@juki-team/base-ui 1.5.16 → 1.5.19

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 (208) hide show
  1. package/dist/esm/ArrowForwardIcon-B_e3QWhU.js +1 -0
  2. package/dist/esm/BarChart-BvTDut5Q.js +1 -0
  3. package/dist/esm/{CartesianChart-cNl_tqN9.js → CartesianChart-DXJUzdHO.js} +6 -6
  4. package/dist/esm/ChangePasswordModal-CWpZcVtX.js +1 -0
  5. package/dist/esm/CodeEditor-Y_Y_KGwk.js +1 -0
  6. package/dist/esm/CodeViewer-0wZyL6Bq.js +1 -0
  7. package/dist/esm/Collapse-B1DPGlnv.js +1 -0
  8. package/dist/esm/{DataGrid-Bu-7Atkf.js → DataGrid-D3ZzYM2h.js} +1 -1
  9. package/dist/esm/DataViewer-BfSurhEG.js +1 -0
  10. package/dist/esm/DrawerView-DSBtwsMA.js +1 -0
  11. package/dist/esm/ExcalidrawButton-yv6E00bG.js +1 -0
  12. package/dist/esm/GraphvizViewer-DakATts5.js +1 -0
  13. package/dist/esm/ImageLoaderCropper-C8OKbFOn.js +1 -0
  14. package/dist/esm/InputCellPhoneNumber-BEXEJTBK.js +1 -0
  15. package/dist/esm/InputColor-CbPh2iDK.js +14 -0
  16. package/dist/esm/LineChart-COzz604R.js +1 -0
  17. package/dist/esm/LoaderLayer-CWElgcGs.js +1 -0
  18. package/dist/esm/MdMath-DtFnLyF6.js +1 -0
  19. package/dist/esm/MdMathEditor-MfrmiBkf.js +28 -0
  20. package/dist/esm/{Popover-C0pozkRR.js → Popover-rAcowqkt.js} +1 -1
  21. package/dist/esm/ReplyIcon-D3OGXdpv.js +1 -0
  22. package/dist/esm/SettingsIcon-W2HrGsHn.js +1 -0
  23. package/dist/esm/SlideDeck-BNzpTHHg.js +1 -0
  24. package/dist/esm/TableEyeIcon-cEB6wzrG.js +1 -0
  25. package/dist/esm/TableOfContents-BReKKYKJ.js +1 -0
  26. package/dist/esm/Tooltip-RM4-Vd-G.js +1 -0
  27. package/dist/esm/UserCodeEditor-BCEc8t_t.js +61 -0
  28. package/dist/esm/VirtualizedRowsFixed-CJ-W5Lx9.js +1 -0
  29. package/dist/esm/WorksheetAsSlides-B11okTdK.js +1 -0
  30. package/dist/esm/WorksheetBodies-d_OdcX-s.js +1 -0
  31. package/dist/esm/WorksheetContents-BTVure1H.js +1 -0
  32. package/dist/esm/WorksheetEditor-EvB90uEy.js +1 -0
  33. package/dist/esm/WorksheetNode-Bi_SPWLG.js +1 -0
  34. package/dist/esm/WorksheetViewer-bf0RET7d.js +1 -0
  35. package/dist/esm/abnfDiagram-WEYOIA3C-DUulIW8V.js +1 -0
  36. package/dist/esm/{arc-CVDK40Ip.js → arc-DFzzPj4i.js} +1 -1
  37. package/dist/esm/architectureDiagram-ZHVYKT53-CgOYCH5f.js +1 -0
  38. package/dist/esm/blockDiagram-RJAE7QA3-Dx--ga4x.js +1 -0
  39. package/dist/esm/c4Diagram-XDPPPE54-COXzepKB.js +1 -0
  40. package/dist/esm/channel-_i3jSBTX.js +1 -0
  41. package/dist/esm/{chunk-2E7WHVMD-CDFgC3vV.js → chunk-2E7WHVMD-DVZL7NAY.js} +1 -1
  42. package/dist/esm/{chunk-2Q5K7J3B-kc9wbXRi.js → chunk-2Q5K7J3B-eykHmSYq.js} +1 -1
  43. package/dist/esm/{chunk-4EMNKR2T-BOCYiV20.js → chunk-4EMNKR2T-BiH2YqCm.js} +1 -1
  44. package/dist/esm/{chunk-55XCU76K-B9fq0Aas.js → chunk-55XCU76K-DkZ5SylO.js} +1 -1
  45. package/dist/esm/{chunk-5VM5RSS4-BiSpRiw9.js → chunk-5VM5RSS4-od-ppdXO.js} +1 -1
  46. package/dist/esm/{chunk-JWPE2WC7-fUi3mFpq.js → chunk-JWPE2WC7-Ban7escN.js} +1 -1
  47. package/dist/esm/{chunk-NQOKRVIF-9yhnn9l0.js → chunk-NQOKRVIF-DFUjH0uz.js} +1 -1
  48. package/dist/esm/{chunk-VQ5W62QI-k74sEYFL.js → chunk-VQ5W62QI-8RFxNRa_.js} +1 -1
  49. package/dist/esm/{chunk-XXDRQBXY-DJJHL2aw.js → chunk-XXDRQBXY-BLNKkmc0.js} +1 -1
  50. package/dist/esm/{chunk-ZCHMQSOR-DZxET8Hs.js → chunk-ZCHMQSOR-BhhsuCkN.js} +1 -1
  51. package/dist/esm/classDiagram-v2-4MYWR3UA-CeKl1zzm.js +1 -0
  52. package/dist/esm/commons-C-9EFvh4.js +1 -0
  53. package/dist/esm/constants.js +1 -1
  54. package/dist/esm/cose-bilkent-JH36ORCC-DM7-KVzj.js +1 -0
  55. package/dist/esm/cynefinDiagram-WF24UDRP-Cbf70uGf.js +1 -0
  56. package/dist/esm/dagre-NK4GIZVX-WvANG2YF.js +1 -0
  57. package/dist/esm/diagram-CBK3MWTC-czBpYiMW.js +1 -0
  58. package/dist/esm/diagram-I5XIIV2D-D0K29cS6.js +1 -0
  59. package/dist/esm/diagram-ODIL2UCW-DJOtGvRy.js +1 -0
  60. package/dist/esm/diagram-PFBEJUXE-Bb7d4gy5.js +1 -0
  61. package/dist/esm/diagram-RJA3I4VV-766WDxVQ.js +1 -0
  62. package/dist/esm/diagram-TYUNFSNR-jxQ7Yf7F.js +1 -0
  63. package/dist/esm/ebnfDiagram-V4P3TTPT-CmQb2zv4.js +1 -0
  64. package/dist/esm/elk-QONTBCTQ-ed5QeBRk.js +1 -0
  65. package/dist/esm/enums.js +1 -1
  66. package/dist/esm/erDiagram-KYQIGQAA-DeToaAJo.js +1 -0
  67. package/dist/esm/{floating-ui.dom-DGDCR4EF.js → floating-ui.dom-DpXpy_9C.js} +1 -1
  68. package/dist/esm/flowDiagram-IUGLLWBU-XbuBBhyN.js +1 -0
  69. package/dist/esm/ganttDiagram-R7GPNTJY-DFWpMgXx.js +1 -0
  70. package/dist/esm/gitGraphDiagram-PDYL7XHY-CoobcIfr.js +1 -0
  71. package/dist/esm/helpers.js +1 -1
  72. package/dist/esm/index-B--41Rgp.js +1 -0
  73. package/dist/esm/{index-mLZqgXD7.js → index-BBCZJE-R.js} +1 -1
  74. package/dist/esm/index-BlaxEeMl.js +1 -0
  75. package/dist/esm/{index-CffiBbeH.js → index-CB1wz24Q.js} +1 -1
  76. package/dist/esm/{index-DWLuqDsD.js → index-CJ0mP3Zm.js} +1 -1
  77. package/dist/esm/{index-CmWQEzQl.js → index-CWCIYdOV.js} +1 -1
  78. package/dist/esm/{index-DBWowQHL.js → index-C_OMDe9Q.js} +1 -1
  79. package/dist/esm/{index-nNMK7HvL.js → index-CqbF_7wB.js} +1 -1
  80. package/dist/esm/index-D1LsGPMS.js +1 -0
  81. package/dist/esm/{index-CHgqN-d9.js → index-D2XW0y_s.js} +1 -1
  82. package/dist/esm/{index-BDQ8194g.js → index-D5f1dQka.js} +1 -1
  83. package/dist/esm/{index-CJtYjUlf.js → index-DBdTqY1b.js} +1 -1
  84. package/dist/esm/{index-CHVYA2P8.js → index-Dn0pnDCC.js} +1 -1
  85. package/dist/esm/index-DpobNvg5.js +1 -0
  86. package/dist/esm/index-Zvckkvpn.js +1 -0
  87. package/dist/esm/{index-BS7YTgMe.js → index-kHWDzZEv.js} +1 -1
  88. package/dist/esm/infoDiagram-MVDRKAX5-BrsWRbGW.js +1 -0
  89. package/dist/esm/ishikawaDiagram-HPEHV2GE-BAmx-YEw.js +1 -0
  90. package/dist/esm/journeyDiagram-BOSHW7O7-CnBSpLoa.js +1 -0
  91. package/dist/esm/kanban-definition-FNSA4HC5-4yCo11oy.js +1 -0
  92. package/dist/esm/{linear-CIPQsvV7.js → linear-BCwRtKK9.js} +1 -1
  93. package/dist/esm/main.js +1 -1
  94. package/dist/esm/mermaid.core-Dj1WAzSy.js +5 -0
  95. package/dist/esm/mindmap-definition-6OY57UG3-Bd4Y4GbF.js +1 -0
  96. package/dist/esm/pegDiagram-ECIUJNBX-CK56FMnc.js +1 -0
  97. package/dist/esm/pieDiagram-GNMPY74T-BJ1Np7Iw.js +1 -0
  98. package/dist/esm/quadrantDiagram-D57K4MC3-tOVWqHZx.js +1 -0
  99. package/dist/esm/railroadDiagram-Y72NRBL7-BvwPAju5.js +1 -0
  100. package/dist/esm/requirementDiagram-EQYSW5RA-D7P8RO2c.js +1 -0
  101. package/dist/esm/sankeyDiagram-SY24JHO5-Hasf32Sf.js +1 -0
  102. package/dist/esm/sequenceDiagram-BLEHNHQU-CVjBG1oF.js +1 -0
  103. package/dist/esm/server.js +1 -1
  104. package/dist/esm/settings-DzQM72QE.js +1 -0
  105. package/dist/esm/settings.js +1 -1
  106. package/dist/esm/sizeCapture-INFHLROL-CiSMSiOI.js +1 -0
  107. package/dist/esm/stateDiagram-v2-A6IESKWZ-z0hJGPOR.js +1 -0
  108. package/dist/esm/swimlanes-B3ENRKFQ-CBNFNgNt.js +1 -0
  109. package/dist/esm/swimlanesDiagram-AYQRV4AK-Bf9aZNHn.js +1 -0
  110. package/dist/esm/{throttle-tEKq3i9o.js → throttle-DvoLRXRs.js} +1 -1
  111. package/dist/esm/{time-DP3lbwAd.js → time-2Ms6XNBq.js} +1 -1
  112. package/dist/esm/timeline-definition-JXYKGLGB-Cug_uWko.js +1 -0
  113. package/dist/esm/{types-C6dLWyzP.js → types-DIz4kTf7.js} +1 -1
  114. package/dist/esm/usecaseDiagram-WPOLBNNX-DvMBgn3t.js +1 -0
  115. package/dist/esm/vennDiagram-Q3Y3IDCW-BkU3qp5r.js +1 -0
  116. package/dist/esm/wardleyDiagram-IVAIDKWA-BgQww2R8.js +1 -0
  117. package/dist/esm/websocket-Cz_aqdkJ.js +1 -0
  118. package/dist/esm/worksheet-CKlbZOJI.js +1 -0
  119. package/dist/esm/worksheet-Tio8jHyw.js +1 -0
  120. package/dist/esm/xychartDiagram-4URNHDU4-Dk_dIDtn.js +1 -0
  121. package/dist/module-types/src/components/molecules/_lazy_/CodeEditor/codemirror/types.d.ts +7 -1
  122. package/dist/module-types/src/components/types/index.d.ts +5 -0
  123. package/dist/module-types/src/enums/index.d.ts +1 -1
  124. package/dist/module-types/src/stores/websocket/topicChannels.d.ts +1 -1
  125. package/package.json +2 -2
  126. package/src/styles/components/atoms/_menu.scss +25 -13
  127. package/dist/esm/ArrowForwardIcon-BIC54sbk.js +0 -1
  128. package/dist/esm/BarChart-54h6GU3p.js +0 -1
  129. package/dist/esm/ChangePasswordModal-DGIG264-.js +0 -1
  130. package/dist/esm/CodeEditor-C5-1AgZR.js +0 -1
  131. package/dist/esm/CodeViewer-CQrzGpJT.js +0 -1
  132. package/dist/esm/Collapse-Cx9QTKZD.js +0 -1
  133. package/dist/esm/DataViewer-Cv0iOPJ_.js +0 -1
  134. package/dist/esm/DrawerView-Cbw3l2O7.js +0 -1
  135. package/dist/esm/ExcalidrawButton-zJFah1nC.js +0 -1
  136. package/dist/esm/GraphvizViewer-DsTGulG0.js +0 -1
  137. package/dist/esm/ImageLoaderCropper-Bk1LxSbD.js +0 -1
  138. package/dist/esm/InputCellPhoneNumber-BaFBGcAe.js +0 -1
  139. package/dist/esm/InputColor-DhUlWGSD.js +0 -14
  140. package/dist/esm/LineChart-BQ1UY4l8.js +0 -1
  141. package/dist/esm/LoaderLayer-aKmuHFys.js +0 -1
  142. package/dist/esm/MdMath-DvH_O_A3.js +0 -1
  143. package/dist/esm/MdMathEditor-4-bjr11C.js +0 -29
  144. package/dist/esm/ReplyIcon-DFPc1kie.js +0 -1
  145. package/dist/esm/SettingsIcon-P_1rE3U0.js +0 -1
  146. package/dist/esm/SlideDeck-0cxhxG3b.js +0 -1
  147. package/dist/esm/TableEyeIcon-5qDbI7lU.js +0 -1
  148. package/dist/esm/TableOfContents-DG7lfEl8.js +0 -1
  149. package/dist/esm/Tooltip-OI-qyixa.js +0 -1
  150. package/dist/esm/UserCodeEditor-XI5CMxYI.js +0 -61
  151. package/dist/esm/VirtualizedRowsFixed-DH6WrMq1.js +0 -1
  152. package/dist/esm/WorksheetAsSlides-vK1Nqrlr.js +0 -1
  153. package/dist/esm/WorksheetBodies-AupmhX--.js +0 -1
  154. package/dist/esm/WorksheetContents-RcU2Wigz.js +0 -1
  155. package/dist/esm/WorksheetEditor-BExsBWi8.js +0 -1
  156. package/dist/esm/WorksheetNode-BTU0R61c.js +0 -1
  157. package/dist/esm/WorksheetViewer-Bn_SoOic.js +0 -1
  158. package/dist/esm/abnfDiagram-WEYOIA3C-Dpw6XMB5.js +0 -1
  159. package/dist/esm/architectureDiagram-ZHVYKT53-CwRCJS-f.js +0 -1
  160. package/dist/esm/blockDiagram-RJAE7QA3-BsveJL2h.js +0 -1
  161. package/dist/esm/c4Diagram-XDPPPE54-DT_YwSdM.js +0 -1
  162. package/dist/esm/channel-DfU2WyO4.js +0 -1
  163. package/dist/esm/classDiagram-v2-4MYWR3UA-Ccw8sMnD.js +0 -1
  164. package/dist/esm/commons-Bam9oxAR.js +0 -1
  165. package/dist/esm/cose-bilkent-JH36ORCC-iT9n9qMD.js +0 -1
  166. package/dist/esm/cynefinDiagram-WF24UDRP-COkkadSX.js +0 -1
  167. package/dist/esm/dagre-NK4GIZVX-B2jYnU0Q.js +0 -1
  168. package/dist/esm/diagram-CBK3MWTC-DzCzOobH.js +0 -1
  169. package/dist/esm/diagram-I5XIIV2D-ChGPyzwT.js +0 -1
  170. package/dist/esm/diagram-ODIL2UCW-_jTs4ZGf.js +0 -1
  171. package/dist/esm/diagram-PFBEJUXE-C66lVsSz.js +0 -1
  172. package/dist/esm/diagram-RJA3I4VV-QELSA6fF.js +0 -1
  173. package/dist/esm/diagram-TYUNFSNR-Be-cdxPq.js +0 -1
  174. package/dist/esm/ebnfDiagram-V4P3TTPT-Cr1EANnv.js +0 -1
  175. package/dist/esm/elk-QONTBCTQ-CqfCbAWo.js +0 -1
  176. package/dist/esm/erDiagram-KYQIGQAA-DMgweTFG.js +0 -1
  177. package/dist/esm/flowDiagram-IUGLLWBU-B4pY13UK.js +0 -1
  178. package/dist/esm/ganttDiagram-R7GPNTJY-YkRR1QZl.js +0 -1
  179. package/dist/esm/gitGraphDiagram-PDYL7XHY-BuhZy85T.js +0 -1
  180. package/dist/esm/index-CTKRTL8i.js +0 -1
  181. package/dist/esm/index-DU7OAICx.js +0 -1
  182. package/dist/esm/index-c3o5xJQl.js +0 -1
  183. package/dist/esm/index-w_leOmyv.js +0 -1
  184. package/dist/esm/infoDiagram-MVDRKAX5-CfqZ5lu9.js +0 -1
  185. package/dist/esm/ishikawaDiagram-HPEHV2GE-fwZw1vDt.js +0 -1
  186. package/dist/esm/journeyDiagram-BOSHW7O7-CJ0qr25S.js +0 -1
  187. package/dist/esm/kanban-definition-FNSA4HC5-D467uQkY.js +0 -1
  188. package/dist/esm/mermaid.core-QEjDbduh.js +0 -5
  189. package/dist/esm/mindmap-definition-6OY57UG3-BLQmSwVy.js +0 -1
  190. package/dist/esm/pegDiagram-ECIUJNBX-BD9B5ipu.js +0 -1
  191. package/dist/esm/pieDiagram-GNMPY74T-ALgTthPz.js +0 -1
  192. package/dist/esm/quadrantDiagram-D57K4MC3-DvM56mui.js +0 -1
  193. package/dist/esm/railroadDiagram-Y72NRBL7-Bbmv8kBV.js +0 -1
  194. package/dist/esm/requirementDiagram-EQYSW5RA-B2-FtMv8.js +0 -1
  195. package/dist/esm/sankeyDiagram-SY24JHO5-a4Tjq4bh.js +0 -1
  196. package/dist/esm/sequenceDiagram-BLEHNHQU-D51n1e3_.js +0 -1
  197. package/dist/esm/settings-Cd8fftVp.js +0 -1
  198. package/dist/esm/sizeCapture-INFHLROL-EvtR_ZF3.js +0 -1
  199. package/dist/esm/stateDiagram-v2-A6IESKWZ-Dy_vLRVL.js +0 -1
  200. package/dist/esm/swimlanes-B3ENRKFQ-0pqT2-Jw.js +0 -1
  201. package/dist/esm/swimlanesDiagram-AYQRV4AK-COayinaD.js +0 -1
  202. package/dist/esm/timeline-definition-JXYKGLGB-DFhOynr-.js +0 -1
  203. package/dist/esm/usecaseDiagram-WPOLBNNX-MTVBbHK8.js +0 -1
  204. package/dist/esm/vennDiagram-Q3Y3IDCW-CgaIfPfv.js +0 -1
  205. package/dist/esm/wardleyDiagram-IVAIDKWA-CEQzSAI4.js +0 -1
  206. package/dist/esm/websocket-BppBoZUJ.js +0 -1
  207. package/dist/esm/worksheet-CQgex79V.js +0 -1
  208. package/dist/esm/xychartDiagram-4URNHDU4-BQJJ7mH2.js +0 -1
@@ -0,0 +1,28 @@
1
+ import{jsx as e,jsxs as t}from"react/jsx-runtime";import{W as n,X as r,g as o,L as i,Y as s,Z as a,E as l,G as c,_ as d,z as u,$ as h,a0 as p,a1 as f,a2 as m,a3 as g,a4 as v,a5 as y,a6 as w,a7 as b,a8 as x,a9 as k,U as C,aa as S,ab as M,ac as N,ad as E,ae as O,af as A,ag as T,ah as D,ai as I,aj as _,ak as R,Q as L,K as B,M as P}from"./basic-setup-DtpgwOSH.js";import{h as z,i as j,j as V,l as $,p as H,z as q,m as F,u as W,r as U,v as G,S as K,g as J,d as Z,c as Y,C as X,k as Q}from"./types-DIz4kTf7.js";import ee,{useRef as te,useState as ne,useMemo as re,createContext as oe,useContext as ie,useCallback as se,useLayoutEffect as ae,useEffect as le,forwardRef as ce,useImperativeHandle as de,memo as ue}from"react";import{a as he,af as pe,e as fe,l as me,aK as ge,T as ve,aL as ye,az as we,aM as be}from"./index-D1LsGPMS.js";import{c as xe,d as ke}from"./commons-C-9EFvh4.js";import{S as Ce,l as Se,C as Me}from"./settings-DzQM72QE.js";import"./enums.js";import{P as Ne,T as Ee,v as Oe}from"./index-Zvckkvpn.js";import{L as Ae,s as Te,m as De,f as Ie}from"./LoaderLayer-CWElgcGs.js";import"motion/react";import"react-dom";import"swr";import{c as _e}from"./clsx-BeLtu-UY.js";import{B as Re,bj as Le}from"./mermaid.core-Dj1WAzSy.js";import{c as Be,f as Pe,o as ze,s as je,a as Ve}from"./floating-ui.dom-DpXpy_9C.js";import{t as $e,d as He}from"./throttle-DvoLRXRs.js";import{i as qe,g as Fe,F as We}from"./isSymbol-D2gNAbOe.js";import{b as Ue,c as Ge}from"./toNumber-B6ypue5Z.js";import{i as Ke}from"./viz-BmmZnl4P.js";import{y as Je}from"./websocket-Cz_aqdkJ.js";import"./index-DpobNvg5.js";import"@ably/spaces";import"@ably/spaces/react";import"ably";import"ably/liveobjects";import"@ably/spaces/dist/mjs/react";import"./string-DPJhNSkw.js";import"./floating-ui.core-DzsaFWsC.js";const Ze={}.hasOwnProperty;function Ye(e,t){let n,r=-1;if(t.extensions)for(;++r<t.extensions.length;)Ye(e,t.extensions[r]);for(n in t)if(Ze.call(t,n))switch(n){case"extensions":break;case"unsafe":case"join":Xe(e[n],t[n]);break;case"handlers":Qe(e[n],t[n]);break;default:e.options[n]=t[n]}return e}function Xe(e,t){t&&e.push(...t)}function Qe(e,t){t&&Object.assign(e,t)}const et=[function(e,t,n,r){if("code"===t.type&&z(t,r)&&("list"===e.type||e.type===t.type&&z(e,r)))return!1;if("spread"in n&&"boolean"==typeof n.spread){if("paragraph"===e.type&&(e.type===t.type||"definition"===t.type||"heading"===t.type&&j(t,r)))return;return n.spread?1:0}}];const tt=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"],nt=[{character:"\t",after:"[\\r\\n]",inConstruct:"phrasing"},{character:"\t",before:"[\\r\\n]",inConstruct:"phrasing"},{character:"\t",inConstruct:["codeFencedLangGraveAccent","codeFencedLangTilde"]},{character:"\r",inConstruct:["codeFencedLangGraveAccent","codeFencedLangTilde","codeFencedMetaGraveAccent","codeFencedMetaTilde","destinationLiteral","headingAtx"]},{character:"\n",inConstruct:["codeFencedLangGraveAccent","codeFencedLangTilde","codeFencedMetaGraveAccent","codeFencedMetaTilde","destinationLiteral","headingAtx"]},{character:" ",after:"[\\r\\n]",inConstruct:"phrasing"},{character:" ",before:"[\\r\\n]",inConstruct:"phrasing"},{character:" ",inConstruct:["codeFencedLangGraveAccent","codeFencedLangTilde"]},{character:"!",after:"\\[",inConstruct:"phrasing",notInConstruct:tt},{character:'"',inConstruct:"titleQuote"},{atBreak:!0,character:"#"},{character:"#",inConstruct:"headingAtx",after:"(?:[\r\n]|$)"},{character:"&",after:"[#A-Za-z]",inConstruct:"phrasing"},{character:"'",inConstruct:"titleApostrophe"},{character:"(",inConstruct:"destinationRaw"},{before:"\\]",character:"(",inConstruct:"phrasing",notInConstruct:tt},{atBreak:!0,before:"\\d+",character:")"},{character:")",inConstruct:"destinationRaw"},{atBreak:!0,character:"*",after:"(?:[ \t\r\n*])"},{character:"*",inConstruct:"phrasing",notInConstruct:tt},{atBreak:!0,character:"+",after:"(?:[ \t\r\n])"},{atBreak:!0,character:"-",after:"(?:[ \t\r\n-])"},{atBreak:!0,before:"\\d+",character:".",after:"(?:[ \t\r\n]|$)"},{atBreak:!0,character:"<",after:"[!/?A-Za-z]"},{character:"<",after:"[!/?A-Za-z]",inConstruct:"phrasing",notInConstruct:tt},{character:"<",inConstruct:"destinationLiteral"},{atBreak:!0,character:"="},{atBreak:!0,character:">"},{character:">",inConstruct:"destinationLiteral"},{atBreak:!0,character:"["},{character:"[",inConstruct:"phrasing",notInConstruct:tt},{character:"[",inConstruct:["label","reference"]},{character:"\\",after:"[\\r\\n]",inConstruct:"phrasing"},{character:"]",inConstruct:["label","reference"]},{atBreak:!0,character:"_"},{character:"_",inConstruct:"phrasing",notInConstruct:tt},{atBreak:!0,character:"`"},{character:"`",inConstruct:["codeFencedLangGraveAccent","codeFencedMetaGraveAccent"]},{character:"`",inConstruct:"phrasing",notInConstruct:tt},{atBreak:!0,character:"~"}];function rt(e){return e.label||!e.identifier?e.label||"":V(e.identifier)}function ot(e){if(!e._compiled){const t=(e.atBreak?"[\\r\\n][\\t ]*":"")+(e.before?"(?:"+e.before+")":"");e._compiled=new RegExp((t?"("+t+")":"")+(/[|\\{}()[\]^$+*?.-]/.test(e.character)?"\\":"")+e.character+(e.after?"(?:"+e.after+")":""),"g")}return e._compiled}function it(e,t,n,r){let o=r.join.length;for(;o--;){const i=r.join[o](e,t,n,r);if(!0===i||1===i)break;if("number"==typeof i)return"\n".repeat(1+i);if(!1===i)return"\n\n\x3c!----\x3e\n\n"}return"\n\n"}const st=/\r?\n|\r/g;function at(e,t){const n=[];let r,o=0,i=0;for(;r=st.exec(e);)s(e.slice(o,r.index)),n.push(r[0]),o=r.index+r[0].length,i++;return s(e.slice(o)),n.join("");function s(e){n.push(t(e,i,!e))}}function lt(e,t){return e-t}function ct(e,t){const n=/\\(?=[!-/:-@[-`{-~])/g,r=[],o=[],i=e+t;let s,a=-1,l=0;for(;s=n.exec(i);)r.push(s.index);for(;++a<r.length;)l!==r[a]&&o.push(e.slice(l,r[a])),o.push("\\"),l=r[a];return o.push(e.slice(l)),o.join("")}function dt(e){const t=e||{},n=t.now||{};let r=t.lineShift||0,o=n.line||1,i=n.column||1;return{move:function(e){const t=e||"",n=t.split(/\r?\n|\r/g),s=n[n.length-1];return o+=n.length-1,i=1===n.length?i+s.length:1+s.length+r,t},current:function(){return{now:{line:o,column:i},lineShift:r}},shift:function(e){r+=e}}}function ut(e,t){const n={associationId:rt,containerPhrasing:mt,containerFlow:gt,createTracker:dt,compilePattern:ot,enter:function(e){return n.stack.push(e),function(){n.stack.pop()}},handlers:{...F},handle:void 0,indentLines:at,indexStack:[],join:[...et],options:{},safe:vt,stack:[],unsafe:[...nt]};Ye(n,t||{}),n.options.tightDefinitions&&n.join.push(ft),n.handle=q("type",{invalid:ht,unknown:pt,handlers:n.handlers});let r=n.handle(e,void 0,n,{before:"\n",after:"\n",now:{line:1,column:1},lineShift:0});return r&&10!==r.charCodeAt(r.length-1)&&13!==r.charCodeAt(r.length-1)&&(r+="\n"),r}function ht(e){throw new Error("Cannot handle value `"+e+"`, expected node")}function pt(e){throw new Error("Cannot handle unknown node `"+e.type+"`")}function ft(e,t){if("definition"===e.type&&e.type===t.type)return 0}function mt(e,t){return function(e,t,n){const r=t.indexStack,o=e.children||[],i=[];let s,a=-1,l=n.before;r.push(-1);let c=t.createTracker(n);for(;++a<o.length;){const d=o[a];let u;if(r[r.length-1]=a,a+1<o.length){let n=t.handle.handlers[o[a+1].type];n&&n.peek&&(n=n.peek),u=n?n(o[a+1],e,t,{before:"",after:"",...c.current()}).charAt(0):""}else u=n.after;i.length>0&&("\r"===l||"\n"===l)&&"html"===d.type&&(i[i.length-1]=i[i.length-1].replace(/(\r?\n|\r)$/," "),l=" ",c=t.createTracker(n),c.move(i.join("")));let h=t.handle(d,e,t,{...c.current(),after:u,before:l});s&&s===h.slice(0,1)&&(h=$(s.charCodeAt(0))+h.slice(1));const p=t.attentionEncodeSurroundingInfo;t.attentionEncodeSurroundingInfo=void 0,s=void 0,p&&(i.length>0&&p.before&&l===i[i.length-1].slice(-1)&&(i[i.length-1]=i[i.length-1].slice(0,-1)+$(l.charCodeAt(0))),p.after&&(s=u)),c.move(h),i.push(h),l=h.slice(-1)}return r.pop(),i.join("")}(e,this,t)}function gt(e,t){return function(e,t,n){const r=t.indexStack,o=e.children||[],i=t.createTracker(n),s=[];let a=-1;for(r.push(-1);++a<o.length;){const n=o[a];r[r.length-1]=a,s.push(i.move(t.handle(n,e,t,{before:"\n",after:"\n",...i.current()}))),"list"!==n.type&&(t.bulletLastUsed=void 0),a<o.length-1&&s.push(i.move(it(n,o[a+1],e,t)))}return r.pop(),s.join("")}(e,this,t)}function vt(e,t){return function(e,t,n){const r=(n.before||"")+(t||"")+(n.after||""),o=[],i=[],s={};let a=-1;for(;++a<e.unsafe.length;){const t=e.unsafe[a];if(!H(e.stack,t))continue;const n=e.compilePattern(t);let i;for(;i=n.exec(r);){const e="before"in t||Boolean(t.atBreak),n="after"in t,r=i.index+(e?i[1].length:0);o.includes(r)?(s[r].before&&!e&&(s[r].before=!1),s[r].after&&!n&&(s[r].after=!1)):(o.push(r),s[r]={before:e,after:n})}}o.sort(lt);let l=n.before?n.before.length:0;const c=r.length-(n.after?n.after.length:0);for(a=-1;++a<o.length;){const e=o[a];e<l||e>=c||e+1<c&&o[a+1]===e+1&&s[e].after&&!s[e+1].before&&!s[e+1].after||o[a-1]===e-1&&s[e].before&&!s[e-1].before&&!s[e-1].after||(l!==e&&i.push(ct(r.slice(l,e),"\\")),l=e,!/[!-/:-@[-`{-~]/.test(r.charAt(e))||n.encode&&n.encode.includes(r.charAt(e))?(i.push($(r.charCodeAt(e))),l++):i.push("\\"))}return i.push(ct(r.slice(l,c),n.after)),i.join("")}(this,e,t)}var yt=function(e){return e.docTypeError="docTypeError",e.contextNotFound="contextNotFound",e.timerNotFound="timerNotFound",e.ctxCallOutOfScope="ctxCallOutOfScope",e.createNodeInParserFail="createNodeInParserFail",e.stackOverFlow="stackOverFlow",e.parserMatchError="parserMatchError",e.serializerMatchError="serializerMatchError",e.getAtomFromSchemaFail="getAtomFromSchemaFail",e.expectDomTypeError="expectDomTypeError",e.callCommandBeforeEditorView="callCommandBeforeEditorView",e.missingRootElement="missingRootElement",e.missingNodeInSchema="missingNodeInSchema",e.missingMarkInSchema="missingMarkInSchema",e.ctxNotBind="ctxNotBind",e.missingYjsDoc="missingYjsDoc",e.aiProviderError="aiProviderError",e.aiBuildContextError="aiBuildContextError",e}({}),wt=class extends Error{constructor(e,t,n){super(t,n),this.name="MilkdownError",this.code=e,void 0!==n?.cause&&(this.cause=n.cause)}},bt=(e,t)=>"function"==typeof t?"[Function]":t,xt=e=>JSON.stringify(e,bt);function kt(){return new wt(yt.ctxCallOutOfScope,"Should not call a context out of the plugin.")}function Ct(){return new wt(yt.stackOverFlow,"Stack over flow, cannot pop on an empty stack.")}function St(e){return new wt(yt.expectDomTypeError,`Expect to be a dom, but get: ${xt(e)}.`)}function Mt(){return new wt(yt.callCommandBeforeEditorView,"You're trying to call a command before editor view initialized, make sure to get commandManager from ctx after editor view has been initialized")}function Nt(e){return new wt(yt.missingNodeInSchema,`Missing node in schema, milkdown cannot find "${e}" in schema.`)}function Et(e){try{return xt(e)}catch{return"[Unserializable]"}}var Ot=class{constructor(){this.sliceMap=new Map,this.get=e=>{const t="string"==typeof e?[...this.sliceMap.values()].find(t=>t.type.name===e):this.sliceMap.get(e.id);if(!t){throw function(e){return new wt(yt.contextNotFound,`Context "${e}" not found, do you forget to inject it?`)}("string"==typeof e?e:e.name)}return t},this.remove=e=>{const t="string"==typeof e?[...this.sliceMap.values()].find(t=>t.type.name===e):this.sliceMap.get(e.id);t&&this.sliceMap.delete(t.type.id)},this.has=e=>"string"==typeof e?[...this.sliceMap.values()].some(t=>t.type.name===e):this.sliceMap.has(e.id)}},At=class{#e;#t;#n;constructor(e,t,n){this.#e=[],this.#n=()=>{this.#e.forEach(e=>e(this.#t))},this.set=e=>{this.#t=e,this.#n()},this.get=()=>this.#t,this.update=e=>{this.#t=e(this.#t),this.#n()},this.type=n,this.#t=t,e.set(n.id,this)}on(e){return this.#e.push(e),()=>{this.#e=this.#e.filter(t=>t!==e)}}once(e){const t=this.on(n=>{e(n),t()});return t}off(e){this.#e=this.#e.filter(t=>t!==e)}offAll(){this.#e=[]}},Tt=class{constructor(e,t){this.id=Symbol(`Context-${t}`),this.name=t,this._defaultValue=e,this._typeInfo=()=>{throw kt()}}create(e,t=this._defaultValue){return new At(e,t,this)}},Dt=(e,t)=>new Tt(e,t),It=class{#r;#o;#i;#s;#a;#l;#c;constructor(e,t,n){this.#s=new Set,this.#a=new Set,this.#l=new Map,this.#c=new Map,this.read=()=>({metadata:this.#r,injectedSlices:[...this.#s].map(e=>({name:"string"==typeof e?e:e.name,value:this.#d(e)})),consumedSlices:[...this.#a].map(e=>({name:"string"==typeof e?e:e.name,value:this.#d(e)})),recordedTimers:[...this.#l].map(([e,{duration:t}])=>({name:e.name,duration:t,status:this.#u(e)})),waitTimers:[...this.#c].map(([e,{duration:t}])=>({name:e.name,duration:t,status:this.#u(e)}))}),this.onRecord=e=>{this.#l.set(e,{start:Date.now(),duration:0})},this.onClear=e=>{this.#l.delete(e)},this.onDone=e=>{const t=this.#l.get(e);t&&(t.duration=Date.now()-t.start)},this.onWait=(e,t)=>{const n=Date.now();t.finally(()=>{this.#c.set(e,{duration:Date.now()-n})}).catch(console.error)},this.onInject=e=>{this.#s.add(e)},this.onRemove=e=>{this.#s.delete(e)},this.onUse=e=>{this.#a.add(e)},this.#d=e=>this.#o.get(e).get(),this.#u=e=>this.#i.get(e).status,this.#o=e,this.#i=t,this.#r=n}#d;#u},_t=class e{#o;#i;#r;#h;constructor(t,n,r){this.produce=t=>t&&Object.keys(t).length?new e(this.#o,this.#i,{...t}):this,this.inject=(e,t)=>{const n=e.create(this.#o.sliceMap);return null!=t&&n.set(t),this.#h?.onInject(e),this},this.remove=e=>(this.#o.remove(e),this.#h?.onRemove(e),this),this.record=e=>(e.create(this.#i.store),this.#h?.onRecord(e),this),this.clearTimer=e=>(this.#i.remove(e),this.#h?.onClear(e),this),this.isInjected=e=>this.#o.has(e),this.isRecorded=e=>this.#i.has(e),this.use=e=>(this.#h?.onUse(e),this.#o.get(e)),this.get=e=>this.use(e).get(),this.set=(e,t)=>this.use(e).set(t),this.update=(e,t)=>this.use(e).update(t),this.timer=e=>this.#i.get(e),this.done=e=>{this.timer(e).done(),this.#h?.onDone(e)},this.wait=e=>{const t=this.timer(e).start();return this.#h?.onWait(e,t),t},this.waitTimers=async e=>{await Promise.all(this.get(e).map(e=>this.wait(e)))},this.#o=t,this.#i=n,this.#r=r,r&&(this.#h=new It(t,n,r))}get meta(){return this.#r}get inspector(){return this.#h}},Rt=class{constructor(){this.store=new Map,this.get=e=>{const t=this.store.get(e.id);if(!t)throw n=e.name,new wt(yt.timerNotFound,`Timer "${n}" not found, do you forget to record it?`);var n;return t},this.remove=e=>{this.store.delete(e.id)},this.has=e=>this.store.has(e.id)}},Lt=class{#p;#f;#m;#g;#v;constructor(e,t){this.#p=null,this.#f=null,this.#g="pending",this.#v=null,this.start=()=>(this.#p??=new Promise((e,t)=>{this.#f=t=>{t instanceof CustomEvent&&t.detail.id===this.#m&&(this.#g="resolved",this.#y(),t.stopImmediatePropagation(),e())},this.#w(()=>{"pending"===this.#g&&(this.#g="rejected"),this.#y(),t(new Error(`Timing ${this.type.name} timeout.`))}),this.#g="pending",addEventListener(this.type.name,this.#f)}),this.#p),this.done=()=>{const e=new CustomEvent(this.type.name,{detail:{id:this.#m}});dispatchEvent(e)},this.#y=()=>{null!==this.#v&&(clearTimeout(this.#v),this.#v=null),this.#f&&removeEventListener(this.type.name,this.#f)},this.#w=e=>{this.#v=setTimeout(()=>{this.#v=null,e()},this.type.timeout)},this.#m=Symbol(t.name),this.type=t,e.set(t.id,this)}get status(){return this.#g}#y;#w},Bt=class{constructor(e,t=3e3){this.create=e=>new Lt(e,this),this.id=Symbol(`Timer-${e}`),this.name=e,this.timeout=t}},Pt=(e,t=3e3)=>new Bt(e,t);function zt(e){const t=this;t.compiler=function(n){return ut(n,{...t.data("settings"),...e,extensions:t.data("toMarkdownExtensions")||[]})}}function jt(e){this.content=e}function Vt(e,t,n){for(let r=0;;r++){if(r==e.childCount||r==t.childCount)return e.childCount==t.childCount?null:n;let o=e.child(r),i=t.child(r);if(o!=i){if(!o.sameMarkup(i))return n;if(o.isText&&o.text!=i.text){let e=o.text,t=i.text,r=0;for(;e[r]==t[r];r++)n++;return r&&r<e.length&&r<t.length&&qt(e.charCodeAt(r-1))&&Ht(e.charCodeAt(r))&&n--,n}if(o.content.size||i.content.size){let e=Vt(o.content,i.content,n+1);if(null!=e)return e}n+=o.nodeSize}else n+=o.nodeSize}}function $t(e,t,n,r){for(let o=e.childCount,i=t.childCount;;){if(0==o||0==i)return o==i?null:{a:n,b:r};let s=e.child(--o),a=t.child(--i),l=s.nodeSize;if(s!=a){if(!s.sameMarkup(a))return{a:n,b:r};if(s.isText&&s.text!=a.text){let e=s.text,t=a.text,o=e.length,i=t.length;for(;o>0&&i>0&&e[o-1]==t[i-1];)o--,i--,n--,r--;return o&&i&&o<e.length&&qt(e.charCodeAt(o-1))&&Ht(e.charCodeAt(o))&&(n++,r++),{a:n,b:r}}if(s.content.size||a.content.size){let e=$t(s.content,a.content,n-1,r-1);if(e)return e}n-=l,r-=l}else n-=l,r-=l}}function Ht(e){return e>=56320&&e<57344}function qt(e){return e>=55296&&e<56320}jt.prototype={constructor:jt,find:function(e){for(var t=0;t<this.content.length;t+=2)if(this.content[t]===e)return t;return-1},get:function(e){var t=this.find(e);return-1==t?void 0:this.content[t+1]},update:function(e,t,n){var r=n&&n!=e?this.remove(n):this,o=r.find(e),i=r.content.slice();return-1==o?i.push(n||e,t):(i[o+1]=t,n&&(i[o]=n)),new jt(i)},remove:function(e){var t=this.find(e);if(-1==t)return this;var n=this.content.slice();return n.splice(t,2),new jt(n)},addToStart:function(e,t){return new jt([e,t].concat(this.remove(e).content))},addToEnd:function(e,t){var n=this.remove(e).content.slice();return n.push(e,t),new jt(n)},addBefore:function(e,t,n){var r=this.remove(t),o=r.content.slice(),i=r.find(e);return o.splice(-1==i?o.length:i,0,t,n),new jt(o)},forEach:function(e){for(var t=0;t<this.content.length;t+=2)e(this.content[t],this.content[t+1])},prepend:function(e){return(e=jt.from(e)).size?new jt(e.content.concat(this.subtract(e).content)):this},append:function(e){return(e=jt.from(e)).size?new jt(this.subtract(e).content.concat(e.content)):this},subtract:function(e){var t=this;e=jt.from(e);for(var n=0;n<e.content.length;n+=2)t=t.remove(e.content[n]);return t},toObject:function(){var e={};return this.forEach(function(t,n){e[t]=n}),e},get size(){return this.content.length>>1}},jt.from=function(e){if(e instanceof jt)return e;var t=[];if(e)for(var n in e)t.push(n,e[n]);return new jt(t)};let Ft=class e{constructor(e,t){if(this.content=e,this.size=t||0,null==t)for(let t=0;t<e.length;t++)this.size+=e[t].nodeSize}nodesBetween(e,t,n,r=0,o){for(let i=0,s=0;s<t;i++){let a=this.content[i],l=s+a.nodeSize;if(l>e&&!1!==n(a,r+s,o||null,i)&&a.content.size){let o=s+1;a.nodesBetween(Math.max(0,e-o),Math.min(a.content.size,t-o),n,r+o)}s=l}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,t,n,r){let o="",i=!0;return this.nodesBetween(e,t,(s,a)=>{let l=s.isText?s.text.slice(Math.max(e,a)-a,t-a):s.isLeaf?r?"function"==typeof r?r(s):r:s.type.spec.leafText?s.type.spec.leafText(s):"":"";s.isBlock&&(s.isLeaf&&l||s.isTextblock)&&n&&(i?i=!1:o+=n),o+=l},0),o}append(t){if(!t.size)return this;if(!this.size)return t;let n=this.lastChild,r=t.firstChild,o=this.content.slice(),i=0;for(n.isText&&n.sameMarkup(r)&&(o[o.length-1]=n.withText(n.text+r.text),i=1);i<t.content.length;i++)o.push(t.content[i]);return new e(o,this.size+t.size)}cut(t,n=this.size){if(0==t&&n==this.size)return this;let r=[],o=0;if(n>t)for(let e=0,i=0;i<n;e++){let s=this.content[e],a=i+s.nodeSize;a>t&&((i<t||a>n)&&(s=s.isText?s.cut(Math.max(0,t-i),Math.min(s.text.length,n-i)):s.cut(Math.max(0,t-i-1),Math.min(s.content.size,n-i-1))),r.push(s),o+=s.nodeSize),i=a}return new e(r,o)}cutByIndex(t,n){return t==n?e.empty:0==t&&n==this.content.length?this:new e(this.content.slice(t,n))}replaceChild(t,n){let r=this.content[t];if(r==n)return this;let o=this.content.slice(),i=this.size+n.nodeSize-r.nodeSize;return o[t]=n,new e(o,i)}addToStart(t){return new e([t].concat(this.content),this.size+t.nodeSize)}addToEnd(t){return new e(this.content.concat(t),this.size+t.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let t=0;t<this.content.length;t++)if(!this.content[t].eq(e.content[t]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(e){let t=this.content[e];if(!t)throw new RangeError("Index "+e+" out of range for "+this);return t}maybeChild(e){return this.content[e]||null}forEach(e){for(let t=0,n=0;t<this.content.length;t++){let r=this.content[t];e(r,n,t),n+=r.nodeSize}}findDiffStart(e,t=0){return Vt(this,e,t)}findDiffEnd(e,t=this.size,n=e.size){return $t(this,e,t,n)}findIndex(e){if(0==e)return Ut(0,e);if(e==this.size)return Ut(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let t=0,n=0;;t++){let r=n+this.child(t).nodeSize;if(r>=e)return r==e?Ut(t+1,r):Ut(t,n);n=r}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(t,n){if(!n)return e.empty;if(!Array.isArray(n))throw new RangeError("Invalid input for Fragment.fromJSON");return e.fromArray(n.map(t.nodeFromJSON))}static fromArray(t){if(!t.length)return e.empty;let n,r=0;for(let e=0;e<t.length;e++){let o=t[e];r+=o.nodeSize,e&&o.isText&&t[e-1].sameMarkup(o)?(n||(n=t.slice(0,e)),n[n.length-1]=o.withText(n[n.length-1].text+o.text)):n&&n.push(o)}return new e(n||t,r)}static from(t){if(!t)return e.empty;if(t instanceof e)return t;if(Array.isArray(t))return this.fromArray(t);if(t.attrs)return new e([t],t.nodeSize);throw new RangeError("Can not convert "+t+" to a Fragment"+(t.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}};Ft.empty=new Ft([],0);const Wt={index:0,offset:0};function Ut(e,t){return Wt.index=e,Wt.offset=t,Wt}function Gt(e,t){if(e===t)return!0;if(!e||"object"!=typeof e||!t||"object"!=typeof t)return!1;let n=Array.isArray(e);if(Array.isArray(t)!=n)return!1;if(n){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(!Gt(e[n],t[n]))return!1}else{for(let n in e)if(!(n in t)||!Gt(e[n],t[n]))return!1;for(let n in t)if(!(n in e))return!1}return!0}class Kt{constructor(e,t){this.type=e,this.attrs=t}addToSet(e){let t,n=!1;for(let r=0;r<e.length;r++){let o=e[r];if(this.eq(o))return e;if(this.type.excludes(o.type))t||(t=e.slice(0,r));else{if(o.type.excludes(this.type))return e;!n&&o.type.rank>this.type.rank&&(t||(t=e.slice(0,r)),t.push(this),n=!0),t&&t.push(o)}}return t||(t=e.slice()),n||t.push(this),t}removeFromSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return e.slice(0,t).concat(e.slice(t+1));return e}isInSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return!0;return!1}eq(e){return this==e||this.type==e.type&&Gt(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,t){if(!t)throw new RangeError("Invalid input for Mark.fromJSON");let n=e.marks[t.type];if(!n)throw new RangeError(`There is no mark type ${t.type} in this schema`);return n.create(t.attrs)}static sameSet(e,t){if(e==t)return!0;if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(!e[n].eq(t[n]))return!1;return!0}static setFrom(e){if(!e||Array.isArray(e)&&0==e.length)return Kt.none;if(e instanceof Kt)return[e];let t=e.slice();return t.sort((e,t)=>e.type.rank-t.type.rank),t}}Kt.none=[];class Jt extends Error{}class Zt{constructor(e,t,n){this.content=e,this.openStart=t,this.openEnd=n}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,t){let n=Xt(this.content,e+this.openStart,t,this.openStart+1,this.openEnd+1);return n&&new Zt(n,this.openStart,this.openEnd)}removeBetween(e,t){return new Zt(Yt(this.content,e+this.openStart,t+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(e,t){if(!t)return Zt.empty;let n=t.openStart||0,r=t.openEnd||0;if("number"!=typeof n||"number"!=typeof r)throw new RangeError("Invalid input for Slice.fromJSON");return new Zt(Ft.fromJSON(e,t.content),n,r)}static maxOpen(e,t=!0){let n=0,r=0;for(let r=e.firstChild;r&&!r.isLeaf&&(t||!r.type.spec.isolating);r=r.firstChild)n++;for(let n=e.lastChild;n&&!n.isLeaf&&(t||!n.type.spec.isolating);n=n.lastChild)r++;return new Zt(e,n,r)}}function Yt(e,t,n){let{index:r,offset:o}=e.findIndex(t),i=e.maybeChild(r),{index:s,offset:a}=e.findIndex(n);if(o==t||i.isText){if(a!=n&&!e.child(s).isText)throw new RangeError("Removing non-flat range");return e.cut(0,t).append(e.cut(n))}if(r!=s)throw new RangeError("Removing non-flat range");return e.replaceChild(r,i.copy(Yt(i.content,t-o-1,n-o-1)))}function Xt(e,t,n,r,o,i){let{index:s,offset:a}=e.findIndex(t),l=e.maybeChild(s);if(a==t||l.isText)return i&&r<=0&&o<=0&&!i.canReplace(s,s,n)?null:e.cut(0,t).append(n).append(e.cut(t));let c=Xt(l.content,t-a-1,n,0==s?r-1:0,s==e.childCount-1?o-1:0,l);return c&&e.replaceChild(s,l.copy(c))}function Qt(e,t,n){if(n.openStart>e.depth)throw new Jt("Inserted content deeper than insertion position");if(e.depth-n.openStart!=t.depth-n.openEnd)throw new Jt("Inconsistent open depths");return en(e,t,n,0)}function en(e,t,n,r){let o=e.index(r),i=e.node(r);if(o==t.index(r)&&r<e.depth-n.openStart){let s=en(e,t,n,r+1);return i.copy(i.content.replaceChild(o,s))}if(n.content.size){if(n.openStart||n.openEnd||e.depth!=r||t.depth!=r){let{start:o,end:s}=function(e,t){let n=t.depth-e.openStart,r=t.node(n).copy(e.content);for(let e=n-1;e>=0;e--)r=t.node(e).copy(Ft.from(r));return{start:r.resolveNoCache(e.openStart+n),end:r.resolveNoCache(r.content.size-e.openEnd-n)}}(n,e);return sn(i,an(e,o,s,t,r))}{let r=e.parent,o=r.content;return sn(r,o.cut(0,e.parentOffset).append(n.content).append(o.cut(t.parentOffset)))}}return sn(i,ln(e,t,r))}function tn(e,t){if(!t.type.compatibleContent(e.type))throw new Jt("Cannot join "+t.type.name+" onto "+e.type.name)}function nn(e,t,n){let r=e.node(n);return tn(r,t.node(n)),r}function rn(e,t){let n=t.length-1;n>=0&&e.isText&&e.sameMarkup(t[n])?t[n]=e.withText(t[n].text+e.text):t.push(e)}function on(e,t,n,r){let o=(t||e).node(n),i=0,s=t?t.index(n):o.childCount;e&&(i=e.index(n),e.depth>n?i++:e.textOffset&&(rn(e.nodeAfter,r),i++));for(let e=i;e<s;e++)rn(o.child(e),r);t&&t.depth==n&&t.textOffset&&rn(t.nodeBefore,r)}function sn(e,t){if(!e.type.validContent(t))throw new Jt("Invalid content for node "+e.type.name);return e.copy(t)}function an(e,t,n,r,o){let i=e.depth>o&&nn(e,t,o+1),s=r.depth>o&&nn(n,r,o+1),a=[];return on(null,e,o,a),i&&s&&t.index(o)==n.index(o)?(tn(i,s),rn(sn(i,an(e,t,n,r,o+1)),a)):(i&&rn(sn(i,ln(e,t,o+1)),a),on(t,n,o,a),s&&rn(sn(s,ln(n,r,o+1)),a)),on(r,null,o,a),new Ft(a)}function ln(e,t,n){let r=[];if(on(null,e,n,r),e.depth>n){rn(sn(nn(e,t,n+1),ln(e,t,n+1)),r)}return on(t,null,n,r),new Ft(r)}Zt.empty=new Zt(Ft.empty,0,0);class cn{constructor(e,t,n){this.pos=e,this.path=t,this.parentOffset=n,this.depth=t.length/3-1}resolveDepth(e){return null==e?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[3*this.resolveDepth(e)]}index(e){return this.path[3*this.resolveDepth(e)+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e!=this.depth||this.textOffset?1:0)}start(e){return 0==(e=this.resolveDepth(e))?0:this.path[3*e-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(!(e=this.resolveDepth(e)))throw new RangeError("There is no position before the top-level node");return e==this.depth+1?this.pos:this.path[3*e-1]}after(e){if(!(e=this.resolveDepth(e)))throw new RangeError("There is no position after the top-level node");return e==this.depth+1?this.pos:this.path[3*e-1]+this.path[3*e].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,t=this.index(this.depth);if(t==e.childCount)return null;let n=this.pos-this.path[this.path.length-1],r=e.child(t);return n?e.child(t).cut(n):r}get nodeBefore(){let e=this.index(this.depth),t=this.pos-this.path[this.path.length-1];return t?this.parent.child(e).cut(0,t):0==e?null:this.parent.child(e-1)}posAtIndex(e,t){t=this.resolveDepth(t);let n=this.path[3*t],r=0==t?0:this.path[3*t-1]+1;for(let t=0;t<e;t++)r+=n.child(t).nodeSize;return r}marks(){let e=this.parent,t=this.index();if(0==e.content.size)return Kt.none;if(this.textOffset)return e.child(t).marks;let n=e.maybeChild(t-1),r=e.maybeChild(t);if(!n){let e=n;n=r,r=e}let o=n.marks;for(var i=0;i<o.length;i++)!1!==o[i].type.spec.inclusive||r&&o[i].isInSet(r.marks)||(o=o[i--].removeFromSet(o));return o}marksAcross(e){let t=this.parent.maybeChild(this.index());if(!t||!t.isInline)return null;let n=t.marks,r=e.parent.maybeChild(e.index());for(var o=0;o<n.length;o++)!1!==n[o].type.spec.inclusive||r&&n[o].isInSet(r.marks)||(n=n[o--].removeFromSet(n));return n}sharedDepth(e){for(let t=this.depth;t>0;t--)if(this.start(t)<=e&&this.end(t)>=e)return t;return 0}blockRange(e=this,t){if(e.pos<this.pos)return e.blockRange(this);for(let n=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);n>=0;n--)if(e.pos<=this.end(n)&&(!t||t(this.node(n))))return new pn(this,e,n);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos<this.pos?e:this}toString(){let e="";for(let t=1;t<=this.depth;t++)e+=(e?"/":"")+this.node(t).type.name+"_"+this.index(t-1);return e+":"+this.parentOffset}static resolve(e,t){if(!(t>=0&&t<=e.content.size))throw new RangeError("Position "+t+" out of range");let n=[],r=0,o=t;for(let t=e;;){let{index:e,offset:i}=t.content.findIndex(o),s=o-i;if(n.push(t,e,r+i),!s)break;if(t=t.child(e),t.isText)break;o=s-1,r+=i+1}return new cn(t,n,o)}static resolveCached(e,t){let n=hn.get(e);if(n)for(let e=0;e<n.elts.length;e++){let r=n.elts[e];if(r.pos==t)return r}else hn.set(e,n=new dn);let r=n.elts[n.i]=cn.resolve(e,t);return n.i=(n.i+1)%un,r}}class dn{constructor(){this.elts=[],this.i=0}}const un=12,hn=new WeakMap;class pn{constructor(e,t,n){this.$from=e,this.$to=t,this.depth=n}get start(){return this.$from.before(this.depth+1)}get end(){return this.$to.after(this.depth+1)}get parent(){return this.$from.node(this.depth)}get startIndex(){return this.$from.index(this.depth)}get endIndex(){return this.$to.indexAfter(this.depth)}}const fn=Object.create(null);class mn{constructor(e,t,n,r=Kt.none){this.type=e,this.attrs=t,this.marks=r,this.content=n||Ft.empty}get children(){return this.content.content}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(e){return this.content.child(e)}maybeChild(e){return this.content.maybeChild(e)}forEach(e){this.content.forEach(e)}nodesBetween(e,t,n,r=0){this.content.nodesBetween(e,t,n,r,this)}descendants(e){this.nodesBetween(0,this.content.size,e)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,"")}textBetween(e,t,n,r){return this.content.textBetween(e,t,n,r)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(e){return this==e||this.sameMarkup(e)&&this.content.eq(e.content)}sameMarkup(e){return this.hasMarkup(e.type,e.attrs,e.marks)}hasMarkup(e,t,n){return this.type==e&&Gt(this.attrs,t||e.defaultAttrs||fn)&&Kt.sameSet(this.marks,n||Kt.none)}copy(e=null){return e==this.content?this:new mn(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new mn(this.type,this.attrs,this.content,e)}cut(e,t=this.content.size){return 0==e&&t==this.content.size?this:this.copy(this.content.cut(e,t))}slice(e,t=this.content.size,n=!1){if(e==t)return Zt.empty;let r=this.resolve(e),o=this.resolve(t),i=n?0:r.sharedDepth(t),s=r.start(i),a=r.node(i).content.cut(r.pos-s,o.pos-s);return new Zt(a,r.depth-i,o.depth-i)}replace(e,t,n){return Qt(this.resolve(e),this.resolve(t),n)}nodeAt(e){for(let t=this;;){let{index:n,offset:r}=t.content.findIndex(e);if(t=t.maybeChild(n),!t)return null;if(r==e||t.isText)return t;e-=r+1}}childAfter(e){let{index:t,offset:n}=this.content.findIndex(e);return{node:this.content.maybeChild(t),index:t,offset:n}}childBefore(e){if(0==e)return{node:null,index:0,offset:0};let{index:t,offset:n}=this.content.findIndex(e);if(n<e)return{node:this.content.child(t),index:t,offset:n};let r=this.content.child(t-1);return{node:r,index:t-1,offset:n-r.nodeSize}}resolve(e){return cn.resolveCached(this,e)}resolveNoCache(e){return cn.resolve(this,e)}rangeHasMark(e,t,n){let r=!1;return t>e&&this.nodesBetween(e,t,e=>(n.isInSet(e.marks)&&(r=!0),!r)),r}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let e=this.type.name;return this.content.size&&(e+="("+this.content.toStringInner()+")"),vn(this.marks,e)}contentMatchAt(e){let t=this.type.contentMatch.matchFragment(this.content,0,e);if(!t)throw new Error("Called contentMatchAt on a node with invalid content");return t}canReplace(e,t,n=Ft.empty,r=0,o=n.childCount){let i=this.contentMatchAt(e).matchFragment(n,r,o),s=i&&i.matchFragment(this.content,t);if(!s||!s.validEnd)return!1;for(let e=r;e<o;e++)if(!this.type.allowsMarks(n.child(e).marks))return!1;return!0}canReplaceWith(e,t,n,r){if(r&&!this.type.allowsMarks(r))return!1;let o=this.contentMatchAt(e).matchType(n),i=o&&o.matchFragment(this.content,t);return!!i&&i.validEnd}canAppend(e){return e.content.size?this.canReplace(this.childCount,this.childCount,e.content):this.type.compatibleContent(e.type)}check(){this.type.checkContent(this.content),yn(this.type.attrs,this.attrs,"node",this.type.name);let e=Kt.none;for(let t=0;t<this.marks.length;t++){let n=this.marks[t];yn(n.type.attrs,n.attrs,"mark",n.type.name),e=n.addToSet(e)}if(!Kt.sameSet(e,this.marks))throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(e=>e.type.name)}`);this.content.forEach(e=>e.check())}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(e=>e.toJSON())),e}static fromJSON(e,t){if(!t)throw new RangeError("Invalid input for Node.fromJSON");let n;if(t.marks){if(!Array.isArray(t.marks))throw new RangeError("Invalid mark data for Node.fromJSON");n=t.marks.map(e.markFromJSON)}if("text"==t.type){if("string"!=typeof t.text)throw new RangeError("Invalid text node in JSON");return e.text(t.text,n)}let r=Ft.fromJSON(e,t.content);return e.nodeType(t.type).create(t.attrs,r,n)}}mn.prototype.text=void 0;let gn=class e extends mn{constructor(e,t,n,r){if(super(e,t,null,r),!n)throw new RangeError("Empty text nodes are not allowed");this.text=n}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):vn(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,t){return this.text.slice(e,t)}get nodeSize(){return this.text.length}mark(t){return t==this.marks?this:new e(this.type,this.attrs,this.text,t)}withText(t){return t==this.text?this:new e(this.type,this.attrs,t,this.marks)}cut(e=0,t=this.text.length){return 0==e&&t==this.text.length?this:this.withText(this.text.slice(e,t))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}};function vn(e,t){for(let n=e.length-1;n>=0;n--)t=e[n].type.name+"("+t+")";return t}function yn(e,t,n,r){for(let o in t)if(!(o in e))throw new RangeError(`Unsupported attribute ${o} for ${n} of type ${r}`);for(let n in e)e[n].validate&&e[n].validate(t[n])}class wn{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,t){let n=new bn(e,t);if(null==n.next)return wn.empty;let r=xn(n);n.next&&n.err("Unexpected trailing text");let o=function(e){let t=Object.create(null);return n(En(e,0));function n(r){let o=[];r.forEach(t=>{e[t].forEach(({term:t,to:n})=>{if(!t)return;let r;for(let e=0;e<o.length;e++)o[e][0]==t&&(r=o[e][1]);En(e,n).forEach(e=>{r||o.push([t,r=[]]),-1==r.indexOf(e)&&r.push(e)})})});let i=t[r.join(",")]=new wn(r.indexOf(e.length-1)>-1);for(let e=0;e<o.length;e++){let r=o[e][1].sort(Nn);i.next.push({type:o[e][0],next:t[r.join(",")]||n(r)})}return i}}(function(e){let t=[[]];return o(i(e,0),n()),t;function n(){return t.push([])-1}function r(e,n,r){let o={term:r,to:n};return t[e].push(o),o}function o(e,t){e.forEach(e=>e.to=t)}function i(e,t){if("choice"==e.type)return e.exprs.reduce((e,n)=>e.concat(i(n,t)),[]);if("seq"!=e.type){if("star"==e.type){let s=n();return r(t,s),o(i(e.expr,s),s),[r(s)]}if("plus"==e.type){let s=n();return o(i(e.expr,t),s),o(i(e.expr,s),s),[r(s)]}if("opt"==e.type)return[r(t)].concat(i(e.expr,t));if("range"==e.type){let s=t;for(let t=0;t<e.min;t++){let t=n();o(i(e.expr,s),t),s=t}if(-1==e.max)o(i(e.expr,s),s);else for(let t=e.min;t<e.max;t++){let t=n();r(s,t),o(i(e.expr,s),t),s=t}return[r(s)]}if("name"==e.type)return[r(t,void 0,e.value)];throw new Error("Unknown expr type")}for(let r=0;;r++){let s=i(e.exprs[r],t);if(r==e.exprs.length-1)return s;o(s,t=n())}}}(r));return function(e,t){for(let n=0,r=[e];n<r.length;n++){let e=r[n],o=!e.validEnd,i=[];for(let t=0;t<e.next.length;t++){let{type:n,next:s}=e.next[t];i.push(n.name),!o||n.isText||n.hasRequiredAttrs()||(o=!1),-1==r.indexOf(s)&&r.push(s)}o&&t.err("Only non-generatable nodes ("+i.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}(o,n),o}matchType(e){for(let t=0;t<this.next.length;t++)if(this.next[t].type==e)return this.next[t].next;return null}matchFragment(e,t=0,n=e.childCount){let r=this;for(let o=t;r&&o<n;o++)r=r.matchType(e.child(o).type);return r}get inlineContent(){return 0!=this.next.length&&this.next[0].type.isInline}get defaultType(){for(let e=0;e<this.next.length;e++){let{type:t}=this.next[e];if(!t.isText&&!t.hasRequiredAttrs())return t}return null}compatible(e){for(let t=0;t<this.next.length;t++)for(let n=0;n<e.next.length;n++)if(this.next[t].type==e.next[n].type)return!0;return!1}fillBefore(e,t=!1,n=0){let r=[this];return function o(i,s){let a=i.matchFragment(e,n);if(a&&(!t||a.validEnd))return Ft.from(s.map(e=>e.createAndFill()));for(let e=0;e<i.next.length;e++){let{type:t,next:n}=i.next[e];if(!t.isText&&!t.hasRequiredAttrs()&&-1==r.indexOf(n)){r.push(n);let e=o(n,s.concat(t));if(e)return e}}return null}(this,[])}findWrapping(e){for(let t=0;t<this.wrapCache.length;t+=2)if(this.wrapCache[t]==e)return this.wrapCache[t+1];let t=this.computeWrapping(e);return this.wrapCache.push(e,t),t}computeWrapping(e){let t=Object.create(null),n=[{match:this,type:null,via:null}];for(;n.length;){let r=n.shift(),o=r.match;if(o.matchType(e)){let e=[];for(let t=r;t.type;t=t.via)e.push(t.type);return e.reverse()}for(let e=0;e<o.next.length;e++){let{type:i,next:s}=o.next[e];i.isLeaf||i.hasRequiredAttrs()||i.name in t||r.type&&!s.validEnd||(n.push({match:i.contentMatch,type:i,via:r}),t[i.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw new RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];return function t(n){e.push(n);for(let r=0;r<n.next.length;r++)-1==e.indexOf(n.next[r].next)&&t(n.next[r].next)}(this),e.map((t,n)=>{let r=n+(t.validEnd?"*":" ")+" ";for(let n=0;n<t.next.length;n++)r+=(n?", ":"")+t.next[n].type.name+"->"+e.indexOf(t.next[n].next);return r}).join("\n")}}wn.empty=new wn(!0);class bn{constructor(e,t){this.string=e,this.nodeTypes=t,this.inline=null,this.pos=0,this.tokens=e.split(/\s*(?=\b|\W|$)/),""==this.tokens[this.tokens.length-1]&&this.tokens.pop(),""==this.tokens[0]&&this.tokens.shift()}get next(){return this.tokens[this.pos]}eat(e){return this.next==e&&(this.pos++||!0)}err(e){throw new SyntaxError(e+" (in content expression '"+this.string+"')")}}function xn(e){let t=[];do{t.push(kn(e))}while(e.eat("|"));return 1==t.length?t[0]:{type:"choice",exprs:t}}function kn(e){let t=[];do{t.push(Cn(e))}while(e.next&&")"!=e.next&&"|"!=e.next);return 1==t.length?t[0]:{type:"seq",exprs:t}}function Cn(e){let t=function(e){if(e.eat("(")){let t=xn(e);return e.eat(")")||e.err("Missing closing paren"),t}if(!/\W/.test(e.next)){let t=function(e,t){let n=e.nodeTypes,r=n[t];if(r)return[r];let o=[];for(let e in n){let r=n[e];r.isInGroup(t)&&o.push(r)}0==o.length&&e.err("No node type or group '"+t+"' found");return o}(e,e.next).map(t=>(null==e.inline?e.inline=t.isInline:e.inline!=t.isInline&&e.err("Mixing inline and block content"),{type:"name",value:t}));return e.pos++,1==t.length?t[0]:{type:"choice",exprs:t}}e.err("Unexpected token '"+e.next+"'")}(e);for(;;)if(e.eat("+"))t={type:"plus",expr:t};else if(e.eat("*"))t={type:"star",expr:t};else if(e.eat("?"))t={type:"opt",expr:t};else{if(!e.eat("{"))break;t=Mn(e,t)}return t}function Sn(e){/\D/.test(e.next)&&e.err("Expected number, got '"+e.next+"'");let t=Number(e.next);return e.pos++,t}function Mn(e,t){let n=Sn(e),r=n;return e.eat(",")&&(r="}"!=e.next?Sn(e):-1),e.eat("}")||e.err("Unclosed braced range"),{type:"range",min:n,max:r,expr:t}}function Nn(e,t){return t-e}function En(e,t){let n=[];return function t(r){let o=e[r];if(1==o.length&&!o[0].term)return t(o[0].to);n.push(r);for(let e=0;e<o.length;e++){let{term:r,to:i}=o[e];r||-1!=n.indexOf(i)||t(i)}}(t),n.sort(Nn)}function On(e){let t=Object.create(null);for(let n in e){let r=e[n];if(!r.hasDefault)return null;t[n]=r.default}return t}function An(e,t){let n=Object.create(null);for(let r in e){let o=e[r],i=t&&t[r];if(void 0===i){if(!o.hasDefault)throw new RangeError("No value supplied for attribute "+r);i=o.default}else o.validate&&o.validate(i);n[r]=i}return n}function Tn(e,t){let n=Object.create(null);if(t)for(let r in t)n[r]=new In(e,r,t[r]);return n}let Dn=class e{constructor(e,t,n){this.name=e,this.schema=t,this.spec=n,this.markSet=null,this.groups=n.group?n.group.split(" "):[],this.attrs=Tn(e,n.attrs),this.defaultAttrs=On(this.attrs),this.contentMatch=null,this.inlineContent=null,this.isBlock=!(n.inline||"text"==e),this.isText="text"==e}get isInline(){return!this.isBlock}get isTextblock(){return this.isBlock&&this.inlineContent}get isLeaf(){return this.contentMatch==wn.empty}get isAtom(){return this.isLeaf||!!this.spec.atom}isInGroup(e){return this.groups.indexOf(e)>-1}get whitespace(){return this.spec.whitespace||(this.spec.code?"pre":"normal")}hasRequiredAttrs(){for(let e in this.attrs)if(this.attrs[e].isRequired)return!0;return!1}compatibleContent(e){return this==e||this.contentMatch.compatible(e.contentMatch)}computeAttrs(e){return!e&&this.defaultAttrs?this.defaultAttrs:An(this.attrs,e)}create(e=null,t,n){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new mn(this,this.computeAttrs(e),Ft.from(t),Kt.setFrom(n))}createChecked(e=null,t,n){return t=Ft.from(t),this.checkContent(t),new mn(this,this.computeAttrs(e),t,Kt.setFrom(n))}createAndFill(e=null,t,n){if(e=this.computeAttrs(e),(t=Ft.from(t)).size){let e=this.contentMatch.fillBefore(t);if(!e)return null;t=e.append(t)}let r=this.contentMatch.matchFragment(t),o=r&&r.fillBefore(Ft.empty,!0);return o?new mn(this,e,t.append(o),Kt.setFrom(n)):null}validContent(e){let t=this.contentMatch.matchFragment(e);if(!t||!t.validEnd)return!1;for(let t=0;t<e.childCount;t++)if(!this.allowsMarks(e.child(t).marks))return!1;return!0}checkContent(e){if(!this.validContent(e))throw new RangeError(`Invalid content for node ${this.name}: ${e.toString().slice(0,50)}`)}checkAttrs(e){}allowsMarkType(e){return null==this.markSet||this.markSet.indexOf(e)>-1}allowsMarks(e){if(null==this.markSet)return!0;for(let t=0;t<e.length;t++)if(!this.allowsMarkType(e[t].type))return!1;return!0}allowedMarks(e){if(null==this.markSet)return e;let t;for(let n=0;n<e.length;n++)this.allowsMarkType(e[n].type)?t&&t.push(e[n]):t||(t=e.slice(0,n));return t?t.length?t:Kt.none:e}static compile(t,n){let r=Object.create(null);t.forEach((t,o)=>r[t]=new e(t,n,o));let o=n.spec.topNode||"doc";if(!r[o])throw new RangeError("Schema is missing its top node type ('"+o+"')");if(!r.text)throw new RangeError("Every schema needs a 'text' type");for(let e in r.text.attrs)throw new RangeError("The text node type should not have attributes");return r}};class In{constructor(e,t,n){this.hasDefault=Object.prototype.hasOwnProperty.call(n,"default"),this.default=n.default,this.validate="string"==typeof n.validate?function(e,t,n){let r=n.split("|");return n=>{let o=null===n?"null":typeof n;if(r.indexOf(o)<0)throw new RangeError(`Expected value of type ${r} for attribute ${t} on type ${e}, got ${o}`)}}(e,t,n.validate):n.validate}get isRequired(){return!this.hasDefault}}class _n{constructor(e,t,n,r){this.name=e,this.rank=t,this.schema=n,this.spec=r,this.attrs=Tn(e,r.attrs),this.excluded=null;let o=On(this.attrs);this.instance=o?new Kt(this,o):null}create(e=null){return!e&&this.instance?this.instance:new Kt(this,An(this.attrs,e))}static compile(e,t){let n=Object.create(null),r=0;return e.forEach((e,o)=>n[e]=new _n(e,r++,t,o)),n}removeFromSet(e){for(var t=0;t<e.length;t++)e[t].type==this&&(e=e.slice(0,t).concat(e.slice(t+1)),t--);return e}isInSet(e){for(let t=0;t<e.length;t++)if(e[t].type==this)return e[t]}excludes(e){return this.excluded.indexOf(e)>-1}}class Rn{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let t=this.spec={};for(let n in e)t[n]=e[n];t.nodes=jt.from(e.nodes),t.marks=jt.from(e.marks||{}),this.nodes=Dn.compile(this.spec.nodes,this),this.marks=_n.compile(this.spec.marks,this);let n=Object.create(null);for(let e in this.nodes){if(e in this.marks)throw new RangeError(e+" can not be both a node and a mark");let t=this.nodes[e],r=t.spec.content||"",o=t.spec.marks;if(t.contentMatch=n[r]||(n[r]=wn.parse(r,this.nodes)),t.inlineContent=t.contentMatch.inlineContent,t.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!t.isInline||!t.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=t}t.markSet="_"==o?null:o?Ln(this,o.split(" ")):""!=o&&t.inlineContent?null:[]}for(let e in this.marks){let t=this.marks[e],n=t.spec.excludes;t.excluded=null==n?[t]:""==n?[]:Ln(this,n.split(" "))}this.nodeFromJSON=e=>mn.fromJSON(this,e),this.markFromJSON=e=>Kt.fromJSON(this,e),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(e,t=null,n,r){if("string"==typeof e)e=this.nodeType(e);else{if(!(e instanceof Dn))throw new RangeError("Invalid node type: "+e);if(e.schema!=this)throw new RangeError("Node type from different schema used ("+e.name+")")}return e.createChecked(t,n,r)}text(e,t){let n=this.nodes.text;return new gn(n,n.defaultAttrs,e,Kt.setFrom(t))}mark(e,t){return"string"==typeof e&&(e=this.marks[e]),e.create(t)}nodeType(e){let t=this.nodes[e];if(!t)throw new RangeError("Unknown node type: "+e);return t}}function Ln(e,t){let n=[];for(let r=0;r<t.length;r++){let o=t[r],i=e.marks[o],s=i;if(i)n.push(i);else for(let t in e.marks){let r=e.marks[t];("_"==o||r.spec.group&&r.spec.group.split(" ").indexOf(o)>-1)&&n.push(s=r)}if(!s)throw new SyntaxError("Unknown mark type: '"+t[r]+"'")}return n}class Bn{constructor(e,t){this.schema=e,this.rules=t,this.tags=[],this.styles=[];let n=this.matchedStyles=[];t.forEach(e=>{if(function(e){return null!=e.tag}(e))this.tags.push(e);else if(function(e){return null!=e.style}(e)){let t=/[^=]*/.exec(e.style)[0];n.indexOf(t)<0&&n.push(t),this.styles.push(e)}}),this.normalizeLists=!this.tags.some(t=>{if(!/^(ul|ol)\b/.test(t.tag)||!t.node)return!1;let n=e.nodes[t.node];return n.contentMatch.matchType(n)})}parse(e,t={}){let n=new Hn(this,t,!1);return n.addAll(e,Kt.none,t.from,t.to),n.finish()}parseSlice(e,t={}){let n=new Hn(this,t,!0);return n.addAll(e,Kt.none,t.from,t.to),Zt.maxOpen(n.finish())}matchTag(e,t,n){for(let r=n?this.tags.indexOf(n)+1:0;r<this.tags.length;r++){let n=this.tags[r];if(qn(e,n.tag)&&(void 0===n.namespace||e.namespaceURI==n.namespace)&&(!n.context||t.matchesContext(n.context))){if(n.getAttrs){let t=n.getAttrs(e);if(!1===t)continue;n.attrs=t||void 0}return n}}}matchStyle(e,t,n,r){for(let o=r?this.styles.indexOf(r)+1:0;o<this.styles.length;o++){let r=this.styles[o],i=r.style;if(!(0!=i.indexOf(e)||r.context&&!n.matchesContext(r.context)||i.length>e.length&&(61!=i.charCodeAt(e.length)||i.slice(e.length+1)!=t))){if(r.getAttrs){let e=r.getAttrs(t);if(!1===e)continue;r.attrs=e||void 0}return r}}}static schemaRules(e){let t=[];function n(e){let n=null==e.priority?50:e.priority,r=0;for(;r<t.length;r++){let e=t[r];if((null==e.priority?50:e.priority)<n)break}t.splice(r,0,e)}for(let t in e.marks){let r=e.marks[t].spec.parseDOM;r&&r.forEach(e=>{n(e=Fn(e)),e.mark||e.ignore||e.clearMark||(e.mark=t)})}for(let t in e.nodes){let r=e.nodes[t].spec.parseDOM;r&&r.forEach(e=>{n(e=Fn(e)),e.node||e.ignore||e.mark||(e.node=t)})}return t}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new Bn(e,Bn.schemaRules(e)))}}const Pn={address:!0,article:!0,aside:!0,blockquote:!0,body:!0,canvas:!0,dd:!0,div:!0,dl:!0,fieldset:!0,figcaption:!0,figure:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,li:!0,noscript:!0,ol:!0,output:!0,p:!0,pre:!0,section:!0,table:!0,tfoot:!0,ul:!0},zn={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},jn={ol:!0,ul:!0};function Vn(e,t,n){return null!=t?(t?1:0)|("full"===t?2:0):e&&"pre"==e.whitespace?3:-5&n}class $n{constructor(e,t,n,r,o,i){this.type=e,this.attrs=t,this.marks=n,this.solid=r,this.options=i,this.content=[],this.activeMarks=Kt.none,this.match=o||(4&i?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let t=this.type.contentMatch.fillBefore(Ft.from(e));if(!t){let t,n=this.type.contentMatch;return(t=n.findWrapping(e.type))?(this.match=n,t):null}this.match=this.type.contentMatch.matchFragment(t)}return this.match.findWrapping(e.type)}finish(e){if(!(1&this.options)){let e,t=this.content[this.content.length-1];if(t&&t.isText&&(e=/[ \t\r\n\u000c]+$/.exec(t.text))){let n=t;t.text.length==e[0].length?this.content.pop():this.content[this.content.length-1]=n.withText(n.text.slice(0,n.text.length-e[0].length))}}let t=Ft.from(this.content);return!e&&this.match&&(t=t.append(this.match.fillBefore(Ft.empty,!0))),this.type?this.type.create(this.attrs,t,this.marks):t}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!Pn.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class Hn{constructor(e,t,n){this.parser=e,this.options=t,this.isOpen=n,this.open=0,this.localPreserveWS=!1;let r,o=t.topNode,i=Vn(null,t.preserveWhitespace,0)|(n?4:0);r=o?new $n(o.type,o.attrs,Kt.none,!0,t.topMatch||o.type.contentMatch,i):new $n(n?null:e.schema.topNodeType,null,Kt.none,!0,null,i),this.nodes=[r],this.find=t.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e,t){3==e.nodeType?this.addTextNode(e,t):1==e.nodeType&&this.addElement(e,t)}addTextNode(e,t){let n=e.nodeValue,r=this.top,o=2&r.options?"full":this.localPreserveWS||(1&r.options)>0,{schema:i}=this.parser;if("full"===o||r.inlineContext(e)||/[^ \t\r\n\u000c]/.test(n)){if(o)if("full"===o)n=n.replace(/\r\n?/g,"\n");else if(i.linebreakReplacement&&/[\r\n]/.test(n)&&this.top.findWrapping(i.linebreakReplacement.create())){let e=n.split(/\r?\n|\r/);for(let n=0;n<e.length;n++)n&&this.insertNode(i.linebreakReplacement.create(),t,!0),e[n]&&this.insertNode(i.text(e[n]),t,!/\S/.test(e[n]));n=""}else n=n.replace(/\r?\n|\r/g," ");else if(n=n.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(n)&&this.open==this.nodes.length-1){let t=r.content[r.content.length-1],o=e.previousSibling;(!t||o&&"BR"==o.nodeName||t.isText&&/[ \t\r\n\u000c]$/.test(t.text))&&(n=n.slice(1))}n&&this.insertNode(i.text(n),t,!/\S/.test(n)),this.findInText(e)}else this.findInside(e)}addElement(e,t,n){let r=this.localPreserveWS,o=this.top;("PRE"==e.tagName||/pre/.test(e.style&&e.style.whiteSpace))&&(this.localPreserveWS=!0);let i,s=e.nodeName.toLowerCase();jn.hasOwnProperty(s)&&this.parser.normalizeLists&&function(e){for(let t=e.firstChild,n=null;t;t=t.nextSibling){let e=1==t.nodeType?t.nodeName.toLowerCase():null;e&&jn.hasOwnProperty(e)&&n?(n.appendChild(t),t=n):"li"==e?n=t:e&&(n=null)}}(e);let a=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(i=this.parser.matchTag(e,this,n));e:if(a?a.ignore:zn.hasOwnProperty(s))this.findInside(e),this.ignoreFallback(e,t);else if(!a||a.skip||a.closeParent){a&&a.closeParent?this.open=Math.max(0,this.open-1):a&&a.skip.nodeType&&(e=a.skip);let n,r=this.needsBlock;if(Pn.hasOwnProperty(s))o.content.length&&o.content[0].isInline&&this.open&&(this.open--,o=this.top),n=!0,o.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e,t);break e}let i=a&&a.skip?t:this.readStyles(e,t);i&&this.addAll(e,i),n&&this.sync(o),this.needsBlock=r}else{let n=this.readStyles(e,t);n&&this.addElementByRule(e,a,n,!1===a.consuming?i:void 0)}this.localPreserveWS=r}leafFallback(e,t){"BR"==e.nodeName&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode("\n"),t)}ignoreFallback(e,t){"BR"!=e.nodeName||this.top.type&&this.top.type.inlineContent||this.findPlace(this.parser.schema.text("-"),t,!0)}readStyles(e,t){let n=e.style;if(n&&n.length)for(let e=0;e<this.parser.matchedStyles.length;e++){let r=this.parser.matchedStyles[e],o=n.getPropertyValue(r);if(o)for(let e;;){let n=this.parser.matchStyle(r,o,this,e);if(!n)break;if(n.ignore)return null;if(t=n.clearMark?t.filter(e=>!n.clearMark(e)):t.concat(this.parser.schema.marks[n.mark].create(n.attrs)),!1!==n.consuming)break;e=n}}return t}addElementByRule(e,t,n,r){let o,i;if(t.node)if(i=this.parser.schema.nodes[t.node],i.isLeaf)this.insertNode(i.create(t.attrs),n,"BR"==e.nodeName)||this.leafFallback(e,n);else{let e=this.enter(i,t.attrs||null,n,t.preserveWhitespace);e&&(o=!0,n=e)}else{let e=this.parser.schema.marks[t.mark];n=n.concat(e.create(t.attrs))}let s=this.top;if(i&&i.isLeaf)this.findInside(e);else if(r)this.addElement(e,n,r);else if(t.getContent)this.findInside(e),t.getContent(e,this.parser.schema).forEach(e=>this.insertNode(e,n,!1));else{let r=e;"string"==typeof t.contentElement?r=e.querySelector(t.contentElement):"function"==typeof t.contentElement?r=t.contentElement(e):t.contentElement&&(r=t.contentElement),this.findAround(e,r,!0),this.addAll(r,n),this.findAround(e,r,!1)}o&&this.sync(s)&&this.open--}addAll(e,t,n,r){let o=n||0;for(let i=n?e.childNodes[n]:e.firstChild,s=null==r?null:e.childNodes[r];i!=s;i=i.nextSibling,++o)this.findAtPoint(e,o),this.addDOM(i,t);this.findAtPoint(e,o)}findPlace(e,t,n){let r,o;for(let t=this.open,i=0;t>=0;t--){let s=this.nodes[t],a=s.findWrapping(e);if(a&&(!r||r.length>a.length+i)&&(r=a,o=s,!a.length))break;if(s.solid){if(n)break;i+=2}}if(!r)return null;this.sync(o);for(let e=0;e<r.length;e++)t=this.enterInner(r[e],null,t,!1);return t}insertNode(e,t,n){if(e.isInline&&this.needsBlock&&!this.top.type){let e=this.textblockFromContext();e&&(t=this.enterInner(e,null,t))}let r=this.findPlace(e,t,n);if(r){this.closeExtra();let t=this.top;t.match&&(t.match=t.match.matchType(e.type));let n=Kt.none;for(let o of r.concat(e.marks))(t.type?t.type.allowsMarkType(o.type):Wn(o.type,e.type))&&(n=o.addToSet(n));return t.content.push(e.mark(n)),!0}return!1}enter(e,t,n,r){let o=this.findPlace(e.create(t),n,!1);return o&&(o=this.enterInner(e,t,n,!0,r)),o}enterInner(e,t,n,r=!1,o){this.closeExtra();let i=this.top;i.match=i.match&&i.match.matchType(e);let s=Vn(e,o,i.options);4&i.options&&0==i.content.length&&(s|=4);let a=Kt.none;return n=n.filter(t=>!(i.type?i.type.allowsMarkType(t.type):Wn(t.type,e))||(a=t.addToSet(a),!1)),this.nodes.push(new $n(e,t,a,r,null,s)),this.open++,n}closeExtra(e=!1){let t=this.nodes.length-1;if(t>this.open){for(;t>this.open;t--)this.nodes[t-1].content.push(this.nodes[t].finish(e));this.nodes.length=this.open+1}}finish(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(!(!this.isOpen&&!this.options.topOpen))}sync(e){for(let t=this.open;t>=0;t--){if(this.nodes[t]==e)return this.open=t,!0;this.localPreserveWS&&(this.nodes[t].options|=1)}return!1}get currentPos(){this.closeExtra();let e=0;for(let t=this.open;t>=0;t--){let n=this.nodes[t].content;for(let t=n.length-1;t>=0;t--)e+=n[t].nodeSize;t&&e++}return e}findAtPoint(e,t){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].node==e&&this.find[n].offset==t&&(this.find[n].pos=this.currentPos)}findInside(e){if(this.find)for(let t=0;t<this.find.length;t++)null==this.find[t].pos&&1==e.nodeType&&e.contains(this.find[t].node)&&(this.find[t].pos=this.currentPos)}findAround(e,t,n){if(e!=t&&this.find)for(let r=0;r<this.find.length;r++)if(null==this.find[r].pos&&1==e.nodeType&&e.contains(this.find[r].node)){t.compareDocumentPosition(this.find[r].node)&(n?2:4)&&(this.find[r].pos=this.currentPos)}}findInText(e){if(this.find)for(let t=0;t<this.find.length;t++)this.find[t].node==e&&(this.find[t].pos=this.currentPos-(e.nodeValue.length-this.find[t].offset))}matchesContext(e){if(e.indexOf("|")>-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let t=e.split("/"),n=this.options.context,r=!(this.isOpen||n&&n.parent.type!=this.nodes[0].type),o=-(n?n.depth+1:0)+(r?0:1),i=(e,s)=>{for(;e>=0;e--){let a=t[e];if(""==a){if(e==t.length-1||0==e)continue;for(;s>=o;s--)if(i(e-1,s))return!0;return!1}{let e=s>0||0==s&&r?this.nodes[s].type:n&&s>=o?n.node(s-o).type:null;if(!e||e.name!=a&&!e.isInGroup(a))return!1;s--}}return!0};return i(t.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let t=e.depth;t>=0;t--){let n=e.node(t).contentMatchAt(e.indexAfter(t)).defaultType;if(n&&n.isTextblock&&n.defaultAttrs)return n}for(let e in this.parser.schema.nodes){let t=this.parser.schema.nodes[e];if(t.isTextblock&&t.defaultAttrs)return t}}}function qn(e,t){return(e.matches||e.msMatchesSelector||e.webkitMatchesSelector||e.mozMatchesSelector).call(e,t)}function Fn(e){let t={};for(let n in e)t[n]=e[n];return t}function Wn(e,t){let n=t.schema.nodes;for(let r in n){let o=n[r];if(!o.allowsMarkType(e))continue;let i=[],s=e=>{i.push(e);for(let n=0;n<e.edgeCount;n++){let{type:r,next:o}=e.edge(n);if(r==t)return!0;if(i.indexOf(o)<0&&s(o))return!0}};if(s(o.contentMatch))return!0}}class Un{constructor(e,t){this.nodes=e,this.marks=t}serializeFragment(e,t={},n){n||(n=Kn(t).createDocumentFragment());let r=n,o=[];return e.forEach(e=>{if(o.length||e.marks.length){let n=0,i=0;for(;n<o.length&&i<e.marks.length;){let t=e.marks[i];if(this.marks[t.type.name]){if(!t.eq(o[n][0])||!1===t.type.spec.spanning)break;n++,i++}else i++}for(;n<o.length;)r=o.pop()[1];for(;i<e.marks.length;){let n=e.marks[i++],s=this.serializeMark(n,e.isInline,t);s&&(o.push([n,r]),r.appendChild(s.dom),r=s.contentDOM||s.dom)}}r.appendChild(this.serializeNodeInner(e,t))}),n}serializeNodeInner(e,t){if(e.isText)return Kn(t).createTextNode(e.text);let{dom:n,contentDOM:r}=Yn(Kn(t),this.nodes[e.type.name](e),null,e.attrs);if(r){if(e.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(e.content,t,r)}return n}serializeNode(e,t={}){let n=this.serializeNodeInner(e,t);for(let r=e.marks.length-1;r>=0;r--){let o=this.serializeMark(e.marks[r],e.isInline,t);o&&((o.contentDOM||o.dom).appendChild(n),n=o.dom)}return n}serializeMark(e,t,n={}){let r=this.marks[e.type.name];return r&&Yn(Kn(n),r(e,t),null,e.attrs)}static renderSpec(e,t,n=null,r){return"string"==typeof t?{dom:e.createTextNode(t)}:Yn(e,t,n,r)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new Un(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let t=Gn(e.nodes);return t.text||(t.text=e=>e.text),t}static marksFromSchema(e){return Gn(e.marks)}}function Gn(e){let t={};for(let n in e){let r=e[n].spec.toDOM;r&&(t[n]=r)}return t}function Kn(e){return e.document||window.document}const Jn=new WeakMap;function Zn(e){let t=Jn.get(e);return void 0===t&&Jn.set(e,t=function(e){let t=null;function n(e){if(e&&"object"==typeof e)if(Array.isArray(e))if("string"==typeof e[0])t||(t=[]),t.push(e);else for(let t=0;t<e.length;t++)n(e[t]);else for(let t in e)n(e[t])}return n(e),t}(e)),t}function Yn(e,t,n,r){if(1==t.nodeType)return{dom:t};if(t.dom&&1==t.dom.nodeType)return t;let o,i=t[0];if("string"!=typeof i)throw new RangeError("Invalid array passed to renderSpec");if(r&&(o=Zn(r))&&o.indexOf(t)>-1)throw new RangeError("Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.");let s,a=i.indexOf(" ");a>0&&(n=i.slice(0,a),i=i.slice(a+1));let l=n?e.createElementNS(n,i):e.createElement(i),c=t[1],d=1;if(c&&"object"==typeof c&&null==c.nodeType&&!Array.isArray(c)){d=2;for(let e in c)if(null!=c[e]){let t=e.indexOf(" ");t>0?l.setAttributeNS(e.slice(0,t),e.slice(t+1),c[e]):"style"==e&&l.style?l.style.cssText=c[e]:l.setAttribute(e,c[e])}}for(let o=d;o<t.length;o++){let i=t[o];if(0===i){if(o<t.length-1||o>d)throw new RangeError("Content hole must be the only child of its parent node");return{dom:l,contentDOM:l}}if("string"==typeof i)l.appendChild(e.createTextNode(i));else{let{dom:t,contentDOM:o}=Yn(e,i,n,r);if(l.appendChild(t),o){if(s)throw new RangeError("Multiple content holes");s=o}}}return{dom:l,contentDOM:s}}const Xn=Math.pow(2,16);function Qn(e,t){return e+t*Xn}function er(e){return 65535&e}class tr{constructor(e,t,n){this.pos=e,this.delInfo=t,this.recover=n}get deleted(){return(8&this.delInfo)>0}get deletedBefore(){return(5&this.delInfo)>0}get deletedAfter(){return(6&this.delInfo)>0}get deletedAcross(){return(4&this.delInfo)>0}}class nr{constructor(e,t=!1){if(this.ranges=e,this.inverted=t,!e.length&&nr.empty)return nr.empty}recover(e){let t=0,n=er(e);if(!this.inverted)for(let e=0;e<n;e++)t+=this.ranges[3*e+2]-this.ranges[3*e+1];return this.ranges[3*n]+t+function(e){return(e-(65535&e))/Xn}(e)}mapResult(e,t=1){return this._map(e,t,!1)}map(e,t=1){return this._map(e,t,!0)}_map(e,t,n){let r=0,o=this.inverted?2:1,i=this.inverted?1:2;for(let s=0;s<this.ranges.length;s+=3){let a=this.ranges[s]-(this.inverted?r:0);if(a>e)break;let l=this.ranges[s+o],c=this.ranges[s+i],d=a+l;if(e<=d){let o=a+r+((l?e==a?-1:e==d?1:t:t)<0?0:c);if(n)return o;let i=e==(t<0?a:d)?null:Qn(s/3,e-a),u=e==a?2:e==d?1:4;return(t<0?e!=a:e!=d)&&(u|=8),new tr(o,u,i)}r+=c-l}return n?e+r:new tr(e+r,0,null)}touches(e,t){let n=0,r=er(t),o=this.inverted?2:1,i=this.inverted?1:2;for(let t=0;t<this.ranges.length;t+=3){let s=this.ranges[t]-(this.inverted?n:0);if(s>e)break;let a=this.ranges[t+o];if(e<=s+a&&t==3*r)return!0;n+=this.ranges[t+i]-a}return!1}forEach(e){let t=this.inverted?2:1,n=this.inverted?1:2;for(let r=0,o=0;r<this.ranges.length;r+=3){let i=this.ranges[r],s=i-(this.inverted?o:0),a=i+(this.inverted?0:o),l=this.ranges[r+t],c=this.ranges[r+n];e(s,s+l,a,a+c),o+=c-l}}invert(){return new nr(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return 0==e?nr.empty:new nr(e<0?[0,-e,0]:[0,0,e])}}nr.empty=new nr([]);class rr{constructor(e,t,n=0,r=(e?e.length:0)){this.mirror=t,this.from=n,this.to=r,this._maps=e||[],this.ownData=!(e||t)}get maps(){return this._maps}slice(e=0,t=this.maps.length){return new rr(this._maps,this.mirror,e,t)}appendMap(e,t){this.ownData||(this._maps=this._maps.slice(),this.mirror=this.mirror&&this.mirror.slice(),this.ownData=!0),this.to=this._maps.push(e),null!=t&&this.setMirror(this._maps.length-1,t)}appendMapping(e){for(let t=0,n=this._maps.length;t<e._maps.length;t++){let r=e.getMirror(t);this.appendMap(e._maps[t],null!=r&&r<t?n+r:void 0)}}getMirror(e){if(this.mirror)for(let t=0;t<this.mirror.length;t++)if(this.mirror[t]==e)return this.mirror[t+(t%2?-1:1)]}setMirror(e,t){this.mirror||(this.mirror=[]),this.mirror.push(e,t)}appendMappingInverted(e){for(let t=e.maps.length-1,n=this._maps.length+e._maps.length;t>=0;t--){let r=e.getMirror(t);this.appendMap(e._maps[t].invert(),null!=r&&r>t?n-r-1:void 0)}}invert(){let e=new rr;return e.appendMappingInverted(this),e}map(e,t=1){if(this.mirror)return this._map(e,t,!0);for(let n=this.from;n<this.to;n++)e=this._maps[n].map(e,t);return e}mapResult(e,t=1){return this._map(e,t,!1)}_map(e,t,n){let r=0;for(let n=this.from;n<this.to;n++){let o=this._maps[n].mapResult(e,t);if(null!=o.recover){let t=this.getMirror(n);if(null!=t&&t>n&&t<this.to){n=t,e=this._maps[t].recover(o.recover);continue}}r|=o.delInfo,e=o.pos}return n?e:new tr(e,r,null)}}const or=Object.create(null);class ir{getMap(){return nr.empty}merge(e){return null}static fromJSON(e,t){if(!t||!t.stepType)throw new RangeError("Invalid input for Step.fromJSON");let n=or[t.stepType];if(!n)throw new RangeError(`No step type ${t.stepType} defined`);return n.fromJSON(e,t)}static jsonID(e,t){if(e in or)throw new RangeError("Duplicate use of step JSON ID "+e);return or[e]=t,t.prototype.jsonID=e,t}}class sr{constructor(e,t){this.doc=e,this.failed=t}static ok(e){return new sr(e,null)}static fail(e){return new sr(null,e)}static fromReplace(e,t,n,r){try{return sr.ok(e.replace(t,n,r))}catch(e){if(e instanceof Jt)return sr.fail(e.message);throw e}}}function ar(e,t,n){let r=[];for(let o=0;o<e.childCount;o++){let i=e.child(o);i.content.size&&(i=i.copy(ar(i.content,t,i))),i.isInline&&(i=t(i,n,o)),r.push(i)}return Ft.fromArray(r)}class lr extends ir{constructor(e,t,n){super(),this.from=e,this.to=t,this.mark=n}apply(e){let t=e.slice(this.from,this.to),n=e.resolve(this.from),r=n.node(n.sharedDepth(this.to)),o=new Zt(ar(t.content,(e,t)=>e.isAtom&&t.type.allowsMarkType(this.mark.type)?e.mark(this.mark.addToSet(e.marks)):e,r),t.openStart,t.openEnd);return sr.fromReplace(e,this.from,this.to,o)}invert(){return new cr(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),n=e.mapResult(this.to,-1);return t.deleted&&n.deleted||t.pos>=n.pos?null:new lr(t.pos,n.pos,this.mark)}merge(e){return e instanceof lr&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new lr(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,t){if("number"!=typeof t.from||"number"!=typeof t.to)throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new lr(t.from,t.to,e.markFromJSON(t.mark))}}ir.jsonID("addMark",lr);class cr extends ir{constructor(e,t,n){super(),this.from=e,this.to=t,this.mark=n}apply(e){let t=e.slice(this.from,this.to),n=new Zt(ar(t.content,e=>e.mark(this.mark.removeFromSet(e.marks)),e),t.openStart,t.openEnd);return sr.fromReplace(e,this.from,this.to,n)}invert(){return new lr(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),n=e.mapResult(this.to,-1);return t.deleted&&n.deleted||t.pos>=n.pos?null:new cr(t.pos,n.pos,this.mark)}merge(e){return e instanceof cr&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new cr(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,t){if("number"!=typeof t.from||"number"!=typeof t.to)throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new cr(t.from,t.to,e.markFromJSON(t.mark))}}ir.jsonID("removeMark",cr);class dr extends ir{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return sr.fail("No node at mark step's position");let n=t.type.create(t.attrs,null,this.mark.addToSet(t.marks));return sr.fromReplace(e,this.pos,this.pos+1,new Zt(Ft.from(n),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);if(t){let e=this.mark.addToSet(t.marks);if(e.length==t.marks.length){for(let n=0;n<t.marks.length;n++)if(!t.marks[n].isInSet(e))return new dr(this.pos,t.marks[n]);return new dr(this.pos,this.mark)}}return new ur(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new dr(t.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,t){if("number"!=typeof t.pos)throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new dr(t.pos,e.markFromJSON(t.mark))}}ir.jsonID("addNodeMark",dr);class ur extends ir{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return sr.fail("No node at mark step's position");let n=t.type.create(t.attrs,null,this.mark.removeFromSet(t.marks));return sr.fromReplace(e,this.pos,this.pos+1,new Zt(Ft.from(n),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);return t&&this.mark.isInSet(t.marks)?new dr(this.pos,this.mark):this}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new ur(t.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,t){if("number"!=typeof t.pos)throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new ur(t.pos,e.markFromJSON(t.mark))}}ir.jsonID("removeNodeMark",ur);class hr extends ir{constructor(e,t,n,r=!1){super(),this.from=e,this.to=t,this.slice=n,this.structure=r}apply(e){return this.structure&&fr(e,this.from,this.to)?sr.fail("Structure replace would overwrite content"):sr.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new nr([this.from,this.to-this.from,this.slice.size])}invert(e){return new hr(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let t=e.mapResult(this.to,-1),n=this.from==this.to&&hr.MAP_BIAS<0?t:e.mapResult(this.from,1);return n.deletedAcross&&t.deletedAcross?null:new hr(n.pos,Math.max(n.pos,t.pos),this.slice,this.structure)}merge(e){if(!(e instanceof hr)||e.structure||this.structure)return null;if(this.from+this.slice.size!=e.from||this.slice.openEnd||e.slice.openStart){if(e.to!=this.from||this.slice.openStart||e.slice.openEnd)return null;{let t=this.slice.size+e.slice.size==0?Zt.empty:new Zt(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new hr(e.from,this.to,t,this.structure)}}{let t=this.slice.size+e.slice.size==0?Zt.empty:new Zt(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new hr(this.from,this.to+(e.to-e.from),t,this.structure)}}toJSON(){let e={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,t){if("number"!=typeof t.from||"number"!=typeof t.to)throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new hr(t.from,t.to,Zt.fromJSON(e,t.slice),!!t.structure)}}hr.MAP_BIAS=1,ir.jsonID("replace",hr);class pr extends ir{constructor(e,t,n,r,o,i,s=!1){super(),this.from=e,this.to=t,this.gapFrom=n,this.gapTo=r,this.slice=o,this.insert=i,this.structure=s}apply(e){if(this.structure&&(fr(e,this.from,this.gapFrom)||fr(e,this.gapTo,this.to)))return sr.fail("Structure gap-replace would overwrite content");let t=e.slice(this.gapFrom,this.gapTo);if(t.openStart||t.openEnd)return sr.fail("Gap is not a flat range");let n=this.slice.insertAt(this.insert,t.content);return n?sr.fromReplace(e,this.from,this.to,n):sr.fail("Content does not fit in gap")}getMap(){return new nr([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(e){let t=this.gapTo-this.gapFrom;return new pr(this.from,this.from+this.slice.size+t,this.from+this.insert,this.from+this.insert+t,e.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(e){let t=e.mapResult(this.from,1),n=e.mapResult(this.to,-1),r=this.from==this.gapFrom?t.pos:e.map(this.gapFrom,-1),o=this.to==this.gapTo?n.pos:e.map(this.gapTo,1);return t.deletedAcross&&n.deletedAcross||r<t.pos||o>n.pos?null:new pr(t.pos,n.pos,r,o,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,t){if("number"!=typeof t.from||"number"!=typeof t.to||"number"!=typeof t.gapFrom||"number"!=typeof t.gapTo||"number"!=typeof t.insert)throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new pr(t.from,t.to,t.gapFrom,t.gapTo,Zt.fromJSON(e,t.slice),t.insert,!!t.structure)}}function fr(e,t,n){let r=e.resolve(t),o=n-t,i=r.depth;for(;o>0&&i>0&&r.indexAfter(i)==r.node(i).childCount;)i--,o--;if(o>0){let e=r.node(i).maybeChild(r.indexAfter(i));for(;o>0;){if(!e||e.isLeaf)return!0;e=e.firstChild,o--}}return!1}function mr(e,t,n,r=n.contentMatch,o=!0){let i=e.doc.nodeAt(t),s=[],a=t+1;for(let t=0;t<i.childCount;t++){let l=i.child(t),c=a+l.nodeSize,d=r.matchType(l.type);if(d){r=d;for(let t=0;t<l.marks.length;t++)n.allowsMarkType(l.marks[t].type)||e.step(new cr(a,c,l.marks[t]));if(o&&l.isText&&"pre"!=n.whitespace){let e,t,r=/\r?\n|\r/g;for(;e=r.exec(l.text);)t||(t=new Zt(Ft.from(n.schema.text(" ",n.allowedMarks(l.marks))),0,0)),s.push(new hr(a+e.index,a+e.index+e[0].length,t))}}else s.push(new hr(a,c,Zt.empty));a=c}if(!r.validEnd){let t=r.fillBefore(Ft.empty,!0);e.replace(a,a,new Zt(t,0,0))}for(let t=s.length-1;t>=0;t--)e.step(s[t])}function gr(e,t,n){return(0==t||e.canReplace(t,e.childCount))&&(n==e.childCount||e.canReplace(0,n))}function vr(e){let t=e.parent.content.cutByIndex(e.startIndex,e.endIndex);for(let n=e.depth,r=0,o=0;;--n){let i=e.$from.node(n),s=e.$from.index(n)+r,a=e.$to.indexAfter(n)-o;if(n<e.depth&&i.canReplace(s,a,t))return n;if(0==n||i.type.spec.isolating||!gr(i,s,a))break;s&&(r=1),a<i.childCount&&(o=1)}return null}function yr(e,t,n=null,r=e){let o=function(e,t){let{parent:n,startIndex:r,endIndex:o}=e,i=n.contentMatchAt(r).findWrapping(t);if(!i)return null;let s=i.length?i[0]:t;return n.canReplaceWith(r,o,s)?i:null}(e,t),i=o&&function(e,t){let{parent:n,startIndex:r,endIndex:o}=e,i=n.child(r),s=t.contentMatch.findWrapping(i.type);if(!s)return null;let a=(s.length?s[s.length-1]:t).contentMatch;for(let e=r;a&&e<o;e++)a=a.matchType(n.child(e).type);return a&&a.validEnd?s:null}(r,t);return i?o.map(wr).concat({type:t,attrs:n}).concat(i.map(wr)):null}function wr(e){return{type:e,attrs:null}}function br(e,t,n,r){t.forEach((o,i)=>{if(o.isText){let s,a=/\r?\n|\r/g;for(;s=a.exec(o.text);){let o=e.mapping.slice(r).map(n+1+i+s.index);e.replaceWith(o,o+1,t.type.schema.linebreakReplacement.create())}}})}function xr(e,t,n,r){t.forEach((o,i)=>{if(o.type==o.type.schema.linebreakReplacement){let o=e.mapping.slice(r).map(n+1+i);e.replaceWith(o,o+1,t.type.schema.text("\n"))}})}function kr(e,t,n=1,r){let o=e.resolve(t),i=o.depth-n,s=r&&r[r.length-1]||o.parent;if(i<0||o.parent.type.spec.isolating||!o.parent.canReplace(o.index(),o.parent.childCount)||!s.type.validContent(o.parent.content.cutByIndex(o.index(),o.parent.childCount)))return!1;for(let e=o.depth-1,t=n-2;e>i;e--,t--){let n=o.node(e),i=o.index(e);if(n.type.spec.isolating)return!1;let s=n.content.cutByIndex(i,n.childCount),a=r&&r[t+1];a&&(s=s.replaceChild(0,a.type.create(a.attrs)));let l=r&&r[t]||n;if(!n.canReplace(i+1,n.childCount)||!l.type.validContent(s))return!1}let a=o.indexAfter(i),l=r&&r[0];return o.node(i).canReplaceWith(a,a,l?l.type:o.node(i+1).type)}function Cr(e,t){let n=e.resolve(t),r=n.index();return o=n.nodeBefore,i=n.nodeAfter,!(!o||!i||o.isLeaf||!function(e,t){t.content.size||e.type.compatibleContent(t.type);let n=e.contentMatchAt(e.childCount),{linebreakReplacement:r}=e.type.schema;for(let o=0;o<t.childCount;o++){let i=t.child(o),s=i.type==r?e.type.schema.nodes.text:i.type;if(n=n.matchType(s),!n)return!1;if(!e.type.allowsMarks(i.marks))return!1}return n.validEnd}(o,i))&&n.parent.canReplace(r,r+1);var o,i}function Sr(e,t,n=t,r=Zt.empty){if(t==n&&!r.size)return null;let o=e.resolve(t),i=e.resolve(n);return Mr(o,i,r)?new hr(t,n,r):new Nr(o,i,r).fit()}function Mr(e,t,n){return!n.openStart&&!n.openEnd&&e.start()==t.start()&&e.parent.canReplace(e.index(),t.index(),n.content)}ir.jsonID("replaceAround",pr);class Nr{constructor(e,t,n){this.$from=e,this.$to=t,this.unplaced=n,this.frontier=[],this.placed=Ft.empty;for(let t=0;t<=e.depth;t++){let n=e.node(t);this.frontier.push({type:n.type,match:n.contentMatchAt(e.indexAfter(t))})}for(let t=e.depth;t>0;t--)this.placed=Ft.from(e.node(t).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let e=this.findFittable();e?this.placeNodes(e):this.openMore()||this.dropNode()}let e=this.mustMoveInline(),t=this.placed.size-this.depth-this.$from.depth,n=this.$from,r=this.close(e<0?this.$to:n.doc.resolve(e));if(!r)return null;let o=this.placed,i=n.depth,s=r.depth;for(;i&&s&&1==o.childCount;)o=o.firstChild.content,i--,s--;let a=new Zt(o,i,s);return e>-1?new pr(n.pos,e,this.$to.pos,this.$to.end(),a,t):a.size||n.pos!=this.$to.pos?new hr(n.pos,r.pos,a):null}findFittable(){let e=this.unplaced.openStart;for(let t=this.unplaced.content,n=0,r=this.unplaced.openEnd;n<e;n++){let o=t.firstChild;if(t.childCount>1&&(r=0),o.type.spec.isolating&&r<=n){e=n;break}t=o.content}for(let t=1;t<=2;t++)for(let n=1==t?e:this.unplaced.openStart;n>=0;n--){let e,r=null;n?(r=Ar(this.unplaced.content,n-1).firstChild,e=r.content):e=this.unplaced.content;let o=e.firstChild;for(let e=this.depth;e>=0;e--){let i,{type:s,match:a}=this.frontier[e],l=null;if(1==t&&(o?a.matchType(o.type)||(l=a.fillBefore(Ft.from(o),!1)):r&&s.compatibleContent(r.type)))return{sliceDepth:n,frontierDepth:e,parent:r,inject:l};if(2==t&&o&&(i=a.findWrapping(o.type)))return{sliceDepth:n,frontierDepth:e,parent:r,wrap:i};if(r&&a.matchType(r.type))break}}}openMore(){let{content:e,openStart:t,openEnd:n}=this.unplaced,r=Ar(e,t);return!(!r.childCount||r.firstChild.isLeaf)&&(this.unplaced=new Zt(e,t+1,Math.max(n,r.size+t>=e.size-n?t+1:0)),!0)}dropNode(){let{content:e,openStart:t,openEnd:n}=this.unplaced,r=Ar(e,t);if(r.childCount<=1&&t>0){let o=e.size-t<=t+r.size;this.unplaced=new Zt(Er(e,t-1,1),t-1,o?t-1:n)}else this.unplaced=new Zt(Er(e,t,1),t,n)}placeNodes({sliceDepth:e,frontierDepth:t,parent:n,inject:r,wrap:o}){for(;this.depth>t;)this.closeFrontierNode();if(o)for(let e=0;e<o.length;e++)this.openFrontierNode(o[e]);let i=this.unplaced,s=n?n.content:i.content,a=i.openStart-e,l=0,c=[],{match:d,type:u}=this.frontier[t];if(r){for(let e=0;e<r.childCount;e++)c.push(r.child(e));d=d.matchFragment(r)}let h=s.size+e-(i.content.size-i.openEnd);for(;l<s.childCount;){let e=s.child(l),t=d.matchType(e.type);if(!t)break;l++,(l>1||0==a||e.content.size)&&(d=t,c.push(Tr(e.mark(u.allowedMarks(e.marks)),1==l?a:0,l==s.childCount?h:-1)))}let p=l==s.childCount;p||(h=-1),this.placed=Or(this.placed,t,Ft.from(c)),this.frontier[t].match=d,p&&h<0&&n&&n.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let e=0,t=s;e<h;e++){let e=t.lastChild;this.frontier.push({type:e.type,match:e.contentMatchAt(e.childCount)}),t=e.content}this.unplaced=p?0==e?Zt.empty:new Zt(Er(i.content,e-1,1),e-1,h<0?i.openEnd:e-1):new Zt(Er(i.content,e,l),i.openStart,i.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let e,t=this.frontier[this.depth];if(!t.type.isTextblock||!Dr(this.$to,this.$to.depth,t.type,t.match,!1)||this.$to.depth==this.depth&&(e=this.findCloseLevel(this.$to))&&e.depth==this.depth)return-1;let{depth:n}=this.$to,r=this.$to.after(n);for(;n>1&&r==this.$to.end(--n);)++r;return r}findCloseLevel(e){e:for(let t=Math.min(this.depth,e.depth);t>=0;t--){let{match:n,type:r}=this.frontier[t],o=t<e.depth&&e.end(t+1)==e.pos+(e.depth-(t+1)),i=Dr(e,t,r,n,o);if(i){for(let n=t-1;n>=0;n--){let{match:t,type:r}=this.frontier[n],o=Dr(e,n,r,t,!0);if(!o||o.childCount)continue e}return{depth:t,fit:i,move:o?e.doc.resolve(e.after(t+1)):e}}}}close(e){let t=this.findCloseLevel(e);if(!t)return null;for(;this.depth>t.depth;)this.closeFrontierNode();t.fit.childCount&&(this.placed=Or(this.placed,t.depth,t.fit)),e=t.move;for(let n=t.depth+1;n<=e.depth;n++){let t=e.node(n),r=t.type.contentMatch.fillBefore(t.content,!0,e.index(n));this.openFrontierNode(t.type,t.attrs,r)}return e}openFrontierNode(e,t=null,n){let r=this.frontier[this.depth];r.match=r.match.matchType(e),this.placed=Or(this.placed,this.depth,Ft.from(e.create(t,n))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let e=this.frontier.pop().match.fillBefore(Ft.empty,!0);e.childCount&&(this.placed=Or(this.placed,this.frontier.length,e))}}function Er(e,t,n){return 0==t?e.cutByIndex(n,e.childCount):e.replaceChild(0,e.firstChild.copy(Er(e.firstChild.content,t-1,n)))}function Or(e,t,n){return 0==t?e.append(n):e.replaceChild(e.childCount-1,e.lastChild.copy(Or(e.lastChild.content,t-1,n)))}function Ar(e,t){for(let n=0;n<t;n++)e=e.firstChild.content;return e}function Tr(e,t,n){if(t<=0)return e;let r=e.content;return t>1&&(r=r.replaceChild(0,Tr(r.firstChild,t-1,1==r.childCount?n-1:0))),t>0&&(r=e.type.contentMatch.fillBefore(r).append(r),n<=0&&(r=r.append(e.type.contentMatch.matchFragment(r).fillBefore(Ft.empty,!0)))),e.copy(r)}function Dr(e,t,n,r,o){let i=e.node(t),s=o?e.indexAfter(t):e.index(t);if(s==i.childCount&&!n.compatibleContent(i.type))return null;let a=r.fillBefore(i.content,!0,s);return a&&!function(e,t,n){for(let r=n;r<t.childCount;r++)if(!e.allowsMarks(t.child(r).marks))return!0;return!1}(n,i.content,s)?a:null}function Ir(e){return e.spec.defining||e.spec.definingForContent}function _r(e,t,n,r,o){if(t<n){let o=e.firstChild;e=e.replaceChild(0,o.copy(_r(o.content,t+1,n,r,o)))}if(t>r){let t=o.contentMatchAt(0),n=t.fillBefore(e).append(e);e=n.append(t.matchFragment(n).fillBefore(Ft.empty,!0))}return e}function Rr(e,t){let n=[];for(let r=Math.min(e.depth,t.depth);r>=0;r--){let o=e.start(r);if(o<e.pos-(e.depth-r)||t.end(r)>t.pos+(t.depth-r)||e.node(r).type.spec.isolating||t.node(r).type.spec.isolating)break;(o==t.start(r)||r==e.depth&&r==t.depth&&e.parent.inlineContent&&t.parent.inlineContent&&r&&t.start(r-1)==o-1)&&n.push(r)}return n}class Lr extends ir{constructor(e,t,n){super(),this.pos=e,this.attr=t,this.value=n}apply(e){let t=e.nodeAt(this.pos);if(!t)return sr.fail("No node at attribute step's position");let n=Object.create(null);for(let e in t.attrs)n[e]=t.attrs[e];n[this.attr]=this.value;let r=t.type.create(n,null,t.marks);return sr.fromReplace(e,this.pos,this.pos+1,new Zt(Ft.from(r),0,t.isLeaf?0:1))}getMap(){return nr.empty}invert(e){return new Lr(this.pos,this.attr,e.nodeAt(this.pos).attrs[this.attr])}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new Lr(t.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(e,t){if("number"!=typeof t.pos||"string"!=typeof t.attr)throw new RangeError("Invalid input for AttrStep.fromJSON");return new Lr(t.pos,t.attr,t.value)}}ir.jsonID("attr",Lr);class Br extends ir{constructor(e,t){super(),this.attr=e,this.value=t}apply(e){let t=Object.create(null);for(let n in e.attrs)t[n]=e.attrs[n];t[this.attr]=this.value;let n=e.type.create(t,e.content,e.marks);return sr.ok(n)}getMap(){return nr.empty}invert(e){return new Br(this.attr,e.attrs[this.attr])}map(e){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(e,t){if("string"!=typeof t.attr)throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new Br(t.attr,t.value)}}ir.jsonID("docAttr",Br);let Pr=class extends Error{};Pr=function e(t){let n=Error.call(this,t);return n.__proto__=e.prototype,n},(Pr.prototype=Object.create(Error.prototype)).constructor=Pr,Pr.prototype.name="TransformError";class zr{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new rr}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let t=this.maybeStep(e);if(t.failed)throw new Pr(t.failed);return this}maybeStep(e){let t=e.apply(this.doc);return t.failed||this.addStep(e,t.doc),t}get docChanged(){return this.steps.length>0}changedRange(){let e=1e9,t=-1e9;for(let n=0;n<this.mapping.maps.length;n++){let r=this.mapping.maps[n];n&&(e=r.map(e,1),t=r.map(t,-1)),r.forEach((n,r,o,i)=>{e=Math.min(e,o),t=Math.max(t,i)})}return 1e9==e?null:{from:e,to:t}}addStep(e,t){this.docs.push(this.doc),this.steps.push(e),this.mapping.appendMap(e.getMap()),this.doc=t}replace(e,t=e,n=Zt.empty){let r=Sr(this.doc,e,t,n);return r&&this.step(r),this}replaceWith(e,t,n){return this.replace(e,t,new Zt(Ft.from(n),0,0))}delete(e,t){return this.replace(e,t,Zt.empty)}insert(e,t){return this.replaceWith(e,e,t)}replaceRange(e,t,n){return function(e,t,n,r){if(!r.size)return e.deleteRange(t,n);let o=e.doc.resolve(t),i=e.doc.resolve(n);if(Mr(o,i,r))return e.step(new hr(t,n,r));let s=Rr(o,i);0==s[s.length-1]&&s.pop();let a=-(o.depth+1);s.unshift(a);for(let e=o.depth,t=o.pos-1;e>0;e--,t--){let n=o.node(e).type.spec;if(n.defining||n.definingAsContext||n.isolating)break;s.indexOf(e)>-1?a=e:o.before(e)==t&&s.splice(1,0,-e)}let l=s.indexOf(a),c=[],d=r.openStart;for(let e=r.content,t=0;;t++){let n=e.firstChild;if(c.push(n),t==r.openStart)break;e=n.content}for(let e=d-1;e>=0;e--){let t=c[e],n=Ir(t.type);if(n&&!t.sameMarkup(o.node(Math.abs(a)-1)))d=e;else if(n||!t.type.isTextblock)break}for(let t=r.openStart;t>=0;t--){let a=(t+d+1)%(r.openStart+1),u=c[a];if(u)for(let t=0;t<s.length;t++){let c=s[(t+l)%s.length],d=!0;c<0&&(d=!1,c=-c);let h=o.node(c-1),p=o.index(c-1);if(h.canReplaceWith(p,p,u.type,u.marks))return e.replace(o.before(c),d?i.after(c):n,new Zt(_r(r.content,0,r.openStart,a),a,r.openEnd))}}let u=e.steps.length;for(let a=s.length-1;a>=0&&(e.replace(t,n,r),!(e.steps.length>u));a--){let e=s[a];e<0||(t=o.before(e),n=i.after(e))}}(this,e,t,n),this}replaceRangeWith(e,t,n){return function(e,t,n,r){if(!r.isInline&&t==n&&e.doc.resolve(t).parent.content.size){let o=function(e,t,n){let r=e.resolve(t);if(r.parent.canReplaceWith(r.index(),r.index(),n))return t;if(0==r.parentOffset)for(let e=r.depth-1;e>=0;e--){let t=r.index(e);if(r.node(e).canReplaceWith(t,t,n))return r.before(e+1);if(t>0)return null}if(r.parentOffset==r.parent.content.size)for(let e=r.depth-1;e>=0;e--){let t=r.indexAfter(e);if(r.node(e).canReplaceWith(t,t,n))return r.after(e+1);if(t<r.node(e).childCount)return null}return null}(e.doc,t,r.type);null!=o&&(t=n=o)}e.replaceRange(t,n,new Zt(Ft.from(r),0,0))}(this,e,t,n),this}deleteRange(e,t){return function(e,t,n){let r=e.doc.resolve(t),o=e.doc.resolve(n);if(r.parent.isTextblock&&o.parent.isTextblock&&r.start()!=o.start()&&0==r.parentOffset&&0==o.parentOffset){let i=r.sharedDepth(n),s=!1;for(let e=r.depth;e>i;e--)r.node(e).type.spec.isolating&&(s=!0);for(let e=o.depth;e>i;e--)o.node(e).type.spec.isolating&&(s=!0);if(!s){for(let e=r.depth;e>0&&t==r.start(e);e--)t=r.before(e);for(let e=o.depth;e>0&&n==o.start(e);e--)n=o.before(e);r=e.doc.resolve(t),o=e.doc.resolve(n)}}let i=Rr(r,o);for(let t=0;t<i.length;t++){let n=i[t],s=t==i.length-1;if(s&&0==n||r.node(n).type.contentMatch.validEnd)return e.delete(r.start(n),o.end(n));if(n>0&&(s||r.node(n-1).canReplace(r.index(n-1),o.indexAfter(n-1))))return e.delete(r.before(n),o.after(n))}for(let i=1;i<=r.depth&&i<=o.depth;i++)if(t-r.start(i)==r.depth-i&&n>r.end(i)&&o.end(i)-n!=o.depth-i&&r.start(i-1)==o.start(i-1)&&r.node(i-1).canReplace(r.index(i-1),o.index(i-1)))return e.delete(r.before(i),n);e.delete(t,n)}(this,e,t),this}lift(e,t){return function(e,t,n){let{$from:r,$to:o,depth:i}=t,s=r.before(i+1),a=o.after(i+1),l=s,c=a,d=Ft.empty,u=0;for(let e=i,t=!1;e>n;e--)t||r.index(e)>0?(t=!0,d=Ft.from(r.node(e).copy(d)),u++):l--;let h=Ft.empty,p=0;for(let e=i,t=!1;e>n;e--)t||o.after(e+1)<o.end(e)?(t=!0,h=Ft.from(o.node(e).copy(h)),p++):c++;e.step(new pr(l,c,s,a,new Zt(d.append(h),u,p),d.size-u,!0))}(this,e,t),this}join(e,t=1){return function(e,t,n){let r=null,{linebreakReplacement:o}=e.doc.type.schema,i=e.doc.resolve(t-n),s=i.node().type;if(o&&s.inlineContent){let e="pre"==s.whitespace,t=!!s.contentMatch.matchType(o);e&&!t?r=!1:!e&&t&&(r=!0)}let a=e.steps.length;if(!1===r){let r=e.doc.resolve(t+n);xr(e,r.node(),r.before(),a)}s.inlineContent&&mr(e,t+n-1,s,i.node().contentMatchAt(i.index()),null==r);let l=e.mapping.slice(a),c=l.map(t-n);if(e.step(new hr(c,l.map(t+n,-1),Zt.empty,!0)),!0===r){let t=e.doc.resolve(c);br(e,t.node(),t.before(),e.steps.length)}}(this,e,t),this}wrap(e,t){return function(e,t,n){let r=Ft.empty;for(let e=n.length-1;e>=0;e--){if(r.size){let t=n[e].type.contentMatch.matchFragment(r);if(!t||!t.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}r=Ft.from(n[e].type.create(n[e].attrs,r))}let o=t.start,i=t.end;e.step(new pr(o,i,o,i,new Zt(r,0,0),n.length,!0))}(this,e,t),this}setBlockType(e,t=e,n,r=null){return function(e,t,n,r,o){if(!r.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let i=e.steps.length;e.doc.nodesBetween(t,n,(t,n)=>{let s="function"==typeof o?o(t):o;if(t.isTextblock&&!t.hasMarkup(r,s)&&function(e,t,n){let r=e.resolve(t),o=r.index();return r.parent.canReplaceWith(o,o+1,n)}(e.doc,e.mapping.slice(i).map(n),r)){let o=null;if(r.schema.linebreakReplacement){let e="pre"==r.whitespace,t=!!r.contentMatch.matchType(r.schema.linebreakReplacement);e&&!t?o=!1:!e&&t&&(o=!0)}!1===o&&xr(e,t,n,i),mr(e,e.mapping.slice(i).map(n,1),r,void 0,null===o);let a=e.mapping.slice(i),l=a.map(n,1),c=a.map(n+t.nodeSize,1);return e.step(new pr(l,c,l+1,c-1,new Zt(Ft.from(r.create(s,null,t.marks)),0,0),1,!0)),!0===o&&br(e,t,n,i),!1}})}(this,e,t,n,r),this}setNodeMarkup(e,t,n=null,r){return function(e,t,n,r,o){let i=e.doc.nodeAt(t);if(!i)throw new RangeError("No node at given position");n||(n=i.type);let s=n.create(r,null,o||i.marks);if(i.isLeaf)return e.replaceWith(t,t+i.nodeSize,s);if(!n.validContent(i.content))throw new RangeError("Invalid content for node type "+n.name);e.step(new pr(t,t+i.nodeSize,t+1,t+i.nodeSize-1,new Zt(Ft.from(s),0,0),1,!0))}(this,e,t,n,r),this}setNodeAttribute(e,t,n){return this.step(new Lr(e,t,n)),this}setDocAttribute(e,t){return this.step(new Br(e,t)),this}addNodeMark(e,t){return this.step(new dr(e,t)),this}removeNodeMark(e,t){let n=this.doc.nodeAt(e);if(!n)throw new RangeError("No node at position "+e);if(t instanceof Kt)t.isInSet(n.marks)&&this.step(new ur(e,t));else{let r,o=n.marks,i=[];for(;r=t.isInSet(o);)i.push(new ur(e,r)),o=r.removeFromSet(o);for(let e=i.length-1;e>=0;e--)this.step(i[e])}return this}split(e,t=1,n){return function(e,t,n=1,r){let o=e.doc.resolve(t),i=Ft.empty,s=Ft.empty;for(let e=o.depth,t=o.depth-n,a=n-1;e>t;e--,a--){i=Ft.from(o.node(e).copy(i));let t=r&&r[a];s=Ft.from(t?t.type.create(t.attrs,s):o.node(e).copy(s))}e.step(new hr(t,t,new Zt(i.append(s),n,n),!0))}(this,e,t,n),this}addMark(e,t,n){return function(e,t,n,r){let o,i,s=[],a=[];e.doc.nodesBetween(t,n,(e,l,c)=>{if(!e.isInline)return;let d=e.marks;if(!r.isInSet(d)&&c.type.allowsMarkType(r.type)){let c=Math.max(l,t),u=Math.min(l+e.nodeSize,n),h=r.addToSet(d);for(let e=0;e<d.length;e++)d[e].isInSet(h)||(o&&o.to==c&&o.mark.eq(d[e])?o.to=u:s.push(o=new cr(c,u,d[e])));i&&i.to==c?i.to=u:a.push(i=new lr(c,u,r))}}),s.forEach(t=>e.step(t)),a.forEach(t=>e.step(t))}(this,e,t,n),this}removeMark(e,t,n){return function(e,t,n,r){let o=[],i=0;e.doc.nodesBetween(t,n,(e,s)=>{if(!e.isInline)return;i++;let a=null;if(r instanceof _n){let t,n=e.marks;for(;t=r.isInSet(n);)(a||(a=[])).push(t),n=t.removeFromSet(n)}else r?r.isInSet(e.marks)&&(a=[r]):a=e.marks;if(a&&a.length){let r=Math.min(s+e.nodeSize,n);for(let e=0;e<a.length;e++){let n,l=a[e];for(let e=0;e<o.length;e++){let t=o[e];t.step==i-1&&l.eq(o[e].style)&&(n=t)}n?(n.to=r,n.step=i):o.push({style:l,from:Math.max(s,t),to:r,step:i})}}}),o.forEach(t=>e.step(new cr(t.from,t.to,t.style)))}(this,e,t,n),this}clearIncompatible(e,t,n){return mr(this,e,t,n),this}}const jr=Object.create(null);class Vr{constructor(e,t,n){this.$anchor=e,this.$head=t,this.ranges=n||[new $r(e.min(t),e.max(t))]}get anchor(){return this.$anchor.pos}get head(){return this.$head.pos}get from(){return this.$from.pos}get to(){return this.$to.pos}get $from(){return this.ranges[0].$from}get $to(){return this.ranges[0].$to}get empty(){let e=this.ranges;for(let t=0;t<e.length;t++)if(e[t].$from.pos!=e[t].$to.pos)return!1;return!0}content(){return this.$from.doc.slice(this.from,this.to,!0)}replace(e,t=Zt.empty){let n=t.content.lastChild,r=null;for(let e=0;e<t.openEnd;e++)r=n,n=n.lastChild;let o=e.steps.length,i=this.ranges;for(let s=0;s<i.length;s++){let{$from:a,$to:l}=i[s],c=e.mapping.slice(o);e.replaceRange(c.map(a.pos),c.map(l.pos),s?Zt.empty:t),0==s&&Yr(e,o,(n?n.isInline:r&&r.isTextblock)?-1:1)}}replaceWith(e,t){let n=e.steps.length,r=this.ranges;for(let o=0;o<r.length;o++){let{$from:i,$to:s}=r[o],a=e.mapping.slice(n),l=a.map(i.pos),c=a.map(s.pos);o?e.deleteRange(l,c):(e.replaceRangeWith(l,c,t),Yr(e,n,t.isInline?-1:1))}}static findFrom(e,t,n=!1){let r=e.parent.inlineContent?new Fr(e):Zr(e.node(0),e.parent,e.pos,e.index(),t,n);if(r)return r;for(let r=e.depth-1;r>=0;r--){let o=t<0?Zr(e.node(0),e.node(r),e.before(r+1),e.index(r),t,n):Zr(e.node(0),e.node(r),e.after(r+1),e.index(r)+1,t,n);if(o)return o}return null}static near(e,t=1){return this.findFrom(e,t)||this.findFrom(e,-t)||new Kr(e.node(0))}static atStart(e){return Zr(e,e,0,0,1)||new Kr(e)}static atEnd(e){return Zr(e,e,e.content.size,e.childCount,-1)||new Kr(e)}static fromJSON(e,t){if(!t||!t.type)throw new RangeError("Invalid input for Selection.fromJSON");let n=jr[t.type];if(!n)throw new RangeError(`No selection type ${t.type} defined`);return n.fromJSON(e,t)}static jsonID(e,t){if(e in jr)throw new RangeError("Duplicate use of selection JSON ID "+e);return jr[e]=t,t.prototype.jsonID=e,t}getBookmark(){return Fr.between(this.$anchor,this.$head).getBookmark()}}Vr.prototype.visible=!0;class $r{constructor(e,t){this.$from=e,this.$to=t}}let Hr=!1;function qr(e){Hr||e.parent.inlineContent||(Hr=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+e.parent.type.name+")"))}class Fr extends Vr{constructor(e,t=e){qr(e),qr(t),super(e,t)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(e,t){let n=e.resolve(t.map(this.head));if(!n.parent.inlineContent)return Vr.near(n);let r=e.resolve(t.map(this.anchor));return new Fr(r.parent.inlineContent?r:n,n)}replace(e,t=Zt.empty){if(super.replace(e,t),t==Zt.empty){let t=this.$from.marksAcross(this.$to);t&&e.ensureMarks(t)}}eq(e){return e instanceof Fr&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new Wr(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(e,t){if("number"!=typeof t.anchor||"number"!=typeof t.head)throw new RangeError("Invalid input for TextSelection.fromJSON");return new Fr(e.resolve(t.anchor),e.resolve(t.head))}static create(e,t,n=t){let r=e.resolve(t);return new this(r,n==t?r:e.resolve(n))}static between(e,t,n){let r=e.pos-t.pos;if(n&&!r||(n=r>=0?1:-1),!t.parent.inlineContent){let e=Vr.findFrom(t,n,!0)||Vr.findFrom(t,-n,!0);if(!e)return Vr.near(t,n);t=e.$head}return e.parent.inlineContent||(0==r||(e=(Vr.findFrom(e,-n,!0)||Vr.findFrom(e,n,!0)).$anchor).pos<t.pos!=r<0)&&(e=t),new Fr(e,t)}}Vr.jsonID("text",Fr);class Wr{constructor(e,t){this.anchor=e,this.head=t}map(e){return new Wr(e.map(this.anchor),e.map(this.head))}resolve(e){return Fr.between(e.resolve(this.anchor),e.resolve(this.head))}}class Ur extends Vr{constructor(e){let t=e.nodeAfter,n=e.node(0).resolve(e.pos+t.nodeSize);super(e,n),this.node=t}map(e,t){let{deleted:n,pos:r}=t.mapResult(this.anchor),o=e.resolve(r);return n?Vr.near(o):new Ur(o)}content(){return new Zt(Ft.from(this.node),0,0)}eq(e){return e instanceof Ur&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new Gr(this.anchor)}static fromJSON(e,t){if("number"!=typeof t.anchor)throw new RangeError("Invalid input for NodeSelection.fromJSON");return new Ur(e.resolve(t.anchor))}static create(e,t){return new Ur(e.resolve(t))}static isSelectable(e){return!e.isText&&!1!==e.type.spec.selectable}}Ur.prototype.visible=!1,Vr.jsonID("node",Ur);class Gr{constructor(e){this.anchor=e}map(e){let{deleted:t,pos:n}=e.mapResult(this.anchor);return t?new Wr(n,n):new Gr(n)}resolve(e){let t=e.resolve(this.anchor),n=t.nodeAfter;return n&&Ur.isSelectable(n)?new Ur(t):Vr.near(t)}}class Kr extends Vr{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,t=Zt.empty){if(t==Zt.empty){e.delete(0,e.doc.content.size);let t=Vr.atStart(e.doc);t.eq(e.selection)||e.setSelection(t)}else super.replace(e,t)}toJSON(){return{type:"all"}}static fromJSON(e){return new Kr(e)}map(e){return new Kr(e)}eq(e){return e instanceof Kr}getBookmark(){return Jr}}Vr.jsonID("all",Kr);const Jr={map(){return this},resolve:e=>new Kr(e)};function Zr(e,t,n,r,o,i=!1){if(t.inlineContent)return Fr.create(e,n);for(let s=r-(o>0?0:1);o>0?s<t.childCount:s>=0;s+=o){let r=t.child(s);if(r.isAtom){if(!i&&Ur.isSelectable(r))return Ur.create(e,n-(o<0?r.nodeSize:0))}else{let t=Zr(e,r,n+o,o<0?r.childCount:0,o,i);if(t)return t}n+=r.nodeSize*o}return null}function Yr(e,t,n){let r=e.steps.length-1;if(r<t)return;let o,i=e.steps[r];(i instanceof hr||i instanceof pr)&&(e.mapping.maps[r].forEach((e,t,n,r)=>{null==o&&(o=r)}),e.setSelection(Vr.near(e.doc.resolve(o),n)))}class Xr extends zr{constructor(e){super(e.doc),this.curSelectionFor=0,this.updated=0,this.meta=Object.create(null),this.time=Date.now(),this.curSelection=e.selection,this.storedMarks=e.storedMarks}get selection(){return this.curSelectionFor<this.steps.length&&(this.curSelection=this.curSelection.map(this.doc,this.mapping.slice(this.curSelectionFor)),this.curSelectionFor=this.steps.length),this.curSelection}setSelection(e){if(e.$from.doc!=this.doc)throw new RangeError("Selection passed to setSelection must point at the current document");return this.curSelection=e,this.curSelectionFor=this.steps.length,this.updated=-3&this.updated|1,this.storedMarks=null,this}get selectionSet(){return(1&this.updated)>0}setStoredMarks(e){return this.storedMarks=e,this.updated|=2,this}ensureMarks(e){return Kt.sameSet(this.storedMarks||this.selection.$from.marks(),e)||this.setStoredMarks(e),this}addStoredMark(e){return this.ensureMarks(e.addToSet(this.storedMarks||this.selection.$head.marks()))}removeStoredMark(e){return this.ensureMarks(e.removeFromSet(this.storedMarks||this.selection.$head.marks()))}get storedMarksSet(){return(2&this.updated)>0}addStep(e,t){super.addStep(e,t),this.updated=-3&this.updated,this.storedMarks=null}setTime(e){return this.time=e,this}replaceSelection(e){return this.selection.replace(this,e),this}replaceSelectionWith(e,t=!0){let n=this.selection;return t&&(e=e.mark(this.storedMarks||(n.empty?n.$from.marks():n.$from.marksAcross(n.$to)||Kt.none))),n.replaceWith(this,e),this}deleteSelection(){return this.selection.replace(this),this}insertText(e,t,n){let r=this.doc.type.schema;if(null==t)return e?this.replaceSelectionWith(r.text(e),!0):this.deleteSelection();{if(null==n&&(n=t),!e)return this.deleteRange(t,n);let o=this.storedMarks;if(!o){let e=this.doc.resolve(t);o=n==t?e.marks():e.marksAcross(this.doc.resolve(n))}return this.replaceRangeWith(t,n,r.text(e,o)),this.selection.empty||this.selection.to!=t+e.length||this.setSelection(Vr.near(this.selection.$to)),this}}setMeta(e,t){return this.meta["string"==typeof e?e:e.key]=t,this}getMeta(e){return this.meta["string"==typeof e?e:e.key]}get isGeneric(){for(let e in this.meta)return!1;return!0}scrollIntoView(){return this.updated|=4,this}get scrolledIntoView(){return(4&this.updated)>0}}function Qr(e,t){return t&&e?e.bind(t):e}class eo{constructor(e,t,n){this.name=e,this.init=Qr(t.init,n),this.apply=Qr(t.apply,n)}}const to=[new eo("doc",{init:e=>e.doc||e.schema.topNodeType.createAndFill(),apply:e=>e.doc}),new eo("selection",{init:(e,t)=>e.selection||Vr.atStart(t.doc),apply:e=>e.selection}),new eo("storedMarks",{init:e=>e.storedMarks||null,apply:(e,t,n,r)=>r.selection.$cursor?e.storedMarks:null}),new eo("scrollToSelection",{init:()=>0,apply:(e,t)=>e.scrolledIntoView?t+1:t})];class no{constructor(e,t){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=to.slice(),t&&t.forEach(e=>{if(this.pluginsByKey[e.key])throw new RangeError("Adding different instances of a keyed plugin ("+e.key+")");this.plugins.push(e),this.pluginsByKey[e.key]=e,e.spec.state&&this.fields.push(new eo(e.key,e.spec.state,e))})}}class ro{constructor(e){this.config=e}get schema(){return this.config.schema}get plugins(){return this.config.plugins}apply(e){return this.applyTransaction(e).state}filterTransaction(e,t=-1){for(let n=0;n<this.config.plugins.length;n++)if(n!=t){let t=this.config.plugins[n];if(t.spec.filterTransaction&&!t.spec.filterTransaction.call(t,e,this))return!1}return!0}applyTransaction(e){if(!this.filterTransaction(e))return{state:this,transactions:[]};let t=[e],n=this.applyInner(e),r=null;for(;;){let o=!1;for(let i=0;i<this.config.plugins.length;i++){let s=this.config.plugins[i];if(s.spec.appendTransaction){let a=r?r[i].n:0,l=r?r[i].state:this,c=a<t.length&&s.spec.appendTransaction.call(s,a?t.slice(a):t,l,n);if(c&&n.filterTransaction(c,i)){if(c.setMeta("appendedTransaction",e),!r){r=[];for(let e=0;e<this.config.plugins.length;e++)r.push(e<i?{state:n,n:t.length}:{state:this,n:0})}t.push(c),n=n.applyInner(c),o=!0}r&&(r[i]={state:n,n:t.length})}}if(!o)return{state:n,transactions:t}}}applyInner(e){if(!e.before.eq(this.doc))throw new RangeError("Applying a mismatched transaction");let t=new ro(this.config),n=this.config.fields;for(let r=0;r<n.length;r++){let o=n[r];t[o.name]=o.apply(e,this[o.name],this,t)}return t}get tr(){return new Xr(this)}static create(e){let t=new no(e.doc?e.doc.type.schema:e.schema,e.plugins),n=new ro(t);for(let r=0;r<t.fields.length;r++)n[t.fields[r].name]=t.fields[r].init(e,n);return n}reconfigure(e){let t=new no(this.schema,e.plugins),n=t.fields,r=new ro(t);for(let t=0;t<n.length;t++){let o=n[t].name;r[o]=this.hasOwnProperty(o)?this[o]:n[t].init(e,r)}return r}toJSON(e){let t={doc:this.doc.toJSON(),selection:this.selection.toJSON()};if(this.storedMarks&&(t.storedMarks=this.storedMarks.map(e=>e.toJSON())),e&&"object"==typeof e)for(let n in e){if("doc"==n||"selection"==n)throw new RangeError("The JSON fields `doc` and `selection` are reserved");let r=e[n],o=r.spec.state;o&&o.toJSON&&(t[n]=o.toJSON.call(r,this[r.key]))}return t}static fromJSON(e,t,n){if(!t)throw new RangeError("Invalid input for EditorState.fromJSON");if(!e.schema)throw new RangeError("Required config field 'schema' missing");let r=new no(e.schema,e.plugins),o=new ro(r);return r.fields.forEach(r=>{if("doc"==r.name)o.doc=mn.fromJSON(e.schema,t.doc);else if("selection"==r.name)o.selection=Vr.fromJSON(o.doc,t.selection);else if("storedMarks"==r.name)t.storedMarks&&(o.storedMarks=t.storedMarks.map(e.schema.markFromJSON));else{if(n)for(let i in n){let s=n[i],a=s.spec.state;if(s.key==r.name&&a&&a.fromJSON&&Object.prototype.hasOwnProperty.call(t,i))return void(o[r.name]=a.fromJSON.call(s,e,t[i],o))}o[r.name]=r.init(e,o)}}),o}}function oo(e,t,n){for(let r in e){let o=e[r];o instanceof Function?o=o.bind(t):"handleDOMEvents"==r&&(o=oo(o,t,{})),n[r]=o}return n}class io{constructor(e){this.spec=e,this.props={},e.props&&oo(e.props,this,this.props),this.key=e.key?e.key.key:ao("plugin")}getState(e){return e[this.key]}}const so=Object.create(null);function ao(e){return e in so?e+"$"+ ++so[e]:(so[e]=0,e+"$")}class lo{constructor(e="key"){this.key=ao(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}const co=(e,t)=>!e.selection.empty&&(t&&t(e.tr.deleteSelection().scrollIntoView()),!0);function uo(e,t){let{$cursor:n}=e.selection;return!n||(t?!t.endOfTextblock("backward",e):n.parentOffset>0)?null:n}const ho=(e,t,n)=>{let r=uo(e,n);if(!r)return!1;let o=go(r);if(!o){let n=r.blockRange(),o=n&&vr(n);return null!=o&&(t&&t(e.tr.lift(n,o).scrollIntoView()),!0)}let i=o.nodeBefore;if(xo(e,o,t,-1))return!0;if(0==r.parent.content.size&&(fo(i,"end")||Ur.isSelectable(i)))for(let n=r.depth;;n--){let s=Sr(e.doc,r.before(n),r.after(n),Zt.empty);if(s&&s.slice.size<s.to-s.from){if(t){let n=e.tr.step(s);n.setSelection(fo(i,"end")?Vr.findFrom(n.doc.resolve(n.mapping.map(o.pos,-1)),-1):Ur.create(n.doc,o.pos-i.nodeSize)),t(n.scrollIntoView())}return!0}if(1==n||r.node(n-1).childCount>1)break}return!(!i.isAtom||o.depth!=r.depth-1)&&(t&&t(e.tr.delete(o.pos-i.nodeSize,o.pos).scrollIntoView()),!0)},po=(e,t,n)=>{let r=uo(e,n);if(!r)return!1;let o=go(r);return!!o&&function(e,t,n){let r=t.nodeBefore,o=r,i=t.pos-1;for(;!o.isTextblock;i--){if(o.type.spec.isolating)return!1;let e=o.lastChild;if(!e)return!1;o=e}let s=t.nodeAfter,a=s,l=t.pos+1;for(;!a.isTextblock;l++){if(a.type.spec.isolating)return!1;let e=a.firstChild;if(!e)return!1;a=e}let c=Sr(e.doc,i,l,Zt.empty);if(!c||c.from!=i||c instanceof hr&&c.slice.size>=l-i)return!1;if(n){let t=e.tr.step(c);t.setSelection(Fr.create(t.doc,i)),n(t.scrollIntoView())}return!0}(e,o,t)};function fo(e,t,n=!1){for(let r=e;r;r="start"==t?r.firstChild:r.lastChild){if(r.isTextblock)return!0;if(n&&1!=r.childCount)return!1}return!1}const mo=(e,t,n)=>{let{$head:r,empty:o}=e.selection,i=r;if(!o)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("backward",e):r.parentOffset>0)return!1;i=go(r)}let s=i&&i.nodeBefore;return!(!s||!Ur.isSelectable(s))&&(t&&t(e.tr.setSelection(Ur.create(e.doc,i.pos-s.nodeSize)).scrollIntoView()),!0)};function go(e){if(!e.parent.type.spec.isolating)for(let t=e.depth-1;t>=0;t--){if(e.index(t)>0)return e.doc.resolve(e.before(t+1));if(e.node(t).type.spec.isolating)break}return null}function vo(e){if(!e.parent.type.spec.isolating)for(let t=e.depth-1;t>=0;t--){let n=e.node(t);if(e.index(t)+1<n.childCount)return e.doc.resolve(e.after(t+1));if(n.type.spec.isolating)break}return null}function yo(e){for(let t=0;t<e.edgeCount;t++){let{type:n}=e.edge(t);if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}const wo=(e,t)=>{let{$head:n,$anchor:r}=e.selection;if(!n.parent.type.spec.code||!n.sameParent(r))return!1;let o=n.node(-1),i=n.indexAfter(-1),s=yo(o.contentMatchAt(i));if(!s||!o.canReplaceWith(i,i,s))return!1;if(t){let r=n.after(),o=e.tr.replaceWith(r,r,s.createAndFill());o.setSelection(Vr.near(o.doc.resolve(r),1)),t(o.scrollIntoView())}return!0};const bo=(e,t)=>{let{$from:n,$to:r}=e.selection;if(e.selection instanceof Ur&&e.selection.node.isBlock)return!(!n.parentOffset||!kr(e.doc,n.pos)||(t&&t(e.tr.split(n.pos).scrollIntoView()),0));if(!n.depth)return!1;let o,i,s=[],a=!1,l=!1;for(let e=n.depth;;e--){if(n.node(e).isBlock){a=n.end(e)==n.pos+(n.depth-e),l=n.start(e)==n.pos-(n.depth-e),i=yo(n.node(e-1).contentMatchAt(n.indexAfter(e-1))),s.unshift(a&&i?{type:i}:null),o=e;break}if(1==e)return!1;s.unshift(null)}let c=e.tr;(e.selection instanceof Fr||e.selection instanceof Kr)&&c.deleteSelection();let d=c.mapping.map(n.pos),u=kr(c.doc,d,s.length,s);if(u||(s[0]=i?{type:i}:null,u=kr(c.doc,d,s.length,s)),!u)return!1;if(c.split(d,s.length,s),!a&&l&&n.node(o).type!=i){let e=c.mapping.map(n.before(o)),t=c.doc.resolve(e);i&&n.node(o-1).canReplaceWith(t.index(),t.index()+1,i)&&c.setNodeMarkup(c.mapping.map(n.before(o)),i)}return t&&t(c.scrollIntoView()),!0};function xo(e,t,n,r){let o,i,s=t.nodeBefore,a=t.nodeAfter,l=s.type.spec.isolating||a.type.spec.isolating;if(!l&&function(e,t,n){let r=t.nodeBefore,o=t.nodeAfter,i=t.index();return!(!(r&&o&&r.type.compatibleContent(o.type))||(!r.content.size&&t.parent.canReplace(i-1,i)?(n&&n(e.tr.delete(t.pos-r.nodeSize,t.pos).scrollIntoView()),0):!t.parent.canReplace(i,i+1)||!o.isTextblock&&!Cr(e.doc,t.pos)||(n&&n(e.tr.join(t.pos).scrollIntoView()),0)))}(e,t,n))return!0;let c=!l&&t.parent.canReplace(t.index(),t.index()+1);if(c&&(o=(i=s.contentMatchAt(s.childCount)).findWrapping(a.type))&&i.matchType(o[0]||a.type).validEnd){if(n){let r=t.pos+a.nodeSize,i=Ft.empty;for(let e=o.length-1;e>=0;e--)i=Ft.from(o[e].create(null,i));i=Ft.from(s.copy(i));let l=e.tr.step(new pr(t.pos-1,r,t.pos,r,new Zt(i,1,0),o.length,!0)),c=l.doc.resolve(r+2*o.length);c.nodeAfter&&c.nodeAfter.type==s.type&&Cr(l.doc,c.pos)&&l.join(c.pos),n(l.scrollIntoView())}return!0}let d=a.type.spec.isolating||r>0&&l?null:Vr.findFrom(t,1),u=d&&d.$from.blockRange(d.$to),h=u&&vr(u);if(null!=h&&h>=t.depth)return n&&n(e.tr.lift(u,h).scrollIntoView()),!0;if(c&&fo(a,"start",!0)&&fo(s,"end")){let r=s,o=[];for(;o.push(r),!r.isTextblock;)r=r.lastChild;let i=a,l=1;for(;!i.isTextblock;i=i.firstChild)l++;if(r.canReplace(r.childCount,r.childCount,i.content)){if(n){let r=Ft.empty;for(let e=o.length-1;e>=0;e--)r=Ft.from(o[e].copy(r));n(e.tr.step(new pr(t.pos-o.length,t.pos+a.nodeSize,t.pos+l,t.pos+a.nodeSize-l,new Zt(r,o.length,0),0,!0)).scrollIntoView())}return!0}}return!1}function ko(e){return function(t,n){let r=t.selection,o=e<0?r.$from:r.$to,i=o.depth;for(;o.node(i).isInline;){if(!i)return!1;i--}return!!o.node(i).isTextblock&&(n&&n(t.tr.setSelection(Fr.create(t.doc,e<0?o.start(i):o.end(i)))),!0)}}const Co=ko(-1),So=ko(1);function Mo(e,t=null){return function(n,r){let{$from:o,$to:i}=n.selection,s=o.blockRange(i),a=s&&yr(s,e,t);return!!a&&(r&&r(n.tr.wrap(s,a).scrollIntoView()),!0)}}function No(e,t=null){return function(n,r){let o=!1;for(let r=0;r<n.selection.ranges.length&&!o;r++){let{$from:{pos:i},$to:{pos:s}}=n.selection.ranges[r];n.doc.nodesBetween(i,s,(r,i)=>{if(o)return!1;if(r.isTextblock&&!r.hasMarkup(e,t))if(r.type==e)o=!0;else{let t=n.doc.resolve(i),r=t.index();o=t.parent.canReplaceWith(r,r+1,e)}})}if(!o)return!1;if(r){let o=n.tr;for(let r=0;r<n.selection.ranges.length;r++){let{$from:{pos:i},$to:{pos:s}}=n.selection.ranges[r];o.setBlockType(i,s,e,t)}r(o.scrollIntoView())}return!0}}function Eo(e,t=null,n){return function(n,r){let{empty:o,$cursor:i,ranges:s}=n.selection;if(o&&!i||!function(e,t,n){for(let r=0;r<t.length;r++){let{$from:o,$to:i}=t[r],s=0==o.depth&&e.inlineContent&&e.type.allowsMarkType(n);if(e.nodesBetween(o.pos,i.pos,(e,t)=>{if(s)return!1;s=e.inlineContent&&e.type.allowsMarkType(n)}),s)return!0}return!1}(n.doc,s,e))return!1;if(r)if(i)e.isInSet(n.storedMarks||i.marks())?r(n.tr.removeStoredMark(e)):r(n.tr.addStoredMark(e.create(t)));else{let o,i=n.tr;o=!s.some(t=>n.doc.rangeHasMark(t.$from.pos,t.$to.pos,e));for(let n=0;n<s.length;n++){let{$from:r,$to:a}=s[n];if(o){let n=r.pos,o=a.pos,s=r.nodeAfter,l=a.nodeBefore,c=s&&s.isText?/^\s*/.exec(s.text)[0].length:0,d=l&&l.isText?/\s*$/.exec(l.text)[0].length:0;n+c<o&&(n+=c,o-=d),i.addMark(n,o,e.create(t))}else i.removeMark(r.pos,a.pos,e)}r(i.scrollIntoView())}return!0}}function Oo(...e){return function(t,n,r){for(let o=0;o<e.length;o++)if(e[o](t,n,r))return!0;return!1}}let Ao=Oo(co,ho,mo),To=Oo(co,(e,t,n)=>{let r=function(e,t){let{$cursor:n}=e.selection;return!n||(t?!t.endOfTextblock("forward",e):n.parentOffset<n.parent.content.size)?null:n}(e,n);if(!r)return!1;let o=vo(r);if(!o)return!1;let i=o.nodeAfter;if(xo(e,o,t,1))return!0;if(0==r.parent.content.size&&(fo(i,"start")||Ur.isSelectable(i))){let n=Sr(e.doc,r.before(),r.after(),Zt.empty);if(n&&n.slice.size<n.to-n.from){if(t){let r=e.tr.step(n);r.setSelection(fo(i,"start")?Vr.findFrom(r.doc.resolve(r.mapping.map(o.pos)),1):Ur.create(r.doc,r.mapping.map(o.pos))),t(r.scrollIntoView())}return!0}}return!(!i.isAtom||o.depth!=r.depth-1)&&(t&&t(e.tr.delete(o.pos,o.pos+i.nodeSize).scrollIntoView()),!0)},(e,t,n)=>{let{$head:r,empty:o}=e.selection,i=r;if(!o)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("forward",e):r.parentOffset<r.parent.content.size)return!1;i=vo(r)}let s=i&&i.nodeAfter;return!(!s||!Ur.isSelectable(s))&&(t&&t(e.tr.setSelection(Ur.create(e.doc,i.pos)).scrollIntoView()),!0)});const Do={Enter:Oo((e,t)=>{let{$head:n,$anchor:r}=e.selection;return!(!n.parent.type.spec.code||!n.sameParent(r))&&(t&&t(e.tr.insertText("\n").scrollIntoView()),!0)},(e,t)=>{let n=e.selection,{$from:r,$to:o}=n;if(n instanceof Kr||r.parent.inlineContent||o.parent.inlineContent)return!1;let i=yo(o.parent.contentMatchAt(o.indexAfter()));if(!i||!i.isTextblock)return!1;if(t){let n=(!r.parentOffset&&o.index()<o.parent.childCount?r:o).pos,s=e.tr.insert(n,i.createAndFill());s.setSelection(Fr.create(s.doc,n+1)),t(s.scrollIntoView())}return!0},(e,t)=>{let{$cursor:n}=e.selection;if(!n||n.parent.content.size)return!1;if(n.depth>1&&n.after()!=n.end(-1)){let r=n.before();if(kr(e.doc,r))return t&&t(e.tr.split(r).scrollIntoView()),!0}let r=n.blockRange(),o=r&&vr(r);return null!=o&&(t&&t(e.tr.lift(r,o).scrollIntoView()),!0)},bo),"Mod-Enter":wo,Backspace:Ao,"Mod-Backspace":Ao,"Shift-Backspace":Ao,Delete:To,"Mod-Delete":To,"Mod-a":(e,t)=>(t&&t(e.tr.setSelection(new Kr(e.doc))),!0)},Io={"Ctrl-h":Do.Backspace,"Alt-Backspace":Do["Mod-Backspace"],"Ctrl-d":Do.Delete,"Ctrl-Alt-Backspace":Do["Mod-Delete"],"Alt-Delete":Do["Mod-Delete"],"Alt-d":Do["Mod-Delete"],"Ctrl-a":Co,"Ctrl-e":So};for(let e in Do)Io[e]=Do[e];const _o=("undefined"!=typeof navigator?/Mac|iP(hone|[oa]d)/.test(navigator.platform):!("undefined"==typeof os||!os.platform)&&"darwin"==os.platform())?Io:Do;class Ro{constructor(e,t,n={}){var r;this.match=e,this.match=e,this.handler="string"==typeof t?(r=t,function(e,t,n,o){let i=r;if(t[1]){let e=t[0].lastIndexOf(t[1]);i+=t[0].slice(e+t[1].length);let r=(n+=e)-o;r>0&&(i=t[0].slice(e-r,e)+i,n=o)}return e.tr.insertText(i,n,o)}):t,this.undoable=!1!==n.undoable,this.inCode=n.inCode||!1,this.inCodeMark=!1!==n.inCodeMark}}const Lo=(e,t)=>{let n=e.plugins;for(let r=0;r<n.length;r++){let o,i=n[r];if(i.spec.isInputRules&&(o=i.getState(e))){if(t){let n=e.tr,r=o.transform;for(let e=r.steps.length-1;e>=0;e--)n.step(r.steps[e].invert(r.docs[e]));if(o.text){let t=n.doc.resolve(o.from).marks();n.replaceWith(o.from,o.to,e.schema.text(o.text,t))}else n.delete(o.from,o.to);t(n)}return!0}}return!1};function Bo(e,t,n=null,r){return new Ro(e,(e,o,i,s)=>{let a=n instanceof Function?n(o):n,l=e.tr.delete(i,s),c=l.doc.resolve(i).blockRange(),d=c&&yr(c,t,a);if(!d)return null;l.wrap(c,d);let u=l.doc.resolve(i-1).nodeBefore;return u&&u.type==t&&Cr(l.doc,i-1)&&(!r||r(o,u))&&l.join(i-1),l})}function Po(e,t,n=null){return new Ro(e,(e,r,o,i)=>{let s=e.doc.resolve(o),a=n instanceof Function?n(r):n;return s.node(-1).canReplaceWith(s.index(-1),s.indexAfter(-1),t)?e.tr.delete(o,i).setBlockType(o,o,t,a):null})}new Ro(/--$/,"—",{inCodeMark:!1}),new Ro(/\.\.\.$/,"…",{inCodeMark:!1}),new Ro(/(?:^|[\s\{\[\(\<'"\u2018\u201C])(")$/,"“",{inCodeMark:!1}),new Ro(/"$/,"”",{inCodeMark:!1}),new Ro(/(?:^|[\s\{\[\(\<'"\u2018\u201C])(')$/,"‘",{inCodeMark:!1}),new Ro(/'$/,"’",{inCodeMark:!1});const zo="undefined"!=typeof navigator?navigator:null,jo="undefined"!=typeof document?document:null,Vo=zo&&zo.userAgent||"",$o=/Edge\/(\d+)/.exec(Vo),Ho=/MSIE \d/.exec(Vo),qo=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Vo),Fo=!!(Ho||qo||$o),Wo=Ho?document.documentMode:qo?+qo[1]:$o?+$o[1]:0,Uo=!Fo&&/gecko\/(\d+)/i.test(Vo),Go=Uo&&+(/Firefox\/(\d+)/.exec(Vo)||[0,0])[1],Ko=!Fo&&/Chrome\/(\d+)/.exec(Vo),Jo=!!Ko,Zo=Ko?+Ko[1]:0,Yo=!Fo&&!!zo&&/Apple Computer/.test(zo.vendor),Xo=Yo&&(/Mobile\/\w+/.test(Vo)||!!zo&&zo.maxTouchPoints>2),Qo=Xo||!!zo&&/Mac/.test(zo.platform),ei=/Android \d/.test(Vo),ti=!!jo&&"webkitFontSmoothing"in jo.documentElement.style,ni=ti?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;var ri=Object.freeze({__proto__:null,android:ei,chrome:Jo,chrome_version:Zo,gecko:Uo,gecko_version:Go,ie:Fo,ie_version:Wo,ios:Xo,mac:Qo,safari:Yo,webkit:ti,webkit_version:ni});function oi(e,t,n,r,o,i){if(e.composing)return!1;const s=e.state,a=s.doc.resolve(t);if(a.parent.type.spec.code)return!1;const l=a.parent.textBetween(Math.max(0,a.parentOffset-500),a.parentOffset,void 0,"")+r;for(let a of o){const o=a,c=o.match.exec(l),d=c&&c[0]&&o.handler(s,c,t-(c[0].length-r.length),n);if(d)return!1!==o.undoable&&d.setMeta(i,{transform:d,from:t,to:n,text:r}),e.dispatch(d),!0}return!1}const ii=new lo("MILKDOWN_CUSTOM_INPUTRULES");function si({rules:e}){const t=new io({key:ii,isInputRules:!0,state:{init:()=>null,apply(e,t){const n=e.getMeta(this);return n||(e.selectionSet||e.docChanged?null:t)}},props:{handleTextInput:(n,r,o,i)=>oi(n,r,o,i,e,t),handleDOMEvents:{compositionend:n=>(setTimeout(()=>{const{$cursor:r}=n.state.selection;r&&oi(n,r.pos,r.pos,"",e,t)}),!1),keydown:(e,t)=>!(!ei||!Jo||"Enter"!==t.key)&&(!e.composing&&(!!e.someProp("handleKeyDown",n=>n(e,t))&&(t.preventDefault(),!0)))},handleKeyDown(n,r){if("Enter"!==r.key)return!1;const{$cursor:o}=n.state.selection;return!!o&&oi(n,o.pos,o.pos,"\n",e,t)}}});return t}function ai(e){return e.some(e=>e.type.spec.code)}function li(e,t,n){if(t>=n)return!1;let r=!1;return e.doc.nodesBetween(t,n,e=>(e.isInline&&ai(e.marks)&&(r=!0),!r)),r}function ci(e,t,n={}){return new Ro(e,(e,r,o,i)=>{var s,a,l,c;const{tr:d}=e;let u,h=r[r.length-1],p=r[0],f=[];const m={group:h,fullMatch:p,start:o,end:i},g=null==(s=n.updateCaptured)?void 0:s.call(n,m);if(Object.assign(m,g),({group:h,fullMatch:p,start:o,end:i}=m),null===p)return null;if(""===(null==h?void 0:h.trim()))return null;if(h){const s=p.search(/\S/),m=o+p.indexOf(h),g=m+h.length,v=li(e,o+s,m),y=g<i&&li(e,g,i);if(v||y||function(e,t){var n;return ai(null!=(n=e.storedMarks)?n:e.doc.resolve(t).marks())}(e,i))return null;f=null!=(a=d.storedMarks)?a:[],g<i&&d.delete(g,i),m>o&&d.delete(o+s,m),u=o+s+h.length;const w=null==(l=n.getAttr)?void 0:l.call(n,r);d.addMark(o,u,t.create(w)),d.setStoredMarks(f),null==(c=n.beforeDispatch)||c.call(n,{match:r,start:o,end:i,tr:d})}return d})}var di=Object.defineProperty,ui=Object.defineProperties,hi=Object.getOwnPropertyDescriptors,pi=Object.getOwnPropertySymbols,fi=Object.prototype.hasOwnProperty,mi=Object.prototype.propertyIsEnumerable,gi=(e,t,n)=>t in e?di(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;function vi(e=0,t=0,n=0){return Math.min(Math.max(e,t),n)}function yi(e,t,n){const r=e.state.doc.content.size,o=vi(t,0,r),i=vi(n,0,r),s=e.coordsAtPos(o),a=e.coordsAtPos(i,-1),l=Math.min(s.top,a.top),c=Math.max(s.bottom,a.bottom),d=Math.min(s.left,a.left),u=Math.max(s.right,a.right),h={top:l,bottom:c,left:d,right:u,width:u-d,height:c-l,x:d,y:l};return p=((e,t)=>{for(var n in t||(t={}))fi.call(t,n)&&gi(e,n,t[n]);if(pi)for(var n of pi(t))mi.call(t,n)&&gi(e,n,t[n]);return e})({},h),ui(p,hi({toJSON:()=>h}));var p}function wi(e){return Object.assign(Object.create(e),e).setTime(Date.now())}function bi(e){if(1===e.content.childCount){const t=e.content.firstChild;if("text"===(null==t?void 0:t.type.name)&&0===t.marks.length)return t;if("paragraph"===(null==t?void 0:t.type.name)&&1===t.childCount){const e=t.firstChild;if("text"===(null==e?void 0:e.type.name)&&0===e.marks.length)return e}}return!1}function xi(e){return t=>{for(let n=t.depth;n>0;n-=1){const r=t.node(n);if(e(r)){return{from:t.before(n),to:t.after(n),node:r}}}}}function ki(e,t){const n=t.nodes[e];if(!n)throw function(e,t){return new wt(yt.getAtomFromSchemaFail,`Cannot get ${e}: ${t} from schema.`)}("node",e);return n}function Ci(e){return t=>{for(let n=t.depth;n>0;n--){const r=t.node(n);if(e(r))return{pos:t.before(n),start:t.start(n),depth:n,node:r}}}}function Si(e,t){if(!(e instanceof Ur))return;const{node:n,$from:r}=e;return function(e,t){return Array.isArray(e)&&e.includes(t.type)||t.type===e}(t,n)?{node:n,pos:r.pos,start:r.start(r.depth),depth:r.depth}:void 0}const Mi=(e,t)=>{const{selection:n,doc:r}=e;if(n instanceof Ur)return{hasNode:n.node.type===t,pos:n.from,target:n.node};const{from:o,to:i}=n;let s=!1,a=-1,l=null;return r.nodesBetween(o,i,(e,n)=>!l&&(e.type!==t||(s=!0,a=n,l=e,!1))),{hasNode:s,pos:a,target:l}},Ni="undefined"!=typeof navigator&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),Ei="undefined"!=typeof navigator&&/Win/.test(navigator.platform);function Oi(e){let t,n,r,o,i=e.split(/-(?!$)/),s=i[i.length-1];"Space"==s&&(s=" ");for(let e=0;e<i.length-1;e++){let s=i[e];if(/^(cmd|meta|m)$/i.test(s))o=!0;else if(/^a(lt)?$/i.test(s))t=!0;else if(/^(c|ctrl|control)$/i.test(s))n=!0;else if(/^s(hift)?$/i.test(s))r=!0;else{if(!/^mod$/i.test(s))throw new Error("Unrecognized modifier name: "+s);Ni?o=!0:n=!0}}return t&&(s="Alt-"+s),n&&(s="Ctrl-"+s),o&&(s="Meta-"+s),r&&(s="Shift-"+s),s}function Ai(e,t,n=!0){return t.altKey&&(e="Alt-"+e),t.ctrlKey&&(e="Ctrl-"+e),t.metaKey&&(e="Meta-"+e),n&&t.shiftKey&&(e="Shift-"+e),e}function Ti(e){return new io({props:{handleKeyDown:Di(e)}})}function Di(e){let t=function(e){let t=Object.create(null);for(let n in e)t[Oi(n)]=e[n];return t}(e);return function(e,o){let i,s=n(o),a=t[Ai(s,o)];if(a&&a(e.state,e.dispatch,e))return!0;if(1==s.length&&" "!=s){if(o.shiftKey){let n=t[Ai(s,o,!1)];if(n&&n(e.state,e.dispatch,e))return!0}if((o.altKey||o.metaKey||o.ctrlKey)&&!(Ei&&o.ctrlKey&&o.altKey)&&(i=r[o.keyCode])&&i!=s){let n=t[Ai(i,o)];if(n&&n(e.state,e.dispatch,e))return!0}}return!1}}var Ii=class{},_i=class{constructor(){this.elements=[],this.size=()=>this.elements.length,this.top=()=>this.elements.at(-1),this.push=e=>{this.top()?.push(e)},this.open=e=>{this.elements.push(e)},this.close=()=>{const e=this.elements.pop();if(!e)throw Ct();return e}}},Ri=class e extends Ii{constructor(e,t,n){super(),this.type=e,this.content=t,this.attrs=n}push(e,...t){this.content.push(e,...t)}pop(){return this.content.pop()}static create(t,n,r){return new e(t,n,r)}},Li=class extends _i{#b;static{this.create=(e,t)=>{const n=new this(e);return e=>(n.run(t,e),n.toDoc())}}constructor(e){super(),this.#b=Kt.none,this.#x=e=>e.isText,this.#k=(e,t)=>{if(this.#x(e)&&this.#x(t)&&Kt.sameSet(e.marks,t.marks))return this.schema.text(e.text+t.text,e.marks)},this.#C=e=>{const t=Object.values({...this.schema.nodes,...this.schema.marks}).find(t=>t.spec.parseMarkdown.match(e));if(!t)throw function(e){return new wt(yt.parserMatchError,`Cannot match target parser for node: ${xt(e)}.`)}(e);return t},this.#S=e=>{const t=this.#C(e);t.spec.parseMarkdown.runner(this,e,t)},this.injectRoot=(e,t,n)=>(this.openNode(t,n),this.next(e.children),this),this.openNode=(e,t)=>(this.open(Ri.create(e,[],t)),this),this.#M=()=>{this.#b=Kt.none;const e=this.close();return this.#N(e.type,e.attrs,e.content)},this.closeNode=()=>{try{this.#M()}catch(e){console.error(e)}return this},this.#N=(e,t,n)=>{const r=e.createAndFill(t,n,this.#b);if(!r)throw function(e,t,n){const r=`Cannot create node for ${"name"in e?e.name:e}`,o=e=>{if(null==e)return"null";if(Array.isArray(e))return`[${e.map(o).join(", ")}]`;if("object"==typeof e)return"toJSON"in e&&"function"==typeof e.toJSON?JSON.stringify(e.toJSON()):"spec"in e?JSON.stringify(e.spec):JSON.stringify(e);if("string"==typeof e||"number"==typeof e||"boolean"==typeof e)return JSON.stringify(e);if("function"==typeof e)return`[Function: ${e.name||"anonymous"}]`;try{return String(e)}catch{return"[Unserializable]"}},i=[["[Description]",r],["[Attributes]",t],["[Content]",(n??[]).map(e=>e?"object"==typeof e&&"type"in e?`${e}`:o(e):"null")]].reduce((e,[t,n])=>{const r=`${t}: ${o(n)}.`;return e.concat(r)},[]);return new wt(yt.createNodeInParserFail,i.join("\n"))}(e,t,n);return this.push(r),r},this.addNode=(e,t,n)=>{try{this.#N(e,t,n)}catch(e){console.error(e)}return this},this.openMark=(e,t)=>{const n=e.create(t);return this.#b=n.addToSet(this.#b),this},this.closeMark=e=>(this.#b=e.removeFromSet(this.#b),this),this.addText=e=>{try{const t=this.top();if(!t)throw Ct();const n=t.pop(),r=this.schema.text(e,this.#b);if(!n)return t.push(r),this;const o=this.#k(n,r);return o?(t.push(o),this):(t.push(n,r),this)}catch(e){return console.error(e),this}},this.build=()=>{let e;do{e=this.#M()}while(this.size());return e},this.next=(e=[])=>([e].flat().forEach(e=>this.#S(e)),this),this.toDoc=()=>this.build(),this.run=(e,t)=>{const n=e.runSync(e.parse(t),t);return this.next(n),this},this.schema=e}#x;#k;#C;#S;#M;#N},Bi=class e extends Ii{constructor(e,t,n,r={}){super(),this.type=e,this.children=t,this.value=n,this.props=r,this.push=(e,...t)=>{this.children||(this.children=[]),this.children.push(e,...t)},this.pop=()=>this.children?.pop()}static{this.create=(t,n,r,o={})=>new e(t,n,r,o)}},Pi=class extends _i{#E;static{this.create=(e,t)=>{const n=new this(e);return e=>(n.run(e),n.toString(t))}}constructor(e){super(),this.#E=[],this.#C=e=>{const t=Object.values({...this.schema.nodes,...this.schema.marks}).find(t=>t.spec.toMarkdown.match(e));if(!t)throw function(e){return new wt(yt.serializerMatchError,`Cannot match target serializer for node: ${xt(e)}.`)}(e.type);return t},this.#O=e=>this.#C(e).spec.toMarkdown.runner(this,e),this.#A=(e,t)=>this.#C(e).spec.toMarkdown.runner(this,e,t),this.#T=e=>{const t=e=>e.type.spec.priority??50,n=[...e].sort((e,n)=>t(e)-t(n)),r=[];return this.#E.forEach(({mark:e})=>{const t=n.findIndex(t=>t.eq(e));t>=0&&r.push(...n.splice(t,1))}),r.concat(n)},this.#D=e=>{const t=e?.marks;let n=0;for(;n<this.#E.length;){const{mark:e,spanning:r}=this.#E[n];if(!r||!t?.some(t=>t.eq(e)))break;n++}for(let e=this.#E.length-1;e>=n;e--)this.#I(this.#E[e].mark)},this.#S=(e,t)=>{this.#T(e.marks).every(t=>!this.#A(t,e))&&this.#O(e),this.#D(t)},this.#_=e=>{const{children:t}=e;return t?(e.children=t.reduce((e,t,n)=>{if(0===n)return[t];const r=e.at(-1);if(r&&r.isMark&&t.isMark){const{children:n,...o}=t,{children:i,...s}=r;if(t.type===r.type&&n&&i&&JSON.stringify(o)===JSON.stringify(s)){const t={...s,children:[...i,...n]};return e.slice(0,-1).concat(this.#_(t))}}return e.concat(t)},[]),e):e},this.#R=e=>{const t={...e.props,type:e.type};return e.children&&(t.children=e.children),e.value&&(t.value=e.value),t},this.openNode=(e,t,n)=>(this.open(Bi.create(e,void 0,t,n)),this),this.#L=(e,t)=>{let n="",r="";const o=e.children;if(o){const e=o[0],t=o.at(-1);if(t&&"text"===t.type&&t.value.endsWith(" ")){const e=t.value,n=e.trimEnd();r=e.slice(n.length),t.value=n}if(e&&"text"===e.type&&e.value.startsWith(" ")){const t=e.value,r=t.trimStart();n=t.slice(0,t.length-r.length),e.value=r}}n.length&&this.#N("text",void 0,n);const i=t();return r.length&&this.#N("text",void 0,r),i},this.#M=(e=!1)=>{const t=this.close(),n=()=>this.#N(t.type,t.children,t.value,t.props);return e?this.#L(t,n):n()},this.closeNode=()=>(this.#M(),this),this.#N=(e,t,n,r)=>{const o=Bi.create(e,t,n,r),i=this.#_(this.#R(o));return this.push(i),i},this.addNode=(e,t,n,r)=>(this.#N(e,t,n,r),this),this.#B=(e,t,n,r)=>this.#E.some(t=>t.mark.eq(e))?this:(this.#E.push({mark:e,spanning:null==n}),this.openNode(t,n,{...r,isMark:!0})),this.#I=e=>{let t=-1;for(let n=this.#E.length-1;n>=0;n--)if(this.#E[n].mark.eq(e)){t=n;break}t<0||(this.#E.splice(t,1),this.#M(!0))},this.withMark=(e,t,n,r)=>(this.#B(e,t,n,r),this),this.closeMark=e=>(this.#I(e),this),this.build=()=>{let e=null;do{e=this.#M()}while(this.size());return e.children||(e.children=[]),e},this.next=e=>{return t=e,Object.prototype.hasOwnProperty.call(t,"size")?(e.forEach((t,n,r)=>{this.#S(t,e.maybeChild(r+1)??void 0)}),this):(this.#S(e),this);var t},this.toString=e=>e.stringify(this.build()),this.run=e=>(this.#E=[],this.next(e),this),this.schema=e}#C;#O;#A;#T;#D;#S;#_;#R;#L;#M;#N;#B;#I};const zi=function(e){for(var t=0;;t++)if(!(e=e.previousSibling))return t},ji=function(e){let t=e.assignedSlot||e.parentNode;return t&&11==t.nodeType?t.host:t};let Vi=null;const $i=function(e,t,n){let r=Vi||(Vi=document.createRange());return r.setEnd(e,null==n?e.nodeValue.length:n),r.setStart(e,t||0),r},Hi=function(e,t,n,r){return n&&(Fi(e,t,n,r,-1)||Fi(e,t,n,r,1))},qi=/^(img|br|input|textarea|hr)$/i;function Fi(e,t,n,r,o){for(var i;;){if(e==n&&t==r)return!0;if(t==(o<0?0:Wi(e))){let n=e.parentNode;if(!n||!Ui(n)||Ji(e)||qi.test(e.nodeName)||"false"==e.contentEditable)return!1;t=zi(e)+(o<0?0:1),e=n}else{if(!Ui(e))return!1;{let n=e.childNodes[t+(o<0?-1:0)];if(Ui(n)&&"false"==n.contentEditable){if(!(null===(i=n.pmViewDesc)||void 0===i?void 0:i.ignoreForSelection))return!1;t+=o}else e=n,t=o<0?Wi(e):0}}}}function Wi(e){return 3==e.nodeType?e.nodeValue.length:e.childNodes.length}function Ui(e){return 1==e.nodeType}function Gi(e){return 3==e.nodeType}function Ki(e,t){return!!t&&e.contains(Ui(t)?t:t.parentNode)}function Ji(e){let t;for(let n=e;n&&!(t=n.pmViewDesc);n=n.parentNode);return t&&t.node&&t.node.isBlock&&(t.dom==e||t.contentDOM==e)}const Zi=function(e){return e.focusNode&&Hi(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset)};const Yi="undefined"!=typeof navigator?navigator:null,Xi="undefined"!=typeof document?document:null,Qi=Yi&&Yi.userAgent||"",es=/Edge\/(\d+)/.exec(Qi),ts=/MSIE \d/.exec(Qi),ns=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Qi),rs=!!(ts||ns||es),is=ts?document.documentMode:ns?+ns[1]:es?+es[1]:0,ss=!rs&&/gecko\/(\d+)/i.test(Qi);ss&&(/Firefox\/(\d+)/.exec(Qi)||[0,0])[1];const as=!rs&&/Chrome\/(\d+)/.exec(Qi),ls=!!as,cs=as?+as[1]:0,ds=!rs&&!!Yi&&/Apple Computer/.test(Yi.vendor),us=ds&&(/Mobile\/\w+/.test(Qi)||!!Yi&&Yi.maxTouchPoints>2),hs=us||!!Yi&&/Mac/.test(Yi.platform),ps=!!Yi&&/Win/.test(Yi.platform),fs=/Android \d/.test(Qi),ms=!!Xi&&"webkitFontSmoothing"in Xi.documentElement.style,gs=ms?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function vs(e){let t=e.defaultView&&e.defaultView.visualViewport;return t?{left:0,right:t.width,top:0,bottom:t.height}:{left:0,right:e.documentElement.clientWidth,top:0,bottom:e.documentElement.clientHeight}}function ys(e,t){return"number"==typeof e?e:e[t]}function ws(e){let t=e.getBoundingClientRect(),n=t.width/e.offsetWidth||1,r=t.height/e.offsetHeight||1;return{left:t.left,right:t.left+e.clientWidth*n,top:t.top,bottom:t.top+e.clientHeight*r}}function bs(e,t,n){if(!Os(t)&&0==t.left)return;let r=e.someProp("scrollThreshold")||0,o=e.someProp("scrollMargin")||5,i=e.dom.ownerDocument;for(let s=n||e.dom;s;){if(!Ui(s)){s=ji(s);continue}let e=s==i.body,n=e?vs(i):ws(s),a=0,l=0;if(t.top<n.top+ys(r,"top")?l=-(n.top-t.top+ys(o,"top")):t.bottom>n.bottom-ys(r,"bottom")&&(l=t.bottom-t.top>n.bottom-n.top?t.top+ys(o,"top")-n.top:t.bottom-n.bottom+ys(o,"bottom")),t.left<n.left+ys(r,"left")?a=-(n.left-t.left+ys(o,"left")):t.right>n.right-ys(r,"right")&&(a=t.right-n.right+ys(o,"right")),a||l)if(e)i.defaultView.scrollBy(a,l);else{let e=s.scrollLeft,n=s.scrollTop;l&&(s.scrollTop+=l),a&&(s.scrollLeft+=a);let r=s.scrollLeft-e,o=s.scrollTop-n;t={left:t.left-r,top:t.top-o,right:t.right-r,bottom:t.bottom-o}}let c=e?"fixed":getComputedStyle(s).position;if(/^(fixed|sticky)$/.test(c))break;s="absolute"==c?s.offsetParent:ji(s)}}function xs(e){let t=[],n=e.ownerDocument;for(let r=e;r&&(t.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),e!=n);r=ji(r));return t}function ks(e,t){for(let n=0;n<e.length;n++){let{dom:r,top:o,left:i}=e[n];r.scrollTop!=o+t&&(r.scrollTop=o+t),r.scrollLeft!=i&&(r.scrollLeft=i)}}let Cs=null;function Ss(e,t){let n,r,o,i,s=2e8,a=0,l=t.top,c=t.top;for(let d=e.firstChild,u=0;d;d=d.nextSibling,u++){let e;if(Ui(d))e=d.getClientRects();else{if(!Gi(d))continue;e=$i(d).getClientRects()}for(let h=0;h<e.length;h++){let p=e[h];if(p.top<=l&&p.bottom>=c){l=Math.max(p.bottom,l),c=Math.min(p.top,c);let e=p.left>t.left?p.left-t.left:p.right<t.left?t.left-p.right:0;if(e<s){n=d,s=e,r=e&&Gi(n)?{left:p.right<t.left?p.right:p.left,top:t.top}:t,Ui(d)&&e&&(a=u+(t.left>=(p.left+p.right)/2?1:0));continue}}else p.top>t.top&&!o&&p.left<=t.left&&p.right>=t.left&&(o=d,i={left:Math.max(p.left,Math.min(p.right,t.left)),top:p.top});!n&&(t.left>=p.right&&t.top>=p.top||t.left>=p.left&&t.top>=p.bottom)&&(a=u+1)}}return!n&&o&&(n=o,r=i,s=0),n&&Gi(n)?function(e,t){let n,r=e.nodeValue.length,o=document.createRange();for(let i=0;i<r;i++){o.setEnd(e,i+1),o.setStart(e,i);let r=As(o,1);if(r.top!=r.bottom&&Ms(t,r)){n={node:e,offset:i+(t.left>=(r.left+r.right)/2?1:0)};break}}return o.detach(),n||{node:e,offset:0}}(n,r):!n||s?{node:e,offset:a}:Ss(n,r)}function Ms(e,t){return e.left>=t.left-1&&e.left<=t.right+1&&e.top>=t.top-1&&e.top<=t.bottom+1}function Ns(e,t,n){let r=e.childNodes.length;if(r&&n.top<n.bottom)for(let o=Math.max(0,Math.min(r-1,Math.floor(r*(t.top-n.top)/(n.bottom-n.top))-2)),i=o;;){let n=e.childNodes[i];if(Ui(n)){let e=n.getClientRects();for(let r=0;r<e.length;r++){let o=e[r];if(Ms(t,o))return Ns(n,t,o)}}if((i=(i+1)%r)==o)break}return e}function Es(e,t){let n,r=e.dom.ownerDocument,o=0,i=function(e,t,n){if(e.caretPositionFromPoint)try{let r=e.caretPositionFromPoint(t,n);if(r)return{node:r.offsetNode,offset:Math.min(Wi(r.offsetNode),r.offset)}}catch(e){}if(e.caretRangeFromPoint){let r=e.caretRangeFromPoint(t,n);if(r)return{node:r.startContainer,offset:Math.min(Wi(r.startContainer),r.startOffset)}}}(r,t.left,t.top);i&&({node:n,offset:o}=i);let s,a=(e.root.elementFromPoint?e.root:r).elementFromPoint(t.left,t.top);if(!a||!e.dom.contains(a)){let n=e.dom.getBoundingClientRect();if(!Ms(t,n))return null;if(a=Ns(e.dom,t,n),!a)return null}if(ds)for(let e=a;n&&e;e=ji(e))e.draggable&&(n=void 0);if(a=function(e,t){let n=e.parentNode;return n&&/^li$/i.test(n.nodeName)&&t.left<e.getBoundingClientRect().left?n:e}(a,t),n){if(ss&&Ui(n)&&(o=Math.min(o,n.childNodes.length),o<n.childNodes.length)){let e,r=n.childNodes[o];"IMG"==r.nodeName&&(e=r.getBoundingClientRect()).right<=t.left&&e.bottom>t.top&&o++}let r;ms&&o&&Ui(n)&&Ui(r=n.childNodes[o-1])&&"false"==r.contentEditable&&r.getBoundingClientRect().top>=t.top&&o--,n==e.dom&&o==n.childNodes.length-1&&Ui(n.lastChild)&&t.top>n.lastChild.getBoundingClientRect().bottom?s=e.state.doc.content.size:0!=o&&Ui(n)&&"BR"==n.childNodes[o-1].nodeName||(s=function(e,t,n,r){let o=-1;for(let n=t,i=!1;n!=e.dom;){let t,s=e.docView.nearestDesc(n,!0);if(!s)return null;if(Ui(s.dom)&&(s.node.isBlock&&s.parent||!s.contentDOM)&&((t=s.dom.getBoundingClientRect()).width||t.height)&&(s.node.isBlock&&s.parent&&!/^T(R|BODY|HEAD|FOOT)$/.test(s.dom.nodeName)&&(!i&&t.left>r.left||t.top>r.top?o=s.posBefore:(!i&&t.right<r.left||t.bottom<r.top)&&(o=s.posAfter),i=!0),!s.contentDOM&&o<0&&!s.node.isText))return(s.node.isBlock?r.top<(t.top+t.bottom)/2:r.left<(t.left+t.right)/2)?s.posBefore:s.posAfter;n=s.dom.parentNode}return o>-1?o:e.docView.posFromDOM(t,n,-1)}(e,n,o,t))}null==s&&(s=function(e,t,n){let{node:r,offset:o}=Ss(t,n),i=-1;if(Ui(r)&&!r.firstChild){let e=r.getBoundingClientRect();i=e.left!=e.right&&n.left>(e.left+e.right)/2?1:-1}return e.docView.posFromDOM(r,o,i)}(e,a,t));let l=e.docView.nearestDesc(a,!0);return{pos:s,inside:l?l.posAtStart-l.border:-1}}function Os(e){return e.top<e.bottom||e.left<e.right}function As(e,t){let n=e.getClientRects();if(n.length){let e=n[t<0?0:n.length-1];if(Os(e))return e}return Array.prototype.find.call(n,Os)||e.getBoundingClientRect()}const Ts=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function Ds(e,t,n){let{node:r,offset:o,atom:i}=e.docView.domFromPos(t,n<0?-1:1),s=ms||ss;if(Gi(r)){if(!s||!Ts.test(r.nodeValue)&&(n<0?o:o!=r.nodeValue.length)){let e=o,t=o,i=n<0?1:-1;return n<0&&!o?(t++,i=-1):n>=0&&o==r.nodeValue.length?(e--,i=1):n<0?e--:t++,Is(As($i(r,e,t),i),i<0)}{let e=As($i(r,o,o),n);if(ss&&o&&/\s/.test(r.nodeValue[o-1])&&o<r.nodeValue.length){let t=As($i(r,o-1,o-1),-1);if(t.top==e.top){let n=As($i(r,o,o+1),-1);if(n.top!=e.top)return Is(n,n.left<t.left)}}return e}}if(!e.state.doc.resolve(t-(i||0)).parent.inlineContent){if(null==i&&o&&(n<0||o==Wi(r))){let e=r.childNodes[o-1];if(Ui(e))return _s(e.getBoundingClientRect(),!1)}if(null==i&&o<Wi(r)){let e=r.childNodes[o];if(Ui(e))return _s(e.getBoundingClientRect(),!0)}return _s(r.getBoundingClientRect(),n>=0)}if(null==i&&o&&(n<0||o==Wi(r))){let e=r.childNodes[o-1],t=Gi(e)?$i(e,Wi(e)-(s?0:1)):!Ui(e)||"BR"==e.nodeName&&e.nextSibling?null:e;if(t)return Is(As(t,1),!1)}if(null==i&&o<Wi(r)){let e=r.childNodes[o];for(;e.pmViewDesc&&e.pmViewDesc.ignoreForCoords;)e=e.nextSibling;let t=e?Gi(e)?$i(e,0,s?0:1):Ui(e)?e:null:null;if(t)return Is(As(t,-1),!0)}return Is(As(Gi(r)?$i(r):r,-n),n>=0)}function Is(e,t){if(0==e.width)return e;let n=t?e.left:e.right;return{top:e.top,bottom:e.bottom,left:n,right:n}}function _s(e,t){if(0==e.height)return e;let n=t?e.top:e.bottom;return{top:n,bottom:n,left:e.left,right:e.right}}function Rs(e,t,n){let r=e.state,o=e.root.activeElement;r!=t&&e.updateState(t),o!=e.dom&&e.focus();try{return n()}finally{r!=t&&e.updateState(r),o!=e.dom&&o&&o.focus()}}const Ls=/[\u0590-\u08ac]/;let Bs=null,Ps=null,zs=!1;function js(e,t,n){return Bs==t&&Ps==n?zs:(Bs=t,Ps=n,zs="up"==n||"down"==n?function(e,t,n){let r=t.selection,o="up"==n?r.$from:r.$to;return Rs(e,t,()=>{let{node:t}=e.docView.domFromPos(o.pos,"up"==n?-1:1);for(;;){let n=e.docView.nearestDesc(t,!0);if(!n)break;if(n.node.isBlock){t=n.contentDOM||n.dom;break}t=n.dom.parentNode}let r=Ds(e,o.pos,1);for(let e=t.firstChild;e;e=e.nextSibling){let t;if(Ui(e))t=e.getClientRects();else{if(!Gi(e))continue;t=$i(e,0,e.nodeValue.length).getClientRects()}for(let e=0;e<t.length;e++){let o=t[e];if(o.bottom>o.top+1&&("up"==n?r.top-o.top>2*(o.bottom-r.top):o.bottom-r.bottom>2*(r.bottom-o.top)))return!1}}return!0})}(e,t,n):function(e,t,n){let{$head:r}=t.selection;if(!r.parent.isTextblock)return!1;let o=r.parentOffset,i=!o,s=o==r.parent.content.size,a=e.domSelection();return a?Ls.test(r.parent.textContent)&&a.modify?Rs(e,t,()=>{let{focusNode:t,focusOffset:o,anchorNode:i,anchorOffset:s}=e.domSelectionRange(),l=a.caretBidiLevel;a.modify("move",n,"character");let c=r.depth?e.docView.domAfterPos(r.before()):e.dom,{focusNode:d,focusOffset:u}=e.domSelectionRange(),h=d&&!Ki(c,d)||t==d&&o==u;try{a.collapse(i,s),t&&(t!=i||o!=s)&&a.extend&&a.extend(t,o)}catch(e){}return null!=l&&(a.caretBidiLevel=l),h}):"left"==n||"backward"==n?i:s:r.pos==r.start()||r.pos==r.end()}(e,t,n))}class Vs{constructor(e,t,n,r){this.parent=e,this.children=t,this.dom=n,this.contentDOM=r,this.dirty=0,n.pmViewDesc=this}matchesWidget(e){return!1}matchesMark(e){return!1}matchesNode(e,t,n){return!1}matchesHack(e){return!1}parseRule(e){return null}stopEvent(e){return!1}get size(){let e=0;for(let t=0;t<this.children.length;t++)e+=this.children[t].size;return e}get border(){return 0}destroy(){this.parent=void 0,this.dom.pmViewDesc==this&&(this.dom.pmViewDesc=void 0);for(let e=0;e<this.children.length;e++)this.children[e].destroy()}posBeforeChild(e){for(let t=0,n=this.posAtStart;;t++){let r=this.children[t];if(r==e)return n;n+=r.size}}get posBefore(){return this.parent.posBeforeChild(this)}get posAtStart(){return this.parent?this.parent.posBeforeChild(this)+this.border:0}get posAfter(){return this.posBefore+this.size}get posAtEnd(){return this.posAtStart+this.size-2*this.border}localPosFromDOM(e,t,n){if(this.contentDOM&&Ki(this.contentDOM,e)){if(n<0){let n,r;if(e==this.contentDOM)n=e.childNodes[t-1];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;n=e.previousSibling}for(;n&&(!(r=n.pmViewDesc)||r.parent!=this);)n=n.previousSibling;return n?this.posBeforeChild(r)+r.size:this.posAtStart}{let n,r;if(e==this.contentDOM)n=e.childNodes[t];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;n=e.nextSibling}for(;n&&(!(r=n.pmViewDesc)||r.parent!=this);)n=n.nextSibling;return n?this.posBeforeChild(r):this.posAtEnd}}let r;if(e==this.dom&&this.contentDOM)r=t>zi(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM)){let n=e.compareDocumentPosition(this.contentDOM);r=16&n?t>Array.from(e.childNodes).findIndex(e=>e.contains(this.contentDOM)):!(4&n)}else if(this.dom.firstChild){if(0==t)for(let t=e;;t=t.parentNode){if(t==this.dom){r=!1;break}if(t.previousSibling)break}if(null==r&&t==e.childNodes.length)for(let t=e;;t=t.parentNode){if(t==this.dom){r=!0;break}if(t.nextSibling)break}}return(null==r?n>0:r)?this.posAtEnd:this.posAtStart}nearestDesc(e,t=!1){for(let n=!0,r=e;r;r=r.parentNode){let o,i=this.getDesc(r);if(i&&(!t||i.node)){if(!n||!(o=i.nodeDOM)||(Ui(o)?Ki(o,e):o==e))return i;n=!1}}}getDesc(e){let t=e.pmViewDesc;for(let e=t;e;e=e.parent)if(e==this)return t}posFromDOM(e,t,n){for(let r=e;r;r=r.parentNode){let o=this.getDesc(r);if(o)return o.localPosFromDOM(e,t,n)}return-1}descAt(e){for(let t=0,n=0;t<this.children.length;t++){let r=this.children[t],o=n+r.size;if(n==e&&o!=n){for(;!r.border&&r.children.length;)for(let e=0;e<r.children.length;e++){let t=r.children[e];if(t.size){r=t;break}}return r}if(e<o)return r.descAt(e-n-r.border);n=o}}domFromPos(e,t){if(!this.contentDOM)return{node:this.dom,offset:0,atom:e+1};let n=0,r=0;for(let t=0;n<this.children.length;n++){let o=t+this.children[n].size;if(o>e){r=e-t;break}t=o}if(r)return this.children[n].domFromPos(r-this.children[n].border,t);for(;n>0;n--){let e=this.children[n-1];if(e.size||!(e instanceof Gs||e instanceof $s&&e.side>=0))break}if(t<=0){let e,r=!0;for(;e=n?this.children[n-1]:null,e&&e.dom.parentNode!=this.contentDOM;n--,r=!1);return e&&t&&r&&!e.border&&!e.domAtom?e.domFromPos(e.size,t):{node:this.contentDOM,offset:e?zi(e.dom)+1:0}}{let e,r=!0;for(;e=n<this.children.length?this.children[n]:null,e&&e.dom.parentNode!=this.contentDOM;n++,r=!1);return e&&r&&!e.border&&!e.domAtom?e.domFromPos(0,t):{node:this.contentDOM,offset:e?zi(e.dom):this.contentDOM.childNodes.length}}}parseRange(e,t,n=0){if(0==this.children.length)return{node:this.contentDOM,from:e,to:t,fromOffset:0,toOffset:this.contentDOM.childNodes.length};let r=-1,o=-1;for(let i=n,s=0;;s++){let n=this.children[s],a=i+n.size;if(-1==r&&e<=a){let o=i+n.border;if(e>=o&&t<=a-n.border&&n.node&&n.contentDOM&&this.contentDOM.contains(n.contentDOM))return n.parseRange(e,t,o);e=i;for(let t=s;t>0;t--){let n=this.children[t-1];if(n.size&&n.dom.parentNode==this.contentDOM&&!n.emptyChildAt(1)){r=zi(n.dom)+1;break}e-=n.size}-1==r&&(r=0)}if(r>-1&&(a>t||s==this.children.length-1)){t=a;for(let e=s+1;e<this.children.length;e++){let n=this.children[e];if(n.size&&n.dom.parentNode==this.contentDOM&&!n.emptyChildAt(-1)){o=zi(n.dom);break}t+=n.size}-1==o&&(o=this.contentDOM.childNodes.length);break}i=a}return{node:this.contentDOM,from:e,to:t,fromOffset:r,toOffset:o}}emptyChildAt(e){if(this.border||!this.contentDOM||!this.children.length)return!1;let t=this.children[e<0?0:this.children.length-1];return 0==t.size||t.emptyChildAt(e)}domAfterPos(e){let{node:t,offset:n}=this.domFromPos(e,0);if(!Ui(t)||n==t.childNodes.length)throw new RangeError("No node after pos "+e);return t.childNodes[n]}setSelection(e,t,n,r=!1){let o=Math.min(e,t),i=Math.max(e,t);for(let s=0,a=0;s<this.children.length;s++){let l=this.children[s],c=a+l.size;if(o>a&&i<c)return l.setSelection(e-a-l.border,t-a-l.border,n,r);a=c}let s=this.domFromPos(e,e?-1:1),a=t==e?s:this.domFromPos(t,t?-1:1),l=n.root.getSelection(),c=n.domSelectionRange(),d=!1;if((ss||ds)&&e==t){let{node:e,offset:t}=s;if(Gi(e)){if(d=!(!t||"\n"!=e.nodeValue[t-1]),d&&t==e.nodeValue.length)for(let t,n=e;n;n=n.parentNode){if(t=n.nextSibling){"BR"==t.nodeName&&(s=a={node:t.parentNode,offset:zi(t)+1});break}let e=n.pmViewDesc;if(e&&e.node&&e.node.isBlock)break}}else{let n=e.childNodes[t-1];d=n&&("BR"==n.nodeName||"false"==n.contentEditable)}}if(ss&&c.focusNode&&c.focusNode!=a.node&&Ui(c.focusNode)){let e=c.focusNode.childNodes[c.focusOffset];e&&"false"==e.contentEditable&&(r=!0)}if(!(r||d&&ds)&&Hi(s.node,s.offset,c.anchorNode,c.anchorOffset)&&Hi(a.node,a.offset,c.focusNode,c.focusOffset))return;let u=!1;if((l.extend||e==t)&&(!d||!ss)){l.collapse(s.node,s.offset);try{e!=t&&l.extend(a.node,a.offset),u=!0}catch(e){}}if(!u){if(e>t){let e=s;s=a,a=e}let n=document.createRange();n.setEnd(a.node,a.offset),n.setStart(s.node,s.offset),l.removeAllRanges(),l.addRange(n)}}ignoreMutation(e){return!this.contentDOM&&"selection"!=e.type}get contentLost(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}markDirty(e,t){for(let n=0,r=0;r<this.children.length;r++){let o=this.children[r],i=n+o.size;if(n==i?e<=i&&t>=n:e<i&&t>n){let r=n+o.border,s=i-o.border;if(e>=r&&t<=s)return this.dirty=e==n||t==i?2:1,void(e!=r||t!=s||!o.contentLost&&o.dom.parentNode==this.contentDOM?o.markDirty(e-r,t-r):o.dirty=3);o.dirty=o.dom!=o.contentDOM||o.dom.parentNode!=this.contentDOM||o.children.length?3:2}n=i}this.dirty=2}markParentsDirty(){let e=1;for(let t=this.parent;t;t=t.parent,e++){let n=1==e?2:1;t.dirty<n&&(t.dirty=n)}}get domAtom(){return!1}get ignoreForCoords(){return!1}get ignoreForSelection(){return!1}isText(e){return!1}}class $s extends Vs{constructor(e,t,n,r){let o,i=t.type.toDOM;if("function"==typeof i&&(i=i(n,()=>o?o.parent?o.parent.posBeforeChild(o):void 0:r)),!t.type.spec.raw){let e=Ui(i)?i:document.createElement("span");e!=i&&(e.appendChild(i),i=e),e.hasAttribute("contenteditable")||(e.contentEditable="false"),e.classList.add("ProseMirror-widget")}super(e,[],i,null),this.widget=t,this.widget=t,o=this}matchesWidget(e){return 0==this.dirty&&e.type.eq(this.widget.type)}parseRule(){return{ignore:!0}}stopEvent(e){let t=this.widget.spec.stopEvent;return!!t&&t(e)}ignoreMutation(e){return"selection"!=e.type||this.widget.spec.ignoreSelection}destroy(){this.widget.type.destroy(this.dom),super.destroy()}get domAtom(){return!0}get ignoreForSelection(){return!!this.widget.type.spec.relaxedSide}get side(){return this.widget.type.side}}class Hs extends Vs{constructor(e,t,n,r){super(e,[],t,null),this.textDOM=n,this.text=r}get size(){return this.text.length}localPosFromDOM(e,t){return e!=this.textDOM?this.posAtStart+(t?this.size:0):this.posAtStart+t}domFromPos(e){return{node:this.textDOM,offset:e}}ignoreMutation(e){return"characterData"===e.type&&e.target.nodeValue==e.oldValue}}class qs extends Vs{constructor(e,t,n,r,o){super(e,[],n,r),this.mark=t,this.spec=o}static create(e,t,n,r){let o=r.nodeViews[t.type.name],i=o&&o(t,r,n);return i&&i.dom||(i=Un.renderSpec(document,t.type.spec.toDOM(t,n),null,t.attrs)),new qs(e,t,i.dom,i.contentDOM||i.dom,i)}parseRule(){return 3&this.dirty||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return 3!=this.dirty&&this.mark.eq(e)}markDirty(e,t){if(super.markDirty(e,t),0!=this.dirty){let e=this.parent;for(;!e.node;)e=e.parent;e.dirty<this.dirty&&(e.dirty=this.dirty),this.dirty=0}}slice(e,t,n){let r=qs.create(this.parent,this.mark,!0,n),o=this.children,i=this.size;t<i&&(o=sa(o,t,i,n)),e>0&&(o=sa(o,0,e,n));for(let e=0;e<o.length;e++)o[e].parent=r;return r.children=o,r}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}}class Fs extends Vs{constructor(e,t,n,r,o,i,s){super(e,[],o,i),this.node=t,this.outerDeco=n,this.innerDeco=r,this.nodeDOM=s}static create(e,t,n,r,o,i){let s,a=o.nodeViews[t.type.name],l=a&&a(t,o,()=>s?s.parent?s.parent.posBeforeChild(s):void 0:i,n,r),c=l&&l.dom,d=l&&l.contentDOM;if(t.isText)if(c){if(!Gi(c))throw new RangeError("Text must be rendered as a DOM text node")}else c=document.createTextNode(t.text);else if(!c){let e=Un.renderSpec(document,t.type.spec.toDOM(t),null,t.attrs);({dom:c,contentDOM:d}=e)}d||t.isText||"BR"==c.nodeName||(c.hasAttribute("contenteditable")||(c.contentEditable="false"),t.type.spec.draggable&&(c.draggable=!0));let u=c;return c=ta(c,n,t),l?s=new Ks(e,t,n,r,c,d||null,u,l):t.isText?new Us(e,t,n,r,c,u):new Fs(e,t,n,r,c,d||null,u)}parseRule(e){if(this.node.type.spec.reparseInView)return null;let t={node:this.node.type.name,attrs:this.node.attrs};if("pre"==this.node.type.whitespace&&(t.preserveWhitespace="full"),this.contentDOM)if(this.contentLost){for(let e=this.children.length-1;e>=0;e--){let n=this.children[e];if(this.dom.contains(n.dom.parentNode)){t.contentElement=n.dom.parentNode;break}}if(!t.contentElement){let n=e&&e.find(t=>Ui(t)&&e.indexOf(t.parentNode)<0&&this.dom.contains(t));n?t.contentElement=n:t.getContent=()=>Ft.empty}}else t.contentElement=this.contentDOM;else t.getContent=()=>this.node.content;return t}matchesNode(e,t,n){return 0==this.dirty&&e.eq(this.node)&&na(t,this.outerDeco)&&n.eq(this.innerDeco)}get size(){return this.node.nodeSize}get border(){return this.node.isLeaf?0:1}updateChildren(e,t){let n=this.node.inlineContent,r=t,o=e.composing?this.localCompositionInfo(e,t):null,i=o&&o.pos>-1?o:null,s=o&&o.pos<0,a=new oa(this,i&&i.node,e),l=this.node.inlineContent,c=l&&this.node.isBlock;!function(e,t,n,r){let o=t.locals(e),i=0;if(0==o.length){for(let n=0;n<e.childCount;n++){let s=e.child(n);r(s,o,t.forChild(i,s),n),i+=s.nodeSize}return}let s=0,a=[],l=null;for(let c=0;;){let d,u,h,p;for(;s<o.length&&o[s].to==i;){let e=o[s++];e.widget&&(d?(u||(u=[d])).push(e):d=e)}if(d)if(u){u.sort(ia);for(let e=0;e<u.length;e++)n(u[e],c,!!l)}else n(d,c,!!l);if(l)p=-1,h=l,l=null;else{if(!(c<e.childCount))break;p=c,h=e.child(c++)}for(let e=0;e<a.length;e++)a[e].to<=i&&a.splice(e--,1);for(;s<o.length&&o[s].from<=i&&o[s].to>i;)a.push(o[s++]);let f=i+h.nodeSize;if(h.isText){let e=f;s<o.length&&o[s].from<e&&(e=o[s].from);for(let t=0;t<a.length;t++)a[t].to<e&&(e=a[t].to);e<f&&(l=h.cut(e-i),h=h.cut(0,e-i),f=e,p=-1)}else for(;s<o.length&&o[s].to<f;)s++;r(h,h.isInline&&!h.isLeaf?a.filter(e=>!e.inline):a.slice(),t.forChild(i,h),p),i=f}}(this.node,this.innerDeco,(t,o,i)=>{t.spec.marks?a.syncToMarks(t.spec.marks,n,e,o):t.type.side>=0&&!i&&a.syncToMarks(o==this.node.childCount?Kt.none:this.node.child(o).marks,n,e,o),a.placeWidget(t,e,r)},(t,i,d,u)=>{let h;a.syncToMarks(t.marks,n,e,u),c&&t.isAtom&&!t.isText&&a.addHackNode("IMG",a.top),a.findNodeMatch(t,i,d,u)||s&&e.state.selection.from>r&&e.state.selection.to<r+t.nodeSize&&(h=a.findIndexWithChild(o.node))>-1&&a.updateNodeAt(t,i,d,h,e)||a.updateNextNode(t,i,d,e,u,r)||a.addNode(t,i,d,e,r),r+=t.nodeSize,l&&(c=t.isAtom&&!t.isText)}),a.syncToMarks([],n,e,0),this.node.isTextblock&&a.addTextblockHacks(),a.destroyRest(),(a.changed||2==this.dirty)&&(i&&this.protectLocalComposition(e,i),Js(this.contentDOM,this.children,e),us&&function(e){if("UL"==e.nodeName||"OL"==e.nodeName){let t=e.style.cssText;e.style.cssText=t+"; list-style: square !important",window.getComputedStyle(e).listStyle,e.style.cssText=t}}(this.dom))}localCompositionInfo(e,t){let{from:n,to:r}=e.state.selection;if(!(e.state.selection instanceof Fr)||n<t||r>t+this.node.content.size)return null;let o=e.input.compositionNode;if(!o||!this.dom.contains(o.parentNode))return null;if(this.node.inlineContent){let e=o.nodeValue,i=function(e,t,n,r){for(let o=0,i=0;o<e.childCount&&i<=r;){let s=e.child(o++),a=i;if(i+=s.nodeSize,!s.isText)continue;let l=s.text;for(;o<e.childCount;){let t=e.child(o++);if(i+=t.nodeSize,!t.isText)break;l+=t.text}if(i>=n){if(i>=r&&l.slice(r-t.length-a,r-a)==t)return r-t.length;let e=a<r?l.lastIndexOf(t,r-a-1):-1;if(e>=0&&e+t.length+a>=n)return a+e;if(n==r&&l.length>=r+t.length-a&&l.slice(r-a,r-a+t.length)==t)return r}}return-1}(this.node.content,e,n-t,r-t);return i<0?null:{node:o,pos:i,text:e}}return{node:o,pos:-1,text:""}}protectLocalComposition(e,{node:t,pos:n,text:r}){if(this.getDesc(t))return;let o=t;for(;o.parentNode!=this.contentDOM;o=o.parentNode){for(;o.previousSibling;)o.parentNode.removeChild(o.previousSibling);for(;o.nextSibling;)o.parentNode.removeChild(o.nextSibling);o.pmViewDesc&&(o.pmViewDesc=void 0)}let i=new Hs(this,o,t,r);e.input.compositionNodes.push(i),this.children=sa(this.children,n,n+r.length,e,i)}update(e,t,n,r){return!(3==this.dirty||!e.sameMarkup(this.node))&&(this.updateInner(e,t,n,r),!0)}updateInner(e,t,n,r){this.updateOuterDeco(t),this.node=e,this.innerDeco=n,this.contentDOM&&this.updateChildren(r,this.posAtStart),this.dirty=0}updateOuterDeco(e){if(na(e,this.outerDeco))return;let t=!Ui(this.nodeDOM),n=this.dom;this.dom=Qs(this.dom,this.nodeDOM,Xs(this.outerDeco,this.node,t),Xs(e,this.node,t)),this.dom!=n&&(n.pmViewDesc=void 0,this.dom.pmViewDesc=this),this.outerDeco=e}selectNode(){Ui(this.nodeDOM)&&(this.nodeDOM.classList.add("ProseMirror-selectednode"),!this.contentDOM&&this.node.type.spec.draggable||(this.nodeDOM.draggable=!0))}deselectNode(){Ui(this.nodeDOM)&&(this.nodeDOM.classList.remove("ProseMirror-selectednode"),!this.contentDOM&&this.node.type.spec.draggable||this.nodeDOM.removeAttribute("draggable"))}get domAtom(){return this.node.isAtom}}function Ws(e,t,n,r,o){ta(r,t,e);let i=new Fs(void 0,e,t,n,r,r,r);return i.contentDOM&&i.updateChildren(o,0),i}class Us extends Fs{constructor(e,t,n,r,o,i){super(e,t,n,r,o,null,i)}parseRule(){let e=this.nodeDOM.parentNode;for(;e&&e!=this.dom&&!e.pmIsDeco;)e=e.parentNode;return{skip:e||!0}}update(e,t,n,r){return!(3==this.dirty||0!=this.dirty&&!this.inParent()||!e.sameMarkup(this.node))&&(this.updateOuterDeco(t),0==this.dirty&&e.text==this.node.text||e.text==this.nodeDOM.nodeValue||(this.nodeDOM.nodeValue=e.text,r.trackWrites==this.nodeDOM&&(r.trackWrites=null)),this.node=e,this.dirty=0,!0)}inParent(){let e=this.parent.contentDOM;for(let t=this.nodeDOM;t;t=t.parentNode)if(t==e)return!0;return!1}domFromPos(e){return{node:this.nodeDOM,offset:e}}localPosFromDOM(e,t,n){return e==this.nodeDOM?this.posAtStart+Math.min(t,this.node.text.length):super.localPosFromDOM(e,t,n)}ignoreMutation(e){return"characterData"!=e.type&&"selection"!=e.type}slice(e,t,n){let r=this.node.cut(e,t),o=document.createTextNode(r.text);return new Us(this.parent,r,this.outerDeco,this.innerDeco,o,o)}markDirty(e,t){super.markDirty(e,t),this.dom==this.nodeDOM||0!=e&&t!=this.nodeDOM.nodeValue.length||(this.dirty=3)}get domAtom(){return!1}isText(e){return this.node.text==e}}class Gs extends Vs{parseRule(){return{ignore:!0}}matchesHack(e){return 0==this.dirty&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return"IMG"==this.dom.nodeName}}class Ks extends Fs{constructor(e,t,n,r,o,i,s,a){super(e,t,n,r,o,i,s),this.spec=a}update(e,t,n,r){if(3==this.dirty)return!1;if(this.spec.update&&(this.node.type==e.type||this.spec.multiType)){let o=this.spec.update(e,t,n);return o&&this.updateInner(e,t,n,r),o}return!(!this.contentDOM&&!e.isLeaf)&&super.update(e,t,n,r)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(e,t,n,r){this.spec.setSelection?this.spec.setSelection(e,t,n.root):super.setSelection(e,t,n,r)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}stopEvent(e){return!!this.spec.stopEvent&&this.spec.stopEvent(e)}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}}function Js(e,t,n){let r=e.firstChild,o=!1;for(let i=0;i<t.length;i++){let s=t[i],a=s.dom;if(a.parentNode==e){for(;a!=r;)r=ra(r),o=!0;r=r.nextSibling}else o=!0,e.insertBefore(a,r);if(s instanceof qs){let t=r?r.previousSibling:e.lastChild;Js(s.contentDOM,s.children,n),r=t?t.nextSibling:e.firstChild}}for(;r;)r=ra(r),o=!0;o&&n.trackWrites==e&&(n.trackWrites=null)}const Zs=function(e){e&&(this.nodeName=e)};Zs.prototype=Object.create(null);const Ys=[new Zs];function Xs(e,t,n){if(0==e.length)return Ys;let r=n?Ys[0]:new Zs,o=[r];for(let i=0;i<e.length;i++){let s=e[i].type.attrs;if(s){s.nodeName&&o.push(r=new Zs(s.nodeName));for(let e in s){let i=s[e];null!=i&&(n&&1==o.length&&o.push(r=new Zs(t.isInline?"span":"div")),"class"==e?r.class=(r.class?r.class+" ":"")+i:"style"==e?r.style=(r.style?r.style+";":"")+i:"nodeName"!=e&&(r[e]=i))}}}return o}function Qs(e,t,n,r){if(n==Ys&&r==Ys)return t;let o=t;for(let t=0;t<r.length;t++){let i=r[t],s=n[t];if(t){let t;s&&s.nodeName==i.nodeName&&o!=e&&(t=o.parentNode)&&t.nodeName.toLowerCase()==i.nodeName||(t=document.createElement(i.nodeName),t.pmIsDeco=!0,t.appendChild(o),s=Ys[0]),o=t}ea(o,s||Ys[0],i)}return o}function ea(e,t,n){for(let r in t)"class"==r||"style"==r||"nodeName"==r||r in n||e.removeAttribute(r);for(let r in n)"class"!=r&&"style"!=r&&"nodeName"!=r&&n[r]!=t[r]&&e.setAttribute(r,n[r]);if(t.class!=n.class){let r=t.class?t.class.split(" ").filter(Boolean):[],o=n.class?n.class.split(" ").filter(Boolean):[];for(let t=0;t<r.length;t++)-1==o.indexOf(r[t])&&e.classList.remove(r[t]);for(let t=0;t<o.length;t++)-1==r.indexOf(o[t])&&e.classList.add(o[t]);0==e.classList.length&&e.removeAttribute("class")}if(t.style!=n.style){if(t.style){let n,r=/\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g;for(;n=r.exec(t.style);)e.style.removeProperty(n[1])}n.style&&(e.style.cssText+=n.style)}}function ta(e,t,n){return Qs(e,e,Ys,Xs(t,n,!Ui(e)))}function na(e,t){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(!e[n].type.eq(t[n].type))return!1;return!0}function ra(e){let t=e.nextSibling;return e.parentNode.removeChild(e),t}class oa{constructor(e,t,n){this.lock=t,this.view=n,this.index=0,this.stack=[],this.changed=!1,this.top=e,this.preMatch=function(e,t){let n=t,r=n.children.length,o=e.childCount,i=new Map,s=[];e:for(;o>0;){let a;for(;;)if(r){let e=n.children[r-1];if(!(e instanceof qs)){a=e,r--;break}n=e,r=e.children.length}else{if(n==t)break e;r=n.parent.children.indexOf(n),n=n.parent}let l=a.node;if(l){if(l!=e.child(o-1))break;--o,i.set(a,o),s.push(a)}}return{index:o,matched:i,matches:s.reverse()}}(e.node.content,e)}destroyBetween(e,t){if(e!=t){for(let n=e;n<t;n++)this.top.children[n].destroy();this.top.children.splice(e,t-e),this.changed=!0}}destroyRest(){this.destroyBetween(this.index,this.top.children.length)}syncToMarks(e,t,n,r){let o=0,i=this.stack.length>>1,s=Math.min(i,e.length);for(;o<s&&(o==i-1?this.top:this.stack[o+1<<1]).matchesMark(e[o])&&!1!==e[o].type.spec.spanning;)o++;for(;o<i;)this.destroyRest(),this.top.dirty=0,this.index=this.stack.pop(),this.top=this.stack.pop(),i--;for(;i<e.length;){this.stack.push(this.top,this.index+1);let o=-1,s=this.top.children.length;r<this.preMatch.index&&(s=Math.min(this.index+3,s));for(let t=this.index;t<s;t++){let n=this.top.children[t];if(n.matchesMark(e[i])&&!this.isLocked(n.dom)){o=t;break}}if(o<0&&this.index<this.top.children.length){let t=this.top.children[this.index];t instanceof qs&&3!=t.dirty&&t.mark.type==e[i].type&&t.spec.update&&!this.isLocked(t.dom)&&t.spec.update(e[i])&&(t.mark=e[i],o=this.index,this.changed=!0)}if(o>-1)o>this.index&&(this.changed=!0,this.destroyBetween(this.index,o)),this.top=this.top.children[this.index];else{let r=qs.create(this.top,e[i],t,n);this.top.children.splice(this.index,0,r),this.top=r,this.changed=!0}this.index=0,i++}}findNodeMatch(e,t,n,r){let o,i=-1;if(r>=this.preMatch.index&&(o=this.preMatch.matches[r-this.preMatch.index]).parent==this.top&&o.matchesNode(e,t,n))i=this.top.children.indexOf(o,this.index);else for(let r=this.index,o=Math.min(this.top.children.length,r+5);r<o;r++){let o=this.top.children[r];if(o.matchesNode(e,t,n)&&!this.preMatch.matched.has(o)){i=r;break}}return!(i<0)&&(this.destroyBetween(this.index,i),this.index++,!0)}updateNodeAt(e,t,n,r,o){let i=this.top.children[r];return 3==i.dirty&&i.dom==i.contentDOM&&(i.dirty=2),!!i.update(e,t,n,o)&&(this.destroyBetween(this.index,r),this.index++,!0)}findIndexWithChild(e){for(;;){let t=e.parentNode;if(!t)return-1;if(t==this.top.contentDOM){let t=e.pmViewDesc;if(t)for(let e=this.index;e<this.top.children.length;e++)if(this.top.children[e]==t)return e;return-1}e=t}}updateNextNode(e,t,n,r,o,i){for(let s=this.index;s<this.top.children.length;s++){let a=this.top.children[s];if(a instanceof Fs){let l=this.preMatch.matched.get(a);if(null!=l&&l!=o)return!1;let c,d=a.dom,u=this.isLocked(d)&&!(e.isText&&a.node&&a.node.isText&&a.nodeDOM.nodeValue==e.text&&3!=a.dirty&&na(t,a.outerDeco));if(!u&&a.update(e,t,n,r))return this.destroyBetween(this.index,s),a.dom!=d&&(this.changed=!0),this.index++,!0;if(!u&&(c=this.recreateWrapper(a,e,t,n,r,i)))return this.destroyBetween(this.index,s),this.top.children[this.index]=c,c.contentDOM&&(c.dirty=2,c.updateChildren(r,i+1),c.dirty=0),this.changed=!0,this.index++,!0;break}}return!1}recreateWrapper(e,t,n,r,o,i){if(e.dirty||t.isAtom||!e.children.length||!e.node.content.eq(t.content)||!na(n,e.outerDeco)||!r.eq(e.innerDeco))return null;let s=Fs.create(this.top,t,n,r,o,i);if(s.contentDOM){s.children=e.children,e.children=[];for(let e of s.children)e.parent=s}return e.destroy(),s}addNode(e,t,n,r,o){let i=Fs.create(this.top,e,t,n,r,o);i.contentDOM&&i.updateChildren(r,o+1),this.top.children.splice(this.index++,0,i),this.changed=!0}placeWidget(e,t,n){let r=this.index<this.top.children.length?this.top.children[this.index]:null;if(!r||!r.matchesWidget(e)||e!=r.widget&&r.widget.type.toDOM.parentNode){let r=new $s(this.top,e,t,n);this.top.children.splice(this.index++,0,r),this.changed=!0}else this.index++}addTextblockHacks(){let e=this.top.children[this.index-1],t=this.top;for(;e instanceof qs;)t=e,e=t.children[t.children.length-1];(!e||!(e instanceof Us)||/\n$/.test(e.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(e.node.text))&&((ds||ls)&&e&&"false"==e.dom.contentEditable&&this.addHackNode("IMG",t),this.addHackNode("BR",this.top))}addHackNode(e,t){if(t==this.top&&this.index<t.children.length&&t.children[this.index].matchesHack(e))this.index++;else{let n=document.createElement(e);"IMG"==e&&(n.className="ProseMirror-separator",n.alt=""),"BR"==e&&(n.className="ProseMirror-trailingBreak");let r=new Gs(this.top,[],n,null);t!=this.top?t.children.push(r):t.children.splice(this.index++,0,r),this.changed=!0}}isLocked(e){return this.lock&&(e==this.lock||Ui(e)&&e.contains(this.lock.parentNode))}}function ia(e,t){return e.type.side-t.type.side}function sa(e,t,n,r,o){let i=[];for(let s=0,a=0;s<e.length;s++){let l=e[s],c=a,d=a+=l.size;c>=n||d<=t?i.push(l):(c<t&&i.push(l.slice(0,t-c,r)),o&&(i.push(o),o=void 0),d>n&&i.push(l.slice(n-c,l.size,r)))}return i}function aa(e,t=null){let n=e.domSelectionRange(),r=e.state.doc;if(!n.focusNode)return null;let o=e.docView.nearestDesc(n.focusNode),i=o&&0==o.size,s=e.docView.posFromDOM(n.focusNode,n.focusOffset,1);if(s<0)return null;let a,l,c=r.resolve(s);if(Zi(n)){for(a=s;o&&!o.node;)o=o.parent;if(!(o&&o.node.isAtom&&Ur.isSelectable(o.node)&&o.parent)||o.node.isInline&&function(e,t,n){for(let r=0==t,o=t==Wi(e);r||o;){if(e==n)return!0;let t=zi(e);if(!(e=e.parentNode))return!1;r=r&&0==t,o=o&&t==Wi(e)}}(n.focusNode,n.focusOffset,o.dom)){if(ss&&"key"==t&&s>e.state.selection.to&&Ui(n.focusNode)&&n.focusOffset==n.focusNode.childNodes.length&&o&&o.posAtStart>e.state.selection.to)for(let e=n.focusNode;;e=e.parentNode){if("visible"!=getComputedStyle(e).overflow){l=Vr.findFrom(r.resolve(o.posAtStart),1);break}if(e==o.dom||e.nextSibling||!e.parentNode||!Ui(e.parentNode))break}}else{let e=o.posBefore;l=new Ur(s==e?c:r.resolve(e))}}else{if(n instanceof e.dom.ownerDocument.defaultView.Selection&&n.rangeCount>1){let t=s,o=s;for(let r=0;r<n.rangeCount;r++){let i=n.getRangeAt(r);t=Math.min(t,e.docView.posFromDOM(i.startContainer,i.startOffset,1)),o=Math.max(o,e.docView.posFromDOM(i.endContainer,i.endOffset,-1))}if(t<0)return null;[a,s]=o==e.state.selection.anchor?[o,t]:[t,o],c=r.resolve(s)}else a=e.docView.posFromDOM(n.anchorNode,n.anchorOffset,1);if(a<0)return null}let d=r.resolve(a);if(!l){l=ga(e,d,c,"pointer"==t||e.state.selection.head<c.pos&&!i?1:-1)}return l}function la(e){return e.editable?e.hasFocus():ya(e)&&document.activeElement&&document.activeElement.contains(e.dom)}function ca(e,t=!1){let n=e.state.selection;if(fa(e,n),!la(e))return;let r=e.input.mouseDown;if(!t&&ls&&r){let t=e.domSelectionRange(),n=e.domObserver.currentSelection;if(t.anchorNode&&n.anchorNode&&Hi(t.anchorNode,t.anchorOffset,n.anchorNode,n.anchorOffset)&&r.delaySelUpdate())return void e.domObserver.setCurSelection()}if(e.domObserver.disconnectSelection(),e.cursorWrapper)!function(e){let t=e.domSelection();if(!t)return;let n=e.cursorWrapper.dom,r="IMG"==n.nodeName;r?t.collapse(n.parentNode,zi(n)+1):t.collapse(n,0);!r&&!e.state.selection.visible&&rs&&is<=11&&(n.disabled=!0,n.disabled=!1)}(e);else{let r,o,{anchor:i,head:s}=n;!da||n instanceof Fr||(n.$from.parent.inlineContent||(r=ua(e,n.from)),n.empty||n.$from.parent.inlineContent||(o=ua(e,n.to))),e.docView.setSelection(i,s,e,t),da&&(r&&pa(r),o&&pa(o)),n.visible?e.dom.classList.remove("ProseMirror-hideselection"):(e.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&function(e){let t=e.dom.ownerDocument;t.removeEventListener("selectionchange",e.input.hideSelectionGuard);let n=e.domSelectionRange(),r=n.anchorNode,o=n.anchorOffset;t.addEventListener("selectionchange",e.input.hideSelectionGuard=()=>{n.anchorNode==r&&n.anchorOffset==o||(t.removeEventListener("selectionchange",e.input.hideSelectionGuard),setTimeout(()=>{la(e)&&!e.state.selection.visible||e.dom.classList.remove("ProseMirror-hideselection")},20))})}(e))}e.domObserver.setCurSelection(),e.domObserver.connectSelection()}const da=ds||ls&&cs<63;function ua(e,t){let{node:n,offset:r}=e.docView.domFromPos(t,0),o=r<n.childNodes.length?n.childNodes[r]:null,i=r?n.childNodes[r-1]:null;if(ds&&o&&"false"==o.contentEditable)return ha(o);if(!(o&&"false"!=o.contentEditable||i&&"false"!=i.contentEditable)){if(o)return ha(o);if(i)return ha(i)}}function ha(e){return e.contentEditable="true",ds&&e.draggable&&(e.draggable=!1,e.wasDraggable=!0),e}function pa(e){e.contentEditable="false",e.wasDraggable&&(e.draggable=!0,e.wasDraggable=null)}function fa(e,t){if(t instanceof Ur){let n=e.docView.descAt(t.from);n!=e.lastSelectedViewDesc&&(ma(e),n&&n.selectNode(),e.lastSelectedViewDesc=n)}else ma(e)}function ma(e){e.lastSelectedViewDesc&&(e.lastSelectedViewDesc.parent&&e.lastSelectedViewDesc.deselectNode(),e.lastSelectedViewDesc=void 0)}function ga(e,t,n,r){return e.someProp("createSelectionBetween",r=>r(e,t,n))||Fr.between(t,n,r)}function va(e){return!(e.editable&&!e.hasFocus())&&ya(e)}function ya(e){let t=e.domSelectionRange();if(!t.anchorNode)return!1;try{return Ki(e.dom,t.anchorNode)&&(e.editable||Ki(e.dom,t.focusNode))}catch(e){return!1}}function wa(e,t){let{$anchor:n,$head:r}=e.selection,o=t>0?n.max(r):n.min(r),i=o.parent.inlineContent?o.depth?e.doc.resolve(t>0?o.after():o.before()):null:o;return i&&Vr.findFrom(i,t)}function ba(e,t){return e.dispatch(e.state.tr.setSelection(t).scrollIntoView()),!0}function xa(e,t,n){let r=e.state.selection;if(!(r instanceof Fr)){if(r instanceof Ur&&r.node.isInline)return ba(e,new Fr(t>0?r.$to:r.$from));{let n=wa(e.state,t);return!!n&&ba(e,n)}}if(n.indexOf("s")>-1){let{$head:n}=r,o=n.textOffset?null:t<0?n.nodeBefore:n.nodeAfter;if(!o||o.isText||!o.isLeaf)return!1;let i=e.state.doc.resolve(n.pos+o.nodeSize*(t<0?-1:1));return ba(e,new Fr(r.$anchor,i))}if(!r.empty)return!1;if(e.endOfTextblock(t>0?"forward":"backward")){let n=wa(e.state,t);return!!(n&&n instanceof Ur)&&ba(e,n)}if(!hs||n.indexOf("m")<0){let n,o=r.$head,i=o.textOffset?null:t<0?o.nodeBefore:o.nodeAfter;if(!i||i.isText)return!1;let s=t<0?o.pos-i.nodeSize:o.pos;return!!(i.isAtom||(n=e.docView.descAt(s))&&!n.contentDOM)&&(Ur.isSelectable(i)?ba(e,new Ur(t<0?e.state.doc.resolve(o.pos-i.nodeSize):o)):ba(e,new Fr(e.state.doc.resolve(t<0?s:s+i.nodeSize))))}}function ka(e,t){let n=e.pmViewDesc;return n?0==n.size&&(t<0||e.nextSibling||"BR"!=e.nodeName):Ui(e)&&"false"==e.contentEditable}function Ca(e,t){return t<0?function(e){let t=e.domSelectionRange(),n=t.focusNode,r=t.focusOffset;if(!n)return;let o,i,s=!1;ss&&Ui(n)&&r<Wi(n)&&ka(n.childNodes[r],-1)&&(s=!0);for(;;)if(r>0){if(!Ui(n))break;let e=n.childNodes[r-1];if(ka(e,-1))o=n,i=--r;else{if(!Gi(e))break;n=e,r=n.nodeValue.length}}else{if(Sa(n))break;{let t=n.previousSibling;for(;t&&ka(t,-1);)o=n.parentNode,i=zi(t),t=t.previousSibling;if(t)n=t,r=Wi(n);else{if(n=n.parentNode,n==e.dom)break;r=0}}}s?Ma(e,n,r):o&&Ma(e,o,i)}(e):function(e){let t=e.domSelectionRange(),n=t.focusNode,r=t.focusOffset;if(!n)return;let o,i,s=Wi(n);for(;;)if(r<s){if(!Ui(n))break;if(!ka(n.childNodes[r],1))break;o=n,i=++r}else{if(Sa(n))break;{let t=n.nextSibling;for(;t&&ka(t,1);)o=t.parentNode,i=zi(t)+1,t=t.nextSibling;if(t)n=t,r=0,s=Wi(n);else{if(n=n.parentNode,n==e.dom)break;r=s=0}}}o&&Ma(e,o,i)}(e)}function Sa(e){let t=e.pmViewDesc;return t&&t.node&&t.node.isBlock}function Ma(e,t,n){if(!Gi(t)){let e,r;(r=function(e,t){for(;e&&t==e.childNodes.length&&!Ji(e);)t=zi(e)+1,e=e.parentNode;for(;e&&t<e.childNodes.length;){let n=e.childNodes[t];if(Gi(n))return n;if(Ui(n)&&"false"==n.contentEditable)break;e=n,t=0}}(t,n))?(t=r,n=0):(e=function(e,t){for(;e&&!t&&!Ji(e);)t=zi(e),e=e.parentNode;for(;e&&t;){let n=e.childNodes[t-1];if(Gi(n))return n;if(Ui(n)&&"false"==n.contentEditable)break;t=(e=n).childNodes.length}}(t,n))&&(t=e,n=e.nodeValue.length)}let r=e.domSelection(),o=e.domSelectionRange();if(!r)return;Zi(o)?r.collapse(t,n):r.extend&&(r.collapse(o.anchorNode,o.anchorOffset),r.extend(t,n)),e.domObserver.setCurSelection();let{state:i}=e;setTimeout(()=>{e.state==i&&ca(e)},50)}function Na(e,t){let n=e.state.doc.resolve(t);if(!ls&&!ps&&n.parent.inlineContent){let r=e.coordsAtPos(t);if(t>n.start()){let n=e.coordsAtPos(t-1),o=(n.top+n.bottom)/2;if(o>r.top&&o<r.bottom&&Math.abs(n.left-r.left)>1)return n.left<r.left?"ltr":"rtl"}if(t<n.end()){let n=e.coordsAtPos(t+1),o=(n.top+n.bottom)/2;if(o>r.top&&o<r.bottom&&Math.abs(n.left-r.left)>1)return n.left>r.left?"ltr":"rtl"}}let r=e.dom;for(let t=n.depth;t>0;t--)if(n.node(t).isBlock){r=e.nodeDOM(n.before(t))||r;break}return"rtl"==getComputedStyle(r).direction?"rtl":"ltr"}function Ea(e,t,n){let r=e.state.selection;if(r instanceof Fr&&!r.empty||n.indexOf("s")>-1)return!1;if(hs&&n.indexOf("m")>-1)return!1;let{$from:o,$to:i}=r;if(!o.parent.inlineContent||e.endOfTextblock(t<0?"up":"down")){let n=wa(e.state,t);if(n&&n instanceof Ur)return ba(e,n)}if(!o.parent.inlineContent){let n=t<0?o:i,s=r instanceof Kr?Vr.near(n,t):Vr.findFrom(n,t);return!!s&&ba(e,s)}return!1}function Oa(e,t){if(!(e.state.selection instanceof Fr))return!0;let{$head:n,$anchor:r,empty:o}=e.state.selection;if(!n.sameParent(r))return!0;if(!o)return!1;if(e.endOfTextblock(t>0?"forward":"backward"))return!0;let i=!n.textOffset&&(t<0?n.nodeBefore:n.nodeAfter);if(i&&!i.isText){let r=e.state.tr;return t<0?r.delete(n.pos-i.nodeSize,n.pos):r.delete(n.pos,n.pos+i.nodeSize),e.dispatch(r),!0}return!1}function Aa(e,t,n){e.domObserver.stop(),t.contentEditable=n,e.domObserver.start()}function Ta(e,t){let n=t.keyCode,r=function(e){let t="";return e.ctrlKey&&(t+="c"),e.metaKey&&(t+="m"),e.altKey&&(t+="a"),e.shiftKey&&(t+="s"),t}(t);if(8==n||hs&&72==n&&"c"==r)return Oa(e,-1)||Ca(e,-1);if(46==n&&!t.shiftKey||hs&&68==n&&"c"==r)return Oa(e,1)||Ca(e,1);if(13==n||27==n)return!0;if(37==n||hs&&66==n&&"c"==r){let t=37==n?"ltr"==Na(e,e.state.selection.from)?-1:1:-1;return xa(e,t,r)||Ca(e,t)}if(39==n||hs&&70==n&&"c"==r){let t=39==n?"ltr"==Na(e,e.state.selection.from)?1:-1:1;return xa(e,t,r)||Ca(e,t)}return 38==n||hs&&80==n&&"c"==r?Ea(e,-1,r)||Ca(e,-1):40==n||hs&&78==n&&"c"==r?function(e){if(!ds||e.state.selection.$head.parentOffset>0)return!1;let{focusNode:t,focusOffset:n}=e.domSelectionRange();if(t&&Ui(t)&&0==n&&t.firstChild&&Ui(t.firstChild)&&"false"==t.firstChild.contentEditable){let n=t.firstChild;Aa(e,n,"true"),setTimeout(()=>Aa(e,n,"false"),20)}return!1}(e)||Ea(e,1,r)||Ca(e,1):r==(hs?"m":"c")&&(66==n||73==n||89==n||90==n)}function Da(e,t){e.someProp("transformCopied",n=>{t=n(t,e)});let n=[],{content:r,openStart:o,openEnd:i}=t;for(;o>1&&i>1&&1==r.childCount&&1==r.firstChild.childCount;){o--,i--;let e=r.firstChild;n.push(e.type.name,e.attrs!=e.type.defaultAttrs?e.attrs:null),r=e.content}let s=e.someProp("clipboardSerializer")||Un.fromSchema(e.state.schema),a=Va(),l=a.createElement("div");l.appendChild(s.serializeFragment(r,{document:a}));let c,d=l.firstChild,u=0;for(;d&&Ui(d)&&(c=ja[d.nodeName.toLowerCase()]);){for(let e=c.length-1;e>=0;e--){let t=a.createElement(c[e]);for(;l.firstChild;)t.appendChild(l.firstChild);l.appendChild(t),u++}d=l.firstChild}return d&&Ui(d)&&d.setAttribute("data-pm-slice",`${o} ${i}${u?` -${u}`:""} ${JSON.stringify(n)}`),{dom:l,text:e.someProp("clipboardTextSerializer",n=>n(t,e))||t.content.textBetween(0,t.content.size,"\n\n"),slice:t}}function Ia(e,t,n,r,o){let i,s,a=o.parent.type.spec.code;if(!n&&!t)return null;let l=!!t&&(r||a||!n);if(l){if(e.someProp("transformPastedText",n=>{t=n(t,a||r,e)}),a)return s=new Zt(Ft.from(e.state.schema.text(t.replace(/\r\n?/g,"\n"))),0,0),e.someProp("transformPasted",t=>{s=t(s,e,!0)}),s;let n=e.someProp("clipboardTextParser",n=>n(t,o,r,e));if(n)s=n;else{let n=o.marks(),{schema:r}=e.state,s=Un.fromSchema(r);i=document.createElement("div"),t.split(/(?:\r\n?|\n)+/).forEach(e=>{let t=i.appendChild(document.createElement("p"));e&&t.appendChild(s.serializeNode(r.text(e,n)))})}}else e.someProp("transformPastedHTML",t=>{n=t(n,e)}),i=function(e){let t=/^(\s*<meta [^>]*>)*/.exec(e);t&&(e=e.slice(t[0].length));let n,r=Va(),o=r.body,i=/<([a-z][^>\s]+)/i.exec(e);(n=i&&ja[i[1].toLowerCase()])&&(e=n.map(e=>"<"+e+">").join("")+e+n.map(e=>"</"+e+">").reverse().join(""));if(o.innerHTML=function(e){let t=window.trustedTypes;if(!t)return e;if(!$a){if($a=t.defaultPolicy)try{return $a.createHTML(e)}catch(e){}$a=t.createPolicy("ProseMirrorClipboard",{createHTML:e=>e})}return $a.createHTML(e)}(e),n)for(let e=0;e<n.length;e++)o=o.querySelector(n[e])||o;for(let e=0;e<r.styleSheets.length;e++){let t=r.styleSheets[e];for(let e=0;e<t.rules.length;e++){let n=t.rules[e];if(n instanceof CSSStyleRule){let e=o.querySelectorAll(n.selectorText);for(let t=0;t<e.length;t++)e[t].style.cssText+=n.style.cssText}}}return o}(n),ms&&function(e){let t=e.querySelectorAll(ls?"span:not([class]):not([style])":"span.Apple-converted-space");for(let n=0;n<t.length;n++){let r=t[n];1==r.childNodes.length&&" "==r.textContent&&r.parentNode&&r.parentNode.replaceChild(e.ownerDocument.createTextNode(" "),r)}}(i);let c=i&&i.querySelector("[data-pm-slice]"),d=c&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(c.getAttribute("data-pm-slice")||"");if(d&&d[3])for(let e=+d[3];e>0;e--){let e=i.firstChild;for(;e&&!Ui(e);)e=e.nextSibling;if(!e)break;i=e}if(!s){let t=e.someProp("clipboardParser")||e.someProp("domParser")||Bn.fromSchema(e.state.schema);s=t.parseSlice(i,{preserveWhitespace:!(!l&&!d),context:o,ruleFromNode:e=>"BR"!=e.nodeName||e.nextSibling||!e.parentNode||_a.test(e.parentNode.nodeName)?null:{ignore:!0}})}if(d)s=function(e,t){if(!e.size)return e;let n,r=e.content.firstChild.type.schema;try{n=JSON.parse(t)}catch(t){return e}let{content:o,openStart:i,openEnd:s}=e;for(let e=n.length-2;e>=0;e-=2){let t=r.nodes[n[e]];if(!t||t.hasRequiredAttrs())break;try{o=Ft.from(t.create(n[e+1],o))}catch(e){break}i++,s++}return new Zt(o,i,s)}(za(s,+d[1],+d[2]),d[4]);else if(s=Zt.maxOpen(function(e,t){if(e.childCount<2)return e;for(let n=t.depth;n>=0;n--){let r,o=t.node(n).contentMatchAt(t.index(n)),i=[];if(e.forEach(e=>{if(!i)return;let t,n=o.findWrapping(e.type);if(!n)return i=null;if(t=i.length&&r.length&&La(n,r,e,i[i.length-1],0))i[i.length-1]=t;else{i.length&&(i[i.length-1]=Ba(i[i.length-1],r.length));let t=Ra(e,n);i.push(t),o=o.matchType(t.type),r=n}}),i)return Ft.from(i)}return e}(s.content,o),!0),s.openStart||s.openEnd){let e=0,t=0;for(let t=s.content.firstChild;e<s.openStart&&!t.type.spec.isolating;e++,t=t.firstChild);for(let e=s.content.lastChild;t<s.openEnd&&!e.type.spec.isolating;t++,e=e.lastChild);s=za(s,e,t)}return e.someProp("transformPasted",t=>{s=t(s,e,l)}),s}const _a=/^(a|abbr|acronym|b|cite|code|del|em|i|ins|kbd|label|output|q|ruby|s|samp|span|strong|sub|sup|time|u|tt|var)$/i;function Ra(e,t,n=0){for(let r=t.length-1;r>=n;r--)e=t[r].create(null,Ft.from(e));return e}function La(e,t,n,r,o){if(o<e.length&&o<t.length&&e[o]==t[o]){let i=La(e,t,n,r.lastChild,o+1);if(i)return r.copy(r.content.replaceChild(r.childCount-1,i));if(r.contentMatchAt(r.childCount).matchType(o==e.length-1?n.type:e[o+1]))return r.copy(r.content.append(Ft.from(Ra(n,e,o+1))))}}function Ba(e,t){if(0==t)return e;let n=e.content.replaceChild(e.childCount-1,Ba(e.lastChild,t-1)),r=e.contentMatchAt(e.childCount).fillBefore(Ft.empty,!0);return e.copy(n.append(r))}function Pa(e,t,n,r,o,i){let s=t<0?e.firstChild:e.lastChild,a=s.content;return e.childCount>1&&(i=0),o<r-1&&(a=Pa(a,t,n,r,o+1,i)),o>=n&&(a=t<0?s.contentMatchAt(0).fillBefore(a,i<=o).append(a):a.append(s.contentMatchAt(s.childCount).fillBefore(Ft.empty,!0))),e.replaceChild(t<0?0:e.childCount-1,s.copy(a))}function za(e,t,n){return t<e.openStart&&(e=new Zt(Pa(e.content,-1,t,e.openStart,0,e.openEnd),t,e.openEnd)),n<e.openEnd&&(e=new Zt(Pa(e.content,1,n,e.openEnd,0,0),e.openStart,n)),e}const ja={thead:["table"],tbody:["table"],tfoot:["table"],caption:["table"],colgroup:["table"],col:["table","colgroup"],tr:["table","tbody"],td:["table","tbody","tr"],th:["table","tbody","tr"]};function Va(){return document.implementation.createHTMLDocument("title")}let $a=null;const Ha={},qa={},Fa={touchstart:!0,touchmove:!0};class Wa{constructor(){this.shiftKey=!1,this.mouseDown=null,this.lastKeyCode=null,this.lastKeyCodeTime=0,this.lastKeyDispatched=!1,this.lastClick={time:0,x:0,y:0,type:"",button:0},this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastIOSEnter=0,this.lastIOSEnterFallbackTimeout=-1,this.lastFocus=0,this.lastTouch=0,this.lastChromeDelete=0,this.composing=!1,this.compositionNode=null,this.composingTimeout=-1,this.compositionNodes=[],this.compositionEndedAt=-2e8,this.compositionID=1,this.badSafariComposition=!1,this.compositionPendingChanges=0,this.domChangeCount=0,this.eventHandlers=Object.create(null),this.hideSelectionGuard=null}}function Ua(e,t){e.input.lastSelectionOrigin=t,e.input.lastSelectionTime=Date.now()}function Ga(e){e.someProp("handleDOMEvents",t=>{for(let n in t)e.input.eventHandlers[n]||e.dom.addEventListener(n,e.input.eventHandlers[n]=t=>Ka(e,t))})}function Ka(e,t){return e.someProp("handleDOMEvents",n=>{let r=n[t.type];return!!r&&(r(e,t)||t.defaultPrevented)})}function Ja(e,t){if(!t.bubbles)return!0;if(t.defaultPrevented)return!1;for(let n=t.target;n!=e.dom;n=n.parentNode)if(!n||11==n.nodeType||n.pmViewDesc&&n.pmViewDesc.stopEvent(t))return!1;return!0}function Za(e,t){let{input:n}=e;return!n.lastKeyDispatched&&!e.composing&&(n.lastKeyDispatched=!0,"string"==typeof t&&(t=function(e,t){let n=document.createEvent("Event");return n.initEvent("keydown",!0,!0),n.keyCode=e,n.key=n.code=t,n}("Backspace"==t?8:13,t)),e.someProp("handleKeyDown",n=>n(e,t)))}function Ya(e){return{left:e.clientX,top:e.clientY}}function Xa(e,t,n,r,o){if(-1==r)return!1;let i=e.state.doc.resolve(r);for(let r=i.depth+1;r>0;r--)if(e.someProp(t,t=>r>i.depth?t(e,n,i.nodeAfter,i.before(r),o,!0):t(e,n,i.node(r),i.before(r),o,!1)))return!0;return!1}function Qa(e,t,n){if(e.focused||e.focus(),e.state.selection.eq(t))return;let r=e.state.tr.setSelection(t);r.setMeta("pointer",!0),e.dispatch(r)}function el(e,t,n,r,o){return Xa(e,"handleClickOn",t,n,r)||e.someProp("handleClick",n=>n(e,t,r))||(o?function(e,t){if(-1==t)return!1;let n,r,o=e.state.selection;o instanceof Ur&&(n=o.node);let i=e.state.doc.resolve(t);for(let e=i.depth+1;e>0;e--){let t=e>i.depth?i.nodeAfter:i.node(e);if(Ur.isSelectable(t)){r=n&&o.$from.depth>0&&e>=o.$from.depth&&i.before(o.$from.depth+1)==o.$from.pos?i.before(o.$from.depth):i.before(e);break}}return null!=r&&(Qa(e,Ur.create(e.state.doc,r)),!0)}(e,n):function(e,t){if(-1==t)return!1;let n=e.state.doc.resolve(t),r=n.nodeAfter;return!!(r&&r.isAtom&&Ur.isSelectable(r))&&(Qa(e,new Ur(n)),!0)}(e,n))}function tl(e,t,n,r){return Xa(e,"handleDoubleClickOn",t,n,r)||e.someProp("handleDoubleClick",n=>n(e,t,r))}function nl(e,t,n,r){return Xa(e,"handleTripleClickOn",t,n,r)||e.someProp("handleTripleClick",n=>n(e,t,r))||function(e,t,n){if(0!=n.button)return!1;let r=rl(e,t,!0),o=e.state.doc;if(!r)return!1;Qa(e,r),r instanceof Fr&&o.eq(e.state.doc)&&(e.input.mouseDown=new ll(e,r));return!0}(e,n,r)}function rl(e,t,n){let r=e.state.doc;if(-1==t)return r.inlineContent?Fr.create(r,0,r.content.size):null;let o=r.resolve(t);for(let e=o.depth+1;e>0;e--){let t=e>o.depth?o.nodeAfter:o.node(e),i=o.before(e);if(t.inlineContent)return Fr.create(r,i+1,i+1+t.content.size);if(n&&Ur.isSelectable(t))return Ur.create(r,i)}return null}function ol(e){return fl(e)}qa.keydown=(e,t)=>{let n=t;if(e.input.shiftKey=16==n.keyCode||n.shiftKey,!cl(e)&&(e.input.lastKeyCode=n.keyCode,e.input.lastKeyCodeTime=Date.now(),e.input.lastKeyDispatched=!1,!fs||!ls||13!=n.keyCode))if(229!=n.keyCode&&e.domObserver.forceFlush(),!us||13!=n.keyCode||n.ctrlKey||n.altKey||n.metaKey)Za(e,n)||Ta(e,n)?n.preventDefault():Ua(e,"key");else{let t=Date.now();e.input.lastIOSEnter=t,e.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{e.input.lastIOSEnter==t&&(Za(e,"Enter"),e.input.lastIOSEnter=0)},200)}},qa.keyup=(e,t)=>{16==t.keyCode&&(e.input.shiftKey=!1)},qa.keypress=(e,t)=>{let n=t;if(cl(e)||!n.charCode||n.ctrlKey&&!n.altKey||hs&&n.metaKey)return;if(e.someProp("handleKeyPress",t=>t(e,n)))return void n.preventDefault();let r=e.state.selection;if(!(r instanceof Fr&&r.$from.sameParent(r.$to))){let t=String.fromCharCode(n.charCode),o=()=>e.state.tr.insertText(t).scrollIntoView();/[\r\n]/.test(t)||e.someProp("handleTextInput",n=>n(e,r.$from.pos,r.$to.pos,t,o))||e.dispatch(o()),n.preventDefault()}};const il=hs?"metaKey":"ctrlKey";Ha.mousedown=(e,t)=>{let n=t;e.input.shiftKey=n.shiftKey;let r=ol(e),o=Date.now(),i="singleClick";o-e.input.lastClick.time<500&&function(e,t){let n=t.x-e.clientX,r=t.y-e.clientY;return n*n+r*r<100}(n,e.input.lastClick)&&!n[il]&&e.input.lastClick.button==n.button&&("singleClick"==e.input.lastClick.type?i="doubleClick":"doubleClick"==e.input.lastClick.type&&(i="tripleClick")),e.input.lastClick={time:o,x:n.clientX,y:n.clientY,type:i,button:n.button},e.input.mouseDown&&e.input.mouseDown.done();let s=e.posAtCoords(Ya(n));s&&("singleClick"==i?e.input.mouseDown=new al(e,s,n,!!r):("doubleClick"==i?tl:nl)(e,s.pos,s.inside,n)?n.preventDefault():Ua(e,"pointer"))};class sl{constructor(e){this.view=e,this.mightDrag=null,e.root.addEventListener("mouseup",this.up=this.up.bind(this)),e.root.addEventListener("mousemove",this.move=this.move.bind(this))}up(e){this.done()}move(e){0==e.buttons&&this.done()}done(){this.view.root.removeEventListener("mouseup",this.up),this.view.root.removeEventListener("mousemove",this.move),this.view.input.mouseDown==this&&(this.view.input.mouseDown=null)}delaySelUpdate(){return!1}}class al extends sl{constructor(e,t,n,r){let o,i;if(super(e),this.pos=t,this.event=n,this.flushed=r,this.delayedSelectionSync=!1,this.startDoc=e.state.doc,this.selectNode=!!n[il],this.allowDefault=n.shiftKey,t.inside>-1)o=e.state.doc.nodeAt(t.inside),i=t.inside;else{let n=e.state.doc.resolve(t.pos);o=n.parent,i=n.depth?n.before():0}const s=r?null:n.target,a=s?e.docView.nearestDesc(s,!0):null;this.target=a&&Ui(a.nodeDOM)?a.nodeDOM:null;let{selection:l}=e.state;0==n.button&&(o.type.spec.draggable&&!1!==o.type.spec.selectable||l instanceof Ur&&l.from<=i&&l.to>i)&&(this.mightDrag={node:o,pos:i,addAttr:!(!this.target||this.target.draggable),setUneditable:!(!this.target||!ss||this.target.hasAttribute("contentEditable"))}),this.target&&this.mightDrag&&(this.mightDrag.addAttr||this.mightDrag.setUneditable)&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&(this.target.draggable=!0),this.mightDrag.setUneditable&&setTimeout(()=>{this.view.input.mouseDown==this&&this.target.setAttribute("contentEditable","false")},20),this.view.domObserver.start()),Ua(e,"pointer")}done(){super.done(),this.mightDrag&&this.target&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&this.target.removeAttribute("draggable"),this.mightDrag.setUneditable&&this.target.removeAttribute("contentEditable"),this.view.domObserver.start()),this.delayedSelectionSync&&setTimeout(()=>{this.view.isDestroyed||ca(this.view)})}up(e){if(this.done(),!this.view.dom.contains(e.target))return;let t=this.pos;this.view.state.doc!=this.startDoc&&(t=this.view.posAtCoords(Ya(e))),this.updateAllowDefault(e),this.allowDefault||!t?Ua(this.view,"pointer"):el(this.view,t.pos,t.inside,e,this.selectNode)?e.preventDefault():0==e.button&&(this.flushed||ds&&this.mightDrag&&!this.mightDrag.node.isAtom||ls&&!this.view.state.selection.visible&&Math.min(Math.abs(t.pos-this.view.state.selection.from),Math.abs(t.pos-this.view.state.selection.to))<=2)?(Qa(this.view,Vr.near(this.view.state.doc.resolve(t.pos))),e.preventDefault()):Ua(this.view,"pointer")}move(e){this.updateAllowDefault(e),Ua(this.view,"pointer"),super.move(e)}updateAllowDefault(e){!this.allowDefault&&(Math.abs(this.event.x-e.clientX)>4||Math.abs(this.event.y-e.clientY)>4)&&(this.allowDefault=!0)}delaySelUpdate(){return!!this.allowDefault&&(this.delayedSelectionSync=!0,!0)}}class ll extends sl{constructor(e,t){super(e),this.startSelection=t,this.startDoc=e.state.doc}move(e){if(0==e.buttons||this.view.isDestroyed||!this.view.state.doc.eq(this.startDoc))return void this.done();e.preventDefault(),Ua(this.view,"pointer");let t=this.view.posAtCoords(Ya(e)),n=t&&rl(this.view,t.inside,!1);if(!n)return;let{doc:r}=this.view.state,o=this.startSelection,[i,s]=n.from<o.from?[o.to,n.from]:[o.from,n.to];Qa(this.view,Fr.create(r,i,s))}}function cl(e,t){return!!e.composing||!!(ds&&Math.abs(Date.now()-e.input.compositionEndedAt)<500)&&(e.input.compositionEndedAt=-2e8,!0)}Ha.touchstart=e=>{e.input.lastTouch=Date.now(),ol(e),Ua(e,"pointer")},Ha.touchmove=e=>{e.input.lastTouch=Date.now(),Ua(e,"pointer")},Ha.contextmenu=e=>ol(e);const dl=fs?5e3:-1;function ul(e,t){clearTimeout(e.input.composingTimeout),t>-1&&(e.input.composingTimeout=setTimeout(()=>fl(e),t))}function hl(e){for(e.composing&&(e.input.composing=!1,e.input.compositionEndedAt=Date.now());e.input.compositionNodes.length>0;)e.input.compositionNodes.pop().markParentsDirty()}function pl(e){let t=e.domSelectionRange();if(!t.focusNode)return null;let n=function(e,t){for(;;){if(Gi(e)&&t)return e;if(Ui(e)&&t>0){if("false"==e.contentEditable)return null;t=Wi(e=e.childNodes[t-1])}else{if(!e.parentNode||Ji(e))return null;t=zi(e),e=e.parentNode}}}(t.focusNode,t.focusOffset),r=function(e,t){for(;;){if(Gi(e)&&t<e.nodeValue.length)return e;if(Ui(e)&&t<e.childNodes.length){if("false"==e.contentEditable)return null;e=e.childNodes[t],t=0}else{if(!e.parentNode||Ji(e))return null;t=zi(e)+1,e=e.parentNode}}}(t.focusNode,t.focusOffset);if(n&&r&&n!=r){let t=r.pmViewDesc,o=e.domObserver.lastChangedTextNode;if(n==o||r==o)return o;if(!t||!t.isText(r.nodeValue))return r;if(e.input.compositionNode==r){let e=n.pmViewDesc;if(e&&e.isText(n.nodeValue))return r}}return n||r}function fl(e,t=!1){if(!(fs&&e.domObserver.flushingSoon>=0)){if(e.domObserver.forceFlush(),hl(e),t||e.docView&&e.docView.dirty){let n=aa(e),r=e.state.selection;return n&&!n.eq(r)?e.dispatch(e.state.tr.setSelection(n)):!e.markCursor&&!t||r.$from.node(r.$from.sharedDepth(r.to)).inlineContent?e.updateState(e.state):e.dispatch(e.state.tr.deleteSelection()),!0}return!1}}qa.compositionstart=qa.compositionupdate=e=>{if(!e.composing){e.domObserver.flush();let{state:t}=e,n=t.selection.$to;if(t.selection instanceof Fr&&t.selection.empty&&(t.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some(e=>!1===e.type.spec.inclusive)||ls&&ps&&function(e){let{focusNode:t,focusOffset:n}=e.domSelectionRange();if(!t||!Ui(t)||n>=t.childNodes.length)return!1;let r=t.childNodes[n];return Ui(r)&&"false"==r.contentEditable}(e)))e.markCursor=e.state.storedMarks||n.marks(),fl(e,!0),e.markCursor=null;else if(fl(e,!t.selection.empty),ss&&t.selection.empty&&n.parentOffset&&!n.textOffset&&n.nodeBefore.marks.length){let t=e.domSelectionRange();for(let n=t.focusNode,r=t.focusOffset;n&&Ui(n)&&0!=r;){let t=r<0?n.lastChild:n.childNodes[r-1];if(!t)break;if(Gi(t)){let n=e.domSelection();n&&n.collapse(t,t.nodeValue.length);break}n=t,r=-1}}e.input.composing=!0}ul(e,dl)},qa.compositionend=(e,t)=>{e.composing&&(e.input.composing=!1,e.input.compositionEndedAt=Date.now(),e.input.compositionPendingChanges=e.domObserver.pendingRecords().length?e.input.compositionID:0,e.input.compositionNode=null,e.input.badSafariComposition?e.domObserver.forceFlush():e.input.compositionPendingChanges&&Promise.resolve().then(()=>e.domObserver.flush()),e.input.compositionID++,ul(e,20))};const ml=rs&&is<15||us&&gs<604;function gl(e,t,n,r,o){let i=Ia(e,t,n,r,e.state.selection.$from);if(e.someProp("handlePaste",t=>t(e,o,i||Zt.empty)))return!0;if(!i)return!1;let s=function(e){return 0==e.openStart&&0==e.openEnd&&1==e.content.childCount?e.content.firstChild:null}(i),a=s?e.state.tr.replaceSelectionWith(s,r):e.state.tr.replaceSelection(i);return e.dispatch(a.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function vl(e){let t=e.getData("text/plain")||e.getData("Text");if(t)return t;let n=e.getData("text/uri-list");return n?n.replace(/\r?\n/g," "):""}Ha.copy=qa.cut=(e,t)=>{let n=t,r=e.state.selection,o="cut"==n.type;if(r.empty)return;let i=ml?null:n.clipboardData,s=r.content(),{dom:a,text:l}=Da(e,s);i?(n.preventDefault(),i.clearData(),i.setData("text/html",a.innerHTML),i.setData("text/plain",l)):function(e,t){if(!e.dom.parentNode)return;let n=e.dom.parentNode.appendChild(document.createElement("div"));n.appendChild(t),n.style.cssText="position: fixed; left: -10000px; top: 10px";let r=getSelection(),o=document.createRange();o.selectNodeContents(t),e.dom.blur(),r.removeAllRanges(),r.addRange(o),setTimeout(()=>{n.parentNode&&n.parentNode.removeChild(n),e.focus()},50)}(e,a),o&&e.dispatch(e.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))},qa.paste=(e,t)=>{let n=t;if(e.composing&&!fs)return;let r=ml?null:n.clipboardData,o=e.input.shiftKey&&45!=e.input.lastKeyCode;r&&gl(e,vl(r),r.getData("text/html"),o,n)?n.preventDefault():function(e,t){if(!e.dom.parentNode)return;let n=e.input.shiftKey||e.state.selection.$from.parent.type.spec.code,r=e.dom.parentNode.appendChild(document.createElement(n?"textarea":"div"));n||(r.contentEditable="true"),r.style.cssText="position: fixed; left: -10000px; top: 10px",r.focus();let o=e.input.shiftKey&&45!=e.input.lastKeyCode;setTimeout(()=>{e.focus(),r.parentNode&&r.parentNode.removeChild(r),n?gl(e,r.value,null,o,t):gl(e,r.textContent,r.innerHTML,o,t)},50)}(e,n)};class yl{constructor(e,t,n){this.slice=e,this.move=t,this.node=n}}const wl=hs?"altKey":"ctrlKey";function bl(e,t){let n;return e.someProp("dragCopies",e=>{n=n||e(t)}),null!=n?!n:!t[wl]}Ha.dragstart=(e,t)=>{let n=t,r=e.input.mouseDown;if(r&&r.done(),!n.dataTransfer)return;let o,i=e.state.selection,s=i.empty?null:e.posAtCoords(Ya(n));if(s&&s.pos>=i.from&&s.pos<=(i instanceof Ur?i.to-1:i.to));else if(r&&r.mightDrag)o=Ur.create(e.state.doc,r.mightDrag.pos);else if(n.target&&Ui(n.target)){let t=e.docView.nearestDesc(n.target,!0);t&&t.node.type.spec.draggable&&t!=e.docView&&(o=Ur.create(e.state.doc,t.posBefore))}let a=(o||e.state.selection).content(),{dom:l,text:c,slice:d}=Da(e,a);(!n.dataTransfer.files.length||!ls||cs>120)&&n.dataTransfer.clearData(),n.dataTransfer.setData(ml?"Text":"text/html",l.innerHTML),n.dataTransfer.effectAllowed="copyMove",ml||n.dataTransfer.setData("text/plain",c),e.dragging=new yl(d,bl(e,n),o)},Ha.dragend=e=>{let t=e.dragging;window.setTimeout(()=>{e.dragging==t&&(e.dragging=null)},50)},qa.dragover=qa.dragenter=(e,t)=>t.preventDefault(),qa.drop=(e,t)=>{try{!function(e,t,n){if(!t.dataTransfer)return;let r=e.posAtCoords(Ya(t));if(!r)return;let o=e.state.doc.resolve(r.pos),i=n&&n.slice;i?e.someProp("transformPasted",t=>{i=t(i,e,!1)}):i=Ia(e,vl(t.dataTransfer),ml?null:t.dataTransfer.getData("text/html"),!1,o);let s=!(!n||!bl(e,t));if(e.someProp("handleDrop",n=>n(e,t,i||Zt.empty,s)))return void t.preventDefault();if(!i)return;t.preventDefault();let a=i?function(e,t,n){let r=e.resolve(t);if(!n.content.size)return t;let o=n.content;for(let e=0;e<n.openStart;e++)o=o.firstChild.content;for(let e=1;e<=(0==n.openStart&&n.size?2:1);e++)for(let t=r.depth;t>=0;t--){let n=t==r.depth?0:r.pos<=(r.start(t+1)+r.end(t+1))/2?-1:1,i=r.index(t)+(n>0?1:0),s=r.node(t),a=!1;if(1==e)a=s.canReplace(i,i,o);else{let e=s.contentMatchAt(i).findWrapping(o.firstChild.type);a=e&&s.canReplaceWith(i,i,e[0])}if(a)return 0==n?r.pos:n<0?r.before(t+1):r.after(t+1)}return null}(e.state.doc,o.pos,i):o.pos;null==a&&(a=o.pos);let l=e.state.tr;if(s){let{node:e}=n;e?e.replace(l):l.deleteSelection()}let c=l.mapping.map(a),d=0==i.openStart&&0==i.openEnd&&1==i.content.childCount,u=l.doc;d?l.replaceRangeWith(c,c,i.content.firstChild):l.replaceRange(c,c,i);if(l.doc.eq(u))return;let h=l.doc.resolve(c);if(d&&Ur.isSelectable(i.content.firstChild)&&h.nodeAfter&&h.nodeAfter.sameMarkup(i.content.firstChild))l.setSelection(new Ur(h));else{let t=l.mapping.map(a);l.mapping.maps[l.mapping.maps.length-1].forEach((e,n,r,o)=>t=o),l.setSelection(ga(e,h,l.doc.resolve(t)))}e.focus(),e.dispatch(l.setMeta("uiEvent","drop"))}(e,t,e.dragging)}finally{e.dragging=null}},Ha.focus=e=>{if(e.input.lastFocus=Date.now(),!e.focused){e.domObserver.stop(),e.dom.classList.add("ProseMirror-focused"),e.domObserver.start(),e.focused=!0;let t=e.domSelectionRange();if(!e.domObserver.currentSelection.eq(t)){let{focusNode:n,focusOffset:r}=t;setTimeout(()=>{let t=e.domSelectionRange();t.focusNode==n&&t.focusOffset==r&&e.docView&&e.hasFocus()&&ca(e)},20)}}},Ha.blur=(e,t)=>{let n=t;e.focused&&(e.domObserver.stop(),e.dom.classList.remove("ProseMirror-focused"),e.domObserver.start(),n.relatedTarget&&e.dom.contains(n.relatedTarget)&&e.domObserver.currentSelection.clear(),e.focused=!1)},Ha.beforeinput=(e,t)=>{if(fs&&"deleteContentBackward"==t.inputType){e.domObserver.flushSoon();let{domChangeCount:t}=e.input;setTimeout(()=>{if(e.input.domChangeCount!=t||e.domObserver.pendingRecords().length)return;if(e.dom.blur(),e.focus(),Za(e,"Backspace"))return;let{$cursor:n}=e.state.selection;n&&n.pos>0&&e.dispatch(e.state.tr.delete(n.pos-1,n.pos).scrollIntoView())},50)}};for(let e in qa)Ha[e]=qa[e];function xl(e,t){if(e==t)return!0;for(let n in e)if(e[n]!==t[n])return!1;for(let n in t)if(!(n in e))return!1;return!0}class kl{constructor(e){this.frag=e,this.index=0,this.off=0}nodeAt(e){for(;this.off<=e&&this.index<this.frag.childCount;){let t=this.frag.child(this.index);if(this.off==e)return t;this.off+=t.nodeSize,this.index++}return null}}class Cl{constructor(e,t){this.toDOM=e,this.spec=t||Ol,this.side=this.spec.side||0}map(e,t,n,r){let{pos:o,deleted:i}=e.mapResult(t.from+r,this.side<0?-1:1);return i?null:new Nl(o-n,o-n,this)}valid(){return!0}eq(e){return this==e||e instanceof Cl&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&xl(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class Sl{constructor(e,t){this.attrs=e,this.spec=t||Ol}map(e,t,n,r){let o=e.map(t.from+r,this.spec.inclusiveStart?-1:1)-n,i=e.map(t.to+r,this.spec.inclusiveEnd?1:-1)-n;return o>=i?null:new Nl(o,i,this)}valid(e,t){return t.from<t.to}eq(e){return this==e||e instanceof Sl&&xl(this.attrs,e.attrs)&&xl(this.spec,e.spec)}static is(e){return e.type instanceof Sl}destroy(){}}class Ml{constructor(e,t){this.attrs=e,this.spec=t||Ol}map(e,t,n,r){let o=e.mapResult(t.from+r,1);if(o.deleted)return null;let i=e.mapResult(t.to+r,-1);return i.deleted||i.pos<=o.pos?null:new Nl(o.pos-n,i.pos-n,this)}valid(e,t,n){let r=n.nodeAt(t.from);return!!r&&!r.isText&&t.from+r.nodeSize==t.to}eq(e){return this==e||e instanceof Ml&&xl(this.attrs,e.attrs)&&xl(this.spec,e.spec)}destroy(){}}class Nl{constructor(e,t,n){this.from=e,this.to=t,this.type=n}copy(e,t){return new Nl(e,t,this.type)}eq(e,t=0){return this.type.eq(e.type)&&this.from+t==e.from&&this.to+t==e.to}map(e,t,n){return this.type.map(e,this,t,n)}static widget(e,t,n){return new Nl(e,e,new Cl(t,n))}static inline(e,t,n,r){return new Nl(e,t,new Sl(n,r))}static node(e,t,n,r){return new Nl(e,t,new Ml(n,r))}get spec(){return this.type.spec}get inline(){return this.type instanceof Sl}get widget(){return this.type instanceof Cl}}const El=[],Ol={};class Al{constructor(e,t){this.local=e.length?e:El,this.children=t.length?t:El}static create(e,t){return t.length?Ll(t,e,0,Ol):Tl}find(e,t,n){let r=[];return this.findInner(null==e?0:e,null==t?1e9:t,r,0,n),r}findInner(e,t,n,r,o){for(let i=0;i<this.local.length;i++){let s=this.local[i];s.from<=t&&s.to>=e&&(!o||o(s.spec))&&n.push(s.copy(s.from+r,s.to+r))}for(let i=0;i<this.children.length;i+=3)if(this.children[i]<t&&this.children[i+1]>e){let s=this.children[i]+1;this.children[i+2].findInner(e-s,t-s,n,r+s,o)}}map(e,t,n){return this==Tl||0==e.maps.length?this:this.mapInner(e,t,0,0,n||Ol)}mapInner(e,t,n,r,o){let i;if(this.local.length){let s=new kl(t.content);for(let a=0;a<this.local.length;a++){let l=this.local[a].map(e,n,r);l&&l.type.valid(t,l,s)?(i||(i=[])).push(l):o.onRemove&&o.onRemove(this.local[a].spec)}}return this.children.length?function(e,t,n,r,o,i,s){let a=e.slice();for(let e=0,t=i;e<n.maps.length;e++){let r=0;n.maps[e].forEach((e,n,o,i)=>{let s=i-o-(n-e);for(let o=0;o<a.length;o+=3){let i=a[o+1];if(i<0||e>i+t-r)continue;let l=a[o]+t-r;n>=l?a[o+1]=e<=l?-2:-1:e>=t&&s&&(a[o]+=s,a[o+1]+=s)}r+=s}),t=n.maps[e].map(t,-1)}let l=!1;for(let t=0;t<a.length;t+=3)if(a[t+1]<0){if(-2==a[t+1]){l=!0,a[t+1]=-1;continue}let c=n.map(e[t]+i),d=c-o;if(d<0||d>=r.content.size){l=!0;continue}let u=n.map(e[t+1]+i,-1)-o,{index:h,offset:p}=r.content.findIndex(d),f=r.maybeChild(h);if(f&&p==d&&p+f.nodeSize==u){let r=a[t+2].mapInner(n,f,c+1,e[t]+i+1,s);r!=Tl?(a[t]=d,a[t+1]=u,a[t+2]=r):(a[t+1]=-2,l=!0)}else l=!0}if(l){let l=function(e,t,n,r,o,i,s){function a(e,t){for(let i=0;i<e.local.length;i++){let a=e.local[i].map(r,o,t);a?n.push(a):s.onRemove&&s.onRemove(e.local[i].spec)}for(let n=0;n<e.children.length;n+=3)a(e.children[n+2],e.children[n]+t+1)}for(let n=0;n<e.length;n+=3)-1==e[n+1]&&a(e[n+2],t[n]+i+1);return n}(a,e,t,n,o,i,s),c=Ll(l,r,0,s);t=c.local;for(let e=0;e<a.length;e+=3)a[e+1]<0&&(a.splice(e,3),e-=3);for(let e=0,t=0;e<c.children.length;e+=3){let n=c.children[e];for(;t<a.length&&a[t]<n;)t+=3;a.splice(t,0,c.children[e],c.children[e+1],c.children[e+2])}}return new Al(t.sort(Bl),a)}(this.children,i||[],e,t,n,r,o):i?new Al(i.sort(Bl),El):Tl}add(e,t){return t.length?this==Tl?Al.create(e,t):this.addInner(e,t,0):this}addInner(e,t,n){let r,o=0;e.forEach((e,i)=>{let s,a=i+n;if(s=_l(t,e,a)){for(r||(r=this.children.slice());o<r.length&&r[o]<i;)o+=3;r[o]==i?r[o+2]=r[o+2].addInner(e,s,a+1):r.splice(o,0,i,i+e.nodeSize,Ll(s,e,a+1,Ol)),o+=3}});let i=Il(o?Rl(t):t,-n);if(i.length){let t=new kl(e.content);for(let n=0;n<i.length;n++)i[n].type.valid(e,i[n],t)||i.splice(n--,1)}return new Al(i.length?this.local.concat(i).sort(Bl):this.local,r||this.children)}remove(e){return 0==e.length||this==Tl?this:this.removeInner(e,0)}removeInner(e,t){let n=this.children,r=this.local;for(let r=0;r<n.length;r+=3){let o,i=n[r]+t,s=n[r+1]+t;for(let t,n=0;n<e.length;n++)(t=e[n])&&t.from>i&&t.to<s&&(e[n]=null,(o||(o=[])).push(t));if(!o)continue;n==this.children&&(n=this.children.slice());let a=n[r+2].removeInner(o,i+1);a!=Tl?n[r+2]=a:(n.splice(r,3),r-=3)}if(r.length)for(let n,o=0;o<e.length;o++)if(n=e[o])for(let e=0;e<r.length;e++)r[e].eq(n,t)&&(r==this.local&&(r=this.local.slice()),r.splice(e--,1));return n==this.children&&r==this.local?this:r.length||n.length?new Al(r,n):Tl}forChild(e,t){if(this==Tl)return this;if(t.isLeaf)return Al.empty;let n,r;for(let t=0;t<this.children.length;t+=3)if(this.children[t]>=e){this.children[t]==e&&(n=this.children[t+2]);break}let o=e+1,i=o+t.content.size;for(let e=0;e<this.local.length;e++){let t=this.local[e];if(t.from<i&&t.to>o&&t.type instanceof Sl){let e=Math.max(o,t.from)-o,n=Math.min(i,t.to)-o;e<n&&(r||(r=[])).push(t.copy(e,n))}}if(r){let e=new Al(r.sort(Bl),El);return n?new Dl([e,n]):e}return n||Tl}eq(e){if(this==e)return!0;if(!(e instanceof Al)||this.local.length!=e.local.length||this.children.length!=e.children.length)return!1;for(let t=0;t<this.local.length;t++)if(!this.local[t].eq(e.local[t]))return!1;for(let t=0;t<this.children.length;t+=3)if(this.children[t]!=e.children[t]||this.children[t+1]!=e.children[t+1]||!this.children[t+2].eq(e.children[t+2]))return!1;return!0}locals(e){return Pl(this.localsInner(e))}localsInner(e){if(this==Tl)return El;if(e.inlineContent||!this.local.some(Sl.is))return this.local;let t=[];for(let e=0;e<this.local.length;e++)this.local[e].type instanceof Sl||t.push(this.local[e]);return t}forEachSet(e){e(this)}}Al.empty=new Al([],[]),Al.removeOverlap=Pl;const Tl=Al.empty;class Dl{constructor(e){this.members=e}map(e,t){const n=this.members.map(n=>n.map(e,t,Ol));return Dl.from(n)}forChild(e,t){if(t.isLeaf)return Al.empty;let n=[];for(let r=0;r<this.members.length;r++){let o=this.members[r].forChild(e,t);o!=Tl&&(o instanceof Dl?n=n.concat(o.members):n.push(o))}return Dl.from(n)}eq(e){if(!(e instanceof Dl)||e.members.length!=this.members.length)return!1;for(let t=0;t<this.members.length;t++)if(!this.members[t].eq(e.members[t]))return!1;return!0}locals(e){let t,n=!0;for(let r=0;r<this.members.length;r++){let o=this.members[r].localsInner(e);if(o.length)if(t){n&&(t=t.slice(),n=!1);for(let e=0;e<o.length;e++)t.push(o[e])}else t=o}return t?Pl(n?t:t.sort(Bl)):El}static from(e){switch(e.length){case 0:return Tl;case 1:return e[0];default:return new Dl(e.every(e=>e instanceof Al)?e:e.reduce((e,t)=>e.concat(t instanceof Al?t:t.members),[]))}}forEachSet(e){for(let t=0;t<this.members.length;t++)this.members[t].forEachSet(e)}}function Il(e,t){if(!t||!e.length)return e;let n=[];for(let r=0;r<e.length;r++){let o=e[r];n.push(new Nl(o.from+t,o.to+t,o.type))}return n}function _l(e,t,n){if(t.isLeaf)return null;let r=n+t.nodeSize,o=null;for(let t,i=0;i<e.length;i++)(t=e[i])&&t.from>n&&t.to<r&&((o||(o=[])).push(t),e[i]=null);return o}function Rl(e){let t=[];for(let n=0;n<e.length;n++)null!=e[n]&&t.push(e[n]);return t}function Ll(e,t,n,r){let o=[],i=!1;t.forEach((t,s)=>{let a=_l(e,t,s+n);if(a){i=!0;let e=Ll(a,t,n+s+1,r);e!=Tl&&o.push(s,s+t.nodeSize,e)}});let s=Il(i?Rl(e):e,-n).sort(Bl);if(s.length){let e=new kl(t.content);for(let n=0;n<s.length;n++)s[n].type.valid(t,s[n],e)||(r.onRemove&&r.onRemove(s[n].spec),s.splice(n--,1))}return s.length||o.length?new Al(s,o):Tl}function Bl(e,t){return e.from-t.from||e.to-t.to}function Pl(e){let t=e;for(let n=0;n<t.length-1;n++){let r=t[n];if(r.from!=r.to)for(let o=n+1;o<t.length;o++){let i=t[o];if(i.from!=r.from){i.from<r.to&&(t==e&&(t=e.slice()),t[n]=r.copy(r.from,i.from),zl(t,o,r.copy(i.from,r.to)));break}i.to!=r.to&&(t==e&&(t=e.slice()),t[o]=i.copy(i.from,r.to),zl(t,o+1,i.copy(r.to,i.to)))}}return t}function zl(e,t,n){for(;t<e.length&&Bl(n,e[t])>0;)t++;e.splice(t,0,n)}function jl(e){let t=[];return e.someProp("decorations",n=>{let r=n(e.state);r&&r!=Tl&&t.push(r)}),e.cursorWrapper&&t.push(Al.create(e.state.doc,[e.cursorWrapper.deco])),Dl.from(t)}const Vl={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},$l=rs&&is<=11;class Hl{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}set(e){this.anchorNode=e.anchorNode,this.anchorOffset=e.anchorOffset,this.focusNode=e.focusNode,this.focusOffset=e.focusOffset}clear(){this.anchorNode=this.focusNode=null}eq(e){return e.anchorNode==this.anchorNode&&e.anchorOffset==this.anchorOffset&&e.focusNode==this.focusNode&&e.focusOffset==this.focusOffset}}class ql{constructor(e,t){this.view=e,this.handleDOMChange=t,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new Hl,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.lastChangedTextNode=null,this.observer=window.MutationObserver&&new window.MutationObserver(t=>{for(let e=0;e<t.length;e++)this.queue.push(t[e]);rs&&is<=11&&t.some(e=>"childList"==e.type&&e.removedNodes.length||"characterData"==e.type&&e.oldValue.length>e.target.nodeValue.length)?this.flushSoon():ds&&e.composing&&t.some(e=>"childList"==e.type&&"TR"==e.target.nodeName)?(e.input.badSafariComposition=!0,this.flushSoon()):this.flush()}),$l&&(this.onCharData=e=>{this.queue.push({target:e.target,type:"characterData",oldValue:e.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this)}flushSoon(){this.flushingSoon<0&&(this.flushingSoon=window.setTimeout(()=>{this.flushingSoon=-1,this.flush()},20))}forceFlush(){this.flushingSoon>-1&&(window.clearTimeout(this.flushingSoon),this.flushingSoon=-1,this.flush())}start(){this.observer&&(this.observer.takeRecords(),this.observer.observe(this.view.dom,Vl)),this.onCharData&&this.view.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.connectSelection()}stop(){if(this.observer){let e=this.observer.takeRecords();if(e.length){for(let t=0;t<e.length;t++)this.queue.push(e[t]);window.setTimeout(()=>this.flush(),20)}this.observer.disconnect()}this.onCharData&&this.view.dom.removeEventListener("DOMCharacterDataModified",this.onCharData),this.disconnectSelection()}connectSelection(){this.view.dom.ownerDocument.addEventListener("selectionchange",this.onSelectionChange)}disconnectSelection(){this.view.dom.ownerDocument.removeEventListener("selectionchange",this.onSelectionChange)}suppressSelectionUpdates(){this.suppressingSelectionUpdates=!0,setTimeout(()=>this.suppressingSelectionUpdates=!1,50)}onSelectionChange(){if(va(this.view)){if(this.suppressingSelectionUpdates)return ca(this.view);if(rs&&is<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&Hi(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset))return this.flushSoon()}this.flush()}}setCurSelection(){this.currentSelection.set(this.view.domSelectionRange())}ignoreSelectionChange(e){if(!e.focusNode)return!0;let t,n=new Set;for(let t=e.focusNode;t;t=ji(t))n.add(t);for(let r=e.anchorNode;r;r=ji(r))if(n.has(r)){t=r;break}let r=t&&this.view.docView.nearestDesc(t);return r&&r.ignoreMutation({type:"selection",target:Gi(t)?t.parentNode:t})?(this.setCurSelection(),!0):void 0}pendingRecords(){if(this.observer)for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}flush(){let{view:e}=this;if(!e.docView||this.flushingSoon>-1)return;let t=this.pendingRecords();t.length&&(this.queue=[]);let n,r=!1;!this.suppressingSelectionUpdates&&va(e)&&(n=e.domSelectionRange(),r=!this.currentSelection.eq(n)&&!this.ignoreSelectionChange(n));let o=-1,i=-1,s=!1,a=[];if(e.editable)for(let e=0;e<t.length;e++){let n=this.registerMutation(t[e],a);n&&(o=o<0?n.from:Math.min(n.from,o),i=i<0?n.to:Math.max(n.to,i),n.typeOver&&(s=!0))}if(a.some(e=>"BR"==e.nodeName)&&(8==e.input.lastKeyCode||46==e.input.lastKeyCode||ls&&(e.composing||e.input.compositionEndedAt>Date.now()-50)&&t.some(e=>"childList"==e.type&&e.removedNodes.length))){for(let e of a)if("BR"==e.nodeName&&e.parentNode){let t=e.nextSibling;for(;t&&Ui(t);){if("false"==t.contentEditable){e.parentNode.removeChild(e);break}t=t.firstChild}}}else if(ss&&a.length){let t=a.filter(e=>"BR"==e.nodeName);if(2==t.length){let[e,n]=t;e.parentNode&&e.parentNode.parentNode==n.parentNode?n.remove():e.remove()}else{let{focusNode:n}=this.currentSelection;for(let r of t){let t=r.parentNode;!t||"LI"!=t.nodeName||n&&Gl(e,n)==t||r.remove()}}}let l=null;o<0&&r&&e.input.lastFocus>Date.now()-200&&Math.max(e.input.lastTouch,e.input.lastClick.time)<Date.now()-300&&Zi(n)&&(l=aa(e))&&l.eq(Vr.near(e.state.doc.resolve(0),1))?(e.input.lastFocus=0,ca(e),this.currentSelection.set(n),e.scrollToSelection()):(o>-1||r)&&(o>-1&&(e.docView.markDirty(o,i),function(e){if(Fl.has(e))return;if(Fl.set(e,null),-1!==["normal","nowrap","pre-line"].indexOf(getComputedStyle(e.dom).whiteSpace)){if(e.requiresGeckoHackNode=ss,Wl)return;console.warn("ProseMirror expects the CSS white-space property to be set, preferably to 'pre-wrap'. It is recommended to load style/prosemirror.css from the prosemirror-view package."),Wl=!0}}(e)),e.input.badSafariComposition&&(e.input.badSafariComposition=!1,function(e,t){var n;let{focusNode:r,focusOffset:o}=e.domSelectionRange();for(let i of t)if("TR"==(null===(n=i.parentNode)||void 0===n?void 0:n.nodeName)){let t=i.nextSibling;for(;t&&"TD"!=t.nodeName&&"TH"!=t.nodeName;)t=t.nextSibling;if(t){let n=t;for(;;){let e=n.firstChild;if(!e||!Ui(e)||"false"==e.contentEditable||/^(BR|IMG)$/.test(e.nodeName))break;n=e}n.insertBefore(i,n.firstChild),r==i&&e.domSelection().collapse(i,o)}else i.parentNode.removeChild(i)}}(e,a)),this.handleDOMChange(o,i,s,a),e.docView&&e.docView.dirty?e.updateState(e.state):n&&!this.currentSelection.eq(n)&&ca(e),n&&this.currentSelection.set(n))}registerMutation(e,t){if(t.indexOf(e.target)>-1)return null;let n=this.view.docView.nearestDesc(e.target);if("attributes"==e.type&&(n==this.view.docView||"contenteditable"==e.attributeName||"style"==e.attributeName&&!e.oldValue&&!e.target.getAttribute("style")))return null;if(!n||n.ignoreMutation(e))return null;if("childList"==e.type){for(let n=0;n<e.addedNodes.length;n++){let r=e.addedNodes[n];t.push(r),Gi(r)&&(this.lastChangedTextNode=r)}if(n.contentDOM&&n.contentDOM!=n.dom&&!n.contentDOM.contains(e.target))return{from:n.posBefore,to:n.posAfter};let r=e.previousSibling,o=e.nextSibling;if(rs&&is<=11&&e.addedNodes.length)for(let t=0;t<e.addedNodes.length;t++){let{previousSibling:n,nextSibling:i}=e.addedNodes[t];(!n||Array.prototype.indexOf.call(e.addedNodes,n)<0)&&(r=n),(!i||Array.prototype.indexOf.call(e.addedNodes,i)<0)&&(o=i)}let i=r&&r.parentNode==e.target?zi(r)+1:0,s=n.localPosFromDOM(e.target,i,-1),a=o&&o.parentNode==e.target?zi(o):e.target.childNodes.length;return{from:s,to:n.localPosFromDOM(e.target,a,1)}}return"attributes"==e.type?{from:n.posAtStart-n.border,to:n.posAtEnd+n.border}:(this.lastChangedTextNode=e.target,{from:n.posAtStart,to:n.posAtEnd,typeOver:e.target.nodeValue==e.oldValue})}}let Fl=new WeakMap,Wl=!1;function Ul(e,t){let n=t.startContainer,r=t.startOffset,o=t.endContainer,i=t.endOffset,s=e.domAtPos(e.state.selection.anchor);return Hi(s.node,s.offset,o,i)&&([n,r,o,i]=[o,i,n,r]),{anchorNode:n,anchorOffset:r,focusNode:o,focusOffset:i}}function Gl(e,t){for(let n=t.parentNode;n&&n!=e.dom;n=n.parentNode){let t=e.docView.nearestDesc(n,!0);if(t&&t.node.isBlock)return n}return null}const Kl=e=>t=>{let n=t.pmViewDesc;if(n)return n.parseRule(e);if("BR"==t.nodeName&&t.parentNode){if(ds&&/^(ul|ol)$/i.test(t.parentNode.nodeName)){let e=document.createElement("div");return e.appendChild(document.createElement("li")),{skip:e}}if(t.parentNode.lastChild==t||ds&&/^(tr|table)$/i.test(t.parentNode.nodeName))return{ignore:!0}}else if("IMG"==t.nodeName&&t.getAttribute("mark-placeholder"))return{ignore:!0};return null},Jl=/^(a|abbr|acronym|b|bd[io]|big|br|button|cite|code|data(list)?|del|dfn|em|i|img|ins|kbd|label|map|mark|meter|output|q|ruby|s|samp|small|span|strong|su[bp]|time|u|tt|var)$/i;function Zl(e,t,n,r,o){let i=e.input.compositionPendingChanges||(e.composing?e.input.compositionID:0);if(e.input.compositionPendingChanges=0,t<0){let t=e.input.lastSelectionTime>Date.now()-50?e.input.lastSelectionOrigin:null,n=aa(e,t);if(n&&!e.state.selection.eq(n)){if(ls&&fs&&13===e.input.lastKeyCode&&Date.now()-100<e.input.lastKeyCodeTime&&Za(e,"Enter"))return;let r=e.state.tr.setSelection(n);"pointer"==t?r.setMeta("pointer",!0):"key"==t&&r.scrollIntoView(),i&&r.setMeta("composition",i),e.dispatch(r)}return}let s=e.state.doc.resolve(t),a=s.sharedDepth(n);t=s.before(a+1),n=e.state.doc.resolve(n).after(a+1);let l,c,d=e.state.selection,u=function(e,t,n,r){let o,{node:i,fromOffset:s,toOffset:a,from:l,to:c}=e.docView.parseRange(t,n),d=e.domSelectionRange(),u=d.anchorNode;if(u&&Ki(e.dom,u)&&(o=[{node:u,offset:d.anchorOffset}],Zi(d)||o.push({node:d.focusNode,offset:d.focusOffset})),ls&&8===e.input.lastKeyCode)for(let e=a;e>s;e--){let t=i.childNodes[e-1],n=t.pmViewDesc;if("BR"==t.nodeName&&!n){a=e;break}if(!n||n.size)break}let h=e.state.doc,p=e.someProp("domParser")||Bn.fromSchema(e.state.schema),f=h.resolve(l),m=null,g=p.parse(i,{topNode:f.parent,topMatch:f.parent.contentMatchAt(f.index()),topOpen:!0,from:s,to:a,preserveWhitespace:"pre"!=f.parent.type.whitespace||"full",findPositions:o,ruleFromNode:Kl(r),context:f});if(o&&null!=o[0].pos){let e=o[0].pos,t=o[1]&&o[1].pos;null==t&&(t=e),m={anchor:e+l,head:t+l}}return{doc:g,sel:m,from:l,to:c}}(e,t,n,o),h=e.state.doc,p=h.slice(u.from,u.to);8===e.input.lastKeyCode&&Date.now()-100<e.input.lastKeyCodeTime?(l=e.state.selection.to,c="end"):(l=e.state.selection.from,c="start"),e.input.lastKeyCode=null;let f=function(e,t,n,r,o){let i=e.findDiffStart(t,n),s=n+e.size,a=n+t.size;if(null==i)return null;let{a:l,b:c}=e.findDiffEnd(t,s,a);if("end"==o){r-=l+Math.max(0,i-Math.min(l,c))-i}if(l<i&&s<a){i-=r<=i&&r>=l?i-r:0,c=i+(c-l),l=i}else if(c<i){i-=r<=i&&r>=c?i-r:0,l=i+(l-c),c=i}return{start:i,endA:l,endB:c}}(p.content,u.doc.content,u.from,l,c);if(f&&e.input.domChangeCount++,(us&&e.input.lastIOSEnter>Date.now()-225||fs)&&o.some(e=>Ui(e)&&!Jl.test(e.nodeName))&&(!f||f.endA>=f.endB)&&Za(e,"Enter"))return void(e.input.lastIOSEnter=0);if(!f){if(!(r&&d instanceof Fr&&!d.empty&&d.$head.sameParent(d.$anchor))||e.composing||u.sel&&u.sel.anchor!=u.sel.head){if(u.sel){let t=Yl(e,e.state.doc,u.sel);if(t&&!t.eq(e.state.selection)){let n=e.state.tr.setSelection(t);i&&n.setMeta("composition",i),e.dispatch(n)}}return}f={start:d.from,endA:d.to,endB:d.to}}e.state.selection.from<e.state.selection.to&&f.start==f.endB&&e.state.selection instanceof Fr&&(f.start>e.state.selection.from&&f.start<=e.state.selection.from+2&&e.state.selection.from>=u.from?f.start=e.state.selection.from:f.endA<e.state.selection.to&&f.endA>=e.state.selection.to-2&&e.state.selection.to<=u.to&&(f.endB+=e.state.selection.to-f.endA,f.endA=e.state.selection.to)),rs&&is<=11&&f.endB==f.start+1&&f.endA==f.start&&f.start>u.from&&"  "==u.doc.textBetween(f.start-u.from-1,f.start-u.from+1)&&(f.start--,f.endA--,f.endB--);let m=u.doc.resolveNoCache(f.start-u.from),g=u.doc.resolveNoCache(f.endB-u.from),v=h.resolve(f.start),y=m.sameParent(g)&&m.parent.inlineContent&&v.end()>=f.endA;if((us&&e.input.lastIOSEnter>Date.now()-225&&(!y||o.some(e=>"DIV"==e.nodeName||"P"==e.nodeName))||!y&&function(e,t,n){let r=0,o=0;return e.nodesBetween(t,n,(e,i)=>{e.isTextblock&&i>=t&&i<n?r++:(e.isText?/\S/.test(e.text.slice(Math.max(0,t-i),Math.min(e.nodeSize,n-i))):e.isLeaf)&&o++}),0==o&&1==r}(u.doc,m.pos,g.pos))&&Za(e,"Enter"))return void(e.input.lastIOSEnter=0);if(e.state.selection.anchor>f.start&&(y?f.endA>f.start&&f.endB==f.start:function(e,t,n,r,o){if(n-t<=o.pos-r.pos||Xl(r,!0,!1)<o.pos)return!1;let i=e.resolve(t);if(!r.parent.inlineContent){let e=i.nodeAfter;return null!=e&&n==t+e.nodeSize}if(i.parentOffset<i.parent.content.size||!i.parent.isTextblock)return!1;let s=e.resolve(Xl(i,!0,!0));return!(!s.parent.isTextblock||s.pos>n||Xl(s,!0,!1)<n)&&r.parent.content.cut(r.parentOffset).eq(s.parent.content)}(h,f.start,f.endA,m,g))&&Za(e,"Backspace"))return void(fs&&ls&&e.domObserver.suppressSelectionUpdates());ls&&f.endB==f.start&&(e.input.lastChromeDelete=Date.now()),fs&&!y&&m.start()!=g.start()&&0==g.parentOffset&&m.depth==g.depth&&u.sel&&u.sel.anchor==u.sel.head&&u.sel.head==f.endA&&(f.endB-=2,g=u.doc.resolveNoCache(f.endB-u.from),setTimeout(()=>Za(e,"Enter"),20));let w,b=f.start,x=f.endA,k=t=>{let n=t||e.state.tr.replace(b,x,u.doc.slice(f.start-u.from,f.endB-u.from));if(u.sel){let t=Yl(e,n.doc,u.sel);t&&!(ls&&e.composing&&t.empty&&(f.start!=f.endB||e.input.lastChromeDelete<Date.now()-100)&&(t.head==b||t.head==n.mapping.map(x)-1)||rs&&t.empty&&t.head==b)&&n.setSelection(t)}return i&&n.setMeta("composition",i),n.scrollIntoView()};if(y)if(m.pos==g.pos){rs&&is<=11&&0==m.parentOffset&&(e.domObserver.suppressSelectionUpdates(),setTimeout(()=>ca(e),20));let t=k(e.state.tr.delete(b,x)),n=h.resolve(f.start).marksAcross(h.resolve(f.endA));n&&t.ensureMarks(n),e.dispatch(t)}else if(f.endA==f.endB&&(w=function(e,t){let n,r,o,i=e.firstChild.marks,s=t.firstChild.marks,a=i,l=s;for(let e=0;e<s.length;e++)a=s[e].removeFromSet(a);for(let e=0;e<i.length;e++)l=i[e].removeFromSet(l);if(1==a.length&&0==l.length)r=a[0],n="add",o=e=>e.mark(r.addToSet(e.marks));else{if(0!=a.length||1!=l.length)return null;r=l[0],n="remove",o=e=>e.mark(r.removeFromSet(e.marks))}let c=[];for(let e=0;e<t.childCount;e++)c.push(o(t.child(e)));if(Ft.from(c).eq(e))return{mark:r,type:n}}(m.parent.content.cut(m.parentOffset,g.parentOffset),v.parent.content.cut(v.parentOffset,f.endA-v.start())))){let t=k(e.state.tr);"add"==w.type?t.addMark(b,x,w.mark):t.removeMark(b,x,w.mark),e.dispatch(t)}else if(m.parent.child(m.index()).isText&&m.index()==g.index()-(g.textOffset?0:1)){let t=m.parent.textBetween(m.parentOffset,g.parentOffset),n=()=>k(e.state.tr.insertText(t,b,x));e.someProp("handleTextInput",r=>r(e,b,x,t,n))||e.dispatch(n())}else e.dispatch(k());else e.dispatch(k())}function Yl(e,t,n){return Math.max(n.anchor,n.head)>t.content.size?null:ga(e,t.resolve(n.anchor),t.resolve(n.head))}function Xl(e,t,n){let r=e.depth,o=t?e.end():e.pos;for(;r>0&&(t||e.indexAfter(r)==e.node(r).childCount);)r--,o++,t=!1;if(n){let t=e.node(r).maybeChild(e.indexAfter(r));for(;t&&!t.isLeaf;)t=t.firstChild,o++}return o}class Ql{constructor(e,t){this._root=null,this.focused=!1,this.trackWrites=null,this.mounted=!1,this.markCursor=null,this.cursorWrapper=null,this.lastSelectedViewDesc=void 0,this.input=new Wa,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=t,this.state=t.state,this.directPlugins=t.plugins||[],this.directPlugins.forEach(oc),this.dispatch=this.dispatch.bind(this),this.dom=e&&e.mount||document.createElement("div"),e&&(e.appendChild?e.appendChild(this.dom):"function"==typeof e?e(this.dom):e.mount&&(this.mounted=!0)),this.editable=nc(this),tc(this),this.nodeViews=rc(this),this.docView=Ws(this.state.doc,ec(this),jl(this),this.dom,this),this.domObserver=new ql(this,(e,t,n,r)=>Zl(this,e,t,n,r)),this.domObserver.start(),function(e){for(let t in Ha){let n=Ha[t];e.dom.addEventListener(t,e.input.eventHandlers[t]=t=>{!Ja(e,t)||Ka(e,t)||!e.editable&&t.type in qa||n(e,t)},Fa[t]?{passive:!0}:void 0)}ds&&e.dom.addEventListener("input",()=>null),Ga(e)}(this),this.updatePluginViews()}get composing(){return this.input.composing}get props(){if(this._props.state!=this.state){let e=this._props;this._props={};for(let t in e)this._props[t]=e[t];this._props.state=this.state}return this._props}update(e){e.handleDOMEvents!=this._props.handleDOMEvents&&Ga(this);let t=this._props;this._props=e,e.plugins&&(e.plugins.forEach(oc),this.directPlugins=e.plugins),this.updateStateInner(e.state,t)}setProps(e){let t={};for(let e in this._props)t[e]=this._props[e];t.state=this.state;for(let n in e)t[n]=e[n];this.update(t)}updateState(e){this.updateStateInner(e,this._props)}updateStateInner(e,t){var n;let r=this.state,o=!1,i=!1;e.storedMarks&&this.composing&&(hl(this),i=!0),this.state=e;let s=r.plugins!=e.plugins||this._props.plugins!=t.plugins;if(s||this._props.plugins!=t.plugins||this._props.nodeViews!=t.nodeViews){let e=rc(this);(function(e,t){let n=0,r=0;for(let r in e){if(e[r]!=t[r])return!0;n++}for(let e in t)r++;return n!=r})(e,this.nodeViews)&&(this.nodeViews=e,o=!0)}(s||t.handleDOMEvents!=this._props.handleDOMEvents)&&Ga(this),this.editable=nc(this),tc(this);let a=jl(this),l=ec(this),c=r.plugins==e.plugins||r.doc.eq(e.doc)?e.scrollToSelection>r.scrollToSelection?"to selection":"preserve":"reset",d=o||!this.docView.matchesNode(e.doc,l,a);!d&&e.selection.eq(r.selection)||(i=!0);let u="preserve"==c&&i&&null==this.dom.style.overflowAnchor&&function(e){let t,n,r=e.dom.getBoundingClientRect(),o=Math.max(0,r.top);for(let i=(r.left+r.right)/2,s=o+1;s<Math.min(innerHeight,r.bottom);s+=5){let r=e.root.elementFromPoint(i,s);if(!r||r==e.dom||!e.dom.contains(r))continue;let a=r.getBoundingClientRect();if(a.top>=o-20){t=r,n=a.top;break}}return{refDOM:t,refTop:n,stack:xs(e.dom)}}(this);if(i){this.domObserver.stop();let t=d&&(rs||ls)&&!this.composing&&!r.selection.empty&&!e.selection.empty&&function(e,t){let n=Math.min(e.$anchor.sharedDepth(e.head),t.$anchor.sharedDepth(t.head));return e.$anchor.start(n)!=t.$anchor.start(n)}(r.selection,e.selection);if(d){let n=ls?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=pl(this)),!o&&this.docView.update(e.doc,l,a,this)||(this.docView.updateOuterDeco(l),this.docView.destroy(),this.docView=Ws(e.doc,l,a,this.dom,this)),!n||this.trackWrites&&this.dom.contains(this.trackWrites)||(t=!0)}let n=this.input.mouseDown;t||!(n&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&function(e){let t=e.docView.domFromPos(e.state.selection.anchor,0),n=e.domSelectionRange();return Hi(t.node,t.offset,n.anchorNode,n.anchorOffset)}(this)&&n.delaySelUpdate())?ca(this,t):(fa(this,e.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(r),(null===(n=this.dragging)||void 0===n?void 0:n.node)&&!r.doc.eq(e.doc)&&this.updateDraggedNode(this.dragging,r),"reset"==c?this.dom.scrollTop=0:"to selection"==c?this.scrollToSelection():u&&function({refDOM:e,refTop:t,stack:n}){let r=e?e.getBoundingClientRect().top:0;ks(n,0==r?0:r-t)}(u)}scrollToSelection(){let e=this.domSelectionRange().focusNode;if(e&&Ki(this.dom,e))if(this.someProp("handleScrollToSelection",e=>e(this)));else if(this.state.selection instanceof Ur){let t=this.docView.domAfterPos(this.state.selection.from);Ui(t)&&bs(this,t.getBoundingClientRect(),e)}else bs(this,this.coordsAtPos(this.state.selection.head,1),e);else;}destroyPluginViews(){let e;for(;e=this.pluginViews.pop();)e.destroy&&e.destroy()}updatePluginViews(e){if(e&&e.plugins==this.state.plugins&&this.directPlugins==this.prevDirectPlugins)for(let t=0;t<this.pluginViews.length;t++){let n=this.pluginViews[t];n.update&&n.update(this,e)}else{this.prevDirectPlugins=this.directPlugins,this.destroyPluginViews();for(let e=0;e<this.directPlugins.length;e++){let t=this.directPlugins[e];t.spec.view&&this.pluginViews.push(t.spec.view(this))}for(let e=0;e<this.state.plugins.length;e++){let t=this.state.plugins[e];t.spec.view&&this.pluginViews.push(t.spec.view(this))}}}updateDraggedNode(e,t){let n=e.node,r=-1;if(n.from<this.state.doc.content.size&&this.state.doc.nodeAt(n.from)==n.node)r=n.from;else{let e=n.from+(this.state.doc.content.size-t.doc.content.size);(e>0&&e<this.state.doc.content.size&&this.state.doc.nodeAt(e))==n.node&&(r=e)}this.dragging=new yl(e.slice,e.move,r<0?void 0:Ur.create(this.state.doc,r))}someProp(e,t){let n,r=this._props&&this._props[e];if(null!=r&&(n=t?t(r):r))return n;for(let r=0;r<this.directPlugins.length;r++){let o=this.directPlugins[r].props[e];if(null!=o&&(n=t?t(o):o))return n}let o=this.state.plugins;if(o)for(let r=0;r<o.length;r++){let i=o[r].props[e];if(null!=i&&(n=t?t(i):i))return n}}hasFocus(){if(rs){let e=this.root.activeElement;if(e==this.dom)return!0;if(!e||!this.dom.contains(e))return!1;for(;e&&this.dom!=e&&this.dom.contains(e);){if("false"==e.contentEditable)return!1;e=e.parentElement}return!0}return this.root.activeElement==this.dom}focus(){this.domObserver.stop(),this.editable&&function(e){if(e.setActive)return e.setActive();if(Cs)return e.focus(Cs);let t=xs(e);e.focus(null==Cs?{get preventScroll(){return Cs={preventScroll:!0},!0}}:void 0),Cs||(Cs=!1,ks(t,0))}(this.dom),ca(this),this.domObserver.start()}get root(){let e=this._root;if(null==e)for(let e=this.dom.parentNode;e;e=e.parentNode)if(9==e.nodeType||11==e.nodeType&&e.host)return e.getSelection||(Object.getPrototypeOf(e).getSelection=()=>e.ownerDocument.getSelection()),this._root=e;return e||document}updateRoot(){this._root=null}posAtCoords(e){return Es(this,e)}coordsAtPos(e,t=1){return Ds(this,e,t)}domAtPos(e,t=0){return this.docView.domFromPos(e,t)}nodeDOM(e){let t=this.docView.descAt(e);return t?t.nodeDOM:null}posAtDOM(e,t,n=-1){let r=this.docView.posFromDOM(e,t,n);if(null==r)throw new RangeError("DOM position not inside the editor");return r}endOfTextblock(e,t){return js(this,t||this.state,e)}pasteHTML(e,t){return gl(this,"",e,!1,t||new ClipboardEvent("paste"))}pasteText(e,t){return gl(this,e,null,!0,t||new ClipboardEvent("paste"))}serializeForClipboard(e){return Da(this,e)}destroy(){this.docView&&(!function(e){e.input.mouseDown&&e.input.mouseDown.done(),e.domObserver.stop();for(let t in e.input.eventHandlers)e.dom.removeEventListener(t,e.input.eventHandlers[t]);clearTimeout(e.input.composingTimeout),clearTimeout(e.input.lastIOSEnterFallbackTimeout)}(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],jl(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,Vi=null)}get isDestroyed(){return null==this.docView}dispatchEvent(e){return function(e,t){Ka(e,t)||!Ha[t.type]||!e.editable&&t.type in qa||Ha[t.type](e,t)}(this,e)}domSelectionRange(){let e=!1!==this.dom.isConnected&&this.domSelection();return e?ds&&11===this.root.nodeType&&function(e){let t=e.activeElement;for(;t&&t.shadowRoot;)t=t.shadowRoot.activeElement;return t}(this.dom.ownerDocument)==this.dom&&function(e,t){if(t.getComposedRanges){let n=t.getComposedRanges(e.root)[0];if(n)return Ul(e,n)}let n;function r(e){e.preventDefault(),e.stopImmediatePropagation(),n=e.getTargetRanges()[0]}return e.dom.addEventListener("beforeinput",r,!0),document.execCommand("indent"),e.dom.removeEventListener("beforeinput",r,!0),n?Ul(e,n):null}(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}function ec(e){let t=Object.create(null);return t.class="ProseMirror",t.contenteditable=String(e.editable),e.someProp("attributes",n=>{if("function"==typeof n&&(n=n(e.state)),n)for(let e in n)"class"==e?t.class+=" "+n[e]:"style"==e?t.style=(t.style?t.style+";":"")+n[e]:t[e]||"contenteditable"==e||"nodeName"==e||(t[e]=String(n[e]))}),t.translate||(t.translate="no"),[Nl.node(0,e.state.doc.content.size,t)]}function tc(e){if(e.markCursor){let t=document.createElement("img");t.className="ProseMirror-separator",t.setAttribute("mark-placeholder","true"),t.setAttribute("alt",""),e.cursorWrapper={dom:t,deco:Nl.widget(e.state.selection.from,t,{raw:!0,marks:e.markCursor})}}else e.cursorWrapper=null}function nc(e){return!e.someProp("editable",t=>!1===t(e.state))}function rc(e){let t=Object.create(null);function n(e){for(let n in e)Object.prototype.hasOwnProperty.call(t,n)||(t[n]=e[n])}return e.someProp("nodeViews",n),e.someProp("markViews",n),t}function oc(e){if(e.spec.state||e.spec.filterTransaction||e.spec.appendTransaction)throw new RangeError("Plugins passed directly to the view must not have a state component")}function ic(e,t){return e.meta={package:"@milkdown/core",group:"System",...t},e}Ql.prototype.dispatch=function(e){let t=this._props.dispatchTransaction;t?t.call(this,e):this.updateState(this.state.apply(e))};var sc={text:(e,t,n,r)=>{const o=e.value;return/^[^*_\\]*\s+$/.test(o)?o:n.safe(o,{...r,encode:[]})},strong:(e,t,n,r)=>{const o=e.marker||n.options.strong||"*",i=n.enter("strong"),s=n.createTracker(r);let a=s.move(o+o);return a+=s.move(n.containerPhrasing(e,{before:a,after:o,...s.current()})),a+=s.move(o+o),i(),a},emphasis:(e,t,n,r)=>{const o=e.marker||n.options.emphasis||"*",i=n.enter("emphasis"),s=n.createTracker(r);let a=s.move(o);return a+=s.move(n.containerPhrasing(e,{before:a,after:o,...s.current()})),a+=s.move(o),i(),a}},ac=Dt({},"editorView"),lc=Dt({},"editorState"),cc=Dt([],"initTimer"),dc=Dt({},"editor"),uc=Dt([],"inputRules"),hc=Dt([],"prosePlugins"),pc=Dt([],"remarkPlugins"),fc=Dt([],"nodeView"),mc=Dt([],"markView"),gc=Dt(W().use(U).use(zt),"remark"),vc=Dt({handlers:sc,encode:[]},"remarkStringifyOptions"),yc=Pt("ConfigReady");var wc=Pt("InitReady");function bc(e){const t=t=>(t.inject(dc,e).inject(hc,[]).inject(pc,[]).inject(uc,[]).inject(fc,[]).inject(mc,[]).inject(vc,{handlers:sc,encode:[]}).inject(gc,W().use(U).use(zt)).inject(cc,[yc]).record(wc),async()=>{await t.waitTimers(cc);const e=t.get(vc);return t.set(gc,W().use(U).use(zt,e)),t.done(wc),()=>{t.remove(dc).remove(hc).remove(pc).remove(uc).remove(fc).remove(mc).remove(vc).remove(gc).remove(cc).clearTimer(wc)}});return ic(t,{displayName:"Init"}),t}var xc=Pt("SchemaReady"),kc=Dt([],"schemaTimer"),Cc=Dt({},"schema"),Sc=Dt([],"nodes"),Mc=Dt([],"marks");function Nc(e){return{...e,parseDOM:e.parseDOM?.map(t=>({priority:e.priority,...t}))}}var Ec=e=>(e.inject(Cc,{}).inject(Sc,[]).inject(Mc,[]).inject(kc,[wc]).record(xc),async()=>{await e.waitTimers(kc);const t=e.get(gc),n=e.get(pc).reduce((e,t)=>e.use(t.plugin,t.options),t);e.set(gc,n);const r=Object.fromEntries(e.get(Sc).map(([e,t])=>[e,Nc(t)])),o=Object.fromEntries(e.get(Mc).map(([e,t])=>[e,Nc(t)])),i=new Rn({nodes:r,marks:o});return e.set(Cc,i),e.done(xc),()=>{e.remove(Cc).remove(Sc).remove(Mc).remove(kc).clearTimer(xc)}});ic(Ec,{displayName:"Schema"});var Oc=class{constructor(){this.#o=new Ot,this.#P=null,this.setCtx=e=>{this.#P=e},this.chain=()=>{if(null==this.#P)throw Mt();const e=this.#P,t=[],n=this.get.bind(this),r={run:()=>{const n=Oo(...t),r=e.get(ac);return n(r.state,r.dispatch,r)},inline:e=>(t.push(e),r),pipe:function(e,o){const i=n(e);return t.push(i(o)),r}.bind(this)};return r}}#o;#P;get ctx(){return this.#P}create(e,t){const n=e.create(this.#o.sliceMap);return n.set(t),n}get(e){return this.#o.get(e).get()}remove(e){return this.#o.remove(e)}call(e,t){if(null==this.#P)throw Mt();const n=this.get(e)(t),r=this.#P.get(ac);return n(r.state,r.dispatch,r)}inline(e){if(null==this.#P)throw Mt();const t=this.#P.get(ac);return e(t.state,t.dispatch,t)}};var Ac=Dt(new Oc,"commands"),Tc=Dt([xc],"commandsTimer"),Dc=Pt("CommandsReady"),Ic=e=>{const t=new Oc;return t.setCtx(e),e.inject(Ac,t).inject(Tc,[xc]).record(Dc),async()=>(await e.waitTimers(Tc),e.done(Dc),()=>{e.remove(Ac).remove(Tc).clearTimer(Dc)})};ic(Ic,{displayName:"Commands"});var _c=class{constructor(){this.#P=null,this.#z=[],this.setCtx=e=>{this.#P=e},this.add=e=>(this.#z.push(e),()=>{this.#z=this.#z.filter(t=>t!==e)}),this.addObjectKeymap=e=>{const t=[];return Object.entries(e).forEach(([e,n])=>{if("function"==typeof n){const r={key:e,onRun:()=>n};this.#z.push(r),t.push(()=>{this.#z=this.#z.filter(e=>e!==r)})}else this.#z.push(n),t.push(()=>{this.#z=this.#z.filter(e=>e!==n)})}),()=>{t.forEach(e=>e())}},this.addBaseKeymap=()=>{const e=function(e){return e.Backspace=Oo(Lo,co,po,mo),e}(_o);return this.addObjectKeymap(e)},this.build=()=>{const e={};return this.#z.forEach(t=>{e[t.key]=[...e[t.key]||[],t]}),Object.fromEntries(Object.entries(e).map(([e,t])=>{const n=t.sort((e,t)=>(t.priority??50)-(e.priority??50));return[e,(e,t,r)=>{const o=this.#P;if(null==o)throw kt();return Oo(...n.map(e=>e.onRun(o)))(e,t,r)}]}))}}#P;#z;get ctx(){return this.#P}},Rc=Dt(new _c,"keymap"),Lc=Dt([xc],"keymapTimer"),Bc=Pt("KeymapReady"),Pc=e=>{const t=new _c;return t.setCtx(e),e.inject(Rc,t).inject(Lc,[xc]).record(Bc),async()=>(await e.waitTimers(Lc),e.done(Bc),()=>{e.remove(Rc).remove(Lc).clearTimer(Bc)})},zc=Pt("ParserReady"),jc=()=>{throw kt()},Vc=Dt(jc,"parser"),$c=Dt([],"parserTimer"),Hc=e=>(e.inject(Vc,jc).inject($c,[xc]).record(zc),async()=>{await e.waitTimers($c);const t=e.get(gc),n=e.get(Cc);return e.set(Vc,Li.create(n,t)),e.done(zc),()=>{e.remove(Vc).remove($c).clearTimer(zc)}});ic(Hc,{displayName:"Parser"});var qc=Pt("SerializerReady"),Fc=Dt([],"serializerTimer"),Wc=()=>{throw kt()},Uc=Dt(Wc,"serializer"),Gc=e=>(e.inject(Uc,Wc).inject(Fc,[xc]).record(qc),async()=>{await e.waitTimers(Fc);const t=e.get(gc),n=e.get(Cc);return e.set(Uc,Pi.create(n,t)),e.done(qc),()=>{e.remove(Uc).remove(Fc).clearTimer(qc)}});ic(Gc,{displayName:"Serializer"});var Kc=Dt("","defaultValue"),Jc=Dt(e=>e,"stateOptions"),Zc=Dt([],"editorStateTimer"),Yc=Pt("EditorStateReady");function Xc(e,t,n){if("string"==typeof e)return t(e);if("html"===e.type)return Bn.fromSchema(n).parse(e.dom);if("json"===e.type)return mn.fromJSON(n,e.value);throw r=e,new wt(yt.docTypeError,`Doc type error, unsupported type: ${xt(r)}`);var r}var Qc=new lo("MILKDOWN_STATE_TRACKER"),ed=e=>(e.inject(Kc,"").inject(lc,{}).inject(Jc,e=>e).inject(Zc,[zc,qc,Dc,Bc]).record(Yc),async()=>{await e.waitTimers(Zc);const t=e.get(Cc),n=e.get(Vc),r=e.get(uc),o=e.get(Jc),i=e.get(hc),s=Xc(e.get(Kc),n,t),a=e.get(Rc),l=a.addBaseKeymap(),c=[...i,new io({key:Qc,state:{init:()=>{},apply:(t,n,r,o)=>{e.set(lc,o)}}}),si({rules:r}),Ti(a.build())];e.set(hc,c);const d=o({schema:t,doc:s,plugins:c}),u=ro.create(d);return e.set(lc,u),e.done(Yc),()=>{l(),e.remove(Kc).remove(lc).remove(Jc).remove(Zc).clearTimer(Yc)}});ic(ed,{displayName:"EditorState"});var td=Dt([],"pasteRule"),nd=Dt([xc],"pasteRuleTimer"),rd=Pt("PasteRuleReady"),od=e=>(e.inject(td,[]).inject(nd,[xc]).record(rd),async()=>(await e.waitTimers(nd),e.done(rd),()=>{e.remove(td).remove(nd).clearTimer(rd)}));ic(od,{displayName:"PasteRule"});var id=Pt("EditorViewReady"),sd=Dt([],"editorViewTimer"),ad=Dt({},"editorViewOptions"),ld=Dt(null,"root"),cd=Dt(null,"rootDOM"),dd=Dt({},"rootAttrs");var ud=new lo("MILKDOWN_VIEW_CLEAR"),hd=e=>(e.inject(ld,document.body).inject(ac,{}).inject(ad,{}).inject(cd,null).inject(dd,{}).inject(sd,[Yc,rd]).record(id),async()=>{await e.wait(wc);const t=e.get(ld)||document.body,n="string"==typeof t?document.querySelector(t):t;e.update(hc,t=>[new io({key:ud,view:t=>{const r=n?function(e,t){const n=document.createElement("div");n.className="milkdown",e.appendChild(n),t.set(cd,n);const r=t.get(dd);return Object.entries(r).forEach(([e,t])=>n.setAttribute(e,t)),n}(n,e):void 0;return(()=>{if(r&&n){const e=t.dom;n.replaceChild(r,e),r.appendChild(e)}})(),{destroy:()=>{r?.parentNode&&r?.parentNode.replaceChild(t.dom,r),r?.remove()}}}}),...t]),await e.waitTimers(sd);const r=e.get(lc),o=e.get(ad),i=Object.fromEntries(e.get(fc)),s=Object.fromEntries(e.get(mc)),a=new Ql(n,{state:r,nodeViews:i,markViews:s,transformPasted:(t,n,r)=>(e.get(td).sort((e,t)=>(t.priority??50)-(e.priority??50)).map(e=>e.run).forEach(e=>{t=e(t,n,r)}),t),...o});var l;return(l=a.dom).classList.add("editor"),l.setAttribute("role","textbox"),e.set(ac,a),e.done(id),()=>{a?.destroy(),e.remove(ld).remove(ac).remove(ad).remove(cd).remove(dd).remove(sd).clearTimer(id)}});ic(hd,{displayName:"EditorView"});var pd=function(e){return e.Idle="Idle",e.OnCreate="OnCreate",e.Created="Created",e.OnDestroy="OnDestroy",e.Destroyed="Destroyed",e}({}),fd=class e{constructor(){this.#j=!1,this.#g="Idle",this.#V=[],this.#$=()=>{},this.#o=new Ot,this.#i=new Rt,this.#H=new Map,this.#q=new Map,this.#P=new _t(this.#o,this.#i),this.#F=()=>{const e=function(e){const t=t=>(t.record(yc),async()=>(await e(t),t.done(yc),()=>{t.clearTimer(yc)}));return ic(t,{displayName:"Config"}),t}(async e=>{await Promise.all(this.#V.map(t=>Promise.resolve(t(e))))}),t=[Ec,Hc,Gc,Ic,Pc,od,ed,hd,bc(this),e];this.#W(t,this.#q)},this.#W=(e,t)=>{e.forEach(e=>{const n=this.#P.produce(this.#j?e.meta:void 0),r=e(n);t.set(e,{ctx:n,handler:r,cleanup:void 0})})},this.#U=(e,t=!1)=>Promise.all([e].flat().map(async e=>{const n=this.#H.get(e)?.cleanup;return t?this.#H.delete(e):this.#H.set(e,{ctx:void 0,handler:void 0,cleanup:void 0}),"function"==typeof n?n():n})),this.#G=async()=>{await Promise.all([...this.#q.entries()].map(async([e,{cleanup:t}])=>"function"==typeof t?t():t)),this.#q.clear()},this.#K=e=>{this.#g=e,this.#$(e)},this.#J=e=>[...e.entries()].map(async([t,n])=>{const{ctx:r,handler:o}=n;if(!o)return;const i=await o();e.set(t,{ctx:r,handler:o,cleanup:i})}),this.enableInspector=(e=!0)=>(this.#j=e,this),this.onStatusChange=e=>(this.#$=e,this),this.config=e=>(this.#V.push(e),this),this.removeConfig=e=>(this.#V=this.#V.filter(t=>t!==e),this),this.use=e=>{const t=[e].flat();return t.flat().forEach(e=>{this.#H.set(e,{ctx:void 0,handler:void 0,cleanup:void 0})}),"Created"===this.#g&&this.#W(t,this.#H),this},this.remove=async e=>"OnCreate"===this.#g?(console.warn("[Milkdown]: You are trying to remove plugins when the editor is creating, this is not recommended, please check your code."),new Promise(t=>{setTimeout(()=>{t(this.remove(e))},50)})):(await this.#U([e].flat(),!0),this),this.create=async()=>("OnCreate"===this.#g||("Created"===this.#g&&await this.destroy(),this.#K("OnCreate"),this.#F(),this.#W([...this.#H.keys()],this.#H),await Promise.all([this.#J(this.#q),this.#J(this.#H)].flat()),this.#K("Created")),this),this.destroy=async(e=!1)=>"Destroyed"===this.#g||"OnDestroy"===this.#g?this:"OnCreate"===this.#g?new Promise(t=>{setTimeout(()=>{t(this.destroy(e))},50)}):(e&&(this.#V=[]),this.#K("OnDestroy"),await this.#U([...this.#H.keys()],e),await this.#G(),this.#K("Destroyed"),this),this.action=e=>e(this.#P),this.inspect=()=>this.#j?[...this.#q.values(),...this.#H.values()].map(({ctx:e})=>e?.inspector?.read()).filter(e=>Boolean(e)):(console.warn("[Milkdown]: You are trying to collect inspection when inspector is disabled, please enable inspector by `editor.enableInspector()` first."),[])}static make(){return new e}#j;#g;#V;#$;#o;#i;#H;#q;#P;#F;#W;#U;#G;#K;#J;get ctx(){return this.#P}get status(){return this.#g}};let md=e=>crypto.getRandomValues(new Uint8Array(e)),gd=(e,t=21)=>((e,t,n)=>{let r=256-256%e.length;if(256===r){let r=e.length-1;return(o=t)=>{if(!o)return"";let i="";for(;;){let t=n(o),s=o|=0;for(;s--;)if(i+=e[t[s]&r],i.length>=o)return i}}}return(o=t)=>{if(!o)return"";let i="",s=Math.ceil(409.6*o/r);for(;;){let t=n(s),a=s;for(;a--;)if(t[a]<r&&(i+=e[t[a]%e.length],i.length>=o))return i}}})(e,0|t,md);function vd(e,t,n){const r=e.findIndex(([e])=>e===t);if(-1===r)return[...e,n];const o=e.slice();return o[r]=n,o}function yd(e,t){const n=function(e="cmdKey"){return Dt(()=>()=>!1,e)}(e),r=o=>async()=>{r.key=n,await o.wait(Dc);const i=t(o);return o.get(Ac).create(n,i),r.run=t=>o.get(Ac).call(e,t),()=>{o.get(Ac).remove(n)}};return r}function wd(e){const t=n=>async()=>{await n.wait(xc);const r=e(n);return n.update(uc,e=>[...e,r]),t.inputRule=r,()=>{n.update(uc,e=>e.filter(e=>e!==r))}};return t}function bd(e,t){const n=r=>async()=>{const o=t(r);return r.update(Mc,t=>vd(t,e,[e,o])),n.id=e,n.schema=o,()=>{r.update(Mc,t=>t.filter(([t])=>t!==e))}};return n.type=t=>{const n=t.get(Cc).marks[e];if(!n)throw r=e,new wt(yt.missingMarkInSchema,`Missing mark in schema, milkdown cannot find "${r}" in schema.`);var r;return n},n}function xd(e,t){const n=r=>async()=>{const o=t(r);return r.update(Sc,t=>vd(t,e,[e,o])),n.id=e,n.schema=o,()=>{r.update(Sc,t=>t.filter(([t])=>t!==e))}};return n.type=t=>{const n=t.get(Cc).nodes[e];if(!n)throw Nt(e);return n},n}function kd(e){let t;const n=n=>async()=>(await n.wait(xc),t=e(n),n.update(hc,e=>[...e,t]),()=>{n.update(hc,e=>e.filter(e=>e!==t))});return n.plugin=()=>t,n.key=()=>t.spec.key,n}function Cd(e){const t=n=>async()=>{await n.wait(Bc);const r=n.get(Rc),o=e(n),i=r.addObjectKeymap(o);return t.keymap=o,()=>{i()}};return t}function Sd(e,t){const n=r=>async()=>{await r.wait(xc);const o=t(r);return e.type(r)instanceof Dn?r.update(fc,t=>[...t,[e.id,o]]):r.update(mc,t=>[...t,[e.id,o]]),n.view=o,n.type=e,()=>{e.type(r)instanceof Dn?r.update(fc,t=>t.filter(t=>t[0]!==e.id)):r.update(mc,t=>t.filter(t=>t[0]!==e.id))}};return n}function Md(e,t){const n=Dt(e,t),r=e=>(e.inject(n),()=>()=>{e.remove(n)});return r.key=n,r}function Nd(e,t){const n=Md(t,e),r=xd(e,e=>e.get(n.key)(e)),o=[n,r];return o.id=r.id,o.node=r,o.type=e=>r.type(e),o.ctx=n,o.key=n.key,o.extendSchema=n=>Nd(e,n(t)),o}function Ed(e,t){const n=Md(t,e),r=bd(e,e=>e.get(n.key)(e)),o=[n,r];return o.id=r.id,o.mark=r,o.type=e=>r.type(e),o.ctx=n,o.key=n.key,o.extendSchema=n=>Ed(e,n(t)),o}function Od(e,t){const n=Md(Object.fromEntries(Object.entries(t).map(([e,{shortcuts:t,priority:n}])=>[e,{shortcuts:t,priority:n}])),`${e}Keymap`),r=Cd(e=>{const r=e.get(n.key),o=Object.entries(t).flatMap(([e,{command:t}])=>{const n=r[e],o=[n.shortcuts].flat(),i=n.priority;return o.map(e=>[e,{key:e,onRun:t,priority:i}])});return Object.fromEntries(o)}),o=[n,r];return o.ctx=n,o.shortcuts=r,o.key=n.key,o.keymap=r.keymap,o}gd("abcedfghicklmn",10);var Ad=(e,t=()=>({}))=>Md(t,`${e}Attr`),Td=(e,t=()=>({}))=>Md(t,`${e}Attr`);function Dd(e,t,n){const r=Md({},e),o=e=>async()=>{await e.wait(wc);const n={plugin:t(e),options:e.get(r.key)};return e.update(pc,e=>[...e,n]),()=>{e.update(pc,e=>e.filter(e=>e!==n))}},i=[r,o];return i.id=e,i.plugin=o,i.options=r,i}function Id(e){return e=>{const t=e.get(ac);e.get(Cc);return e.get(Uc)(t.state.doc)}}var _d=oe({});var Rd=()=>{const e=function(){const{dom:e,editor:t,setLoading:n,editorFactory:r}=ie(_d),o=te(null);return le(()=>{const i=o.current;if(!r)return;if(!i)return;e.current=i;const s=r(i);return s?(n(!0),s.create().then(e=>{t.current=e}).finally(()=>{n(!1)}).catch(console.error),()=>{s.destroy().catch(console.error)}):void 0},[e,t,r,n]),o}();return ee.createElement("div",{"data-milkdown-root":!0,ref:e})},Ld=({children:e})=>{const t=te(void 0),[n,r]=ne(void 0),o=te(void 0),[i,s]=ne(!0),a=re(()=>({loading:i,dom:t,editor:o,setLoading:s,editorFactory:n,setEditorFactory:r}),[i,n]);return ee.createElement(_d.Provider,{value:a},e)};function Bd(){const e=ie(_d),t=se(()=>e.editor.current,[e.editor]);return[e.loading,t]}function Pd(e){return new i(s.define(e))}function zd(e){return import("./index-D2XW0y_s.js").then(t=>t.sql({dialect:t[e]}))}const jd=[o.of({name:"C",extensions:["c","h","ino"],load:()=>import("./index-DDBuqExW.js").then(e=>e.cpp())}),o.of({name:"C++",alias:["cpp"],extensions:["cpp","c++","cc","cxx","hpp","h++","hh","hxx"],load:()=>import("./index-DDBuqExW.js").then(e=>e.cpp())}),o.of({name:"CQL",alias:["cassandra"],extensions:["cql"],load:()=>zd("Cassandra")}),o.of({name:"CSS",extensions:["css"],load:()=>import("./index-B9JSZpaA.js").then(e=>e.css())}),o.of({name:"Go",extensions:["go"],load:()=>import("./index-wJyG4Gm6.js").then(e=>e.go())}),o.of({name:"HTML",alias:["xhtml"],extensions:["html","htm","handlebars","hbs"],load:()=>import("./index-Dn0pnDCC.js").then(e=>e.html())}),o.of({name:"Java",extensions:["java"],load:()=>import("./index-D6A8P_xS.js").then(e=>e.java())}),o.of({name:"JavaScript",alias:["ecmascript","js","node"],extensions:["js","mjs","cjs"],load:()=>import("./index-BpFtavDh.js").then(e=>e.javascript())}),o.of({name:"Jinja",extensions:["j2","jinja","jinja2"],load:()=>import("./index-kHWDzZEv.js").then(e=>e.jinja())}),o.of({name:"JSON",alias:["json5"],extensions:["json","map"],load:()=>import("./index-vxKx70Pe.js").then(e=>e.json())}),o.of({name:"JSX",extensions:["jsx"],load:()=>import("./index-BpFtavDh.js").then(e=>e.javascript({jsx:!0}))}),o.of({name:"LESS",extensions:["less"],load:()=>import("./index-YYM2ZvZ6.js").then(e=>e.less())}),o.of({name:"Liquid",extensions:["liquid"],load:()=>import("./index-CB1wz24Q.js").then(e=>e.liquid())}),o.of({name:"MariaDB SQL",load:()=>zd("MariaSQL")}),o.of({name:"Markdown",extensions:["md","markdown","mkd"],load:()=>import("./index-C_OMDe9Q.js").then(e=>e.markdown())}),o.of({name:"MS SQL",load:()=>zd("MSSQL")}),o.of({name:"MySQL",load:()=>zd("MySQL")}),o.of({name:"PHP",extensions:["php","php3","php4","php5","php7","phtml"],load:()=>import("./index-BBCZJE-R.js").then(e=>e.php())}),o.of({name:"PLSQL",extensions:["pls"],load:()=>zd("PLSQL")}),o.of({name:"PostgreSQL",load:()=>zd("PostgreSQL")}),o.of({name:"Python",extensions:["BUILD","bzl","py","pyw"],filename:/^(BUCK|BUILD)$/,load:()=>import("./index-BNvG4PUn.js").then(e=>e.python())}),o.of({name:"Rust",extensions:["rs"],load:()=>import("./index-B46RgSF9.js").then(e=>e.rust())}),o.of({name:"Sass",extensions:["sass"],load:()=>import("./index-D9BPo-_o.js").then(e=>e.sass({indented:!0}))}),o.of({name:"SCSS",extensions:["scss"],load:()=>import("./index-D9BPo-_o.js").then(e=>e.sass())}),o.of({name:"SQL",extensions:["sql"],load:()=>zd("StandardSQL")}),o.of({name:"SQLite",load:()=>zd("SQLite")}),o.of({name:"TSX",extensions:["tsx"],load:()=>import("./index-BpFtavDh.js").then(e=>e.javascript({jsx:!0,typescript:!0}))}),o.of({name:"TypeScript",alias:["ts"],extensions:["ts","mts","cts"],load:()=>import("./index-BpFtavDh.js").then(e=>e.javascript({typescript:!0}))}),o.of({name:"WebAssembly",extensions:["wat","wast"],load:()=>import("./index-Bohl_WFx.js").then(e=>e.wast())}),o.of({name:"XML",alias:["rss","wsdl","xsd"],extensions:["xml","xsl","xsd","svg"],load:()=>import("./index-D5AIo8KT.js").then(e=>e.xml())}),o.of({name:"YAML",alias:["yml"],extensions:["yaml","yml"],load:()=>import("./index-D5f1dQka.js").then(e=>e.yaml())}),o.of({name:"APL",extensions:["dyalog","apl"],load:()=>import("./apl-CXdQSnD-.js").then(e=>Pd(e.apl))}),o.of({name:"PGP",alias:["asciiarmor"],extensions:["asc","pgp","sig"],load:()=>import("./asciiarmor-D5V0T9Cu.js").then(e=>Pd(e.asciiArmor))}),o.of({name:"ASN.1",extensions:["asn","asn1"],load:()=>import("./asn1-DWPaVWf6.js").then(e=>Pd(e.asn1({})))}),o.of({name:"Asterisk",filename:/^extensions\.conf$/i,load:()=>import("./asterisk-B46aRdXb.js").then(e=>Pd(e.asterisk))}),o.of({name:"Brainfuck",extensions:["b","bf"],load:()=>import("./brainfuck-CtZaYBKt.js").then(e=>Pd(e.brainfuck))}),o.of({name:"Cobol",extensions:["cob","cpy"],load:()=>import("./cobol-stawOqaz.js").then(e=>Pd(e.cobol))}),o.of({name:"C#",alias:["csharp","cs"],extensions:["cs"],load:()=>import("./clike-D9ynMLA9.js").then(e=>Pd(e.csharp))}),o.of({name:"Clojure",extensions:["clj","cljc","cljx"],load:()=>import("./clojure-DiuoqK-z.js").then(e=>Pd(e.clojure))}),o.of({name:"ClojureScript",extensions:["cljs"],load:()=>import("./clojure-DiuoqK-z.js").then(e=>Pd(e.clojure))}),o.of({name:"Closure Stylesheets (GSS)",extensions:["gss"],load:()=>import("./css-C4GSMmGA.js").then(e=>Pd(e.gss))}),o.of({name:"CMake",extensions:["cmake","cmake.in"],filename:/^CMakeLists\.txt$/,load:()=>import("./cmake-DXn5xaP-.js").then(e=>Pd(e.cmake))}),o.of({name:"CoffeeScript",alias:["coffee","coffee-script"],extensions:["coffee"],load:()=>import("./coffeescript-BTDxI-eT.js").then(e=>Pd(e.coffeeScript))}),o.of({name:"Common Lisp",alias:["lisp"],extensions:["cl","lisp","el"],load:()=>import("./commonlisp-vq6DHwts.js").then(e=>Pd(e.commonLisp))}),o.of({name:"Cypher",extensions:["cyp","cypher"],load:()=>import("./cypher-gJDei3ni.js").then(e=>Pd(e.cypher))}),o.of({name:"Cython",extensions:["pyx","pxd","pxi"],load:()=>import("./python-On6Xi21R.js").then(e=>Pd(e.cython))}),o.of({name:"Crystal",extensions:["cr"],load:()=>import("./crystal-CRzZ78HM.js").then(e=>Pd(e.crystal))}),o.of({name:"D",extensions:["d"],load:()=>import("./d-BShv7fp-.js").then(e=>Pd(e.d))}),o.of({name:"Dart",extensions:["dart"],load:()=>import("./clike-D9ynMLA9.js").then(e=>Pd(e.dart))}),o.of({name:"diff",extensions:["diff","patch"],load:()=>import("./diff-UJJ5BM9S.js").then(e=>Pd(e.diff))}),o.of({name:"Dockerfile",filename:/^Dockerfile$/,load:()=>import("./dockerfile-DVQ9Q8O9.js").then(e=>Pd(e.dockerFile))}),o.of({name:"DTD",extensions:["dtd"],load:()=>import("./dtd-DI9Herc-.js").then(e=>Pd(e.dtd))}),o.of({name:"Dylan",extensions:["dylan","dyl","intr"],load:()=>import("./dylan-DkEP81N9.js").then(e=>Pd(e.dylan))}),o.of({name:"EBNF",load:()=>import("./ebnf-B-Df8AvO.js").then(e=>Pd(e.ebnf))}),o.of({name:"ECL",extensions:["ecl"],load:()=>import("./ecl-DPFc0Uaf.js").then(e=>Pd(e.ecl))}),o.of({name:"edn",extensions:["edn"],load:()=>import("./clojure-DiuoqK-z.js").then(e=>Pd(e.clojure))}),o.of({name:"Eiffel",extensions:["e"],load:()=>import("./eiffel-DR5c0IrL.js").then(e=>Pd(e.eiffel))}),o.of({name:"Elm",extensions:["elm"],load:()=>import("./elm-DompmV0j.js").then(e=>Pd(e.elm))}),o.of({name:"Erlang",extensions:["erl"],load:()=>import("./erlang-BuqgqA5h.js").then(e=>Pd(e.erlang))}),o.of({name:"Esper",load:()=>import("./sql-ByLYq2fX.js").then(e=>Pd(e.esper))}),o.of({name:"Factor",extensions:["factor"],load:()=>import("./factor-Bk9_H-XT.js").then(e=>Pd(e.factor))}),o.of({name:"FCL",load:()=>import("./fcl-CVaBTCzQ.js").then(e=>Pd(e.fcl))}),o.of({name:"Forth",extensions:["forth","fth","4th"],load:()=>import("./forth-POgR1ypr.js").then(e=>Pd(e.forth))}),o.of({name:"Fortran",extensions:["f","for","f77","f90","f95"],load:()=>import("./fortran-DL7KluxX.js").then(e=>Pd(e.fortran))}),o.of({name:"F#",alias:["fsharp"],extensions:["fs"],load:()=>import("./mllike-3c2dg9RT.js").then(e=>Pd(e.fSharp))}),o.of({name:"Gas",extensions:["s"],load:()=>import("./gas-8mz5Q3qN.js").then(e=>Pd(e.gas))}),o.of({name:"Gherkin",extensions:["feature"],load:()=>import("./gherkin-B6X1vGSW.js").then(e=>Pd(e.gherkin))}),o.of({name:"Groovy",extensions:["groovy","gradle"],filename:/^Jenkinsfile$/,load:()=>import("./groovy-DnIzCrpZ.js").then(e=>Pd(e.groovy))}),o.of({name:"Haskell",extensions:["hs"],load:()=>import("./haskell-CLQs6EAM.js").then(e=>Pd(e.haskell))}),o.of({name:"Haxe",extensions:["hx"],load:()=>import("./haxe-D25e-2l-.js").then(e=>Pd(e.haxe))}),o.of({name:"HXML",extensions:["hxml"],load:()=>import("./haxe-D25e-2l-.js").then(e=>Pd(e.hxml))}),o.of({name:"HTTP",load:()=>import("./http-BKJkqRj4.js").then(e=>Pd(e.http))}),o.of({name:"IDL",extensions:["pro"],load:()=>import("./idl-pcmmZuaN.js").then(e=>Pd(e.idl))}),o.of({name:"JSON-LD",alias:["jsonld"],extensions:["jsonld"],load:()=>import("./javascript-BVaBnk3P.js").then(e=>Pd(e.jsonld))}),o.of({name:"Julia",extensions:["jl"],load:()=>import("./julia-DjdwvFuI.js").then(e=>Pd(e.julia))}),o.of({name:"Kotlin",extensions:["kt","kts"],load:()=>import("./clike-D9ynMLA9.js").then(e=>Pd(e.kotlin))}),o.of({name:"LiveScript",alias:["ls"],extensions:["ls"],load:()=>import("./livescript-HO6ttBFx.js").then(e=>Pd(e.liveScript))}),o.of({name:"Lua",extensions:["lua"],load:()=>import("./lua-BvgfYBhq.js").then(e=>Pd(e.lua))}),o.of({name:"mIRC",extensions:["mrc"],load:()=>import("./mirc-DkvFAiy5.js").then(e=>Pd(e.mirc))}),o.of({name:"Mathematica",extensions:["m","nb","wl","wls"],load:()=>import("./mathematica-IIbmv7SK.js").then(e=>Pd(e.mathematica))}),o.of({name:"Modelica",extensions:["mo"],load:()=>import("./modelica-DSrSSXCg.js").then(e=>Pd(e.modelica))}),o.of({name:"MUMPS",extensions:["mps"],load:()=>import("./mumps-zvxmGV4l.js").then(e=>Pd(e.mumps))}),o.of({name:"Mbox",extensions:["mbox"],load:()=>import("./mbox-z_N2Mo3d.js").then(e=>Pd(e.mbox))}),o.of({name:"Nginx",filename:/nginx.*\.conf$/i,load:()=>import("./nginx-B4hAVlXN.js").then(e=>Pd(e.nginx))}),o.of({name:"NSIS",extensions:["nsh","nsi"],load:()=>import("./nsis-BFvJq6Vq.js").then(e=>Pd(e.nsis))}),o.of({name:"NTriples",extensions:["nt","nq"],load:()=>import("./ntriples-BSwWqoLa.js").then(e=>Pd(e.ntriples))}),o.of({name:"Objective-C",alias:["objective-c","objc"],extensions:["m"],load:()=>import("./clike-D9ynMLA9.js").then(e=>Pd(e.objectiveC))}),o.of({name:"Objective-C++",alias:["objective-c++","objc++"],extensions:["mm"],load:()=>import("./clike-D9ynMLA9.js").then(e=>Pd(e.objectiveCpp))}),o.of({name:"OCaml",extensions:["ml","mli","mll","mly"],load:()=>import("./mllike-3c2dg9RT.js").then(e=>Pd(e.oCaml))}),o.of({name:"Octave",extensions:["m"],load:()=>import("./octave-C4hdQ5Hf.js").then(e=>Pd(e.octave))}),o.of({name:"Oz",extensions:["oz"],load:()=>import("./oz-qQq7irPq.js").then(e=>Pd(e.oz))}),o.of({name:"Pascal",extensions:["p","pas"],load:()=>import("./pascal-CafrKXZF.js").then(e=>Pd(e.pascal))}),o.of({name:"Perl",extensions:["pl","pm"],load:()=>import("./perl-tdMlh9QA.js").then(e=>Pd(e.perl))}),o.of({name:"Pig",extensions:["pig"],load:()=>import("./pig-CwGJVRC4.js").then(e=>Pd(e.pig))}),o.of({name:"PowerShell",extensions:["ps1","psd1","psm1"],load:()=>import("./powershell-D1ly3AHC.js").then(e=>Pd(e.powerShell))}),o.of({name:"Properties files",alias:["ini","properties"],extensions:["properties","ini","in"],load:()=>import("./properties-_nPj978X.js").then(e=>Pd(e.properties))}),o.of({name:"ProtoBuf",extensions:["proto"],load:()=>import("./protobuf-B4y9do6W.js").then(e=>Pd(e.protobuf))}),o.of({name:"Pug",alias:["jade"],extensions:["pug","jade"],load:()=>import("./pug-Dlfivyh-.js").then(e=>Pd(e.pug))}),o.of({name:"Puppet",extensions:["pp"],load:()=>import("./puppet-Bc-yJKzi.js").then(e=>Pd(e.puppet))}),o.of({name:"Q",extensions:["q"],load:()=>import("./q-mUfi2b_o.js").then(e=>Pd(e.q))}),o.of({name:"R",alias:["rscript"],extensions:["r","R"],load:()=>import("./r-BA4EbLKE.js").then(e=>Pd(e.r))}),o.of({name:"RPM Changes",load:()=>import("./rpm-DI_rRufH.js").then(e=>Pd(e.rpmChanges))}),o.of({name:"RPM Spec",extensions:["spec"],load:()=>import("./rpm-DI_rRufH.js").then(e=>Pd(e.rpmSpec))}),o.of({name:"Ruby",alias:["jruby","macruby","rake","rb","rbx"],extensions:["rb"],filename:/^(Gemfile|Rakefile)$/,load:()=>import("./ruby-D9chwFAN.js").then(e=>Pd(e.ruby))}),o.of({name:"SAS",extensions:["sas"],load:()=>import("./sas-Bqaci40L.js").then(e=>Pd(e.sas))}),o.of({name:"Scala",extensions:["scala"],load:()=>import("./clike-D9ynMLA9.js").then(e=>Pd(e.scala))}),o.of({name:"Scheme",extensions:["scm","ss"],load:()=>import("./scheme-qjP0V5Ag.js").then(e=>Pd(e.scheme))}),o.of({name:"Shell",alias:["bash","sh","zsh"],extensions:["sh","ksh","bash"],filename:/^PKGBUILD$/,load:()=>import("./shell-BLav31RL.js").then(e=>Pd(e.shell))}),o.of({name:"Sieve",extensions:["siv","sieve"],load:()=>import("./sieve-r025o_jW.js").then(e=>Pd(e.sieve))}),o.of({name:"Smalltalk",extensions:["st"],load:()=>import("./smalltalk-C7J3IyEP.js").then(e=>Pd(e.smalltalk))}),o.of({name:"Solr",load:()=>import("./solr-78MBEUkU.js").then(e=>Pd(e.solr))}),o.of({name:"SML",extensions:["sml","sig","fun","smackspec"],load:()=>import("./mllike-3c2dg9RT.js").then(e=>Pd(e.sml))}),o.of({name:"SPARQL",alias:["sparul"],extensions:["rq","sparql"],load:()=>import("./sparql-BRLJFz69.js").then(e=>Pd(e.sparql))}),o.of({name:"Spreadsheet",alias:["excel","formula"],load:()=>import("./spreadsheet-CGlWr0eM.js").then(e=>Pd(e.spreadsheet))}),o.of({name:"Squirrel",extensions:["nut"],load:()=>import("./clike-D9ynMLA9.js").then(e=>Pd(e.squirrel))}),o.of({name:"Stylus",extensions:["styl"],load:()=>import("./stylus-Bdo_Aemu.js").then(e=>Pd(e.stylus))}),o.of({name:"Swift",extensions:["swift"],load:()=>import("./swift-B_XXVlXX.js").then(e=>Pd(e.swift))}),o.of({name:"sTeX",load:()=>Promise.resolve().then(function(){return Hd}).then(e=>Pd(e.stex))}),o.of({name:"LaTeX",alias:["tex"],extensions:["text","ltx","tex"],load:()=>Promise.resolve().then(function(){return Hd}).then(e=>Pd(e.stex))}),o.of({name:"SystemVerilog",extensions:["v","sv","svh"],load:()=>import("./verilog-C8nH2N0M.js").then(e=>Pd(e.verilog))}),o.of({name:"Tcl",extensions:["tcl"],load:()=>import("./tcl-B2fODqDH.js").then(e=>Pd(e.tcl))}),o.of({name:"Textile",extensions:["textile"],load:()=>import("./textile-BuVhTOzU.js").then(e=>Pd(e.textile))}),o.of({name:"TiddlyWiki",load:()=>import("./tiddlywiki-BgR6AEZu.js").then(e=>Pd(e.tiddlyWiki))}),o.of({name:"Tiki wiki",load:()=>import("./tiki-CI-ztowC.js").then(e=>Pd(e.tiki))}),o.of({name:"TOML",extensions:["toml"],load:()=>import("./toml-BVJm5Fzd.js").then(e=>Pd(e.toml))}),o.of({name:"Troff",extensions:["1","2","3","4","5","6","7","8","9"],load:()=>import("./troff-Ce85hlLp.js").then(e=>Pd(e.troff))}),o.of({name:"TTCN",extensions:["ttcn","ttcn3","ttcnpp"],load:()=>import("./ttcn-BxnYHtq8.js").then(e=>Pd(e.ttcn))}),o.of({name:"TTCN_CFG",extensions:["cfg"],load:()=>import("./ttcn-cfg-CKJxb-l2.js").then(e=>Pd(e.ttcnCfg))}),o.of({name:"Turtle",extensions:["ttl"],load:()=>import("./turtle-BkSuIpt-.js").then(e=>Pd(e.turtle))}),o.of({name:"Web IDL",extensions:["webidl"],load:()=>import("./webidl-CGwyPRYs.js").then(e=>Pd(e.webIDL))}),o.of({name:"VB.NET",extensions:["vb"],load:()=>import("./vb-BHgjm0DN.js").then(e=>Pd(e.vb))}),o.of({name:"VBScript",extensions:["vbs"],load:()=>import("./vbscript-VzWlGt02.js").then(e=>Pd(e.vbScript))}),o.of({name:"Velocity",extensions:["vtl"],load:()=>import("./velocity-BdD_26Jv.js").then(e=>Pd(e.velocity))}),o.of({name:"Verilog",extensions:["v"],load:()=>import("./verilog-C8nH2N0M.js").then(e=>Pd(e.verilog))}),o.of({name:"VHDL",extensions:["vhd","vhdl"],load:()=>import("./vhdl-CWWH2SUo.js").then(e=>Pd(e.vhdl))}),o.of({name:"XQuery",extensions:["xy","xquery","xq","xqm","xqy"],load:()=>import("./xquery-CVDBqZPY.js").then(e=>Pd(e.xQuery))}),o.of({name:"Yacas",extensions:["ys"],load:()=>import("./yacas-I8QjZlxf.js").then(e=>Pd(e.yacas))}),o.of({name:"Z80",extensions:["z80"],load:()=>import("./z80-DMVFMNEx.js").then(e=>Pd(e.z80))}),o.of({name:"MscGen",extensions:["mscgen","mscin","msc"],load:()=>import("./mscgen-B2igx18G.js").then(e=>Pd(e.mscgen))}),o.of({name:"Xù",extensions:["xu"],load:()=>import("./mscgen-B2igx18G.js").then(e=>Pd(e.xu))}),o.of({name:"MsGenny",extensions:["msgenny"],load:()=>import("./mscgen-B2igx18G.js").then(e=>Pd(e.msgenny))}),o.of({name:"Vue",extensions:["vue"],load:()=>import("./index-CWCIYdOV.js").then(e=>e.vue())}),o.of({name:"Angular Template",load:()=>import("./index-CqbF_7wB.js").then(e=>e.angular())})];function Vd(e){function t(e,t){e.cmdState.push(t)}function n(e){return e.cmdState.length>0?e.cmdState[e.cmdState.length-1]:null}function r(e,t,n){return function(){this.name=e,this.bracketNo=0,this.style=t,this.styles=n,this.argument=null,this.styleIdentifier=function(){return this.styles[this.bracketNo-1]||null},this.openBracket=function(){return this.bracketNo++,"bracket"},this.closeBracket=function(){}}}var o={};function i(e,t){e.f=t}function s(e,r){var s;if(e.match(/^\\[a-zA-Z@\xc0-\u1fff\u2060-\uffff]+/)){var c=e.current().slice(1);return t(r,s=new(s=o.hasOwnProperty(c)?o[c]:o.DEFAULT)),i(r,l),s.style}if(e.match(/^\\[$&%#{}_]/))return"tag";if(e.match(/^\\[,;!\/\\]/))return"tag";if(e.match("\\["))return i(r,function(e,t){return a(e,t,"\\]")}),"keyword";if(e.match("\\("))return i(r,function(e,t){return a(e,t,"\\)")}),"keyword";if(e.match("$$"))return i(r,function(e,t){return a(e,t,"$$")}),"keyword";if(e.match("$"))return i(r,function(e,t){return a(e,t,"$")}),"keyword";var d=e.next();return"%"==d?(e.skipToEnd(),"comment"):"}"==d||"]"==d?(s=n(r))?(s.closeBracket(d),i(r,l),"bracket"):"error":"{"==d||"["==d?(t(r,s=new(s=o.DEFAULT)),"bracket"):/\d/.test(d)?(e.eatWhile(/[\w.%]/),"atom"):(e.eatWhile(/[\w\-_]/),s=function(e){for(var t=e.cmdState,n=t.length-1;n>=0;n--){var r=t[n];if("DEFAULT"!=r.name)return r}return{styleIdentifier:function(){return null}}}(r),"begin"==s.name&&(s.argument=e.current()),s.styleIdentifier())}function a(e,t,n){if(e.eatSpace())return null;if(n&&e.match(n))return i(t,s),"keyword";if(e.match(/^\\[a-zA-Z@]+/))return"tag";if(e.match(/^[a-zA-Z]+/))return"variableName.special";if(e.match(/^\\[$&%#{}_]/))return"tag";if(e.match(/^\\[,;!\/]/))return"tag";if(e.match(/^[\^_&]/))return"tag";if(e.match(/^[+\-<>|=,\/@!*:;'"`~#?]/))return null;if(e.match(/^(\d+\.\d*|\d*\.\d+|\d+)/))return"number";var r=e.next();return"{"==r||"}"==r||"["==r||"]"==r||"("==r||")"==r?"bracket":"%"==r?(e.skipToEnd(),"comment"):"error"}function l(e,t){var r=e.peek();return"{"==r||"["==r?(n(t).openBracket(r),e.eat(r),i(t,s),"bracket"):/[ \t\r]/.test(r)?(e.eat(r),null):(i(t,s),function(e){var t=e.cmdState.pop();t&&t.closeBracket()}(t),s(e,t))}return o.importmodule=r("importmodule","tag",["string","builtin"]),o.documentclass=r("documentclass","tag",["","atom"]),o.usepackage=r("usepackage","tag",["atom"]),o.begin=r("begin","tag",["atom"]),o.end=r("end","tag",["atom"]),o.label=r("label","tag",["atom"]),o.ref=r("ref","tag",["atom"]),o.eqref=r("eqref","tag",["atom"]),o.cite=r("cite","tag",["atom"]),o.bibitem=r("bibitem","tag",["atom"]),o.Bibitem=r("Bibitem","tag",["atom"]),o.RBibitem=r("RBibitem","tag",["atom"]),o.DEFAULT=function(){this.name="DEFAULT",this.style="tag",this.styleIdentifier=this.openBracket=this.closeBracket=function(){}},{name:"stex",startState:function(){return{cmdState:[],f:e?function(e,t){return a(e,t)}:s}},copyState:function(e){return{cmdState:e.cmdState.slice(),f:e.f}},token:function(e,t){return t.f(e,t)},blankLine:function(e){e.f=s,e.cmdState.length=0},languageData:{commentTokens:{line:"%"}}}}const $d=Vd(!1);Vd(!0);var Hd=Object.freeze({__proto__:null,stex:$d});function qd(e){return function(t,n){let{$from:r,$to:o}=t.selection,i=r.blockRange(o,t=>t.childCount>0&&t.firstChild.type==e);return!!i&&(!n||(r.node(i.depth-1).type==e?function(e,t,n,r){let o=e.tr,i=r.end,s=r.$to.end(r.depth);i<s&&(o.step(new pr(i-1,s,i,s,new Zt(Ft.from(n.create(null,r.parent.copy())),1,0),1,!0)),r=new pn(o.doc.resolve(r.$from.pos),o.doc.resolve(s),r.depth));const a=vr(r);if(null==a)return!1;o.lift(r,a);let l=o.doc.resolve(o.mapping.map(i,-1)-1);Cr(o.doc,l.pos)&&l.nodeBefore.type==l.nodeAfter.type&&o.join(l.pos);return t(o.scrollIntoView()),!0}(t,n,e,i):function(e,t,n){let r=e.tr,o=n.parent;for(let e=n.end,t=n.endIndex-1,i=n.startIndex;t>i;t--)e-=o.child(t).nodeSize,r.delete(e-1,e+1);let i=r.doc.resolve(n.start),s=i.nodeAfter;if(r.mapping.map(n.end)!=n.start+i.nodeAfter.nodeSize)return!1;let a=0==n.startIndex,l=n.endIndex==o.childCount,c=i.node(-1),d=i.index(-1);if(!c.canReplace(d+(a?0:1),d+1,s.content.append(l?Ft.empty:Ft.from(o))))return!1;let u=i.pos,h=u+s.nodeSize;return r.step(new pr(u-(a?1:0),h+(l?1:0),u+1,h-1,new Zt((a?Ft.empty:Ft.from(o.copy(Ft.empty))).append(l?Ft.empty:Ft.from(o.copy(Ft.empty))),a?0:1,l?0:1),a?0:1)),t(r.scrollIntoView()),!0}(t,n,i)))}}function Fd(e){return String(e||"").toUpperCase()}function Wd(){return function(e){const t=function(e){const t=new Map;if(!e||!e.type)throw new Error("mdast-util-definitions expected node");return G(e,"definition",function(e){const n=Fd(e.identifier);n&&!t.get(n)&&t.set(n,e)}),function(e){const n=Fd(e);return t.get(n)}}(e);G(e,function(e,n,r){if("definition"===e.type&&void 0!==r&&"number"==typeof n)return r.children.splice(n,1),[K,n];if("imageReference"===e.type||"linkReference"===e.type){const o=t(e.identifier);if(o&&r&&"number"==typeof n)return r.children[n]="imageReference"===e.type?{type:"image",url:o.url,title:o.title,alt:e.alt}:{type:"link",url:o.url,title:o.title,children:e.children},[K,n]}})}}function Ud(e){const t={...e};return t.position&&(t.position={start:{...t.position.start},end:{...t.position.end}}),delete t.children,t}var Gd=/^<br\s*\/?\s*>$/i;function Kd(e,t){if(!(t.childCount>=1&&"hardbreak"===t.lastChild?.type.name))return void e.next(t.content);const n=[];t.content.forEach((e,r,o)=>{o!==t.childCount-1&&n.push(e)}),e.next(Ft.fromArray(n))}function Jd(e,t){return Object.assign(e,{meta:{package:"@milkdown/preset-commonmark",...t}}),e}var Zd=Td("emphasis");Jd(Zd,{displayName:"Attr<emphasis>",group:"Emphasis"});var Yd=Ed("emphasis",e=>({attrs:{marker:{default:e.get(vc).emphasis||"*",validate:"string"}},parseDOM:[{tag:"i"},{tag:"em"},{style:"font-style",getAttrs:e=>"italic"===e}],toDOM:t=>["em",e.get(Zd.key)(t)],parseMarkdown:{match:e=>"emphasis"===e.type,runner:(e,t,n)=>{e.openMark(n,{marker:t.marker}),e.next(t.children),e.closeMark(n)}},toMarkdown:{match:e=>"emphasis"===e.type.name,runner:(e,t)=>{e.withMark(t,"emphasis",void 0,{marker:t.attrs.marker})}}}));Jd(Yd.mark,{displayName:"MarkSchema<emphasis>",group:"Emphasis"}),Jd(Yd.ctx,{displayName:"MarkSchemaCtx<emphasis>",group:"Emphasis"});var Xd=yd("ToggleEmphasis",e=>()=>Eo(Yd.type(e)));Jd(Xd,{displayName:"Command<toggleEmphasisCommand>",group:"Emphasis"});var Qd=wd(e=>ci(/(?:^|[^*])\*([^*]+)\*$/,Yd.type(e),{getAttr:()=>({marker:"*"}),updateCaptured:({fullMatch:e,start:t})=>e.startsWith("*")?{}:{fullMatch:e.slice(1),start:t+1}}));Jd(Qd,{displayName:"InputRule<emphasis>|Star",group:"Emphasis"});var eu=wd(e=>ci(/\b_(?![_\s])(.*?[^_\s])_$/,Yd.type(e),{getAttr:()=>({marker:"_"}),updateCaptured:({fullMatch:e,start:t})=>e.startsWith("_")?{}:{fullMatch:e.slice(1),start:t+1}}));Jd(eu,{displayName:"InputRule<emphasis>|Underscore",group:"Emphasis"});var tu=Od("emphasisKeymap",{ToggleEmphasis:{shortcuts:"Mod-i",command:e=>{const t=e.get(Ac);return()=>t.call(Xd.key)}}});Jd(tu.ctx,{displayName:"KeymapCtx<emphasis>",group:"Emphasis"}),Jd(tu.shortcuts,{displayName:"Keymap<emphasis>",group:"Emphasis"});var nu=Td("strong");Jd(nu,{displayName:"Attr<strong>",group:"Strong"});var ru=Ed("strong",e=>({attrs:{marker:{default:e.get(vc).strong||"*",validate:"string"}},parseDOM:[{tag:"b",getAttrs:e=>"normal"!=e.style.fontWeight&&null},{tag:"strong"},{style:"font-style",getAttrs:e=>"bold"===e},{style:"font-weight=400",clearMark:e=>"strong"==e.type.name},{style:"font-weight",getAttrs:e=>/^(bold(er)?|[5-9]\d{2,})$/.test(e)&&null}],toDOM:t=>["strong",e.get(nu.key)(t)],parseMarkdown:{match:e=>"strong"===e.type,runner:(e,t,n)=>{e.openMark(n,{marker:t.marker}),e.next(t.children),e.closeMark(n)}},toMarkdown:{match:e=>"strong"===e.type.name,runner:(e,t)=>{e.withMark(t,"strong",void 0,{marker:t.attrs.marker})}}}));Jd(ru.mark,{displayName:"MarkSchema<strong>",group:"Strong"}),Jd(ru.ctx,{displayName:"MarkSchemaCtx<strong>",group:"Strong"});var ou=yd("ToggleStrong",e=>()=>Eo(ru.type(e)));Jd(ou,{displayName:"Command<toggleStrongCommand>",group:"Strong"});var iu=wd(e=>ci(/(?<![\w:/])(?:\*\*|__)([^*_]+?)(?:\*\*|__)(?![\w/])$/,ru.type(e),{getAttr:e=>({marker:e[0].startsWith("*")?"*":"_"})}));Jd(iu,{displayName:"InputRule<strong>",group:"Strong"});var su=Od("strongKeymap",{ToggleBold:{shortcuts:["Mod-b"],command:e=>{const t=e.get(Ac);return()=>t.call(ou.key)}}});Jd(su.ctx,{displayName:"KeymapCtx<strong>",group:"Strong"}),Jd(su.shortcuts,{displayName:"Keymap<strong>",group:"Strong"});var au=Td("inlineCode");Jd(au,{displayName:"Attr<inlineCode>",group:"InlineCode"});var lu=Ed("inlineCode",e=>({priority:100,code:!0,inclusive:!1,parseDOM:[{tag:"code"}],toDOM:t=>["code",e.get(au.key)(t)],parseMarkdown:{match:e=>"inlineCode"===e.type,runner:(e,t,n)=>{e.openMark(n),e.addText(t.value),e.closeMark(n)}},toMarkdown:{match:e=>"inlineCode"===e.type.name,runner:(e,t,n)=>(e.withMark(t,"inlineCode",n.text||""),!0)}}));Jd(lu.mark,{displayName:"MarkSchema<inlineCode>",group:"InlineCode"}),Jd(lu.ctx,{displayName:"MarkSchemaCtx<inlineCode>",group:"InlineCode"});var cu=yd("ToggleInlineCode",e=>()=>(t,n)=>{const{selection:r,tr:o}=t;if(r.empty)return!1;const{from:i,to:s}=r;return t.doc.rangeHasMark(i,s,lu.type(e))?(n?.(o.removeMark(i,s,lu.type(e))),!0):(Object.keys(t.schema.marks).filter(e=>e!==lu.type.name).map(e=>t.schema.marks[e]).forEach(e=>{o.removeMark(i,s,e)}),n?.(o.addMark(i,s,lu.type(e).create())),!0)});Jd(cu,{displayName:"Command<toggleInlineCodeCommand>",group:"InlineCode"});var du=wd(e=>ci(/(?:`)([^`]+)(?:`)$/,lu.type(e)));Jd(du,{displayName:"InputRule<inlineCodeInputRule>",group:"InlineCode"});var uu=Od("inlineCodeKeymap",{ToggleInlineCode:{shortcuts:"Mod-e",command:e=>{const t=e.get(Ac);return()=>t.call(cu.key)}}});Jd(uu.ctx,{displayName:"KeymapCtx<inlineCode>",group:"InlineCode"}),Jd(uu.shortcuts,{displayName:"Keymap<inlineCode>",group:"InlineCode"});var hu=new Set(["http:","https:","mailto:","tel:","ftp:"]);function pu(e){return e<=32||e>=127&&e<=160||e>=8203&&e<=8205||8232===e||8233===e||65279===e}function fu(e){if("string"!=typeof e)return"";const t=e.trim();if(!t)return"";const n=function(e){let t="";for(const n of e)pu(n.codePointAt(0)??0)||(t+=n);return t}(t),r=/^([a-z][a-z0-9+.-]*):/i.exec(n)?.[1];return r?hu.has(`${r.toLowerCase()}:`)?t:"":t}var mu=Td("link");Jd(mu,{displayName:"Attr<link>",group:"Link"});var gu=Ed("link",e=>({attrs:{href:{validate:"string"},title:{default:null,validate:"string|null"}},parseDOM:[{tag:"a[href]",getAttrs:e=>{if(!(e instanceof HTMLElement))throw St(e);return{href:e.getAttribute("href"),title:e.getAttribute("title")}}}],toDOM:t=>["a",{...e.get(mu.key)(t),...t.attrs,href:fu(t.attrs.href)}],parseMarkdown:{match:e=>"link"===e.type,runner:(e,t,n)=>{const r=t.url,o=t.title;e.openMark(n,{href:r,title:o}),e.next(t.children),e.closeMark(n)}},toMarkdown:{match:e=>"link"===e.type.name,runner:(e,t)=>{e.withMark(t,"link",void 0,{title:t.attrs.title,url:t.attrs.href})}}}));Jd(gu.mark,{displayName:"MarkSchema<link>",group:"Link"});var vu=yd("ToggleLink",e=>(t={})=>Eo(gu.type(e),t));Jd(vu,{displayName:"Command<toggleLinkCommand>",group:"Link"});var yu=yd("UpdateLink",e=>(t={})=>(n,r)=>{if(!r)return!1;let o,i=-1;const{selection:s}=n,{from:a,to:l}=s;if(n.doc.nodesBetween(a,a===l?l+1:l,(t,n)=>{if(gu.type(e).isInSet(t.marks))return o=t,i=n,!1}),!o)return!1;const c=o.marks.find(({type:t})=>t===gu.type(e));if(!c)return!1;const d=i,u=i+o.nodeSize,{tr:h}=n,p=gu.type(e).create({...c.attrs,...t});return!!p&&(r(h.removeMark(d,u,c).addMark(d,u,p).setSelection(new Fr(h.selection.$anchor)).scrollIntoView()),!0)});Jd(yu,{displayName:"Command<updateLinkCommand>",group:"Link"});var wu=xd("doc",()=>({content:"block+",parseMarkdown:{match:({type:e})=>"root"===e,runner:(e,t,n)=>{e.injectRoot(t,n)}},toMarkdown:{match:e=>"doc"===e.type.name,runner:(e,t)=>{e.openNode("root");const n=t.childCount>0?t.child(t.childCount-1):null,r="paragraph"===n?.type.name&&0===n.content.size?t.content.cut(0,t.content.size-n.nodeSize):t.content;e.next(r)}}}));Jd(wu,{displayName:"NodeSchema<doc>",group:"Doc"});var bu=Object.freeze(["root","blockquote","listItem","footnoteDefinition"]),xu=new Set(["paragraph","heading","tableCell","link","linkReference","emphasis","strong","delete","footnote"]),ku=Md(bu,"blockContainerTypes");Jd(ku,{displayName:"Ctx<blockContainerTypes>",group:"Remark"});var Cu=new Set;function Su(e){const t=e.isInjected(ku.key)?e.get(ku.key):bu,n=new Set;for(const e of t)xu.has(e)?Cu.has(e)||(Cu.add(e),console.warn(`[milkdown/preset-commonmark] "${e}" holds phrasing content and cannot be a block container; it is ignored in blockContainerTypes.`)):n.add(e);return n}var Mu=new Set(["paragraph","tableCell"]);function Nu(e,t){return J(e,e=>{return"html"===e.type&&("string"==typeof(t=e.value)&&Gd.test(t.trim()));var t},(e,n)=>{const r=n[n.length-1];if(r)if(Mu.has(r.type))1===r.children.length&&(r.children=[]);else if(t.has(r.type)){const t=e;return t.children=[],delete t.value,t.type="paragraph",K}})}var Eu=Dd("remark-preserve-empty-line",e=>()=>t=>Nu(t,Su(e)));Jd(Eu.plugin,{displayName:"Remark<remarkPreserveEmptyLine>",group:"Remark"}),Jd(Eu.options,{displayName:"RemarkConfig<remarkPreserveEmptyLine>",group:"Remark"});var Ou=Ad("paragraph");Jd(Ou,{displayName:"Attr<paragraph>",group:"Paragraph"});var Au=Nd("paragraph",e=>({content:"inline*",group:"block",parseDOM:[{tag:"p"}],toDOM:t=>["p",e.get(Ou.key)(t),0],parseMarkdown:{match:e=>"paragraph"===e.type,runner:(e,t,n)=>{e.openNode(n),t.children?e.next(t.children):e.addText(t.value||""),e.closeNode()}},toMarkdown:{match:e=>"paragraph"===e.type.name,runner:(t,n)=>{t.openNode("paragraph"),n.content&&0!==n.content.size||!function(e){return e.isInjected(Eu.options.key)}(e)?Kd(t,n):t.addNode("html",void 0,"<br />"),t.closeNode()}}}));Jd(Au.node,{displayName:"NodeSchema<paragraph>",group:"Paragraph"}),Jd(Au.ctx,{displayName:"NodeSchemaCtx<paragraph>",group:"Paragraph"});var Tu=yd("TurnIntoText",e=>()=>No(Au.type(e)));Jd(Tu,{displayName:"Command<turnIntoTextCommand>",group:"Paragraph"});var Du=Od("paragraphKeymap",{TurnIntoText:{shortcuts:"Mod-Alt-0",command:e=>{const t=e.get(Ac);return()=>t.call(Tu.key)}}});Jd(Du.ctx,{displayName:"KeymapCtx<paragraph>",group:"Paragraph"}),Jd(Du.shortcuts,{displayName:"Keymap<paragraph>",group:"Paragraph"});var Iu=Array(6).fill(0).map((e,t)=>t+1);var _u=Md(function(e){return e.textContent.toLowerCase().trim().replace(/\s+/g,"-")},"headingIdGenerator");Jd(_u,{displayName:"Ctx<HeadingIdGenerator>",group:"Heading"});var Ru=Ad("heading");Jd(Ru,{displayName:"Attr<heading>",group:"Heading"});var Lu=Nd("heading",e=>{const t=e.get(_u.key);return{content:"inline*",group:"block",defining:!0,attrs:{id:{default:"",validate:"string"},level:{default:1,validate:"number"}},parseDOM:Iu.map(e=>({tag:`h${e}`,getAttrs:t=>{if(!(t instanceof HTMLElement))throw St(t);return{level:e,id:t.id}}})),toDOM:n=>[`h${n.attrs.level}`,{...e.get(Ru.key)(n),id:n.attrs.id||t(n)},0],parseMarkdown:{match:({type:e})=>"heading"===e,runner:(e,t,n)=>{const r=t.depth;e.openNode(n,{level:r}),e.next(t.children),e.closeNode()}},toMarkdown:{match:e=>"heading"===e.type.name,runner:(e,t)=>{e.openNode("heading",void 0,{depth:t.attrs.level}),Kd(e,t),e.closeNode()}}}});Jd(Lu.node,{displayName:"NodeSchema<heading>",group:"Heading"}),Jd(Lu.ctx,{displayName:"NodeSchemaCtx<heading>",group:"Heading"});var Bu=wd(e=>Po(/^(?<hashes>#+)\s$/,Lu.type(e),t=>{const n=t.groups?.hashes?.length||0,{$from:r}=e.get(ac).state.selection,o=r.node();if("heading"===o.type.name){let e=Number(o.attrs.level)+Number(n);return e>6&&(e=6),{level:e}}return{level:n}}));Jd(Bu,{displayName:"InputRule<wrapInHeadingInputRule>",group:"Heading"});var Pu=yd("WrapInHeading",e=>t=>(t??=1,t<1?No(Au.type(e)):No(Lu.type(e),{level:t})));Jd(Pu,{displayName:"Command<wrapInHeadingCommand>",group:"Heading"});var zu=yd("DowngradeHeading",e=>()=>(t,n,r)=>{const{$from:o}=t.selection,i=o.node();if(i.type!==Lu.type(e)||!t.selection.empty||0!==o.parentOffset)return!1;const s=i.attrs.level-1;return s?(n?.(t.tr.setNodeMarkup(t.selection.$from.before(),void 0,{...i.attrs,level:s})),!0):No(Au.type(e))(t,n)});Jd(zu,{displayName:"Command<downgradeHeadingCommand>",group:"Heading"});var ju=Od("headingKeymap",{TurnIntoH1:{shortcuts:"Mod-Alt-1",command:e=>{const t=e.get(Ac);return()=>t.call(Pu.key,1)}},TurnIntoH2:{shortcuts:"Mod-Alt-2",command:e=>{const t=e.get(Ac);return()=>t.call(Pu.key,2)}},TurnIntoH3:{shortcuts:"Mod-Alt-3",command:e=>{const t=e.get(Ac);return()=>t.call(Pu.key,3)}},TurnIntoH4:{shortcuts:"Mod-Alt-4",command:e=>{const t=e.get(Ac);return()=>t.call(Pu.key,4)}},TurnIntoH5:{shortcuts:"Mod-Alt-5",command:e=>{const t=e.get(Ac);return()=>t.call(Pu.key,5)}},TurnIntoH6:{shortcuts:"Mod-Alt-6",command:e=>{const t=e.get(Ac);return()=>t.call(Pu.key,6)}},DowngradeHeading:{shortcuts:["Delete","Backspace"],command:e=>{const t=e.get(Ac);return()=>t.call(zu.key)}}});Jd(ju.ctx,{displayName:"KeymapCtx<heading>",group:"Heading"}),Jd(ju.shortcuts,{displayName:"Keymap<heading>",group:"Heading"});var Vu=Ad("blockquote");Jd(Vu,{displayName:"Attr<blockquote>",group:"Blockquote"});var $u=Nd("blockquote",e=>({content:"block+",group:"block",defining:!0,parseDOM:[{tag:"blockquote"}],toDOM:t=>["blockquote",e.get(Vu.key)(t),0],parseMarkdown:{match:({type:e})=>"blockquote"===e,runner:(e,t,n)=>{e.openNode(n).next(t.children).closeNode()}},toMarkdown:{match:e=>"blockquote"===e.type.name,runner:(e,t)=>{e.openNode("blockquote").next(t.content).closeNode()}}}));Jd($u.node,{displayName:"NodeSchema<blockquote>",group:"Blockquote"}),Jd($u.ctx,{displayName:"NodeSchemaCtx<blockquote>",group:"Blockquote"});var Hu=wd(e=>Bo(/^\s*>\s$/,$u.type(e)));Jd(Hu,{displayName:"InputRule<wrapInBlockquoteInputRule>",group:"Blockquote"});var qu=yd("WrapInBlockquote",e=>()=>Mo($u.type(e)));Jd(qu,{displayName:"Command<wrapInBlockquoteCommand>",group:"Blockquote"});var Fu=Od("blockquoteKeymap",{WrapInBlockquote:{shortcuts:"Mod-Shift-b",command:e=>{const t=e.get(Ac);return()=>t.call(qu.key)}}});Jd(Fu.ctx,{displayName:"KeymapCtx<blockquote>",group:"Blockquote"}),Jd(Fu.shortcuts,{displayName:"Keymap<blockquote>",group:"Blockquote"});var Wu=Ad("codeBlock",()=>({pre:{},code:{}}));Jd(Wu,{displayName:"Attr<codeBlock>",group:"CodeBlock"});var Uu=Nd("code_block",e=>({content:"text*",group:"block",marks:"",defining:!0,code:!0,attrs:{language:{default:"",validate:"string"}},parseDOM:[{tag:"pre",preserveWhitespace:"full",getAttrs:e=>{if(!(e instanceof HTMLElement))throw St(e);return{language:e.dataset.language}}}],toDOM:t=>{const n=e.get(Wu.key)(t),r=t.attrs.language,o=r&&r.length>0?{"data-language":r}:void 0;return["pre",{...n.pre,...o},["code",n.code,0]]},parseMarkdown:{match:({type:e})=>"code"===e,runner:(e,t,n)=>{const r=t.lang??"",o=t.value;e.openNode(n,{language:r}),o&&e.addText(o),e.closeNode()}},toMarkdown:{match:e=>"code_block"===e.type.name,runner:(e,t)=>{e.addNode("code",void 0,t.content.firstChild?.text||"",{lang:t.attrs.language})}}}));Jd(Uu.node,{displayName:"NodeSchema<codeBlock>",group:"CodeBlock"}),Jd(Uu.ctx,{displayName:"NodeSchemaCtx<codeBlock>",group:"CodeBlock"});var Gu=wd(e=>Po(/^```(?<language>[a-z]*)?[\s\n]$/,Uu.type(e),e=>({language:e.groups?.language??""})));Jd(Gu,{displayName:"InputRule<createCodeBlockInputRule>",group:"CodeBlock"});var Ku=yd("CreateCodeBlock",e=>(t="")=>No(Uu.type(e),{language:t}));Jd(Ku,{displayName:"Command<createCodeBlockCommand>",group:"CodeBlock"}),Jd(yd("UpdateCodeBlockLanguage",()=>({pos:e,language:t}={pos:-1,language:""})=>(n,r)=>e>=0&&(r?.(n.tr.setNodeAttribute(e,"language",t)),!0)),{displayName:"Command<updateCodeBlockLanguageCommand>",group:"CodeBlock"});var Ju=Od("codeBlockKeymap",{CreateCodeBlock:{shortcuts:"Mod-Alt-c",command:e=>{const t=e.get(Ac);return()=>t.call(Ku.key)}}});Jd(Ju.ctx,{displayName:"KeymapCtx<codeBlock>",group:"CodeBlock"}),Jd(Ju.shortcuts,{displayName:"Keymap<codeBlock>",group:"CodeBlock"});var Zu=Ad("image");Jd(Zu,{displayName:"Attr<image>",group:"Image"});var Yu=Nd("image",e=>({inline:!0,group:"inline",selectable:!0,draggable:!0,marks:"",atom:!0,defining:!0,isolating:!0,attrs:{src:{default:"",validate:"string"},alt:{default:"",validate:"string"},title:{default:"",validate:"string"}},parseDOM:[{tag:"img[src]",getAttrs:e=>{if(!(e instanceof HTMLElement))throw St(e);return{src:e.getAttribute("src")||"",alt:e.getAttribute("alt")||"",title:e.getAttribute("title")||e.getAttribute("alt")||""}}}],toDOM:t=>["img",{...e.get(Zu.key)(t),...t.attrs}],parseMarkdown:{match:({type:e})=>"image"===e,runner:(e,t,n)=>{const r=t.url,o=t.alt??"",i=t.title??"";e.addNode(n,{src:r,alt:o,title:i})}},toMarkdown:{match:e=>"image"===e.type.name,runner:(e,t)=>{e.addNode("image",void 0,void 0,{title:t.attrs.title,url:t.attrs.src,alt:t.attrs.alt})}}}));Jd(Yu.node,{displayName:"NodeSchema<image>",group:"Image"}),Jd(Yu.ctx,{displayName:"NodeSchemaCtx<image>",group:"Image"});var Xu=yd("InsertImage",e=>(t={})=>(n,r)=>{if(!r)return!0;const{src:o="",alt:i="",title:s=""}=t,a=Yu.type(e).create({src:o,alt:i,title:s});return!a||(r(n.tr.replaceSelectionWith(a).scrollIntoView()),!0)});Jd(Xu,{displayName:"Command<insertImageCommand>",group:"Image"});var Qu=yd("UpdateImage",e=>(t={})=>(n,r)=>{const o=Si(n.selection,Yu.type(e));if(!o)return!1;const{node:i,pos:s}=o,a={...i.attrs},{src:l,alt:c,title:d}=t;return void 0!==l&&(a.src=l),void 0!==c&&(a.alt=c),void 0!==d&&(a.title=d),r?.(n.tr.setNodeMarkup(s,void 0,a).scrollIntoView()),!0});Jd(Qu,{displayName:"Command<updateImageCommand>",group:"Image"}),Jd(wd(e=>new Ro(/!\[(?<alt>.*?)]\((?<filename>.*?)\s*(?="|\))"?(?<title>[^"]+)?"?\)/,(t,n,r,o)=>{const[i,s,a="",l]=n;return i?t.tr.replaceWith(r,o,Yu.type(e).create({src:a,alt:s,title:l})):null})),{displayName:"InputRule<insertImageInputRule>",group:"Image"});var eh=Ad("hardbreak",e=>({"data-type":"hardbreak","data-is-inline":e.attrs.isInline}));Jd(eh,{displayName:"Attr<hardbreak>",group:"Hardbreak"});var th=Nd("hardbreak",e=>({inline:!0,group:"inline",attrs:{isInline:{default:!1,validate:"boolean"}},selectable:!1,parseDOM:[{tag:"br"},{tag:'span[data-type="hardbreak"]',getAttrs:()=>({isInline:!0})}],toDOM:t=>t.attrs.isInline?["span",e.get(eh.key)(t)," "]:["br",e.get(eh.key)(t)],parseMarkdown:{match:({type:e})=>"break"===e,runner:(e,t,n)=>{e.addNode(n,{isInline:Boolean(t.data?.isInline)})}},leafText:()=>"\n",toMarkdown:{match:e=>"hardbreak"===e.type.name,runner:(e,t)=>{t.attrs.isInline?e.addNode("text",void 0,"\n"):e.addNode("break")}}}));Jd(th.node,{displayName:"NodeSchema<hardbreak>",group:"Hardbreak"}),Jd(th.ctx,{displayName:"NodeSchemaCtx<hardbreak>",group:"Hardbreak"});var nh=yd("InsertHardbreak",e=>()=>(t,n)=>{const{selection:r,tr:o}=t;if(!(r instanceof Fr))return!1;if(r.empty){const e=r.$from.node();if(e.childCount>0&&"hardbreak"===e.lastChild?.type.name)return n?.(o.replaceRangeWith(r.to-1,r.to,t.schema.node("paragraph")).setSelection(Vr.near(o.doc.resolve(r.to))).scrollIntoView()),!0}return n?.(o.setMeta("hardbreak",!0).replaceSelectionWith(th.type(e).create(),!1).scrollIntoView()),!0});Jd(nh,{displayName:"Command<insertHardbreakCommand>",group:"Hardbreak"});var rh=Od("hardbreakKeymap",{InsertHardbreak:{shortcuts:"Shift-Enter",command:e=>{const t=e.get(Ac);return()=>t.call(nh.key)}}});Jd(rh.ctx,{displayName:"KeymapCtx<hardbreak>",group:"Hardbreak"}),Jd(rh.shortcuts,{displayName:"Keymap<hardbreak>",group:"Hardbreak"});var oh=Ad("hr");Jd(oh,{displayName:"Attr<hr>",group:"Hr"});var ih=Nd("hr",e=>({group:"block",parseDOM:[{tag:"hr"}],toDOM:t=>["hr",e.get(oh.key)(t)],parseMarkdown:{match:({type:e})=>"thematicBreak"===e,runner:(e,t,n)=>{e.addNode(n)}},toMarkdown:{match:e=>"hr"===e.type.name,runner:e=>{e.addNode("thematicBreak")}}}));Jd(ih.node,{displayName:"NodeSchema<hr>",group:"Hr"}),Jd(ih.ctx,{displayName:"NodeSchemaCtx<hr>",group:"Hr"});var sh=wd(e=>new Ro(/^(?:---|___\s|\*\*\*\s)$/,(t,n,r,o)=>{const{tr:i}=t;return n[0]&&i.replaceWith(r-1,o,ih.type(e).create()),i}));Jd(sh,{displayName:"InputRule<insertHrInputRule>",group:"Hr"});var ah=yd("InsertHr",e=>()=>(t,n)=>{if(!n)return!0;const r=Au.node.type(e).create(),{tr:o,selection:i}=t,{from:s}=i,a=ih.type(e).create();if(!a)return!0;const l=o.replaceSelectionWith(a).insert(s,r),c=Vr.findFrom(l.doc.resolve(s),1,!0);return!c||(n(l.setSelection(c).scrollIntoView()),!0)});Jd(ah,{displayName:"Command<insertHrCommand>",group:"Hr"});var lh=Ad("bulletList");Jd(lh,{displayName:"Attr<bulletList>",group:"BulletList"});var ch=Nd("bullet_list",e=>({content:"listItem+",group:"block",attrs:{spread:{default:!1,validate:"boolean"}},parseDOM:[{tag:"ul",getAttrs:e=>{if(!(e instanceof HTMLElement))throw St(e);return{spread:"true"===e.dataset.spread}}}],toDOM:t=>["ul",{...e.get(lh.key)(t),"data-spread":t.attrs.spread},0],parseMarkdown:{match:({type:e,ordered:t})=>"list"===e&&!t,runner:(e,t,n)=>{const r=t.spread??!1;e.openNode(n,{spread:r}).next(t.children).closeNode()}},toMarkdown:{match:e=>"bullet_list"===e.type.name,runner:(e,t)=>{e.openNode("list",void 0,{ordered:!1,spread:t.attrs.spread}).next(t.content).closeNode()}}}));Jd(ch.node,{displayName:"NodeSchema<bulletList>",group:"BulletList"}),Jd(ch.ctx,{displayName:"NodeSchemaCtx<bulletList>",group:"BulletList"});var dh=wd(e=>Bo(/^\s*([-+*])\s$/,ch.type(e)));Jd(dh,{displayName:"InputRule<wrapInBulletListInputRule>",group:"BulletList"});var uh=yd("WrapInBulletList",e=>()=>Mo(ch.type(e)));Jd(uh,{displayName:"Command<wrapInBulletListCommand>",group:"BulletList"});var hh=Od("bulletListKeymap",{WrapInBulletList:{shortcuts:"Mod-Alt-8",command:e=>{const t=e.get(Ac);return()=>t.call(uh.key)}}});Jd(hh.ctx,{displayName:"KeymapCtx<bulletListKeymap>",group:"BulletList"}),Jd(hh.shortcuts,{displayName:"Keymap<bulletListKeymap>",group:"BulletList"});var ph=Ad("orderedList");Jd(ph,{displayName:"Attr<orderedList>",group:"OrderedList"});var fh=Nd("ordered_list",e=>({content:"listItem+",group:"block",attrs:{order:{default:1,validate:"number"},spread:{default:!1,validate:"boolean"}},parseDOM:[{tag:"ol",getAttrs:e=>{if(!(e instanceof HTMLElement))throw St(e);return{spread:"true"===e.dataset.spread,order:e.hasAttribute("start")?Number(e.getAttribute("start")):1}}}],toDOM:t=>["ol",{...e.get(ph.key)(t),...1===t.attrs.order?{}:{start:t.attrs.order},"data-spread":t.attrs.spread},0],parseMarkdown:{match:({type:e,ordered:t})=>"list"===e&&!!t,runner:(e,t,n)=>{const r=t.spread??!0;e.openNode(n,{spread:r,order:t.start??1}).next(t.children).closeNode()}},toMarkdown:{match:e=>"ordered_list"===e.type.name,runner:(e,t)=>{e.openNode("list",void 0,{ordered:!0,start:t.attrs.order??1,spread:t.attrs.spread}),e.next(t.content),e.closeNode()}}}));Jd(fh.node,{displayName:"NodeSchema<orderedList>",group:"OrderedList"}),Jd(fh.ctx,{displayName:"NodeSchemaCtx<orderedList>",group:"OrderedList"});var mh=wd(e=>Bo(/^\s*(\d+)\.\s$/,fh.type(e),e=>({order:Number(e[1])}),(e,t)=>t.childCount+t.attrs.order===Number(e[1])));Jd(mh,{displayName:"InputRule<wrapInOrderedListInputRule>",group:"OrderedList"});var gh=yd("WrapInOrderedList",e=>()=>Mo(fh.type(e)));Jd(gh,{displayName:"Command<wrapInOrderedListCommand>",group:"OrderedList"});var vh=Od("orderedListKeymap",{WrapInOrderedList:{shortcuts:"Mod-Alt-7",command:e=>{const t=e.get(Ac);return()=>t.call(gh.key)}}});Jd(vh.ctx,{displayName:"KeymapCtx<orderedList>",group:"OrderedList"}),Jd(vh.shortcuts,{displayName:"Keymap<orderedList>",group:"OrderedList"});var yh=Ad("listItem");Jd(yh,{displayName:"Attr<listItem>",group:"ListItem"});var wh=Nd("list_item",e=>({group:"listItem",content:"paragraph block*",attrs:{label:{default:"•",validate:"string"},listType:{default:"bullet",validate:"string"},spread:{default:!0,validate:"boolean"}},defining:!0,parseDOM:[{tag:"li",getAttrs:e=>{if(!(e instanceof HTMLElement))throw St(e);return{label:e.dataset.label,listType:e.dataset.listType,spread:"true"===e.dataset.spread}}}],toDOM:t=>["li",{...e.get(yh.key)(t),"data-label":t.attrs.label,"data-list-type":t.attrs.listType,"data-spread":t.attrs.spread},0],parseMarkdown:{match:({type:e})=>"listItem"===e,runner:(e,t,n)=>{const r=null!=t.label?`${t.label}.`:"•",o=null!=t.label?"ordered":"bullet",i=t.spread??!0;e.openNode(n,{label:r,listType:o,spread:i}),e.next(t.children),e.closeNode()}},toMarkdown:{match:e=>"list_item"===e.type.name,runner:(e,t)=>{e.openNode("listItem",void 0,{spread:t.attrs.spread}),e.next(t.content),e.closeNode()}}}));Jd(wh.node,{displayName:"NodeSchema<listItem>",group:"ListItem"}),Jd(wh.ctx,{displayName:"NodeSchemaCtx<listItem>",group:"ListItem"});var bh=yd("SinkListItem",e=>()=>{return t=wh.type(e),function(e,n){let{$from:r,$to:o}=e.selection,i=r.blockRange(o,e=>e.childCount>0&&e.firstChild.type==t);if(!i)return!1;let s=i.startIndex;if(0==s)return!1;let a=i.parent,l=a.child(s-1);if(l.type!=t)return!1;if(n){let r=l.lastChild&&l.lastChild.type==a.type,o=Ft.from(r?t.create():null),s=new Zt(Ft.from(t.create(null,Ft.from(a.type.create(null,o)))),r?3:1,0),c=i.start,d=i.end;n(e.tr.step(new pr(c-(r?3:1),d,c,d,s,1,!0)).scrollIntoView())}return!0};var t});Jd(bh,{displayName:"Command<sinkListItemCommand>",group:"ListItem"});var xh=yd("LiftListItem",e=>()=>qd(wh.type(e)));Jd(xh,{displayName:"Command<liftListItemCommand>",group:"ListItem"});var kh=yd("SplitListItem",e=>()=>(t,n,r)=>{return(o=wh.type(e),function(e,t){let{$from:n,$to:r,node:i}=e.selection;if(i&&i.isBlock||n.depth<2||!n.sameParent(r))return!1;let s=n.node(-1);if(s.type!=o)return!1;if(0==n.parent.content.size&&n.node(-1).childCount==n.indexAfter(-1)){if(3==n.depth||n.node(-3).type!=o||n.index(-2)!=n.node(-2).childCount-1)return!1;if(t){let r=Ft.empty,i=n.index(-1)?1:n.index(-2)?2:3;for(let e=n.depth-i;e>=n.depth-3;e--)r=Ft.from(n.node(e).copy(r));let s=n.indexAfter(-1)<n.node(-2).childCount?1:n.indexAfter(-2)<n.node(-3).childCount?2:3;r=r.append(Ft.from(o.createAndFill()));let a=n.before(n.depth-(i-1)),l=e.tr.replace(a,n.after(-s),new Zt(r,4-i,0)),c=-1;l.doc.nodesBetween(a,l.doc.content.size,(e,t)=>{if(c>-1)return!1;e.isTextblock&&0==e.content.size&&(c=t+1)}),c>-1&&l.setSelection(Vr.near(l.doc.resolve(c))),t(l.scrollIntoView())}return!0}let a=r.pos==n.end()?s.contentMatchAt(0).defaultType:null,l=e.tr.delete(n.pos,r.pos),c=a?[null,{type:a}]:void 0;return!!kr(l.doc,n.pos,2,c)&&(t&&t(l.split(n.pos,2,c).scrollIntoView()),!0)})(t,n&&(e=>{const{$from:r}=t.selection;if(0===r.parent.content.size&&r.node(-1).childCount===r.indexAfter(-1)){const{$from:t}=e.selection;e.setNodeMarkup(t.before(-1),void 0,r.node(-3).attrs)}n(e)}));var o});Jd(kh,{displayName:"Command<splitListItemCommand>",group:"ListItem"});var Ch=yd("LiftFirstListItem",e=>()=>function(e){return(t,n,r)=>{const{selection:o}=t;if(!(o instanceof Fr))return!1;const{empty:i,$from:s}=o;return!(!i||0!==s.parentOffset)&&s.node(-1).type===wh.type(e)&&ho(t,n,r)}}(e));Jd(Ch,{displayName:"Command<liftFirstListItemCommand>",group:"ListItem"});var Sh=Od("listItemKeymap",{NextListItem:{shortcuts:"Enter",command:e=>{const t=e.get(Ac);return()=>t.call(kh.key)}},SinkListItem:{shortcuts:["Tab","Mod-]"],command:e=>{const t=e.get(Ac);return()=>t.call(bh.key)}},LiftListItem:{shortcuts:["Shift-Tab","Mod-["],command:e=>{const t=e.get(Ac);return()=>t.call(xh.key)}},LiftFirstListItem:{shortcuts:["Backspace","Delete"],command:e=>{const t=e.get(Ac);return()=>t.call(Ch.key)}}});Jd(Sh.ctx,{displayName:"KeymapCtx<listItem>",group:"ListItem"}),Jd(Sh.shortcuts,{displayName:"Keymap<listItem>",group:"ListItem"});var Mh=xd("text",()=>({group:"inline",parseMarkdown:{match:({type:e})=>"text"===e,runner:(e,t)=>{e.addText(t.value)}},toMarkdown:{match:e=>"text"===e.type.name,runner:(e,t)=>{e.addNode("text",void 0,t.text)}}}));Jd(Mh,{displayName:"NodeSchema<text>",group:"Text"});var Nh=Ad("html");Jd(Nh,{displayName:"Attr<html>",group:"Html"});var Eh=Nd("html",e=>({atom:!0,group:"inline",inline:!0,attrs:{value:{default:"",validate:"string"}},toDOM:t=>{const n=document.createElement("span"),r={...e.get(Nh.key)(t),"data-value":t.attrs.value,"data-type":"html"};return n.textContent=t.attrs.value,["span",r,t.attrs.value]},parseDOM:[{tag:'span[data-type="html"]',getAttrs:e=>({value:e.dataset.value??""})}],parseMarkdown:{match:({type:e})=>Boolean("html"===e),runner:(e,t,n)=>{e.addNode(n,{value:t.value})}},toMarkdown:{match:e=>"html"===e.type.name,runner:(e,t)=>{e.addNode("html",void 0,t.attrs.value)}}}));Jd(Eh.node,{displayName:"NodeSchema<html>",group:"Html"}),Jd(Eh.ctx,{displayName:"NodeSchemaCtx<html>",group:"Html"});var Oh=[wu,Ou,Au,_u,Ru,Lu,eh,th,Vu,$u,Wu,Uu,oh,ih,Zu,Yu,lh,ch,ph,fh,yh,wh,Zd,Yd,nu,ru,au,lu,mu,gu,Nh,Eh,Mh].flat(),Ah=[Hu,dh,mh,Gu,sh,Bu].flat(),Th=[Qd,eu,du,iu],Dh=yd("IsMarkSelected",()=>e=>t=>{if(!e)return!1;const{doc:n,selection:r}=t;return n.rangeHasMark(r.from,r.to,e)}),Ih=yd("IsNoteSelected",()=>e=>t=>!!e&&Mi(t,e).hasNode),_h=yd("ClearTextInCurrentBlock",()=>()=>(e,t)=>{let n=e.tr;const{$from:r,$to:o}=n.selection,{pos:i}=r,{pos:s}=o,a=i-r.node().content.size;return!(a<0)&&(n=n.deleteRange(a,s),t?.(n),!0)}),Rh=yd("SetBlockType",()=>e=>(t,n)=>{const{nodeType:r,attrs:o=null}=e??{};if(!r)return!1;const i=t.tr,{from:s,to:a}=i.selection;try{i.setBlockType(s,a,r,o)}catch{return!1}return n?.(i),!0}),Lh=yd("WrapInBlockType",()=>e=>(t,n)=>{const{nodeType:r,attrs:o=null}=e??{};if(!r)return!1;let i=t.tr;try{const{$from:e,$to:t}=i.selection,n=e.blockRange(t),s=n&&yr(n,r,o);if(!s)return!1;i=i.wrap(n,s)}catch{return!1}return n?.(i),!0}),Bh=yd("AddBlockType",()=>e=>(t,n)=>{const{nodeType:r,attrs:o=null}=e??{};if(!r)return!1;const i=t.tr;try{const e=r instanceof mn?r:r.createAndFill(o);if(!e)return!1;i.replaceSelectionWith(e)}catch{return!1}return n?.(i),!0}),Ph=yd("SelectTextNearPos",()=>e=>(t,n)=>{const{pos:r}=e??{};if(null==r)return!1;const o=t.tr;try{const e=t.doc.resolve((i=r,s=0,a=t.doc.content.size,Math.min(Math.max(i,s),a)));o.setSelection(Fr.near(e))}catch{return!1}var i,s,a;return n?.(o.scrollIntoView()),!0}),zh=[Tu,qu,Pu,zu,Ku,nh,ah,Xu,Qu,gh,uh,bh,kh,xh,Ch,Xd,cu,ou,vu,yu,Dh,Ih,_h,Rh,Lh,Bh,Ph],jh=[Fu,Ju,rh,ju,Sh,vh,hh,Du,tu,uu,su].flat(),Vh=Dd("remarkAddOrderInList",()=>()=>e=>{G(e,"list",e=>{if(e.ordered){const t=e.start??1;e.children.forEach((e,n)=>{e.label=n+t})}})});Jd(Vh.plugin,{displayName:"Remark<remarkAddOrderInListPlugin>",group:"Remark"}),Jd(Vh.options,{displayName:"RemarkConfig<remarkAddOrderInListPlugin>",group:"Remark"});var $h=Dd("remarkLineBreak",()=>()=>e=>{const t=/(?<![\t ])[\t ]*(?:\r?\n|\r)/g;G(e,"text",(e,n,r)=>{if(!e.value||"string"!=typeof e.value)return;const o=[];let i=0;t.lastIndex=0;let s=t.exec(e.value);for(;s;){const n=s.index;i!==n&&o.push({type:"text",value:e.value.slice(i,n)}),o.push({type:"break",data:{isInline:!0}}),i=n+s[0].length,s=t.exec(e.value)}return o.length>0&&r&&"number"==typeof n?(i<e.value.length&&o.push({type:"text",value:e.value.slice(i)}),r.children.splice(n,1,...o),n+o.length):void 0})});Jd($h.plugin,{displayName:"Remark<remarkLineBreak>",group:"Remark"}),Jd($h.options,{displayName:"RemarkConfig<remarkLineBreak>",group:"Remark"});var Hh=Dd("remarkInlineLink",()=>Wd);Jd(Hh.plugin,{displayName:"Remark<remarkInlineLinkPlugin>",group:"Remark"}),Jd(Hh.options,{displayName:"RemarkConfig<remarkInlineLinkPlugin>",group:"Remark"});var qh=Dd("remarkHTMLTransformer",e=>()=>t=>{const n=Su(e);var r;r=(e,t,r)=>(e=>"html"===e.type)(e)?(r&&n.has(r.type)&&(e.children=[Ud(e)],delete e.value,e.type="paragraph"),[e]):[e],function e(t,n,o){if((e=>!!e.children)(t)){const n=[];for(let r=0,o=t.children.length;r<o;r++){const o=t.children[r];if(o){const i=e(o,r,t);if(i)for(let e=0,t=i.length;e<t;e++){const t=i[e];t&&n.push(t)}}}t.children=n}return r(t,n,o)}(t,0,null)[0]});Jd(qh.plugin,{displayName:"Remark<remarkHtmlTransformer>",group:"Remark"}),Jd(qh.options,{displayName:"RemarkConfig<remarkHtmlTransformer>",group:"Remark"});var Fh=Dd("remarkMarker",()=>()=>(e,t)=>{G(e,e=>["strong","emphasis"].includes(e.type),e=>{e.marker=(e=>t.value.charAt(e.position.start.offset))(e)})});Jd(Fh.plugin,{displayName:"Remark<remarkMarker>",group:"Remark"}),Jd(Fh.options,{displayName:"RemarkConfig<remarkMarker>",group:"Remark"});var Wh=kd(()=>{let e=!1;const t=new lo("MILKDOWN_INLINE_NODES_CURSOR"),n=new io({key:t,state:{init:()=>!1,apply(e){if(!e.selection.empty)return!1;const t=e.selection.$from,n=t.nodeBefore,r=t.nodeAfter;return!(!(n&&r&&n.isInline&&!n.isText&&r.isInline)||r.isText)}},props:{handleDOMEvents:{compositionend:(t,r)=>!!e&&(e=!1,requestAnimationFrame(()=>{if(n.getState(t.state)){const e=t.state.selection.from;r.preventDefault(),t.dispatch(t.state.tr.insertText(r.data||"",e))}}),!0),compositionstart:t=>(n.getState(t.state)&&(e=!0),!1),beforeinput:(t,r)=>{if(n.getState(t.state)&&r instanceof InputEvent&&r.data&&!e){const e=t.state.selection.from;return r.preventDefault(),t.dispatch(t.state.tr.insertText(r.data||"",e)),!0}return!1}},decorations(e){if(n.getState(e)){const t=e.selection.$from.pos,n=document.createElement("span"),r=Nl.widget(t,n,{side:-1}),o=document.createElement("span"),i=Nl.widget(t,o);return setTimeout(()=>{n.contentEditable="true",o.contentEditable="true"}),Al.create(e.doc,[r,i])}return Al.empty}}});return n});Jd(Wh,{displayName:"Prose<inlineNodesCursorPlugin>",group:"Prose"});var Uh=kd(e=>new io({key:new lo("MILKDOWN_HARDBREAK_MARKS"),appendTransaction:(t,n,r)=>{if(!t.length)return;const o=th.type(e);let i;return t.forEach((e,n)=>{e.steps.forEach((e,s)=>{if(!(e instanceof lr))return;const a=(e,r)=>t.slice(n).reduce((e,t,n)=>(0===n?t.mapping.slice(s+1):t.mapping).map(e,r),e),l=a(e.from,-1),c=a(e.to,1);r.doc.nodesBetween(l,c,(e,t)=>{e.type!==o||e.attrs.isInline||e.marks.length&&(i??=r.tr,i.setNodeMarkup(t,o,e.attrs,[]))})})}),i}}));Jd(Uh,{displayName:"Prose<hardbreakClearMarkPlugin>",group:"Prose"});var Gh=Md(["table","code_block"],"hardbreakFilterNodes");Jd(Gh,{displayName:"Ctx<hardbreakFilterNodes>",group:"Prose"});var Kh=kd(e=>{const t=e.get(Gh.key);return new io({key:new lo("MILKDOWN_HARDBREAK_FILTER"),filterTransaction:(e,n)=>{const r=e.getMeta("hardbreak"),[o]=e.steps;if(r&&o instanceof hr){const e=n.doc.resolve(o.from);let r=e.depth,i=!0;for(;r>0;)t.includes(e.node(r).type.name)&&(i=!1),r--;return i}return!0}})});Jd(Kh,{displayName:"Prose<hardbreakFilterPlugin>",group:"Prose"});var Jh=kd(e=>{const t=new lo("MILKDOWN_HEADING_ID"),n=n=>{if(n.composing)return;const r=e.get(_u.key),o=n.state.tr.setMeta("addToHistory",!1);let i=!1;const s={};n.state.doc.descendants((n,a)=>{if(n.type===Lu.type(e)){if(0===n.textContent.trim().length)return;const e=n.attrs;let l=r(n);s[l]?(s[l]+=1,l+=`-#${s[l]}`):s[l]=1,e.id!==l&&(i=!0,o.setMeta(t,!0).setNodeMarkup(a,void 0,{...e,id:l}))}}),i&&n.dispatch(o)};return new io({key:t,view:e=>(n(e),{update:(e,t)=>{e.state.doc.eq(t.doc)||n(e)}})})});Jd(Jh,{displayName:"Prose<syncHeadingIdPlugin>",group:"Prose"});var Zh=kd(e=>new io({key:new lo("MILKDOWN_KEEP_LIST_ORDER"),appendTransaction:(t,n,r)=>{if(!r.selection||t.some(e=>!1===e.getMeta("addToHistory")||!e.isGeneric))return null;const o=fh.type(e),i=ch.type(e),s=wh.type(e),a=(e,t,n=1)=>{let r=!1;const o=`${t+n}.`;return e.label!==o&&(e.label=o,r=!0),r};let l=r.tr,c=!1;return r.doc.descendants((e,t,n,r)=>{if(e.type===i){const n=e.maybeChild(0);n?.type===s&&"ordered"===n.attrs.listType&&(c=!0,l.setNodeMarkup(t,o,{spread:!0}),e.descendants((e,t,n,r)=>{if(e.type===s){const n={...e.attrs};a(n,r)&&(l=l.setNodeMarkup(t,void 0,n))}return!1}))}else if(e.type===s&&n?.type===o){const o={...e.attrs};let i=!1;"ordered"!==o.listType&&(o.listType="ordered",i=!0),n?.maybeChild(0)&&(i=a(o,r,n?.attrs.order??1)),i&&(l=l.setNodeMarkup(t,void 0,o),c=!0)}}),c?l.setMeta("addToHistory",!1):null}}));Jd(Zh,{displayName:"Prose<syncListOrderPlugin>",group:"Prose"});var Yh=[Oh,Ah,Th,zh,jh,[Uh,Gh,Kh,Wh,ku,Vh,Hh,$h,qh,Fh,Eu,Jh,Zh].flat()].flat(),Xh=200,Qh=function(){};Qh.prototype.append=function(e){return e.length?(e=Qh.from(e),!this.length&&e||e.length<Xh&&this.leafAppend(e)||this.length<Xh&&e.leafPrepend(this)||this.appendInner(e)):this},Qh.prototype.prepend=function(e){return e.length?Qh.from(e).append(this):this},Qh.prototype.appendInner=function(e){return new tp(this,e)},Qh.prototype.slice=function(e,t){return void 0===e&&(e=0),void 0===t&&(t=this.length),e>=t?Qh.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,t))},Qh.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)},Qh.prototype.forEach=function(e,t,n){void 0===t&&(t=0),void 0===n&&(n=this.length),t<=n?this.forEachInner(e,t,n,0):this.forEachInvertedInner(e,t,n,0)},Qh.prototype.map=function(e,t,n){void 0===t&&(t=0),void 0===n&&(n=this.length);var r=[];return this.forEach(function(t,n){return r.push(e(t,n))},t,n),r},Qh.from=function(e){return e instanceof Qh?e:e&&e.length?new ep(e):Qh.empty};var ep=function(e){function t(t){e.call(this),this.values=t}e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t;var n={length:{configurable:!0},depth:{configurable:!0}};return t.prototype.flatten=function(){return this.values},t.prototype.sliceInner=function(e,n){return 0==e&&n==this.length?this:new t(this.values.slice(e,n))},t.prototype.getInner=function(e){return this.values[e]},t.prototype.forEachInner=function(e,t,n,r){for(var o=t;o<n;o++)if(!1===e(this.values[o],r+o))return!1},t.prototype.forEachInvertedInner=function(e,t,n,r){for(var o=t-1;o>=n;o--)if(!1===e(this.values[o],r+o))return!1},t.prototype.leafAppend=function(e){if(this.length+e.length<=Xh)return new t(this.values.concat(e.flatten()))},t.prototype.leafPrepend=function(e){if(this.length+e.length<=Xh)return new t(e.flatten().concat(this.values))},n.length.get=function(){return this.values.length},n.depth.get=function(){return 0},Object.defineProperties(t.prototype,n),t}(Qh);Qh.empty=new ep([]);var tp=function(e){function t(t,n){e.call(this),this.left=t,this.right=n,this.length=t.length+n.length,this.depth=Math.max(t.depth,n.depth)+1}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},t.prototype.getInner=function(e){return e<this.left.length?this.left.get(e):this.right.get(e-this.left.length)},t.prototype.forEachInner=function(e,t,n,r){var o=this.left.length;return!(t<o&&!1===this.left.forEachInner(e,t,Math.min(n,o),r))&&(!(n>o&&!1===this.right.forEachInner(e,Math.max(t-o,0),Math.min(this.length,n)-o,r+o))&&void 0)},t.prototype.forEachInvertedInner=function(e,t,n,r){var o=this.left.length;return!(t>o&&!1===this.right.forEachInvertedInner(e,t-o,Math.max(n,o)-o,r+o))&&(!(n<o&&!1===this.left.forEachInvertedInner(e,Math.min(t,o),n,r))&&void 0)},t.prototype.sliceInner=function(e,t){if(0==e&&t==this.length)return this;var n=this.left.length;return t<=n?this.left.slice(e,t):e>=n?this.right.slice(e-n,t-n):this.left.slice(e,n).append(this.right.slice(0,t-n))},t.prototype.leafAppend=function(e){var n=this.right.leafAppend(e);if(n)return new t(this.left,n)},t.prototype.leafPrepend=function(e){var n=this.left.leafPrepend(e);if(n)return new t(n,this.right)},t.prototype.appendInner=function(e){return this.left.depth>=Math.max(this.right.depth,e.depth)+1?new t(this.left,new t(this.right,e)):new t(this,e)},t}(Qh);class np{constructor(e,t){this.items=e,this.eventCount=t}popEvent(e,t){if(0==this.eventCount)return null;let n,r,o=this.items.length;for(;;o--){if(this.items.get(o-1).selection){--o;break}}t&&(n=this.remapping(o,this.items.length),r=n.maps.length);let i,s,a=e.tr,l=[],c=[];return this.items.forEach((e,t)=>{if(!e.step)return n||(n=this.remapping(o,t+1),r=n.maps.length),r--,void c.push(e);if(n){c.push(new rp(e.map));let t,o=e.step.map(n.slice(r));o&&a.maybeStep(o).doc&&(t=a.mapping.maps[a.mapping.maps.length-1],l.push(new rp(t,void 0,void 0,l.length+c.length))),r--,t&&n.appendMap(t,r)}else a.maybeStep(e.step);return e.selection?(i=n?e.selection.map(n.slice(r)):e.selection,s=new np(this.items.slice(0,o).append(c.reverse().concat(l)),this.eventCount-1),!1):void 0},this.items.length,0),{remaining:s,transform:a,selection:i}}addTransform(e,t,n,r){let o=[],i=this.eventCount,s=this.items,a=!r&&s.length?s.get(s.length-1):null;for(let n=0;n<e.steps.length;n++){let l,c=e.steps[n].invert(e.docs[n]),d=new rp(e.mapping.maps[n],c,t);(l=a&&a.merge(d))&&(d=l,n?o.pop():s=s.slice(0,s.length-1)),o.push(d),t&&(i++,t=void 0),r||(a=d)}let l=i-n.depth;return l>ip&&(s=function(e,t){let n;return e.forEach((e,r)=>{if(e.selection&&0==t--)return n=r,!1}),e.slice(n)}(s,l),i-=l),new np(s.append(o),i)}remapping(e,t){let n=new rr;return this.items.forEach((t,r)=>{let o=null!=t.mirrorOffset&&r-t.mirrorOffset>=e?n.maps.length-t.mirrorOffset:void 0;n.appendMap(t.map,o)},e,t),n}addMaps(e){return 0==this.eventCount?this:new np(this.items.append(e.map(e=>new rp(e))),this.eventCount)}rebased(e,t){if(!this.eventCount)return this;let n=[],r=Math.max(0,this.items.length-t),o=e.mapping,i=e.steps.length,s=this.eventCount;this.items.forEach(e=>{e.selection&&s--},r);let a=t;this.items.forEach(t=>{let r=o.getMirror(--a);if(null==r)return;i=Math.min(i,r);let l=o.maps[r];if(t.step){let i=e.steps[r].invert(e.docs[r]),c=t.selection&&t.selection.map(o.slice(a+1,r));c&&s++,n.push(new rp(l,i,c))}else n.push(new rp(l))},r);let l=[];for(let e=t;e<i;e++)l.push(new rp(o.maps[e]));let c=this.items.slice(0,r).append(l).append(n),d=new np(c,s);return d.emptyItemCount()>500&&(d=d.compress(this.items.length-n.length)),d}emptyItemCount(){let e=0;return this.items.forEach(t=>{t.step||e++}),e}compress(e=this.items.length){let t=this.remapping(0,e),n=t.maps.length,r=[],o=0;return this.items.forEach((i,s)=>{if(s>=e)r.push(i),i.selection&&o++;else if(i.step){let e=i.step.map(t.slice(n)),s=e&&e.getMap();if(n--,s&&t.appendMap(s,n),e){let a=i.selection&&i.selection.map(t.slice(n));a&&o++;let l,c=new rp(s.invert(),e,a),d=r.length-1;(l=r.length&&r[d].merge(c))?r[d]=l:r.push(c)}}else i.map&&n--},this.items.length,0),new np(Qh.from(r.reverse()),o)}}np.empty=new np(Qh.empty,0);class rp{constructor(e,t,n,r){this.map=e,this.step=t,this.selection=n,this.mirrorOffset=r}merge(e){if(this.step&&e.step&&!e.selection){let t=e.step.merge(this.step);if(t)return new rp(t.getMap().invert(),t,this.selection)}}}class op{constructor(e,t,n,r,o){this.done=e,this.undone=t,this.prevRanges=n,this.prevTime=r,this.prevComposition=o}}const ip=20;function sp(e){let t=[];for(let n=e.length-1;n>=0&&0==t.length;n--)e[n].forEach((e,n,r,o)=>t.push(r,o));return t}function ap(e,t){if(!e)return null;let n=[];for(let r=0;r<e.length;r+=2){let o=t.map(e[r],1),i=t.map(e[r+1],-1);o<=i&&n.push(o,i)}return n}let lp=!1,cp=null;function dp(e){let t=e.plugins;if(cp!=t){lp=!1,cp=t;for(let e=0;e<t.length;e++)if(t[e].spec.historyPreserveItems){lp=!0;break}}return lp}const up=new lo("history"),hp=new lo("closeHistory");function pp(e={}){return e={depth:e.depth||100,newGroupDelay:e.newGroupDelay||500},new io({key:up,state:{init:()=>new op(np.empty,np.empty,null,0,-1),apply:(t,n,r)=>function(e,t,n,r){let o,i=n.getMeta(up);if(i)return i.historyState;n.getMeta(hp)&&(e=new op(e.done,e.undone,null,0,-1));let s=n.getMeta("appendedTransaction");if(0==n.steps.length)return e;if(s&&s.getMeta(up))return s.getMeta(up).redo?new op(e.done.addTransform(n,void 0,r,dp(t)),e.undone,sp(n.mapping.maps),e.prevTime,e.prevComposition):new op(e.done,e.undone.addTransform(n,void 0,r,dp(t)),null,e.prevTime,e.prevComposition);if(!1===n.getMeta("addToHistory")||s&&!1===s.getMeta("addToHistory"))return(o=n.getMeta("rebased"))?new op(e.done.rebased(n,o),e.undone.rebased(n,o),ap(e.prevRanges,n.mapping),e.prevTime,e.prevComposition):new op(e.done.addMaps(n.mapping.maps),e.undone.addMaps(n.mapping.maps),ap(e.prevRanges,n.mapping),e.prevTime,e.prevComposition);{let o=n.getMeta("composition"),i=0==e.prevTime||!s&&e.prevComposition!=o&&(e.prevTime<(n.time||0)-r.newGroupDelay||!function(e,t){if(!t)return!1;if(!e.docChanged)return!0;let n=!1;return e.mapping.maps[0].forEach((e,r)=>{for(let o=0;o<t.length;o+=2)e<=t[o+1]&&r>=t[o]&&(n=!0)}),n}(n,e.prevRanges)),a=s?ap(e.prevRanges,n.mapping):sp(n.mapping.maps);return new op(e.done.addTransform(n,i?t.selection.getBookmark():void 0,r,dp(t)),np.empty,a,n.time,null==o?e.prevComposition:o)}}(n,r,t,e)},config:e,props:{handleDOMEvents:{beforeinput(e,t){let n=t.inputType,r="historyUndo"==n?mp:"historyRedo"==n?gp:null;return!(!r||!e.editable)&&(t.preventDefault(),r(e.state,e.dispatch))}}}})}function fp(e,t){return(n,r)=>{let o=up.getState(n);if(!o||0==(e?o.undone:o.done).eventCount)return!1;if(r){let i=function(e,t,n){let r=dp(t),o=up.get(t).spec.config,i=(n?e.undone:e.done).popEvent(t,r);if(!i)return null;let s=i.selection.resolve(i.transform.doc),a=(n?e.done:e.undone).addTransform(i.transform,t.selection.getBookmark(),o,r),l=new op(n?a:i.remaining,n?i.remaining:a,null,0,-1);return i.transform.setSelection(s).setMeta(up,{redo:n,historyState:l})}(o,n,e);i&&r(t?i.scrollIntoView():i)}return!0}}const mp=fp(!1,!0),gp=fp(!0,!0);
2
+ /**
3
+ * @vue/shared v3.5.44
4
+ * (c) 2018-present Yuxi (Evan) You and Vue contributors
5
+ * @license MIT
6
+ **/
7
+ function vp(e){const t=Object.create(null);for(const n of e.split(","))t[n]=1;return e=>e in t}const yp="production"!==process.env.NODE_ENV?Object.freeze({}):{},wp="production"!==process.env.NODE_ENV?Object.freeze([]):[],bp=()=>{},xp=()=>!1,kp=e=>111===e.charCodeAt(0)&&110===e.charCodeAt(1)&&(e.charCodeAt(2)>122||e.charCodeAt(2)<97),Cp=e=>e.startsWith("onUpdate:"),Sp=Object.assign,Mp=(e,t)=>{const n=e.indexOf(t);n>-1&&e.splice(n,1)},Np=Object.prototype.hasOwnProperty,Ep=(e,t)=>Np.call(e,t),Op=Array.isArray,Ap=e=>"[object Map]"===zp(e),Tp=e=>"[object Set]"===zp(e),Dp=e=>"[object Date]"===zp(e),Ip=e=>"function"==typeof e,_p=e=>"string"==typeof e,Rp=e=>"symbol"==typeof e,Lp=e=>null!==e&&"object"==typeof e,Bp=e=>(Lp(e)||Ip(e))&&Ip(e.then)&&Ip(e.catch),Pp=Object.prototype.toString,zp=e=>Pp.call(e),jp=e=>zp(e).slice(8,-1),Vp=e=>_p(e)&&"NaN"!==e&&"-"!==e[0]&&""+parseInt(e,10)===e,$p=vp(",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted"),Hp=vp("bind,cloak,else-if,else,for,html,if,model,on,once,pre,show,slot,text,memo"),qp=e=>{const t=Object.create(null);return n=>t[n]||(t[n]=e(n))},Fp=/-\w/g,Wp=qp(e=>e.replace(Fp,e=>e.slice(1).toUpperCase())),Up=/\B([A-Z])/g,Gp=qp(e=>e.replace(Up,"-$1").toLowerCase()),Kp=qp(e=>e.charAt(0).toUpperCase()+e.slice(1)),Jp=qp(e=>e?`on${Kp(e)}`:""),Zp=(e,t)=>!Object.is(e,t),Yp=(e,...t)=>{for(let n=0;n<e.length;n++)e[n](...t)},Xp=(e,t,n,r=!1)=>{Object.defineProperty(e,t,{configurable:!0,enumerable:!1,writable:r,value:n})},Qp=e=>{const t=parseFloat(e);return isNaN(t)?e:t};let ef;const tf=()=>ef||(ef="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{});function nf(e){if(Op(e)){const t={};for(let n=0;n<e.length;n++){const r=e[n],o=_p(r)?af(r):nf(r);if(o)for(const e in o)t[e]=o[e]}return t}if(_p(e)||Lp(e))return e}const rf=/;(?![^(]*\))/g,of=/:([^]+)/,sf=/"(?:[^"\\]|\\[^])*"|'(?:[^'\\]|\\[^])*'|\\[^]|\/\*[^]*?\*\//g;function af(e){const t={};return e.replace(sf,e=>e.startsWith("/*")?"":e).split(rf).forEach(e=>{if(e){const n=e.split(of);n.length>1&&(t[n[0].trim()]=n[1].trim())}}),t}function lf(e){let t="";if(_p(e))t=e;else if(Op(e))for(let n=0;n<e.length;n++){const r=lf(e[n]);r&&(t+=r+" ")}else if(Lp(e))for(const n in e)e[n]&&(t+=n+" ");return t.trim()}const cf=vp("html,body,base,head,link,meta,style,title,address,article,aside,footer,header,hgroup,h1,h2,h3,h4,h5,h6,nav,section,div,dd,dl,dt,figcaption,figure,picture,hr,img,li,main,ol,p,pre,ul,a,b,abbr,bdi,bdo,br,cite,code,data,dfn,em,i,kbd,mark,q,rp,rt,ruby,s,samp,small,span,strong,sub,sup,time,u,var,wbr,area,audio,map,track,video,embed,object,param,source,canvas,script,noscript,del,ins,caption,col,colgroup,table,thead,tbody,td,th,tr,button,datalist,fieldset,form,input,label,legend,meter,optgroup,option,output,progress,select,textarea,details,dialog,menu,summary,template,blockquote,iframe,tfoot"),df=vp("svg,animate,animateMotion,animateTransform,circle,clipPath,color-profile,defs,desc,discard,ellipse,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,filter,foreignObject,g,hatch,hatchpath,image,line,linearGradient,marker,mask,mesh,meshgradient,meshpatch,meshrow,metadata,mpath,path,pattern,polygon,polyline,radialGradient,rect,set,solidcolor,stop,switch,symbol,text,textPath,title,tspan,unknown,use,view"),uf=vp("annotation,annotation-xml,maction,maligngroup,malignmark,math,menclose,merror,mfenced,mfrac,mfraction,mglyph,mi,mlabeledtr,mlongdiv,mmultiscripts,mn,mo,mover,mpadded,mphantom,mprescripts,mroot,mrow,ms,mscarries,mscarry,msgroup,msline,mspace,msqrt,msrow,mstack,mstyle,msub,msubsup,msup,mtable,mtd,mtext,mtr,munder,munderover,none,semantics"),hf=vp("itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,playsinline,readonly");function pf(e){return!!e||""===e}function ff(e,t,n){if(e.length!==t.length)return!1;let r=!0;for(let o=0;r&&o<e.length;o++)r=yf(e[o],t[o],n);return r}function mf(e,t,n){if(e.size!==t.size)return!1;const r=Array.from(t),o=new Uint8Array(r.length);for(const t of e){let e=-1;for(let i=0;i<r.length;i++)if(!o[i]&&yf(t,r[i],n)){e=i;break}if(e<0)return!1;o[e]=1}return!0}function gf(e,t,n){let r=Ap(e),o=Ap(t);if(r||o)return!(!r||!o)&&mf(e,t,n);if(r=Tp(e),o=Tp(t),r||o)return!(!r||!o)&&mf(e,t,n);if(Object.keys(e).length!==Object.keys(t).length)return!1;for(const r in e){const o=e.hasOwnProperty(r),i=t.hasOwnProperty(r);if(o&&!i||!o&&i||!yf(e[r],t[r],n))return!1}return String(e)===String(t)}function vf(e,t,n,r){n||(n=[new Map,new Map]);const[o,i]=n;if(o.has(e)||i.has(t))return o.get(e)===t&&i.get(t)===e;o.set(e,t),i.set(t,e);const s=r(e,t,n);return o.delete(e),i.delete(t),s}function yf(e,t,n){if(e===t)return!0;let r=Dp(e),o=Dp(t);return r||o?!(!r||!o)&&e.getTime()===t.getTime():(r=Rp(e),o=Rp(t),r||o?e===t:(r=Op(e),o=Op(t),r||o?!(!r||!o)&&vf(e,t,n,ff):(r=Lp(e),o=Lp(t),r||o?!(!r||!o)&&vf(e,t,n,gf):String(e)===String(t))))}
8
+ /**
9
+ * @vue/reactivity v3.5.44
10
+ * (c) 2018-present Yuxi (Evan) You and Vue contributors
11
+ * @license MIT
12
+ **/function wf(e,...t){console.warn(`[Vue warn] ${e}`,...t)}let bf,xf;class kf{constructor(e=!1){this.detached=e,this._active=!0,this._on=0,this.effects=[],this.cleanups=[],this._isPaused=!1,this._warnOnRun=!0,this.__v_skip=!0,!e&&bf&&(bf.active?(this.parent=bf,this.index=(bf.scopes||(bf.scopes=[])).push(this)-1):(this._active=!1,this._warnOnRun=!1))}get active(){return this._active}pause(){if(this._active){let e,t;if(this._isPaused=!0,this.scopes){const n=this.scopes.slice();for(e=0,t=n.length;e<t;e++)n[e].pause()}for(e=0,t=this.effects.length;e<t;e++)this.effects[e].pause()}}resume(){if(this._active&&this._isPaused){let e,t;if(this._isPaused=!1,this.scopes){const n=this.scopes.slice();for(e=0,t=n.length;e<t;e++)n[e].resume()}const n=this.effects.slice();for(e=0,t=n.length;e<t;e++)n[e].resume()}}run(e){if(this._active){const t=bf;try{return bf=this,e()}finally{bf=t}}else"production"!==process.env.NODE_ENV&&this._warnOnRun&&wf("cannot run an inactive effect scope.")}on(){1===++this._on&&(this.prevScope=bf,bf=this)}off(){if(this._on>0&&0===--this._on){if(bf===this)bf=this.prevScope;else{let e=bf;for(;e;){if(e.prevScope===this){e.prevScope=this.prevScope;break}e=e.prevScope}}this.prevScope=void 0}}stop(e){if(this._active){let t,n;for(this._active=!1,t=0,n=this.effects.length;t<n;t++)this.effects[t].stop();for(this.effects.length=0,t=0,n=this.cleanups.length;t<n;t++)this.cleanups[t]();if(this.cleanups.length=0,this.scopes){const e=this.scopes.slice();for(t=0,n=e.length;t<n;t++)e[t].stop(!0);this.scopes.length=0}if(!this.detached&&this.parent&&!e){const e=this.parent.scopes.pop();e&&e!==this&&(this.parent.scopes[this.index]=e,e.index=this.index)}this.parent=void 0}}}const Cf=new WeakSet;class Sf{constructor(e){this.fn=e,this.deps=void 0,this.depsTail=void 0,this.flags=5,this.next=void 0,this.cleanup=void 0,this.scheduler=void 0,bf&&(bf.active?bf.effects.push(this):this.flags&=-2)}pause(){this.flags|=64}resume(){64&this.flags&&(this.flags&=-65,Cf.has(this)&&(Cf.delete(this),this.trigger()))}notify(){2&this.flags&&!(32&this.flags)||8&this.flags||Of(this)}run(){if(!(1&this.flags))return this.fn();this.flags|=2,$f(this),Df(this);const e=xf,t=Pf;xf=this,Pf=!0;try{return this.fn()}finally{"production"!==process.env.NODE_ENV&&xf!==this&&wf("Active effect was not restored correctly - this is likely a Vue internal bug."),If(this),xf=e,Pf=t,this.flags&=-3}}stop(){if(1&this.flags){for(let e=this.deps;e;e=e.nextDep)Lf(e);this.deps=this.depsTail=void 0,$f(this),this.onStop&&this.onStop(),this.flags&=-2}}trigger(){64&this.flags?Cf.add(this):this.scheduler?this.scheduler():this.runIfDirty()}runIfDirty(){_f(this)&&this.run()}get dirty(){return _f(this)}}let Mf,Nf,Ef=0;function Of(e,t=!1){if(e.flags|=8,t)return e.next=Nf,void(Nf=e);e.next=Mf,Mf=e}function Af(){Ef++}function Tf(){if(--Ef>0)return;if(Nf){let e=Nf;for(Nf=void 0;e;){const t=e.next;e.next=void 0,e.flags&=-9,e=t}}let e;for(;Mf;){let t=Mf;for(Mf=void 0;t;){const n=t.next;if(t.next=void 0,t.flags&=-9,1&t.flags)try{t.trigger()}catch(t){e||(e=t)}t=n}}if(e)throw e}function Df(e){for(let t=e.deps;t;t=t.nextDep)t.version=-1,t.prevActiveLink=t.dep.activeLink,t.dep.activeLink=t}function If(e){let t,n=e.depsTail,r=n;for(;r;){const e=r.prevDep;-1===r.version?(r===n&&(n=e),Lf(r),Bf(r)):t=r,r.dep.activeLink=r.prevActiveLink,r.prevActiveLink=void 0,r=e}e.deps=t,e.depsTail=n}function _f(e){for(let t=e.deps;t;t=t.nextDep)if(t.dep.version!==t.version||t.dep.computed&&(Rf(t.dep.computed)||t.dep.version!==t.version))return!0;return!!e._dirty}function Rf(e){if(4&e.flags&&!(16&e.flags))return;if(e.flags&=-17,e.globalVersion===Hf)return;if(e.globalVersion=Hf,!e.isSSR&&128&e.flags&&(!e.deps&&!e._dirty||!_f(e)))return;e.flags|=2;const t=e.dep,n=xf,r=Pf;xf=e,Pf=!0;try{Df(e);const n=e.fn(e._value);(0===t.version||Zp(n,e._value))&&(e.flags|=128,e._value=n,t.version++)}catch(e){throw t.version++,e}finally{xf=n,Pf=r,If(e),e.flags&=-3}}function Lf(e,t=!1){const{dep:n,prevSub:r,nextSub:o}=e;if(r&&(r.nextSub=o,e.prevSub=void 0),o&&(o.prevSub=r,e.nextSub=void 0),"production"!==process.env.NODE_ENV&&n.subsHead===e&&(n.subsHead=o),n.subs===e&&(n.subs=r,!r&&n.computed)){n.computed.flags&=-5;for(let e=n.computed.deps;e;e=e.nextDep)Lf(e,!0)}t||--n.sc||!n.map||n.map.delete(n.key)}function Bf(e){const{prevDep:t,nextDep:n}=e;t&&(t.nextDep=n,e.prevDep=void 0),n&&(n.prevDep=t,e.nextDep=void 0)}let Pf=!0;const zf=[];function jf(){zf.push(Pf),Pf=!1}function Vf(){const e=zf.pop();Pf=void 0===e||e}function $f(e){const{cleanup:t}=e;if(e.cleanup=void 0,t){const e=xf;xf=void 0;try{t()}finally{xf=e}}}let Hf=0;class qf{constructor(e,t){this.sub=e,this.dep=t,this.version=t.version,this.nextDep=this.prevDep=this.nextSub=this.prevSub=this.prevActiveLink=void 0}}class Ff{constructor(e){this.computed=e,this.version=0,this.activeLink=void 0,this.subs=void 0,this.map=void 0,this.key=void 0,this.sc=0,this.__v_skip=!0,"production"!==process.env.NODE_ENV&&(this.subsHead=void 0)}track(e){if(!xf||!Pf||xf===this.computed)return;let t=this.activeLink;if(void 0===t||t.sub!==xf)t=this.activeLink=new qf(xf,this),xf.deps?(t.prevDep=xf.depsTail,xf.depsTail.nextDep=t,xf.depsTail=t):xf.deps=xf.depsTail=t,Wf(t);else if(-1===t.version&&(t.version=this.version,t.nextDep)){const e=t.nextDep;e.prevDep=t.prevDep,t.prevDep&&(t.prevDep.nextDep=e),t.prevDep=xf.depsTail,t.nextDep=void 0,xf.depsTail.nextDep=t,xf.depsTail=t,xf.deps===t&&(xf.deps=e)}return"production"!==process.env.NODE_ENV&&xf.onTrack&&xf.onTrack(Sp({effect:xf},e)),t}trigger(e){this.version++,Hf++,this.notify(e)}notify(e){Af();try{if("production"!==process.env.NODE_ENV)for(let t=this.subsHead;t;t=t.nextSub)!t.sub.onTrigger||8&t.sub.flags||t.sub.onTrigger(Sp({effect:t.sub},e));for(let e=this.subs;e;e=e.prevSub)e.sub.notify()&&e.sub.dep.notify()}finally{Tf()}}}function Wf(e){if(e.dep.sc++,4&e.sub.flags){const t=e.dep.computed;if(t&&!e.dep.subs){t.flags|=20;for(let e=t.deps;e;e=e.nextDep)Wf(e)}const n=e.dep.subs;n!==e&&(e.prevSub=n,n&&(n.nextSub=e)),"production"!==process.env.NODE_ENV&&void 0===e.dep.subsHead&&(e.dep.subsHead=e),e.dep.subs=e}}const Uf=new WeakMap,Gf=Symbol("production"!==process.env.NODE_ENV?"Object iterate":""),Kf=Symbol("production"!==process.env.NODE_ENV?"Map keys iterate":""),Jf=Symbol("production"!==process.env.NODE_ENV?"Array iterate":"");function Zf(e,t,n){if(Pf&&xf){let r=Uf.get(e);r||Uf.set(e,r=new Map);let o=r.get(n);o||(r.set(n,o=new Ff),o.map=r,o.key=n),"production"!==process.env.NODE_ENV?o.track({target:e,type:t,key:n}):o.track()}}function Yf(e,t,n,r,o,i){const s=Uf.get(e);if(!s)return void Hf++;const a=s=>{s&&("production"!==process.env.NODE_ENV?s.trigger({target:e,type:t,key:n,newValue:r,oldValue:o,oldTarget:i}):s.trigger())};if(Af(),"clear"===t)s.forEach(a);else{const o=Op(e),i=o&&Vp(n);if(o&&"length"===n){const e=Number(r);s.forEach((t,n)=>{("length"===n||n===Jf||!Rp(n)&&n>=e)&&a(t)})}else switch((void 0!==n||s.has(void 0))&&a(s.get(n)),i&&a(s.get(Jf)),t){case"add":o?i&&a(s.get("length")):(a(s.get(Gf)),Ap(e)&&a(s.get(Kf)));break;case"delete":o||(a(s.get(Gf)),Ap(e)&&a(s.get(Kf)));break;case"set":Ap(e)&&a(s.get(Gf))}}Tf()}function Xf(e){const t=$m(e);return t===e?t:(Zf(t,"iterate",Jf),jm(e)?t:zm(e)?Pm(e)?t.map(e=>qm(Hm(e))):t.map(qm):t.map(Hm))}function Qf(e){return Zf(e=$m(e),"iterate",Jf),e}function em(e,t){return zm(e)?Pm(e)?qm(Hm(t)):qm(t):Hm(t)}const tm={__proto__:null,[Symbol.iterator](){return nm(this,Symbol.iterator,e=>em(this,e))},concat(...e){return Xf(this).concat(...e.map(e=>Op(e)?Xf(e):e))},entries(){return nm(this,"entries",e=>(e[1]=em(this,e[1]),e))},every(e,t){return im(this,"every",e,t,void 0,arguments)},filter(e,t){return im(this,"filter",e,t,e=>e.map(e=>em(this,e)),arguments)},find(e,t){return im(this,"find",e,t,e=>em(this,e),arguments)},findIndex(e,t){return im(this,"findIndex",e,t,void 0,arguments)},findLast(e,t){return im(this,"findLast",e,t,e=>em(this,e),arguments)},findLastIndex(e,t){return im(this,"findLastIndex",e,t,void 0,arguments)},forEach(e,t){return im(this,"forEach",e,t,void 0,arguments)},includes(...e){return am(this,"includes",e)},indexOf(...e){return am(this,"indexOf",e)},join(e){return Xf(this).join(e)},lastIndexOf(...e){return am(this,"lastIndexOf",e)},map(e,t){return im(this,"map",e,t,void 0,arguments)},pop(){return lm(this,"pop")},push(...e){return lm(this,"push",e)},reduce(e,...t){return sm(this,"reduce",e,t)},reduceRight(e,...t){return sm(this,"reduceRight",e,t)},shift(){return lm(this,"shift")},some(e,t){return im(this,"some",e,t,void 0,arguments)},splice(...e){return lm(this,"splice",e)},toReversed(){return Xf(this).toReversed()},toSorted(e){return Xf(this).toSorted(e)},toSpliced(...e){return Xf(this).toSpliced(...e)},unshift(...e){return lm(this,"unshift",e)},values(){return nm(this,"values",e=>em(this,e))}};function nm(e,t,n){const r=Qf(e),o=r[t],i=o.call(r);if(r!==e&&!jm(e)){if("Array Iterator"===i[Symbol.toStringTag]){const e=Object.create(Object.getPrototypeOf(i));return e.next=()=>rm(i.next(),n),o!==om[t]&&Object.defineProperties(e,{return:{get(){const e=i.return;return"function"==typeof e?e.bind(i):e}},throw:{get(){const e=i.throw;return"function"==typeof e?e.bind(i):e}}}),e}i._next=i.next,i.next=()=>rm(i._next(),n)}return i}function rm(e,t){return e.done||(e.value=t(e.value)),e}const om=Array.prototype;function im(e,t,n,r,o,i){const s=Qf(e),a=s!==e&&!jm(e),l=s[t];if(l!==om[t]){const t=l.apply(e,i);return a?Hm(t):t}let c=n;s!==e&&(a?c=function(t,r){return n.call(this,em(e,t),r,e)}:n.length>2&&(c=function(t,r){return n.call(this,t,r,e)}));const d=l.call(s,c,r);return a&&o?o(d):d}function sm(e,t,n,r){const o=Qf(e),i=o!==e&&!jm(e);let s=n,a=!1;o!==e&&(i?(a=0===r.length,s=function(t,r,o){return a&&(a=!1,t=em(e,t)),n.call(this,t,em(e,r),o,e)}):n.length>3&&(s=function(t,r,o){return n.call(this,t,r,o,e)}));const l=o[t](s,...r);return a?em(e,l):l}function am(e,t,n){const r=$m(e);Zf(r,"iterate",Jf);const o=r[t](...n);return-1!==o&&!1!==o||!Vm(n[0])?o:(n[0]=$m(n[0]),r[t](...n))}function lm(e,t,n=[]){jf(),Af();const r=$m(e)[t].apply(e,n);return Tf(),Vf(),r}const cm=vp("__proto__,__v_isRef,__isVue"),dm=new Set(Object.getOwnPropertyNames(Symbol).filter(e=>"arguments"!==e&&"caller"!==e).map(e=>Symbol[e]).filter(Rp));function um(e){Rp(e)||(e=String(e));const t=$m(this);return Zf(t,"has",e),t.hasOwnProperty(e)}class hm{constructor(e=!1,t=!1){this._isReadonly=e,this._isShallow=t}get(e,t,n){if("__v_skip"===t)return e.__v_skip;const r=this._isReadonly,o=this._isShallow;if("__v_isReactive"===t)return!r;if("__v_isReadonly"===t)return r;if("__v_isShallow"===t)return o;if("__v_raw"===t)return n===(r?o?Im:Dm:o?Tm:Am).get(e)||Object.getPrototypeOf(e)===Object.getPrototypeOf(n)?e:void 0;const i=Op(e);if(!r){let e;if(i&&(e=tm[t]))return e;if("hasOwnProperty"===t)return um}const s=Reflect.get(e,t,Fm(e)?e:n);if(Rp(t)?dm.has(t):cm(t))return s;if(r||Zf(e,"get",t),o)return s;if(Fm(s)){const e=i&&Vp(t)?s:s.value;return r&&Lp(e)?Rm(e):e}return Lp(s)?r?Rm(s):_m(s):s}}class pm extends hm{constructor(e=!1){super(!1,e)}set(e,t,n,r){let o=e[t];const i=Op(e)&&Vp(t);if(!this._isShallow){const r=zm(o);if(jm(n)||zm(n)||(o=$m(o),n=$m(n)),!i&&Fm(o)&&!Fm(n))return r?("production"!==process.env.NODE_ENV&&wf(`Set operation on key "${String(t)}" failed: target is readonly.`,e[t]),!0):(o.value=n,!0)}const s=i?Number(t)<e.length:Ep(e,t),a=Reflect.set(e,t,n,Fm(e)?e:r);return e===$m(r)&&a&&(s?Zp(n,o)&&Yf(e,"set",t,n,o):Yf(e,"add",t,n)),a}deleteProperty(e,t){const n=Ep(e,t),r=e[t],o=Reflect.deleteProperty(e,t);return o&&n&&Yf(e,"delete",t,void 0,r),o}has(e,t){const n=Reflect.has(e,t);return Rp(t)&&dm.has(t)||Zf(e,"has",t),n}ownKeys(e){return Zf(e,"iterate",Op(e)?"length":Gf),Reflect.ownKeys(e)}}class fm extends hm{constructor(e=!1){super(!0,e)}set(e,t){return"production"!==process.env.NODE_ENV&&wf(`Set operation on key "${String(t)}" failed: target is readonly.`,e),!0}deleteProperty(e,t){return"production"!==process.env.NODE_ENV&&wf(`Delete operation on key "${String(t)}" failed: target is readonly.`,e),!0}}const mm=new pm,gm=new fm,vm=new pm(!0),ym=new fm(!0),wm=e=>e,bm=e=>Reflect.getPrototypeOf(e);function xm(e){return function(...t){if("production"!==process.env.NODE_ENV){const n=t[0]?`on key "${t[0]}" `:"";wf(`${Kp(e)} operation ${n}failed: target is readonly.`,$m(this))}return"delete"!==e&&("clear"===e?void 0:this)}}function km(e,t){const n={get(n){const r=this.__v_raw,o=$m(r),i=$m(n);e||(Zp(n,i)&&Zf(o,"get",n),Zf(o,"get",i));const{has:s}=bm(o),a=t?wm:e?qm:Hm;return s.call(o,n)?a(r.get(n)):s.call(o,i)?a(r.get(i)):void(r!==o&&r.get(n))},get size(){const t=this.__v_raw;return!e&&Zf($m(t),"iterate",Gf),t.size},has(t){const n=this.__v_raw,r=$m(n),o=$m(t);return e||(Zp(t,o)&&Zf(r,"has",t),Zf(r,"has",o)),t===o?n.has(t):n.has(t)||n.has(o)},forEach(n,r){const o=this,i=o.__v_raw,s=$m(i),a=t?wm:e?qm:Hm;return!e&&Zf(s,"iterate",Gf),i.forEach((e,t)=>n.call(r,a(e),a(t),o))}};Sp(n,e?{add:xm("add"),set:xm("set"),delete:xm("delete"),clear:xm("clear")}:{add(e){const n=$m(this),r=bm(n),o=$m(e),i=t||jm(e)||zm(e)?e:o;return r.has.call(n,i)||Zp(e,i)&&r.has.call(n,e)||Zp(o,i)&&r.has.call(n,o)||(n.add(i),Yf(n,"add",i,i)),this},set(e,n){t||jm(n)||zm(n)||(n=$m(n));const r=$m(this),{has:o,get:i}=bm(r);let s=o.call(r,e);s?"production"!==process.env.NODE_ENV&&Om(r,o,e):(e=$m(e),s=o.call(r,e));const a=i.call(r,e);return r.set(e,n),s?Zp(n,a)&&Yf(r,"set",e,n,a):Yf(r,"add",e,n),this},delete(e){const t=$m(this),{has:n,get:r}=bm(t);let o=n.call(t,e);o?"production"!==process.env.NODE_ENV&&Om(t,n,e):(e=$m(e),o=n.call(t,e));const i=r?r.call(t,e):void 0,s=t.delete(e);return o&&Yf(t,"delete",e,void 0,i),s},clear(){const e=$m(this),t=0!==e.size,n="production"!==process.env.NODE_ENV?Ap(e)?new Map(e):new Set(e):void 0,r=e.clear();return t&&Yf(e,"clear",void 0,void 0,n),r}});return["keys","values","entries",Symbol.iterator].forEach(r=>{n[r]=function(e,t,n){return function(...r){const o=this.__v_raw,i=$m(o),s=Ap(i),a="entries"===e||e===Symbol.iterator&&s,l="keys"===e&&s,c=o[e](...r),d=n?wm:t?qm:Hm;return!t&&Zf(i,"iterate",l?Kf:Gf),Sp(Object.create(c),{next(){const{value:e,done:t}=c.next();return t?{value:e,done:t}:{value:a?[d(e[0]),d(e[1])]:d(e),done:t}}})}}(r,e,t)}),n}function Cm(e,t){const n=km(e,t);return(r,o,i)=>"__v_isReactive"===o?!e:"__v_isReadonly"===o?e:"__v_isShallow"===o?t:"__v_raw"===o?r:Reflect.get(Ep(n,o)&&o in r?n:r,o,i)}const Sm={get:Cm(!1,!1)},Mm={get:Cm(!1,!0)},Nm={get:Cm(!0,!1)},Em={get:Cm(!0,!0)};function Om(e,t,n){const r=$m(n);if(r!==n&&t.call(e,r)){const t=jp(e);wf(`Reactive ${t} contains both the raw and reactive versions of the same object${"Map"===t?" as keys":""}, which can lead to inconsistencies. Avoid differentiating between the raw and reactive versions of an object and only use the reactive version if possible.`)}}const Am=new WeakMap,Tm=new WeakMap,Dm=new WeakMap,Im=new WeakMap;function _m(e){return zm(e)?e:Bm(e,!1,mm,Sm,Am)}function Rm(e){return Bm(e,!0,gm,Nm,Dm)}function Lm(e){return Bm(e,!0,ym,Em,Im)}function Bm(e,t,n,r,o){if(!Lp(e))return"production"!==process.env.NODE_ENV&&wf(`value cannot be made ${t?"readonly":"reactive"}: ${String(e)}`),e;if(e.__v_raw&&(!t||!e.__v_isReactive))return e;if(e.__v_skip||!Object.isExtensible(e))return e;const i=o.get(e);if(i)return i;const s=function(e){switch(e){case"Object":case"Array":return 1;case"Map":case"Set":case"WeakMap":case"WeakSet":return 2;default:return 0}}(jp(e));if(0===s)return e;const a=new Proxy(e,2===s?r:n);return o.set(e,a),a}function Pm(e){return zm(e)?Pm(e.__v_raw):!(!e||!e.__v_isReactive)}function zm(e){return!(!e||!e.__v_isReadonly)}function jm(e){return!(!e||!e.__v_isShallow)}function Vm(e){return!!e&&!!e.__v_raw}function $m(e){const t=e&&e.__v_raw;return t?$m(t):e}const Hm=e=>Lp(e)?_m(e):e,qm=e=>Lp(e)?Rm(e):e;function Fm(e){return!!e&&!0===e.__v_isRef}function Wm(e){return Gm(e,!1)}function Um(e){return Gm(e,!0)}function Gm(e,t){return Fm(e)?e:new Km(e,t)}class Km{constructor(e,t){this.dep=new Ff,this.__v_isRef=!0,this.__v_isShallow=!1,this._rawValue=t?e:$m(e),this._value=t?e:Hm(e),this.__v_isShallow=t}get value(){return"production"!==process.env.NODE_ENV?this.dep.track({target:this,type:"get",key:"value"}):this.dep.track(),this._value}set value(e){const t=this._rawValue,n=this.__v_isShallow||jm(e)||zm(e);e=n?e:$m(e),Zp(e,t)&&(this._rawValue=e,this._value=n?e:Hm(e),"production"!==process.env.NODE_ENV?this.dep.trigger({target:this,type:"set",key:"value",newValue:e,oldValue:t}):this.dep.trigger())}}const Jm={get:(e,t,n)=>{return"__v_raw"===t?e:Fm(r=Reflect.get(e,t,n))?r.value:r;var r},set:(e,t,n,r)=>{const o=e[t];return Fm(o)&&!Fm(n)?(o.value=n,!0):Reflect.set(e,t,n,r)}};function Zm(e){return Pm(e)?e:new Proxy(e,Jm)}class Ym{constructor(e,t,n){this.fn=e,this.setter=t,this._value=void 0,this.dep=new Ff(this),this.__v_isRef=!0,this.deps=void 0,this.depsTail=void 0,this.flags=16,this.globalVersion=Hf-1,this.next=void 0,this.effect=this,this.__v_isReadonly=!t,this.isSSR=n}notify(){if(this.flags|=16,!(8&this.flags||xf===this))return Of(this,!0),!0;process.env.NODE_ENV}get value(){const e="production"!==process.env.NODE_ENV?this.dep.track({target:this,type:"get",key:"value"}):this.dep.track();return Rf(this),e&&(e.version=this.dep.version),this._value}set value(e){this.setter?this.setter(e):"production"!==process.env.NODE_ENV&&wf("Write operation failed: computed value is readonly")}}const Xm={},Qm=new WeakMap;let eg;function tg(e,t,n=yp){const{immediate:r,deep:o,once:i,scheduler:s,augmentJob:a,call:l}=n,c=e=>{(n.onWarn||wf)("Invalid watch source: ",e,"A watch source can only be a getter/effect function, a ref, a reactive object, or an array of these types.")},d=e=>o?e:jm(e)||!1===o||0===o?ng(e,1):ng(e);let u,h,p,f,m=!1,g=!1;if(Fm(e)?(h=()=>e.value,m=jm(e)):Pm(e)?(h=()=>d(e),m=!0):Op(e)?(g=!0,m=e.some(e=>Pm(e)||jm(e)),h=()=>e.map(e=>Fm(e)?e.value:Pm(e)?d(e):Ip(e)?l?l(e,2):e():void("production"!==process.env.NODE_ENV&&c(e)))):Ip(e)?h=t?l?()=>l(e,2):e:()=>{if(p){jf();try{p()}finally{Vf()}}const t=eg;eg=u;try{return l?l(e,3,[f]):e(f)}finally{eg=t}}:(h=bp,"production"!==process.env.NODE_ENV&&c(e)),t&&o){const e=h,t=!0===o?1/0:o;h=()=>ng(e(),t)}const v=bf,y=()=>{u.stop(),v&&v.active&&Mp(v.effects,u)};if(i&&t){const e=t;t=(...t)=>{try{return e(...t)}finally{y()}}}let w=g?new Array(e.length).fill(Xm):Xm;const b=e=>{if(1&u.flags&&(u.dirty||e))if(t){const n=u.run();if(e||o||m||(g?n.some((e,t)=>Zp(e,w[t])):Zp(n,w))){const e=eg;jf();try{p&&p(),eg=u;const e=[n,w===Xm?void 0:g&&w[0]===Xm?[]:w,f];w=n,l?l(t,3,e):t(...e)}finally{eg=e,Vf()}}}else u.run()};return a&&a(b),u=new Sf(h),u.scheduler=s?()=>s(b,!1):b,f=e=>function(e,t=!1,n=eg){if(n){let t=Qm.get(n);t||Qm.set(n,t=[]),t.push(e)}else"production"===process.env.NODE_ENV||t||wf("onWatcherCleanup() was called when there was no active watcher to associate with.")}(e,!1,u),p=u.onStop=()=>{const e=Qm.get(u);if(e){if(l)l(e,4);else for(const t of e)t();Qm.delete(u)}},"production"!==process.env.NODE_ENV&&(u.onTrack=n.onTrack,u.onTrigger=n.onTrigger),t?r?b(!0):w=u.run():s?s(b.bind(null,!0),!0):u.run(),y.pause=u.pause.bind(u),y.resume=u.resume.bind(u),y.stop=y,y}function ng(e,t=1/0,n){if(t<=0||!Lp(e)||e.__v_skip)return e;if(((n=n||new Map).get(e)||0)>=t)return e;if(n.set(e,t),t--,Fm(e))ng(e.value,t,n);else if(Op(e))for(let r=0;r<e.length;r++)ng(e[r],t,n);else if(Tp(e)||Ap(e))e.forEach(e=>{ng(e,t,n)});else if("[object Object]"===zp(e)){for(const r in e)ng(e[r],t,n);for(const r of Object.getOwnPropertySymbols(e))Object.prototype.propertyIsEnumerable.call(e,r)&&ng(e[r],t,n)}return e}
13
+ /**
14
+ * @vue/runtime-core v3.5.44
15
+ * (c) 2018-present Yuxi (Evan) You and Vue contributors
16
+ * @license MIT
17
+ **/const rg=[];function og(e){rg.push(e)}function ig(){rg.pop()}let sg=!1;function ag(e,...t){if(sg)return;sg=!0,jf();const n=rg.length?rg[rg.length-1].component:null,r=n&&n.appContext.config.warnHandler,o=function(){let e=rg[rg.length-1];if(!e)return[];const t=[];for(;e;){const n=t[0];n&&n.vnode===e?n.recurseCount++:t.push({vnode:e,recurseCount:0});const r=e.component&&e.component.parent;e=r&&r.vnode}return t}();if(r)ug(r,n,11,[e+t.map(e=>{var t,n;return null!=(n=null==(t=e.toString)?void 0:t.call(e))?n:JSON.stringify(e)}).join(""),n&&n.proxy,o.map(({vnode:e})=>`at <${Kw(n,e.type)}>`).join("\n"),o]);else{const n=[`[Vue warn]: ${e}`,...t];o.length&&n.push("\n",...function(e){const t=[];return e.forEach((e,n)=>{t.push(...0===n?[]:["\n"],...function({vnode:e,recurseCount:t}){const n=t>0?`... (${t} recursive calls)`:"",r=!!e.component&&null==e.component.parent,o=` at <${Kw(e.component,e.type,r)}`,i=">"+n;return e.props?[o,...lg(e.props),i]:[o+i]}(e))}),t}(o)),console.warn(...n)}Vf(),sg=!1}function lg(e){const t=[],n=Object.keys(e);return n.slice(0,3).forEach(n=>{t.push(...cg(n,e[n]))}),n.length>3&&t.push(" ..."),t}function cg(e,t,n){return _p(t)?(t=JSON.stringify(t),n?t:[`${e}=${t}`]):"number"==typeof t||"boolean"==typeof t||null==t?n?t:[`${e}=${t}`]:Fm(t)?(t=cg(e,$m(t.value),!0),n?t:[`${e}=Ref<`,t,">"]):Ip(t)?[`${e}=fn${t.name?`<${t.name}>`:""}`]:(t=$m(t),n?t:[`${e}=`,t])}const dg={sp:"serverPrefetch hook",bc:"beforeCreate hook",c:"created hook",bm:"beforeMount hook",m:"mounted hook",bu:"beforeUpdate hook",u:"updated",bum:"beforeUnmount hook",um:"unmounted hook",a:"activated hook",da:"deactivated hook",ec:"errorCaptured hook",rtc:"renderTracked hook",rtg:"renderTriggered hook",0:"setup function",1:"render function",2:"watcher getter",3:"watcher callback",4:"watcher cleanup function",5:"native event handler",6:"component event handler",7:"vnode hook",8:"directive hook",9:"transition hook",10:"app errorHandler",11:"app warnHandler",12:"ref function",13:"async component loader",14:"scheduler flush",15:"component update",16:"app unmount cleanup function"};function ug(e,t,n,r){try{return r?e(...r):e()}catch(e){pg(e,t,n)}}function hg(e,t,n,r){if(Ip(e)){const o=ug(e,t,n,r);return o&&Bp(o)&&o.catch(e=>{pg(e,t,n)}),o}if(Op(e)){const o=[];for(let i=0;i<e.length;i++)o.push(hg(e[i],t,n,r));return o}"production"!==process.env.NODE_ENV&&ag("Invalid value type passed to callWithAsyncErrorHandling(): "+typeof e)}function pg(e,t,n,r=!0){const o=t?t.vnode:null,{errorHandler:i,throwUnhandledErrorInProduction:s}=t&&t.appContext.config||yp;if(t){let r=t.parent;const o=t.proxy,s="production"!==process.env.NODE_ENV?dg[n]:`https://vuejs.org/error-reference/#runtime-${n}`;for(;r;){const t=r.ec;if(t)for(let n=0;n<t.length;n++)if(!1===t[n](e,o,s))return;r=r.parent}if(i)return jf(),ug(i,null,10,[e,o,s]),void Vf()}!function(e,t,n,r=!0,o=!1){if("production"!==process.env.NODE_ENV){const o=dg[t];if(n&&og(n),ag("Unhandled error"+(o?` during execution of ${o}`:"")),n&&ig(),r)throw e;console.error(e)}else{if(o)throw e;console.error(e)}}(e,n,o,r,s)}const fg=[];let mg=-1;const gg=[];let vg=null,yg=0;const wg=Promise.resolve();let bg=null;function xg(e){const t=bg||wg;return e?t.then(this?e.bind(this):e):t}function kg(e){if(!(1&e.flags)){const t=Og(e),n=fg[fg.length-1];!n||!(2&e.flags)&&t>=Og(n)?fg.push(e):fg.splice(function(e){let t=mg+1,n=fg.length;for(;t<n;){const r=t+n>>>1,o=fg[r],i=Og(o);i<e||i===e&&2&o.flags?t=r+1:n=r}return t}(t),0,e),e.flags|=1,Cg()}}function Cg(){bg||(bg=wg.then(Ag))}function Sg(e){if(Op(e))for(let t=0;t<e.length;t++)gg.push(e[t]);else vg&&-1===e.id?vg.splice(yg+1,0,e):1&e.flags||(gg.push(e),e.flags|=1);Cg()}function Mg(e,t,n,r=mg+1){for("production"!==process.env.NODE_ENV&&(n=n||new Map);r<fg.length;r++){const o=fg[r];if(o&&2&o.flags){if(e&&o.id!==e.uid||void 0!==t&&!(o.id>=t))continue;if("production"!==process.env.NODE_ENV&&Tg(n,o))continue;fg.splice(r,1),r=e?r-1:mg,4&o.flags&&(o.flags&=-2),o(),4&o.flags||(o.flags&=-2)}}}function Ng(e,t,n=0){if(gg.length){let r=gg,o=0;if(t){r=[];for(let e=0;e<gg.length;e++){const i=gg[e];(void 0!==i.i?!i.i||i.i.uid<n:t.has(i))?gg[o++]=i:r.push(i)}}const i=[...new Set(r)].sort((e,t)=>Og(e)-Og(t));if(gg.length=o,vg){for(let e=0;e<i.length;e++)vg.push(i[e]);return}for(vg=i,"production"!==process.env.NODE_ENV&&(e=e||new Map),yg=0;yg<vg.length;yg++){const t=vg[yg];"production"!==process.env.NODE_ENV&&Tg(e,t)||(4&t.flags&&(t.flags&=-2),8&t.flags||t(),t.flags&=-2)}vg=null,yg=0}}let Eg=!1;const Og=e=>null==e.id?2&e.flags?-1:1/0:e.id;function Ag(e){"production"!==process.env.NODE_ENV&&(e=e||new Map);const t="production"!==process.env.NODE_ENV?t=>Tg(e,t):bp;try{for(mg=0;mg<fg.length;mg++){const e=fg[mg];if(e&&!(8&e.flags)){if("production"!==process.env.NODE_ENV&&t(e))continue;4&e.flags&&(e.flags&=-2),ug(e,e.i,e.i?15:14),4&e.flags||(e.flags&=-2)}}}finally{for(;mg<fg.length;mg++){const e=fg[mg];e&&(e.flags&=-2)}mg=-1,fg.length=0,Ng(e),bg=null,(fg.length||gg.length)&&Ag(e)}}function Tg(e,t){const n=e.get(t)||0;if(n>100){const e=t.i,n=e&&Gw(e.type);return pg(`Maximum recursive updates exceeded${n?` in component <${n}>`:""}. This means you have a reactive effect that is mutating its own dependencies and thus recursively triggering itself. Possible sources include component template, render function, updated hook or watcher source function.`,null,10),!0}return e.set(t,n+1),!1}let Dg=!1;const Ig=e=>{try{return Dg}finally{Dg=e}},_g=new Map;"production"!==process.env.NODE_ENV&&(tf().__VUE_HMR_RUNTIME__={createRecord:zg(Lg),rerender:zg(function(e,t){const n=Rg.get(e);if(!n)return;n.initialDef.render=t,[...n.instances].forEach(e=>{t&&(e.render=t,Bg(e.type).render=t),e.renderCache=[],Dg=!0,8&e.job.flags||e.update(),Dg=!1})}),reload:zg(function(e,t){const n=Rg.get(e);if(!n)return;t=Bg(t),Pg(n.initialDef,t);const r=[...n.instances];for(let e=0;e<r.length;e++){const o=r[e],i=Bg(o.type);let s=_g.get(i);s||(i!==n.initialDef&&Pg(i,t),_g.set(i,s=new Set)),s.add(o),o.appContext.propsCache.delete(o.type),o.appContext.emitsCache.delete(o.type),o.appContext.optionsCache.delete(o.type),o.ceReload?(s.add(o),o.ceReload(t.styles),s.delete(o)):o.parent?kg(()=>{8&o.job.flags||(Dg=!0,o.parent.update(),Dg=!1,s.delete(o))}):o.appContext.reload?o.appContext.reload():"undefined"!=typeof window?window.location.reload():console.warn("[HMR] Root or manually mounted instance modified. Full reload required."),o.root.ce&&o!==o.root&&o.root.ce._removeChildStyle(i)}Sg(()=>{_g.clear()})})});const Rg=new Map;function Lg(e,t){return!Rg.has(e)&&(Rg.set(e,{initialDef:Bg(t),instances:new Set}),!0)}function Bg(e){return Jw(e)?e.__vccOpts:e}function Pg(e,t){Sp(e,t);for(const n in e)"__file"===n||n in t||delete e[n]}function zg(e){return(t,n)=>{try{return e(t,n)}catch(e){console.error(e),console.warn("[HMR] Something went wrong during Vue component hot-reload. Full reload required.")}}}let jg,Vg=[],$g=!1;function Hg(e,...t){jg?jg.emit(e,...t):$g||Vg.push({event:e,args:t})}function qg(e,t){var n,r;if(jg=e,jg)jg.enabled=!0,Vg.forEach(({event:e,args:t})=>jg.emit(e,...t)),Vg=[];else if("undefined"!=typeof window&&window.HTMLElement&&!(null==(r=null==(n=window.navigator)?void 0:n.userAgent)?void 0:r.includes("jsdom"))){(t.__VUE_DEVTOOLS_HOOK_REPLAY__=t.__VUE_DEVTOOLS_HOOK_REPLAY__||[]).push(e=>{qg(e,t)}),setTimeout(()=>{jg||(t.__VUE_DEVTOOLS_HOOK_REPLAY__=null,$g=!0,Vg=[])},3e3)}else $g=!0,Vg=[]}const Fg=Gg("component:added"),Wg=Gg("component:updated"),Ug=Gg("component:removed");function Gg(e){return t=>{Hg(e,t.appContext.app,t.uid,t.parent?t.parent.uid:void 0,t)}}const Kg=Zg("perf:start"),Jg=Zg("perf:end");function Zg(e){return(t,n,r)=>{Hg(e,t.appContext.app,t.uid,t,n,r)}}let Yg=null,Xg=null;function Qg(e){const t=Yg;return Yg=e,Xg=e&&e.type.__scopeId||null,t}function ev(e){Hp(e)&&ag("Do not use built-in directive ids as custom directive id: "+e)}function tv(e,t,n,r){const o=e.dirs,i=t&&t.dirs;for(let s=0;s<o.length;s++){const a=o[s];i&&(a.oldValue=i[s].value);let l=a.dir[r];l&&(jf(),hg(l,n,8,[e.el,a,e,t]),Vf())}}function nv(e,t,n=!1){const r=Dw();if(r||cy){let o=cy?cy._context.provides:r?null==r.parent||r.ce?r.vnode.appContext&&r.vnode.appContext.provides:r.parent.provides:void 0;if(o&&e in o)return o[e];if(arguments.length>1)return n&&Ip(t)?t.call(r&&r.proxy):t;"production"!==process.env.NODE_ENV&&ag(`injection "${String(e)}" not found.`)}else"production"!==process.env.NODE_ENV&&ag("inject() can only be used inside setup() or functional components.")}const rv=Symbol.for("v-scx");function ov(e,t){return sv(e,null,t)}function iv(e,t,n){return"production"===process.env.NODE_ENV||Ip(t)||ag("`watch(fn, options?)` signature has been moved to a separate API. Use `watchEffect(fn, options?)` instead. `watch` now only supports `watch(source, cb, options?) signature."),sv(e,t,n)}function sv(e,t,n=yp){const{immediate:r,deep:o,flush:i,once:s}=n;"production"===process.env.NODE_ENV||t||(void 0!==r&&ag('watch() "immediate" option is only respected when using the watch(source, callback, options?) signature.'),void 0!==o&&ag('watch() "deep" option is only respected when using the watch(source, callback, options?) signature.'),void 0!==s&&ag('watch() "once" option is only respected when using the watch(source, callback, options?) signature.'));const a=Sp({},n);"production"!==process.env.NODE_ENV&&(a.onWarn=ag);const l=t&&r||!t&&"post"!==i;let c;if(jw)if("sync"===i){const e=(()=>{{const e=nv(rv);return e||"production"!==process.env.NODE_ENV&&ag("Server rendering context not provided. Make sure to only call useSSRContext() conditionally in the server build."),e}})();c=e.__watcherHandles||(e.__watcherHandles=[])}else if(!l){const e=()=>{};return e.stop=bp,e.resume=bp,e.pause=bp,e}const d=Tw;a.call=(e,t,n)=>hg(e,d,t,n);let u=!1;"post"===i?a.scheduler=e=>{e.i=d,Zy(e,d&&d.suspense)}:"sync"!==i&&(u=!0,a.scheduler=(e,t)=>{t?e():kg(e)}),a.augmentJob=e=>{t&&(e.flags|=4),u&&(e.flags|=2,d&&(e.id=d.uid,e.i=d))};const h=tg(e,t,a);return jw&&(c?c.push(h):l&&h()),h}function av(e,t,n){const r=this.proxy,o=_p(e)?e.includes(".")?lv(r,e):()=>r[e]:e.bind(r,r);let i;Ip(t)?i=t:(i=t.handler,n=t);const s=Rw(this),a=sv(o,i.bind(r),n);return s(),a}function lv(e,t){const n=t.split(".");return()=>{let t=e;for(let e=0;e<n.length&&t;e++)t=t[n[e]];return t}}const cv=Symbol("_vte"),dv=e=>e.__isTeleport,uv=Symbol("_leaveCb");function hv(e){if(!Cv(e))return dv(e.type)&&e.children?function(e){let t=e[0];if(e.length>1){let n=!1;for(const r of e)if(r.type!==aw){if("production"!==process.env.NODE_ENV&&n){ag("<transition> can only be used on a single element or component. Use <transition-group> for lists.");break}if(t=r,n=!0,"production"===process.env.NODE_ENV)break}}return t}(e.children):e;if(e.component)return e.component.subTree;const{shapeFlag:t,children:n}=e;if(n){if(16&t)return n[0];if(32&t&&Ip(n.default))return n.default()}}function pv(e,t){if(6&e.shapeFlag&&e.component){e.transition=t;const n=e.component.subTree;pv(dv(n.type)&&hv(n)||n,t)}else if(128&e.shapeFlag)e.ssContent.transition=t.clone(e.ssContent),e.ssFallback.transition=t.clone(e.ssFallback);else if(e.transition=t,e.type===iw&&Op(e.children)){const n=yy(e.children,!1);n&&pv(n,t)}}function fv(e){if(e.component)return fv(e.component.subTree);if(e.type===iw){const t=Op(e.children)&&yy(e.children,!1);return t?fv(t):void 0}return e.type!==aw?e:void 0}function mv(e,t){return Ip(e)?(()=>Sp({name:e.name},t,{setup:e}))():e}function gv(e){e.ids=[e.ids[0]+e.ids[2]+++"-",0,0]}const vv=new WeakSet;function yv(e,t){let n;return!(!(n=Object.getOwnPropertyDescriptor(e,t))||n.configurable)}const wv=new WeakMap;function bv(e,t,n,r,o=!1){if(Op(e))return void e.forEach((e,i)=>bv(e,t&&(Op(t)?t[i]:t),n,r,o));if(kv(r)&&!o)return void(512&r.shapeFlag&&r.type.__asyncResolved&&r.component.subTree.component&&bv(e,t,n,r.component.subTree));const i=4&r.shapeFlag?Fw(r.component):r.el,s=o?null:i,{i:a,r:l}=e;if("production"!==process.env.NODE_ENV&&!a)return void ag("Missing ref owner context. ref cannot be used on hoisted vnodes. A vnode with ref must be created inside the render function.");const c=t&&t.r,d=a.refs===yp?a.refs={}:a.refs,u=a.setupState,h=$m(u),p=u===yp?xp:e=>("production"===process.env.NODE_ENV||(Ep(h,e)&&!Fm(h[e])&&ag(`Template ref "${e}" used on a non-ref value. It will not work in the production build.`),!vv.has(h[e])))&&(!yv(d,e)&&Ep(h,e)),f=(e,t)=>("production"===process.env.NODE_ENV||!vv.has(e))&&(!t||!yv(d,t));if(null!=c&&c!==l)if(xv(t),_p(c))d[c]=null,p(c)&&(u[c]=null);else if(Fm(c)){const e=t;f(c,e.k)&&(c.value=null),e.k&&(d[e.k]=null)}if(Ip(l))ug(l,a,12,[s,d]);else{const t=_p(l),r=Fm(l);if(t||r){const a=()=>{if(e.f){const n=t?p(l)?u[l]:d[l]:f(l)||!e.k?l.value:d[e.k];if(o)Op(n)&&Mp(n,i);else if(Op(n))n.includes(i)||n.push(i);else if(t)d[l]=[i],p(l)&&(u[l]=d[l]);else{const t=[i];f(l,e.k)&&(l.value=t),e.k&&(d[e.k]=t)}}else t?(d[l]=s,p(l)&&(u[l]=s)):r?(f(l,e.k)&&(l.value=s),e.k&&(d[e.k]=s)):"production"!==process.env.NODE_ENV&&ag("Invalid template ref type:",l,`(${typeof l})`)};if(s){const t=()=>{a(),wv.delete(e)};t.id=-1,wv.set(e,t),Zy(t,n)}else xv(e),a()}else"production"!==process.env.NODE_ENV&&ag("Invalid template ref type:",l,`(${typeof l})`)}}function xv(e){const t=wv.get(e);t&&(t.flags|=8,wv.delete(e))}tf().requestIdleCallback,tf().cancelIdleCallback;const kv=e=>!!e.type.__asyncLoader,Cv=e=>e.type.__isKeepAlive;function Sv(e,t){Nv(e,"a",t)}function Mv(e,t){Nv(e,"da",t)}function Nv(e,t,n=Tw){const r=e.__wdc||(e.__wdc=()=>{let t=n;for(;t;){if(t.isDeactivated)return;t=t.parent}return e()});if(Ov(t,r,n),n){let e=n.parent;for(;e&&e.parent;)Cv(e.parent.vnode)&&Ev(r,t,n,e),e=e.parent}}function Ev(e,t,n,r){const o=Ov(t,e,r,!0);Lv(()=>{Mp(r[t],o)},n)}function Ov(e,t,n=Tw,r=!1){if(n){const o=n[e]||(n[e]=[]),i=t.__weh||(t.__weh=(...r)=>{jf();const o=Rw(n),i=hg(t,n,e,r);return o(),Vf(),i});return r?o.unshift(i):o.push(i),i}if("production"!==process.env.NODE_ENV){ag(`${Jp(dg[e].replace(/ hook$/,""))} is called when there is no active component instance to be associated with. Lifecycle injection APIs can only be used during execution of setup(). If you are using async setup(), make sure to register lifecycle hooks before the first await statement.`)}}const Av=e=>(t,n=Tw)=>{jw&&"sp"!==e||Ov(e,(...e)=>t(...e),n)},Tv=Av("bm"),Dv=Av("m"),Iv=Av("bu"),_v=Av("u"),Rv=Av("bum"),Lv=Av("um"),Bv=Av("sp"),Pv=Av("rtg"),zv=Av("rtc");function jv(e,t=Tw){Ov("ec",e,t)}const Vv=Symbol.for("v-ndc"),$v=e=>e?zw(e)?Fw(e):$v(e.parent):null,Hv=e=>{const t=e.subTree&&(e=>{let t=!1;for(;;){if(e.patchFlag>0&&2048&e.patchFlag){const n=yy(e.children);if(!n)return;e=n,t=!0;continue}const n=e.component;if(n&&n.subTree){e=n.subTree;continue}const r=e.suspense;if(!r||!r.activeBranch)return t?e.el:void 0;e=r.activeBranch}})(e.subTree);return void 0===t?e.vnode.el:t},qv=Sp(Object.create(null),{$:e=>e,$el:e=>"production"!==process.env.NODE_ENV?Hv(e):e.vnode.el,$data:e=>e.data,$props:e=>"production"!==process.env.NODE_ENV?Lm(e.props):e.props,$attrs:e=>"production"!==process.env.NODE_ENV?Lm(e.attrs):e.attrs,$slots:e=>"production"!==process.env.NODE_ENV?Lm(e.slots):e.slots,$refs:e=>"production"!==process.env.NODE_ENV?Lm(e.refs):e.refs,$parent:e=>$v(e.parent),$root:e=>$v(e.root),$host:e=>e.ce,$emit:e=>e.emit,$options:e=>__VUE_OPTIONS_API__?Xv(e):e.type,$forceUpdate:e=>e.f||(e.f=()=>{kg(e.update)}),$nextTick:e=>e.n||(e.n=xg.bind(e.proxy)),$watch:e=>__VUE_OPTIONS_API__?av.bind(e):bp}),Fv=e=>"_"===e||"$"===e,Wv=(e,t)=>e!==yp&&!e.__isScriptSetup&&Ep(e,t),Uv={get({_:e},t){if("__v_skip"===t)return!0;const{ctx:n,setupState:r,data:o,props:i,accessCache:s,type:a,appContext:l}=e;if("production"!==process.env.NODE_ENV&&"__isVue"===t)return!0;if("$"!==t[0]){const e=s[t];if(void 0!==e)switch(e){case 1:return r[t];case 2:return o[t];case 4:return n[t];case 3:return i[t]}else{if(Wv(r,t))return s[t]=1,r[t];if(__VUE_OPTIONS_API__&&o!==yp&&Ep(o,t))return s[t]=2,o[t];if(Ep(i,t))return s[t]=3,i[t];if(n!==yp&&Ep(n,t))return s[t]=4,n[t];__VUE_OPTIONS_API__&&!Kv||(s[t]=0)}}const c=qv[t];let d,u;return c?("$attrs"===t?(Zf(e.attrs,"get",""),"production"!==process.env.NODE_ENV&&my()):"production"!==process.env.NODE_ENV&&"$slots"===t&&Zf(e,"get",t),c(e)):(d=a.__cssModules)&&(d=d[t])?d:n!==yp&&Ep(n,t)?(s[t]=4,n[t]):(u=l.config.globalProperties,Ep(u,t)?u[t]:void("production"===process.env.NODE_ENV||!Yg||_p(t)&&0===t.indexOf("__v")||(o!==yp&&Fv(t[0])&&Ep(o,t)?ag(`Property ${JSON.stringify(t)} must be accessed via $data because it starts with a reserved character ("$" or "_") and is not proxied on the render context.`):e===Yg&&ag(`Property ${JSON.stringify(t)} was accessed during render but is not defined on instance.`))))},set({_:e},t,n){const{data:r,setupState:o,ctx:i}=e;return Wv(o,t)?(o[t]=n,!0):"production"!==process.env.NODE_ENV&&o.__isScriptSetup&&Ep(o,t)?(ag(`Cannot mutate <script setup> binding "${t}" from Options API.`),!1):__VUE_OPTIONS_API__&&r!==yp&&Ep(r,t)?(r[t]=n,!0):Ep(e.props,t)?("production"!==process.env.NODE_ENV&&ag(`Attempting to mutate prop "${t}". Props are readonly.`),!1):"$"===t[0]&&t.slice(1)in e?("production"!==process.env.NODE_ENV&&ag(`Attempting to mutate public property "${t}". Properties starting with $ are reserved and readonly.`),!1):("production"!==process.env.NODE_ENV&&t in e.appContext.config.globalProperties?Object.defineProperty(i,t,{enumerable:!0,configurable:!0,value:n}):i[t]=n,!0)},has({_:{data:e,setupState:t,accessCache:n,ctx:r,appContext:o,props:i,type:s}},a){let l;return!!(n[a]||__VUE_OPTIONS_API__&&e!==yp&&"$"!==a[0]&&Ep(e,a)||Wv(t,a)||Ep(i,a)||Ep(r,a)||Ep(qv,a)||Ep(o.config.globalProperties,a)||(l=s.__cssModules)&&l[a])},defineProperty(e,t,n){return null!=n.get?e._.accessCache[t]=0:Ep(n,"value")&&this.set(e,t,n.value,null),Reflect.defineProperty(e,t,n)}};function Gv(e){return Op(e)?e.reduce((e,t)=>(e[t]=null,e),{}):e}"production"!==process.env.NODE_ENV&&(Uv.ownKeys=e=>(ag("Avoid app logic that relies on enumerating keys on a component instance. The keys will be empty in production mode to avoid performance overhead."),Reflect.ownKeys(e)));let Kv=!0;function Jv(e){const t=Xv(e),n=e.proxy,r=e.ctx;Kv=!1,t.beforeCreate&&Zv(t.beforeCreate,e,"bc");const{data:o,computed:i,methods:s,watch:a,provide:l,inject:c,created:d,beforeMount:u,mounted:h,beforeUpdate:p,updated:f,activated:m,deactivated:g,beforeDestroy:v,beforeUnmount:y,destroyed:w,unmounted:b,render:x,renderTracked:k,renderTriggered:C,errorCaptured:S,serverPrefetch:M,expose:N,inheritAttrs:E,components:O,directives:A,filters:T}=t,D="production"!==process.env.NODE_ENV?function(){const e=Object.create(null);return(t,n)=>{e[n]?ag(`${t} property "${n}" is already defined in ${e[n]}.`):e[n]=t}}():null;if("production"!==process.env.NODE_ENV){const[t]=e.propsOptions;if(t)for(const e in t)D("Props",e)}if(c&&function(e,t,n=bp){Op(e)&&(e=ny(e));for(const r in e){const o=e[r];let i;i=Lp(o)?"default"in o?nv(o.from||r,o.default,!0):nv(o.from||r):nv(o),Fm(i)?Object.defineProperty(t,r,{enumerable:!0,configurable:!0,get:()=>i.value,set:e=>i.value=e}):t[r]=i,"production"!==process.env.NODE_ENV&&n("Inject",r)}}(c,r,D),s)for(const e in s){const t=s[e];Ip(t)?("production"!==process.env.NODE_ENV?Object.defineProperty(r,e,{value:t.bind(n),configurable:!0,enumerable:!0,writable:!0}):r[e]=t.bind(n),"production"!==process.env.NODE_ENV&&D("Methods",e)):"production"!==process.env.NODE_ENV&&ag(`Method "${e}" has type "${typeof t}" in the component definition. Did you reference the function correctly?`)}if(o){"production"===process.env.NODE_ENV||Ip(o)||ag("The data option must be a function. Plain object usage is no longer supported.");const t=o.call(n,n);if("production"!==process.env.NODE_ENV&&Bp(t)&&ag("data() returned a Promise - note data() cannot be async; If you intend to perform data fetching before component renders, use async setup() + <Suspense>."),Lp(t)){if(e.data=_m(t),"production"!==process.env.NODE_ENV)for(const e in t)D("Data",e),Fv(e[0])||Object.defineProperty(r,e,{configurable:!0,enumerable:!0,get:()=>t[e],set:bp})}else"production"!==process.env.NODE_ENV&&ag("data() should return an object.")}if(Kv=!0,i)for(const e in i){const t=i[e],o=Ip(t)?t.bind(n,n):Ip(t.get)?t.get.bind(n,n):bp;"production"!==process.env.NODE_ENV&&o===bp&&ag(`Computed property "${e}" has no getter.`);const s=!Ip(t)&&Ip(t.set)?t.set.bind(n):"production"!==process.env.NODE_ENV?()=>{ag(`Write operation failed: computed property "${e}" is readonly.`)}:bp,a=Zw({get:o,set:s});Object.defineProperty(r,e,{enumerable:!0,configurable:!0,get:()=>a.value,set:e=>a.value=e}),"production"!==process.env.NODE_ENV&&D("Computed",e)}if(a)for(const e in a)Yv(a[e],r,n,e);if(l){const e=Ip(l)?l.call(n):l;Reflect.ownKeys(e).forEach(t=>{!function(e,t){if("production"!==process.env.NODE_ENV&&(Tw&&!Tw.isMounted||ag("provide() can only be used inside setup().")),Tw){let n=Tw.provides;const r=Tw.parent&&Tw.parent.provides;r===n&&(n=Tw.provides=Object.create(r)),n[e]=t}}(t,e[t])})}function I(e,t){Op(t)?t.forEach(t=>e(t.bind(n))):t&&e(t.bind(n))}if(d&&Zv(d,e,"c"),I(Tv,u),I(Dv,h),I(Iv,p),I(_v,f),I(Sv,m),I(Mv,g),I(jv,S),I(zv,k),I(Pv,C),I(Rv,y),I(Lv,b),I(Bv,M),Op(N))if(N.length){const t=e.exposed||(e.exposed={});N.forEach(e=>{Object.defineProperty(t,e,{get:()=>n[e],set:t=>n[e]=t,enumerable:!0})})}else e.exposed||(e.exposed={});x&&e.render===bp&&(e.render=x),null!=E&&(e.inheritAttrs=E),O&&(e.components=O),A&&(e.directives=A),M&&gv(e)}function Zv(e,t,n){hg(Op(e)?e.map(e=>e.bind(t.proxy)):e.bind(t.proxy),t,n)}function Yv(e,t,n,r){let o=r.includes(".")?lv(n,r):()=>n[r];if(_p(e)){const n=t[e];Ip(n)?iv(o,n):"production"!==process.env.NODE_ENV&&ag(`Invalid watch handler specified by key "${e}"`,n)}else if(Ip(e))iv(o,e.bind(n));else if(Lp(e))if(Op(e))e.forEach(e=>Yv(e,t,n,r));else{const r=Ip(e.handler)?e.handler.bind(n):t[e.handler];Ip(r)?iv(o,r,e):"production"!==process.env.NODE_ENV&&ag(`Invalid watch handler specified by key "${e.handler}"`,r)}else"production"!==process.env.NODE_ENV&&ag(`Invalid watch option: "${r}"`,e)}function Xv(e){const t=e.type,{mixins:n,extends:r}=t,{mixins:o,optionsCache:i,config:{optionMergeStrategies:s}}=e.appContext,a=i.get(t);let l;return a?l=a:o.length||n||r?(l={},o.length&&o.forEach(e=>Qv(l,e,s,!0)),Qv(l,t,s)):l=t,Lp(t)&&i.set(t,l),l}function Qv(e,t,n,r=!1){const{mixins:o,extends:i}=t;i&&Qv(e,i,n,!0),o&&o.forEach(t=>Qv(e,t,n,!0));for(const o in t)if(r&&"expose"===o)"production"!==process.env.NODE_ENV&&ag('"expose" option is ignored when declared in mixins or extends. It should only be declared in the base component itself.');else{const r=ey[o]||n&&n[o];e[o]=r?r(e[o],t[o]):t[o]}return e}const ey={data:ty,props:iy,emits:iy,methods:oy,computed:oy,beforeCreate:ry,created:ry,beforeMount:ry,mounted:ry,beforeUpdate:ry,updated:ry,beforeDestroy:ry,beforeUnmount:ry,destroyed:ry,unmounted:ry,activated:ry,deactivated:ry,errorCaptured:ry,serverPrefetch:ry,components:oy,directives:oy,watch:function(e,t){if(!e)return t;if(!t)return e;const n=Sp(Object.create(null),e);for(const r in t)n[r]=ry(e[r],t[r]);return n},provide:ty,inject:function(e,t){return oy(ny(e),ny(t))}};function ty(e,t){return t?e?function(){return Sp(Ip(e)?e.call(this,this):e,Ip(t)?t.call(this,this):t)}:t:e}function ny(e){if(Op(e)){const t={};for(let n=0;n<e.length;n++)t[e[n]]=e[n];return t}return e}function ry(e,t){return e?[...new Set([].concat(e,t))]:t}function oy(e,t){return e?Sp(Object.create(null),e,t):t}function iy(e,t){return e?Op(e)&&Op(t)?[...new Set([...e,...t])]:Sp(Object.create(null),Gv(e),Gv(null!=t?t:{})):t}function sy(){return{app:null,config:{isNativeTag:xp,performance:!1,globalProperties:{},optionMergeStrategies:{},errorHandler:void 0,warnHandler:void 0,compilerOptions:{}},mixins:[],components:{},directives:{},provides:Object.create(null),optionsCache:new WeakMap,propsCache:new WeakMap,emitsCache:new WeakMap}}let ay=0;function ly(e,t){return function(t,n=null){Ip(t)||(t=Sp({},t)),null==n||Lp(n)||("production"!==process.env.NODE_ENV&&ag("root props passed to app.mount() must be an object."),n=null);const r=sy(),o=new WeakSet,i=[];let s=!1;const a=r.app={_uid:ay++,_component:t,_props:n,_container:null,_context:r,_instance:null,version:Xw,get config(){return r.config},set config(e){"production"!==process.env.NODE_ENV&&ag("app.config cannot be replaced. Modify individual options instead.")},use:(e,...t)=>(o.has(e)?"production"!==process.env.NODE_ENV&&ag("Plugin has already been applied to target app."):e&&Ip(e.install)?(o.add(e),e.install(a,...t)):Ip(e)?(o.add(e),e(a,...t)):"production"!==process.env.NODE_ENV&&ag('A plugin must either be a function or an object with an "install" function.'),a),mixin:e=>(__VUE_OPTIONS_API__?r.mixins.includes(e)?"production"!==process.env.NODE_ENV&&ag("Mixin has already been applied to target app"+(e.name?`: ${e.name}`:"")):r.mixins.push(e):"production"!==process.env.NODE_ENV&&ag("Mixins are only available in builds supporting Options API"),a),component:(e,t)=>("production"!==process.env.NODE_ENV&&Pw(e,r.config),t?("production"!==process.env.NODE_ENV&&r.components[e]&&ag(`Component "${e}" has already been registered in target app.`),r.components[e]=t,a):r.components[e]),directive:(e,t)=>("production"!==process.env.NODE_ENV&&ev(e),t?("production"!==process.env.NODE_ENV&&r.directives[e]&&ag(`Directive "${e}" has already been registered in target app.`),r.directives[e]=t,a):r.directives[e]),mount(o,i,l){if(!s){"production"!==process.env.NODE_ENV&&o.__vue_app__&&ag("There is already an app instance mounted on the host container.\n If you want to mount another app on the same host container, you need to unmount the previous app by calling `app.unmount()` first.");const i=a._ceVNode||ww(t,n);return i.appContext=r,!0===l?l="svg":!1===l&&(l=void 0),"production"!==process.env.NODE_ENV&&(r.reload=()=>{const t=xw(i);t.el=null,e(t,o,l)}),e(i,o,l),s=!0,a._container=o,o.__vue_app__=a,("production"!==process.env.NODE_ENV||__VUE_PROD_DEVTOOLS__)&&(a._instance=i.component,function(e,t){Hg("app:init",e,t,{Fragment:iw,Text:sw,Comment:aw,Static:lw})}(a,Xw)),Fw(i.component)}"production"!==process.env.NODE_ENV&&ag("App has already been mounted.\nIf you want to remount the same app, move your app creation logic into a factory function and create fresh app instances for each mount - e.g. `const createMyApp = () => createApp(App)`")},onUnmount(e){"production"!==process.env.NODE_ENV&&"function"!=typeof e&&ag("Expected function as first argument to app.onUnmount(), but got "+typeof e),i.push(e)},unmount(){s?(hg(i,a._instance,16),e(null,a._container),("production"!==process.env.NODE_ENV||__VUE_PROD_DEVTOOLS__)&&(a._instance=null,function(e){Hg("app:unmount",e)}(a)),delete a._container.__vue_app__):"production"!==process.env.NODE_ENV&&ag("Cannot unmount an app that is not mounted.")},provide:(e,t)=>("production"!==process.env.NODE_ENV&&e in r.provides&&(Ep(r.provides,e)?ag(`App already provides property with key "${String(e)}". It will be overwritten with the new value.`):ag(`App already provides property with key "${String(e)}" inherited from its parent element. It will be overwritten with the new value.`)),r.provides[e]=t,a),runWithContext(e){const t=cy;cy=a;try{return e()}finally{cy=t}}};return a}}let cy=null;function dy(e,t,...n){if(e.isUnmounted)return;const r=e.vnode.props||yp;if("production"!==process.env.NODE_ENV){const{emitsOptions:r,propsOptions:[o]}=e;if(r)if(t in r){const e=r[t];if(Ip(e)){e(...n)||ag(`Invalid event arguments: event validation failed for event "${t}".`)}}else o&&Jp(Wp(t))in o||ag(`Component emitted event "${t}" but it is neither declared in the emits option nor as an "${Jp(Wp(t))}" prop.`)}let o=n;const i=t.startsWith("update:"),s=i&&((e,t)=>"modelValue"===t||"model-value"===t?e.modelModifiers:e[`${t}Modifiers`]||e[`${Wp(t)}Modifiers`]||e[`${Gp(t)}Modifiers`])(r,t.slice(7));if(s&&(s.trim&&(o=n.map(e=>_p(e)?e.trim():e)),s.number&&(o=o.map(Qp))),("production"!==process.env.NODE_ENV||__VUE_PROD_DEVTOOLS__)&&function(e,t,n){Hg("component:emit",e.appContext.app,e,t,n)}(e,t,o),"production"!==process.env.NODE_ENV){const n=t.toLowerCase();n!==t&&r[Jp(n)]&&ag(`Event "${n}" is emitted in component ${Kw(e,e.type)} but the handler is registered for "${t}". Note that HTML attributes are case-insensitive and you cannot use v-on to listen to camelCase events when using in-DOM templates. You should probably use "${Gp(t)}" instead of "${t}".`)}let a,l=r[a=Jp(t)]||r[a=Jp(Wp(t))];!l&&i&&(l=r[a=Jp(Gp(t))]),l&&hg(l,e,6,o);const c=r[a+"Once"];if(c){if(e.emitted){if(e.emitted[a])return}else e.emitted={};e.emitted[a]=!0,hg(c,e,6,o)}}const uy=new WeakMap;function hy(e,t,n=!1){const r=__VUE_OPTIONS_API__&&n?uy:t.emitsCache,o=r.get(e);if(void 0!==o)return o;const i=e.emits;let s={},a=!1;if(__VUE_OPTIONS_API__&&!Ip(e)){const r=e=>{const n=hy(e,t,!0);n&&(a=!0,Sp(s,n))};!n&&t.mixins.length&&t.mixins.forEach(r),e.extends&&r(e.extends),e.mixins&&e.mixins.forEach(r)}return i||a?(Op(i)?i.forEach(e=>s[e]=null):Sp(s,i),Lp(e)&&r.set(e,s),s):(Lp(e)&&r.set(e,null),null)}function py(e,t){return!(!e||!kp(t))&&(t="Once"===(t=t.slice(2))?t:t.replace(/Once$/,""),Ep(e,t[0].toLowerCase()+t.slice(1))||Ep(e,Gp(t))||Ep(e,t))}let fy=!1;function my(){fy=!0}function gy(e){const{type:t,vnode:n,proxy:r,withProxy:o,propsOptions:[i],slots:s,attrs:a,emit:l,render:c,renderCache:d,props:u,data:h,setupState:p,ctx:f,inheritAttrs:m}=e,g=Qg(e);let v,y;"production"!==process.env.NODE_ENV&&(fy=!1);try{if(4&n.shapeFlag){const e=o||r,t="production"!==process.env.NODE_ENV&&p.__isScriptSetup?new Proxy(e,{get:(e,t,n)=>(ag(`Property '${String(t)}' was accessed via 'this'. Avoid using 'this' in templates.`),Reflect.get(e,t,n))}):e;v=Sw(c.call(t,e,d,"production"!==process.env.NODE_ENV?Lm(u):u,p,h,f)),y=a}else{const e=t;"production"!==process.env.NODE_ENV&&a===u&&my(),v=Sw(e.length>1?e("production"!==process.env.NODE_ENV?Lm(u):u,"production"!==process.env.NODE_ENV?{get attrs(){return my(),Lm(a)},slots:s,emit:l}:{attrs:a,slots:s,emit:l}):e("production"!==process.env.NODE_ENV?Lm(u):u,null)),y=t.props?a:wy(a)}}catch(t){cw.length=0,pg(t,e,1),v=ww(aw)}let w,b=v;if("production"!==process.env.NODE_ENV&&v.patchFlag>0&&2048&v.patchFlag&&([b,w]=vy(v)),y&&!1!==m){const e=Object.keys(y),{shapeFlag:t}=b;if(e.length)if(7&t)i&&e.some(Cp)&&(y=by(y,i)),b=xw(b,y,!1,!0);else if("production"!==process.env.NODE_ENV&&!fy&&b.type!==aw){const e=Object.keys(a),t=[],n=[];for(let r=0,o=e.length;r<o;r++){const o=e[r];kp(o)?Cp(o)||t.push(o[2].toLowerCase()+o.slice(3)):n.push(o)}n.length&&ag(`Extraneous non-props attributes (${n.join(", ")}) were passed to component but could not be automatically inherited because component renders fragment or text or teleport root nodes.`),t.length&&ag(`Extraneous non-emits event listeners (${t.join(", ")}) were passed to component but could not be automatically inherited because component renders fragment or text root nodes. If the listener is intended to be a component custom event listener only, declare it using the "emits" option.`)}}if(n.dirs&&("production"===process.env.NODE_ENV||xy(b)||ag("Runtime directive used on component with non-element root node. The directives will not function as intended."),b=xw(b,null,!1,!0),b.dirs=b.dirs?b.dirs.concat(n.dirs):n.dirs),n.transition){const e=dv(b.type)&&hv(b)||b;"production"===process.env.NODE_ENV||xy(e)||ag("Component inside <Transition> renders non-element root node that cannot be animated."),pv(e,n.transition)}return"production"!==process.env.NODE_ENV&&w?w(b):v=b,Qg(g),v}const vy=e=>{const t=e.children,n=e.dynamicChildren,r=yy(t,!1);if(!r)return[e,void 0];if("production"!==process.env.NODE_ENV&&r.patchFlag>0&&2048&r.patchFlag)return vy(r);const o=t.indexOf(r),i=n?n.indexOf(r):-1;return[Sw(r),r=>{t[o]=r,n&&(i>-1?n[i]=r:r.patchFlag>0&&(e.dynamicChildren=[...n,r]))}]};function yy(e,t=!0){let n;for(let r=0;r<e.length;r++){const o=e[r];if(!fw(o))return;if(o.type!==aw||"v-if"===o.children){if(n)return;if(n=o,"production"!==process.env.NODE_ENV&&t&&n.patchFlag>0&&2048&n.patchFlag)return yy(n.children)}}return n}const wy=e=>{let t;for(const n in e)("class"===n||"style"===n||kp(n))&&((t||(t={}))[n]=e[n]);return t},by=(e,t)=>{const n={};for(const r in e)Cp(r)&&r.slice(9)in t||(n[r]=e[r]);return n},xy=e=>7&e.shapeFlag||e.type===aw;function ky(e,t,n){const r=Object.keys(t);if(r.length!==Object.keys(e).length)return!0;for(let o=0;o<r.length;o++){const i=r[o];if(!Ep(e,i)||Cy(t,e,i)&&!py(n,i))return!0}return!1}function Cy(e,t,n){const r=e[n],o=t[n];return"style"===n&&Lp(r)&&Lp(o)?!yf(r,o):r!==o}const Sy={},My=()=>Object.create(Sy),Ny=e=>Object.getPrototypeOf(e)===Sy;function Ey(e,t,n,r=!1){const o={},i=My();e.propsDefaults=Object.create(null),Oy(e,t,o,i);for(const t in e.propsOptions[0])t in o||(o[t]=void 0);"production"!==process.env.NODE_ENV&&_y(t||{},o,e),n?e.props=r?o:Bm(o,!1,vm,Mm,Tm):e.type.props?e.props=o:e.props=i,e.attrs=i}function Oy(e,t,n,r){const[o,i]=e.propsOptions;let s,a=!1;if(t)for(let l in t){if($p(l))continue;const c=t[l];let d;o&&Ep(o,d=Wp(l))?i&&i.includes(d)?(s||(s={}))[d]=c:n[d]=c:py(e.emitsOptions,l)||l in r&&c===r[l]||(r[l]=c,a=!0)}if(i){const t=$m(n),r=s||yp;for(let s=0;s<i.length;s++){const a=i[s];n[a]=Ay(o,t,a,r[a],e,!Ep(r,a))}}return a}function Ay(e,t,n,r,o,i){const s=e[n];if(null!=s){const e=Ep(s,"default");if(e&&void 0===r){const e=s.default;if(s.type!==Function&&!s.skipFactory&&Ip(e)){const{propsDefaults:i}=o;if(n in i)r=i[n];else{const s=Rw(o);r=i[n]=e.call(null,t),s()}}else r=e;o.ce&&o.ce._setProp(n,r)}s[0]&&(i&&!e?r=!1:!s[1]||""!==r&&r!==Gp(n)||(r=!0))}return r}const Ty=new WeakMap;function Dy(e,t,n=!1){const r=__VUE_OPTIONS_API__&&n?Ty:t.propsCache,o=r.get(e);if(o)return o;const i=e.props,s={},a=[];let l=!1;if(__VUE_OPTIONS_API__&&!Ip(e)){const r=e=>{l=!0;const[n,r]=Dy(e,t,!0);Sp(s,n),r&&a.push(...r)};!n&&t.mixins.length&&t.mixins.forEach(r),e.extends&&r(e.extends),e.mixins&&e.mixins.forEach(r)}if(!i&&!l)return Lp(e)&&r.set(e,wp),wp;if(Op(i))for(let e=0;e<i.length;e++){"production"===process.env.NODE_ENV||_p(i[e])||ag("props must be strings when using array syntax.",i[e]);const t=Wp(i[e]);Iy(t)&&(s[t]=yp)}else if(i){"production"===process.env.NODE_ENV||Lp(i)||ag("invalid props options",i);for(const e in i){const t=Wp(e);if(Iy(t)){const n=i[e],r=s[t]=Op(n)||Ip(n)?{type:n}:Sp({},n),o=r.type;let l=!1,c=!0;if(Op(o))for(let e=0;e<o.length;++e){const t=o[e],n=Ip(t)&&t.name;if("Boolean"===n){l=!0;break}"String"===n&&(c=!1)}else l=Ip(o)&&"Boolean"===o.name;r[0]=l,r[1]=c,(l||Ep(r,"default"))&&a.push(t)}}}const c=[s,a];return Lp(e)&&r.set(e,c),c}function Iy(e){return"$"!==e[0]&&!$p(e)||("production"!==process.env.NODE_ENV&&ag(`Invalid prop name: "${e}" is a reserved property.`),!1)}function _y(e,t,n){const r=$m(t),o=n.propsOptions[0],i=Object.keys(e).map(e=>Wp(e));for(const e in o){let t=o[e];null!=t&&Ry(e,r[e],t,"production"!==process.env.NODE_ENV?Lm(r):r,!i.includes(e))}}function Ry(e,t,n,r,o){const{type:i,required:s,validator:a,skipCheck:l}=n;if(s&&o)ag('Missing required prop: "'+e+'"');else if(null!=t||s){if(null!=i&&!0!==i&&!l){let n=!1;const r=Op(i)?i:[i],o=[];for(let e=0;e<r.length&&!n;e++){const{valid:i,expectedType:s}=By(t,r[e]);o.push(s||""),n=i}if(!n)return void ag(function(e,t,n){if(0===n.length)return`Prop type [] for prop "${e}" won't match anything. Did you mean to use type Array instead?`;let r=`Invalid prop: type check failed for prop "${e}". Expected ${n.map(Kp).join(" | ")}`;const o=n[0],i=jp(t),s=Py(t,o),a=Py(t,i);1===n.length&&zy(o)&&function(...e){return e.every(e=>{const t=e.toLowerCase();return"boolean"!==t&&"symbol"!==t})}(o,i)&&(r+=` with value ${s}`);r+=`, got ${i} `,zy(i)&&(r+=`with value ${a}.`);return r}(e,t,o))}a&&!a(t,r)&&ag('Invalid prop: custom validator check failed for prop "'+e+'".')}}const Ly=vp("String,Number,Boolean,Function,Symbol,BigInt");function By(e,t){let n;const r=function(e){if(null===e)return"null";if("function"==typeof e)return e.name||"";if("object"==typeof e)return e.constructor&&e.constructor.name||"";return""}(t);if("null"===r)n=null===e;else if(Ly(r)){const o=typeof e;n=o===r.toLowerCase(),n||"object"!==o||(n=e instanceof t)}else n="Object"===r?Lp(e):"Array"===r?Op(e):e instanceof t;return{valid:n,expectedType:r}}function Py(e,t){return Rp(e)?e.toString():"String"===t?`"${e}"`:"Number"===t?`${Number(e)}`:`${e}`}function zy(e){return["string","number","boolean"].some(t=>e.toLowerCase()===t)}const jy=e=>"_"===e||"_ctx"===e||"$stable"===e,Vy=e=>Op(e)?e.map(Sw):[Sw(e)],$y=(e,t,n)=>{if(t._n)return t;const r=function(e,t=Yg){if(!t)return e;if(e._n)return e;const n=(...r)=>{n._d&&pw(-1);const o=Qg(t),i=cw.length;let s;try{s=e(...r)}finally{for(let e=cw.length;e>i;e--)uw();Qg(o),n._d&&pw(1)}return("production"!==process.env.NODE_ENV||__VUE_PROD_DEVTOOLS__)&&Wg(t),s};return n._n=!0,n._c=!0,n._d=!0,n}((...r)=>("production"===process.env.NODE_ENV||!Tw||null===n&&Yg||n&&n.root!==Tw.root||ag(`Slot "${e}" invoked outside of the render function: this will not track dependencies used in the slot. Invoke the slot function inside the render function instead.`),Vy(t(...r))),n);return r._c=!1,r},Hy=(e,t,n)=>{const r=e._ctx;for(const n in e){if(jy(n))continue;const o=e[n];if(Ip(o))t[n]=$y(n,o,r);else if(null!=o){"production"!==process.env.NODE_ENV&&ag(`Non-function value encountered for slot "${n}". Prefer function slots for better performance.`);const e=Vy(o);t[n]=()=>e}}},qy=(e,t)=>{"production"===process.env.NODE_ENV||Cv(e.vnode)||ag("Non-function value encountered for default slot. Prefer function slots for better performance.");const n=Vy(t);e.slots.default=()=>n},Fy=(e,t,n)=>{for(const r in t)!n&&jy(r)||(e[r]=t[r])};let Wy,Uy;function Gy(e,t){e.appContext.config.performance&&Jy()&&Uy.mark(`vue-${t}-${e.uid}`),("production"!==process.env.NODE_ENV||__VUE_PROD_DEVTOOLS__)&&Kg(e,t,Jy()?Uy.now():Date.now())}function Ky(e,t){if(e.appContext.config.performance&&Jy()){const n=`vue-${t}-${e.uid}`,r=n+":end",o=`<${Kw(e,e.type)}> ${t}`;Uy.mark(r),Uy.measure(o,n,r),Uy.clearMeasures(o),Uy.clearMarks(n),Uy.clearMarks(r)}("production"!==process.env.NODE_ENV||__VUE_PROD_DEVTOOLS__)&&Jg(e,t,Jy()?Uy.now():Date.now())}function Jy(){return void 0!==Wy||("undefined"!=typeof window&&window.performance?(Wy=!0,Uy=window.performance):Wy=!1),Wy}const Zy=function(e,t){t&&t.pendingBranch?Op(e)?t.effects.push(...e):t.effects.push(e):Sg(e)};function Yy(e){return function(e){!function(){const e=[];if("boolean"!=typeof __VUE_OPTIONS_API__&&("production"!==process.env.NODE_ENV&&e.push("__VUE_OPTIONS_API__"),tf().__VUE_OPTIONS_API__=!0),"boolean"!=typeof __VUE_PROD_DEVTOOLS__&&("production"!==process.env.NODE_ENV&&e.push("__VUE_PROD_DEVTOOLS__"),tf().__VUE_PROD_DEVTOOLS__=!1),"boolean"!=typeof __VUE_PROD_HYDRATION_MISMATCH_DETAILS__&&("production"!==process.env.NODE_ENV&&e.push("__VUE_PROD_HYDRATION_MISMATCH_DETAILS__"),tf().__VUE_PROD_HYDRATION_MISMATCH_DETAILS__=!1),"production"!==process.env.NODE_ENV&&e.length){const t=e.length>1;console.warn(`Feature flag${t?"s":""} ${e.join(", ")} ${t?"are":"is"} not explicitly defined. You are running the esm-bundler build of Vue, which expects these compile-time feature flags to be globally injected via the bundler config in order to get better tree-shaking in the production bundle.\n\nFor more details, see https://link.vuejs.org/feature-flags.`)}}();const t=tf();t.__VUE__=!0,"production"===process.env.NODE_ENV&&!__VUE_PROD_DEVTOOLS__||qg(t.__VUE_DEVTOOLS_GLOBAL_HOOK__,t);const{insert:n,remove:r,patchProp:o,createElement:i,createText:s,createComment:a,setText:l,setElementText:c,parentNode:d,nextSibling:u,setScopeId:h=bp,insertStaticContent:p}=e,f=(e,t,n,r=null,o=null,i=null,s=void 0,a=null,l=("production"===process.env.NODE_ENV||!Dg)&&!!t.dynamicChildren)=>{if(e===t)return;e&&!mw(e,t)&&(r=q(e),z(e,o,i,!0),e=null),-2===t.patchFlag&&(l=!1,t.dynamicChildren=null),t.dynamicChildren&&e&&e.dynamicChildren&&e.dynamicChildren.hasOnce&&(t.dynamicChildren===wp&&(t.dynamicChildren=[]),t.dynamicChildren.hasOnce=!0);const{type:c,ref:d,shapeFlag:u}=t;switch(c){case sw:m(e,t,n,r);break;case aw:g(e,t,n,r);break;case lw:null==e?v(t,n,r,s):"production"!==process.env.NODE_ENV&&y(e,t,n,s);break;case iw:O(e,t,n,r,o,i,s,a,l);break;default:1&u?x(e,t,n,r,o,i,s,a,l):6&u?A(e,t,n,r,o,i,s,a,l):64&u||128&u?c.process(e,t,n,r,o,i,s,a,l,W):"production"!==process.env.NODE_ENV&&ag("Invalid VNode type:",c,`(${typeof c})`)}null!=d&&o?bv(d,e&&e.ref,i,t||e,!t):null==d&&e&&null!=e.ref&&bv(e.ref,null,i,e,!0)},m=(e,t,r,o)=>{if(null==e)n(t.el=s(t.children),r,o);else{const n=t.el=e.el;t.children!==e.children&&l(n,t.children)}},g=(e,t,r,o)=>{null==e?n(t.el=a(t.children||""),r,o):t.el=e.el},v=(e,t,n,r)=>{[e.el,e.anchor]=p(e.children,t,n,r,e.el,e.anchor)},y=(e,t,n,r)=>{if(t.children!==e.children){const o=u(e.anchor);b(e),[t.el,t.anchor]=p(t.children,n,o,r)}else t.el=e.el,t.anchor=e.anchor},w=({el:e,anchor:t},r,o)=>{let i;for(;e&&e!==t;)i=u(e),n(e,r,o),e=i;n(t,r,o)},b=({el:e,anchor:t})=>{let n;for(;e&&e!==t;)n=u(e),r(e),e=n;r(t)},x=(e,t,n,r,o,i,s,a,l)=>{if("svg"===t.type?s="svg":"math"===t.type&&(s="mathml"),null==e)k(t,n,r,o,i,s,a,l);else{const n=e.el&&e.el._isVueCE?e.el:null;try{n&&n._beginPatch(),M(e,t,o,i,s,a,l)}finally{n&&n._endPatch()}}},k=(e,t,r,s,a,l,d,u)=>{let h,p;const{props:f,shapeFlag:m,transition:g,dirs:v}=e;if(h=e.el=i(e.type,l,f&&f.is,f),8&m?c(h,e.children):16&m&&S(e.children,h,null,s,a,Xy(e,l),d,u),v&&tv(e,null,s,"created"),C(h,e,e.scopeId,d,s),f){for(const e in f)"value"===e||$p(e)||o(h,e,null,f[e],l,s);"value"in f&&o(h,"value",null,f.value,l),(p=f.onVnodeBeforeMount)&&Ew(p,s,e)}("production"!==process.env.NODE_ENV||__VUE_PROD_DEVTOOLS__)&&(Xp(h,"__vnode",e,!0),Xp(h,"__vueParentComponent",s,!0)),v&&tv(e,null,s,"beforeMount");const y=function(e,t){return(!e||e&&!e.pendingBranch)&&t&&!t.persisted}(a,g);if(y&&g.beforeEnter(h),n(h,t,r),(p=f&&f.onVnodeMounted)||y||v){const t=!("production"===process.env.NODE_ENV)&&Dg;Zy(()=>{let n;"production"!==process.env.NODE_ENV&&(n=Ig(t));try{p&&Ew(p,s,e),y&&g.enter(h),v&&tv(e,null,s,"mounted")}finally{"production"!==process.env.NODE_ENV&&Ig(n)}},a)}},C=(e,t,n,r,o)=>{if(n&&h(e,n),r)for(let t=0;t<r.length;t++)h(e,r[t]);if(o){let n=o.subTree;if("production"!==process.env.NODE_ENV&&n.patchFlag>0&&2048&n.patchFlag&&(n=yy(n.children)||n),t===n||ow(n.type)&&(n.ssContent===t||n.ssFallback===t)){const t=o.vnode;C(e,t,t.scopeId,t.slotScopeIds,o.parent)}}},S=(e,t,n,r,o,i,s,a,l=0)=>{for(let c=l;c<e.length;c++){const l=e[c]=a?Mw(e[c]):Sw(e[c]);f(null,l,t,n,r,o,i,s,a)}},M=(e,t,n,r,i,s,a)=>{const l=t.el=e.el;("production"!==process.env.NODE_ENV||__VUE_PROD_DEVTOOLS__)&&(l.__vnode=t);let{patchFlag:d,dynamicChildren:u,dirs:h}=t;d|=16&e.patchFlag;const p=e.props||yp,f=t.props||yp;let m;if(n&&Qy(n,!1),(m=f.onVnodeBeforeUpdate)&&Ew(m,n,t,e),h&&tv(t,e,n,"beforeUpdate"),n&&Qy(n,!0),("production"!==process.env.NODE_ENV&&Dg||u&&(!e.dynamicChildren||e.dynamicChildren.length!==u.length))&&(d=0,a=!1,u=null),(p.innerHTML&&null==f.innerHTML||p.textContent&&null==f.textContent)&&c(l,""),u?(N(e.dynamicChildren,u,l,n,r,Xy(t,i),s),"production"!==process.env.NODE_ENV&&ew(e,t)):a||R(e,t,l,null,n,r,Xy(t,i),s,!1),d>0){if(16&d)E(l,p,f,n,i);else if(2&d&&p.class!==f.class&&o(l,"class",null,f.class,i),4&d&&o(l,"style",p.style,f.style,i),8&d){const e=t.dynamicProps;for(let t=0;t<e.length;t++){const r=e[t],s=p[r],a=f[r];a===s&&"value"!==r||o(l,r,s,a,i,n)}}1&d&&e.children!==t.children&&c(l,t.children)}else a||null!=u||E(l,p,f,n,i);((m=f.onVnodeUpdated)||h)&&Zy(()=>{m&&Ew(m,n,t,e),h&&tv(t,e,n,"updated")},r)},N=(e,t,n,r,o,i,s)=>{for(let a=0;a<t.length;a++){const l=e[a],c=t[a],u=l.el||rw(l),h=u&&(l.type===iw||!mw(l,c)||198&l.shapeFlag)?d(u):n;f(l,c,h,null,r,o,i,s,!0)}},E=(e,t,n,r,i)=>{if(t!==n){if(t!==yp)for(const s in t)$p(s)||s in n||o(e,s,t[s],null,i,r);for(const s in n){if($p(s))continue;const a=n[s],l=t[s];a!==l&&"value"!==s&&o(e,s,l,a,i,r)}"value"in n&&o(e,"value",t.value,n.value,i)}},O=(e,t,r,o,i,a,l,c,d)=>{const u=t.el=e?e.el:s(""),h=t.anchor=e?e.anchor:s("");let{patchFlag:p,dynamicChildren:f,slotScopeIds:m}=t;"production"!==process.env.NODE_ENV&&(Dg||2048&p)&&(p=0,d=!1,f=null),m&&(c=c?c.concat(m):m),null==e?(n(u,r,o),n(h,r,o),S(t.children||[],r,h,i,a,l,c,d)):p>0&&64&p&&f&&e.dynamicChildren&&e.dynamicChildren.length===f.length?(N(e.dynamicChildren,f,r,i,a,l,c),"production"!==process.env.NODE_ENV?ew(e,t):(null!=t.key||i&&t===i.subTree)&&ew(e,t,!0)):R(e,t,r,h,i,a,l,c,d)},A=(e,t,n,r,o,i,s,a,l)=>{t.slotScopeIds=a,null==e?512&t.shapeFlag?o.ctx.activate(t,n,r,s,l):T(t,n,r,o,i,s,l):D(e,t,l)},T=(e,t,n,r,o,i,s)=>{const a=e.component=function(e,t,n){const r=e.type,o=(t?t.appContext:e.appContext)||Ow,i={uid:Aw++,vnode:e,type:r,parent:t,appContext:o,root:null,next:null,subTree:null,effect:null,update:null,job:null,scope:new kf(!0),render:null,proxy:null,exposed:null,exposeProxy:null,withProxy:null,provides:t?t.provides:Object.create(o.provides),ids:t?t.ids:["",0,0],accessCache:null,renderCache:[],components:null,directives:null,propsOptions:Dy(r,o),emitsOptions:hy(r,o),emit:null,emitted:null,propsDefaults:yp,inheritAttrs:r.inheritAttrs,ctx:yp,data:yp,props:yp,attrs:yp,slots:yp,refs:yp,setupState:yp,setupContext:null,suspense:n,suspenseId:n?n.pendingId:0,asyncDep:null,asyncResolved:!1,isMounted:!1,isUnmounted:!1,isDeactivated:!1,bc:null,c:null,bm:null,m:null,bu:null,u:null,um:null,bum:null,da:null,a:null,rtg:null,rtc:null,ec:null,sp:null};"production"!==process.env.NODE_ENV?i.ctx=function(e){const t={};return Object.defineProperty(t,"_",{configurable:!0,enumerable:!1,get:()=>e}),Object.keys(qv).forEach(n=>{Object.defineProperty(t,n,{configurable:!0,enumerable:!1,get:()=>qv[n](e),set:bp})}),t}(i):i.ctx={_:i};i.root=t?t.root:i,i.emit=dy.bind(null,i),e.ce&&e.ce(i);return i}(e,r,o);if("production"!==process.env.NODE_ENV&&a.type.__hmrId&&function(e){const t=e.type.__hmrId;let n=Rg.get(t);n||(Lg(t,e.type),n=Rg.get(t)),n.instances.add(e)}(a),"production"!==process.env.NODE_ENV&&(og(e),Gy(a,"mount")),Cv(e)&&(a.ctx.renderer=W),"production"!==process.env.NODE_ENV&&Gy(a,"init"),function(e,t=!1,n=!1){t&&_w(t);const{props:r,children:o}=e.vnode,i=zw(e);Ey(e,r,i,t),((e,t,n)=>{const r=e.slots=My();if(32&e.vnode.shapeFlag){const e=t._;e?(Fy(r,t,n),n&&Xp(r,"_",e,!0)):Hy(t,r)}else t&&qy(e,t)})(e,o,n||t);const s=i?function(e,t){const n=e.type;if("production"!==process.env.NODE_ENV){if(n.name&&Pw(n.name,e.appContext.config),n.components){const t=Object.keys(n.components);for(let n=0;n<t.length;n++)Pw(t[n],e.appContext.config)}if(n.directives){const e=Object.keys(n.directives);for(let t=0;t<e.length;t++)ev(e[t])}n.compilerOptions&&$w()&&ag('"compilerOptions" is only supported when using a build of Vue that includes the runtime compiler. Since you are using a runtime-only build, the options should be passed via your build tool config instead.')}e.accessCache=Object.create(null),e.proxy=new Proxy(e.ctx,Uv),"production"===process.env.NODE_ENV||function(e){const{ctx:t,propsOptions:[n]}=e;n&&Object.keys(n).forEach(n=>{Object.defineProperty(t,n,{enumerable:!0,configurable:!0,get:()=>e.props[n],set:bp})})}(e);const{setup:r}=n;if(r){jf();const o=e.setupContext=r.length>1?function(e){const t=t=>{if("production"!==process.env.NODE_ENV&&(e.exposed&&ag("expose() should be called only once per setup()."),null!=t)){let e=typeof t;"object"===e&&(Op(t)?e="array":Fm(t)&&(e="ref")),"object"!==e&&ag(`expose() should be passed a plain object, received ${e}.`)}e.exposed=t||{}};if("production"!==process.env.NODE_ENV){let n,r;return Object.freeze({get attrs(){return n||(n=new Proxy(e.attrs,qw))},get slots(){return r||(r=function(e){return new Proxy(e.slots,{get:(t,n)=>(Zf(e,"get","$slots"),t[n])})}(e))},get emit(){return(t,...n)=>e.emit(t,...n)},expose:t})}return{attrs:new Proxy(e.attrs,qw),slots:e.slots,emit:e.emit,expose:t}}(e):null,i=Rw(e),s=ug(r,e,0,["production"!==process.env.NODE_ENV?Lm(e.props):e.props,o]),a=Bp(s);if(Vf(),i(),!a&&!e.sp||kv(e)||gv(e),a){if(s.then(Lw,Lw),t)return s.then(n=>{_w(!0);try{Vw(e,n,t)}finally{_w(!1)}}).catch(t=>{pg(t,e,0)});if(e.asyncDep=s,"production"!==process.env.NODE_ENV&&!e.suspense){ag(`Component <${Kw(e,n)}>: setup function returned a promise, but no <Suspense> boundary was found in the parent component tree. A component with async setup() must be nested in a <Suspense> in order to be rendered.`)}}else Vw(e,s,t)}else Hw(e,t)}(e,t):void 0;t&&_w(!1)}(a,!1,s),"production"!==process.env.NODE_ENV&&Ky(a,"init"),"production"!==process.env.NODE_ENV&&Dg&&(e.el=null),a.asyncDep){if(o&&o.registerDep(a,I,s,i),!e.el){const r=a.subTree=ww(aw);g(null,r,t,n),e.placeholder=r.el}}else I(a,e,t,n,o,i,s);"production"!==process.env.NODE_ENV&&(ig(),Ky(a,"mount"))},D=(e,t,n)=>{const r=t.component=e.component;if(function(e,t,n){const{props:r,children:o,component:i}=e,{props:s,children:a,patchFlag:l}=t,c=i.emitsOptions;if("production"!==process.env.NODE_ENV&&(o||a)&&Dg)return!0;if(t.dirs||t.transition)return!0;if(!(n&&l>=0))return!(!o&&!a||a&&a.$stable)||r!==s&&(r?!s||ky(r,s,c):!!s);if(1024&l)return!0;if(16&l)return r?ky(r,s,c):!!s;if(8&l){const e=t.dynamicProps;for(let t=0;t<e.length;t++){const n=e[t];if(Cy(s,r,n)&&!py(c,n))return!0}}return!1}(e,t,n)){if(r.asyncDep&&!r.asyncResolved)return"production"!==process.env.NODE_ENV&&og(t),t.el=e.el,t.placeholder=e.placeholder,_(r,t,n),void("production"!==process.env.NODE_ENV&&ig());r.next=t,r.update()}else t.el=e.el,t.placeholder=e.placeholder,r.vnode=t},I=(e,t,n,r,o,i,s)=>{const a=()=>{if(e.isMounted){let{next:t,bu:n,u:r,parent:a,vnode:l}=e;{const n=tw(e);if(n)return t&&(t.el=l.el,_(e,t,s)),void n.asyncDep.then(()=>{Zy(()=>{e.isUnmounted||c()},o)})}let u,h=t;"production"!==process.env.NODE_ENV&&og(t||e.vnode),Qy(e,!1),t?(t.el=l.el,_(e,t,s)):t=l,n&&Yp(n),(u=t.props&&t.props.onVnodeBeforeUpdate)&&Ew(u,a,t,l),Qy(e,!0),"production"!==process.env.NODE_ENV&&Gy(e,"render");const p=gy(e);"production"!==process.env.NODE_ENV&&Ky(e,"render");const m=e.subTree;e.subTree=p,"production"!==process.env.NODE_ENV&&Gy(e,"patch"),f(m,p,d(m.el),q(m),e,o,i),"production"!==process.env.NODE_ENV&&Ky(e,"patch"),t.el=p.el,null===h&&function({vnode:e,parent:t,suspense:n},r){for(;t;){const n=t.subTree;if(n.suspense&&n.suspense.activeBranch===e&&(n.suspense.vnode.el=n.el=r,e=n),n!==e)break;(e=t.vnode).el=r,t=t.parent}n&&n.activeBranch===e&&(n.vnode.el=r)}(e,p.el),r&&Zy(r,o),(u=t.props&&t.props.onVnodeUpdated)&&Zy(()=>Ew(u,a,t,l),o),("production"!==process.env.NODE_ENV||__VUE_PROD_DEVTOOLS__)&&Wg(e),"production"!==process.env.NODE_ENV&&ig()}else{let s;const{el:a,props:l}=t,{bm:c,m:d,parent:u,root:h,type:p}=e,m=kv(t);Qy(e,!1),c&&Yp(c),!m&&(s=l&&l.onVnodeBeforeMount)&&Ew(s,u,t),Qy(e,!0);{h.ce&&h.ce._hasShadowRoot()&&h.ce._injectChildStyle(p,e.parent?e.parent.type:void 0),"production"!==process.env.NODE_ENV&&Gy(e,"render");const s=e.subTree=gy(e);"production"!==process.env.NODE_ENV&&Ky(e,"render"),"production"!==process.env.NODE_ENV&&Gy(e,"patch"),f(null,s,n,r,e,o,i),"production"!==process.env.NODE_ENV&&Ky(e,"patch"),t.el=s.el}if(d&&Zy(d,o),!m&&(s=l&&l.onVnodeMounted)){const e=t;Zy(()=>Ew(s,u,e),o)}(256&t.shapeFlag||u&&kv(u.vnode)&&256&u.vnode.shapeFlag)&&e.a&&Zy(e.a,o),e.isMounted=!0,("production"!==process.env.NODE_ENV||__VUE_PROD_DEVTOOLS__)&&Fg(e),t=n=r=null}};e.scope.on();const l=e.effect=new Sf(a);e.scope.off();const c=e.update=l.run.bind(l),u=e.job=l.runIfDirty.bind(l);u.i=e,u.id=e.uid,l.scheduler=()=>kg(u),Qy(e,!0),"production"!==process.env.NODE_ENV&&(l.onTrack=e.rtc?t=>Yp(e.rtc,t):void 0,l.onTrigger=e.rtg?t=>Yp(e.rtg,t):void 0),c()},_=(e,t,n)=>{t.component=e;const r=e.vnode.props;e.vnode=t,e.next=null,function(e,t,n,r){const{props:o,attrs:i,vnode:{patchFlag:s}}=e,a=$m(o),[l]=e.propsOptions;let c=!1;if("production"!==process.env.NODE_ENV&&function(e){for(;e;){if(e.type.__hmrId)return!0;e=e.parent}}(e)||!(r||s>0)||16&s){let r;Oy(e,t,o,i)&&(c=!0);for(const i in a)t&&(Ep(t,i)||(r=Gp(i))!==i&&Ep(t,r))||(l?!n||void 0===n[i]&&void 0===n[r]||(o[i]=Ay(l,a,i,void 0,e,!0)):delete o[i]);if(i!==a)for(const e in i)t&&Ep(t,e)||(delete i[e],c=!0)}else if(8&s){const n=e.vnode.dynamicProps;for(let r=0;r<n.length;r++){let s=n[r];if(py(e.emitsOptions,s))continue;const d=t[s];if(l)if(Ep(i,s))d!==i[s]&&(i[s]=d,c=!0);else{const t=Wp(s);o[t]=Ay(l,a,t,d,e,!1)}else d!==i[s]&&(i[s]=d,c=!0)}}c&&Yf(e.attrs,"set",""),"production"!==process.env.NODE_ENV&&_y(t||{},o,e)}(e,t.props,r,n),((e,t,n)=>{const{vnode:r,slots:o}=e;let i=!0,s=yp;if(32&r.shapeFlag){const r=t._;r?"production"!==process.env.NODE_ENV&&Dg?(Fy(o,t,n),Yf(e,"set","$slots")):n&&1===r?i=!1:Fy(o,t,n):(i=!t.$stable,Hy(t,o)),s=t}else t&&(qy(e,t),s={default:1});if(i)for(const e in o)jy(e)||null!=s[e]||delete o[e]})(e,t.children,n),jf(),Mg(e),Vf()},R=(e,t,n,r,o,i,s,a,l=!1)=>{const d=e&&e.children,u=e?e.shapeFlag:0,h=t.children,{patchFlag:p,shapeFlag:f}=t;if(p>0){if(128&p)return void B(d,h,n,r,o,i,s,a,l);if(256&p)return void L(d,h,n,r,o,i,s,a,l)}8&f?(16&u&&H(d,o,i),h!==d&&c(n,h)):16&u?16&f?B(d,h,n,r,o,i,s,a,l):H(d,o,i,!0):(8&u&&c(n,""),16&f&&S(h,n,r,o,i,s,a,l))},L=(e,t,n,r,o,i,s,a,l)=>{t=t||wp;const c=(e=e||wp).length,d=t.length,u=Math.min(c,d);let h;for(h=0;h<u;h++){const r=t[h]=l?Mw(t[h]):Sw(t[h]);f(e[h],r,n,null,o,i,s,a,l)}c>d?H(e,o,i,!0,!1,u):S(t,n,r,o,i,s,a,l,u)},B=(e,t,n,r,o,i,s,a,l)=>{let c=0;const d=t.length;let u=e.length-1,h=d-1;for(;c<=u&&c<=h;){const r=e[c],d=t[c]=l?Mw(t[c]):Sw(t[c]);if(!mw(r,d))break;f(r,d,n,null,o,i,s,a,l),c++}for(;c<=u&&c<=h;){const r=e[u],c=t[h]=l?Mw(t[h]):Sw(t[h]);if(!mw(r,c))break;f(r,c,n,null,o,i,s,a,l),u--,h--}if(c>u){if(c<=h){const e=h+1,u=e<d?t[e].el:r;for(;c<=h;)f(null,t[c]=l?Mw(t[c]):Sw(t[c]),n,u,o,i,s,a,l),c++}}else if(c>h)for(;c<=u;)z(e[c],o,i,!0),c++;else{const p=c,m=c,g=new Map;for(c=m;c<=h;c++){const e=t[c]=l?Mw(t[c]):Sw(t[c]);null!=e.key&&("production"!==process.env.NODE_ENV&&g.has(e.key)&&ag("Duplicate keys found during update:",JSON.stringify(e.key),"Make sure keys are unique."),g.set(e.key,c))}let v,y=0;const w=h-m+1;let b=!1,x=0;const k=new Array(w);for(c=0;c<w;c++)k[c]=0;for(c=p;c<=u;c++){const r=e[c];if(y>=w){z(r,o,i,!0);continue}let d;if(null!=r.key)d=g.get(r.key);else for(v=m;v<=h;v++)if(0===k[v-m]&&mw(r,t[v])){d=v;break}void 0===d?z(r,o,i,!0):(k[d-m]=c+1,d>=x?x=d:b=!0,f(r,t[d],n,null,o,i,s,a,l),y++)}const C=b?function(e){const t=e.slice(),n=[0];let r,o,i,s,a;const l=e.length;for(r=0;r<l;r++){const l=e[r];if(0!==l){if(o=n[n.length-1],e[o]<l){t[r]=o,n.push(r);continue}for(i=0,s=n.length-1;i<s;)a=i+s>>1,e[n[a]]<l?i=a+1:s=a;l<e[n[i]]&&(i>0&&(t[r]=n[i-1]),n[i]=r)}}i=n.length,s=n[i-1];for(;i-- >0;)n[i]=s,s=t[s];return n}(k):wp;for(v=C.length-1,c=w-1;c>=0;c--){const e=m+c,u=t[e],h=t[e+1],p=e+1<d?h.el||rw(h):r;0===k[c]?f(null,u,n,p,o,i,s,a,l):b&&(v<0||c!==C[v]?P(u,n,p,2):v--)}}},P=(e,t,o,i,s=null)=>{const{el:a,type:l,transition:c,children:d,shapeFlag:u}=e;if(6&u)return void P(e.component.subTree,t,o,i);if(128&u)return void e.suspense.move(t,o,i);if(64&u)return void l.move(e,t,o,W);if(l===iw){n(a,t,o);for(let e=0;e<d.length;e++)P(d[e],t,o,i);return void n(e.anchor,t,o)}if(l===lw)return void w(e,t,o);if(2!==i&&1&u&&c)if(0===i)c.persisted&&!a[uv]?n(a,t,o):(c.beforeEnter(a),n(a,t,o),Zy(()=>c.enter(a),s));else{const{leave:i,delayLeave:s,afterLeave:l}=c,d=()=>{e.ctx.isUnmounted?r(a):n(a,t,o)},u=()=>{const e=a._isLeaving||!!a[uv];a._isLeaving&&a[uv](!0),c.persisted&&!e?d():i(a,()=>{d(),l&&l()})};s?s(a,d,u):u()}else n(a,t,o)},z=(e,t,n,r=!1,o=!1)=>{const{type:i,props:s,ref:a,children:l,dynamicChildren:c,shapeFlag:d,patchFlag:u,dirs:h,cacheIndex:p,memo:f}=e;if((-2===u||c&&c.hasOnce)&&(o=!1),null!=a&&(jf(),bv(a,null,n,e,!0),Vf()),null==p||e.ctx&&e.ctx!==t||(t.renderCache[p]=void 0),256&d)return void t.ctx.deactivate(e);const m=1&d&&h,g=!kv(e);let v;if(g&&(v=s&&s.onVnodeBeforeUnmount)&&Ew(v,t,e),6&d)$(e.component,n,r);else{if(128&d)return void e.suspense.unmount(n,r);m&&tv(e,null,t,"beforeUnmount"),64&d?e.type.remove(e,t,n,W,r):c&&!c.hasOnce&&(i!==iw||u>0&&64&u)?H(c,t,n,!1,!0):(i===iw&&384&u||!o&&16&d)&&H(l,t,n),r&&j(e)}const y=null!=f&&null==p;(g&&(v=s&&s.onVnodeUnmounted)||m||y)&&Zy(()=>{v&&Ew(v,t,e),m&&tv(e,null,t,"unmounted"),y&&(e.el=null)},n)},j=e=>{const{type:t,el:n,anchor:o,transition:i}=e,s=t===iw;if(s&&!i)return void V(n,o);if(t===lw)return b(e),void(i&&!i.persisted&&i.afterLeave&&i.afterLeave());const a=s?fv(e):e,l=()=>{s?d(n)&&V(n,o):r(n),i&&!i.persisted&&i.afterLeave&&i.afterLeave()};if(a&&1&a.shapeFlag&&i&&!i.persisted){const{leave:e,delayLeave:t}=i,n=a.el,r=()=>e(n,l);t?t(n,l,r):r()}else l()},V=(e,t)=>{let n;for(;e!==t;)n=u(e),r(e),e=n;r(t)},$=(e,t,n)=>{"production"!==process.env.NODE_ENV&&e.type.__hmrId&&function(e){Rg.get(e.type.__hmrId).instances.delete(e)}(e);const{bum:r,scope:o,job:i,subTree:s,um:a,m:l,a:c}=e;var d;nw(l),nw(c),r&&Yp(r),o.stop(),i?(i.flags|=8,z(s,e,t,n)):e.vnode.el&&s&&(s.transition=e.vnode.transition,z(s,e,t,n)),a&&Zy(a,t),Zy(()=>{e.isUnmounted=!0},t),("production"!==process.env.NODE_ENV||__VUE_PROD_DEVTOOLS__)&&(d=e,jg&&"function"==typeof jg.cleanupBuffer&&!jg.cleanupBuffer(d)&&Ug(d))},H=(e,t,n,r=!1,o=!1,i=0)=>{for(let s=i;s<e.length;s++)z(e[s],t,n,r,o)},q=e=>{if(6&e.shapeFlag)return q(e.component.subTree);if(128&e.shapeFlag)return e.suspense.next();const t=u(e.anchor||e.el),n=t&&t[cv];return n?u(n):t},F=(e,t,n)=>{!function(e,t){if(Eg)return void e();const n=void 0===t?void 0:new Set(gg);e(),Eg=!0;try{Mg(void 0,t),Ng(void 0,n,t)}finally{Eg=!1}}(()=>{null==e?t._vnode&&z(t._vnode,null,null,!0):f(t._vnode||null,e,t,null,null,null,n),t._vnode=e},e&&t._vnode?void 0:e&&e.component?e.component.uid:Aw)},W={p:f,um:z,m:P,r:j,mt:T,mc:S,pc:R,pbc:N,n:q,o:e};let U;return{render:F,hydrate:U,createApp:ly(F)}}(e)}function Xy({type:e,props:t},n){return"svg"===n&&"foreignObject"===e||"mathml"===n&&"annotation-xml"===e&&t&&t.encoding&&t.encoding.includes("html")?void 0:n}function Qy({effect:e,job:t},n){n?(e.flags|=32,t.flags|=4):(e.flags&=-33,t.flags&=-5)}function ew(e,t,n=!1){const r=e.children,o=t.children;if(Op(r)&&Op(o))for(let e=0;e<r.length;e++){const t=r[e];let i=o[e];1&i.shapeFlag&&!i.dynamicChildren&&((i.patchFlag<=0||32===i.patchFlag)&&(i=o[e]=Mw(o[e]),i.el=t.el),n||-2===i.patchFlag||ew(t,i)),i.type===sw&&(-1===i.patchFlag&&(i=o[e]=Mw(i)),i.el=t.el),i.type!==aw||i.el||(i.el=t.el),"production"!==process.env.NODE_ENV&&i.el&&(i.el.__vnode=i)}}function tw(e){const t=e.subTree.component;if(t)return t.asyncDep&&!t.asyncResolved?t:tw(t)}function nw(e){if(e)for(let t=0;t<e.length;t++)e[t].flags|=8}function rw(e){if(e.placeholder)return e.placeholder;const t=e.component;return t?rw(t.subTree):null}const ow=e=>e.__isSuspense;const iw=Symbol.for("v-fgt"),sw=Symbol.for("v-txt"),aw=Symbol.for("v-cmt"),lw=Symbol.for("v-stc"),cw=[];let dw=null;function uw(){cw.pop(),dw=cw[cw.length-1]||null}let hw=1;function pw(e,t=!1){hw+=e,e<0&&dw&&t&&(dw.hasOnce=!0)}function fw(e){return!!e&&!0===e.__v_isVNode}function mw(e,t){if("production"!==process.env.NODE_ENV&&6&t.shapeFlag&&e.component){const n=_g.get(t.type);if(n&&n.has(e.component))return e.shapeFlag&=-257,t.shapeFlag&=-513,!1}return e.type===t.type&&e.key===t.key}const gw=({key:e})=>null!=e?e:null,vw=({ref:e,ref_key:t,ref_for:n})=>("number"==typeof e&&(e=""+e),null!=e?_p(e)||Fm(e)||Ip(e)?{i:Yg,r:e,k:t,f:!!n}:e:null);function yw(e,t=null,n=null,r=0,o=null,i=(e===iw?0:1),s=!1,a=!1){const l={__v_isVNode:!0,__v_skip:!0,type:e,props:t,key:t&&gw(t),ref:t&&vw(t),scopeId:Xg,slotScopeIds:null,children:n,component:null,suspense:null,ssContent:null,ssFallback:null,dirs:null,transition:null,el:null,anchor:null,target:null,targetStart:null,targetAnchor:null,staticCount:0,shapeFlag:i,patchFlag:r,dynamicProps:o,dynamicChildren:null,appContext:null,ctx:Yg};if(a?(Nw(l,n),128&i&&e.normalize(l)):n&&(l.shapeFlag|=_p(n)?8:16),"production"!==process.env.NODE_ENV&&l.key!=l.key&&ag("VNode created with invalid key (NaN). VNode type:",l.type),"production"!==process.env.NODE_ENV&&t&&1&l.shapeFlag){const e=null!=t.innerHTML?"innerHTML":null!=t.textContent?"textContent":null;e&&function(e){return _p(e)?""!==e:!!Op(e)&&e.length>0}(l.children)&&ag(`The \`${e}\` prop on <${l.type}> will override its children. Remove either the \`${e}\` prop or the children.`)}return hw>0&&!s&&dw&&(l.patchFlag>0||6&i)&&32!==l.patchFlag&&dw.push(l),l}const ww="production"!==process.env.NODE_ENV?(...e)=>bw(...e):bw;function bw(e,t=null,n=null,r=0,o=null,i=!1){if(e&&e!==Vv||("production"===process.env.NODE_ENV||e||ag(`Invalid vnode type when creating vnode: ${e}.`),e=aw),fw(e)){const r=xw(e,t,!0);return n&&Nw(r,n),hw>0&&!i&&dw&&(6&r.shapeFlag?dw[dw.indexOf(e)]=r:dw.push(r)),r.patchFlag=-2,r}if(Jw(e)&&(e=e.__vccOpts),t){t=function(e){return e?Vm(e)||Ny(e)?Sp({},e):e:null}(t);let{class:e,style:n}=t;e&&!_p(e)&&(t.class=lf(e)),Lp(n)&&(Vm(n)&&!Op(n)&&(n=Sp({},n)),t.style=nf(n))}const s=_p(e)?1:ow(e)?128:dv(e)?64:Lp(e)?4:Ip(e)?2:0;return"production"!==process.env.NODE_ENV&&4&s&&Vm(e)&&ag("Vue received a Component that was made a reactive object. This can lead to unnecessary performance overhead and should be avoided by marking the component with `markRaw` or using `shallowRef` instead of `ref`.","\nComponent that was made reactive: ",e=$m(e)),yw(e,t,n,r,o,s,i,!0)}function xw(e,t,n=!1,r=!1){const{props:o,ref:i,patchFlag:s,children:a,transition:l}=e,c=t?function(...e){const t={};for(let n=0;n<e.length;n++){const r=e[n];for(const e in r)if("class"===e)t.class!==r.class&&(t.class=lf([t.class,r.class]));else if("style"===e)t.style=nf([t.style,r.style]);else if(kp(e)){const n=t[e],o=r[e];!o||n===o||Op(n)&&n.includes(o)?null!=o||null!=n||Cp(e)||(t[e]=o):t[e]=n?[].concat(n,o):o}else""!==e&&(t[e]=r[e])}return t}(o||{},t):o,d={__v_isVNode:!0,__v_skip:!0,type:e.type,props:c,key:c&&gw(c),ref:t&&t.ref?n&&i?Op(i)?i.concat(vw(t)):[i,vw(t)]:vw(t):i,scopeId:e.scopeId,slotScopeIds:e.slotScopeIds,children:"production"!==process.env.NODE_ENV&&-1===s&&Op(a)?a.map(kw):a,target:e.target,targetStart:e.targetStart,targetAnchor:e.targetAnchor,staticCount:e.staticCount,shapeFlag:e.shapeFlag,patchFlag:t&&e.type!==iw?-1===s?16:16|s:s,dynamicProps:e.dynamicProps,dynamicChildren:e.dynamicChildren,appContext:e.appContext,dirs:e.dirs,transition:l,component:e.component,suspense:e.suspense,ssContent:e.ssContent&&xw(e.ssContent),ssFallback:e.ssFallback&&xw(e.ssFallback),placeholder:e.placeholder,el:e.el,anchor:e.anchor,ctx:e.ctx,ce:e.ce,cacheIndex:e.cacheIndex};return l&&r&&pv(d,l.clone(d)),d}function kw(e){const t=xw(e);return Op(e.children)&&(t.children=e.children.map(kw)),t}function Cw(e=" ",t=0){return ww(sw,null,e,t)}function Sw(e){return null==e||"boolean"==typeof e?ww(aw):Op(e)?ww(iw,null,e.slice()):fw(e)?Mw(e):ww(sw,null,String(e))}function Mw(e){return null===e.el&&-1!==e.patchFlag||e.memo?e:xw(e)}function Nw(e,t){let n=0;const{shapeFlag:r}=e;if(null==t)t=null;else if(Op(t))n=16;else if("object"==typeof t){if(65&r){const n=t.default;return void(n&&(n._c&&(n._d=!1),Nw(e,n()),n._c&&(n._d=!0)))}{n=32;const r=t._;r||Ny(t)?3===r&&Yg&&(1===Yg.slots._?t._=1:(t._=2,e.patchFlag|=1024)):t._ctx=Yg}}else if(Ip(t)){if(65&r)return void Nw(e,{default:t});t={default:t,_ctx:Yg},n=32}else t=String(t),64&r?(n=16,t=[Cw(t)]):n=8;e.children=t,e.shapeFlag|=n}function Ew(e,t,n,r=null){hg(e,t,7,[n,r])}const Ow=sy();let Aw=0;let Tw=null;const Dw=()=>Tw||Yg;let Iw,_w;{const e=tf(),t=(t,n)=>{let r;return(r=e[t])||(r=e[t]=[]),r.push(n),e=>{r.length>1?r.forEach(t=>t(e)):r[0](e)}};Iw=t("__VUE_INSTANCE_SETTERS__",e=>Tw=e),_w=t("__VUE_SSR_SETTERS__",e=>jw=e)}const Rw=e=>{const t=Tw;return Iw(e),e.scope.on(),()=>{e.scope.off(),Iw(t)}},Lw=()=>{Tw&&Tw.scope.off(),Iw(null)},Bw=vp("slot,component");function Pw(e,{isNativeTag:t}){(Bw(e)||t(e))&&ag("Do not use built-in or reserved HTML elements as component id: "+e)}function zw(e){return 4&e.vnode.shapeFlag}let jw=!1;function Vw(e,t,n){Ip(t)?e.type.__ssrInlineRender?e.ssrRender=t:e.render=t:Lp(t)?("production"!==process.env.NODE_ENV&&fw(t)&&ag("setup() should not return VNodes directly - return a render function instead."),("production"!==process.env.NODE_ENV||__VUE_PROD_DEVTOOLS__)&&(e.devtoolsRawSetupState=t),e.setupState=Zm(t),"production"!==process.env.NODE_ENV&&function(e){const{ctx:t,setupState:n}=e;Object.keys($m(n)).forEach(e=>{if(!n.__isScriptSetup){if(Fv(e[0]))return void ag(`setup() return property ${JSON.stringify(e)} should not start with "$" or "_" which are reserved prefixes for Vue internals.`);Object.defineProperty(t,e,{enumerable:!0,configurable:!0,get:()=>n[e],set:bp})}})}(e)):"production"!==process.env.NODE_ENV&&void 0!==t&&ag("setup() should return an object. Received: "+(null===t?"null":typeof t)),Hw(e,n)}const $w=()=>!0;function Hw(e,t,n){const r=e.type;if(e.render||(e.render=r.render||bp),__VUE_OPTIONS_API__){const t=Rw(e);jf();try{Jv(e)}finally{Vf(),t()}}"production"===process.env.NODE_ENV||r.render||e.render!==bp||t||(r.template?ag('Component provided template option but runtime compilation is not supported in this build of Vue. Configure your bundler to alias "vue" to "vue/dist/vue.esm-bundler.js".'):ag("Component is missing template or render function: ",r))}const qw="production"!==process.env.NODE_ENV?{get:(e,t)=>(my(),Zf(e,"get",""),e[t]),set:()=>(ag("setupContext.attrs is readonly."),!1),deleteProperty:()=>(ag("setupContext.attrs is readonly."),!1)}:{get:(e,t)=>(Zf(e,"get",""),e[t])};function Fw(e){return e.exposed?e.exposeProxy||(e.exposeProxy=new Proxy(Zm((t=e.exposed,!Ep(t,"__v_skip")&&Object.isExtensible(t)&&Xp(t,"__v_skip",!0),t)),{get:(t,n)=>n in t?t[n]:n in qv?qv[n](e):void 0,has:(e,t)=>t in e||t in qv})):e.proxy;var t}const Ww=/(?:^|[-_])\w/g,Uw=e=>e.replace(Ww,e=>e.toUpperCase()).replace(/[-_]/g,"");function Gw(e,t=!0){return Ip(e)?e.displayName||e.name:e.name||t&&e.__name}function Kw(e,t,n=!1){let r=Gw(t);if(!r&&t.__file){const e=t.__file.match(/([^/\\]+)\.\w+$/);e&&(r=e[1])}if(!r&&e){const n=e=>{for(const n in e)if(e[n]===t)return n};r=n(e.components)||e.parent&&n(e.parent.type.components)||n(e.appContext.components)}return r?Uw(r):n?"App":"Anonymous"}function Jw(e){return Ip(e)&&"__vccOpts"in e}const Zw=(e,t)=>{const n=function(e,t,n=!1){let r,o;Ip(e)?r=e:(r=e.get,o=e.set);const i=new Ym(r,o,n);return process.env.NODE_ENV,i}(e,0,jw);if("production"!==process.env.NODE_ENV){const e=Dw();e&&e.appContext.config.warnRecursiveComputed&&(n._warnRecursive=!0)}return n};function Yw(e,t,n){try{pw(-1);const r=arguments.length;return 2===r?Lp(t)&&!Op(t)?fw(t)?ww(e,null,[t]):ww(e,t):ww(e,null,t):(r>3?n=Array.prototype.slice.call(arguments,2):3===r&&fw(n)&&(n=[n]),ww(e,t,n))}finally{pw(1)}}const Xw="3.5.44",Qw="production"!==process.env.NODE_ENV?ag:bp;
18
+ /**
19
+ * @vue/runtime-dom v3.5.44
20
+ * (c) 2018-present Yuxi (Evan) You and Vue contributors
21
+ * @license MIT
22
+ **/
23
+ let eb;process.env.NODE_ENV,process.env.NODE_ENV;const tb="undefined"!=typeof window&&window.trustedTypes;if(tb)try{eb=tb.createPolicy("vue",{createHTML:e=>e})}catch(e){"production"!==process.env.NODE_ENV&&Qw(`Error creating trusted types policy: ${e}`)}const nb=eb?e=>eb.createHTML(e):e=>e,rb="undefined"!=typeof document?document:null,ob=rb&&rb.createElement("template"),ib={insert:(e,t,n)=>{t.insertBefore(e,n||null)},remove:e=>{const t=e.parentNode;t&&t.removeChild(e)},createElement:(e,t,n,r)=>{const o="svg"===t?rb.createElementNS("http://www.w3.org/2000/svg",e):"mathml"===t?rb.createElementNS("http://www.w3.org/1998/Math/MathML",e):n?rb.createElement(e,{is:n}):rb.createElement(e);return"select"===e&&r&&null!=r.multiple&&o.setAttribute("multiple",r.multiple),o},createText:e=>rb.createTextNode(e),createComment:e=>rb.createComment(e),setText:(e,t)=>{e.nodeValue=t},setElementText:(e,t)=>{e.textContent=t},parentNode:e=>e.parentNode,nextSibling:e=>e.nextSibling,querySelector:e=>rb.querySelector(e),setScopeId(e,t){e.setAttribute(t,"")},insertStaticContent(e,t,n,r,o,i){const s=n?n.previousSibling:t.lastChild;if(o&&(o===i||o.nextSibling))for(;t.insertBefore(o.cloneNode(!0),n),o!==i&&(o=o.nextSibling););else{ob.innerHTML=nb("svg"===r?`<svg>${e}</svg>`:"mathml"===r?`<math>${e}</math>`:e);const o=ob.content;if("svg"===r||"mathml"===r){const e=o.firstChild;for(;e.firstChild;)o.appendChild(e.firstChild);o.removeChild(e)}t.insertBefore(o,n)}return[s?s.nextSibling:t.firstChild,n?n.previousSibling:t.lastChild]}},sb=Symbol("_vtc");const ab=Symbol("_vod"),lb=Symbol("_vsh"),cb=Symbol("production"!==process.env.NODE_ENV?"CSS_VAR_TEXT":""),db=/(?:^|;)\s*display\s*:/;const ub=/[^\\];\s*$/,hb=/\s*!important$/;function pb(e,t,n){if(Op(n))n.forEach(n=>pb(e,t,n));else if(null==n&&(n=""),"production"!==process.env.NODE_ENV&&ub.test(n)&&Qw(`Unexpected semicolon at the end of '${t}' style value: '${n}'`),t.startsWith("--"))hb.test(n)?e.setProperty(t,n.replace(hb,""),"important"):e.setProperty(t,n);else{const r=function(e,t){const n=mb[t];if(n)return n;let r=Wp(t);if("filter"!==r&&r in e)return mb[t]=r;r=Kp(r);for(let n=0;n<fb.length;n++){const o=fb[n]+r;if(o in e)return mb[t]=o}return t}(e,t);hb.test(n)?e.setProperty(Gp(r),n.replace(hb,""),"important"):e[r]=n}}const fb=["Webkit","Moz","ms"],mb={};function gb(e,t,n,r){return"TEXTAREA"===e.tagName&&("width"===t||"height"===t)&&_p(r)&&n===r}const vb="http://www.w3.org/1999/xlink";function yb(e,t,n,r,o,i=hf(t)){r&&t.startsWith("xlink:")?null==n?e.removeAttributeNS(vb,t.slice(6,t.length)):e.setAttributeNS(vb,t,n):null==n||i&&!pf(n)?e.removeAttribute(t):e.setAttribute(t,i?"":Rp(n)?String(n):n)}function wb(e,t,n,r,o){if("innerHTML"===t||"textContent"===t)return void(null!=n&&(e[t]="innerHTML"===t?nb(n):n));const i=e.tagName;if("value"===t&&"PROGRESS"!==i&&!i.includes("-")){const r="OPTION"===i?e.getAttribute("value")||"":e.value,o=null==n?"checkbox"===e.type?"on":"":String(n);return r===o&&"_value"in e||(e.value=o),null==n&&e.removeAttribute(t),void(e._value=n)}let s=!1;if(""===n||null==n){const r=typeof e[t];"boolean"===r?n=pf(n):null==n&&"string"===r?(n="",s=!0):"number"===r&&(n=0,s=!0)}try{e[t]=n}catch(e){"production"===process.env.NODE_ENV||s||Qw(`Failed setting prop "${t}" on <${i.toLowerCase()}>: value ${n} is invalid.`,e)}s&&e.removeAttribute(o||t)}const bb=Symbol("_vei");function xb(e,t,n,r,o=null){const i=e[bb]||(e[bb]={}),s=i[t];if(r&&s)s.value="production"!==process.env.NODE_ENV?Eb(r,t):r;else{const[n,a]=function(e){let t,n;for(;(n=e.match(kb))&&!Cb.test(e);)t||(t={}),e=e.slice(0,e.length-n[1].length),t[n[1].toLowerCase()]=!0;const r=":"===e[2]?e.slice(3):Gp(e.slice(2));return[r,t]}(t);if(r){const s=i[t]=function(e,t){const n=e=>{if(e._vts){if(e._vts<=n.attached)return}else e._vts=Date.now();const r=n.value;if(Op(r)){const n=e.stopImmediatePropagation;e.stopImmediatePropagation=()=>{n.call(e),e._stopped=!0};const o=r.slice(),i=[e];for(let n=0;n<o.length&&!e._stopped;n++){const e=o[n];e&&hg(e,t,5,i)}}else hg(r,t,5,[e])};return n.value=e,n.attached=Nb(),n}("production"!==process.env.NODE_ENV?Eb(r,t):r,o);!function(e,t,n,r){e.addEventListener(t,n,r)}(e,n,s,a)}else s&&(!function(e,t,n,r){e.removeEventListener(t,n,r)}(e,n,s,a),i[t]=void 0)}}const kb=/(Once|Passive|Capture)$/,Cb=/^on:?(?:Once|Passive|Capture)$/;let Sb=0;const Mb=Promise.resolve(),Nb=()=>Sb||(Mb.then(()=>Sb=0),Sb=Date.now());function Eb(e,t){return Ip(e)||Op(e)?e:(Qw(`Wrong type passed as event handler to ${t} - did you forget @ or : in front of your prop?\nExpected function or array of functions, received type ${typeof e}.`),bp)}const Ob=e=>111===e.charCodeAt(0)&&110===e.charCodeAt(1)&&e.charCodeAt(2)>96&&e.charCodeAt(2)<123;const Ab=Sp({patchProp:(e,t,n,r,o,i)=>{const s="svg"===o;"class"===t?function(e,t,n){const r=e[sb];r&&(t=(t?[t,...r]:[...r]).join(" ")),null==t?e.removeAttribute("class"):n?e.setAttribute("class",t):e.className=t}(e,r,s):"style"===t?function(e,t,n){const r=e.style,o=_p(n);let i=!1;if(n&&!o){if(t)if(_p(t))for(const e of t.split(";")){const t=e.slice(0,e.indexOf(":")).trim();null==n[t]&&pb(r,t,"")}else for(const e in t)null==n[e]&&pb(r,e,"");for(const o in n){"display"===o&&(i=!0);const s=n[o];null!=s?gb(e,o,!_p(t)&&t?t[o]:void 0,s)||pb(r,o,s):pb(r,o,"")}}else if(o){if(t!==n){const e=r[cb];e&&(n+=";"+e),r.cssText=n,i=db.test(n)}}else t&&e.removeAttribute("style");ab in e&&(o&&t===n||(e[ab]=i?r.display:""),e[lb]&&(r.display="none"))}(e,n,r):kp(t)?Cp(t)||xb(e,t,0,r,i):("."===t[0]?(t=t.slice(1),1):"^"===t[0]?(t=t.slice(1),0):function(e,t,n,r){if(r)return"innerHTML"===t||"textContent"===t||!!(t in e&&Ob(t)&&Ip(n));if("spellcheck"===t||"draggable"===t||"translate"===t||"autocorrect"===t)return!1;if("sandbox"===t&&"IFRAME"===e.tagName)return!1;if("form"===t)return!1;if("list"===t&&"INPUT"===e.tagName)return!1;if("type"===t&&"TEXTAREA"===e.tagName)return!1;if("width"===t||"height"===t){const t=e.tagName;if("IMG"===t||"VIDEO"===t||"CANVAS"===t||"SOURCE"===t)return!1}if(Ob(t)&&_p(n))return!1;return t in e}(e,t,r,s))?(wb(e,t,r),e.tagName.includes("-")||"value"!==t&&"checked"!==t&&"selected"!==t||yb(e,t,r,s,0,"value"!==t)):e._isVueCE&&(function(e,t){const n=e._def.props;if(!n)return!1;const r=Wp(t);return Array.isArray(n)?n.some(e=>Wp(e)===r):Object.keys(n).some(e=>Wp(e)===r)}(e,t)||e._def.__asyncLoader&&(/[A-Z]/.test(t)||!_p(r)))?wb(e,Wp(t),r,0,t):("true-value"===t?e._trueValue=r:"false-value"===t&&(e._falseValue=r),yb(e,t,r,s))}},ib);let Tb;const Db=(...e)=>{const t=(Tb||(Tb=Yy(Ab))).createApp(...e);"production"!==process.env.NODE_ENV&&(function(e){Object.defineProperty(e.config,"isNativeTag",{value:e=>cf(e)||df(e)||uf(e),writable:!1})}(t),function(e){{const t=e.config.isCustomElement;Object.defineProperty(e.config,"isCustomElement",{get:()=>t,set(){Qw("The `isCustomElement` config option is deprecated. Use `compilerOptions.isCustomElement` instead.")}});const n=e.config.compilerOptions,r='The `compilerOptions` config option is only respected when using a build of Vue.js that includes the runtime compiler (aka "full build"). Since you are using the runtime-only build, `compilerOptions` must be passed to `@vue/compiler-dom` in the build setup instead.\n- For vue-loader: pass it via vue-loader\'s `compilerOptions` loader option.\n- For vue-cli: see https://cli.vuejs.org/guide/webpack.html#modifying-options-of-a-loader\n- For vite: pass it via @vitejs/plugin-vue options. See https://github.com/vitejs/vite-plugin-vue/tree/main/packages/plugin-vue#example-for-passing-options-to-vuecompiler-sfc';Object.defineProperty(e.config,"compilerOptions",{get:()=>(Qw(r),n),set(){Qw(r)}})}}(t));const{mount:n}=t;return t.mount=e=>{const r=function(e){if(_p(e)){const t=document.querySelector(e);return"production"===process.env.NODE_ENV||t||Qw(`Failed to mount app: mount target selector "${e}" returned null.`),t}"production"!==process.env.NODE_ENV&&window.ShadowRoot&&e instanceof window.ShadowRoot&&"closed"===e.mode&&Qw('mounting on a ShadowRoot with `{mode: "closed"}` may lead to unpredictable bugs');return e}
24
+ /**
25
+ * vue v3.5.44
26
+ * (c) 2018-present Yuxi (Evan) You and Vue contributors
27
+ * @license MIT
28
+ **/(e);if(!r)return;const o=t._component;Ip(o)||o.render||o.template||(o.template=r.innerHTML),1===r.nodeType&&(r.textContent="");const i=n(r,!1,function(e){if(e instanceof SVGElement)return"svg";if("function"==typeof MathMLElement&&e instanceof MathMLElement)return"mathml"}(r));return r instanceof Element&&(r.removeAttribute("v-cloak"),r.setAttribute("data-v-app","")),i},t};"production"!==process.env.NODE_ENV&&function(){if("production"===process.env.NODE_ENV||"undefined"==typeof window)return;const e={style:"color:#3ba776"},t={style:"color:#1677ff"},n={style:"color:#f5222d"},r={style:"color:#eb2f96"},o={__vue_custom_formatter:!0,header(t){if(!Lp(t))return null;if(t.__isVue)return["div",e,"VueInstance"];if(Fm(t)){jf();const n=t.value;return Vf(),["div",{},["span",e,d(t)],"<",a(n),">"]}return Pm(t)?["div",{},["span",e,jm(t)?"ShallowReactive":"Reactive"],"<",a(t),">"+(zm(t)?" (readonly)":"")]:zm(t)?["div",{},["span",e,jm(t)?"ShallowReadonly":"Readonly"],"<",a(t),">"]:null},hasBody:e=>e&&e.__isVue,body(e){if(e&&e.__isVue)return["div",{},...i(e.$)]}};function i(e){const t=[];e.type.props&&e.props&&t.push(s("props",$m(e.props))),e.setupState!==yp&&t.push(s("setup",e.setupState)),e.data!==yp&&t.push(s("data",$m(e.data)));const n=l(e,"computed");n&&t.push(s("computed",n));const o=l(e,"inject");return o&&t.push(s("injected",o)),t.push(["div",{},["span",{style:r.style+";opacity:0.66"},"$ (internal): "],["object",{object:e}]]),t}function s(e,t){return t=Sp({},t),Object.keys(t).length?["div",{style:"line-height:1.25em;margin-bottom:0.6em"},["div",{style:"color:#476582"},e],["div",{style:"padding-left:1.25em"},...Object.keys(t).map(e=>["div",{},["span",r,e+": "],a(t[e],!1)])]]:["span",{}]}function a(e,o=!0){return"number"==typeof e?["span",t,e]:"string"==typeof e?["span",n,JSON.stringify(e)]:"boolean"==typeof e?["span",r,e]:Lp(e)?["object",{object:o?$m(e):e}]:["span",n,String(e)]}function l(e,t){const n=e.type;if(Ip(n))return;const r={};for(const o in e.ctx)c(n,o,t)&&(r[o]=e.ctx[o]);return r}function c(e,t,n){const r=e[n];return!!(Op(r)&&r.includes(t)||Lp(r)&&t in r)||!(!e.extends||!c(e.extends,t,n))||!(!e.mixins||!e.mixins.some(e=>c(e,t,n)))||void 0}function d(e){return jm(e)?"ShallowRef":e.effect?"ComputedRef":"Ref"}window.devtoolsFormatters?window.devtoolsFormatters.push(o):window.devtoolsFormatters=[o]}();var Ib=Object.defineProperty,_b=Object.getOwnPropertySymbols,Rb=Object.prototype.hasOwnProperty,Lb=Object.prototype.propertyIsEnumerable,Bb=(e,t,n)=>t in e?Ib(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Pb=(e,t)=>{for(var n in t||(t={}))Rb.call(t,n)&&Bb(e,n,t[n]);if(_b)for(var n of _b(t))Lb.call(t,n)&&Bb(e,n,t[n]);return e};function zb(e,t){return Object.assign(e,{meta:Pb({package:"@milkdown/components"},t)}),e}const jb=Md({extensions:[],languages:[],expandIcon:"⬇",searchIcon:"🔍",clearSearchIcon:"⌫",searchPlaceholder:"Search language",noResultText:"No result",copyText:"Copy",copyIcon:"📋",onCopy:()=>{},renderLanguage:e=>e,renderPreview:()=>null,previewToggleButton:e=>e?"Edit":"Hide",previewLabel:"Preview",previewLoading:"Loading..."},"codeBlockConfigCtx");zb(jb,{displayName:"Config<code-block>",group:"CodeBlock"});class Vb{constructor(e){this.languages=e,this.map={},e.forEach(e=>{e.alias.forEach(t=>{this.map[t]=e})})}getAll(){return this.languages.map(e=>({name:e.name,alias:e.alias}))}load(e){const t=this.map[e.toLowerCase()];return t?t.support?Promise.resolve(t.support):t.load():Promise.resolve(void 0)}}function $b({icon:e,class:t,onClick:n}){return Yw("span",{class:_e("milkdown-icon",t),onPointerdown:n,innerHTML:e?Re.sanitize(e.trim()):void 0})}$b.props={icon:{type:String,required:!1},class:{type:String,required:!1},onClick:{type:Function,required:!1}};function Hb(e){return t=this,n=null,r=function*(){try{return navigator.clipboard.writeText(e)}catch(t){const n=document.createElement("textarea"),r=document.activeElement;n.value=e,n.setAttribute("readonly",""),n.style.contain="strict",n.style.position="absolute",n.style.left="-9999px",n.style.fontSize="12pt";const o=document.getSelection(),i=o?o.rangeCount>0&&o.getRangeAt(0):null;document.body.appendChild(n),n.select(),n.selectionStart=0,n.selectionEnd=e.length,document.execCommand("copy"),document.body.removeChild(n),i&&(o.removeAllRanges(),o.addRange(i)),r&&r.focus()}},new Promise((e,o)=>{var i=e=>{try{a(r.next(e))}catch(e){o(e)}},s=e=>{try{a(r.throw(e))}catch(e){o(e)}},a=t=>t.done?e(t.value):Promise.resolve(t.value).then(i,s);a((r=r.apply(t,n)).next())});var t,n,r}const qb=mv({props:{copyText:{type:String,required:!0},copyIcon:{type:String,required:!0},onCopy:{type:Function,required:!0},text:{type:String,required:!0}},setup(e){const t=()=>{Hb(e.text).then(()=>e.onCopy(e.text)).catch(console.error)};return()=>Yw(iw,null,Yw("button",{type:"button",class:"copy-button",onClick:t},Yw($b,{icon:e.copyIcon}),e.copyText))}}),Fb=gd("abcdefghijklmnopqrstuvwxyz0123456789",8);const Wb=mv({props:{language:{type:Object,required:!0},getReadOnly:{type:Function,required:!0},config:{type:Object,required:!0},getAllLanguages:{type:Function,required:!0},setLanguage:{type:Function,required:!0}},setup({language:e,config:t,setLanguage:n,getAllLanguages:r,getReadOnly:o}){const i=Wm(),s=Wm(!1),a=Wm(),l=`${"milkdown-code-language-search"}-${Fb()}`;const c=Wm(),d=Wm("");iv([s,i,c],()=>{d.value="";const e=i.value,t=c.value;e&&t&&Be(e,t,{placement:"bottom-start"}).then(({x:e,y:n})=>{Object.assign(t.style,{left:`${e}px`,top:`${n}px`})}).catch(console.error)});const u=e=>{if(e.preventDefault(),e.stopPropagation(),o())return;const t=!s.value;s.value=t,t&&setTimeout(()=>{var e;return null==(e=a.value)?void 0:e.focus()},0)},h=e=>{const t=e.target;d.value=t.value},p=e=>{"Escape"===e.key&&(d.value="")},f=Zw(()=>{var t;if(!s.value)return[];const n=null!=(t=r())?t:[],o=n.find(t=>t.name.toLowerCase()===e.value.toLowerCase()),i=n.filter(e=>{const t=d.value.toLowerCase();return(e.name.toLowerCase().includes(t)||e.alias.some(e=>e.toLowerCase().includes(t)))&&e!==o});return 0===i.length?[]:o?[o,...i]:i}),m=e=>{const t=e.target;if(i.value&&i.value.contains(t))return;const n=c.value,r=i.value;r&&n&&"true"===r.dataset.expanded&&(n.contains(t)||(s.value=!1))};return Dv(()=>{window.addEventListener("click",m)}),Lv(()=>{window.removeEventListener("click",m)}),()=>Yw(iw,null,Yw("button",{type:"button",ref:i,class:"language-button",onClick:u,"data-expanded":String(s.value)},e.value||"Text",Yw("div",{class:"expand-icon"},Yw($b,{icon:t.expandIcon}))),Yw("div",{ref:c,class:"language-picker"},s.value?Yw("div",{class:"list-wrapper"},Yw("div",{class:"search-box"},Yw("div",{class:"search-icon"},Yw($b,{icon:t.searchIcon})),Yw("input",{id:l,ref:a,class:"search-input",placeholder:t.searchPlaceholder,value:d.value,onInput:h,onKeydown:p}),Yw("div",{class:_e("clear-icon",0===d.value.length&&"hidden"),onMousedown:e=>{e.preventDefault(),d.value=""}},Yw($b,{icon:t.clearSearchIcon}))),Yw("ul",{class:"language-list",role:"listbox",onKeydown:e=>{if("Enter"===e.key){const e=document.activeElement;e instanceof HTMLElement&&e.dataset.language&&n(e.dataset.language)}}},f.value.length?f.value.map(r=>Yw("li",{role:"listitem",tabindex:"0",class:"language-list-item","aria-selected":r.name.toLowerCase()===e.value.toLowerCase(),"data-language":r.name,onClick:()=>{n(r.name),s.value=!1}},t.renderLanguage(r.name,r.name.toLowerCase()===e.value.toLowerCase()))):Yw("li",{class:"language-list-item no-result"},t.noResultText))):null))}});let Ub;function Gb(e){return null!=Ub||(Ub=function(){const e=Re(),t={ADD_TAGS:["foreignObject"],ADD_ATTR:["xmlns"],HTML_INTEGRATION_POINTS:{foreignobject:!0}};return e.addHook("uponSanitizeElement",(e,t)=>{var n;if("foreignobject"===t.tagName){const t=e.parentElement;t&&"http://www.w3.org/2000/svg"===t.namespaceURI||null==(n=e.parentNode)||n.removeChild(e)}}),n=>e.sanitize(n,t)}()),Ub(e)}const Kb=mv({props:{text:{type:Object,required:!0},language:{type:Object,required:!0},config:{type:Object,required:!0},previewOnlyMode:{type:Object,required:!0},preview:{type:Object,required:!0}},setup(e){const{previewOnlyMode:t,config:n,preview:r}=e,o=Wm();return ov(()=>{const e=o.value;if(!e)return;for(;e.firstChild;)e.removeChild(e.firstChild);const t=r.value;("string"==typeof t||t instanceof Element)&&(e.innerHTML=Gb(t))}),()=>r.value?Yw("div",{class:"preview-panel"},!t.value&&Yw(iw,null,Yw("div",{class:"preview-divider"}),Yw("div",{class:"preview-label"},n.previewLabel)),Yw("div",{ref:o,class:"preview"})):null}}),Jb=mv({props:{text:{type:Object,required:!0},selected:{type:Object,required:!0},getReadOnly:{type:Function,required:!0},codemirror:{type:Object,required:!0},language:{type:Object,required:!0},getAllLanguages:{type:Function,required:!0},setLanguage:{type:Function,required:!0},config:{type:Object,required:!0}},setup(e){var t;const n=Wm(null!=(t=e.config.previewOnlyByDefault)?t:e.getReadOnly()),r=Wm(),o=Wm(null);Dv(()=>{for(var t;null==(t=r.value)?void 0:t.firstChild;)r.value.removeChild(r.value.firstChild);r.value&&r.value.appendChild(e.codemirror.dom)}),iv(()=>[e.text.value,e.language.value],()=>{const t=e.config.renderPreview(e.language.value,e.text.value,e=>o.value=e);t&&(o.value=t);void 0===t&&!o.value&&(o.value=Re.sanitize(e.config.previewLoading)),null===t&&(o.value=null)},{immediate:!0});const i=()=>{};return()=>{var t;return Yw(iw,null,Yw("div",{class:"tools"},Yw(Wb,{language:e.language,config:e.config,setLanguage:e.setLanguage,getAllLanguages:e.getAllLanguages,getReadOnly:e.getReadOnly}),Yw("div",{class:"tools-button-group"},Yw(qb,{copyIcon:e.config.copyIcon,copyText:e.config.copyText,onCopy:null!=(t=e.config.onCopy)?t:i,text:e.text.value}),o.value?Yw("button",{class:"preview-toggle-button",onClick:()=>n.value=!n.value},Yw($b,{icon:e.config.previewToggleButton(n.value)})):null)),Yw("div",{ref:r,class:_e("codemirror-host",o.value&&n.value&&"hidden")}),Yw(Kb,{text:e.text,language:e.language,config:e.config,previewOnlyMode:n,preview:o}))}}}),Zb=new WeakMap;let Yb=null;function Xb(){return Yb||(Yb=new IntersectionObserver(e=>{for(const t of e){const e=Zb.get(t.target);null==e||e(t.isIntersecting)}},{rootMargin:"200px"})),Yb}const Qb=class e{constructor(e,t,n,r,o,i){var s;this.node=e,this.view=t,this.getPos=n,this.loader=r,this.config=o,this.selected=Wm(!1),this.language=Wm(""),this.text=Wm(""),this.initialized=!1,this.updating=!1,this.languageName="",this.teardownTimer=null,this.onConfigChange=({extensions:e})=>{e!==this.extensions&&(this.extensions=e,this.initialized&&this.cm.dispatch({effects:this.extensionsConf.reconfigure(e)}))},this.forwardUpdate=e=>{var t;if(this.updating||!this.cm.hasFocus)return;let n=(null!=(t=this.getPos())?t:0)+1;const{main:r}=e.state.selection,o=n+r.from,i=n+r.to,s=this.view.state.selection;if(e.docChanged||s.from!==o||s.to!==i){const t=this.view.state.tr;e.changes.iterChanges((e,r,o,i,s)=>{s.length?t.replaceWith(n+e,n+r,this.view.state.schema.text(s.toString())):t.delete(n+e,n+r),n+=i-o-(r-e)}),t.setSelection(Fr.create(t.doc,o,i)),this.view.dispatch(t)}},this.createApp=()=>Db(Jb,{text:this.text,selected:this.selected,codemirror:this.cm,language:this.language,getAllLanguages:this.getAllLanguages,getReadOnly:()=>!this.view.editable,setLanguage:this.setLanguage,config:this.config}),this.codeMirrorKeymap=()=>{const e=this.view;return[{key:"ArrowUp",run:()=>this.maybeEscape("line",-1)},{key:"ArrowLeft",run:()=>this.maybeEscape("char",-1)},{key:"ArrowDown",run:()=>this.maybeEscape("line",1)},{key:"ArrowRight",run:()=>this.maybeEscape("char",1)},{key:"Mod-Enter",run:()=>!!wo(e.state,e.dispatch)&&(e.focus(),!0)},{key:"Mod-z",run:()=>mp(e.state,e.dispatch)},{key:"Shift-Mod-z",run:()=>gp(e.state,e.dispatch)},{key:"Mod-y",run:()=>gp(e.state,e.dispatch)},{key:"Backspace",run:()=>{var e;const t=this.cm.state.selection.ranges;if(t.length>1)return!1;const n=t[0];if(n&&(!n.empty||n.anchor>0))return!1;if(this.cm.state.doc.lines>=2)return!1;const r=this.view.state,o=null!=(e=this.getPos())?e:0,i=r.tr.replaceWith(o,o+this.node.nodeSize,r.schema.nodes.paragraph.createChecked({},this.node.content));return i.setSelection(Fr.near(i.doc.resolve(o))),this.view.dispatch(i),this.view.focus(),!0}}]},this.maybeEscape=(e,t)=>{var n;const{state:r}=this.cm;let o=r.selection.main;if(!o.empty)return!1;if("line"===e&&(o=r.doc.lineAt(o.head)),t<0?o.from>0:o.to<r.doc.length)return!1;const i=(null!=(n=this.getPos())?n:0)+(t<0?0:this.node.nodeSize),s=Fr.near(this.view.state.doc.resolve(i),t),a=this.view.state.tr.setSelection(s).scrollIntoView();return this.view.dispatch(a),this.view.focus(),!0},this.setLanguage=e=>{var t;this.view.dispatch(this.view.state.tr.setNodeAttribute(null!=(t=this.getPos())?t:0,"language",e))},this.getAllLanguages=()=>this.loader.getAll(),this.languageConf=new a,this.readOnlyConf=new a,this.extensionsConf=new a,this.extensions=o.extensions,this.disposeConfigWatcher=null==i?void 0:i(this.onConfigChange),this.text.value=this.node.textContent,this.language.value=null!=(s=this.node.attrs.language)?s:"",this.dom=document.createElement("div"),this.dom.className="milkdown-code-block",this.disposeSelectedWatcher=ov(()=>{this.selected.value?this.dom.classList.add("selected"):this.dom.classList.remove("selected")}),this.renderPlaceholder(),Zb.set(this.dom,e=>{e?(this.cancelTeardown(),this.initializeCodeMirror()):this.initialized&&this.scheduleTeardown()}),Xb().observe(this.dom)}renderPlaceholder(){const e=document.createElement("pre");e.className="milkdown-code-block-placeholder";const t=document.createElement("code");t.textContent=this.node.textContent,e.appendChild(t),this.dom.appendChild(e)}initializeCodeMirror(){if(this.initialized)return;this.initialized=!0,this.cm=new l({doc:this.node.textContent,root:this.view.root,extensions:[this.readOnlyConf.of(c.readOnly.of(!this.view.editable)),d(),u.of(this.codeMirrorKeymap()),this.languageConf.of([]),c.changeFilter.of(()=>this.view.editable||this.updating),this.extensionsConf.of(this.extensions),l.updateListener.of(this.forwardUpdate)]});const e=this.dom.querySelector(".milkdown-code-block-placeholder");e&&this.dom.removeChild(e),this.app=this.createApp(),this.app.mount(this.dom),this.updateLanguage()}teardownCodeMirror(){if(this.initialized&&!this.cm.hasFocus&&!this.selected.value){for(this.app.unmount(),this.cm.destroy(),this.initialized=!1,this.languageName="";this.dom.firstChild;)this.dom.removeChild(this.dom.firstChild);this.renderPlaceholder()}}scheduleTeardown(){this.cancelTeardown(),this.teardownTimer=setTimeout(()=>this.teardownCodeMirror(),e.TEARDOWN_DELAY)}cancelTeardown(){null!=this.teardownTimer&&(clearTimeout(this.teardownTimer),this.teardownTimer=null)}updateLanguage(){const e=this.node.attrs.language;if(e===this.languageName)return;this.language.value=e;this.loader.load(null!=e?e:"").then(t=>{t&&(this.cm.dispatch({effects:this.languageConf.reconfigure(t)}),this.languageName=e)}).catch(console.error)}setSelection(e,t){if(this.initialized||this.initializeCodeMirror(),this.cm.dom.isConnected){this.cm.focus(),this.updating=!0;try{this.cm.dispatch({selection:{anchor:e,head:t}})}finally{this.updating=!1}}}update(e){var t;if(e.type!==this.node.type)return!1;if(this.updating)return!0;if(this.node=e,this.text.value=e.textContent,this.language.value=null!=(t=e.attrs.language)?t:"",!this.initialized){const t=this.dom.querySelector(".milkdown-code-block-placeholder code");return t&&(t.textContent=e.textContent),!0}this.updateLanguage(),this.view.editable===this.cm.state.readOnly&&this.cm.dispatch({effects:this.readOnlyConf.reconfigure(c.readOnly.of(!this.view.editable))});const n=function(e,t){if(e===t)return null;let n=0,r=e.length,o=t.length;for(;n<r&&e.charCodeAt(n)===t.charCodeAt(n);)++n;for(;r>n&&o>n&&e.charCodeAt(r-1)===t.charCodeAt(o-1);)r--,o--;return{from:n,to:r,text:t.slice(n,o)}}(this.cm.state.doc.toString(),e.textContent);if(n){this.updating=!0;try{this.cm.dispatch({changes:{from:n.from,to:n.to,insert:n.text},scrollIntoView:this.view.editable})}finally{this.updating=!1}}return!0}selectNode(){this.initialized||this.initializeCodeMirror(),this.selected.value=!0,this.cm.focus()}deselectNode(){this.selected.value=!1}stopEvent(){return!0}destroy(){var e;null==(e=this.disposeConfigWatcher)||e.call(this),this.cancelTeardown(),Xb().unobserve(this.dom),Zb.delete(this.dom),this.initialized&&(this.app.unmount(),this.cm.destroy()),this.disposeSelectedWatcher()}};Qb.TEARDOWN_DELAY=5e3;let ex=Qb;const tx=Sd(Uu.node,e=>{const t=e.use(jb.key),n=new Vb(t.get().languages);return(e,r,o)=>new ex(e,r,o,n,t.get(),e=>t.on(e))});zb(tx,{displayName:"NodeView<code-block>",group:"CodeBlock"});const nx=[tx,jb];function rx(e,t,n,r,o,i){return qe(e)&&qe(t)&&(i.set(t,e),Ue(e,t,void 0,rx,i),i.delete(t)),e}var ox=Ge(function(e,t,n,r){Ue(e,t,n,r)}),ix=Fe(function(e){return e.push(void 0,rx),We(ox,void 0,e)});const sx={encodeCharacter:e=>e,encodeNodeStart:e=>e.type.name,encodeNodeEnd:e=>-function(e){let t=e.schema.cached.changeSetIDs||(e.schema.cached.changeSetIDs=Object.create(null)),n=t[e.name];return null==n&&(t[e.name]=n=Object.keys(e.schema.nodes).indexOf(e.name)+1),n}(e.type),compareTokens:(e,t)=>e===t};function ax(e,t,n,r,o){for(let i=0,s=0;i<e.childCount;i++){let a=e.child(i),l=s+a.nodeSize,c=Math.max(s,n),d=Math.min(l,r);if(c<d)if(a.isText)for(let e=c;e<d;e++)o.push(t.encodeCharacter(a.text.charCodeAt(e-s),a.marks));else a.isLeaf?o.push(t.encodeNodeStart(a)):(c==s&&o.push(t.encodeNodeStart(a)),ax(a.content,t,Math.max(s+1,c)-s-1,Math.min(l-1,d)-s-1,o),d==l&&o.push(t.encodeNodeEnd(a)));s=l}return o}function lx(e,t){return Math.min(15,Math.max(2,Math.floor(Math.max(e,t)/10)))}function cx(e,t,n,r=sx){let o=ax(e,r,n.fromA,n.toA,[]),i=ax(t,r,n.fromB,n.toB,[]),s=0,a=o.length,l=i.length,c=r.compareTokens;for(;s<o.length&&s<i.length&&c(o[s],i[s]);)s++;if(s==o.length&&s==i.length)return[];for(;a>s&&l>s&&c(o[a-1],i[l-1]);)a--,l--;if(a==s||l==s||a==l&&a==s+1)return[n.slice(s,a,s,l)];let d=a-s,u=l-s,h=Math.min(5e3,d+u),p=[],f=[];for(let e=2*(h+1),t=0;t<e;t++)f[t]=-1;for(let e=0;e<=h;e++){for(let t=-e;t<=e;t+=2){let r=f[t+1+h],m=f[t-1+h],g=r<m?m:r+1,v=g+t;for(;g<d&&v<u&&c(o[s+g],i[s+v]);)g++,v++;if(f[t+h]=g,g>=d&&v>=u){let r=[],o=lx(a-s,l-s),i=-1,c=-1,d=-1,u=-1,m=(e,t,s,a)=>{i>-1&&i<t+o?(i=e,d=s):(i>-1&&r.push(n.slice(i,c,d,u)),i=e,c=t,d=s,u=a)};for(let n=e-1;n>=0;n--){let e=f[t+1+h],r=f[t-1+h];e<r?(t--,g=r+s,v=g+t,m(g,g,v,v+1)):(t++,g=e+s,v=g+t,m(g,g+1,v,v)),f=p[n>>1]}return i>-1&&r.push(n.slice(i,c,d,u)),r.reverse()}}e%2==0&&p.push(f.slice())}return[n.slice(s,a,s,l)]}let dx,ux=class e{constructor(e,t){this.length=e,this.data=t}cut(t){return t==this.length?this:new e(t,this.data)}static slice(t,n,r){if(n==r)return e.none;if(0==n&&r==e.len(t))return t;let o=[];for(let e=0,i=0;i<r;e++){let s=t[e],a=i+s.length,l=Math.min(r,a)-Math.max(n,i);l>0&&o.push(s.cut(l)),i=a}return o}static join(t,n,r){if(0==t.length)return n;if(0==n.length)return t;let o=r(t[t.length-1].data,n[0].data);if(null==o)return t.concat(n);let i=t.slice(0,t.length-1);i.push(new e(t[t.length-1].length+n[0].length,o));for(let e=1;e<n.length;e++)i.push(n[e]);return i}static len(e){let t=0;for(let n=0;n<e.length;n++)t+=e[n].length;return t}};ux.none=[];class hx{constructor(e,t,n,r,o,i){this.fromA=e,this.toA=t,this.fromB=n,this.toB=r,this.deleted=o,this.inserted=i}get lenA(){return this.toA-this.fromA}get lenB(){return this.toB-this.fromB}slice(e,t,n,r){return 0==e&&0==n&&t==this.toA-this.fromA&&r==this.toB-this.fromB?this:new hx(this.fromA+e,this.fromA+t,this.fromB+n,this.fromB+r,ux.slice(this.deleted,e,t),ux.slice(this.inserted,n,r))}static merge(e,t,n){if(0==e.length)return t;if(0==t.length)return e;let r=[];for(let o=0,i=0,s=e[0],a=t[0];;){if(!s&&!a)return r;if(s&&(!a||s.toB<a.fromA)){let n=i?t[i-1].toB-t[i-1].toA:0;r.push(0==n?s:new hx(s.fromA,s.toA,s.fromB+n,s.toB+n,s.deleted,s.inserted)),s=o++==e.length?null:e[o]}else if(a&&(!s||a.toA<s.fromB)){let n=o?e[o-1].toB-e[o-1].toA:0;r.push(0==n?a:new hx(a.fromA-n,a.toA-n,a.fromB,a.toB,a.deleted,a.inserted)),a=i++==t.length?null:t[i]}else{let l=Math.min(s.fromB,a.fromA),c=Math.min(s.fromA,a.fromA-(o?e[o-1].toB-e[o-1].toA:0)),d=c,u=Math.min(a.fromB,s.fromB+(i?t[i-1].toB-t[i-1].toA:0)),h=u,p=ux.none,f=ux.none,m=!1,g=!1;for(;;){let r=s?l>=s.fromB?s.toB:s.fromB:2e8,c=a?l>=a.fromA?a.toA:a.fromA:2e8,u=Math.min(r,c),v=s&&l>=s.fromB,y=a&&l>=a.fromA;if(!v&&!y)break;v&&l==s.fromB&&!m&&(p=ux.join(p,s.deleted,n),d+=s.lenA,m=!0),v&&!y&&(f=ux.join(f,ux.slice(s.inserted,l-s.fromB,u-s.fromB),n),h+=u-l),y&&l==a.fromA&&!g&&(f=ux.join(f,a.inserted,n),h+=a.lenB,g=!0),y&&!v&&(p=ux.join(p,ux.slice(a.deleted,l-a.fromA,u-a.fromA),n),d+=u-l),v&&u==s.toB&&(s=o++==e.length?null:e[o],m=!1),y&&u==a.toA&&(a=i++==t.length?null:t[i],g=!1),l=u}(c<d||u<h)&&r.push(new hx(c,d,u,h,p,f))}}}static fromJSON(e){return new hx(e.fromA,e.toA,e.fromB,e.toB,e.deleted.map(e=>new ux(e.length,e.data)),e.inserted.map(e=>new ux(e.length,e.data)))}toJSON(){return this}}try{dx=new RegExp("[\\p{Alphabetic}_]","u")}catch(e){}class px{constructor(e,t){this.config=e,this.changes=t}addSteps(e,t,n){let r=[];for(let e=0;e<t.length;e++){let o=Array.isArray(n)?n[e]:n,i=0;t[e].forEach((e,t,n,s)=>{r.push(new hx(e+i,t+i,n,s,e==t?ux.none:[new ux(t-e,o)],n==s?ux.none:[new ux(s-n,o)])),i=s-n-(t-e)})}if(0==r.length)return this;let o=fx(r,this.config.combine),i=hx.merge(this.changes,o,this.config.combine),s=i;for(let t=0;t<s.length;t++){let n=s[t];if(n.fromA==n.toA||n.fromB==n.toB||!o.some(e=>e.toB>n.fromB&&e.fromB<n.toB))continue;let r=cx(this.config.doc.content,e.content,n,this.config.encoder);1==r.length&&0==r[0].fromB&&r[0].toB==n.toB-n.fromB||(s==i&&(s=i.slice()),1==r.length?s[t]=r[0]:(s.splice(t,1,...r),t+=r.length-1))}return new px(this.config,s)}get startDoc(){return this.config.doc}map(e){let t=t=>{let n=e(t);return n===t.data?t:new ux(t.length,n)};return new px(this.config,this.changes.map(e=>new hx(e.fromA,e.toA,e.fromB,e.toB,e.deleted.map(t),e.inserted.map(t))))}changedRange(e,t){if(e==this)return null;let n=t&&function(e){let t=mx(e);if(!t)return null;let n=mx(e.map(e=>e.invert()).reverse());return{fromA:n.from,toA:n.to,fromB:t.from,toB:t.to}}(t),r=n?n.toB-n.fromB-(n.toA-n.fromA):0;function o(e){return!n||e<=n.fromA?e:e+r}let i=n?n.fromB:2e8,s=n?n.toB:-2e8;function a(e,t=e){i=Math.min(e,i),s=Math.max(t,s)}let l=this.changes,c=e.changes;for(let e=0,t=0;e<l.length&&t<c.length;){let n=l[e],r=c[t];n&&r&&gx(n,r,o)?(e++,t++):r&&(!n||o(n.fromB)>=r.fromB)?(a(r.fromB,r.toB),t++):(a(o(n.fromB),o(n.toB)),e++)}return i<=s?{from:i,to:s}:null}static create(e,t=(e,t)=>e===t?e:null,n=sx,r=[]){return new px({combine:t,doc:e,encoder:n},r)}}function fx(e,t,n=0,r=e.length){if(r==n+1)return[e[n]];let o=n+r>>1;return hx.merge(fx(e,t,n,o),fx(e,t,o,r),t)}function mx(e){let t=2e8,n=-2e8;for(let r=0;r<e.length;r++){let o=e[r];2e8!=t&&(t=o.map(t,-1),n=o.map(n,1)),o.forEach((e,r,o,i)=>{t=Math.min(t,o),n=Math.max(n,i)})}return 2e8==t?null:{from:t,to:n}}function gx(e,t,n){return n(e.fromB)==t.fromB&&n(e.toB)==t.toB&&vx(e.deleted,t.deleted)&&vx(e.inserted,t.inserted)}function vx(e,t){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(e[n].length!=t[n].length||e[n].data!==t[n].data)return!1;return!0}function yx(e,t){return Object.assign(e,{meta:{package:"@milkdown/plugin-diff",...t}}),e}px.computeDiff=cx;function wx(e,t,n){const r=n.get(e);if(null!=r)return r;const o=[String(t.encodeNodeStart(e))];if(e.isText){const n=e.text;for(let r=0;r<n.length;r++)o.push(":"+String(t.encodeCharacter(n.charCodeAt(r),e.marks)))}else e.content.forEach(e=>{o.push("/"+wx(e,t,n))});o.push("\\"+String(t.encodeNodeEnd(e)));const i=o.join("");return n.set(e,i),i}function bx(e,t,n){const r=[];let o=0;return e.content.forEach(e=>{r.push({node:e,offset:o,size:e.nodeSize,signature:wx(e,n.encoder,n.sigCache)}),o+=e.nodeSize}),{node:e,contentStart:t,content:r}}function xx(e,t,n){return hx.fromJSON({fromA:e.fromA+t,toA:e.toA+t,fromB:e.fromB+n,toB:e.toB+n,deleted:e.deleted.map(e=>({length:e.length,data:e.data})),inserted:e.inserted.map(e=>({length:e.length,data:e.data}))})}function kx(e,t){const n=e.content;if(t<n.length)return e.contentStart+n[t].offset;if(t>0){const r=n[t-1];return e.contentStart+r.offset+r.size}return e.contentStart+e.node.content.size}function Cx(e,t,n){return hx.fromJSON({fromA:t,toA:t+e.size,fromB:n,toB:n,deleted:[{length:e.size,data:null}],inserted:[]})}function Sx(e,t,n){return hx.fromJSON({fromA:t,toA:t,fromB:n,toB:n+e.size,deleted:[],inserted:[{length:e.size,data:null}]})}function Mx(e,t,n,r,o){if(e.childCount>500||t.childCount>500)return function(e,t,n,r,o){const i=new hr(0,e.content.size,new Zt(t.content,0,0));return px.create(e,void 0,o.encoder).addSteps(t,[i.getMap()],null).changes.map(e=>xx(e,n,r))}(e,t,n,r,o);const i=bx(e,n,o),s=bx(t,r,o),a=function(e,t){const n=e.length,r=t.length,o=Array.from({length:n+1},()=>Array.from({length:r+1},()=>0));for(let i=n-1;i>=0;i--)for(let n=r-1;n>=0;n--)e[i].signature===t[n].signature?o[i][n]=o[i+1][n+1]+1:o[i][n]=Math.max(o[i+1][n],o[i][n+1]);const i=[];let s=0,a=0;for(;s<n&&a<r;)e[s].signature===t[a].signature?(i.push([s,a]),s++,a++):o[s+1][a]>=o[s][a+1]?s++:a++;return i}(i.content,s.content),l=[];let c=0,d=0;for(const[e,t]of a)Nx(i,s,{oldStart:c,oldEnd:e,newStart:d,newEnd:t},o,l),c=e+1,d=t+1;return Nx(i,s,{oldStart:c,oldEnd:i.content.length,newStart:d,newEnd:s.content.length},o,l),l}function Nx(e,t,n,r,o){const i=e.content,s=t.content;let a=n.oldStart,l=n.newStart;for(;a<n.oldEnd||l<n.newEnd;){const c=a<n.oldEnd?i[a]:null,d=l<n.newEnd?s[l]:null,u=c&&d&&c.node.type===d.node.type;if(c&&d&&u)o.push(...Ex(e,t,c,d,r)),a++,l++;else{if(c&&(!d||!u)){const n=e.contentStart+c.offset;o.push(Cx(c,n,kx(t,l))),a++;continue}if(d){const n=t.contentStart+d.offset;o.push(Sx(d,kx(e,a),n)),l++}}}}function Ex(e,t,n,r,o){const i=e.contentStart+n.offset,s=t.contentStart+r.offset;return function(e,t){if(e.type!==t.type)return!1;const n=e.type;return!n.isTextblock&&!n.isAtom&&!0!==n.spec.code&&!!n.isBlock}(n.node,r.node)&&(a=n.node,l=r.node,(c=o.encoder).encodeNodeStart(a)===c.encodeNodeStart(l))?Mx(n.node,r.node,i+1,s+1,o):function(e,t,n){const r=e.parent.copy(Ft.from(e.node)),o=t.parent.copy(Ft.from(t.node)),i=new hr(0,r.content.size,new Zt(o.content,0,0));return px.create(r,void 0,n.encoder).addSteps(o,[i.getMap()],null).changes.map(n=>xx(n,e.abs,t.abs))}({node:n.node,parent:e.node,abs:i},{node:r.node,parent:t.node,abs:s},o);var a,l,c}function Ox(e,t,n){const r=function(e={}){const t=new WeakMap,n=new WeakMap;function r(e){let n=t.get(e);if(null!=n)return n;const r=e.attrs,o=r?Object.keys(r).filter(e=>null!=r[e]).sort():[];if(0===o.length)n=e.type.name;else{const t={};for(const e of o)t[e]=r[e];n=`${e.type.name}:${JSON.stringify(t)}`}return t.set(e,n),n}return{encodeCharacter:(e,t)=>{if(0===t.length)return e;let o=n.get(t);return null==o&&(o=t.map(r).join(","),n.set(t,o)),`${e}:${o}`},encodeNodeStart:t=>{const n=t.attrs;if(n&&Object.keys(n).length>0){const r=e[t.type.name]??[],o=Object.keys(n).filter(e=>{if(r.includes(e))return!1;const o=t.type.spec.attrs?.[e]?.default;return n[e]!==o});if(o.length>0){const e={};for(const t of o.sort())e[t]=n[t];return`${t.type.name}:${JSON.stringify(e)}`}}return t.type.name},encodeNodeEnd:e=>{const t=e.type.schema,n=t.cached.changeSetIDs||(t.cached.changeSetIDs=Object.create(null));let r=n[e.type.name];return null==r&&(n[e.type.name]=r=Object.keys(t.nodes).indexOf(e.type.name)+1),-r},compareTokens:(e,t)=>e===t}}(n?.ignoreAttrs),o={encoder:r,sigCache:new WeakMap},i=e.content.size,s=t.content.size,a=n?.range;if(null==a)return Mx(e,t,0,0,o);const l=Math.min(i,s),c=Math.max(0,Math.min(a.from??0,l)),d=Math.max(c,Math.min(a.to??l,l));if(c===d)return[];if(0===c&&d===l&&i===s)return Mx(e,t,0,0,o);const u=function(e,t,n,r,o){const i=e.resolve(n),s=e.resolve(r),a=t.resolve(n),l=t.resolve(r),c=i.sharedDepth(r);if(a.sharedDepth(r)!==c)throw new RangeError(`computeDocDiff: range [${n}, ${r}) resolves to different sharedDepth in old and new docs`);for(let e=0;e<=c;e++){if(o.encodeNodeStart(i.node(e))!==o.encodeNodeStart(a.node(e)))throw new RangeError(`computeDocDiff: ancestor at depth ${e} differs in type or non-ignored attrs along the path to the shared ancestor`);if(i.start(e)!==a.start(e))throw new RangeError(`computeDocDiff: ancestor at depth ${e} starts at different absolute positions in old and new docs (content before the range differs in size)`)}const d=i.node(c);if(d.isTextblock)throw new RangeError(`computeDocDiff: range [${n}, ${r}) lands inside a textblock; widen the range to a block boundary`);if(i.depth!==c||s.depth!==c||a.depth!==c||l.depth!==c)throw new RangeError(`computeDocDiff: range [${n}, ${r}) endpoints must be aligned to child boundaries of the shared ancestor`);const u=a.node(c),h=i.start(c),p=n-h,f=r-h;return{oldCut:d.copy(d.content.cut(p,f)),newCut:u.copy(u.content.cut(p,f)),cutAbsStart:n}}(e,t,c,d,r);return Mx(u.oldCut,u.newCut,u.cutAbsStart,u.cutAbsStart,o)}var Ax=Md({ignoreAttrs:{heading:["id"]}},"diffConfig");yx(Ax,{displayName:"Ctx<diffConfig>",group:"Diff"});var Tx=new lo("MILKDOWN_DIFF");function Dx(e){return e.changes.filter(t=>{return n=t,!e.rejectedRanges.some(e=>n.fromB<e.toB&&n.toB>e.fromB);var n})}var Ix=kd(e=>{const t=e.get(Ax.key);return new io({key:Tx,state:{init:()=>null,apply(e,n,r,o){const i=e.getMeta(Tx);if(!n){if("start"===i?.type){const e=Ox(o.doc,i.newDoc,{ignoreAttrs:t.ignoreAttrs});return{newDoc:i.newDoc,changes:e,rejectedRanges:[],active:!0}}return null}let s,a=n;if(e.docChanged&&a.active&&(a=function(e,t,n){const r=Ox(e,t.newDoc,n);return{...t,changes:r}}(o.doc,a,{ignoreAttrs:t.ignoreAttrs})),!i)return a;switch(i.type){case"start":{const e=Ox(o.doc,i.newDoc,{ignoreAttrs:t.ignoreAttrs});return{newDoc:i.newDoc,changes:e,rejectedRanges:[],active:!0}}case"accept":case"acceptRange":s=a;break;case"reject":s={...a,rejectedRanges:[...a.rejectedRanges,{fromB:i.fromB,toB:i.toB}]};break;case"rejectRange":s={...a,rejectedRanges:[...a.rejectedRanges,{fromB:i.range.fromB,toB:i.range.toB}]};break;case"acceptAll":case"clear":return null;default:return a}return s.active&&0===Dx(s).length?null:s}},filterTransaction:(e,t)=>!Tx.getState(t)?.active||(!!e.getMeta(Tx)||!e.docChanged)})});yx(Ix,{displayName:"Prose<diff>",group:"Diff"});var _x=yd("StartDiffReview",e=>t=>(n,r)=>{if(null==t)return!1;const o=e.get(Vc)(t);return!!o&&(r&&r(n.tr.setMeta(Tx,{type:"start",newDoc:o})),!0)});yx(_x,{displayName:"Command<startDiffReview>",group:"Diff"});var Rx=yd("StartDiffReviewFromDoc",()=>e=>(t,n)=>!!e&&(e.type===t.doc.type&&(n&&n(t.tr.setMeta(Tx,{type:"start",newDoc:e})),!0)));yx(Rx,{displayName:"Command<startDiffReviewFromDoc>",group:"Diff"});var Lx=yd("AcceptDiffChunk",()=>e=>(t,n)=>{if(null==e)return!1;const r=Tx.getState(t);if(!r)return!1;const o=Dx(r)[e];if(!o)return!1;if(n){const i=r.newDoc.slice(o.fromB,o.toB);let s=t.tr.replace(o.fromA,o.toA,i);s=s.setMeta(Tx,{type:"accept",changeIndex:e}),n(s)}return!0});yx(Lx,{displayName:"Command<acceptDiffChunk>",group:"Diff"});var Bx=yd("RejectDiffChunk",()=>e=>(t,n)=>{if(null==e)return!1;const r=Tx.getState(t);if(!r)return!1;const o=Dx(r)[e];return!!o&&(n&&n(t.tr.setMeta(Tx,{type:"reject",fromB:o.fromB,toB:o.toB})),!0)});yx(Bx,{displayName:"Command<rejectDiffChunk>",group:"Diff"});var Px=yd("AcceptDiffRange",()=>e=>(t,n)=>{if(!e)return!1;const r=Tx.getState(t);if(!r)return!1;if(n){const o=r.newDoc.slice(e.fromB,e.toB);let i=t.tr.replace(e.fromA,e.toA,o);i=i.setMeta(Tx,{type:"acceptRange",range:e}),n(i)}return!0});yx(Px,{displayName:"Command<acceptDiffRange>",group:"Diff"});var zx=yd("RejectDiffRange",()=>e=>(t,n)=>!!e&&(!!Tx.getState(t)&&(n&&n(t.tr.setMeta(Tx,{type:"rejectRange",range:e})),!0)));yx(zx,{displayName:"Command<rejectDiffRange>",group:"Diff"});var jx=yd("AcceptAllDiffs",()=>()=>(e,t)=>{const n=Tx.getState(e);return!!n&&(t&&t((0===n.rejectedRanges.length?e.tr.replaceWith(0,e.doc.content.size,n.newDoc.content):function(e,t){const n=Dx(t);for(let r=n.length-1;r>=0;r--){const o=n[r],i=t.newDoc.slice(o.fromB,o.toB);e=e.replace(o.fromA,o.toA,i)}return e}(e.tr,n)).setMeta(Tx,{type:"acceptAll"})),!0)});yx(jx,{displayName:"Command<acceptAllDiffs>",group:"Diff"});var Vx=yd("ClearDiffReview",()=>()=>(e,t)=>!!Tx.getState(e)&&(t&&t(e.tr.setMeta(Tx,{type:"clear"})),!0));yx(Vx,{displayName:"Command<clearDiffReview>",group:"Diff"});var $x=[Ax,Ix,_x,Rx,Lx,Px,Bx,zx,jx,Vx],Hx=Object.defineProperty,qx=Object.getOwnPropertySymbols,Fx=Object.prototype.hasOwnProperty,Wx=Object.prototype.propertyIsEnumerable,Ux=(e,t,n)=>t in e?Hx(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Gx=(e,t)=>{for(var n in t||(t={}))Fx.call(t,n)&&Ux(e,n,t[n]);if(qx)for(var n of qx(t))Wx.call(t,n)&&Ux(e,n,t[n]);return e};function Kx(e,t){return Object.assign(e,{meta:Gx({package:"@milkdown/components"},t)}),e}const Jx="milkdown-diff",Zx=Md({acceptLabel:"Accept",rejectLabel:"Reject",customBlockTypes:[]},"diffComponentConfig");function Yx(e,t,n){if(t===n)return!1;const r=e.resolve(t),o=e.resolve(n);return r.index(0)!==(0===o.depth?Math.max(0,o.index(0)-1):o.index(0))}function Xx(e,t,n){if(t>=n)return!1;const r=e.resolve(t),o=e.resolve(n);if(r.sameParent(o)&&r.parent.isTextblock)return!1;let i=!1;return e.nodesBetween(t,n,(e,r)=>{if(i)return!1;if(!e.isBlock)return!0;const o=r+e.nodeSize;return!(r>=t&&o<=n)||(i=!0,!1)}),i}function Qx(e,t,n){if(n!==e.content.size)return!1;const r=e.resolve(t);if(0!==r.depth)return!1;for(let t=r.index(0);t<e.childCount;t++){const n=e.child(t);if("paragraph"!==n.type.name||n.content.size>0)return!1}return!0}function ek(e,t){const n=e.resolve(t);for(let e=n.depth;e>=1;e--){if(n.node(e).isTextblock)return n.before(e)}return t}function tk(e,t,n,r){let o=0;for(let i=0;i<e.childCount;i++){const s=e.child(i),a=o+s.nodeSize;if(o>=n)break;a>t&&o<n&&r(s,o,a),o=a}}function nk(e,t,n,r){tk(e,t,n,(t,n,o)=>{o===e.content.size&&"paragraph"===t.type.name&&0===t.content.size||r.push(Nl.node(n,o,{class:`${Jx}-removed-block`}))})}function rk(e,t,n=!1){if(t<0||t>e.content.size)return null;const r=e.resolve(Math.min(t,e.content.size));if(r.depth>=1)return{from:r.before(1),to:r.after(1)};if(n){const e=r.nodeBefore;if(e)return{from:t-e.nodeSize,to:t};const n=r.nodeAfter;if(n)return{from:t,to:t+n.nodeSize}}else{const e=r.nodeAfter;if(e)return{from:t,to:t+e.nodeSize};const n=r.nodeBefore;if(n)return{from:t-n.nodeSize,to:t}}return null}function ok(e,t,n){if(t<0||t>e.content.size)return null;const r=e.resolve(Math.min(t,e.content.size));for(let e=r.depth;e>=0;e--){const t=r.node(e).type.name;if(n.has(t))return t}return null}function ik(e,t,n,r=!1){const o=ok(e,t,n);if(o)return o;const i=e.resolve(Math.min(Math.max(t,0),e.content.size)),s=r?i.nodeBefore:i.nodeAfter;return s&&n.has(s.type.name)?s.type.name:null}function sk(e,t,n,r){return e<r&&t>n}function ak(e,t,n,r){return t===n?null!=ok(e,t,r):null!=ik(e,t,r)||null!=ik(e,n,r,!0)}function lk(e,t,n){const r=e.resolve(n.fromA);if(!r.parent.isTextblock||r.depth<1)return null;if(!r.node(1).isTextblock)return null;const o=r.after(1),i=t.resolve(n.fromB);let s;if(i.depth>=1&&i.node(1).isTextblock?(s=i.after(1),s>n.toB&&(s=n.toB)):s=n.fromB,o>=n.toA&&s>=n.toB)return null;const a=[];return(o>n.fromA||s>n.fromB)&&a.push({fromA:n.fromA,toA:Math.min(o,n.toA),fromB:n.fromB,toB:s,isBlock:!1}),(n.toA>o||n.toB>s)&&a.push({fromA:o,toA:Math.max(o,n.toA),fromB:s,toB:n.toB,isBlock:!0}),a.length>1?a:null}function ck(e,t,n,r){return ak(t,e.fromA,e.toA,r)||ak(n,e.fromB,e.toB,r)}function dk(e,t,n,r){return t===n?null==ok(e,t,r)?null:rk(e,t):null!=ik(e,t,r)?rk(e,t):null!=ik(e,n,r,!0)?rk(e,n,!0):null}Kx(Zx,{displayName:"Ctx<diffComponentConfig>",group:"DiffComponent"});const uk=new lo("MILKDOWN_DIFF_DECORATION"),hk=kd(e=>{const t=e.get(Zx.key);return new io({key:uk,state:{init:()=>Al.empty,apply(n,r,o,i){const s=Tx.getState(i);return(null==s?void 0:s.active)?n.getMeta(Tx)||n.docChanged?function(e,t,n,r){const o=[],i=e.get(Ac),s=new Set(r.customBlockTypes),a=Dx(n),l=function(e,t,n,r){var o,i,s,a;const l=[],c=new Set;for(let d=0;d<e.length;d++){if(c.has(d))continue;const u=e[d];if(!ck(u,t,n,r)){l.push({fromA:u.fromA,toA:u.toA,fromB:u.fromB,toB:u.toB,isCustomBlock:!1});continue}const h=dk(t,u.fromA,u.toA,r),p=dk(n,u.fromB,u.toB,r),f={fromA:Math.min(null!=(o=null==h?void 0:h.from)?o:u.fromA,u.fromA),toA:Math.max(null!=(i=null==h?void 0:h.to)?i:u.toA,u.toA),fromB:Math.min(null!=(s=null==p?void 0:p.from)?s:u.fromB,u.fromB),toB:Math.max(null!=(a=null==p?void 0:p.to)?a:u.toB,u.toB),isCustomBlock:!0};c.add(d);for(let t=d+1;t<e.length;t++){if(c.has(t))continue;const n=e[t],r=h&&sk(n.fromA,n.toA,h.from,h.to),o=p&&sk(n.fromB,n.toB,p.from,p.to);(r||o)&&(c.add(t),f.fromA=Math.min(f.fromA,n.fromA),f.toA=Math.max(f.toA,n.toA),f.fromB=Math.min(f.fromB,n.fromB),f.toB=Math.max(f.toB,n.toB))}const m=[];for(let e=0;e<l.length;e++){const t=l[e];if(!t.isCustomBlock)continue;const n=sk(f.fromA,f.toA,t.fromA,t.toA),r=sk(f.fromB,f.toB,t.fromB,t.toB);(n||r)&&(f.fromA=Math.min(f.fromA,t.fromA),f.toA=Math.max(f.toA,t.toA),f.fromB=Math.min(f.fromB,t.fromB),f.toB=Math.max(f.toB,t.toB),m.push(e))}for(let e=m.length-1;e>=0;e--)l.splice(m[e],1);l.push(f)}return l}(a,t,n.newDoc,s);!function(e,t){const n=function(e){let t=e.content.size;for(let n=e.childCount-1;n>=0;n--){const r=e.child(n);if("paragraph"!==r.type.name||r.content.size>0)break;t-=r.nodeSize}return t}(t);if(n!==t.content.size)for(const t of e)t.fromA===t.toA&&t.fromB<t.toB&&t.fromA>=n&&(t.fromA=n,t.toA=n)}(l,t);for(let e=0;e<l.length;e++){const s=l[e],a=s.fromA<s.toA,c=s.fromB<s.toB;if(a&&!c&&Qx(t,s.fromA,s.toA))continue;const d=a&&Yx(t,s.fromA,s.toA),u=a&&Xx(t,s.fromA,s.toA),h=c&&Xx(n.newDoc,s.fromB,s.toB),p=a&&!d&&!u&&!s.isCustomBlock&&!h,f=(d||u||h)&&!p;if(f&&!s.isCustomBlock){const a=lk(t,n.newDoc,s);if(a){pk({doc:t,newDoc:n.newDoc,segments:a,change:s,changeIndex:e,commands:i,acceptLabel:r.acceptLabel,rejectLabel:r.rejectLabel,decorations:o});continue}}a&&(s.isCustomBlock||f?nk(t,s.fromA,s.toA,o):o.push(Nl.inline(s.fromA,s.toA,{class:`${Jx}-removed`})));const m=a?s.toA:s.fromA,g=f?ek(t,m):m;if(c){const t=fk(n.newDoc,s,f);o.push(Nl.widget(g,t,{side:-1,key:`added-${e}`}))}const v=mk({commands:i,isBlockLevel:f,change:s,acceptLabel:r.acceptLabel,rejectLabel:r.rejectLabel});o.push(Nl.widget(g,v,{side:f?-1:1,key:`controls-${e}`}))}return Al.create(t,o)}(e,i.doc,s,t):r.map(n.mapping,n.doc):Al.empty}},props:{decorations(e){var t;return null!=(t=uk.getState(e))?t:Al.empty}}})});function pk({doc:e,newDoc:t,segments:n,change:r,changeIndex:o,commands:i,acceptLabel:s,rejectLabel:a,decorations:l}){for(let r=0;r<n.length;r++){const i=n[r],s=i.fromA<i.toA,a=i.fromB<i.toB;if(s&&(i.isBlock?nk(e,i.fromA,i.toA,l):l.push(Nl.inline(i.fromA,i.toA,{class:`${Jx}-removed`}))),a){const n=i.isBlock?ek(e,s?i.toA:i.fromA):s?i.toA:i.fromA,a=fk(t,i,i.isBlock);l.push(Nl.widget(n,a,{side:-1,key:`added-${o}-${r}`}))}}const c=n[n.length-1],d=ek(e,c.isBlock?c.fromA<c.toA?c.toA:c.fromA:r.toA),u=mk({commands:i,isBlockLevel:!0,change:r,acceptLabel:s,rejectLabel:a});l.push(Nl.widget(d,u,{side:-1,key:`controls-${o}`}))}function fk(e,t,n){var r;const o=document.createElement(n?"div":"span");o.className=`${Jx}-added`,o.contentEditable="false",n&&o.classList.add(`${Jx}-added-block`);const i=Un.fromSchema(e.type.schema);if(n){const n=function(e,t,n){const r=[];let o=!0,i=-1,s=-1;return tk(e,t,n,(e,t,n)=>{-1===i&&(i=t),s=n,r.push(e)}),0!==r.length&&i===t&&s===n||(o=!1),o?r:[]}(e,t.fromB,t.toB);if(n.length>0){const e=document.createDocumentFragment();for(const t of n)e.appendChild(i.serializeNode(t));return o.appendChild(e),o}}const s=e.slice(t.fromB,t.toB),a=i.serializeFragment(s.content);if(o.appendChild(a),!(null==(r=o.textContent)?void 0:r.trim())&&!o.querySelector("img, video, audio, canvas, svg")){const n=e.textBetween(t.fromB,t.toB,"\n","\n");n.trim()&&(o.textContent=n)}return o}function mk({commands:e,isBlockLevel:t,change:n,acceptLabel:r,rejectLabel:o}){const i=document.createElement(t?"div":"span");i.className=`${Jx}-controls`,i.contentEditable="false",t&&i.classList.add(`${Jx}-controls-block`);const s=t=>r=>{r.preventDefault(),r.stopPropagation();const o={fromA:n.fromA,toA:n.toA,fromB:n.fromB,toB:n.toB},i="accept"===t?Px.key:zx.key;e.call(i,o)},a=document.createElement("button");a.className=`${Jx}-accept`,a.textContent=r,a.addEventListener("click",s("accept"));const l=document.createElement("button");return l.className=`${Jx}-reject`,l.textContent=o,l.addEventListener("click",s("reject")),i.appendChild(a),i.appendChild(l),i}Kx(hk,{displayName:"Prose<diffDecoration>",group:"DiffComponent"});const gk=[Zx,hk];function vk(e,t){return Object.assign(e,{meta:{package:"@milkdown/plugin-streaming",...t}}),e}var yk=Md({throttleMs:100,scrollFollow:!0,diffReviewOnEnd:!1,ignoreAttrs:{heading:["id"]}},"streamingConfig");function wk(e){if(e.parent.type.spec.code)return{type:"plain-text",preserveNewlines:!0};for(let t=e.depth;t>0;t--)if("table"===e.node(t).type.name)return{type:"plain-text",preserveNewlines:!1};return e.depth>=1?{type:"split-block"}:{type:"block"}}function bk(e){if(0===e.childCount)return e;const t=e.lastChild;return"paragraph"===t.type.name&&0===t.content.size?e.cut(0,e.size-t.nodeSize):e}function xk(e,t,n){const{insertPos:r,currentEndPos:o}=n,i=n.buffer.replace(/\r\n?/g,"\n");if(!i)return{tr:t,applied:!1,insertEndPos:o};const s=t.doc.content.size,a=Math.max(0,Math.min(r,s)),l=Math.max(a,Math.min(o,s)),c=t.doc.resolve(a),d=(e.get(yk.key).insertStrategy??wk)(c),u={ctx:e,tr:t,buffer:i,from:a,to:l,resolved:c};switch(d.type){case"plain-text":return function({tr:e,buffer:t,from:n,to:r},o){const i=o?t:t.replace(/\n/g," "),s=e.doc.type.schema.text(i);return e=e.replaceWith(n,r,s),{tr:e,applied:!0,insertEndPos:n+i.length}}(u,d.preserveNewlines??!1);case"split-block":return function({ctx:e,tr:t,buffer:n,from:r,to:o,resolved:i}){const s=t.doc.type.schema,a=n.indexOf("\n");if(a<0){const i=Nk(e,s,n);return{tr:t=t.replaceWith(r,o,i),applied:!0,insertEndPos:r+i.size}}const l=n.substring(0,a),c=n.substring(a+1),d=e.get(Vc),u=c.trim()?Mk(d,c):null,h=u?bk(u.content):Ft.empty;if(0===h.childCount){const i=Nk(e,s,n.replace(/\n/g," "));return{tr:t=t.replaceWith(r,o,i),applied:!0,insertEndPos:r+i.size}}const p=i.depth;let f=Nk(e,s,l);for(let e=p;e>0;e--)f=Ft.from(i.node(e).copy(f));const m=f.append(h),g=new Zt(m,p,0),v=t.doc.content.size,y=t.doc.resolve(Math.min(o,v));let w=o;p>0&&y.depth===p&&y.parentOffset===y.parent.content.size&&(w=y.after(p));t=t.replace(r,w,g);const b=m.size-p;return{tr:t,applied:!0,insertEndPos:r+b}}(u);case"block":return function({ctx:e,tr:t,buffer:n,from:r,to:o}){const i=Mk(e.get(Vc),n);if(!i)return{tr:t,applied:!1,insertEndPos:o};const s=bk(i.content);return 0===s.size?{tr:t,applied:!1,insertEndPos:o}:(t=t.replace(r,o,new Zt(s,0,0)),{tr:t,applied:!0,insertEndPos:r+s.size})}(u)}}vk(yk,{displayName:"Ctx<streamingConfig>",group:"Streaming"});var kk=/[*_~`[\\<]|https?:\/\/|www\.|[\w.+-]@\w|&[a-zA-Z#]/,Ck=/\$(?!\s)(?:[^$\n]*[^\s$])?\$(?!\d)/,Sk=/:[\w+-]+:/;function Mk(e,t){try{return e(t)??null}catch{return null}}function Nk(e,t,n){if(!n)return Ft.empty;if(!function(e,t){return!!kk.test(t)||!(!e.nodes.math_inline||!Ck.test(t))||!(!e.nodes.emoji||!Sk.test(t))}(t,n))return Ft.from(t.text(n));const r=Mk(e.get(Vc),n)?.firstChild;if("paragraph"!==r?.type.name||0===r.content.size)return Ft.from(t.text(n));let o=r.content;const i=/^[ \t]+/.exec(n)?.[0];i&&(o=Ft.from(t.text(i)).append(o));const s=/[ \t]+$/.exec(n)?.[0];return s&&(o=o.append(Ft.from(t.text(s)))),o}function Ek(e,t,n){if(null!=n.insertPos){const r=n.insertPos,o=xk(e,t,{buffer:n.buffer,insertPos:r,currentEndPos:n.insertEndPos??r});return{tr:o.tr,newDoc:o.applied?o.tr.doc:null,insertEndPos:o.insertEndPos}}return function(e,t,n){const r=Mk(e.get(Vc),n);if(!r)return{tr:t,newDoc:null};const o=e.get(yk.key).ignoreAttrs,i=Ox(t.doc,r,o?{ignoreAttrs:o}:void 0);for(let e=i.length-1;e>=0;e--){const n=i[e],o=r.slice(n.fromB,n.toB);t=t.replace(n.fromA,n.toA,o)}return{tr:t,newDoc:r}}(e,t,n.buffer)}var Ok=new lo("MILKDOWN_STREAMING");var Ak=kd(e=>{const t=e.get(yk.key);return new io({key:Ok,state:{init:()=>null,apply:(e,t)=>function(e,t){if(!e&&"start"!==t?.type)return null;if(!t)return e;switch(t.type){case"start":return{buffer:"",originalDoc:t.originalDoc,active:!0,lastApplyTime:t.lastApplyTime,insertPos:t.insertPos??null,insertEndPos:t.insertEndPos??t.insertPos??null};case"push":return e?{...e,buffer:e.buffer+t.token}:null;case"apply":return e?{...e,lastApplyTime:t.lastApplyTime,insertEndPos:t.insertEndPos??e.insertEndPos}:null;case"end":case"abort":return null;default:return e}}(t,e.getMeta(Ok))},filterTransaction:(e,t)=>!Ok.getState(t)?.active||(!!e.getMeta(Ok)||!e.docChanged),view:()=>function(e,t){let n=null,r=-1,o=null;function i(){if(!o)return;const n=Ok.getState(o.state);if(!n?.active||n.buffer.length===r)return;r=n.buffer.length;const i=Ek(e,o.state.tr,n);if(!i.newDoc)return;let s=i.tr;(s.docChanged||null!=i.insertEndPos)&&(s=s.setMeta(Ok,{type:"apply",lastApplyTime:Date.now(),insertEndPos:i.insertEndPos}),t.scrollFollow&&(s=s.scrollIntoView()),o.dispatch(s))}function s(){null!=n&&clearTimeout(n),n=setTimeout(i,t.throttleMs)}return{update(e){o=e;const a=Ok.getState(e.state);if(!a?.active)return null!=n&&(clearTimeout(n),n=null),void(r=-1);a.buffer.length!==r&&(Date.now()-a.lastApplyTime>=t.throttleMs?i():s())},destroy(){null!=n&&(clearTimeout(n),n=null),o=null}}}(e,t)})});vk(Ak,{displayName:"Prose<streaming>",group:"Streaming"});var Tk=yd("StartStreaming",()=>e=>(t,n)=>{if(Ok.getState(t)?.active)return!1;if(n){let r,o;if(null!=e?.insertAt)if("selection"===e.insertAt){if(r=t.selection.from,o=t.selection.to,t.selection.empty){const e=t.doc.resolve(r);e.parent.isTextblock&&!e.parent.type.spec.code&&0===e.parent.content.size&&1===e.depth&&(r=e.before(e.depth),o=e.after(e.depth))}}else{const n="cursor"===e.insertAt?t.selection.head:e.insertAt;if(!Number.isFinite(n))return!1;r=Math.max(0,Math.min(Math.round(n),t.doc.content.size));const i=t.doc.resolve(r);i.parent.isTextblock&&!i.parent.type.spec.code&&0===i.parent.content.size&&1===i.depth&&(r=i.before(i.depth),o=i.after(i.depth))}n(t.tr.setMeta(Ok,{type:"start",originalDoc:t.doc,insertPos:r,insertEndPos:o,lastApplyTime:Date.now()}))}return!0});vk(Tk,{displayName:"Command<startStreaming>",group:"Streaming"});var Dk=yd("PushChunk",()=>e=>(t,n)=>null!=e&&(!!Ok.getState(t)?.active&&(n&&n(t.tr.setMeta(Ok,{type:"push",token:e})),!0)));vk(Dk,{displayName:"Command<pushChunk>",group:"Streaming"});var Ik=yd("EndStreaming",e=>t=>(n,r)=>{const o=Ok.getState(n);if(!o?.active)return!1;if(r){const i=e.get(yk.key),s=t?.diffReview??i.diffReviewOnEnd,a=Ek(e,n.tr,o);let l=a.tr;if(l=l.setMeta(Ok,{type:"end"}),s&&a.newDoc){const t=l.doc;l=l.replace(0,l.doc.content.size,new Zt(o.originalDoc.content,0,0)),r(l);try{e.get(Ac).call(Rx.key,t)}catch(e){console.warn("[milkdown/streaming] diff review handoff skipped:",e)}return!0}r(l)}return!0});vk(Ik,{displayName:"Command<endStreaming>",group:"Streaming"});var _k=yd("AbortStreaming",e=>t=>(n,r)=>{const o=Ok.getState(n);if(!o?.active)return!1;if(r){const i=t?.keep??!1;let s=n.tr;s=i?Ek(e,s,o).tr:s.replace(0,n.doc.content.size,new Zt(o.originalDoc.content,0,0)),s=s.setMeta(Ok,{type:"abort"}),r(s)}return!0});vk(_k,{displayName:"Command<abortStreaming>",group:"Streaming"});var Rk=[yk,Ak,Tk,Dk,Ik,_k],Lk=class{#Z;#Y;#X;#Q;#ee;#te;#ne;#re;#oe;#ie;#se;constructor(e){this.#te=!1,this.onShow=()=>{},this.onHide=()=>{},this.#ae=e=>{Be(e,this.element,{placement:this.#Q.placement??"top",middleware:[Pe(),ze(this.#oe),je(this.#ie),...this.#X],...this.#Q}).then(({x:e,y:t})=>{Object.assign(this.element.style,{left:`${e}px`,top:`${t}px`})}).catch(console.error)},this.#le=e=>this.#ee!==e.dom.parentElement,this.#ce=(e,t)=>{const{state:n,composing:r}=e,{selection:o,doc:i}=n,{ranges:s}=o,a=Math.min(...s.map(e=>e.$from.pos)),l=Math.max(...s.map(e=>e.$to.pos)),c=e=>!!e&&e.doc.eq(i)&&e.selection.eq(o),d=c(t)&&c(this.#re);if(this.#te||((this.#ee??e.dom.parentElement??document.body).appendChild(this.element),this.#te=!0),r||d)return;if(this.#re=n,this.#ne?.(),this.#ne=void 0,!this.#Y(e,t))return void this.hide();const u={getBoundingClientRect:()=>yi(e,a,l),contextElement:e.dom};this.#le(e)?this.#ne=Ve(u,this.element,()=>this.#ae(u)):this.#ae(u),this.show()},this.update=(e,t)=>{this.#se(e,t)},this.#de=e=>{const{doc:t,selection:n}=e.state,{empty:r,from:o,to:i}=n,s=!t.textBetween(o,i).length&&e.state.selection instanceof Fr,a=this.element.contains(document.activeElement),l=!e.hasFocus()&&!a,c=!e.editable;return!(l||r||s||c)},this.destroy=()=>{this.#ne?.(),this.#se.cancel()},this.show=(e,t)=>{if(this.element.dataset.show="true",e){this.#ne?.(),this.#ne=void 0;const n={...e,contextElement:t?.dom};t&&this.#le(t)?this.#ne=Ve(n,this.element,()=>this.#ae(n)):this.#ae(n)}this.onShow()},this.hide=()=>{"false"!==this.element.dataset.show&&(this.element.dataset.show="false",this.onHide())},this.element=e.content,this.#Z=e.debounce??200,this.#Y=e.shouldShow??this.#de,this.#oe=e.offset,this.#ie=e.shift,this.#X=e.middleware??[],this.#Q=e.floatingUIOptions??{},this.#ee=e.root,this.element.dataset.show="false",this.#se=$e(this.#ce,this.#Z)}#ae;#le;#ce;#de};function Bk(e){const t=Md({},`${e}_TOOLTIP_SPEC`),n=kd(n=>{const r=n.get(t.key);return new io({key:new lo(`${e}_TOOLTIP`),...r})}),r=[t,n];return r.key=t.key,r.pluginKey=n.key,t.meta={package:"@milkdown/plugin-tooltip",displayName:`Ctx<tooltipSpec>|${e}`},n.meta={package:"@milkdown/plugin-tooltip",displayName:`Prose<tooltip>|${e}`},r}function Pk({icon:e,class:t,onClick:n}){return Yw("span",{class:_e("milkdown-icon",t),onPointerdown:n,innerHTML:e?Re.sanitize(e.trim()):void 0})}function zk(e,t){return Object.assign(e,{meta:{package:"@milkdown/plugin-block",...t}}),e}Pk.props={icon:{type:String,required:!1},class:{type:String,required:!1},onClick:{type:Function,required:!1}};var jk=Md({filterNodes:e=>!xi(e=>"table"===e.type.name)(e)},"blockConfig");zk(jk,{displayName:"Ctx<blockConfig>"});var Vk=ri.ie&&ri.ie_version<15||ri.ios&&ri.webkit_version<604,$k=class{constructor(){this.#ue=()=>{if(!this.#he)return null;const e=this.#he,t=this.#pe;if(this.#fe=null,t&&Ur.isSelectable(e.node)){const n=Ur.create(t.state.doc,e.$pos.pos);return t.dispatch(t.state.tr.setSelection(n)),t.focus(),this.#fe=n,n}return null},this.#fe=null,this.#he=null,this.#me=void 0,this.#ge=!1,this.#ve=()=>{this.#ye?.({type:"hide"}),this.#he=null},this.#we=e=>{this.#he=e,this.#ye?.({type:"show",active:e})},this.bind=(e,t)=>{this.#P=e,this.#ye=t},this.addEvent=e=>{e.addEventListener("mousedown",this.#be),e.addEventListener("mouseup",this.#xe),e.addEventListener("dragstart",this.#ke),e.addEventListener("dragend",this.#Ce)},this.removeEvent=e=>{e.removeEventListener("mousedown",this.#be),e.removeEventListener("mouseup",this.#xe),e.removeEventListener("dragstart",this.#ke),e.removeEventListener("dragend",this.#Ce)},this.unBind=()=>{this.#ye=void 0},this.#be=()=>{this.#me=this.#he?.el.getBoundingClientRect(),this.#ue()},this.#xe=()=>{this.#ge?(this.#ge=!1,this.#fe=null):requestAnimationFrame(()=>{this.#me&&this.#pe?.focus()})},this.#ke=e=>{this.#ge=!0;const t=this.#pe;if(!t)return;t.dom.dataset.dragging="true";const n=this.#fe;if(e.dataTransfer&&n){const r=n.content();e.dataTransfer.effectAllowed="copyMove";const{dom:o,text:i}=t.serializeForClipboard(r);e.dataTransfer.clearData(),e.dataTransfer.setData(Vk?"Text":"text/html",o.innerHTML),Vk||e.dataTransfer.setData("text/plain",i);const s=this.#he?.el;s&&e.dataTransfer.setDragImage(s,0,0),t.dragging={slice:r,move:!0,node:n}}},this.#Ce=()=>{const e=this.#pe;if(!e)return;this.#Se(e);const t=e.dragging;window.setTimeout(()=>{e.dragging===t&&(e.dragging=null)},50)},this.keydownCallback=e=>(this.#ve(),this.#ge=!1,e.dom.dataset.dragging="false",!1),this.#Me=$e((e,t)=>{if(!e.editable)return;const n=e.dom.getBoundingClientRect(),r=n.left+n.width/2;if(!(e.root.elementFromPoint(r,t.clientY)instanceof Element))return void this.#ve();const o=this.#Ne;if(!o)return;const i=function(e,t,n){if(!e.dom.parentElement)return null;try{const r=e.posAtCoords({left:t.x,top:t.y})?.inside;if(null==r||r<0)return null;let o=e.state.doc.resolve(r),i=e.state.doc.nodeAt(r),s=e.nodeDOM(r);const a=t=>{const r=o.depth>=1&&0===o.index(o.depth);if(!t&&!r)return;const l=o.before(o.depth);i=e.state.doc.nodeAt(l),s=e.nodeDOM(l),o=e.state.doc.resolve(l),n(o,i)||a(!0)};return a(!n(o,i)),s&&i?{node:i,$pos:o,el:s}:null}catch{return null}}(e,{x:r,y:t.clientY},o);i?this.#we(i):this.#ve()},200),this.mousemoveCallback=(e,t)=>(e.composing||!e.editable||this.#Me(e,t),!1),this.dragoverCallback=(e,t)=>{if(this.#ge){const n=this.#pe?.dom.parentElement;if(!n)return!1;const r=n.scrollHeight>n.clientHeight,o=n.getBoundingClientRect();if(r){if(n.scrollTop>0&&Math.abs(t.y-o.y)<20)return n.scrollTop=n.scrollTop>10?n.scrollTop-10:0,!1;const r=Math.round(e.dom.getBoundingClientRect().height);if(Math.round(n.scrollTop+o.height)<r&&Math.abs(t.y-(o.height+o.y))<20)return n.scrollTop=n.scrollTop+10,!1}}return!1},this.dragenterCallback=e=>{e.dragging&&(this.#ge=!0,e.dom.dataset.dragging="true")},this.dragleaveCallback=(e,t)=>{const n=t.clientX,r=t.clientY;(n<0||r<0||n>window.innerWidth||r>window.innerHeight)&&(this.#he=null,this.#Se(e))},this.dropCallback=e=>(this.#Se(e),!1),this.dragendCallback=e=>{this.#Se(e)},this.#Se=e=>{this.#ge=!1,e.dom.dataset.dragging="false"}}#P;#ue;#fe;#he;#me;#ge;get#Ne(){try{return this.#P?.get(jk.key).filterNodes}catch{return}}get#pe(){return this.#P?.get(ac)}#ye;#ve;#we;#be;#xe;#ke;#Ce;#Me;#Se},Hk=Md(()=>new $k,"blockService"),qk=Md({},"blockServiceInstance");zk(Hk,{displayName:"Ctx<blockService>"}),zk(qk,{displayName:"Ctx<blockServiceInstance>"});var Fk=Md({},"blockSpec");zk(Fk,{displayName:"Ctx<blockSpec>"});var Wk=kd(e=>{const t=new lo("MILKDOWN_BLOCK"),n=e.get(Hk.key)();e.set(qk.key,n);const r=e.get(Fk.key);return new io({key:t,...r,props:{...r.props,handleDOMEvents:{drop:e=>n.dropCallback(e),pointermove:(e,t)=>n.mousemoveCallback(e,t),keydown:e=>n.keydownCallback(e),dragover:(e,t)=>n.dragoverCallback(e,t),dragleave:(e,t)=>n.dragleaveCallback(e,t),dragenter:e=>n.dragenterCallback(e),dragend:e=>n.dragendCallback(e)}}})});zk(Wk,{displayName:"Prose<block>"});var Uk=class{#Ee;#P;#Oe;#Ae;#ee;#te;#X;#Q;#Te;#De;#Ie;get active(){return this.#Ae}constructor(e){this.#Ae=null,this.#te=!1,this.update=()=>{requestAnimationFrame(()=>{if(!this.#te)try{this.#_e(),this.#te=!0}catch{}})},this.destroy=()=>{this.#Oe?.unBind(),this.#Oe?.removeEvent(this.#Ee),this.#Ee.remove()},this.show=e=>{const t=e.el,n=this.#P.get(ac).dom,r={ctx:this.#P,active:e,editorDom:n,blockDom:this.#Ee},o={contextElement:t,getBoundingClientRect:()=>this.#De?this.#De(r):t.getBoundingClientRect()},i=[Pe()];if(this.#Te){const e=this.#Te(r),t=ze(e);i.push(t)}Be(o,this.#Ee,{placement:this.#Ie?this.#Ie(r):"left",middleware:[...i,...this.#X],...this.#Q}).then(({x:e,y:t})=>{Object.assign(this.#Ee.style,{left:`${e}px`,top:`${t}px`}),this.#Ee.dataset.show="true"}).catch(console.error)},this.hide=()=>{this.#Ee.dataset.show="false"},this.#P=e.ctx,this.#Ee=e.content,this.#Te=e.getOffset,this.#De=e.getPosition,this.#Ie=e.getPlacement,this.#X=e.middleware??[],this.#Q=e.floatingUIOptions??{},this.#ee=e.root,this.hide()}#_e(){const e=this.#P.get(ac);(this.#ee??e.dom.parentElement??document.body).appendChild(this.#Ee);const t=this.#P.get(qk.key);t.bind(this.#P,e=>{"hide"===e.type?(this.hide(),this.#Ae=null):"show"===e.type&&(this.show(e.active),this.#Ae=e.active)}),this.#Oe=t,this.#Oe.addEvent(this.#Ee),this.#Ee.draggable=!0}},Gk=[Fk,jk,Hk,qk,Wk];Gk.key=Fk.key,Gk.pluginKey=Wk.key;var Kk=class{#te;#X;#Q;#ee;#Z;#Re;#Y;#se;#oe;constructor(e){this.#te=!1,this.onShow=()=>{},this.onHide=()=>{},this.#ce=(e,t)=>{const{state:n,composing:r}=e,{selection:o,doc:i}=n,{ranges:s}=o,a=Math.min(...s.map(e=>e.$from.pos)),l=Math.max(...s.map(e=>e.$to.pos)),c=t&&t.doc.eq(i)&&t.selection.eq(o);this.#te||((this.#ee??e.dom.parentElement??document.body).appendChild(this.element),this.#te=!0),r||c||(this.#Y(e,t)?(Be({getBoundingClientRect:()=>yi(e,a,l)},this.element,{placement:"bottom-start",middleware:[Pe(),ze(this.#oe),...this.#X],...this.#Q}).then(({x:e,y:t})=>{Object.assign(this.element.style,{left:`${e}px`,top:`${t}px`})}).catch(console.error),this.show()):this.hide())},this.#de=e=>{const t=this.getContent(e);if(!t)return!1;const n=t.at(-1);return!!n&&(Array.isArray(this.#Re)?this.#Re.includes(n):this.#Re===n)},this.update=(e,t)=>{this.#se(e,t)},this.getContent=(e,t=e=>"paragraph"===e.type.name)=>{const{selection:n}=e.state,{empty:r,$from:o}=n,i=e.state.selection instanceof Fr;if("undefined"==typeof document)return;const s=this.element.contains(document.activeElement),a=!e.hasFocus()&&!s,l=!e.editable,c=!(d=t,e=>Ci(d)(e.$from))(e.state.selection);var d;return a||l||!r||!i||c?void 0:o.parent.textBetween(Math.max(0,o.parentOffset-500),o.parentOffset,void 0,"")},this.destroy=()=>{this.#se.cancel()},this.show=()=>{this.element.dataset.show="true",this.onShow()},this.hide=()=>{this.element.dataset.show="false",this.onHide()},this.element=e.content,this.#Z=e.debounce??200,this.#Y=e.shouldShow??this.#de,this.#Re=e.trigger??"/",this.#oe=e.offset,this.#X=e.middleware??[],this.#Q=e.floatingUIOptions??{},this.#ee=e.root,this.#se=He(this.#ce,this.#Z)}#ce;#de},Jk=Object.defineProperty,Zk=Object.getOwnPropertySymbols,Yk=Object.prototype.hasOwnProperty,Xk=Object.prototype.propertyIsEnumerable,Qk=(e,t,n)=>t in e?Jk(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,eC=(e,t)=>{for(var n in t||(t={}))Yk.call(t,n)&&Qk(e,n,t[n]);if(Zk)for(var n of Zk(t))Xk.call(t,n)&&Qk(e,n,t[n]);return e};function tC(e,t){return Object.assign(e,{meta:eC({package:"@milkdown/components"},t)}),e}const nC=Md({imageIcon:"🌌",captionIcon:"💬",uploadButton:"Upload file",confirmButton:"Confirm ⏎",uploadPlaceholderText:"or paste the image link ...",captionPlaceholderText:"Image caption",onUpload:e=>Promise.resolve(URL.createObjectURL(e))},"imageBlockConfigCtx");function rC(e){return G(e,"paragraph",(e,t,n)=>{var r,o;if(1!==(null==(r=e.children)?void 0:r.length))return;const i=null==(o=e.children)?void 0:o[0];if(!i||"image"!==i.type)return;const{url:s,alt:a,title:l}=i,c={type:"image-block",url:s,alt:a,title:l};n.children.splice(t,1,c)})}tC(nC,{displayName:"Config<image-block>",group:"ImageBlock"});const oC=Dd("remark-image-block",()=>()=>rC);tC(oC.plugin,{displayName:"Remark<remarkImageBlock>",group:"ImageBlock"}),tC(oC.options,{displayName:"RemarkConfig<remarkImageBlock>",group:"ImageBlock"});var iC=Object.defineProperty,sC=Object.getOwnPropertySymbols,aC=Object.prototype.hasOwnProperty,lC=Object.prototype.propertyIsEnumerable,cC=(e,t,n)=>t in e?iC(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,dC=(e,t)=>{for(var n in t||(t={}))aC.call(t,n)&&cC(e,n,t[n]);if(sC)for(var n of sC(t))lC.call(t,n)&&cC(e,n,t[n]);return e};const uC="image-block",hC=Nd("image-block",()=>({inline:!1,group:"block",selectable:!0,draggable:!0,isolating:!0,marks:"",atom:!0,priority:100,attrs:{src:{default:"",validate:"string"},caption:{default:"",validate:"string"},ratio:{default:1,validate:"number"}},parseDOM:[{tag:`img[data-type="${uC}"]`,getAttrs:e=>{var t;if(!(e instanceof HTMLElement))throw St(e);return{src:e.getAttribute("src")||"",caption:e.getAttribute("caption")||"",ratio:Number(null!=(t=e.getAttribute("ratio"))?t:1)}}}],toDOM:e=>["img",dC({"data-type":uC},e.attrs)],parseMarkdown:{match:({type:e})=>"image-block"===e,runner:(e,t,n)=>{var r;const o=t.url,i=null!=(r=t.title)?r:"";let s=Number(t.alt||1);(Number.isNaN(s)||0===s)&&(s=1),e.addNode(n,{src:o,caption:i,ratio:s})}},toMarkdown:{match:e=>"image-block"===e.type.name,runner:(e,t)=>{e.openNode("paragraph"),e.addNode("image",void 0,void 0,{title:t.attrs.caption,url:t.attrs.src,alt:`${Number.parseFloat(t.attrs.ratio).toFixed(2)}`}),e.closeNode()}}}));tC(hC.node,{displayName:"NodeSchema<image-block>",group:"ImageBlock"});const pC=gd("abcdefghijklmnopqrstuvwxyz0123456789",8);function fC(e){return`${e}-${pC()}`}function mC({icon:e,class:t,onClick:n}){return Yw("span",{class:_e("milkdown-icon",t),onPointerdown:n,innerHTML:e?Re.sanitize(e.trim()):void 0})}mC.props={icon:{type:String,required:!1},class:{type:String,required:!1},onClick:{type:Function,required:!1}};const gC=mv({props:{src:{type:Object,required:!0},selected:{type:Object,required:!0},readonly:{type:Object,required:!0},setLink:{type:Function,required:!0},imageIcon:{type:String,required:!1},uploadButton:{type:String,required:!1},confirmButton:{type:String,required:!1},uploadPlaceholderText:{type:String,required:!1},onUpload:{type:Function,required:!0},onImageLoadError:{type:Function,required:!1}},setup({readonly:e,src:t,setLink:n,onUpload:r,imageIcon:o,uploadButton:i,confirmButton:s,uploadPlaceholderText:a,className:l,onImageLoadError:c}){var d,u;const h=Wm(!1),p=Wm(),f=Wm(null!=(d=t.value)?d:""),m=fC("milkdown-image-link"),g=fC("milkdown-image-upload"),v=Wm(0!==(null==(u=t.value)?void 0:u.length)),y=e=>{const t=e.target.value;v.value=0!==t.length,f.value=t},w=e=>{var t,r;"Enter"===e.key&&n(null!=(r=null==(t=p.value)?void 0:t.value)?r:"")},b=e=>{var t;const o=null==(t=e.target.files)?void 0:t[0];o&&r(o).then(e=>{e&&(n(e),v.value=!0)}).catch(e=>{console.error("An error occurred while uploading image"),console.error(e)})};return()=>Yw("div",{class:_e("image-edit",l)},Yw(mC,{icon:o,class:"image-icon"}),Yw("div",{class:_e("link-importer",h.value&&"focus")},Yw("input",{id:m,ref:p,draggable:"true",onDragstart:e=>{e.preventDefault(),e.stopPropagation()},disabled:e.value,class:"link-input-area",value:f.value,onInput:y,onKeydown:w,onFocus:()=>h.value=!0,onBlur:()=>h.value=!1}),!v.value&&Yw("div",{class:"placeholder"},Yw("input",{disabled:e.value,class:"hidden",id:g,type:"file",accept:"image/*",onChange:b}),Yw("label",{class:"uploader",for:g},Yw(mC,{icon:i})),Yw("span",{class:"text",onClick:()=>{var e;return null==(e=p.value)?void 0:e.focus()}},a))),f.value&&Yw(iw,null,Yw("div",{class:"image-preview"},Yw("img",{src:f.value,alt:"",onError:e=>Promise.resolve(null==c?void 0:c(e)).catch(()=>{})})),Yw("div",{class:"confirm",onClick:()=>{var e,t;n(null!=(t=null==(e=p.value)?void 0:e.value)?t:"")}},Yw(mC,{icon:s}))))}}),vC=mv({props:{src:{type:Object,required:!0},caption:{type:Object,required:!0},ratio:{type:Object,required:!0},selected:{type:Object,required:!0},readonly:{type:Object,required:!0},setAttr:{type:Function,required:!0},config:{type:Object,required:!0}},setup({src:e,caption:t,ratio:n,readonly:r,setAttr:o,config:i}){var s;const a=Wm(),l=Wm(),c=Wm(Boolean(null==(s=t.value)?void 0:s.length)),d=fC("milkdown-image-caption"),u=Wm(0),h=()=>{var e;const t=a.value;if(!t)return;const r=t.closest(".milkdown-image-block");if(!r)return;let o=r.getBoundingClientRect().width;if(!o)return;i.maxWidth&&i.maxWidth<o&&(o=i.maxWidth);const s=t.naturalHeight,l=t.naturalWidth;let c=l<o?s:o*(s/l);i.maxHeight&&c>i.maxHeight&&(c=i.maxHeight);const d=(c*(null!=(e=n.value)?e:1)).toFixed(2);t.dataset.origin=c.toFixed(2),t.dataset.height=d,t.style.height=`${d}px`,i.maxWidth&&(t.style.maxWidth=`${i.maxWidth}px`)},p=e=>{e.preventDefault(),e.stopPropagation(),r.value||(c.value=!c.value)},f=e=>{const t=e.target.value;u.value&&window.clearTimeout(u.value),u.value=window.setTimeout(()=>{o("caption",t)},1e3)},m=e=>{const t=e.target.value;u.value&&(window.clearTimeout(u.value),u.value=0),o("caption",t)},g=e=>{e.preventDefault();const t=a.value;if(!t)return;const n=t.getBoundingClientRect().top;let r=e.clientY-n;r<100&&(r=100),i.maxHeight&&r>i.maxHeight&&(r=i.maxHeight);const o=Number(r).toFixed(2);t.dataset.height=o,t.style.height=`${o}px`},v=()=>{window.removeEventListener("pointermove",g),window.removeEventListener("pointerup",v);const e=a.value;if(!e)return;const t=Number(e.dataset.origin),n=Number(e.dataset.height),r=Number.parseFloat(Number(n/t).toFixed(2));Number.isNaN(r)||o("ratio",r)},y=e=>{r.value||(e.preventDefault(),e.stopPropagation(),window.addEventListener("pointermove",g),window.addEventListener("pointerup",v))};return()=>Yw(iw,null,Yw("div",{class:"image-wrapper"},Yw("div",{class:"operation"},Yw("div",{class:"operation-item",onPointerdown:p},Yw(mC,{icon:i.captionIcon}))),Yw("img",{ref:a,"data-type":uC,onLoad:h,src:e.value,alt:t.value,onError:e=>{var t;return Promise.resolve(null==(t=i.onImageLoadError)?void 0:t.call(i,e)).catch(()=>{})}}),Yw("div",{ref:l,class:"image-resize-handle",onPointerdown:y})),c.value&&Yw("input",{id:d,draggable:"true",onDragstart:e=>{e.preventDefault(),e.stopPropagation()},class:"caption-input",placeholder:null==i?void 0:i.captionPlaceholderText,onInput:f,onBlur:m,value:t.value}))}});var yC=Object.defineProperty,wC=Object.getOwnPropertySymbols,bC=Object.prototype.hasOwnProperty,xC=Object.prototype.propertyIsEnumerable,kC=(e,t,n)=>t in e?yC(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;const CC=mv({props:{src:{type:Object,required:!0},caption:{type:Object,required:!0},ratio:{type:Object,required:!0},selected:{type:Object,required:!0},readonly:{type:Object,required:!0},setAttr:{type:Function,required:!0},config:{type:Object,required:!0}},setup(e){const{src:t}=e;return()=>{var n;return(null==(n=t.value)?void 0:n.length)?Yw(vC,((e,t)=>{for(var n in t||(t={}))bC.call(t,n)&&kC(e,n,t[n]);if(wC)for(var n of wC(t))xC.call(t,n)&&kC(e,n,t[n]);return e})({},e)):Yw(gC,{src:e.src,selected:e.selected,readonly:e.readonly,setLink:t=>e.setAttr("src",t),imageIcon:e.config.imageIcon,uploadButton:e.config.uploadButton,confirmButton:e.config.confirmButton,uploadPlaceholderText:e.config.uploadPlaceholderText,onUpload:e.config.onUpload,onImageLoadError:e.config.onImageLoadError})}}}),SC=Sd(hC.node,e=>(t,n,r)=>{const o=Wm(t.attrs.src),i=Wm(t.attrs.caption),s=Wm(t.attrs.ratio),a=Wm(!1),l=Wm(!n.editable),c=e.get(nC.key),d=Db(CC,{src:o,caption:i,ratio:s,selected:a,readonly:l,setAttr:(e,t)=>{if(!n.editable)return;const o=r();null!=o&&n.dispatch(n.state.tr.setNodeAttribute(o,e,"src"===e?Re.sanitize(t):t))},config:c}),u=document.createElement("div");u.className="milkdown-image-block";const h=ov(()=>{a.value?u.classList.add("selected"):u.classList.remove("selected")}),p=c.proxyDomURL,f=e=>{if(p){const t=p(e.attrs.src);"string"==typeof t?o.value=t:t.then(e=>{o.value=e}).catch(console.error)}else o.value=e.attrs.src;s.value=e.attrs.ratio,i.value=e.attrs.caption,l.value=!n.editable};return f(t),d.mount(u),{dom:u,update:e=>e.type===t.type&&(f(e),!0),stopEvent:e=>e.target instanceof HTMLInputElement,selectNode:()=>{a.value=!0},deselectNode:()=>{a.value=!1},destroy:()=>{h(),d.unmount(),u.remove()}}});tC(SC,{displayName:"NodeView<image-block>",group:"ImageBlock"});const MC=[oC,hC,SC,nC].flat();let NC,EC;if("undefined"!=typeof WeakMap){let e=new WeakMap;NC=t=>e.get(t),EC=(t,n)=>(e.set(t,n),n)}else{const e=[],t=10;let n=0;NC=t=>{for(let n=0;n<e.length;n+=2)if(e[n]==t)return e[n+1]},EC=(r,o)=>(n==t&&(n=0),e[n++]=r,e[n++]=o)}var OC=class{constructor(e,t,n,r){this.width=e,this.height=t,this.map=n,this.problems=r}findCell(e){for(let t=0;t<this.map.length;t++){const n=this.map[t];if(n!=e)continue;const r=t%this.width,o=t/this.width|0;let i=r+1,s=o+1;for(let e=1;i<this.width&&this.map[t+e]==n;e++)i++;for(let e=1;s<this.height&&this.map[t+this.width*e]==n;e++)s++;return{left:r,top:o,right:i,bottom:s}}throw new RangeError(`No cell with offset ${e} found`)}colCount(e){for(let t=0;t<this.map.length;t++)if(this.map[t]==e)return t%this.width;throw new RangeError(`No cell with offset ${e} found`)}nextCell(e,t,n){const{left:r,right:o,top:i,bottom:s}=this.findCell(e);return"horiz"==t?(n<0?0==r:o==this.width)?null:this.map[i*this.width+(n<0?r-1:o)]:(n<0?0==i:s==this.height)?null:this.map[r+this.width*(n<0?i-1:s)]}rectBetween(e,t){const{left:n,right:r,top:o,bottom:i}=this.findCell(e),{left:s,right:a,top:l,bottom:c}=this.findCell(t);return{left:Math.min(n,s),top:Math.min(o,l),right:Math.max(r,a),bottom:Math.max(i,c)}}cellsInRect(e){const t=[],n={};for(let r=e.top;r<e.bottom;r++)for(let o=e.left;o<e.right;o++){const i=r*this.width+o,s=this.map[i];n[s]||(n[s]=!0,o==e.left&&o&&this.map[i-1]==s||r==e.top&&r&&this.map[i-this.width]==s||t.push(s))}return t}positionAt(e,t,n){for(let r=0,o=0;;r++){const i=o+n.child(r).nodeSize;if(r==e){let n=t+e*this.width;const r=(e+1)*this.width;for(;n<r&&this.map[n]<o;)n++;return n==r?i-1:this.map[n]}o=i}}static get(e){return NC(e)||EC(e,function(e){if("table"!=e.type.spec.tableRole)throw new RangeError("Not a table node: "+e.type.name);const t=function(e){let t=-1,n=!1;for(let r=0;r<e.childCount;r++){const o=e.child(r);let i=0;if(n)for(let t=0;t<r;t++){const n=e.child(t);for(let e=0;e<n.childCount;e++){const o=n.child(e);t+o.attrs.rowspan>r&&(i+=o.attrs.colspan)}}for(let e=0;e<o.childCount;e++){const t=o.child(e);i+=t.attrs.colspan,t.attrs.rowspan>1&&(n=!0)}-1==t?t=i:t!=i&&(t=Math.max(t,i))}return t}(e),n=e.childCount,r=[];let o=0,i=null;const s=[];for(let e=0,o=t*n;e<o;e++)r[e]=0;for(let a=0,l=0;a<n;a++){const c=e.child(a);l++;for(let e=0;;e++){for(;o<r.length&&0!=r[o];)o++;if(e==c.childCount)break;const d=c.child(e),{colspan:u,rowspan:h,colwidth:p}=d.attrs;for(let e=0;e<h;e++){if(e+a>=n){(i||(i=[])).push({type:"overlong_rowspan",pos:l,n:h-e});break}const c=o+e*t;for(let e=0;e<u;e++){0==r[c+e]?r[c+e]=l:(i||(i=[])).push({type:"collision",row:a,pos:l,n:u-e});const n=p&&p[e];if(n){const r=(c+e)%t*2,o=s[r];null==o||o!=n&&1==s[r+1]?(s[r]=n,s[r+1]=1):o==n&&s[r+1]++}}}o+=u,l+=d.nodeSize}const d=(a+1)*t;let u=0;for(;o<d;)0==r[o++]&&u++;u&&(i||(i=[])).push({type:"missing",row:a,n:u}),l++}0!==t&&0!==n||(i||(i=[])).push({type:"zero_sized"});const a=new OC(t,n,r,i);let l=!1;for(let e=0;!l&&e<s.length;e+=2)null!=s[e]&&s[e+1]<n&&(l=!0);l&&function(e,t,n){e.problems||(e.problems=[]);const r={};for(let o=0;o<e.map.length;o++){const i=e.map[o];if(r[i])continue;r[i]=!0;const s=n.nodeAt(i);if(!s)throw new RangeError(`No cell with offset ${i} found`);let a=null;const l=s.attrs;for(let n=0;n<l.colspan;n++){const r=t[(o+n)%e.width*2];null==r||l.colwidth&&l.colwidth[n]==r||((a||(a=AC(l)))[n]=r)}a&&e.problems.unshift({type:"colwidth mismatch",pos:i,colwidth:a})}}(a,s,e);return a}(e))}};function AC(e){if(e.colwidth)return e.colwidth.slice();const t=[];for(let n=0;n<e.colspan;n++)t.push(0);return t}function TC(e,t){if("string"==typeof e)return{};const n=e.getAttribute("data-colwidth"),r=n&&/^\d+(,\d+)*$/.test(n)?n.split(",").map(e=>Number(e)):null,o=Number(e.getAttribute("colspan")||1),i={colspan:o,rowspan:Number(e.getAttribute("rowspan")||1),colwidth:r&&r.length==o?r:null};for(const n in t){const r=t[n].getFromDOM,o=r&&r(e);null!=o&&(i[n]=o)}return i}function DC(e,t){const n={};1!=e.attrs.colspan&&(n.colspan=e.attrs.colspan),1!=e.attrs.rowspan&&(n.rowspan=e.attrs.rowspan),e.attrs.colwidth&&(n["data-colwidth"]=e.attrs.colwidth.join(","));for(const r in t){const o=t[r].setDOMAttr;o&&o(e.attrs[r],n)}return n}function IC(e){if(null!==e){if(!Array.isArray(e))throw new TypeError("colwidth must be null or an array");for(const t of e)if("number"!=typeof t)throw new TypeError("colwidth must be null or an array of numbers")}}function _C(e){let t=e.cached.tableNodeTypes;if(!t){t=e.cached.tableNodeTypes={};for(const n in e.nodes){const r=e.nodes[n],o=r.spec.tableRole;o&&(t[o]=r)}}return t}const RC=new lo("selectingCells");function LC(e){for(let t=e.depth-1;t>0;t--)if("row"==e.node(t).type.spec.tableRole)return e.node(0).resolve(e.before(t+1));return null}function BC(e){const t=e.selection.$head;for(let e=t.depth;e>0;e--)if("row"==t.node(e).type.spec.tableRole)return!0;return!1}function PC(e){const t=e.selection;if("$anchorCell"in t&&t.$anchorCell)return t.$anchorCell.pos>t.$headCell.pos?t.$anchorCell:t.$headCell;if("node"in t&&t.node&&"cell"==t.node.type.spec.tableRole)return t.$anchor;const n=LC(t.$head)||function(e){for(let t=e.nodeAfter,n=e.pos;t;t=t.firstChild,n++){const r=t.type.spec.tableRole;if("cell"==r||"header_cell"==r)return e.doc.resolve(n)}for(let t=e.nodeBefore,n=e.pos;t;t=t.lastChild,n--){const r=t.type.spec.tableRole;if("cell"==r||"header_cell"==r)return e.doc.resolve(n-t.nodeSize)}}(t.$head);if(n)return n;throw new RangeError(`No cell found around position ${t.head}`)}function zC(e){return"row"==e.parent.type.spec.tableRole&&!!e.nodeAfter}function jC(e,t){return e.depth==t.depth&&e.pos>=t.start(-1)&&e.pos<=t.end(-1)}function VC(e,t,n){const r=e.node(-1),o=OC.get(r),i=e.start(-1),s=o.nextCell(e.pos-i,t,n);return null==s?null:e.node(0).resolve(i+s)}function $C(e,t,n=1){const r={...e,colspan:e.colspan-n};return r.colwidth&&(r.colwidth=r.colwidth.slice(),r.colwidth.splice(t,n),r.colwidth.some(e=>e>0)||(r.colwidth=null)),r}function HC(e,t,n=1){const r={...e,colspan:e.colspan+n};if(r.colwidth){r.colwidth=r.colwidth.slice();for(let e=0;e<n;e++)r.colwidth.splice(t,0,0)}return r}var qC=class e extends Vr{constructor(e,t=e){const n=e.node(-1),r=OC.get(n),o=e.start(-1),i=r.rectBetween(e.pos-o,t.pos-o),s=e.node(0),a=r.cellsInRect(i).filter(e=>e!=t.pos-o);a.unshift(t.pos-o);const l=a.map(e=>{const t=n.nodeAt(e);if(!t)throw new RangeError(`No cell with offset ${e} found`);const r=o+e+1;return new $r(s.resolve(r),s.resolve(r+t.content.size))});super(l[0].$from,l[0].$to,l),this.$anchorCell=e,this.$headCell=t}map(t,n){const r=t.resolve(n.map(this.$anchorCell.pos)),o=t.resolve(n.map(this.$headCell.pos));if(zC(r)&&zC(o)&&jC(r,o)){const t=this.$anchorCell.node(-1)!=r.node(-1);return t&&this.isRowSelection()?e.rowSelection(r,o):t&&this.isColSelection()?e.colSelection(r,o):new e(r,o)}return Fr.between(r,o)}content(){const e=this.$anchorCell.node(-1),t=OC.get(e),n=this.$anchorCell.start(-1),r=t.rectBetween(this.$anchorCell.pos-n,this.$headCell.pos-n),o={},i=[];for(let n=r.top;n<r.bottom;n++){const s=[];for(let i=n*t.width+r.left,a=r.left;a<r.right;a++,i++){const n=t.map[i];if(o[n])continue;o[n]=!0;const a=t.findCell(n);let l=e.nodeAt(n);if(!l)throw new RangeError(`No cell with offset ${n} found`);const c=r.left-a.left,d=a.right-r.right;if(c>0||d>0){let e=l.attrs;if(c>0&&(e=$C(e,0,c)),d>0&&(e=$C(e,e.colspan-d,d)),a.left<r.left){if(l=l.type.createAndFill(e),!l)throw new RangeError(`Could not create cell with attrs ${JSON.stringify(e)}`)}else l=l.type.create(e,l.content)}if(a.top<r.top||a.bottom>r.bottom){const e={...l.attrs,rowspan:Math.min(a.bottom,r.bottom)-Math.max(a.top,r.top)};l=a.top<r.top?l.type.createAndFill(e):l.type.create(e,l.content)}s.push(l)}i.push(e.child(n).copy(Ft.from(s)))}const s=this.isColSelection()&&this.isRowSelection()?e:i;return new Zt(Ft.from(s),1,1)}replace(e,t=Zt.empty){const n=e.steps.length,r=this.ranges;for(let o=0;o<r.length;o++){const{$from:i,$to:s}=r[o],a=e.mapping.slice(n);e.replace(a.map(i.pos),a.map(s.pos),o?Zt.empty:t)}const o=Vr.findFrom(e.doc.resolve(e.mapping.slice(n).map(this.to)),-1);o&&e.setSelection(o)}replaceWith(e,t){this.replace(e,new Zt(Ft.from(t),0,0))}forEachCell(e){const t=this.$anchorCell.node(-1),n=OC.get(t),r=this.$anchorCell.start(-1),o=n.cellsInRect(n.rectBetween(this.$anchorCell.pos-r,this.$headCell.pos-r));for(let n=0;n<o.length;n++)e(t.nodeAt(o[n]),r+o[n])}isColSelection(){const e=this.$anchorCell.index(-1),t=this.$headCell.index(-1);if(Math.min(e,t)>0)return!1;const n=e+this.$anchorCell.nodeAfter.attrs.rowspan,r=t+this.$headCell.nodeAfter.attrs.rowspan;return Math.max(n,r)==this.$headCell.node(-1).childCount}static colSelection(t,n=t){const r=t.node(-1),o=OC.get(r),i=t.start(-1),s=o.findCell(t.pos-i),a=o.findCell(n.pos-i),l=t.node(0);return s.top<=a.top?(s.top>0&&(t=l.resolve(i+o.map[s.left])),a.bottom<o.height&&(n=l.resolve(i+o.map[o.width*(o.height-1)+a.right-1]))):(a.top>0&&(n=l.resolve(i+o.map[a.left])),s.bottom<o.height&&(t=l.resolve(i+o.map[o.width*(o.height-1)+s.right-1]))),new e(t,n)}isRowSelection(){const e=this.$anchorCell.node(-1),t=OC.get(e),n=this.$anchorCell.start(-1),r=t.colCount(this.$anchorCell.pos-n),o=t.colCount(this.$headCell.pos-n);if(Math.min(r,o)>0)return!1;const i=r+this.$anchorCell.nodeAfter.attrs.colspan,s=o+this.$headCell.nodeAfter.attrs.colspan;return Math.max(i,s)==t.width}eq(t){return t instanceof e&&t.$anchorCell.pos==this.$anchorCell.pos&&t.$headCell.pos==this.$headCell.pos}static rowSelection(t,n=t){const r=t.node(-1),o=OC.get(r),i=t.start(-1),s=o.findCell(t.pos-i),a=o.findCell(n.pos-i),l=t.node(0);return s.left<=a.left?(s.left>0&&(t=l.resolve(i+o.map[s.top*o.width])),a.right<o.width&&(n=l.resolve(i+o.map[o.width*(a.top+1)-1]))):(a.left>0&&(n=l.resolve(i+o.map[a.top*o.width])),s.right<o.width&&(t=l.resolve(i+o.map[o.width*(s.top+1)-1]))),new e(t,n)}toJSON(){return{type:"cell",anchor:this.$anchorCell.pos,head:this.$headCell.pos}}static fromJSON(t,n){return new e(t.resolve(n.anchor),t.resolve(n.head))}static create(t,n,r=n){return new e(t.resolve(n),t.resolve(r))}getBookmark(){return new FC(this.$anchorCell.pos,this.$headCell.pos)}};qC.prototype.visible=!1,Vr.jsonID("cell",qC);var FC=class e{constructor(e,t){this.anchor=e,this.head=t}map(t){return new e(t.map(this.anchor),t.map(this.head))}resolve(e){const t=e.resolve(this.anchor),n=e.resolve(this.head);return"row"==t.parent.type.spec.tableRole&&"row"==n.parent.type.spec.tableRole&&t.index()<t.parent.childCount&&n.index()<n.parent.childCount&&jC(t,n)?new qC(t,n):Vr.near(n,1)}};function WC(e){if(!(e.selection instanceof qC))return null;const t=[];return e.selection.forEachCell((e,n)=>{t.push(Nl.node(n,n+e.nodeSize,{class:"selectedCell"}))}),Al.create(e.doc,t)}const UC=new lo("fix-tables");function GC(e,t,n,r){const o=e.childCount,i=t.childCount;e:for(let s=0,a=0;s<i;s++){const i=t.child(s);for(let t=a,r=Math.min(o,s+3);t<r;t++)if(e.child(t)==i){a=t+1,n+=i.nodeSize;continue e}r(i,n),a<o&&e.child(a).sameMarkup(i)?GC(e.child(a),i,n+1,r):i.nodesBetween(0,i.content.size,r,n+1),n+=i.nodeSize}}function KC(e,t){let n;const r=(t,r)=>{"table"==t.type.spec.tableRole&&(n=function(e,t,n,r){const o=OC.get(t);if(!o.problems)return r;r||(r=e.tr);const i=[];for(let e=0;e<o.height;e++)i.push(0);for(let e=0;e<o.problems.length;e++){const s=o.problems[e];if("collision"==s.type){const e=t.nodeAt(s.pos);if(!e)continue;const o=e.attrs;for(let e=0;e<o.rowspan;e++)i[s.row+e]+=s.n;r.setNodeMarkup(r.mapping.map(n+1+s.pos),null,$C(o,o.colspan-s.n,s.n))}else if("missing"==s.type)i[s.row]+=s.n;else if("overlong_rowspan"==s.type){const e=t.nodeAt(s.pos);if(!e)continue;r.setNodeMarkup(r.mapping.map(n+1+s.pos),null,{...e.attrs,rowspan:e.attrs.rowspan-s.n})}else if("colwidth mismatch"==s.type){const e=t.nodeAt(s.pos);if(!e)continue;r.setNodeMarkup(r.mapping.map(n+1+s.pos),null,{...e.attrs,colwidth:s.colwidth})}else if("zero_sized"==s.type){const e=r.mapping.map(n);r.delete(e,e+t.nodeSize)}}let s,a;for(let e=0;e<i.length;e++)i[e]&&(null==s&&(s=e),a=e);for(let l=0,c=n+1;l<o.height;l++){const n=t.child(l),o=c+n.nodeSize,d=i[l];if(d>0){let t="cell";n.firstChild&&(t=n.firstChild.type.spec.tableRole);const i=[];for(let n=0;n<d;n++){const n=_C(e.schema)[t].createAndFill();n&&i.push(n)}const u=0!=l&&s!=l-1||a!=l?o-1:c+1;r.insert(r.mapping.map(u),i)}c=o}return r.setMeta(UC,{fixTables:!0})}(e,t,r,n))};return t?t.doc!=e.doc&&GC(t.doc,e.doc,0,r):e.doc.descendants(r),n}function JC(e){const t=OC.get(e),n=[],r=t.height,o=t.width;for(let i=0;i<r;i++){const r=[];for(let n=0;n<o;n++){const s=i*o+n,a=t.map[s];if(i>0){const e=s-o;if(a===t.map[e]){r.push(null);continue}}if(n>0){const e=s-1;if(a===t.map[e]){r.push(null);continue}}r.push(e.nodeAt(a))}n.push(r)}return n}function ZC(e,t){const n=[],r=OC.get(e),o=r.height,i=r.width;for(let s=0;s<o;s++){const o=e.child(s),a=[];for(let n=0;n<i;n++){const o=t[s][n];if(!o)continue;const i=r.map[s*r.width+n],l=e.nodeAt(i);if(!l)continue;const c=l.type.createChecked(o.attrs,o.content,o.marks);a.push(c)}const l=o.type.createChecked(o.attrs,a,o.marks);n.push(l)}return e.type.createChecked(e.attrs,n,e.marks)}function YC(e,t,n,r){const o=t[0]>n[0]?-1:1,i=e.splice(t[0],t.length),s=i.length%2==0?1:0;let a;return a=-1===o?n[0]:n[n.length-1]-s,e.splice(a,0,...i),e}function XC(e){return function(e,t){for(let n=t.depth;n>=0;n-=1){const r=t.node(n);if(e(r))return{node:r,pos:0===n?0:t.before(n),start:t.start(n),depth:n}}return null}(e=>"table"===e.type.spec.tableRole,e)}function QC(e,t){const n=XC(t.$from);if(!n)return;const r=OC.get(n.node);return e<0||e>r.width-1?void 0:r.cellsInRect({left:e,right:e+1,top:0,bottom:r.height}).map(e=>{const t=n.node.nodeAt(e),r=e+n.start;return{pos:r,start:r+1,node:t,depth:n.depth+2}})}function eS(e,t){const n=XC(t.$from);if(!n)return;const r=OC.get(n.node);return e<0||e>r.height-1?void 0:r.cellsInRect({left:0,right:r.width,top:e,bottom:e+1}).map(e=>{const t=n.node.nodeAt(e),r=e+n.start;return{pos:r,start:r+1,node:t,depth:n.depth+2}})}function tS(e,t,n=t){let r=t,o=n;for(let n=t;n>=0;n--){const t=QC(n,e.selection);t&&t.forEach(e=>{const t=e.node.attrs.colspan+n-1;t>=r&&(r=n),t>o&&(o=t)})}for(let n=t;n<=o;n++){const t=QC(n,e.selection);t&&t.forEach(e=>{const t=e.node.attrs.colspan+n-1;e.node.attrs.colspan>1&&t>o&&(o=t)})}const i=[];for(let t=r;t<=o;t++){const n=QC(t,e.selection);n&&n.length>0&&i.push(t)}r=i[0],o=i[i.length-1];const s=QC(r,e.selection),a=eS(0,e.selection);if(!s||!a)return;const l=e.doc.resolve(s[s.length-1].pos);let c;for(let t=o;t>=r;t--){const n=QC(t,e.selection);if(n&&n.length>0){for(let e=a.length-1;e>=0;e--)if(a[e].pos===n[0].pos){c=n[0];break}if(c)break}}return c?{$anchor:l,$head:e.doc.resolve(c.pos),indexes:i}:void 0}function nS(e,t,n=t){let r=t,o=n;for(let n=t;n>=0;n--){const t=eS(n,e.selection);t&&t.forEach(e=>{const t=e.node.attrs.rowspan+n-1;t>=r&&(r=n),t>o&&(o=t)})}for(let n=t;n<=o;n++){const t=eS(n,e.selection);t&&t.forEach(e=>{const t=e.node.attrs.rowspan+n-1;e.node.attrs.rowspan>1&&t>o&&(o=t)})}const i=[];for(let t=r;t<=o;t++){const n=eS(t,e.selection);n&&n.length>0&&i.push(t)}r=i[0],o=i[i.length-1];const s=eS(r,e.selection),a=QC(0,e.selection);if(!s||!a)return;const l=e.doc.resolve(s[s.length-1].pos);let c;for(let t=o;t>=r;t--){const n=eS(t,e.selection);if(n&&n.length>0){for(let e=a.length-1;e>=0;e--)if(a[e].pos===n[0].pos){c=n[0];break}if(c)break}}return c?{$anchor:l,$head:e.doc.resolve(c.pos),indexes:i}:void 0}function rS(e){return e[0].map((t,n)=>e.map(e=>e[n]))}function oS(e){var t,n;const{tr:r,originIndex:o,targetIndex:i,select:s,pos:a}=e,l=XC(r.doc.resolve(a));if(!l)return!1;const c=null===(t=tS(r,o))||void 0===t?void 0:t.indexes,d=null===(n=tS(r,i))||void 0===n?void 0:n.indexes;if(!c||!d)return!1;if(c.includes(i))return!1;const u=function(e,t,n){let r=rS(JC(e));return r=YC(r,t,n),r=rS(r),ZC(e,r)}(l.node,c,d);if(r.replaceWith(l.pos,l.pos+l.node.nodeSize,u),!s)return!0;const h=OC.get(u),p=l.start,f=i,m=h.positionAt(h.height-1,f,u),g=r.doc.resolve(p+m),v=h.positionAt(0,f,u),y=r.doc.resolve(p+v);return r.setSelection(qC.colSelection(g,y)),!0}function iS(e){var t,n;const{tr:r,originIndex:o,targetIndex:i,select:s,pos:a}=e,l=XC(r.doc.resolve(a));if(!l)return!1;const c=null===(t=nS(r,o))||void 0===t?void 0:t.indexes,d=null===(n=nS(r,i))||void 0===n?void 0:n.indexes;if(!c||!d)return!1;if(c.includes(i))return!1;const u=function(e,t,n){let r=JC(e);return r=YC(r,t,n),ZC(e,r)}(l.node,c,d);if(r.replaceWith(l.pos,l.pos+l.node.nodeSize,u),!s)return!0;const h=OC.get(u),p=l.start,f=i,m=h.positionAt(f,h.width-1,u),g=r.doc.resolve(p+m),v=h.positionAt(f,0,u),y=r.doc.resolve(p+v);return r.setSelection(qC.rowSelection(g,y)),!0}function sS(e){const t=e.selection,n=PC(e),r=n.node(-1),o=n.start(-1),i=OC.get(r);return{...t instanceof qC?i.rectBetween(t.$anchorCell.pos-o,t.$headCell.pos-o):i.findCell(n.pos-o),tableStart:o,map:i,table:r}}function aS(e,{map:t,tableStart:n,table:r},o){let i=o>0?-1:0;(function(e,t,n){const r=_C(t.type.schema).header_cell;for(let o=0;o<e.height;o++)if(t.nodeAt(e.map[n+o*e.width]).type!=r)return!1;return!0})(t,r,o+i)&&(i=0==o||o==t.width?null:0);for(let s=0;s<t.height;s++){const a=s*t.width+o;if(o>0&&o<t.width&&t.map[a-1]==t.map[a]){const i=t.map[a],l=r.nodeAt(i);e.setNodeMarkup(e.mapping.map(n+i),null,HC(l.attrs,o-t.colCount(i))),s+=l.attrs.rowspan-1}else{const l=null==i?_C(r.type.schema).cell:r.nodeAt(t.map[a+i]).type,c=t.positionAt(s,o,r);e.insert(e.mapping.map(n+c),l.createAndFill())}}return e}function lS(e,t){if(!BC(e))return!1;if(t){const n=sS(e);t(aS(e.tr,n,n.left))}return!0}function cS(e,t){if(!BC(e))return!1;if(t){const n=sS(e);t(aS(e.tr,n,n.right))}return!0}function dS(e,{map:t,table:n,tableStart:r},o){const i=e.mapping.maps.length;for(let s=0;s<t.height;){const a=s*t.width+o,l=t.map[a],c=n.nodeAt(l),d=c.attrs;if(o>0&&t.map[a-1]==l||o<t.width-1&&t.map[a+1]==l)e.setNodeMarkup(e.mapping.slice(i).map(r+l),null,$C(d,o-t.colCount(l)));else{const t=e.mapping.slice(i).map(r+l);e.delete(t,t+c.nodeSize)}s+=d.rowspan}}function uS(e,{map:t,table:n,tableStart:r},o){let i=0;for(let e=0;e<o;e++)i+=n.child(e).nodeSize;const s=i+n.child(o).nodeSize,a=e.mapping.maps.length;e.delete(i+r,s+r);const l=new Set;for(let i=0,s=o*t.width;i<t.width;i++,s++){const c=t.map[s];if(!l.has(c))if(l.add(c),o>0&&c==t.map[s-t.width]){const t=n.nodeAt(c).attrs;e.setNodeMarkup(e.mapping.slice(a).map(c+r),null,{...t,rowspan:t.rowspan-1}),i+=t.colspan-1}else if(o<t.height&&c==t.map[s+t.width]){const s=n.nodeAt(c),l=s.attrs,d=s.type.create({...l,rowspan:s.attrs.rowspan-1},s.content),u=t.positionAt(o+1,i,n);e.insert(e.mapping.slice(a).map(r+u),d),i+=l.colspan-1}}}function hS(e,t,n){const r=t.map.cellsInRect({left:0,top:0,right:"row"==e?t.map.width:1,bottom:"column"==e?t.map.height:1});for(let e=0;e<r.length;e++){const o=t.table.nodeAt(r[e]);if(o&&o.type!==n.header_cell)return!1}return!0}function pS(e,t){return(t=t||{useDeprecatedLogic:!1}).useDeprecatedLogic?function(e){return function(t,n){if(!BC(t))return!1;if(n){const r=_C(t.schema),o=sS(t),i=t.tr,s=o.map.cellsInRect("column"==e?{left:o.left,top:0,right:o.right,bottom:o.map.height}:"row"==e?{left:0,top:o.top,right:o.map.width,bottom:o.bottom}:o),a=s.map(e=>o.table.nodeAt(e));for(let e=0;e<s.length;e++)a[e].type==r.header_cell&&i.setNodeMarkup(o.tableStart+s[e],r.cell,a[e].attrs);if(0===i.steps.length)for(let e=0;e<s.length;e++)i.setNodeMarkup(o.tableStart+s[e],r.header_cell,a[e].attrs);n(i)}return!0}}(e):function(t,n){if(!BC(t))return!1;if(n){const r=_C(t.schema),o=sS(t),i=t.tr,s=hS("row",o,r),a=hS("column",o,r),l=("column"===e?s:"row"===e&&a)?1:0,c="column"==e?{left:0,top:l,right:1,bottom:o.map.height}:"row"==e?{left:l,top:0,right:o.map.width,bottom:1}:o,d="column"==e?a?r.cell:r.header_cell:"row"==e?s?r.cell:r.header_cell:r.cell;o.map.cellsInRect(c).forEach(e=>{const t=e+o.tableStart,n=i.doc.nodeAt(t);n&&i.setNodeMarkup(t,d,n.attrs)}),n(i)}return!0}}function fS(e){return function(t,n){if(!BC(t))return!1;const r=function(e,t){if(t<0){const t=e.nodeBefore;if(t)return e.pos-t.nodeSize;for(let t=e.index(-1)-1,n=e.before();t>=0;t--){const r=e.node(-1).child(t),o=r.lastChild;if(o)return n-1-o.nodeSize;n-=r.nodeSize}}else{if(e.index()<e.parent.childCount-1)return e.pos+e.nodeAfter.nodeSize;const t=e.node(-1);for(let n=e.indexAfter(-1),r=e.after();n<t.childCount;n++){const e=t.child(n);if(e.childCount)return r+1;r+=e.nodeSize}}return null}(PC(t),e);if(null==r)return!1;if(n){const e=t.doc.resolve(r);n(t.tr.setSelection(Fr.between(e,(o=e,o.node(0).resolve(o.pos+o.nodeAfter.nodeSize)))).scrollIntoView())}var o;return!0}}function mS(e,t){const n=e.selection;if(!(n instanceof qC))return!1;if(t){const r=e.tr,o=_C(e.schema).cell.createAndFill().content;n.forEachCell((e,t)=>{e.content.eq(o)||r.replace(r.mapping.map(t+1),r.mapping.map(t+e.nodeSize-1),new Zt(o,0,0))}),r.docChanged&&t(r)}return!0}function gS(e){if(0===e.size)return null;let{content:t,openStart:n,openEnd:r}=e;for(;1==t.childCount&&(n>0&&r>0||"table"==t.child(0).type.spec.tableRole);)n--,r--,t=t.child(0).content;const o=t.child(0),i=o.type.spec.tableRole,s=o.type.schema,a=[];if("row"==i)for(let e=0;e<t.childCount;e++){let o=t.child(e).content;const i=e?0:Math.max(0,n-1),l=e<t.childCount-1?0:Math.max(0,r-1);(i||l)&&(o=vS(_C(s).row,new Zt(o,i,l)).content),a.push(o)}else{if("cell"!=i&&"header_cell"!=i)return null;a.push(n||r?vS(_C(s).row,new Zt(t,n,r)).content:t)}return function(e,t){const n=[];for(let e=0;e<t.length;e++){const r=t[e];for(let t=r.childCount-1;t>=0;t--){const{rowspan:o,colspan:i}=r.child(t).attrs;for(let t=e;t<e+o;t++)n[t]=(n[t]||0)+i}}let r=0;for(let e=0;e<n.length;e++)r=Math.max(r,n[e]);for(let o=0;o<n.length;o++)if(o>=t.length&&t.push(Ft.empty),n[o]<r){const i=_C(e).cell.createAndFill(),s=[];for(let e=n[o];e<r;e++)s.push(i);t[o]=t[o].append(Ft.from(s))}return{height:t.length,width:r,rows:t}}(s,a)}function vS(e,t){const n=e.createAndFill();return new zr(n).replace(0,n.content.size,t).doc}function yS(e,t,n,r,o,i,s,a){if(0==s||s==t.height)return!1;let l=!1;for(let c=o;c<i;c++){const o=s*t.width+c,i=t.map[o];if(t.map[o-t.width]==i){l=!0;const o=n.nodeAt(i),{top:d,left:u}=t.findCell(i);e.setNodeMarkup(e.mapping.slice(a).map(i+r),null,{...o.attrs,rowspan:s-d}),e.insert(e.mapping.slice(a).map(t.positionAt(s,u,n)),o.type.createAndFill({...o.attrs,rowspan:d+o.attrs.rowspan-s})),c+=o.attrs.colspan-1}}return l}function wS(e,t,n,r,o,i,s,a){if(0==s||s==t.width)return!1;let l=!1;for(let c=o;c<i;c++){const o=c*t.width+s,i=t.map[o];if(t.map[o-1]==i){l=!0;const o=n.nodeAt(i),d=t.colCount(i),u=e.mapping.slice(a).map(i+r);e.setNodeMarkup(u,null,$C(o.attrs,s-d,o.attrs.colspan-(s-d))),e.insert(u+o.nodeSize,o.type.createAndFill($C(o.attrs,0,s-d))),c+=o.attrs.rowspan-1}}return l}function bS(e,t,n,r,o){let i=n?e.doc.nodeAt(n-1):e.doc;if(!i)throw new Error("No table found");let s=OC.get(i);const{top:a,left:l}=r,c=l+o.width,d=a+o.height,u=e.tr;let h=0;function p(){if(i=n?u.doc.nodeAt(n-1):u.doc,!i)throw new Error("No table found");s=OC.get(i),h=u.mapping.maps.length}(function(e,t,n,r,o,i,s){const a=_C(e.doc.type.schema);let l,c;if(o>t.width)for(let i=0,d=0;i<t.height;i++){const u=n.child(i);d+=u.nodeSize;const h=[];let p;p=null==u.lastChild||u.lastChild.type==a.cell?l||(l=a.cell.createAndFill()):c||(c=a.header_cell.createAndFill());for(let e=t.width;e<o;e++)h.push(p);e.insert(e.mapping.slice(s).map(d-1+r),h)}if(i>t.height){const d=[];for(let e=0,r=(t.height-1)*t.width;e<Math.max(t.width,o);e++){const o=!(e>=t.width)&&n.nodeAt(t.map[r+e]).type==a.header_cell;d.push(o?c||(c=a.header_cell.createAndFill()):l||(l=a.cell.createAndFill()))}const u=a.row.create(null,Ft.from(d)),h=[];for(let e=t.height;e<i;e++)h.push(u);e.insert(e.mapping.slice(s).map(r+n.nodeSize-2),h)}return!(!l&&!c)})(u,s,i,n,c,d,h)&&p(),yS(u,s,i,n,l,c,a,h)&&p(),yS(u,s,i,n,l,c,d,h)&&p(),wS(u,s,i,n,a,d,l,h)&&p(),wS(u,s,i,n,a,d,c,h)&&p();for(let e=a;e<d;e++){const t=s.positionAt(e,l,i),r=s.positionAt(e,c,i);u.replace(u.mapping.slice(h).map(t+n),u.mapping.slice(h).map(r+n),new Zt(o.rows[e-a],0,0))}p(),u.setSelection(new qC(u.doc.resolve(n+s.positionAt(a,l,i)),u.doc.resolve(n+s.positionAt(d-1,c-1,i)))),t(u)}pS("row",{useDeprecatedLogic:!0}),pS("column",{useDeprecatedLogic:!0}),pS("cell",{useDeprecatedLogic:!0});const xS=Di({ArrowLeft:CS("horiz",-1),ArrowRight:CS("horiz",1),ArrowUp:CS("vert",-1),ArrowDown:CS("vert",1),"Shift-ArrowLeft":SS("horiz",-1),"Shift-ArrowRight":SS("horiz",1),"Shift-ArrowUp":SS("vert",-1),"Shift-ArrowDown":SS("vert",1),Backspace:mS,"Mod-Backspace":mS,Delete:mS,"Mod-Delete":mS});function kS(e,t,n){return!n.eq(e.selection)&&(t&&t(e.tr.setSelection(n).scrollIntoView()),!0)}function CS(e,t){return(n,r,o)=>{if(!o)return!1;const i=n.selection;if(i instanceof qC)return kS(n,r,Vr.near(i.$headCell,t));if("horiz"!=e&&!i.empty)return!1;const s=OS(o,e,t);if(null==s)return!1;if("horiz"==e)return kS(n,r,Vr.near(n.doc.resolve(i.head+t),t));{const o=n.doc.resolve(s),i=VC(o,e,t);let a;return a=i?Vr.near(i,1):t<0?Vr.near(n.doc.resolve(o.before(-1)),-1):Vr.near(n.doc.resolve(o.after(-1)),1),kS(n,r,a)}}}function SS(e,t){return(n,r,o)=>{if(!o)return!1;const i=n.selection;let s;if(i instanceof qC)s=i;else{const r=OS(o,e,t);if(null==r)return!1;s=new qC(n.doc.resolve(r))}const a=VC(s.$headCell,e,t);return!!a&&kS(n,r,new qC(s.$anchorCell,a))}}function MS(e,t){const n=LC(e.state.doc.resolve(t));return!!n&&(e.dispatch(e.state.tr.setSelection(new qC(n))),!0)}function NS(e,t,n){if(!BC(e.state))return!1;let r=gS(n);const o=e.state.selection;if(o instanceof qC){r||(r={width:1,height:1,rows:[Ft.from(vS(_C(e.state.schema).cell,n))]});const t=o.$anchorCell.node(-1),i=o.$anchorCell.start(-1),s=OC.get(t).rectBetween(o.$anchorCell.pos-i,o.$headCell.pos-i);return r=function({width:e,height:t,rows:n},r,o){if(e!=r){const t=[],o=[];for(let e=0;e<n.length;e++){const i=n[e],s=[];for(let n=t[e]||0,o=0;n<r;o++){let a=i.child(o%i.childCount);n+a.attrs.colspan>r&&(a=a.type.createChecked($C(a.attrs,a.attrs.colspan,n+a.attrs.colspan-r),a.content)),s.push(a),n+=a.attrs.colspan;for(let n=1;n<a.attrs.rowspan;n++)t[e+n]=(t[e+n]||0)+a.attrs.colspan}o.push(Ft.from(s))}n=o,e=r}if(t!=o){const e=[];for(let r=0,i=0;r<o;r++,i++){const s=[],a=n[i%t];for(let e=0;e<a.childCount;e++){let t=a.child(e);r+t.attrs.rowspan>o&&(t=t.type.create({...t.attrs,rowspan:Math.max(1,o-t.attrs.rowspan)},t.content)),s.push(t)}e.push(Ft.from(s))}n=e,t=o}return{width:e,height:t,rows:n}}(r,s.right-s.left,s.bottom-s.top),bS(e.state,e.dispatch,i,s,r),!0}if(r){const t=PC(e.state),n=t.start(-1);return bS(e.state,e.dispatch,n,OC.get(t.node(-1)).findCell(t.pos-n),r),!0}return!1}function ES(e,t){var n;if(0!=t.button)return;if(t.ctrlKey||t.metaKey)return;const r=AS(e,t.target);let o;if(t.shiftKey&&e.state.selection instanceof qC)i(e.state.selection.$anchorCell,t),t.preventDefault();else if(t.shiftKey&&r&&null!=(o=LC(e.state.selection.$anchor))&&(null===(n=TS(e,t))||void 0===n?void 0:n.pos)!=o.pos)i(o,t),t.preventDefault();else if(!r)return;function i(t,n){let r=TS(e,n);const o=null==RC.getState(e.state);if(!r||!jC(t,r)){if(!o)return;r=t}const i=new qC(t,r);if(o||!e.state.selection.eq(i)){const n=e.state.tr.setSelection(i);o&&n.setMeta(RC,t.pos),e.dispatch(n)}}function s(){e.root.removeEventListener("mouseup",s),e.root.removeEventListener("dragstart",s),e.root.removeEventListener("mousemove",a),null!=RC.getState(e.state)&&e.dispatch(e.state.tr.setMeta(RC,-1))}function a(n){const o=n,a=RC.getState(e.state);let l;if(null!=a)l=e.state.doc.resolve(a);else if(AS(e,o.target)!=r&&(l=TS(e,t),!l))return s();l&&i(l,o)}e.root.addEventListener("mouseup",s),e.root.addEventListener("dragstart",s),e.root.addEventListener("mousemove",a)}function OS(e,t,n){if(!(e.state.selection instanceof Fr))return null;const{$head:r}=e.state.selection;for(let o=r.depth-1;o>=0;o--){const i=r.node(o);if((n<0?r.index(o):r.indexAfter(o))!=(n<0?0:i.childCount))return null;if("cell"==i.type.spec.tableRole||"header_cell"==i.type.spec.tableRole){const i=r.before(o),s="vert"==t?n>0?"down":"up":n>0?"right":"left";return e.endOfTextblock(s)?i:null}}return null}function AS(e,t){for(;t&&t!=e.dom;t=t.parentNode)if("TD"==t.nodeName||"TH"==t.nodeName)return t;return null}function TS(e,t){const n=e.posAtCoords({left:t.clientX,top:t.clientY});if(!n)return null;let{inside:r,pos:o}=n;return r>=0&&LC(e.state.doc.resolve(r))||LC(e.state.doc.resolve(o))}var DS=class{constructor(e,t){this.node=e,this.defaultCellMinWidth=t,this.dom=document.createElement("div"),this.dom.className="tableWrapper",this.table=this.dom.appendChild(document.createElement("table")),this.table.style.setProperty("--default-cell-min-width",`${t}px`),this.colgroup=this.table.appendChild(document.createElement("colgroup")),IS(e,this.colgroup,this.table,t),this.contentDOM=this.table.appendChild(document.createElement("tbody"))}update(e){return e.type==this.node.type&&(this.node=e,IS(e,this.colgroup,this.table,this.defaultCellMinWidth),!0)}ignoreMutation(e){return"attributes"==e.type&&(e.target==this.table||this.colgroup.contains(e.target))}};function IS(e,t,n,r,o,i){let s=0,a=!0,l=t.firstChild;const c=e.firstChild;if(c){for(let e=0,n=0;e<c.childCount;e++){const{colspan:d,colwidth:u}=c.child(e).attrs;for(let e=0;e<d;e++,n++){const c=o==n?i:u&&u[e],d=c?c+"px":"";if(s+=c||r,c||(a=!1),l)l.style.width!=d&&(l.style.width=d),l=l.nextSibling;else{const e=document.createElement("col");e.style.width=d,t.appendChild(e)}}}for(;l;){var d;const e=l.nextSibling;null===(d=l.parentNode)||void 0===d||d.removeChild(l),l=e}a?(n.style.width=s+"px",n.style.minWidth=""):(n.style.width="",n.style.minWidth=s+"px")}}const _S=new lo("tableColumnResizing");function RS({handleWidth:e=5,cellMinWidth:t=25,defaultCellMinWidth:n=100,View:r=DS,lastColumnResizable:o=!0}={}){const i=new io({key:_S,state:{init(e,t){var o;const s=null===(o=i.spec)||void 0===o||null===(o=o.props)||void 0===o?void 0:o.nodeViews,a=_C(t.schema).table.name;return r&&s&&(s[a]=(e,t)=>new r(e,n,t)),new LS(-1,!1)},apply:(e,t)=>t.apply(e)},props:{attributes:e=>{const t=_S.getState(e);return t&&t.activeHandle>-1?{class:"resize-cursor"}:{}},handleDOMEvents:{mousemove:(t,n)=>{!function(e,t,n,r){if(!e.editable)return;const o=_S.getState(e.state);if(!o)return;if(!o.dragging){const i=function(e){for(;e&&"TD"!=e.nodeName&&"TH"!=e.nodeName;)e=e.classList&&e.classList.contains("ProseMirror")?null:e.parentNode;return e}(t.target);let s=-1;if(i){const{left:r,right:o}=i.getBoundingClientRect();t.clientX-r<=n?s=BS(e,t,"left",n):o-t.clientX<=n&&(s=BS(e,t,"right",n))}if(s!=o.activeHandle){if(!r&&-1!==s){const t=e.state.doc.resolve(s),n=t.node(-1),r=OC.get(n),o=t.start(-1);if(r.colCount(t.pos-o)+t.nodeAfter.attrs.colspan-1==r.width-1)return}zS(e,s)}}}(t,n,e,o)},mouseleave:e=>{!function(e){if(!e.editable)return;const t=_S.getState(e.state);t&&t.activeHandle>-1&&!t.dragging&&zS(e,-1)}(e)},mousedown:(e,r)=>{!function(e,t,n,r){var o;if(!e.editable)return!1;const i=null!==(o=e.dom.ownerDocument.defaultView)&&void 0!==o?o:window,s=_S.getState(e.state);if(!s||-1==s.activeHandle||s.dragging)return!1;const a=e.state.doc.nodeAt(s.activeHandle),l=function(e,t,{colspan:n,colwidth:r}){const o=r&&r[r.length-1];if(o)return o;const i=e.domAtPos(t);let s=i.node.childNodes[i.offset].offsetWidth,a=n;if(r)for(let e=0;e<n;e++)r[e]&&(s-=r[e],a--);return s/a}(e,s.activeHandle,a.attrs);function c(t){i.removeEventListener("mouseup",c),i.removeEventListener("mousemove",d);const r=_S.getState(e.state);(null==r?void 0:r.dragging)&&(!function(e,t,n){const r=e.state.doc.resolve(t),o=r.node(-1),i=OC.get(o),s=r.start(-1),a=i.colCount(r.pos-s)+r.nodeAfter.attrs.colspan-1,l=e.state.tr;for(let e=0;e<i.height;e++){const t=e*i.width+a;if(e&&i.map[t]==i.map[t-i.width])continue;const r=i.map[t],c=o.nodeAt(r).attrs,d=1==c.colspan?0:a-i.colCount(r);if(c.colwidth&&c.colwidth[d]==n)continue;const u=c.colwidth?c.colwidth.slice():VS(c.colspan);u[d]=n,l.setNodeMarkup(s+r,null,{...c,colwidth:u})}l.docChanged&&e.dispatch(l)}(e,r.activeHandle,PS(r.dragging,t,n)),e.dispatch(e.state.tr.setMeta(_S,{setDragging:null})))}function d(t){if(!t.which)return c(t);const o=_S.getState(e.state);if(o&&o.dragging){const i=PS(o.dragging,t,n);jS(e,o.activeHandle,i,r)}}e.dispatch(e.state.tr.setMeta(_S,{setDragging:{startX:t.clientX,startWidth:l}})),jS(e,s.activeHandle,l,r),i.addEventListener("mouseup",c),i.addEventListener("mousemove",d),t.preventDefault()}(e,r,t,n)}},decorations:e=>{const t=_S.getState(e);if(t&&t.activeHandle>-1)return function(e,t){const n=[],r=e.doc.resolve(t),o=r.node(-1);if(!o)return Al.empty;const i=OC.get(o),s=r.start(-1),a=i.colCount(r.pos-s)+r.nodeAfter.attrs.colspan-1;for(let t=0;t<i.height;t++){const r=a+t*i.width;if(!(a!=i.width-1&&i.map[r]==i.map[r+1]||0!=t&&i.map[r]==i.map[r-i.width])){var l;const t=i.map[r],a=s+t+o.nodeAt(t).nodeSize-1,c=document.createElement("div");c.className="column-resize-handle",(null===(l=_S.getState(e))||void 0===l?void 0:l.dragging)&&n.push(Nl.node(s+t,s+t+o.nodeAt(t).nodeSize,{class:"column-resize-dragging"})),n.push(Nl.widget(a,c))}}return Al.create(e.doc,n)}(e,t.activeHandle)},nodeViews:{}}});return i}var LS=class e{constructor(e,t){this.activeHandle=e,this.dragging=t}apply(t){const n=this,r=t.getMeta(_S);if(r&&null!=r.setHandle)return new e(r.setHandle,!1);if(r&&void 0!==r.setDragging)return new e(n.activeHandle,r.setDragging);if(n.activeHandle>-1&&t.docChanged){let r=t.mapping.map(n.activeHandle,-1);return zC(t.doc.resolve(r))||(r=-1),new e(r,n.dragging)}return n}};function BS(e,t,n,r){const o="right"==n?-r:r,i=e.posAtCoords({left:t.clientX+o,top:t.clientY});if(!i)return-1;const{pos:s}=i,a=LC(e.state.doc.resolve(s));if(!a)return-1;if("right"==n)return a.pos;const l=OC.get(a.node(-1)),c=a.start(-1),d=l.map.indexOf(a.pos-c);return d%l.width==0?-1:c+l.map[d-1]}function PS(e,t,n){const r=t.clientX-e.startX;return Math.max(n,e.startWidth+r)}function zS(e,t){e.dispatch(e.state.tr.setMeta(_S,{setHandle:t}))}function jS(e,t,n,r){const o=e.state.doc.resolve(t),i=o.node(-1),s=o.start(-1),a=OC.get(i).colCount(o.pos-s)+o.nodeAfter.attrs.colspan-1;let l=e.domAtPos(o.start(-1)).node;for(;l&&"TABLE"!=l.nodeName;)l=l.parentNode;l&&IS(i,l.firstChild,l,r,a,n)}function VS(e){return Array(e).fill(0)}function $S({allowTableNodeSelection:e=!1}={}){return new io({key:RC,state:{init:()=>null,apply(e,t){const n=e.getMeta(RC);if(null!=n)return-1==n?null:n;if(null==t||!e.docChanged)return t;const{deleted:r,pos:o}=e.mapping.mapResult(t);return r?null:o}},props:{decorations:WC,handleDOMEvents:{mousedown:ES},createSelectionBetween:e=>null!=RC.getState(e.state)?e.state.selection:null,handleTripleClick:MS,handleKeyDown:xS,handlePaste:NS},appendTransaction:(t,n,r)=>function(e,t,n){const r=(t||e).selection,o=(t||e).doc;let i,s;if(r instanceof Ur&&(s=r.node.type.spec.tableRole)){if("cell"==s||"header_cell"==s)i=qC.create(o,r.from);else if("row"==s){const e=o.resolve(r.from+1);i=qC.rowSelection(e,e)}else if(!n){const e=OC.get(r.node),t=r.from+1,n=t+e.map[e.width*e.height-1];i=qC.create(o,t+1,n)}}else r instanceof Fr&&function({$from:e,$to:t}){if(e.pos==t.pos||e.pos<t.pos-6)return!1;let n=e.pos,r=t.pos,o=e.depth;for(;o>=0&&!(e.after(o+1)<e.end(o));o--,n++);for(let e=t.depth;e>=0&&!(t.before(e+1)>t.start(e));e--,r--);return n==r&&/row|table/.test(e.node(o).type.spec.tableRole)}(r)?i=Fr.create(o,r.from):r instanceof Fr&&function({$from:e,$to:t}){let n,r;for(let t=e.depth;t>0;t--){const r=e.node(t);if("cell"===r.type.spec.tableRole||"header_cell"===r.type.spec.tableRole){n=r;break}}for(let e=t.depth;e>0;e--){const n=t.node(e);if("cell"===n.type.spec.tableRole||"header_cell"===n.type.spec.tableRole){r=n;break}}return n!==r&&0===t.parentOffset}(r)&&(i=Fr.create(o,r.$from.start(),r.$from.end()));return i&&(t||(t=e.tr)).setSelection(i),t}(r,KC(r,n),e)})}var HS="undefined"!=typeof navigator?navigator:null,qS=HS&&HS.userAgent||"",FS=/Edge\/(\d+)/.exec(qS),WS=/MSIE \d/.exec(qS),US=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(qS),GS=!!!(WS||US||FS)&&!!HS&&/Apple Computer/.test(HS.vendor),KS=new lo("safari-ime-span"),JS=!1;function ZS(e){const t=e.dom.ownerDocument.createElement("span");return t.className="ProseMirror-safari-ime-span",t}var YS=new io(GS?{key:KS,props:{decorations:function(e){const{$from:t,$to:n,to:r}=e.selection;if(JS&&t.sameParent(n)){const t=Nl.widget(r,ZS,{ignoreSelection:!0,key:"safari-ime-span"});return Al.create(e.doc,[t])}},handleDOMEvents:{compositionstart:()=>{JS=!0},compositionend:()=>{JS=!1}}}}:{key:KS});function XS(e,t){return Object.assign(e,{meta:{package:"@milkdown/preset-gfm",...t}}),e}var QS=Td("strike_through");XS(QS,{displayName:"Attr<strikethrough>",group:"Strikethrough"});var eM=Ed("strike_through",e=>({parseDOM:[{tag:"del"},{style:"text-decoration",getAttrs:e=>"line-through"===e}],toDOM:t=>["del",e.get(QS.key)(t)],parseMarkdown:{match:e=>"delete"===e.type,runner:(e,t,n)=>{e.openMark(n),e.next(t.children),e.closeMark(n)}},toMarkdown:{match:e=>"strike_through"===e.type.name,runner:(e,t)=>{e.withMark(t,"delete")}}}));XS(eM.mark,{displayName:"MarkSchema<strikethrough>",group:"Strikethrough"}),XS(eM.ctx,{displayName:"MarkSchemaCtx<strikethrough>",group:"Strikethrough"});var tM=yd("ToggleStrikeThrough",e=>()=>Eo(eM.type(e)));XS(tM,{displayName:"Command<ToggleStrikethrough>",group:"Strikethrough"});var nM=wd(e=>ci(/(?<![\w:/])(~{1,2})(.+?)\1(?!\w|\/)$/,eM.type(e)));XS(nM,{displayName:"InputRule<strikethrough>",group:"Strikethrough"});var rM=Od("strikeThroughKeymap",{ToggleStrikethrough:{shortcuts:"Mod-Alt-x",command:e=>{const t=e.get(Ac);return()=>t.call(tM.key)}}});function oM(e,t){const n=t.content.firstChild;if(1!==t.childCount||"paragraph"!==n?.type.name)return void e.next(t.content);const r=n.lastChild,o="hardbreak"===r?.type.name?n.content.cut(0,n.content.size-r.nodeSize):n.content;e.next(o)}XS(rM.ctx,{displayName:"KeymapCtx<strikethrough>",group:"Strikethrough"}),XS(rM.shortcuts,{displayName:"Keymap<strikethrough>",group:"Strikethrough"});var iM=function(e){const t=e.cellAttributes||{},n={colspan:{default:1,validate:"number"},rowspan:{default:1,validate:"number"},colwidth:{default:null,validate:IC}};for(const e in t)n[e]={default:t[e].default,validate:t[e].validate};return{table:{content:"table_row+",tableRole:"table",isolating:!0,group:e.tableGroup,parseDOM:[{tag:"table"}],toDOM:()=>["table",["tbody",0]]},table_row:{content:"(table_cell | table_header)*",tableRole:"row",parseDOM:[{tag:"tr"}],toDOM:()=>["tr",0]},table_cell:{content:e.cellContent,attrs:n,tableRole:"cell",isolating:!0,parseDOM:[{tag:"td",getAttrs:e=>TC(e,t)}],toDOM:e=>["td",DC(e,t),0]},table_header:{content:e.cellContent,attrs:n,tableRole:"header_cell",isolating:!0,parseDOM:[{tag:"th",getAttrs:e=>TC(e,t)}],toDOM:e=>["th",DC(e,t),0]}}}({tableGroup:"block",cellContent:"paragraph",cellAttributes:{alignment:{default:"left",getFromDOM:e=>e.style.textAlign||"left",setDOMAttr:(e,t)=>{t.style=`text-align: ${e||"left"}`}}}}),sM=Nd("table",()=>({...iM.table,content:"table_header_row table_row+",disableDropCursor:!0,parseMarkdown:{match:e=>"table"===e.type,runner:(e,t,n)=>{const r=t.align,o=t.children.map((e,t)=>({...e,align:r,isHeader:0===t}));e.openNode(n),e.next(o),e.closeNode()}},toMarkdown:{match:e=>"table"===e.type.name,runner:(e,t)=>{const n=t.content.firstChild?.content;if(!n)return;const r=[];n.forEach(e=>{r.push(e.attrs.alignment)}),e.openNode("table",void 0,{align:r}),e.next(t.content),e.closeNode()}}}));XS(sM.node,{displayName:"NodeSchema<table>",group:"Table"}),XS(sM.ctx,{displayName:"NodeSchemaCtx<table>",group:"Table"});var aM=Nd("table_header_row",()=>({...iM.table_row,disableDropCursor:!0,content:"(table_header)*",parseDOM:[{tag:"tr[data-is-header]"},{tag:"tr",getAttrs:e=>e instanceof HTMLElement&&(!!e.querySelector("th")&&{})}],toDOM:()=>["tr",{"data-is-header":!0},0],parseMarkdown:{match:e=>Boolean("tableRow"===e.type&&e.isHeader),runner:(e,t,n)=>{const r=t.align,o=t.children.map((e,n)=>({...e,align:r[n],isHeader:t.isHeader}));e.openNode(n),e.next(o),e.closeNode()}},toMarkdown:{match:e=>"table_header_row"===e.type.name,runner:(e,t)=>{0!==t.content.size&&(e.openNode("tableRow",void 0,{isHeader:!0}),e.next(t.content),e.closeNode())}}}));XS(aM.node,{displayName:"NodeSchema<tableHeaderRow>",group:"Table"}),XS(aM.ctx,{displayName:"NodeSchemaCtx<tableHeaderRow>",group:"Table"});var lM=Nd("table_row",()=>({...iM.table_row,disableDropCursor:!0,content:"(table_cell)*",parseMarkdown:{match:e=>"tableRow"===e.type,runner:(e,t,n)=>{const r=t.align,o=t.children.map((e,t)=>({...e,align:r[t]}));e.openNode(n),e.next(o),e.closeNode()}},toMarkdown:{match:e=>"table_row"===e.type.name,runner:(e,t)=>{0!==t.content.size&&(e.openNode("tableRow"),e.next(t.content),e.closeNode())}}}));XS(lM.node,{displayName:"NodeSchema<tableRow>",group:"Table"}),XS(lM.ctx,{displayName:"NodeSchemaCtx<tableRow>",group:"Table"});var cM=Nd("table_cell",()=>({...iM.table_cell,disableDropCursor:!0,parseMarkdown:{match:e=>"tableCell"===e.type&&!e.isHeader,runner:(e,t,n)=>{const r=t.align;e.openNode(n,{alignment:r}).openNode(e.schema.nodes.paragraph).next(t.children).closeNode().closeNode()}},toMarkdown:{match:e=>"table_cell"===e.type.name,runner:(e,t)=>{e.openNode("tableCell"),oM(e,t),e.closeNode()}}}));XS(cM.node,{displayName:"NodeSchema<tableCell>",group:"Table"}),XS(cM.ctx,{displayName:"NodeSchemaCtx<tableCell>",group:"Table"});var dM=Nd("table_header",()=>({...iM.table_header,disableDropCursor:!0,parseMarkdown:{match:e=>"tableCell"===e.type&&!!e.isHeader,runner:(e,t,n)=>{const r=t.align;e.openNode(n,{alignment:r}),e.openNode(e.schema.nodes.paragraph),e.next(t.children),e.closeNode(),e.closeNode()}},toMarkdown:{match:e=>"table_header"===e.type.name,runner:(e,t)=>{e.openNode("tableCell"),oM(e,t),e.closeNode()}}}));function uM(e,t=3,n=3){const r=Array(n).fill(0).map(()=>cM.type(e).createAndFill()),o=Array(n).fill(0).map(()=>dM.type(e).createAndFill()),i=Array(t).fill(0).map((t,n)=>0===n?aM.type(e).create(null,o):lM.type(e).create(null,r));return sM.type(e).create(null,i)}function hM(e){return(t,n)=>r=>{n=n??r.selection.from;const o=r.doc.resolve(n),i=Ci(e=>"table"===e.type.name)(o),s=i?{node:i.node,from:i.start}:void 0,a="row"===e;if(s){const e=OC.get(s.node);if(t>=0&&t<(a?e.height:e.width)){const n=e.positionAt(a?t:e.height-1,a?e.width-1:t,s.node),o=r.doc.resolve(s.from+n),i=a?qC.rowSelection:qC.colSelection,l=e.positionAt(a?t:0,a?0:t,s.node),c=r.doc.resolve(s.from+l);return wi(r.setSelection(i(o,c)))}}return r}}XS(dM.node,{displayName:"NodeSchema<tableHeader>",group:"Table"}),XS(dM.ctx,{displayName:"NodeSchemaCtx<tableHeader>",group:"Table"});var pM=hM("row"),fM=hM("col");function mM(e,t,{map:n,tableStart:r,table:o},i){const s=Array(i).fill(0).reduce((e,t,n)=>e+o.child(n).nodeSize,r),a=Array(n.width).fill(0).map((t,r)=>{const i=o.nodeAt(n.map[r]);return cM.type(e).createAndFill({alignment:i?.attrs.alignment})});return t.insert(s,lM.type(e).create(null,a)),t}function gM(e){const t=function(e){const t=XC(e.$from);if(!t)return;const n=OC.get(t.node);return n.cellsInRect({left:0,right:n.width,top:0,bottom:n.height}).map(e=>{const n=t.node.nodeAt(e),r=e+t.start;return{pos:r,start:r+1,node:n}})}(e.selection);if(t&&t[0]){const n=e.doc.resolve(t[0].pos),r=t[t.length-1];if(r){const t=e.doc.resolve(r.pos);return wi(e.setSelection(new qC(t,n)))}}return e}var vM=yd("GoToPrevTableCell",()=>()=>fS(-1));XS(vM,{displayName:"Command<goToPrevTableCellCommand>",group:"Table"});var yM=yd("GoToNextTableCell",()=>()=>fS(1));XS(yM,{displayName:"Command<goToNextTableCellCommand>",group:"Table"});var wM=yd("ExitTable",e=>()=>(t,n)=>{if(!BC(t))return!1;const{$head:r}=t.selection,o=(i=r,s=sM.type(e),xi(e=>e.type===s)(i));var i,s;if(!o)return!1;const{to:a}=o,l=t.tr.replaceWith(a,a,Au.type(e).createAndFill());return l.setSelection(Vr.near(l.doc.resolve(a),1)).scrollIntoView(),n?.(l),!0});XS(wM,{displayName:"Command<breakTableCommand>",group:"Table"});var bM=yd("InsertTable",e=>({row:t,col:n}={})=>(r,o)=>{const{selection:i,tr:s}=r,{from:a}=i,l=uM(e,t,n),c=s.replaceSelectionWith(l),d=Vr.findFrom(c.doc.resolve(a),1,!0);return d&&c.setSelection(d),o?.(c),!0});XS(bM,{displayName:"Command<insertTableCommand>",group:"Table"});var xM=yd("MoveRow",()=>({from:e,to:t,pos:n}={})=>{return r={from:e??0,to:t??0,pos:n},(e,t)=>{const{from:n,to:o,select:i=!0,pos:s=e.selection.from}=r,a=e.tr;return!!iS({tr:a,originIndex:n,targetIndex:o,select:i,pos:s})&&(null==t||t(a),!0)};var r});XS(xM,{displayName:"Command<moveRowCommand>",group:"Table"});var kM=yd("MoveCol",()=>({from:e,to:t,pos:n}={})=>{return r={from:e??0,to:t??0,pos:n},(e,t)=>{const{from:n,to:o,select:i=!0,pos:s=e.selection.from}=r,a=e.tr;return!!oS({tr:a,originIndex:n,targetIndex:o,select:i,pos:s})&&(null==t||t(a),!0)};var r});XS(kM,{displayName:"Command<moveColCommand>",group:"Table"});var CM=yd("SelectRow",()=>(e={index:0})=>(t,n)=>{const{tr:r}=t,o=n?.(pM(e.index,e.pos)(r));return Boolean(o)});XS(CM,{displayName:"Command<selectRowCommand>",group:"Table"});var SM=yd("SelectCol",()=>(e={index:0})=>(t,n)=>{const{tr:r}=t,o=n?.(fM(e.index,e.pos)(r));return Boolean(o)});XS(SM,{displayName:"Command<selectColCommand>",group:"Table"});var MM=yd("SelectTable",()=>()=>(e,t)=>{const{tr:n}=e,r=t?.(gM(n));return Boolean(r)});XS(MM,{displayName:"Command<selectTableCommand>",group:"Table"});var NM=yd("DeleteSelectedCells",()=>()=>(e,t)=>{const{selection:n}=e;if(!(n instanceof qC))return!1;const r=n.isRowSelection(),o=n.isColSelection();return r&&o?function(e,t){const n=e.selection.$anchor;for(let r=n.depth;r>0;r--)if("table"==n.node(r).type.spec.tableRole)return t&&t(e.tr.delete(n.before(r),n.after(r)).scrollIntoView()),!0;return!1}(e,t):o?function(e,t){if(!BC(e))return!1;if(t){const n=sS(e),r=e.tr;if(0==n.left&&n.right==n.map.width)return!1;for(let e=n.right-1;dS(r,n,e),e!=n.left;e--){const e=n.tableStart?r.doc.nodeAt(n.tableStart-1):r.doc;if(!e)throw new RangeError("No table found");n.table=e,n.map=OC.get(e)}t(r)}return!0}(e,t):function(e,t){if(!BC(e))return!1;if(t){const n=sS(e),r=e.tr;if(0==n.top&&n.bottom==n.map.height)return!1;for(let e=n.bottom-1;uS(r,n,e),e!=n.top;e--){const e=n.tableStart?r.doc.nodeAt(n.tableStart-1):r.doc;if(!e)throw new RangeError("No table found");n.table=e,n.map=OC.get(n.table)}t(r)}return!0}(e,t)});XS(NM,{displayName:"Command<deleteSelectedCellsCommand>",group:"Table"});var EM=yd("AddColBefore",()=>()=>lS);XS(EM,{displayName:"Command<addColBeforeCommand>",group:"Table"});var OM=yd("AddColAfter",()=>()=>cS);XS(OM,{displayName:"Command<addColAfterCommand>",group:"Table"});var AM=yd("AddRowBefore",e=>()=>(t,n)=>{if(!BC(t))return!1;if(n){const r=sS(t);n(mM(e,t.tr,r,r.top))}return!0});XS(AM,{displayName:"Command<addRowBeforeCommand>",group:"Table"});var TM=yd("AddRowAfter",e=>()=>(t,n)=>{if(!BC(t))return!1;if(n){const r=sS(t);n(mM(e,t.tr,r,r.bottom))}return!0});XS(TM,{displayName:"Command<addRowAfterCommand>",group:"Table"});var DM=yd("SetAlign",()=>(e="left")=>{return t="alignment",n=e,function(e,r){if(!BC(e))return!1;const o=PC(e);if(o.nodeAfter.attrs[t]===n)return!1;if(r){const i=e.tr;e.selection instanceof qC?e.selection.forEachCell((e,r)=>{e.attrs[t]!==n&&i.setNodeMarkup(r,null,{...e.attrs,[t]:n})}):i.setNodeMarkup(o.pos,null,{...o.nodeAfter.attrs,[t]:n}),r(i)}return!0};var t,n});XS(DM,{displayName:"Command<setAlignCommand>",group:"Table"});var IM=wd(e=>new Ro(/^\|(?<col>\d+)[xX](?<row>\d+)\|\s$/,(t,n,r,o)=>{const i=t.doc.resolve(r);if(!i.node(-1).canReplaceWith(i.index(-1),i.indexAfter(-1),sM.type(e)))return null;const s=uM(e,Math.max(Number(n.groups?.row??0),2),Number(n.groups?.col)),a=t.tr.replaceRangeWith(r,o,s);return a.setSelection(Fr.create(a.doc,r+3)).scrollIntoView()}));XS(IM,{displayName:"InputRule<insertTableInputRule>",group:"Table"});var _M=function(e){const t=n=>async()=>{await n.wait(xc);const r=e(n);return n.update(td,e=>[...e,r]),t.pasteRule=r,()=>{n.update(td,e=>e.filter(e=>e!==r))}};return t}(e=>({run:(t,n,r)=>{if(r)return t;function o(t){const n=t.childCount,r=t.lastChild?.childCount??0;if(0===n||0===r)return Au.type(e).create();const o=t.firstChild;if(!(r>0&&o&&0===o.childCount))return t;if(n>=3){const r=t.child(1),i=[];for(let t=0;t<r.childCount;t++){const n=r.child(t);i.push(dM.type(e).create(n.attrs,n.content,n.marks))}const s=o.type.create(o.attrs,i),a=[];for(let e=2;e<n;e++)a.push(t.child(e));return t.type.create(t.attrs,[s,...a])}const i=Array(r).fill(0).map(()=>dM.type(e).createAndFill()),s=new Zt(Ft.from(i),0,0),a=o.replace(0,0,s);return t.replace(0,o.nodeSize,new Zt(Ft.from(a),0,0))}let i=function t(n){let r=function(t){const n=lM.type(e),r=[];let i=[],s=!1;function a(){if(0===i.length)return;const t=aM.type(e).createAndFill(),n=sM.type(e).create(null,[t,...i]);r.push(o(n)),i=[]}return t.forEach(e=>{e.type===n?(s=!0,i.push(e)):(a(),r.push(e))}),a(),s?Ft.from(r):t}(n),i=r!==n;const s=[];return r.forEach(n=>{if(n.type===sM.type(e)){const e=o(n);e!==n&&(i=!0),s.push(e)}else if(n.childCount>0){const e=t(n.content);e!==n.content?(i=!0,s.push(n.copy(e))):s.push(n)}else s.push(n)}),i?Ft.from(s):n}(t.content);return i=function(t){const n=[],r=[];t.forEach(e=>r.push(e));for(let t=0;t<r.length;t++){const o=r[t],i=r[t+1];o.type===Au.type(e)&&0===o.content.size&&i&&i.type===sM.type(e)||n.push(o)}return n.length<r.length?Ft.from(n):t}(i),new Zt(Ft.from(i),t.openStart,t.openEnd)}}));XS(_M,{displayName:"PasteRule<table>",group:"Table"});var RM=Od("tableKeymap",{NextCell:{priority:100,shortcuts:["Mod-]","Tab"],command:e=>{const t=e.get(Ac);return()=>t.call(yM.key)}},PrevCell:{shortcuts:["Mod-[","Shift-Tab"],command:e=>{const t=e.get(Ac);return()=>t.call(vM.key)}},ExitTable:{shortcuts:["Mod-Enter","Enter"],command:e=>{const t=e.get(Ac);return()=>t.call(wM.key)}}});XS(RM.ctx,{displayName:"KeymapCtx<table>",group:"Table"}),XS(RM.shortcuts,{displayName:"Keymap<table>",group:"Table"});var LM="footnote_definition",BM="footnoteDefinition",PM=Nd("footnote_definition",()=>({group:"block",content:"block+",defining:!0,attrs:{label:{default:"",validate:"string"}},parseDOM:[{tag:`dl[data-type="${LM}"]`,getAttrs:e=>{if(!(e instanceof HTMLElement))throw St(e);return{label:e.dataset.label}},contentElement:"dd"}],toDOM:e=>{const t=e.attrs.label;return["dl",{"data-label":t,"data-type":LM},["dt",t],["dd",0]]},parseMarkdown:{match:({type:e})=>e===BM,runner:(e,t,n)=>{e.openNode(n,{label:t.label}).next(t.children).closeNode()}},toMarkdown:{match:e=>e.type.name===LM,runner:(e,t)=>{e.openNode(BM,void 0,{label:t.attrs.label,identifier:t.attrs.label}).next(t.content).closeNode()}}}));XS(PM.ctx,{displayName:"NodeSchemaCtx<footnodeDef>",group:"footnote"}),XS(PM.node,{displayName:"NodeSchema<footnodeDef>",group:"footnote"});var zM="footnote_reference",jM=Nd("footnote_reference",()=>({group:"inline",inline:!0,atom:!0,attrs:{label:{default:"",validate:"string"}},parseDOM:[{tag:`sup[data-type="${zM}"]`,getAttrs:e=>{if(!(e instanceof HTMLElement))throw St(e);return{label:e.dataset.label}}}],toDOM:e=>{const t=e.attrs.label;return["sup",{"data-label":t,"data-type":zM},t]},parseMarkdown:{match:({type:e})=>"footnoteReference"===e,runner:(e,t,n)=>{e.addNode(n,{label:t.label})}},toMarkdown:{match:e=>e.type.name===zM,runner:(e,t)=>{e.addNode("footnoteReference",void 0,void 0,{label:t.attrs.label,identifier:t.attrs.label})}}}));XS(jM.ctx,{displayName:"NodeSchemaCtx<footnodeRef>",group:"footnote"}),XS(jM.node,{displayName:"NodeSchema<footnodeRef>",group:"footnote"});var VM=wh.extendSchema(e=>t=>{const n=e(t);return{...n,attrs:{...n.attrs,checked:{default:null,validate:"boolean|null"}},parseDOM:[{tag:'li[data-item-type="task"]',getAttrs:e=>{if(!(e instanceof HTMLElement))throw St(e);return{label:e.dataset.label,listType:e.dataset.listType,spread:"true"===e.dataset.spread,checked:e.dataset.checked?"true"===e.dataset.checked:null}}},...n?.parseDOM||[]],toDOM:e=>n.toDOM&&null==e.attrs.checked?n.toDOM(e):["li",{"data-item-type":"task","data-label":e.attrs.label,"data-list-type":e.attrs.listType,"data-spread":e.attrs.spread,"data-checked":e.attrs.checked},0],parseMarkdown:{match:({type:e})=>"listItem"===e,runner:(e,t,r)=>{if(null==t.checked)return void n.parseMarkdown.runner(e,t,r);const o=null!=t.label?`${t.label}.`:"•",i=null!=t.checked?Boolean(t.checked):null,s=null!=t.label?"ordered":"bullet",a=t.spread??!0;e.openNode(r,{label:o,listType:s,spread:a,checked:i}),e.next(t.children),e.closeNode()}},toMarkdown:{match:e=>"list_item"===e.type.name,runner:(e,t)=>{if(null==t.attrs.checked)return void n.toMarkdown.runner(e,t);const r=t.attrs.label,o=t.attrs.listType,i=t.attrs.spread,s=t.attrs.checked;e.openNode("listItem",void 0,{label:r,listType:o,spread:i,checked:s}),e.next(t.content),e.closeNode()}}}});XS(VM.node,{displayName:"NodeSchema<taskListItem>",group:"ListItem"}),XS(VM.ctx,{displayName:"NodeSchemaCtx<taskListItem>",group:"ListItem"});var $M=wd(()=>new Ro(/^\[(?<checked>\s|x)\]\s$/,(e,t,n,r)=>{const o=e.doc.resolve(n);let i=0,s=o.node(i);for(;s&&"list_item"!==s.type.name;)i--,s=o.node(i);if(!s||null!=s.attrs.checked)return null;const a=Boolean("x"===t.groups?.checked),l=o.before(i),c=e.tr;return c.deleteRange(n,r).setNodeMarkup(l,void 0,{...s.attrs,checked:a}),c}));XS($M,{displayName:"InputRule<wrapInTaskListInputRule>",group:"ListItem"});var HM=[rM,RM].flat(),qM=[IM,$M],FM=[nM],WM=[_M],UM=kd(()=>YS);XS(UM,{displayName:"Prose<autoInsertSpanPlugin>",group:"Prose"}),XS(kd(()=>RS({})),{displayName:"Prose<columnResizingPlugin>",group:"Prose"});var GM=kd(()=>$S({allowTableNodeSelection:!0}));XS(GM,{displayName:"Prose<tableEditingPlugin>",group:"Prose"});var KM=Dd("remarkGFM",()=>Z);XS(KM.plugin,{displayName:"Remark<remarkGFMPlugin>",group:"Remark"}),XS(KM.options,{displayName:"RemarkConfig<remarkGFMPlugin>",group:"Remark"});var JM=new lo("MILKDOWN_KEEP_TABLE_ALIGN_PLUGIN");var ZM=kd(()=>new io({key:JM,appendTransaction:(e,t,n)=>{if(t.doc===n.doc)return;const r=function(e,t){const n=e.content.findDiffStart(t.content);if(null==n)return null;const r=e.content.findDiffEnd(t.content);return r?{from:n,to:Math.max(r.b,n)}:null}(t.doc,n.doc);if(!r)return;let o;const i=(e,t)=>{if("table_cell"!==e.type.name)return;const r=n.doc.resolve(t),i=r.node(r.depth),s=r.node(r.depth-1).firstChild;if(!s)return;const a=function(e,t){let n=0;return t.forEach((t,r,o)=>{t===e&&(n=o)}),n}(e,i),l=s.maybeChild(a);if(!l)return;const c=l.attrs.alignment;c!==e.attrs.alignment&&(o||(o=n.tr),o.setNodeMarkup(t,void 0,{...e.attrs,alignment:c}))};return n.doc.nodesBetween(r.from,r.to,(e,t)=>"table"!==e.type.name||(n.doc.nodesBetween(t,t+e.nodeSize,i),!1)),o}}));XS(ZM,{displayName:"Prose<keepTableAlignPlugin>",group:"Prose"});var YM=[ZM,UM,KM,GM].flat(),XM=[[VM,sM,aM,lM,dM,cM,PM,jM,QS,eM].flat(),qM,WM,FM,HM,[yM,vM,wM,bM,xM,kM,CM,SM,MM,NM,AM,TM,EM,OM,DM,tM],YM].flat();const QM=(()=>[h(),p(),f(),m(),g(),d(),v(),c.allowMultipleSelections.of(!0),y(),w(b,{fallback:!0}),x(),k(),C(),S(),M(),N(),E(),u.of([...O,...A,...T,...D,...I,..._,...R])])();function eN(e){return function(e){return 1===e.nodeType}(e)&&"http://www.w3.org/1999/xhtml"===e.namespaceURI}function tN(e,t){let n,r,o=[];const i=()=>{const t=e.dom.getBoundingClientRect(),i=e.state.doc;return o&&n&&r&&t.width===r.width&&t.height===r.height&&t.x===r.x&&t.y===r.y&&n.eq(i)||(r=t,n=i,o=function(e){let t=[[-1,e.state.doc]],n=[];for(;t.length>0;){const[r,o]=t.pop();if(r>=0){let t=e.nodeDOM(r);if(t&&eN(t)){let{top:e,bottom:i,left:s,right:a}=t.getBoundingClientRect();n.push([r,[s,e,a,e]],[r+o.nodeSize,[s,i,a,i]])}}if(o.isBlock&&!o.isTextblock){let e=r+1;for(let n of o.children)t.push([e,n]),e+=n.nodeSize}}return n}(e)),o},s=(n,r)=>{if(!e.editable||e.isDestroyed)return;let o=i();o.sort((e,t)=>{const[r,o]=e,[i,s]=t;return rN(n,o)-rN(n,s)||r-i}),o=o.slice(0,8);const s=o.find(n=>!1!==t?.({view:e,pos:n[0],event:r}));return s&&function(e,t){const n=e.dragging;if(!n)return;const{move:r}=n;if(!r)return;const o=e.state.selection;if(!(o instanceof Ur))return;const{from:i,to:s}=o;return i<=t&&t<=s}(e,s[0])?void 0:s};let a,l;return(e,t)=>{return a&&(r=e,(n=a)[0]===r[0]&&n[1]===r[1])||(a=e,l=s(e,t)),l;var n,r}}function nN(e,t){return Math.abs(e[0]-t[0])+Math.abs(e[1]-t[1])}function rN(e,t){return Math.min(nN(e,[t[0],t[1]]),nN(e,[t[2],t[3]]))}function oN(e){let t;return new io({key:new lo("prosekit-drop-indicator"),view:n=>(t=tN(n,e.onDrag),function(e,t,n){let r,o,i,s=e.dom,a=!1;const l=()=>{r&&clearTimeout(r),a=!1,r=setTimeout(()=>{a||n.onHide?.()},30)},c=r=>{a=!0;const{clientX:s,clientY:c}=r;if(o===s&&i===c)return;o=s,i=c;let d=t([s,c],r);if(d){const[t,[r,o,i,s]]=d,a={p1:{x:r,y:o},p2:{x:i,y:s}};n.onShow?.({view:e,pos:t,line:a})}else l()};s.addEventListener("dragover",c),s.addEventListener("dragend",l),s.addEventListener("drop",l),s.addEventListener("dragleave",l);return{destroy:()=>{s.removeEventListener("dragover",c),s.removeEventListener("dragend",l),s.removeEventListener("drop",l),s.removeEventListener("dragleave",l)}}}(n,t,e)),props:{handleDrop(e,n,r,o){if(!t)return!1;const i=t([n.clientX,n.clientY],n);if(!i)return!1;n.preventDefault();let s=i[0],a=e.state.tr;if(o){let{node:t}=e.dragging||{};t?t.replace(a):a.deleteSelection()}let l=a.mapping.map(s),c=0==r.openStart&&0==r.openEnd&&1==r.content.childCount,d=a.doc;if(c?a.replaceRangeWith(l,l,r.content.firstChild):a.replaceRange(l,l,r),a.doc.eq(d))return!0;let u=a.doc.resolve(l);if(c&&Ur.isSelectable(r.content.firstChild)&&u.nodeAfter&&u.nodeAfter.sameMarkup(r.content.firstChild))a.setSelection(new Ur(u));else{let t=a.mapping.map(s);a.mapping.maps[a.mapping.maps.length-1].forEach((e,n,r,o)=>t=o),a.setSelection(function(e,t,n,r){return e.someProp("createSelectionBetween",r=>r(e,t,n))||Fr.between(t,n,r)}(e,u,a.doc.resolve(t)))}return e.focus(),e.dispatch(a.setMeta("uiEvent","drop")),!0}}})}class iN extends Vr{constructor(e){super(e,e)}map(e,t){let n=e.resolve(t.map(this.head));return iN.valid(n)?new iN(n):Vr.near(n)}content(){return Zt.empty}eq(e){return e instanceof iN&&e.head==this.head}toJSON(){return{type:"gapcursor",pos:this.head}}static fromJSON(e,t){if("number"!=typeof t.pos)throw new RangeError("Invalid input for GapCursor.fromJSON");return new iN(e.resolve(t.pos))}getBookmark(){return new sN(this.anchor)}static valid(e){let t=e.parent;if(t.inlineContent||!function(e){for(let t=e.depth;t>=0;t--){let n=e.index(t),r=e.node(t);if(0!=n)for(let e=r.child(n-1);;e=e.lastChild){if(0==e.childCount&&!e.inlineContent||aN(e.type))return!0;if(e.inlineContent)return!1}else if(r.type.spec.isolating)return!0}return!0}(e)||!function(e){for(let t=e.depth;t>=0;t--){let n=e.indexAfter(t),r=e.node(t);if(n!=r.childCount)for(let e=r.child(n);;e=e.firstChild){if(0==e.childCount&&!e.inlineContent||aN(e.type))return!0;if(e.inlineContent)return!1}else if(r.type.spec.isolating)return!0}return!0}(e))return!1;let n=t.type.spec.allowGapCursor;if(null!=n)return n;let r=t.contentMatchAt(e.index()).defaultType;return r&&r.isTextblock}static findGapCursorFrom(e,t,n=!1){e:for(;;){if(!n&&iN.valid(e))return e;let r=e.pos,o=null;for(let n=e.depth;;n--){let i=e.node(n);if(t>0?e.indexAfter(n)<i.childCount:e.index(n)>0){o=i.child(t>0?e.indexAfter(n):e.index(n)-1);break}if(0==n)return null;r+=t;let s=e.doc.resolve(r);if(iN.valid(s))return s}for(;;){let i=t>0?o.firstChild:o.lastChild;if(!i){if(o.isAtom&&!o.isText&&!Ur.isSelectable(o)){e=e.doc.resolve(r+o.nodeSize*t),n=!1;continue e}break}o=i,r+=t;let s=e.doc.resolve(r);if(iN.valid(s))return s}return null}}}iN.prototype.visible=!1,iN.findFrom=iN.findGapCursorFrom,Vr.jsonID("gapcursor",iN);class sN{constructor(e){this.pos=e}map(e){return new sN(e.map(this.pos))}resolve(e){let t=e.resolve(this.pos);return iN.valid(t)?new iN(t):Vr.near(t)}}function aN(e){return e.isAtom||e.spec.isolating||e.spec.createGapCursor}const lN=Di({ArrowLeft:cN("horiz",-1),ArrowRight:cN("horiz",1),ArrowUp:cN("vert",-1),ArrowDown:cN("vert",1)});function cN(e,t){const n="vert"==e?t>0?"down":"up":t>0?"right":"left";return function(e,r,o){let i=e.selection,s=t>0?i.$to:i.$from,a=i.empty;if(i instanceof Fr){if(!o.endOfTextblock(n)||0==s.depth)return!1;a=!1,s=e.doc.resolve(t>0?s.after():s.before())}let l=iN.findGapCursorFrom(s,t,a);return!!l&&(r&&r(e.tr.setSelection(new iN(l))),!0)}}function dN(e,t,n){if(!e||!e.editable)return!1;let r=e.state.doc.resolve(t);if(!iN.valid(r))return!1;let o=e.posAtCoords({left:n.clientX,top:n.clientY});return!(o&&o.inside>-1&&Ur.isSelectable(e.state.doc.nodeAt(o.inside)))&&(e.dispatch(e.state.tr.setSelection(new iN(r))),!0)}function uN(e,t){if("insertCompositionText"!=t.inputType||!(e.state.selection instanceof iN))return!1;let{$from:n}=e.state.selection,r=n.parent.contentMatchAt(n.index()).findWrapping(e.state.schema.nodes.text);if(!r)return!1;let o=Ft.empty;for(let e=r.length-1;e>=0;e--)o=Ft.from(r[e].createAndFill(null,o));let i=e.state.tr.replace(n.pos,n.pos,new Zt(o,0,0));return i.setSelection(Fr.near(i.doc.resolve(n.pos+1))),e.dispatch(i),!1}function hN(e){if(!(e.selection instanceof iN))return null;let t=document.createElement("div");return t.className="ProseMirror-gapcursor",Al.create(e.doc,[Nl.widget(e.selection.head,t,{key:"gapcursor"})])}function pN(e,t){return Object.assign(e,{meta:{package:"@milkdown/plugin-cursor",...t}}),e}var fN=Md(null,"dropIndicatorState");pN(fN,{displayName:"Ctx<dropIndicatorState>"});var mN=Md({width:2,color:!1,class:"milkdown-drop-indicator"},"dropIndicatorConfig");pN(mN,{displayName:"Ctx<dropIndicatorConfig>"});var gN=new lo("MILKDOWN_DROP_INDICATOR_DOM"),vN=kd(e=>new io({key:gN,view:t=>{const n=e.get(mN.key),r=document.createElement("div");Object.assign(r.style,{position:"fixed",pointerEvents:"none",display:"none",backgroundColor:n.color,top:"0",left:"0"}),r.classList.add(n.class),r.classList.add("milkdown-drop-indicator"),t.dom.parentNode?.appendChild(r);const o=e.use(fN.key),i=e=>{!function(e,t,n){if(!t)return void Object.assign(e.style,{display:"none"});const{line:r}=t,{width:o}=n,{p1:{x:i,y:s},p2:{x:a,y:l}}=r;let c,d,u=s,h=i;s===l?(c=a-i,d=o,u-=o/2):(c=o,d=l-s,h-=o/2);u=Math.round(u),h=Math.round(h),Object.assign(e.style,{display:"block",width:`${c}px`,height:`${d}px`,transform:`translate(${h}px, ${u}px)`})}(r,e,n)};return o.on(i),{destroy:()=>{o.off(i),r.remove()}}}}));pN(vN,{displayName:"Prose<dropIndicatorDOM>"});var yN=kd(e=>oN({onShow:t=>{e.set(fN.key,t)},onHide:()=>{e.set(fN.key,null)},onDrag:()=>!0}));pN(yN,{displayName:"Prose<dropIndicator>"});var wN=kd(()=>new io({props:{decorations:hN,createSelectionBetween:(e,t,n)=>t.pos==n.pos&&iN.valid(n)?new iN(n):null,handleClick:dN,handleKeyDown:lN,handleDOMEvents:{beforeinput:uN}}}));pN(wN,{displayName:"Prose<gapCursor>"});var bN=[wN,mN,fN,vN,yN].flat();function xN(e){var t;const n=null!=(t=null==e?void 0:e.skipWarning)&&t;let r="undefined"==typeof document?null:document.createElement("div");return new io({key:kN,view:e=>{!0!==n&&function(e,t){for(const[n,r]of Object.entries(e.marks))!1!==r.spec.inclusive||t.includes(n)||console.warn(`[prosemirror-virtual-cursor] Virtual cursor does not work well with marks that have inclusive set to false. Please consider removing the inclusive option from the "${n}" mark or adding it to the "skipWarning" option.`)}(e.state.schema,n||[]);const t=e.dom.ownerDocument;r=r||document.createElement("div");const o=r,i=()=>{!function(e,t){if(!e||!e.dom||e.isDestroyed||!t)return;const{state:n,dom:r}=e,{selection:o}=n;if(!SN(o))return;const i=function(e,t){var n;const r=window.getSelection();if(!r||!r.rangeCount)return null;const o=null==(n=null==r?void 0:r.getRangeAt(0))?void 0:n.cloneRange();if(!o)return null;o.collapse(t);const i=o.getClientRects(),s=(null==i?void 0:i.length)?i[i.length-1]:null;return(null==s?void 0:s.height)?s:e.coordsAtPos(e.state.selection.head)}(e,o.$head===o.$from);if(!i)return t;const s=r.getBoundingClientRect();let a="prosemirror-virtual-cursor";const l=n.selection.$head,[c,d]=CN(l),u=n.storedMarks||l.marks();o.$cursor&&c&&d&&u&&!Kt.sameSet(c,d)&&(Kt.sameSet(c,u)?a+=" prosemirror-virtual-cursor-left":Kt.sameSet(d,u)&&(a+=" prosemirror-virtual-cursor-right"));t.className=a,function(e,t){e.classList.remove(t),e.offsetWidth,e.classList.add(t)}(t,"prosemirror-virtual-cursor-animation"),t.style.height=i.bottom-i.top+"px",t.style.left=i.left-s.left+"px",t.style.top=i.top-s.top+"px"}(e,o)};let s;return window.ResizeObserver&&(s=new window.ResizeObserver(()=>i()),s.observe(e.dom)),t.addEventListener("selectionchange",i),{update:()=>{i()},destroy:()=>{t.removeEventListener("selectionchange",i),s&&s.unobserve(e.dom)}}},props:{handleKeyDown:(e,t)=>{var n;const{selection:r}=e.state;if(t.altKey||t.ctrlKey||t.metaKey||t.shiftKey||t.isComposing||!["ArrowLeft","ArrowRight"].includes(t.key)||!SN(r)||!r.empty)return!1;const o=r.$head,[i,s]=CN(o),a=e.state.storedMarks||o.marks();if(i&&s&&!Kt.sameSet(i,s)){if("ArrowLeft"===t.key&&!Kt.sameSet(i,a))return e.dispatch(e.state.tr.setStoredMarks(i)),!0;if("ArrowRight"===t.key&&!Kt.sameSet(s,a))return e.dispatch(e.state.tr.setStoredMarks(s)),!0}return"ArrowLeft"===t.key&&1===o.textOffset?(e.dispatch(e.state.tr.setSelection(Fr.create(e.state.doc,o.pos-1)).setStoredMarks(o.marks())),!0):"ArrowRight"===t.key&&o.textOffset+1===(null==(n=o.parent.maybeChild(o.index()))?void 0:n.nodeSize)&&(e.dispatch(e.state.tr.setSelection(Fr.create(e.state.doc,o.pos+1)).setStoredMarks(o.marks())),!0)},decorations:e=>{if(r&&SN(e.selection)&&e.selection.empty)return Al.create(e.doc,[Nl.widget(0,r,{key:"prosemirror-virtual-cursor"})])},attributes:{class:"virtual-cursor-enabled"}}})}var kN=new lo("prosemirror-virtual-cursor");function CN(e){const t=e.index(),n=e.parent.maybeChild(t);let r=e.textOffset?n:null;return!r&&t>0&&(r=e.parent.maybeChild(t-1)),[null==r?void 0:r.marks,null==n?void 0:n.marks]}function SN(e){return e&&"object"==typeof e&&"$cursor"in e}var MN=Object.defineProperty,NN=Object.getOwnPropertySymbols,EN=Object.prototype.hasOwnProperty,ON=Object.prototype.propertyIsEnumerable,AN=(e,t,n)=>t in e?MN(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,TN=(e,t)=>{for(var n in t||(t={}))EN.call(t,n)&&AN(e,n,t[n]);if(NN)for(var n of NN(t))ON.call(t,n)&&AN(e,n,t[n]);return e};function DN(e,t){return Object.assign(e,{meta:TN({package:"@milkdown/components"},t)}),e}const IN=Md({imageIcon:"🌌",uploadButton:"Upload",confirmButton:"⏎",uploadPlaceholderText:"/Paste",onUpload:e=>Promise.resolve(URL.createObjectURL(e))},"inlineImageConfigCtx");DN(IN,{displayName:"Config<image-inline>",group:"ImageInline"});const _N=gd("abcdefghijklmnopqrstuvwxyz0123456789",8);function RN(e){return`${e}-${_N()}`}function LN({icon:e,class:t,onClick:n}){return Yw("span",{class:_e("milkdown-icon",t),onPointerdown:n,innerHTML:e?Re.sanitize(e.trim()):void 0})}LN.props={icon:{type:String,required:!1},class:{type:String,required:!1},onClick:{type:Function,required:!1}};const BN=mv({props:{src:{type:Object,required:!0},selected:{type:Object,required:!0},readonly:{type:Object,required:!0},setLink:{type:Function,required:!0},imageIcon:{type:String,required:!1},uploadButton:{type:String,required:!1},confirmButton:{type:String,required:!1},uploadPlaceholderText:{type:String,required:!1},onUpload:{type:Function,required:!0},onImageLoadError:{type:Function,required:!1}},setup({readonly:e,src:t,setLink:n,onUpload:r,imageIcon:o,uploadButton:i,confirmButton:s,uploadPlaceholderText:a,className:l,onImageLoadError:c}){var d,u;const h=Wm(!1),p=Wm(),f=Wm(null!=(d=t.value)?d:""),m=RN("milkdown-image-link"),g=RN("milkdown-image-upload"),v=Wm(0!==(null==(u=t.value)?void 0:u.length)),y=e=>{const t=e.target.value;v.value=0!==t.length,f.value=t},w=e=>{var t,r;"Enter"===e.key&&n(null!=(r=null==(t=p.value)?void 0:t.value)?r:"")},b=e=>{var t;const o=null==(t=e.target.files)?void 0:t[0];o&&r(o).then(e=>{e&&(n(e),v.value=!0)}).catch(e=>{console.error("An error occurred while uploading image"),console.error(e)})};return()=>Yw("div",{class:_e("image-edit",l)},Yw(LN,{icon:o,class:"image-icon"}),Yw("div",{class:_e("link-importer",h.value&&"focus")},Yw("input",{id:m,ref:p,draggable:"true",onDragstart:e=>{e.preventDefault(),e.stopPropagation()},disabled:e.value,class:"link-input-area",value:f.value,onInput:y,onKeydown:w,onFocus:()=>h.value=!0,onBlur:()=>h.value=!1}),!v.value&&Yw("div",{class:"placeholder"},Yw("input",{disabled:e.value,class:"hidden",id:g,type:"file",accept:"image/*",onChange:b}),Yw("label",{class:"uploader",for:g},Yw(LN,{icon:i})),Yw("span",{class:"text",onClick:()=>{var e;return null==(e=p.value)?void 0:e.focus()}},a))),f.value&&Yw(iw,null,Yw("div",{class:"image-preview"},Yw("img",{src:f.value,alt:"",onError:e=>Promise.resolve(null==c?void 0:c(e)).catch(()=>{})})),Yw("div",{class:"confirm",onClick:()=>{var e,t;n(null!=(t=null==(e=p.value)?void 0:e.value)?t:"")}},Yw(LN,{icon:s}))))}}),PN=mv({props:{src:{type:Object,required:!0},alt:{type:Object,required:!0},title:{type:Object,required:!0},selected:{type:Object,required:!0},readonly:{type:Object,required:!0},setAttr:{type:Function,required:!0},config:{type:Object,required:!0}},setup(e){const{src:t,alt:n,title:r}=e;return()=>{var o;return(null==(o=t.value)?void 0:o.length)?Yw("img",{class:"image-inline",src:t.value,alt:n.value,title:r.value}):Yw(BN,{src:e.src,selected:e.selected,readonly:e.readonly,setLink:t=>e.setAttr("src",t),imageIcon:e.config.imageIcon,uploadButton:e.config.uploadButton,confirmButton:e.config.confirmButton,uploadPlaceholderText:e.config.uploadPlaceholderText,onUpload:e.config.onUpload,className:"empty-image-inline"})}}}),zN=Sd(Yu.node,e=>(t,n,r)=>{const o=Wm(t.attrs.src),i=Wm(t.attrs.alt),s=Wm(t.attrs.title),a=Wm(!1),l=Wm(!n.editable),c=e.get(IN.key),d=Db(PN,{src:o,alt:i,title:s,selected:a,readonly:l,setAttr:(e,t)=>{if(!n.editable)return;const o=r();null!=o&&n.dispatch(n.state.tr.setNodeAttribute(o,e,"src"===e?Re.sanitize(t):t))},config:c}),u=document.createElement("span");u.className="milkdown-image-inline";const h=ov(()=>{a.value?u.classList.add("selected"):u.classList.remove("selected")}),p=c.proxyDomURL,f=e=>{if(p){const t=p(e.attrs.src);"string"==typeof t?o.value=t:t.then(e=>{o.value=e}).catch(console.error)}else o.value=e.attrs.src;i.value=e.attrs.alt,s.value=e.attrs.title};return f(t),d.mount(u),{dom:u,update:e=>e.type===t.type&&(f(e),!0),stopEvent:e=>e.target instanceof HTMLInputElement,selectNode:()=>{a.value=!0},deselectNode:()=>{a.value=!1},destroy:()=>{h(),d.unmount(),u.remove()}}});DN(zN,{displayName:"NodeView<image-inline>",group:"ImageInline"});const jN=[IN,zN];class VN extends Error{constructor(e,t){var n,r,o="KaTeX parse error: "+e,i=t&&t.loc;if(i&&i.start<=i.end){var s=i.lexer.input;n=i.start,r=i.end,n===s.length?o+=" at end of input: ":o+=" at position "+(n+1)+": ";var a=s.slice(n,r).replace(/[^]/g,"$&̲");o+=(n>15?"…"+s.slice(n-15,n):s.slice(0,n))+a+(r+15<s.length?s.slice(r,r+15)+"…":s.slice(r))}super(o),this.name="ParseError",this.position=void 0,this.length=void 0,this.rawMessage=void 0,Object.setPrototypeOf(this,VN.prototype),this.position=n,null!=n&&null!=r&&(this.length=r-n),this.rawMessage=e}}var $N=/([A-Z])/g,HN=e=>e.replace($N,"-$1").toLowerCase(),qN={"&":"&amp;",">":"&gt;","<":"&lt;",'"':"&quot;","'":"&#x27;"},FN=/[&><"']/g,WN=e=>String(e).replace(FN,e=>qN[e]),UN=e=>"ordgroup"===e.type||"color"===e.type?1===e.body.length?UN(e.body[0]):e:"font"===e.type?UN(e.body):e,GN=new Set(["mathord","textord","atom"]),KN=e=>GN.has(UN(e).type),JN={displayMode:{type:"boolean",description:"Render math in display mode, which puts the math in display style (so \\int and \\sum are large, for example), and centers the math on the page on its own line.",cli:"-d, --display-mode"},output:{type:{enum:["htmlAndMathml","html","mathml"]},description:"Determines the markup language of the output.",cli:"-F, --format <type>"},leqno:{type:"boolean",description:"Render display math in leqno style (left-justified tags)."},fleqn:{type:"boolean",description:"Render display math flush left."},throwOnError:{type:"boolean",default:!0,cli:"-t, --no-throw-on-error",cliDescription:"Render errors (in the color given by --error-color) instead of throwing a ParseError exception when encountering an error."},errorColor:{type:"string",default:"#cc0000",cli:"-c, --error-color <color>",cliDescription:"A color string given in the format 'rgb' or 'rrggbb' (no #). This option determines the color of errors rendered by the -t option.",cliProcessor:e=>"#"+e},macros:{type:"object",cli:"-m, --macro <def>",cliDescription:"Define custom macro of the form '\\foo:expansion' (use multiple -m arguments for multiple macros).",cliDefault:[],cliProcessor:(e,t)=>(t.push(e),t)},minRuleThickness:{type:"number",description:"Specifies a minimum thickness, in ems, for fraction lines, `\\sqrt` top lines, `{array}` vertical lines, `\\hline`, `\\hdashline`, `\\underline`, `\\overline`, and the borders of `\\fbox`, `\\boxed`, and `\\fcolorbox`.",processor:e=>Math.max(0,e),cli:"--min-rule-thickness <size>",cliProcessor:parseFloat},colorIsTextColor:{type:"boolean",description:"Makes \\color behave like LaTeX's 2-argument \\textcolor, instead of LaTeX's one-argument \\color mode change.",cli:"-b, --color-is-text-color"},strict:{type:[{enum:["warn","ignore","error"]},"boolean","function"],description:"Turn on strict / LaTeX faithfulness mode, which throws an error if the input uses features that are not supported by LaTeX.",cli:"-S, --strict",cliDefault:!1},trust:{type:["boolean","function"],description:"Trust the input, enabling all HTML features such as \\url.",cli:"-T, --trust"},maxSize:{type:"number",default:1/0,description:"If non-zero, all user-specified sizes, e.g. in \\rule{500em}{500em}, will be capped to maxSize ems. Otherwise, elements and spaces can be arbitrarily large",processor:e=>Math.max(0,e),cli:"-s, --max-size <n>",cliProcessor:parseInt},maxExpand:{type:"number",default:1e3,description:"Limit the number of macro expansions to the specified number, to prevent e.g. infinite macro loops. If set to Infinity, the macro expander will try to fully expand as in LaTeX.",processor:e=>Math.max(0,e),cli:"-e, --max-expand <n>",cliProcessor:e=>"Infinity"===e?1/0:parseInt(e)},globalGroup:{type:"boolean",cli:!1}};function ZN(e){return Object.prototype.hasOwnProperty.call(e,"default")&&void 0!==e.default?e.default:function(e){if("string"!=typeof e)return e.enum[0];switch(e){case"boolean":return!1;case"string":return"";case"number":return 0;case"object":return{};default:throw new Error("Unexpected schema type; settings must declare an explicit default.")}}(Array.isArray(e.type)?e.type[0]:e.type)}function YN(e,t,n,r){var o=Object.prototype.hasOwnProperty.call(n,t)?n[t]:void 0,i=Object.prototype.hasOwnProperty.call(r,"processor")?r.processor:void 0;e[t]=void 0!==o?i?i(o):o:ZN(r)}class XN{constructor(e){for(var t of(void 0===e&&(e={}),this.displayMode=void 0,this.output=void 0,this.leqno=void 0,this.fleqn=void 0,this.throwOnError=void 0,this.errorColor=void 0,this.macros=void 0,this.minRuleThickness=void 0,this.colorIsTextColor=void 0,this.strict=void 0,this.trust=void 0,this.maxSize=void 0,this.maxExpand=void 0,this.globalGroup=void 0,e=e||{},Object.keys(JN))){var n=JN[t];n&&YN(this,t,e,n)}}isTrusted(e){if("url"in e&&e.url&&!e.protocol){var t=(e=>{var t=/^[\x00-\x20]*([^\\/#?]*?)(:|&#0*58|&#x0*3a|&colon)/i.exec(e);return t?":"!==t[2]?null:/^[a-zA-Z][a-zA-Z0-9+\-.]*$/.test(t[1])?t[1].toLowerCase():null:"_relative"})(e.url);if(null==t)return!1;e.protocol=t}var n="function"==typeof this.trust?this.trust(e):this.trust;return Boolean(n)}}class QN{constructor(e,t,n){this.id=void 0,this.size=void 0,this.cramped=void 0,this.id=e,this.size=t,this.cramped=n}sup(){return eE[tE[this.id]]}sub(){return eE[nE[this.id]]}fracNum(){return eE[rE[this.id]]}fracDen(){return eE[oE[this.id]]}cramp(){return eE[iE[this.id]]}text(){return eE[sE[this.id]]}isTight(){return this.size>=2}}var eE=[new QN(0,0,!1),new QN(1,0,!0),new QN(2,1,!1),new QN(3,1,!0),new QN(4,2,!1),new QN(5,2,!0),new QN(6,3,!1),new QN(7,3,!0)],tE=[4,5,4,5,6,7,6,7],nE=[5,5,5,5,7,7,7,7],rE=[2,3,4,5,6,7,6,7],oE=[3,3,5,5,7,7,7,7],iE=[1,1,3,3,5,5,7,7],sE=[0,1,2,3,2,3,2,3],aE={DISPLAY:eE[0],TEXT:eE[2],SCRIPT:eE[4],SCRIPTSCRIPT:eE[6]},lE=[{name:"latin",blocks:[[256,591],[768,879]]},{name:"cyrillic",blocks:[[1024,1279]]},{name:"armenian",blocks:[[1328,1423]]},{name:"brahmic",blocks:[[2304,4255]]},{name:"georgian",blocks:[[4256,4351]]},{name:"cjk",blocks:[[12288,12543],[19968,40879],[65280,65376]]},{name:"hangul",blocks:[[44032,55215]]}];var cE=[];function dE(e){for(var t=0;t<cE.length;t+=2)if(e>=cE[t]&&e<=cE[t+1])return!0;return!1}lE.forEach(e=>e.blocks.forEach(e=>cE.push(...e)));var uE=e=>e+" "+e,hE=80,pE={doubleleftarrow:"M262 157\nl10-10c34-36 62.7-77 86-123 3.3-8 5-13.3 5-16 0-5.3-6.7-8-20-8-7.3\n 0-12.2.5-14.5 1.5-2.3 1-4.8 4.5-7.5 10.5-49.3 97.3-121.7 169.3-217 216-28\n 14-57.3 25-88 33-6.7 2-11 3.8-13 5.5-2 1.7-3 4.2-3 7.5s1 5.8 3 7.5\nc2 1.7 6.3 3.5 13 5.5 68 17.3 128.2 47.8 180.5 91.5 52.3 43.7 93.8 96.2 124.5\n 157.5 9.3 8 15.3 12.3 18 13h6c12-.7 18-4 18-10 0-2-1.7-7-5-15-23.3-46-52-87\n-86-123l-10-10h399738v-40H218c328 0 0 0 0 0l-10-8c-26.7-20-65.7-43-117-69 2.7\n-2 6-3.7 10-5 36.7-16 72.3-37.3 107-64l10-8h399782v-40z\nm8 0v40h399730v-40zm0 194v40h399730v-40z",doublerightarrow:"M399738 392l\n-10 10c-34 36-62.7 77-86 123-3.3 8-5 13.3-5 16 0 5.3 6.7 8 20 8 7.3 0 12.2-.5\n 14.5-1.5 2.3-1 4.8-4.5 7.5-10.5 49.3-97.3 121.7-169.3 217-216 28-14 57.3-25 88\n-33 6.7-2 11-3.8 13-5.5 2-1.7 3-4.2 3-7.5s-1-5.8-3-7.5c-2-1.7-6.3-3.5-13-5.5-68\n-17.3-128.2-47.8-180.5-91.5-52.3-43.7-93.8-96.2-124.5-157.5-9.3-8-15.3-12.3-18\n-13h-6c-12 .7-18 4-18 10 0 2 1.7 7 5 15 23.3 46 52 87 86 123l10 10H0v40h399782\nc-328 0 0 0 0 0l10 8c26.7 20 65.7 43 117 69-2.7 2-6 3.7-10 5-36.7 16-72.3 37.3\n-107 64l-10 8H0v40zM0 157v40h399730v-40zm0 194v40h399730v-40z",leftarrow:"M400000 241H110l3-3c68.7-52.7 113.7-120\n 135-202 4-14.7 6-23 6-25 0-7.3-7-11-21-11-8 0-13.2.8-15.5 2.5-2.3 1.7-4.2 5.8\n-5.5 12.5-1.3 4.7-2.7 10.3-4 17-12 48.7-34.8 92-68.5 130S65.3 228.3 18 247\nc-10 4-16 7.7-18 11 0 8.7 6 14.3 18 17 47.3 18.7 87.8 47 121.5 85S196 441.3 208\n 490c.7 2 1.3 5 2 9s1.2 6.7 1.5 8c.3 1.3 1 3.3 2 6s2.2 4.5 3.5 5.5c1.3 1 3.3\n 1.8 6 2.5s6 1 10 1c14 0 21-3.7 21-11 0-2-2-10.3-6-25-20-79.3-65-146.7-135-202\n l-3-3h399890zM100 241v40h399900v-40z",leftbrace:"M6 548l-6-6v-35l6-11c56-104 135.3-181.3 238-232 57.3-28.7 117\n-45 179-50h399577v120H403c-43.3 7-81 15-113 26-100.7 33-179.7 91-237 174-2.7\n 5-6 9-10 13-.7 1-7.3 1-20 1H6z",leftbraceunder:"M0 6l6-6h17c12.688 0 19.313.3 20 1 4 4 7.313 8.3 10 13\n 35.313 51.3 80.813 93.8 136.5 127.5 55.688 33.7 117.188 55.8 184.5 66.5.688\n 0 2 .3 4 1 18.688 2.7 76 4.3 172 5h399450v120H429l-6-1c-124.688-8-235-61.7\n-331-161C60.687 138.7 32.312 99.3 7 54L0 41V6z",leftgroup:"M400000 80\nH435C64 80 168.3 229.4 21 260c-5.9 1.2-18 0-18 0-2 0-3-1-3-3v-38C76 61 257 0\n 435 0h399565z",leftgroupunder:"M400000 262\nH435C64 262 168.3 112.6 21 82c-5.9-1.2-18 0-18 0-2 0-3 1-3 3v38c76 158 257 219\n 435 219h399565z",leftharpoon:"M0 267c.7 5.3 3 10 7 14h399993v-40H93c3.3\n-3.3 10.2-9.5 20.5-18.5s17.8-15.8 22.5-20.5c50.7-52 88-110.3 112-175 4-11.3 5\n-18.3 3-21-1.3-4-7.3-6-18-6-8 0-13 .7-15 2s-4.7 6.7-8 16c-42 98.7-107.3 174.7\n-196 228-6.7 4.7-10.7 8-12 10-1.3 2-2 5.7-2 11zm100-26v40h399900v-40z",leftharpoonplus:"M0 267c.7 5.3 3 10 7 14h399993v-40H93c3.3-3.3 10.2-9.5\n 20.5-18.5s17.8-15.8 22.5-20.5c50.7-52 88-110.3 112-175 4-11.3 5-18.3 3-21-1.3\n-4-7.3-6-18-6-8 0-13 .7-15 2s-4.7 6.7-8 16c-42 98.7-107.3 174.7-196 228-6.7 4.7\n-10.7 8-12 10-1.3 2-2 5.7-2 11zm100-26v40h399900v-40zM0 435v40h400000v-40z\nm0 0v40h400000v-40z",leftharpoondown:"M7 241c-4 4-6.333 8.667-7 14 0 5.333.667 9 2 11s5.333\n 5.333 12 10c90.667 54 156 130 196 228 3.333 10.667 6.333 16.333 9 17 2 .667 5\n 1 9 1h5c10.667 0 16.667-2 18-6 2-2.667 1-9.667-3-21-32-87.333-82.667-157.667\n-152-211l-3-3h399907v-40zM93 281 H400000 v-40L7 241z",leftharpoondownplus:"M7 435c-4 4-6.3 8.7-7 14 0 5.3.7 9 2 11s5.3 5.3 12\n 10c90.7 54 156 130 196 228 3.3 10.7 6.3 16.3 9 17 2 .7 5 1 9 1h5c10.7 0 16.7\n-2 18-6 2-2.7 1-9.7-3-21-32-87.3-82.7-157.7-152-211l-3-3h399907v-40H7zm93 0\nv40h399900v-40zM0 241v40h399900v-40zm0 0v40h399900v-40z",lefthook:"M400000 281 H103s-33-11.2-61-33.5S0 197.3 0 164s14.2-61.2 42.5\n-83.5C70.8 58.2 104 47 142 47 c16.7 0 25 6.7 25 20 0 12-8.7 18.7-26 20-40 3.3\n-68.7 15.7-86 37-10 12-15 25.3-15 40 0 22.7 9.8 40.7 29.5 54 19.7 13.3 43.5 21\n 71.5 23h399859zM103 281v-40h399897v40z",leftlinesegment:uE("M40 281 V428 H0 V94 H40 V241 H400000 v40z"),leftbracketunder:uE("M0 0 h120 V290 H399995 v120 H0z"),leftbracketover:uE("M0 440 h120 V150 H399995 v-120 H0z"),leftmapsto:uE("M40 281 V448H0V74H40V241H400000v40z"),leftToFrom:"M0 147h400000v40H0zm0 214c68 40 115.7 95.7 143 167h22c15.3 0 23\n-.3 23-1 0-1.3-5.3-13.7-16-37-18-35.3-41.3-69-70-101l-7-8h399905v-40H95l7-8\nc28.7-32 52-65.7 70-101 10.7-23.3 16-35.7 16-37 0-.7-7.7-1-23-1h-22C115.7 265.3\n 68 321 0 361zm0-174v-40h399900v40zm100 154v40h399900v-40z",longequal:uE("M0 50 h400000 v40H0z m0 194h40000v40H0z"),midbrace:"M200428 334\nc-100.7-8.3-195.3-44-280-108-55.3-42-101.7-93-139-153l-9-14c-2.7 4-5.7 8.7-9 14\n-53.3 86.7-123.7 153-211 199-66.7 36-137.3 56.3-212 62H0V214h199568c178.3-11.7\n 311.7-78.3 403-201 6-8 9.7-12 11-12 .7-.7 6.7-1 18-1s17.3.3 18 1c1.3 0 5 4 11\n 12 44.7 59.3 101.3 106.3 170 141s145.3 54.3 229 60h199572v120z",midbraceunder:"M199572 214\nc100.7 8.3 195.3 44 280 108 55.3 42 101.7 93 139 153l9 14c2.7-4 5.7-8.7 9-14\n 53.3-86.7 123.7-153 211-199 66.7-36 137.3-56.3 212-62h199568v120H200432c-178.3\n 11.7-311.7 78.3-403 201-6 8-9.7 12-11 12-.7.7-6.7 1-18 1s-17.3-.3-18-1c-1.3 0\n-5-4-11-12-44.7-59.3-101.3-106.3-170-141s-145.3-54.3-229-60H0V214z",oiintSize1:"M512.6 71.6c272.6 0 320.3 106.8 320.3 178.2 0 70.8-47.7 177.6\n-320.3 177.6S193.1 320.6 193.1 249.8c0-71.4 46.9-178.2 319.5-178.2z\nm368.1 178.2c0-86.4-60.9-215.4-368.1-215.4-306.4 0-367.3 129-367.3 215.4 0 85.8\n60.9 214.8 367.3 214.8 307.2 0 368.1-129 368.1-214.8z",oiintSize2:"M757.8 100.1c384.7 0 451.1 137.6 451.1 230 0 91.3-66.4 228.8\n-451.1 228.8-386.3 0-452.7-137.5-452.7-228.8 0-92.4 66.4-230 452.7-230z\nm502.4 230c0-111.2-82.4-277.2-502.4-277.2s-504 166-504 277.2\nc0 110 84 276 504 276s502.4-166 502.4-276z",oiiintSize1:"M681.4 71.6c408.9 0 480.5 106.8 480.5 178.2 0 70.8-71.6 177.6\n-480.5 177.6S202.1 320.6 202.1 249.8c0-71.4 70.5-178.2 479.3-178.2z\nm525.8 178.2c0-86.4-86.8-215.4-525.7-215.4-437.9 0-524.7 129-524.7 215.4 0\n85.8 86.8 214.8 524.7 214.8 438.9 0 525.7-129 525.7-214.8z",oiiintSize2:"M1021.2 53c603.6 0 707.8 165.8 707.8 277.2 0 110-104.2 275.8\n-707.8 275.8-606 0-710.2-165.8-710.2-275.8C311 218.8 415.2 53 1021.2 53z\nm770.4 277.1c0-131.2-126.4-327.6-770.5-327.6S248.4 198.9 248.4 330.1\nc0 130 128.8 326.4 772.7 326.4s770.5-196.4 770.5-326.4z",rightarrow:"M0 241v40h399891c-47.3 35.3-84 78-110 128\n-16.7 32-27.7 63.7-33 95 0 1.3-.2 2.7-.5 4-.3 1.3-.5 2.3-.5 3 0 7.3 6.7 11 20\n 11 8 0 13.2-.8 15.5-2.5 2.3-1.7 4.2-5.5 5.5-11.5 2-13.3 5.7-27 11-41 14.7-44.7\n 39-84.5 73-119.5s73.7-60.2 119-75.5c6-2 9-5.7 9-11s-3-9-9-11c-45.3-15.3-85\n-40.5-119-75.5s-58.3-74.8-73-119.5c-4.7-14-8.3-27.3-11-40-1.3-6.7-3.2-10.8-5.5\n-12.5-2.3-1.7-7.5-2.5-15.5-2.5-14 0-21 3.7-21 11 0 2 2 10.3 6 25 20.7 83.3 67\n 151.7 139 205zm0 0v40h399900v-40z",rightbrace:"M400000 542l\n-6 6h-17c-12.7 0-19.3-.3-20-1-4-4-7.3-8.3-10-13-35.3-51.3-80.8-93.8-136.5-127.5\ns-117.2-55.8-184.5-66.5c-.7 0-2-.3-4-1-18.7-2.7-76-4.3-172-5H0V214h399571l6 1\nc124.7 8 235 61.7 331 161 31.3 33.3 59.7 72.7 85 118l7 13v35z",rightbraceunder:"M399994 0l6 6v35l-6 11c-56 104-135.3 181.3-238 232-57.3\n 28.7-117 45-179 50H-300V214h399897c43.3-7 81-15 113-26 100.7-33 179.7-91 237\n-174 2.7-5 6-9 10-13 .7-1 7.3-1 20-1h17z",rightgroup:"M0 80h399565c371 0 266.7 149.4 414 180 5.9 1.2 18 0 18 0 2 0\n 3-1 3-3v-38c-76-158-257-219-435-219H0z",rightgroupunder:"M0 262h399565c371 0 266.7-149.4 414-180 5.9-1.2 18 0 18\n 0 2 0 3 1 3 3v38c-76 158-257 219-435 219H0z",rightharpoon:"M0 241v40h399993c4.7-4.7 7-9.3 7-14 0-9.3\n-3.7-15.3-11-18-92.7-56.7-159-133.7-199-231-3.3-9.3-6-14.7-8-16-2-1.3-7-2-15-2\n-10.7 0-16.7 2-18 6-2 2.7-1 9.7 3 21 15.3 42 36.7 81.8 64 119.5 27.3 37.7 58\n 69.2 92 94.5zm0 0v40h399900v-40z",rightharpoonplus:"M0 241v40h399993c4.7-4.7 7-9.3 7-14 0-9.3-3.7-15.3-11\n-18-92.7-56.7-159-133.7-199-231-3.3-9.3-6-14.7-8-16-2-1.3-7-2-15-2-10.7 0-16.7\n 2-18 6-2 2.7-1 9.7 3 21 15.3 42 36.7 81.8 64 119.5 27.3 37.7 58 69.2 92 94.5z\nm0 0v40h399900v-40z m100 194v40h399900v-40zm0 0v40h399900v-40z",rightharpoondown:"M399747 511c0 7.3 6.7 11 20 11 8 0 13-.8 15-2.5s4.7-6.8\n 8-15.5c40-94 99.3-166.3 178-217 13.3-8 20.3-12.3 21-13 5.3-3.3 8.5-5.8 9.5\n-7.5 1-1.7 1.5-5.2 1.5-10.5s-2.3-10.3-7-15H0v40h399908c-34 25.3-64.7 57-92 95\n-27.3 38-48.7 77.7-64 119-3.3 8.7-5 14-5 16zM0 241v40h399900v-40z",rightharpoondownplus:"M399747 705c0 7.3 6.7 11 20 11 8 0 13-.8\n 15-2.5s4.7-6.8 8-15.5c40-94 99.3-166.3 178-217 13.3-8 20.3-12.3 21-13 5.3-3.3\n 8.5-5.8 9.5-7.5 1-1.7 1.5-5.2 1.5-10.5s-2.3-10.3-7-15H0v40h399908c-34 25.3\n-64.7 57-92 95-27.3 38-48.7 77.7-64 119-3.3 8.7-5 14-5 16zM0 435v40h399900v-40z\nm0-194v40h400000v-40zm0 0v40h400000v-40z",righthook:"M399859 241c-764 0 0 0 0 0 40-3.3 68.7-15.7 86-37 10-12 15-25.3\n 15-40 0-22.7-9.8-40.7-29.5-54-19.7-13.3-43.5-21-71.5-23-17.3-1.3-26-8-26-20 0\n-13.3 8.7-20 26-20 38 0 71 11.2 99 33.5 0 0 7 5.6 21 16.7 14 11.2 21 33.5 21\n 66.8s-14 61.2-42 83.5c-28 22.3-61 33.5-99 33.5L0 241z M0 281v-40h399859v40z",rightlinesegment:uE("M399960 241 V94 h40 V428 h-40 V281 H0 v-40z"),rightbracketunder:uE("M399995 0 h-120 V290 H0 v120 H400000z"),rightbracketover:uE("M399995 440 h-120 V150 H0 v-120 H399995z"),rightToFrom:"M400000 167c-70.7-42-118-97.7-142-167h-23c-15.3 0-23 .3-23\n 1 0 1.3 5.3 13.7 16 37 18 35.3 41.3 69 70 101l7 8H0v40h399905l-7 8c-28.7 32\n-52 65.7-70 101-10.7 23.3-16 35.7-16 37 0 .7 7.7 1 23 1h23c24-69.3 71.3-125 142\n-167z M100 147v40h399900v-40zM0 341v40h399900v-40z",twoheadleftarrow:"M0 167c68 40\n 115.7 95.7 143 167h22c15.3 0 23-.3 23-1 0-1.3-5.3-13.7-16-37-18-35.3-41.3-69\n-70-101l-7-8h125l9 7c50.7 39.3 85 86 103 140h46c0-4.7-6.3-18.7-19-42-18-35.3\n-40-67.3-66-96l-9-9h399716v-40H284l9-9c26-28.7 48-60.7 66-96 12.7-23.333 19\n-37.333 19-42h-46c-18 54-52.3 100.7-103 140l-9 7H95l7-8c28.7-32 52-65.7 70-101\n 10.7-23.333 16-35.7 16-37 0-.7-7.7-1-23-1h-22C115.7 71.3 68 127 0 167z",twoheadrightarrow:"M400000 167\nc-68-40-115.7-95.7-143-167h-22c-15.3 0-23 .3-23 1 0 1.3 5.3 13.7 16 37 18 35.3\n 41.3 69 70 101l7 8h-125l-9-7c-50.7-39.3-85-86-103-140h-46c0 4.7 6.3 18.7 19 42\n 18 35.3 40 67.3 66 96l9 9H0v40h399716l-9 9c-26 28.7-48 60.7-66 96-12.7 23.333\n-19 37.333-19 42h46c18-54 52.3-100.7 103-140l9-7h125l-7 8c-28.7 32-52 65.7-70\n 101-10.7 23.333-16 35.7-16 37 0 .7 7.7 1 23 1h22c27.3-71.3 75-127 143-167z",tilde1:"M200 55.538c-77 0-168 73.953-177 73.953-3 0-7\n-2.175-9-5.437L2 97c-1-2-2-4-2-6 0-4 2-7 5-9l20-12C116 12 171 0 207 0c86 0\n 114 68 191 68 78 0 168-68 177-68 4 0 7 2 9 5l12 19c1 2.175 2 4.35 2 6.525 0\n 4.35-2 7.613-5 9.788l-19 13.05c-92 63.077-116.937 75.308-183 76.128\n-68.267.847-113-73.952-191-73.952z",tilde2:"M344 55.266c-142 0-300.638 81.316-311.5 86.418\n-8.01 3.762-22.5 10.91-23.5 5.562L1 120c-1-2-1-3-1-4 0-5 3-9 8-10l18.4-9C160.9\n 31.9 283 0 358 0c148 0 188 122 331 122s314-97 326-97c4 0 8 2 10 7l7 21.114\nc1 2.14 1 3.21 1 4.28 0 5.347-3 9.626-7 10.696l-22.3 12.622C852.6 158.372 751\n 181.476 676 181.476c-149 0-189-126.21-332-126.21z",tilde3:"M786 59C457 59 32 175.242 13 175.242c-6 0-10-3.457\n-11-10.37L.15 138c-1-7 3-12 10-13l19.2-6.4C378.4 40.7 634.3 0 804.3 0c337 0\n 411.8 157 746.8 157 328 0 754-112 773-112 5 0 10 3 11 9l1 14.075c1 8.066-.697\n 16.595-6.697 17.492l-21.052 7.31c-367.9 98.146-609.15 122.696-778.15 122.696\n -338 0-409-156.573-744-156.573z",tilde4:"M786 58C457 58 32 177.487 13 177.487c-6 0-10-3.345\n-11-10.035L.15 143c-1-7 3-12 10-13l22-6.7C381.2 35 637.15 0 807.15 0c337 0 409\n 177 744 177 328 0 754-127 773-127 5 0 10 3 11 9l1 14.794c1 7.805-3 13.38-9\n 14.495l-20.7 5.574c-366.85 99.79-607.3 139.372-776.3 139.372-338 0-409\n -175.236-744-175.236z",vec:"M377 20c0-5.333 1.833-10 5.5-14S391 0 397 0c4.667 0 8.667 1.667 12 5\n3.333 2.667 6.667 9 10 19 6.667 24.667 20.333 43.667 41 57 7.333 4.667 11\n10.667 11 18 0 6-1 10-3 12s-6.667 5-14 9c-28.667 14.667-53.667 35.667-75 63\n-1.333 1.333-3.167 3.5-5.5 6.5s-4 4.833-5 5.5c-1 .667-2.5 1.333-4.5 2s-4.333 1\n-7 1c-4.667 0-9.167-1.833-13.5-5.5S337 184 337 178c0-12.667 15.667-32.333 47-59\nH213l-171-1c-8.667-6-13-12.333-13-19 0-4.667 4.333-11.333 13-20h359\nc-16-25.333-24-45-24-59z",widehat1:"M529 0h5l519 115c5 1 9 5 9 10 0 1-1 2-1 3l-4 22\nc-1 5-5 9-11 9h-2L532 67 19 159h-2c-5 0-9-4-11-9l-5-22c-1-6 2-12 8-13z",widehat2:"M1181 0h2l1171 176c6 0 10 5 10 11l-2 23c-1 6-5 10\n-11 10h-1L1182 67 15 220h-1c-6 0-10-4-11-10l-2-23c-1-6 4-11 10-11z",widehat3:"M1181 0h2l1171 236c6 0 10 5 10 11l-2 23c-1 6-5 10\n-11 10h-1L1182 67 15 280h-1c-6 0-10-4-11-10l-2-23c-1-6 4-11 10-11z",widehat4:"M1181 0h2l1171 296c6 0 10 5 10 11l-2 23c-1 6-5 10\n-11 10h-1L1182 67 15 340h-1c-6 0-10-4-11-10l-2-23c-1-6 4-11 10-11z",widecheck1:"M529,159h5l519,-115c5,-1,9,-5,9,-10c0,-1,-1,-2,-1,-3l-4,-22c-1,\n-5,-5,-9,-11,-9h-2l-512,92l-513,-92h-2c-5,0,-9,4,-11,9l-5,22c-1,6,2,12,8,13z",widecheck2:"M1181,220h2l1171,-176c6,0,10,-5,10,-11l-2,-23c-1,-6,-5,-10,\n-11,-10h-1l-1168,153l-1167,-153h-1c-6,0,-10,4,-11,10l-2,23c-1,6,4,11,10,11z",widecheck3:"M1181,280h2l1171,-236c6,0,10,-5,10,-11l-2,-23c-1,-6,-5,-10,\n-11,-10h-1l-1168,213l-1167,-213h-1c-6,0,-10,4,-11,10l-2,23c-1,6,4,11,10,11z",widecheck4:"M1181,340h2l1171,-296c6,0,10,-5,10,-11l-2,-23c-1,-6,-5,-10,\n-11,-10h-1l-1168,273l-1167,-273h-1c-6,0,-10,4,-11,10l-2,23c-1,6,4,11,10,11z",baraboveleftarrow:"M400000 620h-399890l3 -3c68.7 -52.7 113.7 -120 135 -202\nc4 -14.7 6 -23 6 -25c0 -7.3 -7 -11 -21 -11c-8 0 -13.2 0.8 -15.5 2.5\nc-2.3 1.7 -4.2 5.8 -5.5 12.5c-1.3 4.7 -2.7 10.3 -4 17c-12 48.7 -34.8 92 -68.5 130\ns-74.2 66.3 -121.5 85c-10 4 -16 7.7 -18 11c0 8.7 6 14.3 18 17c47.3 18.7 87.8 47\n121.5 85s56.5 81.3 68.5 130c0.7 2 1.3 5 2 9s1.2 6.7 1.5 8c0.3 1.3 1 3.3 2 6\ns2.2 4.5 3.5 5.5c1.3 1 3.3 1.8 6 2.5s6 1 10 1c14 0 21 -3.7 21 -11\nc0 -2 -2 -10.3 -6 -25c-20 -79.3 -65 -146.7 -135 -202l-3 -3h399890z\nM100 620v40h399900v-40z M0 241v40h399900v-40zM0 241v40h399900v-40z",rightarrowabovebar:"M0 241v40h399891c-47.3 35.3-84 78-110 128-16.7 32\n-27.7 63.7-33 95 0 1.3-.2 2.7-.5 4-.3 1.3-.5 2.3-.5 3 0 7.3 6.7 11 20 11 8 0\n13.2-.8 15.5-2.5 2.3-1.7 4.2-5.5 5.5-11.5 2-13.3 5.7-27 11-41 14.7-44.7 39\n-84.5 73-119.5s73.7-60.2 119-75.5c6-2 9-5.7 9-11s-3-9-9-11c-45.3-15.3-85-40.5\n-119-75.5s-58.3-74.8-73-119.5c-4.7-14-8.3-27.3-11-40-1.3-6.7-3.2-10.8-5.5\n-12.5-2.3-1.7-7.5-2.5-15.5-2.5-14 0-21 3.7-21 11 0 2 2 10.3 6 25 20.7 83.3 67\n151.7 139 205zm96 379h399894v40H0zm0 0h399904v40H0z",baraboveshortleftharpoon:"M507,435c-4,4,-6.3,8.7,-7,14c0,5.3,0.7,9,2,11\nc1.3,2,5.3,5.3,12,10c90.7,54,156,130,196,228c3.3,10.7,6.3,16.3,9,17\nc2,0.7,5,1,9,1c0,0,5,0,5,0c10.7,0,16.7,-2,18,-6c2,-2.7,1,-9.7,-3,-21\nc-32,-87.3,-82.7,-157.7,-152,-211c0,0,-3,-3,-3,-3l399351,0l0,-40\nc-398570,0,-399437,0,-399437,0z M593 435 v40 H399500 v-40z\nM0 281 v-40 H399908 v40z M0 281 v-40 H399908 v40z",rightharpoonaboveshortbar:"M0,241 l0,40c399126,0,399993,0,399993,0\nc4.7,-4.7,7,-9.3,7,-14c0,-9.3,-3.7,-15.3,-11,-18c-92.7,-56.7,-159,-133.7,-199,\n-231c-3.3,-9.3,-6,-14.7,-8,-16c-2,-1.3,-7,-2,-15,-2c-10.7,0,-16.7,2,-18,6\nc-2,2.7,-1,9.7,3,21c15.3,42,36.7,81.8,64,119.5c27.3,37.7,58,69.2,92,94.5z\nM0 241 v40 H399908 v-40z M0 475 v-40 H399500 v40z M0 475 v-40 H399500 v40z",shortbaraboveleftharpoon:"M7,435c-4,4,-6.3,8.7,-7,14c0,5.3,0.7,9,2,11\nc1.3,2,5.3,5.3,12,10c90.7,54,156,130,196,228c3.3,10.7,6.3,16.3,9,17c2,0.7,5,1,9,\n1c0,0,5,0,5,0c10.7,0,16.7,-2,18,-6c2,-2.7,1,-9.7,-3,-21c-32,-87.3,-82.7,-157.7,\n-152,-211c0,0,-3,-3,-3,-3l399907,0l0,-40c-399126,0,-399993,0,-399993,0z\nM93 435 v40 H400000 v-40z M500 241 v40 H400000 v-40z M500 241 v40 H400000 v-40z",shortrightharpoonabovebar:"M53,241l0,40c398570,0,399437,0,399437,0\nc4.7,-4.7,7,-9.3,7,-14c0,-9.3,-3.7,-15.3,-11,-18c-92.7,-56.7,-159,-133.7,-199,\n-231c-3.3,-9.3,-6,-14.7,-8,-16c-2,-1.3,-7,-2,-15,-2c-10.7,0,-16.7,2,-18,6\nc-2,2.7,-1,9.7,3,21c15.3,42,36.7,81.8,64,119.5c27.3,37.7,58,69.2,92,94.5z\nM500 241 v40 H399408 v-40z M500 435 v40 H400000 v-40z"};class fE{constructor(e){this.children=void 0,this.classes=void 0,this.height=void 0,this.depth=void 0,this.maxFontSize=void 0,this.style=void 0,this.children=e,this.classes=[],this.height=0,this.depth=0,this.maxFontSize=0,this.style={}}hasClass(e){return this.classes.includes(e)}toNode(){for(var e=document.createDocumentFragment(),t=0;t<this.children.length;t++)e.appendChild(this.children[t].toNode());return e}toMarkup(){for(var e="",t=0;t<this.children.length;t++)e+=this.children[t].toMarkup();return e}toText(){return this.children.map(e=>{if("toText"in e)return e.toText();throw new Error("Expected MathDomNode with toText, got "+e.constructor.name)}).join("")}}var mE={pt:1,mm:7227/2540,cm:7227/254,in:72.27,bp:1.00375,pc:12,dd:1238/1157,cc:14856/1157,nd:685/642,nc:1370/107,sp:1/65536,px:1.00375},gE={ex:!0,em:!0,mu:!0},vE=function(e){return"string"!=typeof e&&(e=e.unit),e in mE||e in gE||"ex"===e},yE=function(e,t){var n;if(e.unit in mE)n=mE[e.unit]/t.fontMetrics().ptPerEm/t.sizeMultiplier;else if("mu"===e.unit)n=t.fontMetrics().cssEmPerMu;else{var r;if(r=t.style.isTight()?t.havingStyle(t.style.text()):t,"ex"===e.unit)n=r.fontMetrics().xHeight;else{if("em"!==e.unit)throw new VN("Invalid unit: '"+e.unit+"'");n=r.fontMetrics().quad}r!==t&&(n*=r.sizeMultiplier/t.sizeMultiplier)}return Math.min(e.number*n,t.maxSize)},wE=function(e){return+e.toFixed(4)+"em"},bE=function(e){return e.filter(e=>e).join(" ")},xE=function(e){var t="";for(var n of Object.keys(e)){var r=e[n];void 0!==r&&(t+=HN(n)+":"+r+";")}return t},kE=function(e,t,n){if(this.classes=e||[],this.attributes={},this.height=0,this.depth=0,this.maxFontSize=0,this.style=n||{},t){t.style.isTight()&&this.classes.push("mtight");var r=t.getColor();r&&(this.style.color=r)}},CE=function(e){var t=document.createElement(e);for(var n of(t.className=bE(this.classes),Object.assign(t.style,this.style),Object.keys(this.attributes)))t.setAttribute(n,this.attributes[n]);for(var r=0;r<this.children.length;r++)t.appendChild(this.children[r].toNode());return t},SE=/[\s"'>/=\x00-\x1f]/,ME=function(e){var t="<"+e;this.classes.length&&(t+=' class="'+WN(bE(this.classes))+'"');var n=xE(this.style);for(var r of(n&&(t+=' style="'+WN(n)+'"'),Object.keys(this.attributes))){if(SE.test(r))throw new VN("Invalid attribute name '"+r+"'");t+=" "+r+'="'+WN(this.attributes[r])+'"'}t+=">";for(var o=0;o<this.children.length;o++)t+=this.children[o].toMarkup();return t+="</"+e+">"};class NE{constructor(e,t,n,r){this.children=void 0,this.attributes=void 0,this.classes=void 0,this.height=void 0,this.depth=void 0,this.width=void 0,this.maxFontSize=void 0,this.style=void 0,this.italic=void 0,kE.call(this,e,n,r),this.children=t||[]}setAttribute(e,t){this.attributes[e]=t}hasClass(e){return this.classes.includes(e)}toNode(){return CE.call(this,"span")}toMarkup(){return ME.call(this,"span")}}class EE{constructor(e,t,n,r){this.children=void 0,this.attributes=void 0,this.classes=void 0,this.height=void 0,this.depth=void 0,this.maxFontSize=void 0,this.style=void 0,kE.call(this,t,r),this.children=n||[],this.setAttribute("href",e)}setAttribute(e,t){this.attributes[e]=t}hasClass(e){return this.classes.includes(e)}toNode(){return CE.call(this,"a")}toMarkup(){return ME.call(this,"a")}}class OE{constructor(e,t,n){this.src=void 0,this.alt=void 0,this.classes=void 0,this.height=void 0,this.depth=void 0,this.maxFontSize=void 0,this.style=void 0,this.alt=t,this.src=e,this.classes=["mord"],this.height=0,this.depth=0,this.maxFontSize=0,this.style=n}hasClass(e){return this.classes.includes(e)}toNode(){var e=document.createElement("img");return e.src=this.src,e.alt=this.alt,e.className="mord",Object.assign(e.style,this.style),e}toMarkup(){var e='<img src="'+WN(this.src)+'" alt="'+WN(this.alt)+'"',t=xE(this.style);return t&&(e+=' style="'+WN(t)+'"'),e+="'/>"}}var AE={"î":"ı̂","ï":"ı̈","í":"ı́","ì":"ı̀"};class TE{constructor(e,t,n,r,o,i,s,a){this.text=void 0,this.height=void 0,this.depth=void 0,this.italic=void 0,this.skew=void 0,this.width=void 0,this.maxFontSize=void 0,this.classes=void 0,this.style=void 0,this.text=e,this.height=t||0,this.depth=n||0,this.italic=r||0,this.skew=o||0,this.width=i||0,this.classes=s||[],this.style=a||{},this.maxFontSize=0;var l=function(e){for(var t=0;t<lE.length;t++)for(var n=lE[t],r=0;r<n.blocks.length;r++){var o=n.blocks[r];if(e>=o[0]&&e<=o[1])return n.name}return null}(this.text.charCodeAt(0));l&&this.classes.push(l+"_fallback"),/[îïíì]/.test(this.text)&&(this.text=AE[this.text])}hasClass(e){return this.classes.includes(e)}toNode(){var e=document.createTextNode(this.text),t=null;return this.italic>0&&((t=document.createElement("span")).style.marginRight=wE(this.italic)),this.classes.length>0&&((t=t||document.createElement("span")).className=bE(this.classes)),Object.keys(this.style).length>0&&(t=t||document.createElement("span"),Object.assign(t.style,this.style)),t?(t.appendChild(e),t):e}toMarkup(){var e=!1,t="<span";this.classes.length&&(e=!0,t+=' class="',t+=WN(bE(this.classes)),t+='"');var n="";this.italic>0&&(n+="margin-right:"+wE(this.italic)+";"),(n+=xE(this.style))&&(e=!0,t+=' style="'+WN(n)+'"');var r=WN(this.text);return e?(t+=">",t+=r,t+="</span>"):r}}class DE{constructor(e,t){this.children=void 0,this.attributes=void 0,this.children=e||[],this.attributes=t||{}}toNode(){var e=document.createElementNS("http://www.w3.org/2000/svg","svg");for(var t of Object.keys(this.attributes))e.setAttribute(t,this.attributes[t]);for(var n=0;n<this.children.length;n++)e.appendChild(this.children[n].toNode());return e}toMarkup(){var e='<svg xmlns="http://www.w3.org/2000/svg"';for(var t of Object.keys(this.attributes))e+=" "+t+'="'+WN(this.attributes[t])+'"';e+=">";for(var n=0;n<this.children.length;n++)e+=this.children[n].toMarkup();return e+="</svg>"}}class IE{constructor(e,t){this.pathName=void 0,this.alternate=void 0,this.pathName=e,this.alternate=t}toNode(){var e=document.createElementNS("http://www.w3.org/2000/svg","path");return this.alternate?e.setAttribute("d",this.alternate):e.setAttribute("d",pE[this.pathName]),e}toMarkup(){return this.alternate?'<path d="'+WN(this.alternate)+'"/>':'<path d="'+WN(pE[this.pathName])+'"/>'}}class _E{constructor(e){this.attributes=void 0,this.attributes=e||{}}toNode(){var e=document.createElementNS("http://www.w3.org/2000/svg","line");for(var t of Object.keys(this.attributes))e.setAttribute(t,this.attributes[t]);return e}toMarkup(){var e="<line";for(var t of Object.keys(this.attributes))e+=" "+t+'="'+WN(this.attributes[t])+'"';return e+="/>"}}var RE={"AMS-Regular":{32:[0,0,0,0,.25],65:[0,.68889,0,0,.72222],66:[0,.68889,0,0,.66667],67:[0,.68889,0,0,.72222],68:[0,.68889,0,0,.72222],69:[0,.68889,0,0,.66667],70:[0,.68889,0,0,.61111],71:[0,.68889,0,0,.77778],72:[0,.68889,0,0,.77778],73:[0,.68889,0,0,.38889],74:[.16667,.68889,0,0,.5],75:[0,.68889,0,0,.77778],76:[0,.68889,0,0,.66667],77:[0,.68889,0,0,.94445],78:[0,.68889,0,0,.72222],79:[.16667,.68889,0,0,.77778],80:[0,.68889,0,0,.61111],81:[.16667,.68889,0,0,.77778],82:[0,.68889,0,0,.72222],83:[0,.68889,0,0,.55556],84:[0,.68889,0,0,.66667],85:[0,.68889,0,0,.72222],86:[0,.68889,0,0,.72222],87:[0,.68889,0,0,1],88:[0,.68889,0,0,.72222],89:[0,.68889,0,0,.72222],90:[0,.68889,0,0,.66667],107:[0,.68889,0,0,.55556],160:[0,0,0,0,.25],165:[0,.675,.025,0,.75],174:[.15559,.69224,0,0,.94666],240:[0,.68889,0,0,.55556],295:[0,.68889,0,0,.54028],710:[0,.825,0,0,2.33334],732:[0,.9,0,0,2.33334],770:[0,.825,0,0,2.33334],771:[0,.9,0,0,2.33334],989:[.08167,.58167,0,0,.77778],1008:[0,.43056,.04028,0,.66667],8245:[0,.54986,0,0,.275],8463:[0,.68889,0,0,.54028],8487:[0,.68889,0,0,.72222],8498:[0,.68889,0,0,.55556],8502:[0,.68889,0,0,.66667],8503:[0,.68889,0,0,.44445],8504:[0,.68889,0,0,.66667],8513:[0,.68889,0,0,.63889],8592:[-.03598,.46402,0,0,.5],8594:[-.03598,.46402,0,0,.5],8602:[-.13313,.36687,0,0,1],8603:[-.13313,.36687,0,0,1],8606:[.01354,.52239,0,0,1],8608:[.01354,.52239,0,0,1],8610:[.01354,.52239,0,0,1.11111],8611:[.01354,.52239,0,0,1.11111],8619:[0,.54986,0,0,1],8620:[0,.54986,0,0,1],8621:[-.13313,.37788,0,0,1.38889],8622:[-.13313,.36687,0,0,1],8624:[0,.69224,0,0,.5],8625:[0,.69224,0,0,.5],8630:[0,.43056,0,0,1],8631:[0,.43056,0,0,1],8634:[.08198,.58198,0,0,.77778],8635:[.08198,.58198,0,0,.77778],8638:[.19444,.69224,0,0,.41667],8639:[.19444,.69224,0,0,.41667],8642:[.19444,.69224,0,0,.41667],8643:[.19444,.69224,0,0,.41667],8644:[.1808,.675,0,0,1],8646:[.1808,.675,0,0,1],8647:[.1808,.675,0,0,1],8648:[.19444,.69224,0,0,.83334],8649:[.1808,.675,0,0,1],8650:[.19444,.69224,0,0,.83334],8651:[.01354,.52239,0,0,1],8652:[.01354,.52239,0,0,1],8653:[-.13313,.36687,0,0,1],8654:[-.13313,.36687,0,0,1],8655:[-.13313,.36687,0,0,1],8666:[.13667,.63667,0,0,1],8667:[.13667,.63667,0,0,1],8669:[-.13313,.37788,0,0,1],8672:[-.064,.437,0,0,1.334],8674:[-.064,.437,0,0,1.334],8705:[0,.825,0,0,.5],8708:[0,.68889,0,0,.55556],8709:[.08167,.58167,0,0,.77778],8717:[0,.43056,0,0,.42917],8722:[-.03598,.46402,0,0,.5],8724:[.08198,.69224,0,0,.77778],8726:[.08167,.58167,0,0,.77778],8733:[0,.69224,0,0,.77778],8736:[0,.69224,0,0,.72222],8737:[0,.69224,0,0,.72222],8738:[.03517,.52239,0,0,.72222],8739:[.08167,.58167,0,0,.22222],8740:[.25142,.74111,0,0,.27778],8741:[.08167,.58167,0,0,.38889],8742:[.25142,.74111,0,0,.5],8756:[0,.69224,0,0,.66667],8757:[0,.69224,0,0,.66667],8764:[-.13313,.36687,0,0,.77778],8765:[-.13313,.37788,0,0,.77778],8769:[-.13313,.36687,0,0,.77778],8770:[-.03625,.46375,0,0,.77778],8774:[.30274,.79383,0,0,.77778],8776:[-.01688,.48312,0,0,.77778],8778:[.08167,.58167,0,0,.77778],8782:[.06062,.54986,0,0,.77778],8783:[.06062,.54986,0,0,.77778],8785:[.08198,.58198,0,0,.77778],8786:[.08198,.58198,0,0,.77778],8787:[.08198,.58198,0,0,.77778],8790:[0,.69224,0,0,.77778],8791:[.22958,.72958,0,0,.77778],8796:[.08198,.91667,0,0,.77778],8806:[.25583,.75583,0,0,.77778],8807:[.25583,.75583,0,0,.77778],8808:[.25142,.75726,0,0,.77778],8809:[.25142,.75726,0,0,.77778],8812:[.25583,.75583,0,0,.5],8814:[.20576,.70576,0,0,.77778],8815:[.20576,.70576,0,0,.77778],8816:[.30274,.79383,0,0,.77778],8817:[.30274,.79383,0,0,.77778],8818:[.22958,.72958,0,0,.77778],8819:[.22958,.72958,0,0,.77778],8822:[.1808,.675,0,0,.77778],8823:[.1808,.675,0,0,.77778],8828:[.13667,.63667,0,0,.77778],8829:[.13667,.63667,0,0,.77778],8830:[.22958,.72958,0,0,.77778],8831:[.22958,.72958,0,0,.77778],8832:[.20576,.70576,0,0,.77778],8833:[.20576,.70576,0,0,.77778],8840:[.30274,.79383,0,0,.77778],8841:[.30274,.79383,0,0,.77778],8842:[.13597,.63597,0,0,.77778],8843:[.13597,.63597,0,0,.77778],8847:[.03517,.54986,0,0,.77778],8848:[.03517,.54986,0,0,.77778],8858:[.08198,.58198,0,0,.77778],8859:[.08198,.58198,0,0,.77778],8861:[.08198,.58198,0,0,.77778],8862:[0,.675,0,0,.77778],8863:[0,.675,0,0,.77778],8864:[0,.675,0,0,.77778],8865:[0,.675,0,0,.77778],8872:[0,.69224,0,0,.61111],8873:[0,.69224,0,0,.72222],8874:[0,.69224,0,0,.88889],8876:[0,.68889,0,0,.61111],8877:[0,.68889,0,0,.61111],8878:[0,.68889,0,0,.72222],8879:[0,.68889,0,0,.72222],8882:[.03517,.54986,0,0,.77778],8883:[.03517,.54986,0,0,.77778],8884:[.13667,.63667,0,0,.77778],8885:[.13667,.63667,0,0,.77778],8888:[0,.54986,0,0,1.11111],8890:[.19444,.43056,0,0,.55556],8891:[.19444,.69224,0,0,.61111],8892:[.19444,.69224,0,0,.61111],8901:[0,.54986,0,0,.27778],8903:[.08167,.58167,0,0,.77778],8905:[.08167,.58167,0,0,.77778],8906:[.08167,.58167,0,0,.77778],8907:[0,.69224,0,0,.77778],8908:[0,.69224,0,0,.77778],8909:[-.03598,.46402,0,0,.77778],8910:[0,.54986,0,0,.76042],8911:[0,.54986,0,0,.76042],8912:[.03517,.54986,0,0,.77778],8913:[.03517,.54986,0,0,.77778],8914:[0,.54986,0,0,.66667],8915:[0,.54986,0,0,.66667],8916:[0,.69224,0,0,.66667],8918:[.0391,.5391,0,0,.77778],8919:[.0391,.5391,0,0,.77778],8920:[.03517,.54986,0,0,1.33334],8921:[.03517,.54986,0,0,1.33334],8922:[.38569,.88569,0,0,.77778],8923:[.38569,.88569,0,0,.77778],8926:[.13667,.63667,0,0,.77778],8927:[.13667,.63667,0,0,.77778],8928:[.30274,.79383,0,0,.77778],8929:[.30274,.79383,0,0,.77778],8934:[.23222,.74111,0,0,.77778],8935:[.23222,.74111,0,0,.77778],8936:[.23222,.74111,0,0,.77778],8937:[.23222,.74111,0,0,.77778],8938:[.20576,.70576,0,0,.77778],8939:[.20576,.70576,0,0,.77778],8940:[.30274,.79383,0,0,.77778],8941:[.30274,.79383,0,0,.77778],8994:[.19444,.69224,0,0,.77778],8995:[.19444,.69224,0,0,.77778],9416:[.15559,.69224,0,0,.90222],9484:[0,.69224,0,0,.5],9488:[0,.69224,0,0,.5],9492:[0,.37788,0,0,.5],9496:[0,.37788,0,0,.5],9585:[.19444,.68889,0,0,.88889],9586:[.19444,.74111,0,0,.88889],9632:[0,.675,0,0,.77778],9633:[0,.675,0,0,.77778],9650:[0,.54986,0,0,.72222],9651:[0,.54986,0,0,.72222],9654:[.03517,.54986,0,0,.77778],9660:[0,.54986,0,0,.72222],9661:[0,.54986,0,0,.72222],9664:[.03517,.54986,0,0,.77778],9674:[.11111,.69224,0,0,.66667],9733:[.19444,.69224,0,0,.94445],10003:[0,.69224,0,0,.83334],10016:[0,.69224,0,0,.83334],10731:[.11111,.69224,0,0,.66667],10846:[.19444,.75583,0,0,.61111],10877:[.13667,.63667,0,0,.77778],10878:[.13667,.63667,0,0,.77778],10885:[.25583,.75583,0,0,.77778],10886:[.25583,.75583,0,0,.77778],10887:[.13597,.63597,0,0,.77778],10888:[.13597,.63597,0,0,.77778],10889:[.26167,.75726,0,0,.77778],10890:[.26167,.75726,0,0,.77778],10891:[.48256,.98256,0,0,.77778],10892:[.48256,.98256,0,0,.77778],10901:[.13667,.63667,0,0,.77778],10902:[.13667,.63667,0,0,.77778],10933:[.25142,.75726,0,0,.77778],10934:[.25142,.75726,0,0,.77778],10935:[.26167,.75726,0,0,.77778],10936:[.26167,.75726,0,0,.77778],10937:[.26167,.75726,0,0,.77778],10938:[.26167,.75726,0,0,.77778],10949:[.25583,.75583,0,0,.77778],10950:[.25583,.75583,0,0,.77778],10955:[.28481,.79383,0,0,.77778],10956:[.28481,.79383,0,0,.77778],57350:[.08167,.58167,0,0,.22222],57351:[.08167,.58167,0,0,.38889],57352:[.08167,.58167,0,0,.77778],57353:[0,.43056,.04028,0,.66667],57356:[.25142,.75726,0,0,.77778],57357:[.25142,.75726,0,0,.77778],57358:[.41951,.91951,0,0,.77778],57359:[.30274,.79383,0,0,.77778],57360:[.30274,.79383,0,0,.77778],57361:[.41951,.91951,0,0,.77778],57366:[.25142,.75726,0,0,.77778],57367:[.25142,.75726,0,0,.77778],57368:[.25142,.75726,0,0,.77778],57369:[.25142,.75726,0,0,.77778],57370:[.13597,.63597,0,0,.77778],57371:[.13597,.63597,0,0,.77778]},"Caligraphic-Regular":{32:[0,0,0,0,.25],65:[0,.68333,0,.19445,.79847],66:[0,.68333,.03041,.13889,.65681],67:[0,.68333,.05834,.13889,.52653],68:[0,.68333,.02778,.08334,.77139],69:[0,.68333,.08944,.11111,.52778],70:[0,.68333,.09931,.11111,.71875],71:[.09722,.68333,.0593,.11111,.59487],72:[0,.68333,.00965,.11111,.84452],73:[0,.68333,.07382,0,.54452],74:[.09722,.68333,.18472,.16667,.67778],75:[0,.68333,.01445,.05556,.76195],76:[0,.68333,0,.13889,.68972],77:[0,.68333,0,.13889,1.2009],78:[0,.68333,.14736,.08334,.82049],79:[0,.68333,.02778,.11111,.79611],80:[0,.68333,.08222,.08334,.69556],81:[.09722,.68333,0,.11111,.81667],82:[0,.68333,0,.08334,.8475],83:[0,.68333,.075,.13889,.60556],84:[0,.68333,.25417,0,.54464],85:[0,.68333,.09931,.08334,.62583],86:[0,.68333,.08222,0,.61278],87:[0,.68333,.08222,.08334,.98778],88:[0,.68333,.14643,.13889,.7133],89:[.09722,.68333,.08222,.08334,.66834],90:[0,.68333,.07944,.13889,.72473],160:[0,0,0,0,.25]},"Fraktur-Regular":{32:[0,0,0,0,.25],33:[0,.69141,0,0,.29574],34:[0,.69141,0,0,.21471],38:[0,.69141,0,0,.73786],39:[0,.69141,0,0,.21201],40:[.24982,.74947,0,0,.38865],41:[.24982,.74947,0,0,.38865],42:[0,.62119,0,0,.27764],43:[.08319,.58283,0,0,.75623],44:[0,.10803,0,0,.27764],45:[.08319,.58283,0,0,.75623],46:[0,.10803,0,0,.27764],47:[.24982,.74947,0,0,.50181],48:[0,.47534,0,0,.50181],49:[0,.47534,0,0,.50181],50:[0,.47534,0,0,.50181],51:[.18906,.47534,0,0,.50181],52:[.18906,.47534,0,0,.50181],53:[.18906,.47534,0,0,.50181],54:[0,.69141,0,0,.50181],55:[.18906,.47534,0,0,.50181],56:[0,.69141,0,0,.50181],57:[.18906,.47534,0,0,.50181],58:[0,.47534,0,0,.21606],59:[.12604,.47534,0,0,.21606],61:[-.13099,.36866,0,0,.75623],63:[0,.69141,0,0,.36245],65:[0,.69141,0,0,.7176],66:[0,.69141,0,0,.88397],67:[0,.69141,0,0,.61254],68:[0,.69141,0,0,.83158],69:[0,.69141,0,0,.66278],70:[.12604,.69141,0,0,.61119],71:[0,.69141,0,0,.78539],72:[.06302,.69141,0,0,.7203],73:[0,.69141,0,0,.55448],74:[.12604,.69141,0,0,.55231],75:[0,.69141,0,0,.66845],76:[0,.69141,0,0,.66602],77:[0,.69141,0,0,1.04953],78:[0,.69141,0,0,.83212],79:[0,.69141,0,0,.82699],80:[.18906,.69141,0,0,.82753],81:[.03781,.69141,0,0,.82699],82:[0,.69141,0,0,.82807],83:[0,.69141,0,0,.82861],84:[0,.69141,0,0,.66899],85:[0,.69141,0,0,.64576],86:[0,.69141,0,0,.83131],87:[0,.69141,0,0,1.04602],88:[0,.69141,0,0,.71922],89:[.18906,.69141,0,0,.83293],90:[.12604,.69141,0,0,.60201],91:[.24982,.74947,0,0,.27764],93:[.24982,.74947,0,0,.27764],94:[0,.69141,0,0,.49965],97:[0,.47534,0,0,.50046],98:[0,.69141,0,0,.51315],99:[0,.47534,0,0,.38946],100:[0,.62119,0,0,.49857],101:[0,.47534,0,0,.40053],102:[.18906,.69141,0,0,.32626],103:[.18906,.47534,0,0,.5037],104:[.18906,.69141,0,0,.52126],105:[0,.69141,0,0,.27899],106:[0,.69141,0,0,.28088],107:[0,.69141,0,0,.38946],108:[0,.69141,0,0,.27953],109:[0,.47534,0,0,.76676],110:[0,.47534,0,0,.52666],111:[0,.47534,0,0,.48885],112:[.18906,.52396,0,0,.50046],113:[.18906,.47534,0,0,.48912],114:[0,.47534,0,0,.38919],115:[0,.47534,0,0,.44266],116:[0,.62119,0,0,.33301],117:[0,.47534,0,0,.5172],118:[0,.52396,0,0,.5118],119:[0,.52396,0,0,.77351],120:[.18906,.47534,0,0,.38865],121:[.18906,.47534,0,0,.49884],122:[.18906,.47534,0,0,.39054],160:[0,0,0,0,.25],8216:[0,.69141,0,0,.21471],8217:[0,.69141,0,0,.21471],58112:[0,.62119,0,0,.49749],58113:[0,.62119,0,0,.4983],58114:[.18906,.69141,0,0,.33328],58115:[.18906,.69141,0,0,.32923],58116:[.18906,.47534,0,0,.50343],58117:[0,.69141,0,0,.33301],58118:[0,.62119,0,0,.33409],58119:[0,.47534,0,0,.50073]},"Main-Bold":{32:[0,0,0,0,.25],33:[0,.69444,0,0,.35],34:[0,.69444,0,0,.60278],35:[.19444,.69444,0,0,.95833],36:[.05556,.75,0,0,.575],37:[.05556,.75,0,0,.95833],38:[0,.69444,0,0,.89444],39:[0,.69444,0,0,.31944],40:[.25,.75,0,0,.44722],41:[.25,.75,0,0,.44722],42:[0,.75,0,0,.575],43:[.13333,.63333,0,0,.89444],44:[.19444,.15556,0,0,.31944],45:[0,.44444,0,0,.38333],46:[0,.15556,0,0,.31944],47:[.25,.75,0,0,.575],48:[0,.64444,0,0,.575],49:[0,.64444,0,0,.575],50:[0,.64444,0,0,.575],51:[0,.64444,0,0,.575],52:[0,.64444,0,0,.575],53:[0,.64444,0,0,.575],54:[0,.64444,0,0,.575],55:[0,.64444,0,0,.575],56:[0,.64444,0,0,.575],57:[0,.64444,0,0,.575],58:[0,.44444,0,0,.31944],59:[.19444,.44444,0,0,.31944],60:[.08556,.58556,0,0,.89444],61:[-.10889,.39111,0,0,.89444],62:[.08556,.58556,0,0,.89444],63:[0,.69444,0,0,.54305],64:[0,.69444,0,0,.89444],65:[0,.68611,0,0,.86944],66:[0,.68611,0,0,.81805],67:[0,.68611,0,0,.83055],68:[0,.68611,0,0,.88194],69:[0,.68611,0,0,.75555],70:[0,.68611,0,0,.72361],71:[0,.68611,0,0,.90416],72:[0,.68611,0,0,.9],73:[0,.68611,0,0,.43611],74:[0,.68611,0,0,.59444],75:[0,.68611,0,0,.90138],76:[0,.68611,0,0,.69166],77:[0,.68611,0,0,1.09166],78:[0,.68611,0,0,.9],79:[0,.68611,0,0,.86388],80:[0,.68611,0,0,.78611],81:[.19444,.68611,0,0,.86388],82:[0,.68611,0,0,.8625],83:[0,.68611,0,0,.63889],84:[0,.68611,0,0,.8],85:[0,.68611,0,0,.88472],86:[0,.68611,.01597,0,.86944],87:[0,.68611,.01597,0,1.18888],88:[0,.68611,0,0,.86944],89:[0,.68611,.02875,0,.86944],90:[0,.68611,0,0,.70277],91:[.25,.75,0,0,.31944],92:[.25,.75,0,0,.575],93:[.25,.75,0,0,.31944],94:[0,.69444,0,0,.575],95:[.31,.13444,.03194,0,.575],97:[0,.44444,0,0,.55902],98:[0,.69444,0,0,.63889],99:[0,.44444,0,0,.51111],100:[0,.69444,0,0,.63889],101:[0,.44444,0,0,.52708],102:[0,.69444,.10903,0,.35139],103:[.19444,.44444,.01597,0,.575],104:[0,.69444,0,0,.63889],105:[0,.69444,0,0,.31944],106:[.19444,.69444,0,0,.35139],107:[0,.69444,0,0,.60694],108:[0,.69444,0,0,.31944],109:[0,.44444,0,0,.95833],110:[0,.44444,0,0,.63889],111:[0,.44444,0,0,.575],112:[.19444,.44444,0,0,.63889],113:[.19444,.44444,0,0,.60694],114:[0,.44444,0,0,.47361],115:[0,.44444,0,0,.45361],116:[0,.63492,0,0,.44722],117:[0,.44444,0,0,.63889],118:[0,.44444,.01597,0,.60694],119:[0,.44444,.01597,0,.83055],120:[0,.44444,0,0,.60694],121:[.19444,.44444,.01597,0,.60694],122:[0,.44444,0,0,.51111],123:[.25,.75,0,0,.575],124:[.25,.75,0,0,.31944],125:[.25,.75,0,0,.575],126:[.35,.34444,0,0,.575],160:[0,0,0,0,.25],163:[0,.69444,0,0,.86853],168:[0,.69444,0,0,.575],172:[0,.44444,0,0,.76666],176:[0,.69444,0,0,.86944],177:[.13333,.63333,0,0,.89444],184:[.17014,0,0,0,.51111],198:[0,.68611,0,0,1.04166],215:[.13333,.63333,0,0,.89444],216:[.04861,.73472,0,0,.89444],223:[0,.69444,0,0,.59722],230:[0,.44444,0,0,.83055],247:[.13333,.63333,0,0,.89444],248:[.09722,.54167,0,0,.575],305:[0,.44444,0,0,.31944],338:[0,.68611,0,0,1.16944],339:[0,.44444,0,0,.89444],567:[.19444,.44444,0,0,.35139],710:[0,.69444,0,0,.575],711:[0,.63194,0,0,.575],713:[0,.59611,0,0,.575],714:[0,.69444,0,0,.575],715:[0,.69444,0,0,.575],728:[0,.69444,0,0,.575],729:[0,.69444,0,0,.31944],730:[0,.69444,0,0,.86944],732:[0,.69444,0,0,.575],733:[0,.69444,0,0,.575],915:[0,.68611,0,0,.69166],916:[0,.68611,0,0,.95833],920:[0,.68611,0,0,.89444],923:[0,.68611,0,0,.80555],926:[0,.68611,0,0,.76666],928:[0,.68611,0,0,.9],931:[0,.68611,0,0,.83055],933:[0,.68611,0,0,.89444],934:[0,.68611,0,0,.83055],936:[0,.68611,0,0,.89444],937:[0,.68611,0,0,.83055],8211:[0,.44444,.03194,0,.575],8212:[0,.44444,.03194,0,1.14999],8216:[0,.69444,0,0,.31944],8217:[0,.69444,0,0,.31944],8220:[0,.69444,0,0,.60278],8221:[0,.69444,0,0,.60278],8224:[.19444,.69444,0,0,.51111],8225:[.19444,.69444,0,0,.51111],8242:[0,.55556,0,0,.34444],8407:[0,.72444,.15486,0,.575],8463:[0,.69444,0,0,.66759],8465:[0,.69444,0,0,.83055],8467:[0,.69444,0,0,.47361],8472:[.19444,.44444,0,0,.74027],8476:[0,.69444,0,0,.83055],8501:[0,.69444,0,0,.70277],8592:[-.10889,.39111,0,0,1.14999],8593:[.19444,.69444,0,0,.575],8594:[-.10889,.39111,0,0,1.14999],8595:[.19444,.69444,0,0,.575],8596:[-.10889,.39111,0,0,1.14999],8597:[.25,.75,0,0,.575],8598:[.19444,.69444,0,0,1.14999],8599:[.19444,.69444,0,0,1.14999],8600:[.19444,.69444,0,0,1.14999],8601:[.19444,.69444,0,0,1.14999],8636:[-.10889,.39111,0,0,1.14999],8637:[-.10889,.39111,0,0,1.14999],8640:[-.10889,.39111,0,0,1.14999],8641:[-.10889,.39111,0,0,1.14999],8656:[-.10889,.39111,0,0,1.14999],8657:[.19444,.69444,0,0,.70277],8658:[-.10889,.39111,0,0,1.14999],8659:[.19444,.69444,0,0,.70277],8660:[-.10889,.39111,0,0,1.14999],8661:[.25,.75,0,0,.70277],8704:[0,.69444,0,0,.63889],8706:[0,.69444,.06389,0,.62847],8707:[0,.69444,0,0,.63889],8709:[.05556,.75,0,0,.575],8711:[0,.68611,0,0,.95833],8712:[.08556,.58556,0,0,.76666],8715:[.08556,.58556,0,0,.76666],8722:[.13333,.63333,0,0,.89444],8723:[.13333,.63333,0,0,.89444],8725:[.25,.75,0,0,.575],8726:[.25,.75,0,0,.575],8727:[-.02778,.47222,0,0,.575],8728:[-.02639,.47361,0,0,.575],8729:[-.02639,.47361,0,0,.575],8730:[.18,.82,0,0,.95833],8733:[0,.44444,0,0,.89444],8734:[0,.44444,0,0,1.14999],8736:[0,.69224,0,0,.72222],8739:[.25,.75,0,0,.31944],8741:[.25,.75,0,0,.575],8743:[0,.55556,0,0,.76666],8744:[0,.55556,0,0,.76666],8745:[0,.55556,0,0,.76666],8746:[0,.55556,0,0,.76666],8747:[.19444,.69444,.12778,0,.56875],8764:[-.10889,.39111,0,0,.89444],8768:[.19444,.69444,0,0,.31944],8771:[.00222,.50222,0,0,.89444],8773:[.027,.638,0,0,.894],8776:[.02444,.52444,0,0,.89444],8781:[.00222,.50222,0,0,.89444],8801:[.00222,.50222,0,0,.89444],8804:[.19667,.69667,0,0,.89444],8805:[.19667,.69667,0,0,.89444],8810:[.08556,.58556,0,0,1.14999],8811:[.08556,.58556,0,0,1.14999],8826:[.08556,.58556,0,0,.89444],8827:[.08556,.58556,0,0,.89444],8834:[.08556,.58556,0,0,.89444],8835:[.08556,.58556,0,0,.89444],8838:[.19667,.69667,0,0,.89444],8839:[.19667,.69667,0,0,.89444],8846:[0,.55556,0,0,.76666],8849:[.19667,.69667,0,0,.89444],8850:[.19667,.69667,0,0,.89444],8851:[0,.55556,0,0,.76666],8852:[0,.55556,0,0,.76666],8853:[.13333,.63333,0,0,.89444],8854:[.13333,.63333,0,0,.89444],8855:[.13333,.63333,0,0,.89444],8856:[.13333,.63333,0,0,.89444],8857:[.13333,.63333,0,0,.89444],8866:[0,.69444,0,0,.70277],8867:[0,.69444,0,0,.70277],8868:[0,.69444,0,0,.89444],8869:[0,.69444,0,0,.89444],8900:[-.02639,.47361,0,0,.575],8901:[-.02639,.47361,0,0,.31944],8902:[-.02778,.47222,0,0,.575],8968:[.25,.75,0,0,.51111],8969:[.25,.75,0,0,.51111],8970:[.25,.75,0,0,.51111],8971:[.25,.75,0,0,.51111],8994:[-.13889,.36111,0,0,1.14999],8995:[-.13889,.36111,0,0,1.14999],9651:[.19444,.69444,0,0,1.02222],9657:[-.02778,.47222,0,0,.575],9661:[.19444,.69444,0,0,1.02222],9667:[-.02778,.47222,0,0,.575],9711:[.19444,.69444,0,0,1.14999],9824:[.12963,.69444,0,0,.89444],9825:[.12963,.69444,0,0,.89444],9826:[.12963,.69444,0,0,.89444],9827:[.12963,.69444,0,0,.89444],9837:[0,.75,0,0,.44722],9838:[.19444,.69444,0,0,.44722],9839:[.19444,.69444,0,0,.44722],10216:[.25,.75,0,0,.44722],10217:[.25,.75,0,0,.44722],10815:[0,.68611,0,0,.9],10927:[.19667,.69667,0,0,.89444],10928:[.19667,.69667,0,0,.89444],57376:[.19444,.69444,0,0,0]},"Main-BoldItalic":{32:[0,0,0,0,.25],33:[0,.69444,.11417,0,.38611],34:[0,.69444,.07939,0,.62055],35:[.19444,.69444,.06833,0,.94444],37:[.05556,.75,.12861,0,.94444],38:[0,.69444,.08528,0,.88555],39:[0,.69444,.12945,0,.35555],40:[.25,.75,.15806,0,.47333],41:[.25,.75,.03306,0,.47333],42:[0,.75,.14333,0,.59111],43:[.10333,.60333,.03306,0,.88555],44:[.19444,.14722,0,0,.35555],45:[0,.44444,.02611,0,.41444],46:[0,.14722,0,0,.35555],47:[.25,.75,.15806,0,.59111],48:[0,.64444,.13167,0,.59111],49:[0,.64444,.13167,0,.59111],50:[0,.64444,.13167,0,.59111],51:[0,.64444,.13167,0,.59111],52:[.19444,.64444,.13167,0,.59111],53:[0,.64444,.13167,0,.59111],54:[0,.64444,.13167,0,.59111],55:[.19444,.64444,.13167,0,.59111],56:[0,.64444,.13167,0,.59111],57:[0,.64444,.13167,0,.59111],58:[0,.44444,.06695,0,.35555],59:[.19444,.44444,.06695,0,.35555],61:[-.10889,.39111,.06833,0,.88555],63:[0,.69444,.11472,0,.59111],64:[0,.69444,.09208,0,.88555],65:[0,.68611,0,0,.86555],66:[0,.68611,.0992,0,.81666],67:[0,.68611,.14208,0,.82666],68:[0,.68611,.09062,0,.87555],69:[0,.68611,.11431,0,.75666],70:[0,.68611,.12903,0,.72722],71:[0,.68611,.07347,0,.89527],72:[0,.68611,.17208,0,.8961],73:[0,.68611,.15681,0,.47166],74:[0,.68611,.145,0,.61055],75:[0,.68611,.14208,0,.89499],76:[0,.68611,0,0,.69777],77:[0,.68611,.17208,0,1.07277],78:[0,.68611,.17208,0,.8961],79:[0,.68611,.09062,0,.85499],80:[0,.68611,.0992,0,.78721],81:[.19444,.68611,.09062,0,.85499],82:[0,.68611,.02559,0,.85944],83:[0,.68611,.11264,0,.64999],84:[0,.68611,.12903,0,.7961],85:[0,.68611,.17208,0,.88083],86:[0,.68611,.18625,0,.86555],87:[0,.68611,.18625,0,1.15999],88:[0,.68611,.15681,0,.86555],89:[0,.68611,.19803,0,.86555],90:[0,.68611,.14208,0,.70888],91:[.25,.75,.1875,0,.35611],93:[.25,.75,.09972,0,.35611],94:[0,.69444,.06709,0,.59111],95:[.31,.13444,.09811,0,.59111],97:[0,.44444,.09426,0,.59111],98:[0,.69444,.07861,0,.53222],99:[0,.44444,.05222,0,.53222],100:[0,.69444,.10861,0,.59111],101:[0,.44444,.085,0,.53222],102:[.19444,.69444,.21778,0,.4],103:[.19444,.44444,.105,0,.53222],104:[0,.69444,.09426,0,.59111],105:[0,.69326,.11387,0,.35555],106:[.19444,.69326,.1672,0,.35555],107:[0,.69444,.11111,0,.53222],108:[0,.69444,.10861,0,.29666],109:[0,.44444,.09426,0,.94444],110:[0,.44444,.09426,0,.64999],111:[0,.44444,.07861,0,.59111],112:[.19444,.44444,.07861,0,.59111],113:[.19444,.44444,.105,0,.53222],114:[0,.44444,.11111,0,.50167],115:[0,.44444,.08167,0,.48694],116:[0,.63492,.09639,0,.385],117:[0,.44444,.09426,0,.62055],118:[0,.44444,.11111,0,.53222],119:[0,.44444,.11111,0,.76777],120:[0,.44444,.12583,0,.56055],121:[.19444,.44444,.105,0,.56166],122:[0,.44444,.13889,0,.49055],126:[.35,.34444,.11472,0,.59111],160:[0,0,0,0,.25],168:[0,.69444,.11473,0,.59111],176:[0,.69444,0,0,.94888],184:[.17014,0,0,0,.53222],198:[0,.68611,.11431,0,1.02277],216:[.04861,.73472,.09062,0,.88555],223:[.19444,.69444,.09736,0,.665],230:[0,.44444,.085,0,.82666],248:[.09722,.54167,.09458,0,.59111],305:[0,.44444,.09426,0,.35555],338:[0,.68611,.11431,0,1.14054],339:[0,.44444,.085,0,.82666],567:[.19444,.44444,.04611,0,.385],710:[0,.69444,.06709,0,.59111],711:[0,.63194,.08271,0,.59111],713:[0,.59444,.10444,0,.59111],714:[0,.69444,.08528,0,.59111],715:[0,.69444,0,0,.59111],728:[0,.69444,.10333,0,.59111],729:[0,.69444,.12945,0,.35555],730:[0,.69444,0,0,.94888],732:[0,.69444,.11472,0,.59111],733:[0,.69444,.11472,0,.59111],915:[0,.68611,.12903,0,.69777],916:[0,.68611,0,0,.94444],920:[0,.68611,.09062,0,.88555],923:[0,.68611,0,0,.80666],926:[0,.68611,.15092,0,.76777],928:[0,.68611,.17208,0,.8961],931:[0,.68611,.11431,0,.82666],933:[0,.68611,.10778,0,.88555],934:[0,.68611,.05632,0,.82666],936:[0,.68611,.10778,0,.88555],937:[0,.68611,.0992,0,.82666],8211:[0,.44444,.09811,0,.59111],8212:[0,.44444,.09811,0,1.18221],8216:[0,.69444,.12945,0,.35555],8217:[0,.69444,.12945,0,.35555],8220:[0,.69444,.16772,0,.62055],8221:[0,.69444,.07939,0,.62055]},"Main-Italic":{32:[0,0,0,0,.25],33:[0,.69444,.12417,0,.30667],34:[0,.69444,.06961,0,.51444],35:[.19444,.69444,.06616,0,.81777],37:[.05556,.75,.13639,0,.81777],38:[0,.69444,.09694,0,.76666],39:[0,.69444,.12417,0,.30667],40:[.25,.75,.16194,0,.40889],41:[.25,.75,.03694,0,.40889],42:[0,.75,.14917,0,.51111],43:[.05667,.56167,.03694,0,.76666],44:[.19444,.10556,0,0,.30667],45:[0,.43056,.02826,0,.35778],46:[0,.10556,0,0,.30667],47:[.25,.75,.16194,0,.51111],48:[0,.64444,.13556,0,.51111],49:[0,.64444,.13556,0,.51111],50:[0,.64444,.13556,0,.51111],51:[0,.64444,.13556,0,.51111],52:[.19444,.64444,.13556,0,.51111],53:[0,.64444,.13556,0,.51111],54:[0,.64444,.13556,0,.51111],55:[.19444,.64444,.13556,0,.51111],56:[0,.64444,.13556,0,.51111],57:[0,.64444,.13556,0,.51111],58:[0,.43056,.0582,0,.30667],59:[.19444,.43056,.0582,0,.30667],61:[-.13313,.36687,.06616,0,.76666],63:[0,.69444,.1225,0,.51111],64:[0,.69444,.09597,0,.76666],65:[0,.68333,0,0,.74333],66:[0,.68333,.10257,0,.70389],67:[0,.68333,.14528,0,.71555],68:[0,.68333,.09403,0,.755],69:[0,.68333,.12028,0,.67833],70:[0,.68333,.13305,0,.65277],71:[0,.68333,.08722,0,.77361],72:[0,.68333,.16389,0,.74333],73:[0,.68333,.15806,0,.38555],74:[0,.68333,.14028,0,.525],75:[0,.68333,.14528,0,.76888],76:[0,.68333,0,0,.62722],77:[0,.68333,.16389,0,.89666],78:[0,.68333,.16389,0,.74333],79:[0,.68333,.09403,0,.76666],80:[0,.68333,.10257,0,.67833],81:[.19444,.68333,.09403,0,.76666],82:[0,.68333,.03868,0,.72944],83:[0,.68333,.11972,0,.56222],84:[0,.68333,.13305,0,.71555],85:[0,.68333,.16389,0,.74333],86:[0,.68333,.18361,0,.74333],87:[0,.68333,.18361,0,.99888],88:[0,.68333,.15806,0,.74333],89:[0,.68333,.19383,0,.74333],90:[0,.68333,.14528,0,.61333],91:[.25,.75,.1875,0,.30667],93:[.25,.75,.10528,0,.30667],94:[0,.69444,.06646,0,.51111],95:[.31,.12056,.09208,0,.51111],97:[0,.43056,.07671,0,.51111],98:[0,.69444,.06312,0,.46],99:[0,.43056,.05653,0,.46],100:[0,.69444,.10333,0,.51111],101:[0,.43056,.07514,0,.46],102:[.19444,.69444,.21194,0,.30667],103:[.19444,.43056,.08847,0,.46],104:[0,.69444,.07671,0,.51111],105:[0,.65536,.1019,0,.30667],106:[.19444,.65536,.14467,0,.30667],107:[0,.69444,.10764,0,.46],108:[0,.69444,.10333,0,.25555],109:[0,.43056,.07671,0,.81777],110:[0,.43056,.07671,0,.56222],111:[0,.43056,.06312,0,.51111],112:[.19444,.43056,.06312,0,.51111],113:[.19444,.43056,.08847,0,.46],114:[0,.43056,.10764,0,.42166],115:[0,.43056,.08208,0,.40889],116:[0,.61508,.09486,0,.33222],117:[0,.43056,.07671,0,.53666],118:[0,.43056,.10764,0,.46],119:[0,.43056,.10764,0,.66444],120:[0,.43056,.12042,0,.46389],121:[.19444,.43056,.08847,0,.48555],122:[0,.43056,.12292,0,.40889],126:[.35,.31786,.11585,0,.51111],160:[0,0,0,0,.25],168:[0,.66786,.10474,0,.51111],176:[0,.69444,0,0,.83129],184:[.17014,0,0,0,.46],198:[0,.68333,.12028,0,.88277],216:[.04861,.73194,.09403,0,.76666],223:[.19444,.69444,.10514,0,.53666],230:[0,.43056,.07514,0,.71555],248:[.09722,.52778,.09194,0,.51111],338:[0,.68333,.12028,0,.98499],339:[0,.43056,.07514,0,.71555],710:[0,.69444,.06646,0,.51111],711:[0,.62847,.08295,0,.51111],713:[0,.56167,.10333,0,.51111],714:[0,.69444,.09694,0,.51111],715:[0,.69444,0,0,.51111],728:[0,.69444,.10806,0,.51111],729:[0,.66786,.11752,0,.30667],730:[0,.69444,0,0,.83129],732:[0,.66786,.11585,0,.51111],733:[0,.69444,.1225,0,.51111],915:[0,.68333,.13305,0,.62722],916:[0,.68333,0,0,.81777],920:[0,.68333,.09403,0,.76666],923:[0,.68333,0,0,.69222],926:[0,.68333,.15294,0,.66444],928:[0,.68333,.16389,0,.74333],931:[0,.68333,.12028,0,.71555],933:[0,.68333,.11111,0,.76666],934:[0,.68333,.05986,0,.71555],936:[0,.68333,.11111,0,.76666],937:[0,.68333,.10257,0,.71555],8211:[0,.43056,.09208,0,.51111],8212:[0,.43056,.09208,0,1.02222],8216:[0,.69444,.12417,0,.30667],8217:[0,.69444,.12417,0,.30667],8220:[0,.69444,.1685,0,.51444],8221:[0,.69444,.06961,0,.51444],8463:[0,.68889,0,0,.54028]},"Main-Regular":{32:[0,0,0,0,.25],33:[0,.69444,0,0,.27778],34:[0,.69444,0,0,.5],35:[.19444,.69444,0,0,.83334],36:[.05556,.75,0,0,.5],37:[.05556,.75,0,0,.83334],38:[0,.69444,0,0,.77778],39:[0,.69444,0,0,.27778],40:[.25,.75,0,0,.38889],41:[.25,.75,0,0,.38889],42:[0,.75,0,0,.5],43:[.08333,.58333,0,0,.77778],44:[.19444,.10556,0,0,.27778],45:[0,.43056,0,0,.33333],46:[0,.10556,0,0,.27778],47:[.25,.75,0,0,.5],48:[0,.64444,0,0,.5],49:[0,.64444,0,0,.5],50:[0,.64444,0,0,.5],51:[0,.64444,0,0,.5],52:[0,.64444,0,0,.5],53:[0,.64444,0,0,.5],54:[0,.64444,0,0,.5],55:[0,.64444,0,0,.5],56:[0,.64444,0,0,.5],57:[0,.64444,0,0,.5],58:[0,.43056,0,0,.27778],59:[.19444,.43056,0,0,.27778],60:[.0391,.5391,0,0,.77778],61:[-.13313,.36687,0,0,.77778],62:[.0391,.5391,0,0,.77778],63:[0,.69444,0,0,.47222],64:[0,.69444,0,0,.77778],65:[0,.68333,0,0,.75],66:[0,.68333,0,0,.70834],67:[0,.68333,0,0,.72222],68:[0,.68333,0,0,.76389],69:[0,.68333,0,0,.68056],70:[0,.68333,0,0,.65278],71:[0,.68333,0,0,.78472],72:[0,.68333,0,0,.75],73:[0,.68333,0,0,.36111],74:[0,.68333,0,0,.51389],75:[0,.68333,0,0,.77778],76:[0,.68333,0,0,.625],77:[0,.68333,0,0,.91667],78:[0,.68333,0,0,.75],79:[0,.68333,0,0,.77778],80:[0,.68333,0,0,.68056],81:[.19444,.68333,0,0,.77778],82:[0,.68333,0,0,.73611],83:[0,.68333,0,0,.55556],84:[0,.68333,0,0,.72222],85:[0,.68333,0,0,.75],86:[0,.68333,.01389,0,.75],87:[0,.68333,.01389,0,1.02778],88:[0,.68333,0,0,.75],89:[0,.68333,.025,0,.75],90:[0,.68333,0,0,.61111],91:[.25,.75,0,0,.27778],92:[.25,.75,0,0,.5],93:[.25,.75,0,0,.27778],94:[0,.69444,0,0,.5],95:[.31,.12056,.02778,0,.5],97:[0,.43056,0,0,.5],98:[0,.69444,0,0,.55556],99:[0,.43056,0,0,.44445],100:[0,.69444,0,0,.55556],101:[0,.43056,0,0,.44445],102:[0,.69444,.07778,0,.30556],103:[.19444,.43056,.01389,0,.5],104:[0,.69444,0,0,.55556],105:[0,.66786,0,0,.27778],106:[.19444,.66786,0,0,.30556],107:[0,.69444,0,0,.52778],108:[0,.69444,0,0,.27778],109:[0,.43056,0,0,.83334],110:[0,.43056,0,0,.55556],111:[0,.43056,0,0,.5],112:[.19444,.43056,0,0,.55556],113:[.19444,.43056,0,0,.52778],114:[0,.43056,0,0,.39167],115:[0,.43056,0,0,.39445],116:[0,.61508,0,0,.38889],117:[0,.43056,0,0,.55556],118:[0,.43056,.01389,0,.52778],119:[0,.43056,.01389,0,.72222],120:[0,.43056,0,0,.52778],121:[.19444,.43056,.01389,0,.52778],122:[0,.43056,0,0,.44445],123:[.25,.75,0,0,.5],124:[.25,.75,0,0,.27778],125:[.25,.75,0,0,.5],126:[.35,.31786,0,0,.5],160:[0,0,0,0,.25],163:[0,.69444,0,0,.76909],167:[.19444,.69444,0,0,.44445],168:[0,.66786,0,0,.5],172:[0,.43056,0,0,.66667],176:[0,.69444,0,0,.75],177:[.08333,.58333,0,0,.77778],182:[.19444,.69444,0,0,.61111],184:[.17014,0,0,0,.44445],198:[0,.68333,0,0,.90278],215:[.08333,.58333,0,0,.77778],216:[.04861,.73194,0,0,.77778],223:[0,.69444,0,0,.5],230:[0,.43056,0,0,.72222],247:[.08333,.58333,0,0,.77778],248:[.09722,.52778,0,0,.5],305:[0,.43056,0,0,.27778],338:[0,.68333,0,0,1.01389],339:[0,.43056,0,0,.77778],567:[.19444,.43056,0,0,.30556],710:[0,.69444,0,0,.5],711:[0,.62847,0,0,.5],713:[0,.56778,0,0,.5],714:[0,.69444,0,0,.5],715:[0,.69444,0,0,.5],728:[0,.69444,0,0,.5],729:[0,.66786,0,0,.27778],730:[0,.69444,0,0,.75],732:[0,.66786,0,0,.5],733:[0,.69444,0,0,.5],915:[0,.68333,0,0,.625],916:[0,.68333,0,0,.83334],920:[0,.68333,0,0,.77778],923:[0,.68333,0,0,.69445],926:[0,.68333,0,0,.66667],928:[0,.68333,0,0,.75],931:[0,.68333,0,0,.72222],933:[0,.68333,0,0,.77778],934:[0,.68333,0,0,.72222],936:[0,.68333,0,0,.77778],937:[0,.68333,0,0,.72222],8211:[0,.43056,.02778,0,.5],8212:[0,.43056,.02778,0,1],8216:[0,.69444,0,0,.27778],8217:[0,.69444,0,0,.27778],8220:[0,.69444,0,0,.5],8221:[0,.69444,0,0,.5],8224:[.19444,.69444,0,0,.44445],8225:[.19444,.69444,0,0,.44445],8230:[0,.123,0,0,1.172],8242:[0,.55556,0,0,.275],8407:[0,.71444,.15382,0,.5],8463:[0,.68889,0,0,.54028],8465:[0,.69444,0,0,.72222],8467:[0,.69444,0,.11111,.41667],8472:[.19444,.43056,0,.11111,.63646],8476:[0,.69444,0,0,.72222],8501:[0,.69444,0,0,.61111],8592:[-.13313,.36687,0,0,1],8593:[.19444,.69444,0,0,.5],8594:[-.13313,.36687,0,0,1],8595:[.19444,.69444,0,0,.5],8596:[-.13313,.36687,0,0,1],8597:[.25,.75,0,0,.5],8598:[.19444,.69444,0,0,1],8599:[.19444,.69444,0,0,1],8600:[.19444,.69444,0,0,1],8601:[.19444,.69444,0,0,1],8614:[.011,.511,0,0,1],8617:[.011,.511,0,0,1.126],8618:[.011,.511,0,0,1.126],8636:[-.13313,.36687,0,0,1],8637:[-.13313,.36687,0,0,1],8640:[-.13313,.36687,0,0,1],8641:[-.13313,.36687,0,0,1],8652:[.011,.671,0,0,1],8656:[-.13313,.36687,0,0,1],8657:[.19444,.69444,0,0,.61111],8658:[-.13313,.36687,0,0,1],8659:[.19444,.69444,0,0,.61111],8660:[-.13313,.36687,0,0,1],8661:[.25,.75,0,0,.61111],8704:[0,.69444,0,0,.55556],8706:[0,.69444,.05556,.08334,.5309],8707:[0,.69444,0,0,.55556],8709:[.05556,.75,0,0,.5],8711:[0,.68333,0,0,.83334],8712:[.0391,.5391,0,0,.66667],8715:[.0391,.5391,0,0,.66667],8722:[.08333,.58333,0,0,.77778],8723:[.08333,.58333,0,0,.77778],8725:[.25,.75,0,0,.5],8726:[.25,.75,0,0,.5],8727:[-.03472,.46528,0,0,.5],8728:[-.05555,.44445,0,0,.5],8729:[-.05555,.44445,0,0,.5],8730:[.2,.8,0,0,.83334],8733:[0,.43056,0,0,.77778],8734:[0,.43056,0,0,1],8736:[0,.69224,0,0,.72222],8739:[.25,.75,0,0,.27778],8741:[.25,.75,0,0,.5],8743:[0,.55556,0,0,.66667],8744:[0,.55556,0,0,.66667],8745:[0,.55556,0,0,.66667],8746:[0,.55556,0,0,.66667],8747:[.19444,.69444,.11111,0,.41667],8764:[-.13313,.36687,0,0,.77778],8768:[.19444,.69444,0,0,.27778],8771:[-.03625,.46375,0,0,.77778],8773:[-.022,.589,0,0,.778],8776:[-.01688,.48312,0,0,.77778],8781:[-.03625,.46375,0,0,.77778],8784:[-.133,.673,0,0,.778],8801:[-.03625,.46375,0,0,.77778],8804:[.13597,.63597,0,0,.77778],8805:[.13597,.63597,0,0,.77778],8810:[.0391,.5391,0,0,1],8811:[.0391,.5391,0,0,1],8826:[.0391,.5391,0,0,.77778],8827:[.0391,.5391,0,0,.77778],8834:[.0391,.5391,0,0,.77778],8835:[.0391,.5391,0,0,.77778],8838:[.13597,.63597,0,0,.77778],8839:[.13597,.63597,0,0,.77778],8846:[0,.55556,0,0,.66667],8849:[.13597,.63597,0,0,.77778],8850:[.13597,.63597,0,0,.77778],8851:[0,.55556,0,0,.66667],8852:[0,.55556,0,0,.66667],8853:[.08333,.58333,0,0,.77778],8854:[.08333,.58333,0,0,.77778],8855:[.08333,.58333,0,0,.77778],8856:[.08333,.58333,0,0,.77778],8857:[.08333,.58333,0,0,.77778],8866:[0,.69444,0,0,.61111],8867:[0,.69444,0,0,.61111],8868:[0,.69444,0,0,.77778],8869:[0,.69444,0,0,.77778],8872:[.249,.75,0,0,.867],8900:[-.05555,.44445,0,0,.5],8901:[-.05555,.44445,0,0,.27778],8902:[-.03472,.46528,0,0,.5],8904:[.005,.505,0,0,.9],8942:[.03,.903,0,0,.278],8943:[-.19,.313,0,0,1.172],8945:[-.1,.823,0,0,1.282],8968:[.25,.75,0,0,.44445],8969:[.25,.75,0,0,.44445],8970:[.25,.75,0,0,.44445],8971:[.25,.75,0,0,.44445],8994:[-.14236,.35764,0,0,1],8995:[-.14236,.35764,0,0,1],9136:[.244,.744,0,0,.412],9137:[.244,.745,0,0,.412],9651:[.19444,.69444,0,0,.88889],9657:[-.03472,.46528,0,0,.5],9661:[.19444,.69444,0,0,.88889],9667:[-.03472,.46528,0,0,.5],9711:[.19444,.69444,0,0,1],9824:[.12963,.69444,0,0,.77778],9825:[.12963,.69444,0,0,.77778],9826:[.12963,.69444,0,0,.77778],9827:[.12963,.69444,0,0,.77778],9837:[0,.75,0,0,.38889],9838:[.19444,.69444,0,0,.38889],9839:[.19444,.69444,0,0,.38889],10216:[.25,.75,0,0,.38889],10217:[.25,.75,0,0,.38889],10222:[.244,.744,0,0,.412],10223:[.244,.745,0,0,.412],10229:[.011,.511,0,0,1.609],10230:[.011,.511,0,0,1.638],10231:[.011,.511,0,0,1.859],10232:[.024,.525,0,0,1.609],10233:[.024,.525,0,0,1.638],10234:[.024,.525,0,0,1.858],10236:[.011,.511,0,0,1.638],10815:[0,.68333,0,0,.75],10927:[.13597,.63597,0,0,.77778],10928:[.13597,.63597,0,0,.77778],57376:[.19444,.69444,0,0,0]},"Math-BoldItalic":{32:[0,0,0,0,.25],48:[0,.44444,0,0,.575],49:[0,.44444,0,0,.575],50:[0,.44444,0,0,.575],51:[.19444,.44444,0,0,.575],52:[.19444,.44444,0,0,.575],53:[.19444,.44444,0,0,.575],54:[0,.64444,0,0,.575],55:[.19444,.44444,0,0,.575],56:[0,.64444,0,0,.575],57:[.19444,.44444,0,0,.575],65:[0,.68611,0,0,.86944],66:[0,.68611,.04835,0,.8664],67:[0,.68611,.06979,0,.81694],68:[0,.68611,.03194,0,.93812],69:[0,.68611,.05451,0,.81007],70:[0,.68611,.15972,0,.68889],71:[0,.68611,0,0,.88673],72:[0,.68611,.08229,0,.98229],73:[0,.68611,.07778,0,.51111],74:[0,.68611,.10069,0,.63125],75:[0,.68611,.06979,0,.97118],76:[0,.68611,0,0,.75555],77:[0,.68611,.11424,0,1.14201],78:[0,.68611,.11424,0,.95034],79:[0,.68611,.03194,0,.83666],80:[0,.68611,.15972,0,.72309],81:[.19444,.68611,0,0,.86861],82:[0,.68611,.00421,0,.87235],83:[0,.68611,.05382,0,.69271],84:[0,.68611,.15972,0,.63663],85:[0,.68611,.11424,0,.80027],86:[0,.68611,.25555,0,.67778],87:[0,.68611,.15972,0,1.09305],88:[0,.68611,.07778,0,.94722],89:[0,.68611,.25555,0,.67458],90:[0,.68611,.06979,0,.77257],97:[0,.44444,0,0,.63287],98:[0,.69444,0,0,.52083],99:[0,.44444,0,0,.51342],100:[0,.69444,0,0,.60972],101:[0,.44444,0,0,.55361],102:[.19444,.69444,.11042,0,.56806],103:[.19444,.44444,.03704,0,.5449],104:[0,.69444,0,0,.66759],105:[0,.69326,0,0,.4048],106:[.19444,.69326,.0622,0,.47083],107:[0,.69444,.01852,0,.6037],108:[0,.69444,.0088,0,.34815],109:[0,.44444,0,0,1.0324],110:[0,.44444,0,0,.71296],111:[0,.44444,0,0,.58472],112:[.19444,.44444,0,0,.60092],113:[.19444,.44444,.03704,0,.54213],114:[0,.44444,.03194,0,.5287],115:[0,.44444,0,0,.53125],116:[0,.63492,0,0,.41528],117:[0,.44444,0,0,.68102],118:[0,.44444,.03704,0,.56666],119:[0,.44444,.02778,0,.83148],120:[0,.44444,0,0,.65903],121:[.19444,.44444,.03704,0,.59028],122:[0,.44444,.04213,0,.55509],160:[0,0,0,0,.25],915:[0,.68611,.15972,0,.65694],916:[0,.68611,0,0,.95833],920:[0,.68611,.03194,0,.86722],923:[0,.68611,0,0,.80555],926:[0,.68611,.07458,0,.84125],928:[0,.68611,.08229,0,.98229],931:[0,.68611,.05451,0,.88507],933:[0,.68611,.15972,0,.67083],934:[0,.68611,0,0,.76666],936:[0,.68611,.11653,0,.71402],937:[0,.68611,.04835,0,.8789],945:[0,.44444,0,0,.76064],946:[.19444,.69444,.03403,0,.65972],947:[.19444,.44444,.06389,0,.59003],948:[0,.69444,.03819,0,.52222],949:[0,.44444,0,0,.52882],950:[.19444,.69444,.06215,0,.50833],951:[.19444,.44444,.03704,0,.6],952:[0,.69444,.03194,0,.5618],953:[0,.44444,0,0,.41204],954:[0,.44444,0,0,.66759],955:[0,.69444,0,0,.67083],956:[.19444,.44444,0,0,.70787],957:[0,.44444,.06898,0,.57685],958:[.19444,.69444,.03021,0,.50833],959:[0,.44444,0,0,.58472],960:[0,.44444,.03704,0,.68241],961:[.19444,.44444,0,0,.6118],962:[.09722,.44444,.07917,0,.42361],963:[0,.44444,.03704,0,.68588],964:[0,.44444,.13472,0,.52083],965:[0,.44444,.03704,0,.63055],966:[.19444,.44444,0,0,.74722],967:[.19444,.44444,0,0,.71805],968:[.19444,.69444,.03704,0,.75833],969:[0,.44444,.03704,0,.71782],977:[0,.69444,0,0,.69155],981:[.19444,.69444,0,0,.7125],982:[0,.44444,.03194,0,.975],1009:[.19444,.44444,0,0,.6118],1013:[0,.44444,0,0,.48333],57649:[0,.44444,0,0,.39352],57911:[.19444,.44444,0,0,.43889]},"Math-Italic":{32:[0,0,0,0,.25],48:[0,.43056,0,0,.5],49:[0,.43056,0,0,.5],50:[0,.43056,0,0,.5],51:[.19444,.43056,0,0,.5],52:[.19444,.43056,0,0,.5],53:[.19444,.43056,0,0,.5],54:[0,.64444,0,0,.5],55:[.19444,.43056,0,0,.5],56:[0,.64444,0,0,.5],57:[.19444,.43056,0,0,.5],65:[0,.68333,0,.13889,.75],66:[0,.68333,.05017,.08334,.75851],67:[0,.68333,.07153,.08334,.71472],68:[0,.68333,.02778,.05556,.82792],69:[0,.68333,.05764,.08334,.7382],70:[0,.68333,.13889,.08334,.64306],71:[0,.68333,0,.08334,.78625],72:[0,.68333,.08125,.05556,.83125],73:[0,.68333,.07847,.11111,.43958],74:[0,.68333,.09618,.16667,.55451],75:[0,.68333,.07153,.05556,.84931],76:[0,.68333,0,.02778,.68056],77:[0,.68333,.10903,.08334,.97014],78:[0,.68333,.10903,.08334,.80347],79:[0,.68333,.02778,.08334,.76278],80:[0,.68333,.13889,.08334,.64201],81:[.19444,.68333,0,.08334,.79056],82:[0,.68333,.00773,.08334,.75929],83:[0,.68333,.05764,.08334,.6132],84:[0,.68333,.13889,.08334,.58438],85:[0,.68333,.10903,.02778,.68278],86:[0,.68333,.22222,0,.58333],87:[0,.68333,.13889,0,.94445],88:[0,.68333,.07847,.08334,.82847],89:[0,.68333,.22222,0,.58056],90:[0,.68333,.07153,.08334,.68264],97:[0,.43056,0,0,.52859],98:[0,.69444,0,0,.42917],99:[0,.43056,0,.05556,.43276],100:[0,.69444,0,.16667,.52049],101:[0,.43056,0,.05556,.46563],102:[.19444,.69444,.10764,.16667,.48959],103:[.19444,.43056,.03588,.02778,.47697],104:[0,.69444,0,0,.57616],105:[0,.65952,0,0,.34451],106:[.19444,.65952,.05724,0,.41181],107:[0,.69444,.03148,0,.5206],108:[0,.69444,.01968,.08334,.29838],109:[0,.43056,0,0,.87801],110:[0,.43056,0,0,.60023],111:[0,.43056,0,.05556,.48472],112:[.19444,.43056,0,.08334,.50313],113:[.19444,.43056,.03588,.08334,.44641],114:[0,.43056,.02778,.05556,.45116],115:[0,.43056,0,.05556,.46875],116:[0,.61508,0,.08334,.36111],117:[0,.43056,0,.02778,.57246],118:[0,.43056,.03588,.02778,.48472],119:[0,.43056,.02691,.08334,.71592],120:[0,.43056,0,.02778,.57153],121:[.19444,.43056,.03588,.05556,.49028],122:[0,.43056,.04398,.05556,.46505],160:[0,0,0,0,.25],915:[0,.68333,.13889,.08334,.61528],916:[0,.68333,0,.16667,.83334],920:[0,.68333,.02778,.08334,.76278],923:[0,.68333,0,.16667,.69445],926:[0,.68333,.07569,.08334,.74236],928:[0,.68333,.08125,.05556,.83125],931:[0,.68333,.05764,.08334,.77986],933:[0,.68333,.13889,.05556,.58333],934:[0,.68333,0,.08334,.66667],936:[0,.68333,.11,.05556,.61222],937:[0,.68333,.05017,.08334,.7724],945:[0,.43056,.0037,.02778,.6397],946:[.19444,.69444,.05278,.08334,.56563],947:[.19444,.43056,.05556,0,.51773],948:[0,.69444,.03785,.05556,.44444],949:[0,.43056,0,.08334,.46632],950:[.19444,.69444,.07378,.08334,.4375],951:[.19444,.43056,.03588,.05556,.49653],952:[0,.69444,.02778,.08334,.46944],953:[0,.43056,0,.05556,.35394],954:[0,.43056,0,0,.57616],955:[0,.69444,0,0,.58334],956:[.19444,.43056,0,.02778,.60255],957:[0,.43056,.06366,.02778,.49398],958:[.19444,.69444,.04601,.11111,.4375],959:[0,.43056,0,.05556,.48472],960:[0,.43056,.03588,0,.57003],961:[.19444,.43056,0,.08334,.51702],962:[.09722,.43056,.07986,.08334,.36285],963:[0,.43056,.03588,0,.57141],964:[0,.43056,.1132,.02778,.43715],965:[0,.43056,.03588,.02778,.54028],966:[.19444,.43056,0,.08334,.65417],967:[.19444,.43056,0,.05556,.62569],968:[.19444,.69444,.03588,.11111,.65139],969:[0,.43056,.03588,0,.62245],977:[0,.69444,0,.08334,.59144],981:[.19444,.69444,0,.08334,.59583],982:[0,.43056,.02778,0,.82813],1009:[.19444,.43056,0,.08334,.51702],1013:[0,.43056,0,.05556,.4059],57649:[0,.43056,0,.02778,.32246],57911:[.19444,.43056,0,.08334,.38403]},"SansSerif-Bold":{32:[0,0,0,0,.25],33:[0,.69444,0,0,.36667],34:[0,.69444,0,0,.55834],35:[.19444,.69444,0,0,.91667],36:[.05556,.75,0,0,.55],37:[.05556,.75,0,0,1.02912],38:[0,.69444,0,0,.83056],39:[0,.69444,0,0,.30556],40:[.25,.75,0,0,.42778],41:[.25,.75,0,0,.42778],42:[0,.75,0,0,.55],43:[.11667,.61667,0,0,.85556],44:[.10556,.13056,0,0,.30556],45:[0,.45833,0,0,.36667],46:[0,.13056,0,0,.30556],47:[.25,.75,0,0,.55],48:[0,.69444,0,0,.55],49:[0,.69444,0,0,.55],50:[0,.69444,0,0,.55],51:[0,.69444,0,0,.55],52:[0,.69444,0,0,.55],53:[0,.69444,0,0,.55],54:[0,.69444,0,0,.55],55:[0,.69444,0,0,.55],56:[0,.69444,0,0,.55],57:[0,.69444,0,0,.55],58:[0,.45833,0,0,.30556],59:[.10556,.45833,0,0,.30556],61:[-.09375,.40625,0,0,.85556],63:[0,.69444,0,0,.51945],64:[0,.69444,0,0,.73334],65:[0,.69444,0,0,.73334],66:[0,.69444,0,0,.73334],67:[0,.69444,0,0,.70278],68:[0,.69444,0,0,.79445],69:[0,.69444,0,0,.64167],70:[0,.69444,0,0,.61111],71:[0,.69444,0,0,.73334],72:[0,.69444,0,0,.79445],73:[0,.69444,0,0,.33056],74:[0,.69444,0,0,.51945],75:[0,.69444,0,0,.76389],76:[0,.69444,0,0,.58056],77:[0,.69444,0,0,.97778],78:[0,.69444,0,0,.79445],79:[0,.69444,0,0,.79445],80:[0,.69444,0,0,.70278],81:[.10556,.69444,0,0,.79445],82:[0,.69444,0,0,.70278],83:[0,.69444,0,0,.61111],84:[0,.69444,0,0,.73334],85:[0,.69444,0,0,.76389],86:[0,.69444,.01528,0,.73334],87:[0,.69444,.01528,0,1.03889],88:[0,.69444,0,0,.73334],89:[0,.69444,.0275,0,.73334],90:[0,.69444,0,0,.67223],91:[.25,.75,0,0,.34306],93:[.25,.75,0,0,.34306],94:[0,.69444,0,0,.55],95:[.35,.10833,.03056,0,.55],97:[0,.45833,0,0,.525],98:[0,.69444,0,0,.56111],99:[0,.45833,0,0,.48889],100:[0,.69444,0,0,.56111],101:[0,.45833,0,0,.51111],102:[0,.69444,.07639,0,.33611],103:[.19444,.45833,.01528,0,.55],104:[0,.69444,0,0,.56111],105:[0,.69444,0,0,.25556],106:[.19444,.69444,0,0,.28611],107:[0,.69444,0,0,.53056],108:[0,.69444,0,0,.25556],109:[0,.45833,0,0,.86667],110:[0,.45833,0,0,.56111],111:[0,.45833,0,0,.55],112:[.19444,.45833,0,0,.56111],113:[.19444,.45833,0,0,.56111],114:[0,.45833,.01528,0,.37222],115:[0,.45833,0,0,.42167],116:[0,.58929,0,0,.40417],117:[0,.45833,0,0,.56111],118:[0,.45833,.01528,0,.5],119:[0,.45833,.01528,0,.74445],120:[0,.45833,0,0,.5],121:[.19444,.45833,.01528,0,.5],122:[0,.45833,0,0,.47639],126:[.35,.34444,0,0,.55],160:[0,0,0,0,.25],168:[0,.69444,0,0,.55],176:[0,.69444,0,0,.73334],180:[0,.69444,0,0,.55],184:[.17014,0,0,0,.48889],305:[0,.45833,0,0,.25556],567:[.19444,.45833,0,0,.28611],710:[0,.69444,0,0,.55],711:[0,.63542,0,0,.55],713:[0,.63778,0,0,.55],728:[0,.69444,0,0,.55],729:[0,.69444,0,0,.30556],730:[0,.69444,0,0,.73334],732:[0,.69444,0,0,.55],733:[0,.69444,0,0,.55],915:[0,.69444,0,0,.58056],916:[0,.69444,0,0,.91667],920:[0,.69444,0,0,.85556],923:[0,.69444,0,0,.67223],926:[0,.69444,0,0,.73334],928:[0,.69444,0,0,.79445],931:[0,.69444,0,0,.79445],933:[0,.69444,0,0,.85556],934:[0,.69444,0,0,.79445],936:[0,.69444,0,0,.85556],937:[0,.69444,0,0,.79445],8211:[0,.45833,.03056,0,.55],8212:[0,.45833,.03056,0,1.10001],8216:[0,.69444,0,0,.30556],8217:[0,.69444,0,0,.30556],8220:[0,.69444,0,0,.55834],8221:[0,.69444,0,0,.55834]},"SansSerif-Italic":{32:[0,0,0,0,.25],33:[0,.69444,.05733,0,.31945],34:[0,.69444,.00316,0,.5],35:[.19444,.69444,.05087,0,.83334],36:[.05556,.75,.11156,0,.5],37:[.05556,.75,.03126,0,.83334],38:[0,.69444,.03058,0,.75834],39:[0,.69444,.07816,0,.27778],40:[.25,.75,.13164,0,.38889],41:[.25,.75,.02536,0,.38889],42:[0,.75,.11775,0,.5],43:[.08333,.58333,.02536,0,.77778],44:[.125,.08333,0,0,.27778],45:[0,.44444,.01946,0,.33333],46:[0,.08333,0,0,.27778],47:[.25,.75,.13164,0,.5],48:[0,.65556,.11156,0,.5],49:[0,.65556,.11156,0,.5],50:[0,.65556,.11156,0,.5],51:[0,.65556,.11156,0,.5],52:[0,.65556,.11156,0,.5],53:[0,.65556,.11156,0,.5],54:[0,.65556,.11156,0,.5],55:[0,.65556,.11156,0,.5],56:[0,.65556,.11156,0,.5],57:[0,.65556,.11156,0,.5],58:[0,.44444,.02502,0,.27778],59:[.125,.44444,.02502,0,.27778],61:[-.13,.37,.05087,0,.77778],63:[0,.69444,.11809,0,.47222],64:[0,.69444,.07555,0,.66667],65:[0,.69444,0,0,.66667],66:[0,.69444,.08293,0,.66667],67:[0,.69444,.11983,0,.63889],68:[0,.69444,.07555,0,.72223],69:[0,.69444,.11983,0,.59722],70:[0,.69444,.13372,0,.56945],71:[0,.69444,.11983,0,.66667],72:[0,.69444,.08094,0,.70834],73:[0,.69444,.13372,0,.27778],74:[0,.69444,.08094,0,.47222],75:[0,.69444,.11983,0,.69445],76:[0,.69444,0,0,.54167],77:[0,.69444,.08094,0,.875],78:[0,.69444,.08094,0,.70834],79:[0,.69444,.07555,0,.73611],80:[0,.69444,.08293,0,.63889],81:[.125,.69444,.07555,0,.73611],82:[0,.69444,.08293,0,.64584],83:[0,.69444,.09205,0,.55556],84:[0,.69444,.13372,0,.68056],85:[0,.69444,.08094,0,.6875],86:[0,.69444,.1615,0,.66667],87:[0,.69444,.1615,0,.94445],88:[0,.69444,.13372,0,.66667],89:[0,.69444,.17261,0,.66667],90:[0,.69444,.11983,0,.61111],91:[.25,.75,.15942,0,.28889],93:[.25,.75,.08719,0,.28889],94:[0,.69444,.0799,0,.5],95:[.35,.09444,.08616,0,.5],97:[0,.44444,.00981,0,.48056],98:[0,.69444,.03057,0,.51667],99:[0,.44444,.08336,0,.44445],100:[0,.69444,.09483,0,.51667],101:[0,.44444,.06778,0,.44445],102:[0,.69444,.21705,0,.30556],103:[.19444,.44444,.10836,0,.5],104:[0,.69444,.01778,0,.51667],105:[0,.67937,.09718,0,.23889],106:[.19444,.67937,.09162,0,.26667],107:[0,.69444,.08336,0,.48889],108:[0,.69444,.09483,0,.23889],109:[0,.44444,.01778,0,.79445],110:[0,.44444,.01778,0,.51667],111:[0,.44444,.06613,0,.5],112:[.19444,.44444,.0389,0,.51667],113:[.19444,.44444,.04169,0,.51667],114:[0,.44444,.10836,0,.34167],115:[0,.44444,.0778,0,.38333],116:[0,.57143,.07225,0,.36111],117:[0,.44444,.04169,0,.51667],118:[0,.44444,.10836,0,.46111],119:[0,.44444,.10836,0,.68334],120:[0,.44444,.09169,0,.46111],121:[.19444,.44444,.10836,0,.46111],122:[0,.44444,.08752,0,.43472],126:[.35,.32659,.08826,0,.5],160:[0,0,0,0,.25],168:[0,.67937,.06385,0,.5],176:[0,.69444,0,0,.73752],184:[.17014,0,0,0,.44445],305:[0,.44444,.04169,0,.23889],567:[.19444,.44444,.04169,0,.26667],710:[0,.69444,.0799,0,.5],711:[0,.63194,.08432,0,.5],713:[0,.60889,.08776,0,.5],714:[0,.69444,.09205,0,.5],715:[0,.69444,0,0,.5],728:[0,.69444,.09483,0,.5],729:[0,.67937,.07774,0,.27778],730:[0,.69444,0,0,.73752],732:[0,.67659,.08826,0,.5],733:[0,.69444,.09205,0,.5],915:[0,.69444,.13372,0,.54167],916:[0,.69444,0,0,.83334],920:[0,.69444,.07555,0,.77778],923:[0,.69444,0,0,.61111],926:[0,.69444,.12816,0,.66667],928:[0,.69444,.08094,0,.70834],931:[0,.69444,.11983,0,.72222],933:[0,.69444,.09031,0,.77778],934:[0,.69444,.04603,0,.72222],936:[0,.69444,.09031,0,.77778],937:[0,.69444,.08293,0,.72222],8211:[0,.44444,.08616,0,.5],8212:[0,.44444,.08616,0,1],8216:[0,.69444,.07816,0,.27778],8217:[0,.69444,.07816,0,.27778],8220:[0,.69444,.14205,0,.5],8221:[0,.69444,.00316,0,.5]},"SansSerif-Regular":{32:[0,0,0,0,.25],33:[0,.69444,0,0,.31945],34:[0,.69444,0,0,.5],35:[.19444,.69444,0,0,.83334],36:[.05556,.75,0,0,.5],37:[.05556,.75,0,0,.83334],38:[0,.69444,0,0,.75834],39:[0,.69444,0,0,.27778],40:[.25,.75,0,0,.38889],41:[.25,.75,0,0,.38889],42:[0,.75,0,0,.5],43:[.08333,.58333,0,0,.77778],44:[.125,.08333,0,0,.27778],45:[0,.44444,0,0,.33333],46:[0,.08333,0,0,.27778],47:[.25,.75,0,0,.5],48:[0,.65556,0,0,.5],49:[0,.65556,0,0,.5],50:[0,.65556,0,0,.5],51:[0,.65556,0,0,.5],52:[0,.65556,0,0,.5],53:[0,.65556,0,0,.5],54:[0,.65556,0,0,.5],55:[0,.65556,0,0,.5],56:[0,.65556,0,0,.5],57:[0,.65556,0,0,.5],58:[0,.44444,0,0,.27778],59:[.125,.44444,0,0,.27778],61:[-.13,.37,0,0,.77778],63:[0,.69444,0,0,.47222],64:[0,.69444,0,0,.66667],65:[0,.69444,0,0,.66667],66:[0,.69444,0,0,.66667],67:[0,.69444,0,0,.63889],68:[0,.69444,0,0,.72223],69:[0,.69444,0,0,.59722],70:[0,.69444,0,0,.56945],71:[0,.69444,0,0,.66667],72:[0,.69444,0,0,.70834],73:[0,.69444,0,0,.27778],74:[0,.69444,0,0,.47222],75:[0,.69444,0,0,.69445],76:[0,.69444,0,0,.54167],77:[0,.69444,0,0,.875],78:[0,.69444,0,0,.70834],79:[0,.69444,0,0,.73611],80:[0,.69444,0,0,.63889],81:[.125,.69444,0,0,.73611],82:[0,.69444,0,0,.64584],83:[0,.69444,0,0,.55556],84:[0,.69444,0,0,.68056],85:[0,.69444,0,0,.6875],86:[0,.69444,.01389,0,.66667],87:[0,.69444,.01389,0,.94445],88:[0,.69444,0,0,.66667],89:[0,.69444,.025,0,.66667],90:[0,.69444,0,0,.61111],91:[.25,.75,0,0,.28889],93:[.25,.75,0,0,.28889],94:[0,.69444,0,0,.5],95:[.35,.09444,.02778,0,.5],97:[0,.44444,0,0,.48056],98:[0,.69444,0,0,.51667],99:[0,.44444,0,0,.44445],100:[0,.69444,0,0,.51667],101:[0,.44444,0,0,.44445],102:[0,.69444,.06944,0,.30556],103:[.19444,.44444,.01389,0,.5],104:[0,.69444,0,0,.51667],105:[0,.67937,0,0,.23889],106:[.19444,.67937,0,0,.26667],107:[0,.69444,0,0,.48889],108:[0,.69444,0,0,.23889],109:[0,.44444,0,0,.79445],110:[0,.44444,0,0,.51667],111:[0,.44444,0,0,.5],112:[.19444,.44444,0,0,.51667],113:[.19444,.44444,0,0,.51667],114:[0,.44444,.01389,0,.34167],115:[0,.44444,0,0,.38333],116:[0,.57143,0,0,.36111],117:[0,.44444,0,0,.51667],118:[0,.44444,.01389,0,.46111],119:[0,.44444,.01389,0,.68334],120:[0,.44444,0,0,.46111],121:[.19444,.44444,.01389,0,.46111],122:[0,.44444,0,0,.43472],126:[.35,.32659,0,0,.5],160:[0,0,0,0,.25],168:[0,.67937,0,0,.5],176:[0,.69444,0,0,.66667],184:[.17014,0,0,0,.44445],305:[0,.44444,0,0,.23889],567:[.19444,.44444,0,0,.26667],710:[0,.69444,0,0,.5],711:[0,.63194,0,0,.5],713:[0,.60889,0,0,.5],714:[0,.69444,0,0,.5],715:[0,.69444,0,0,.5],728:[0,.69444,0,0,.5],729:[0,.67937,0,0,.27778],730:[0,.69444,0,0,.66667],732:[0,.67659,0,0,.5],733:[0,.69444,0,0,.5],915:[0,.69444,0,0,.54167],916:[0,.69444,0,0,.83334],920:[0,.69444,0,0,.77778],923:[0,.69444,0,0,.61111],926:[0,.69444,0,0,.66667],928:[0,.69444,0,0,.70834],931:[0,.69444,0,0,.72222],933:[0,.69444,0,0,.77778],934:[0,.69444,0,0,.72222],936:[0,.69444,0,0,.77778],937:[0,.69444,0,0,.72222],8211:[0,.44444,.02778,0,.5],8212:[0,.44444,.02778,0,1],8216:[0,.69444,0,0,.27778],8217:[0,.69444,0,0,.27778],8220:[0,.69444,0,0,.5],8221:[0,.69444,0,0,.5]},"Script-Regular":{32:[0,0,0,0,.25],65:[0,.7,.22925,0,.80253],66:[0,.7,.04087,0,.90757],67:[0,.7,.1689,0,.66619],68:[0,.7,.09371,0,.77443],69:[0,.7,.18583,0,.56162],70:[0,.7,.13634,0,.89544],71:[0,.7,.17322,0,.60961],72:[0,.7,.29694,0,.96919],73:[0,.7,.19189,0,.80907],74:[.27778,.7,.19189,0,1.05159],75:[0,.7,.31259,0,.91364],76:[0,.7,.19189,0,.87373],77:[0,.7,.15981,0,1.08031],78:[0,.7,.3525,0,.9015],79:[0,.7,.08078,0,.73787],80:[0,.7,.08078,0,1.01262],81:[0,.7,.03305,0,.88282],82:[0,.7,.06259,0,.85],83:[0,.7,.19189,0,.86767],84:[0,.7,.29087,0,.74697],85:[0,.7,.25815,0,.79996],86:[0,.7,.27523,0,.62204],87:[0,.7,.27523,0,.80532],88:[0,.7,.26006,0,.94445],89:[0,.7,.2939,0,.70961],90:[0,.7,.24037,0,.8212],160:[0,0,0,0,.25]},"Size1-Regular":{32:[0,0,0,0,.25],40:[.35001,.85,0,0,.45834],41:[.35001,.85,0,0,.45834],47:[.35001,.85,0,0,.57778],91:[.35001,.85,0,0,.41667],92:[.35001,.85,0,0,.57778],93:[.35001,.85,0,0,.41667],123:[.35001,.85,0,0,.58334],125:[.35001,.85,0,0,.58334],160:[0,0,0,0,.25],710:[0,.72222,0,0,.55556],732:[0,.72222,0,0,.55556],770:[0,.72222,0,0,.55556],771:[0,.72222,0,0,.55556],8214:[-99e-5,.601,0,0,.77778],8593:[1e-5,.6,0,0,.66667],8595:[1e-5,.6,0,0,.66667],8657:[1e-5,.6,0,0,.77778],8659:[1e-5,.6,0,0,.77778],8719:[.25001,.75,0,0,.94445],8720:[.25001,.75,0,0,.94445],8721:[.25001,.75,0,0,1.05556],8730:[.35001,.85,0,0,1],8739:[-.00599,.606,0,0,.33333],8741:[-.00599,.606,0,0,.55556],8747:[.30612,.805,.19445,0,.47222],8748:[.306,.805,.19445,0,.47222],8749:[.306,.805,.19445,0,.47222],8750:[.30612,.805,.19445,0,.47222],8896:[.25001,.75,0,0,.83334],8897:[.25001,.75,0,0,.83334],8898:[.25001,.75,0,0,.83334],8899:[.25001,.75,0,0,.83334],8968:[.35001,.85,0,0,.47222],8969:[.35001,.85,0,0,.47222],8970:[.35001,.85,0,0,.47222],8971:[.35001,.85,0,0,.47222],9168:[-99e-5,.601,0,0,.66667],10216:[.35001,.85,0,0,.47222],10217:[.35001,.85,0,0,.47222],10752:[.25001,.75,0,0,1.11111],10753:[.25001,.75,0,0,1.11111],10754:[.25001,.75,0,0,1.11111],10756:[.25001,.75,0,0,.83334],10758:[.25001,.75,0,0,.83334]},"Size2-Regular":{32:[0,0,0,0,.25],40:[.65002,1.15,0,0,.59722],41:[.65002,1.15,0,0,.59722],47:[.65002,1.15,0,0,.81111],91:[.65002,1.15,0,0,.47222],92:[.65002,1.15,0,0,.81111],93:[.65002,1.15,0,0,.47222],123:[.65002,1.15,0,0,.66667],125:[.65002,1.15,0,0,.66667],160:[0,0,0,0,.25],710:[0,.75,0,0,1],732:[0,.75,0,0,1],770:[0,.75,0,0,1],771:[0,.75,0,0,1],8719:[.55001,1.05,0,0,1.27778],8720:[.55001,1.05,0,0,1.27778],8721:[.55001,1.05,0,0,1.44445],8730:[.65002,1.15,0,0,1],8747:[.86225,1.36,.44445,0,.55556],8748:[.862,1.36,.44445,0,.55556],8749:[.862,1.36,.44445,0,.55556],8750:[.86225,1.36,.44445,0,.55556],8896:[.55001,1.05,0,0,1.11111],8897:[.55001,1.05,0,0,1.11111],8898:[.55001,1.05,0,0,1.11111],8899:[.55001,1.05,0,0,1.11111],8968:[.65002,1.15,0,0,.52778],8969:[.65002,1.15,0,0,.52778],8970:[.65002,1.15,0,0,.52778],8971:[.65002,1.15,0,0,.52778],10216:[.65002,1.15,0,0,.61111],10217:[.65002,1.15,0,0,.61111],10752:[.55001,1.05,0,0,1.51112],10753:[.55001,1.05,0,0,1.51112],10754:[.55001,1.05,0,0,1.51112],10756:[.55001,1.05,0,0,1.11111],10758:[.55001,1.05,0,0,1.11111]},"Size3-Regular":{32:[0,0,0,0,.25],40:[.95003,1.45,0,0,.73611],41:[.95003,1.45,0,0,.73611],47:[.95003,1.45,0,0,1.04445],91:[.95003,1.45,0,0,.52778],92:[.95003,1.45,0,0,1.04445],93:[.95003,1.45,0,0,.52778],123:[.95003,1.45,0,0,.75],125:[.95003,1.45,0,0,.75],160:[0,0,0,0,.25],710:[0,.75,0,0,1.44445],732:[0,.75,0,0,1.44445],770:[0,.75,0,0,1.44445],771:[0,.75,0,0,1.44445],8730:[.95003,1.45,0,0,1],8968:[.95003,1.45,0,0,.58334],8969:[.95003,1.45,0,0,.58334],8970:[.95003,1.45,0,0,.58334],8971:[.95003,1.45,0,0,.58334],10216:[.95003,1.45,0,0,.75],10217:[.95003,1.45,0,0,.75]},"Size4-Regular":{32:[0,0,0,0,.25],40:[1.25003,1.75,0,0,.79167],41:[1.25003,1.75,0,0,.79167],47:[1.25003,1.75,0,0,1.27778],91:[1.25003,1.75,0,0,.58334],92:[1.25003,1.75,0,0,1.27778],93:[1.25003,1.75,0,0,.58334],123:[1.25003,1.75,0,0,.80556],125:[1.25003,1.75,0,0,.80556],160:[0,0,0,0,.25],710:[0,.825,0,0,1.8889],732:[0,.825,0,0,1.8889],770:[0,.825,0,0,1.8889],771:[0,.825,0,0,1.8889],8730:[1.25003,1.75,0,0,1],8968:[1.25003,1.75,0,0,.63889],8969:[1.25003,1.75,0,0,.63889],8970:[1.25003,1.75,0,0,.63889],8971:[1.25003,1.75,0,0,.63889],9115:[.64502,1.155,0,0,.875],9116:[1e-5,.6,0,0,.875],9117:[.64502,1.155,0,0,.875],9118:[.64502,1.155,0,0,.875],9119:[1e-5,.6,0,0,.875],9120:[.64502,1.155,0,0,.875],9121:[.64502,1.155,0,0,.66667],9122:[-99e-5,.601,0,0,.66667],9123:[.64502,1.155,0,0,.66667],9124:[.64502,1.155,0,0,.66667],9125:[-99e-5,.601,0,0,.66667],9126:[.64502,1.155,0,0,.66667],9127:[1e-5,.9,0,0,.88889],9128:[.65002,1.15,0,0,.88889],9129:[.90001,0,0,0,.88889],9130:[0,.3,0,0,.88889],9131:[1e-5,.9,0,0,.88889],9132:[.65002,1.15,0,0,.88889],9133:[.90001,0,0,0,.88889],9143:[.88502,.915,0,0,1.05556],10216:[1.25003,1.75,0,0,.80556],10217:[1.25003,1.75,0,0,.80556],57344:[-.00499,.605,0,0,1.05556],57345:[-.00499,.605,0,0,1.05556],57680:[0,.12,0,0,.45],57681:[0,.12,0,0,.45],57682:[0,.12,0,0,.45],57683:[0,.12,0,0,.45]},"Typewriter-Regular":{32:[0,0,0,0,.525],33:[0,.61111,0,0,.525],34:[0,.61111,0,0,.525],35:[0,.61111,0,0,.525],36:[.08333,.69444,0,0,.525],37:[.08333,.69444,0,0,.525],38:[0,.61111,0,0,.525],39:[0,.61111,0,0,.525],40:[.08333,.69444,0,0,.525],41:[.08333,.69444,0,0,.525],42:[0,.52083,0,0,.525],43:[-.08056,.53055,0,0,.525],44:[.13889,.125,0,0,.525],45:[-.08056,.53055,0,0,.525],46:[0,.125,0,0,.525],47:[.08333,.69444,0,0,.525],48:[0,.61111,0,0,.525],49:[0,.61111,0,0,.525],50:[0,.61111,0,0,.525],51:[0,.61111,0,0,.525],52:[0,.61111,0,0,.525],53:[0,.61111,0,0,.525],54:[0,.61111,0,0,.525],55:[0,.61111,0,0,.525],56:[0,.61111,0,0,.525],57:[0,.61111,0,0,.525],58:[0,.43056,0,0,.525],59:[.13889,.43056,0,0,.525],60:[-.05556,.55556,0,0,.525],61:[-.19549,.41562,0,0,.525],62:[-.05556,.55556,0,0,.525],63:[0,.61111,0,0,.525],64:[0,.61111,0,0,.525],65:[0,.61111,0,0,.525],66:[0,.61111,0,0,.525],67:[0,.61111,0,0,.525],68:[0,.61111,0,0,.525],69:[0,.61111,0,0,.525],70:[0,.61111,0,0,.525],71:[0,.61111,0,0,.525],72:[0,.61111,0,0,.525],73:[0,.61111,0,0,.525],74:[0,.61111,0,0,.525],75:[0,.61111,0,0,.525],76:[0,.61111,0,0,.525],77:[0,.61111,0,0,.525],78:[0,.61111,0,0,.525],79:[0,.61111,0,0,.525],80:[0,.61111,0,0,.525],81:[.13889,.61111,0,0,.525],82:[0,.61111,0,0,.525],83:[0,.61111,0,0,.525],84:[0,.61111,0,0,.525],85:[0,.61111,0,0,.525],86:[0,.61111,0,0,.525],87:[0,.61111,0,0,.525],88:[0,.61111,0,0,.525],89:[0,.61111,0,0,.525],90:[0,.61111,0,0,.525],91:[.08333,.69444,0,0,.525],92:[.08333,.69444,0,0,.525],93:[.08333,.69444,0,0,.525],94:[0,.61111,0,0,.525],95:[.09514,0,0,0,.525],96:[0,.61111,0,0,.525],97:[0,.43056,0,0,.525],98:[0,.61111,0,0,.525],99:[0,.43056,0,0,.525],100:[0,.61111,0,0,.525],101:[0,.43056,0,0,.525],102:[0,.61111,0,0,.525],103:[.22222,.43056,0,0,.525],104:[0,.61111,0,0,.525],105:[0,.61111,0,0,.525],106:[.22222,.61111,0,0,.525],107:[0,.61111,0,0,.525],108:[0,.61111,0,0,.525],109:[0,.43056,0,0,.525],110:[0,.43056,0,0,.525],111:[0,.43056,0,0,.525],112:[.22222,.43056,0,0,.525],113:[.22222,.43056,0,0,.525],114:[0,.43056,0,0,.525],115:[0,.43056,0,0,.525],116:[0,.55358,0,0,.525],117:[0,.43056,0,0,.525],118:[0,.43056,0,0,.525],119:[0,.43056,0,0,.525],120:[0,.43056,0,0,.525],121:[.22222,.43056,0,0,.525],122:[0,.43056,0,0,.525],123:[.08333,.69444,0,0,.525],124:[.08333,.69444,0,0,.525],125:[.08333,.69444,0,0,.525],126:[0,.61111,0,0,.525],127:[0,.61111,0,0,.525],160:[0,0,0,0,.525],176:[0,.61111,0,0,.525],184:[.19445,0,0,0,.525],305:[0,.43056,0,0,.525],567:[.22222,.43056,0,0,.525],711:[0,.56597,0,0,.525],713:[0,.56555,0,0,.525],714:[0,.61111,0,0,.525],715:[0,.61111,0,0,.525],728:[0,.61111,0,0,.525],730:[0,.61111,0,0,.525],770:[0,.61111,0,0,.525],771:[0,.61111,0,0,.525],776:[0,.61111,0,0,.525],915:[0,.61111,0,0,.525],916:[0,.61111,0,0,.525],920:[0,.61111,0,0,.525],923:[0,.61111,0,0,.525],926:[0,.61111,0,0,.525],928:[0,.61111,0,0,.525],931:[0,.61111,0,0,.525],933:[0,.61111,0,0,.525],934:[0,.61111,0,0,.525],936:[0,.61111,0,0,.525],937:[0,.61111,0,0,.525],8216:[0,.61111,0,0,.525],8217:[0,.61111,0,0,.525],8242:[0,.61111,0,0,.525],9251:[.11111,.21944,0,0,.525]}},LE={slant:[.25,.25,.25],space:[0,0,0],stretch:[0,0,0],shrink:[0,0,0],xHeight:[.431,.431,.431],quad:[1,1.171,1.472],extraSpace:[0,0,0],num1:[.677,.732,.925],num2:[.394,.384,.387],num3:[.444,.471,.504],denom1:[.686,.752,1.025],denom2:[.345,.344,.532],sup1:[.413,.503,.504],sup2:[.363,.431,.404],sup3:[.289,.286,.294],sub1:[.15,.143,.2],sub2:[.247,.286,.4],supDrop:[.386,.353,.494],subDrop:[.05,.071,.1],delim1:[2.39,1.7,1.98],delim2:[1.01,1.157,1.42],axisHeight:[.25,.25,.25],defaultRuleThickness:[.04,.049,.049],bigOpSpacing1:[.111,.111,.111],bigOpSpacing2:[.166,.166,.166],bigOpSpacing3:[.2,.2,.2],bigOpSpacing4:[.6,.611,.611],bigOpSpacing5:[.1,.143,.143],sqrtRuleThickness:[.04,.04,.04],ptPerEm:[10,10,10],doubleRuleSep:[.2,.2,.2],arrayRuleWidth:[.04,.04,.04],fboxsep:[.3,.3,.3],fboxrule:[.04,.04,.04]},BE={"Å":"A","Ð":"D","Þ":"o","å":"a","ð":"d","þ":"o","А":"A","Б":"B","В":"B","Г":"F","Д":"A","Е":"E","Ж":"K","З":"3","И":"N","Й":"N","К":"K","Л":"N","М":"M","Н":"H","О":"O","П":"N","Р":"P","С":"C","Т":"T","У":"y","Ф":"O","Х":"X","Ц":"U","Ч":"h","Ш":"W","Щ":"W","Ъ":"B","Ы":"X","Ь":"B","Э":"3","Ю":"X","Я":"R","а":"a","б":"b","в":"a","г":"r","д":"y","е":"e","ж":"m","з":"e","и":"n","й":"n","к":"n","л":"n","м":"m","н":"n","о":"o","п":"n","р":"p","с":"c","т":"o","у":"y","ф":"b","х":"x","ц":"n","ч":"n","ш":"w","щ":"w","ъ":"a","ы":"m","ь":"a","э":"e","ю":"m","я":"r"};function PE(e,t,n){if(!RE[t])throw new Error("Font metrics not found for font: "+t+".");var r=e.charCodeAt(0),o=RE[t][r];if(!o&&e[0]in BE&&(r=BE[e[0]].charCodeAt(0),o=RE[t][r]),o||"text"!==n||dE(r)&&(o=RE[t][77]),o)return{depth:o[0],height:o[1],italic:o[2],skew:o[3],width:o[4]}}var zE={};var jE={math:{},text:{}};function VE(e,t,n,r,o,i){jE[e][o]={font:t,group:n,replace:r},i&&r&&(jE[e][r]=jE[e][o])}var $E="math",HE="text",qE="main",FE="ams",WE="accent-token",UE="bin",GE="close",KE="inner",JE="mathord",ZE="op-token",YE="open",XE="punct",QE="rel",eO="spacing",tO="textord";VE($E,qE,QE,"≡","\\equiv",!0),VE($E,qE,QE,"≺","\\prec",!0),VE($E,qE,QE,"≻","\\succ",!0),VE($E,qE,QE,"∼","\\sim",!0),VE($E,qE,QE,"⊥","\\perp"),VE($E,qE,QE,"⪯","\\preceq",!0),VE($E,qE,QE,"⪰","\\succeq",!0),VE($E,qE,QE,"≃","\\simeq",!0),VE($E,qE,QE,"∣","\\mid",!0),VE($E,qE,QE,"≪","\\ll",!0),VE($E,qE,QE,"≫","\\gg",!0),VE($E,qE,QE,"≍","\\asymp",!0),VE($E,qE,QE,"∥","\\parallel"),VE($E,qE,QE,"⋈","\\bowtie",!0),VE($E,qE,QE,"⌣","\\smile",!0),VE($E,qE,QE,"⊑","\\sqsubseteq",!0),VE($E,qE,QE,"⊒","\\sqsupseteq",!0),VE($E,qE,QE,"≐","\\doteq",!0),VE($E,qE,QE,"⌢","\\frown",!0),VE($E,qE,QE,"∋","\\ni",!0),VE($E,qE,QE,"∝","\\propto",!0),VE($E,qE,QE,"⊢","\\vdash",!0),VE($E,qE,QE,"⊣","\\dashv",!0),VE($E,qE,QE,"∋","\\owns"),VE($E,qE,XE,".","\\ldotp"),VE($E,qE,XE,"⋅","\\cdotp"),VE($E,qE,XE,"⋅","·"),VE(HE,qE,tO,"⋅","·"),VE($E,qE,tO,"#","\\#"),VE(HE,qE,tO,"#","\\#"),VE($E,qE,tO,"&","\\&"),VE(HE,qE,tO,"&","\\&"),VE($E,qE,tO,"ℵ","\\aleph",!0),VE($E,qE,tO,"∀","\\forall",!0),VE($E,qE,tO,"ℏ","\\hbar",!0),VE($E,qE,tO,"∃","\\exists",!0),VE($E,qE,tO,"∇","\\nabla",!0),VE($E,qE,tO,"♭","\\flat",!0),VE($E,qE,tO,"ℓ","\\ell",!0),VE($E,qE,tO,"♮","\\natural",!0),VE($E,qE,tO,"♣","\\clubsuit",!0),VE($E,qE,tO,"℘","\\wp",!0),VE($E,qE,tO,"♯","\\sharp",!0),VE($E,qE,tO,"♢","\\diamondsuit",!0),VE($E,qE,tO,"ℜ","\\Re",!0),VE($E,qE,tO,"♡","\\heartsuit",!0),VE($E,qE,tO,"ℑ","\\Im",!0),VE($E,qE,tO,"♠","\\spadesuit",!0),VE($E,qE,tO,"§","\\S",!0),VE(HE,qE,tO,"§","\\S"),VE($E,qE,tO,"¶","\\P",!0),VE(HE,qE,tO,"¶","\\P"),VE($E,qE,tO,"†","\\dag"),VE(HE,qE,tO,"†","\\dag"),VE(HE,qE,tO,"†","\\textdagger"),VE($E,qE,tO,"‡","\\ddag"),VE(HE,qE,tO,"‡","\\ddag"),VE(HE,qE,tO,"‡","\\textdaggerdbl"),VE($E,qE,GE,"⎱","\\rmoustache",!0),VE($E,qE,YE,"⎰","\\lmoustache",!0),VE($E,qE,GE,"⟯","\\rgroup",!0),VE($E,qE,YE,"⟮","\\lgroup",!0),VE($E,qE,UE,"∓","\\mp",!0),VE($E,qE,UE,"⊖","\\ominus",!0),VE($E,qE,UE,"⊎","\\uplus",!0),VE($E,qE,UE,"⊓","\\sqcap",!0),VE($E,qE,UE,"∗","\\ast"),VE($E,qE,UE,"⊔","\\sqcup",!0),VE($E,qE,UE,"◯","\\bigcirc",!0),VE($E,qE,UE,"∙","\\bullet",!0),VE($E,qE,UE,"‡","\\ddagger"),VE($E,qE,UE,"≀","\\wr",!0),VE($E,qE,UE,"⨿","\\amalg"),VE($E,qE,UE,"&","\\And"),VE($E,qE,QE,"⟵","\\longleftarrow",!0),VE($E,qE,QE,"⇐","\\Leftarrow",!0),VE($E,qE,QE,"⟸","\\Longleftarrow",!0),VE($E,qE,QE,"⟶","\\longrightarrow",!0),VE($E,qE,QE,"⇒","\\Rightarrow",!0),VE($E,qE,QE,"⟹","\\Longrightarrow",!0),VE($E,qE,QE,"↔","\\leftrightarrow",!0),VE($E,qE,QE,"⟷","\\longleftrightarrow",!0),VE($E,qE,QE,"⇔","\\Leftrightarrow",!0),VE($E,qE,QE,"⟺","\\Longleftrightarrow",!0),VE($E,qE,QE,"↦","\\mapsto",!0),VE($E,qE,QE,"⟼","\\longmapsto",!0),VE($E,qE,QE,"↗","\\nearrow",!0),VE($E,qE,QE,"↩","\\hookleftarrow",!0),VE($E,qE,QE,"↪","\\hookrightarrow",!0),VE($E,qE,QE,"↘","\\searrow",!0),VE($E,qE,QE,"↼","\\leftharpoonup",!0),VE($E,qE,QE,"⇀","\\rightharpoonup",!0),VE($E,qE,QE,"↙","\\swarrow",!0),VE($E,qE,QE,"↽","\\leftharpoondown",!0),VE($E,qE,QE,"⇁","\\rightharpoondown",!0),VE($E,qE,QE,"↖","\\nwarrow",!0),VE($E,qE,QE,"⇌","\\rightleftharpoons",!0),VE($E,FE,QE,"≮","\\nless",!0),VE($E,FE,QE,"","\\@nleqslant"),VE($E,FE,QE,"","\\@nleqq"),VE($E,FE,QE,"⪇","\\lneq",!0),VE($E,FE,QE,"≨","\\lneqq",!0),VE($E,FE,QE,"","\\@lvertneqq"),VE($E,FE,QE,"⋦","\\lnsim",!0),VE($E,FE,QE,"⪉","\\lnapprox",!0),VE($E,FE,QE,"⊀","\\nprec",!0),VE($E,FE,QE,"⋠","\\npreceq",!0),VE($E,FE,QE,"⋨","\\precnsim",!0),VE($E,FE,QE,"⪹","\\precnapprox",!0),VE($E,FE,QE,"≁","\\nsim",!0),VE($E,FE,QE,"","\\@nshortmid"),VE($E,FE,QE,"∤","\\nmid",!0),VE($E,FE,QE,"⊬","\\nvdash",!0),VE($E,FE,QE,"⊭","\\nvDash",!0),VE($E,FE,QE,"⋪","\\ntriangleleft"),VE($E,FE,QE,"⋬","\\ntrianglelefteq",!0),VE($E,FE,QE,"⊊","\\subsetneq",!0),VE($E,FE,QE,"","\\@varsubsetneq"),VE($E,FE,QE,"⫋","\\subsetneqq",!0),VE($E,FE,QE,"","\\@varsubsetneqq"),VE($E,FE,QE,"≯","\\ngtr",!0),VE($E,FE,QE,"","\\@ngeqslant"),VE($E,FE,QE,"","\\@ngeqq"),VE($E,FE,QE,"⪈","\\gneq",!0),VE($E,FE,QE,"≩","\\gneqq",!0),VE($E,FE,QE,"","\\@gvertneqq"),VE($E,FE,QE,"⋧","\\gnsim",!0),VE($E,FE,QE,"⪊","\\gnapprox",!0),VE($E,FE,QE,"⊁","\\nsucc",!0),VE($E,FE,QE,"⋡","\\nsucceq",!0),VE($E,FE,QE,"⋩","\\succnsim",!0),VE($E,FE,QE,"⪺","\\succnapprox",!0),VE($E,FE,QE,"≆","\\ncong",!0),VE($E,FE,QE,"","\\@nshortparallel"),VE($E,FE,QE,"∦","\\nparallel",!0),VE($E,FE,QE,"⊯","\\nVDash",!0),VE($E,FE,QE,"⋫","\\ntriangleright"),VE($E,FE,QE,"⋭","\\ntrianglerighteq",!0),VE($E,FE,QE,"","\\@nsupseteqq"),VE($E,FE,QE,"⊋","\\supsetneq",!0),VE($E,FE,QE,"","\\@varsupsetneq"),VE($E,FE,QE,"⫌","\\supsetneqq",!0),VE($E,FE,QE,"","\\@varsupsetneqq"),VE($E,FE,QE,"⊮","\\nVdash",!0),VE($E,FE,QE,"⪵","\\precneqq",!0),VE($E,FE,QE,"⪶","\\succneqq",!0),VE($E,FE,QE,"","\\@nsubseteqq"),VE($E,FE,UE,"⊴","\\unlhd"),VE($E,FE,UE,"⊵","\\unrhd"),VE($E,FE,QE,"↚","\\nleftarrow",!0),VE($E,FE,QE,"↛","\\nrightarrow",!0),VE($E,FE,QE,"⇍","\\nLeftarrow",!0),VE($E,FE,QE,"⇏","\\nRightarrow",!0),VE($E,FE,QE,"↮","\\nleftrightarrow",!0),VE($E,FE,QE,"⇎","\\nLeftrightarrow",!0),VE($E,FE,QE,"△","\\vartriangle"),VE($E,FE,tO,"ℏ","\\hslash"),VE($E,FE,tO,"▽","\\triangledown"),VE($E,FE,tO,"◊","\\lozenge"),VE($E,FE,tO,"Ⓢ","\\circledS"),VE($E,FE,tO,"®","\\circledR"),VE(HE,FE,tO,"®","\\circledR"),VE($E,FE,tO,"∡","\\measuredangle",!0),VE($E,FE,tO,"∄","\\nexists"),VE($E,FE,tO,"℧","\\mho"),VE($E,FE,tO,"Ⅎ","\\Finv",!0),VE($E,FE,tO,"⅁","\\Game",!0),VE($E,FE,tO,"‵","\\backprime"),VE($E,FE,tO,"▲","\\blacktriangle"),VE($E,FE,tO,"▼","\\blacktriangledown"),VE($E,FE,tO,"■","\\blacksquare"),VE($E,FE,tO,"⧫","\\blacklozenge"),VE($E,FE,tO,"★","\\bigstar"),VE($E,FE,tO,"∢","\\sphericalangle",!0),VE($E,FE,tO,"∁","\\complement",!0),VE($E,FE,tO,"ð","\\eth",!0),VE(HE,qE,tO,"ð","ð"),VE($E,FE,tO,"╱","\\diagup"),VE($E,FE,tO,"╲","\\diagdown"),VE($E,FE,tO,"□","\\square"),VE($E,FE,tO,"□","\\Box"),VE($E,FE,tO,"◊","\\Diamond"),VE($E,FE,tO,"¥","\\yen",!0),VE(HE,FE,tO,"¥","\\yen",!0),VE($E,FE,tO,"✓","\\checkmark",!0),VE(HE,FE,tO,"✓","\\checkmark"),VE($E,FE,tO,"ℶ","\\beth",!0),VE($E,FE,tO,"ℸ","\\daleth",!0),VE($E,FE,tO,"ℷ","\\gimel",!0),VE($E,FE,tO,"ϝ","\\digamma",!0),VE($E,FE,tO,"ϰ","\\varkappa"),VE($E,FE,YE,"┌","\\@ulcorner",!0),VE($E,FE,GE,"┐","\\@urcorner",!0),VE($E,FE,YE,"└","\\@llcorner",!0),VE($E,FE,GE,"┘","\\@lrcorner",!0),VE($E,FE,QE,"≦","\\leqq",!0),VE($E,FE,QE,"⩽","\\leqslant",!0),VE($E,FE,QE,"⪕","\\eqslantless",!0),VE($E,FE,QE,"≲","\\lesssim",!0),VE($E,FE,QE,"⪅","\\lessapprox",!0),VE($E,FE,QE,"≊","\\approxeq",!0),VE($E,FE,UE,"⋖","\\lessdot"),VE($E,FE,QE,"⋘","\\lll",!0),VE($E,FE,QE,"≶","\\lessgtr",!0),VE($E,FE,QE,"⋚","\\lesseqgtr",!0),VE($E,FE,QE,"⪋","\\lesseqqgtr",!0),VE($E,FE,QE,"≑","\\doteqdot"),VE($E,FE,QE,"≓","\\risingdotseq",!0),VE($E,FE,QE,"≒","\\fallingdotseq",!0),VE($E,FE,QE,"∽","\\backsim",!0),VE($E,FE,QE,"⋍","\\backsimeq",!0),VE($E,FE,QE,"⫅","\\subseteqq",!0),VE($E,FE,QE,"⋐","\\Subset",!0),VE($E,FE,QE,"⊏","\\sqsubset",!0),VE($E,FE,QE,"≼","\\preccurlyeq",!0),VE($E,FE,QE,"⋞","\\curlyeqprec",!0),VE($E,FE,QE,"≾","\\precsim",!0),VE($E,FE,QE,"⪷","\\precapprox",!0),VE($E,FE,QE,"⊲","\\vartriangleleft"),VE($E,FE,QE,"⊴","\\trianglelefteq"),VE($E,FE,QE,"⊨","\\vDash",!0),VE($E,FE,QE,"⊪","\\Vvdash",!0),VE($E,FE,QE,"⌣","\\smallsmile"),VE($E,FE,QE,"⌢","\\smallfrown"),VE($E,FE,QE,"≏","\\bumpeq",!0),VE($E,FE,QE,"≎","\\Bumpeq",!0),VE($E,FE,QE,"≧","\\geqq",!0),VE($E,FE,QE,"⩾","\\geqslant",!0),VE($E,FE,QE,"⪖","\\eqslantgtr",!0),VE($E,FE,QE,"≳","\\gtrsim",!0),VE($E,FE,QE,"⪆","\\gtrapprox",!0),VE($E,FE,UE,"⋗","\\gtrdot"),VE($E,FE,QE,"⋙","\\ggg",!0),VE($E,FE,QE,"≷","\\gtrless",!0),VE($E,FE,QE,"⋛","\\gtreqless",!0),VE($E,FE,QE,"⪌","\\gtreqqless",!0),VE($E,FE,QE,"≖","\\eqcirc",!0),VE($E,FE,QE,"≗","\\circeq",!0),VE($E,FE,QE,"≜","\\triangleq",!0),VE($E,FE,QE,"∼","\\thicksim"),VE($E,FE,QE,"≈","\\thickapprox"),VE($E,FE,QE,"⫆","\\supseteqq",!0),VE($E,FE,QE,"⋑","\\Supset",!0),VE($E,FE,QE,"⊐","\\sqsupset",!0),VE($E,FE,QE,"≽","\\succcurlyeq",!0),VE($E,FE,QE,"⋟","\\curlyeqsucc",!0),VE($E,FE,QE,"≿","\\succsim",!0),VE($E,FE,QE,"⪸","\\succapprox",!0),VE($E,FE,QE,"⊳","\\vartriangleright"),VE($E,FE,QE,"⊵","\\trianglerighteq"),VE($E,FE,QE,"⊩","\\Vdash",!0),VE($E,FE,QE,"∣","\\shortmid"),VE($E,FE,QE,"∥","\\shortparallel"),VE($E,FE,QE,"≬","\\between",!0),VE($E,FE,QE,"⋔","\\pitchfork",!0),VE($E,FE,QE,"∝","\\varpropto"),VE($E,FE,QE,"◀","\\blacktriangleleft"),VE($E,FE,QE,"∴","\\therefore",!0),VE($E,FE,QE,"∍","\\backepsilon"),VE($E,FE,QE,"▶","\\blacktriangleright"),VE($E,FE,QE,"∵","\\because",!0),VE($E,FE,QE,"⋘","\\llless"),VE($E,FE,QE,"⋙","\\gggtr"),VE($E,FE,UE,"⊲","\\lhd"),VE($E,FE,UE,"⊳","\\rhd"),VE($E,FE,QE,"≂","\\eqsim",!0),VE($E,qE,QE,"⋈","\\Join"),VE($E,FE,QE,"≑","\\Doteq",!0),VE($E,FE,UE,"∔","\\dotplus",!0),VE($E,FE,UE,"∖","\\smallsetminus"),VE($E,FE,UE,"⋒","\\Cap",!0),VE($E,FE,UE,"⋓","\\Cup",!0),VE($E,FE,UE,"⩞","\\doublebarwedge",!0),VE($E,FE,UE,"⊟","\\boxminus",!0),VE($E,FE,UE,"⊞","\\boxplus",!0),VE($E,FE,UE,"⋇","\\divideontimes",!0),VE($E,FE,UE,"⋉","\\ltimes",!0),VE($E,FE,UE,"⋊","\\rtimes",!0),VE($E,FE,UE,"⋋","\\leftthreetimes",!0),VE($E,FE,UE,"⋌","\\rightthreetimes",!0),VE($E,FE,UE,"⋏","\\curlywedge",!0),VE($E,FE,UE,"⋎","\\curlyvee",!0),VE($E,FE,UE,"⊝","\\circleddash",!0),VE($E,FE,UE,"⊛","\\circledast",!0),VE($E,FE,UE,"⋅","\\centerdot"),VE($E,FE,UE,"⊺","\\intercal",!0),VE($E,FE,UE,"⋒","\\doublecap"),VE($E,FE,UE,"⋓","\\doublecup"),VE($E,FE,UE,"⊠","\\boxtimes",!0),VE($E,FE,QE,"⇢","\\dashrightarrow",!0),VE($E,FE,QE,"⇠","\\dashleftarrow",!0),VE($E,FE,QE,"⇇","\\leftleftarrows",!0),VE($E,FE,QE,"⇆","\\leftrightarrows",!0),VE($E,FE,QE,"⇚","\\Lleftarrow",!0),VE($E,FE,QE,"↞","\\twoheadleftarrow",!0),VE($E,FE,QE,"↢","\\leftarrowtail",!0),VE($E,FE,QE,"↫","\\looparrowleft",!0),VE($E,FE,QE,"⇋","\\leftrightharpoons",!0),VE($E,FE,QE,"↶","\\curvearrowleft",!0),VE($E,FE,QE,"↺","\\circlearrowleft",!0),VE($E,FE,QE,"↰","\\Lsh",!0),VE($E,FE,QE,"⇈","\\upuparrows",!0),VE($E,FE,QE,"↿","\\upharpoonleft",!0),VE($E,FE,QE,"⇃","\\downharpoonleft",!0),VE($E,qE,QE,"⊶","\\origof",!0),VE($E,qE,QE,"⊷","\\imageof",!0),VE($E,FE,QE,"⊸","\\multimap",!0),VE($E,FE,QE,"↭","\\leftrightsquigarrow",!0),VE($E,FE,QE,"⇉","\\rightrightarrows",!0),VE($E,FE,QE,"⇄","\\rightleftarrows",!0),VE($E,FE,QE,"↠","\\twoheadrightarrow",!0),VE($E,FE,QE,"↣","\\rightarrowtail",!0),VE($E,FE,QE,"↬","\\looparrowright",!0),VE($E,FE,QE,"↷","\\curvearrowright",!0),VE($E,FE,QE,"↻","\\circlearrowright",!0),VE($E,FE,QE,"↱","\\Rsh",!0),VE($E,FE,QE,"⇊","\\downdownarrows",!0),VE($E,FE,QE,"↾","\\upharpoonright",!0),VE($E,FE,QE,"⇂","\\downharpoonright",!0),VE($E,FE,QE,"⇝","\\rightsquigarrow",!0),VE($E,FE,QE,"⇝","\\leadsto"),VE($E,FE,QE,"⇛","\\Rrightarrow",!0),VE($E,FE,QE,"↾","\\restriction"),VE($E,qE,tO,"‘","`"),VE($E,qE,tO,"$","\\$"),VE(HE,qE,tO,"$","\\$"),VE(HE,qE,tO,"$","\\textdollar"),VE($E,qE,tO,"%","\\%"),VE(HE,qE,tO,"%","\\%"),VE($E,qE,tO,"_","\\_"),VE(HE,qE,tO,"_","\\_"),VE(HE,qE,tO,"_","\\textunderscore"),VE($E,qE,tO,"∠","\\angle",!0),VE($E,qE,tO,"∞","\\infty",!0),VE($E,qE,tO,"′","\\prime"),VE($E,qE,tO,"△","\\triangle"),VE($E,qE,tO,"Γ","\\Gamma",!0),VE($E,qE,tO,"Δ","\\Delta",!0),VE($E,qE,tO,"Θ","\\Theta",!0),VE($E,qE,tO,"Λ","\\Lambda",!0),VE($E,qE,tO,"Ξ","\\Xi",!0),VE($E,qE,tO,"Π","\\Pi",!0),VE($E,qE,tO,"Σ","\\Sigma",!0),VE($E,qE,tO,"Υ","\\Upsilon",!0),VE($E,qE,tO,"Φ","\\Phi",!0),VE($E,qE,tO,"Ψ","\\Psi",!0),VE($E,qE,tO,"Ω","\\Omega",!0),VE($E,qE,tO,"A","Α"),VE($E,qE,tO,"B","Β"),VE($E,qE,tO,"E","Ε"),VE($E,qE,tO,"Z","Ζ"),VE($E,qE,tO,"H","Η"),VE($E,qE,tO,"I","Ι"),VE($E,qE,tO,"K","Κ"),VE($E,qE,tO,"M","Μ"),VE($E,qE,tO,"N","Ν"),VE($E,qE,tO,"O","Ο"),VE($E,qE,tO,"P","Ρ"),VE($E,qE,tO,"T","Τ"),VE($E,qE,tO,"X","Χ"),VE($E,qE,tO,"¬","\\neg",!0),VE($E,qE,tO,"¬","\\lnot"),VE($E,qE,tO,"⊤","\\top"),VE($E,qE,tO,"⊥","\\bot"),VE($E,qE,tO,"∅","\\emptyset"),VE($E,FE,tO,"∅","\\varnothing"),VE($E,qE,JE,"α","\\alpha",!0),VE($E,qE,JE,"β","\\beta",!0),VE($E,qE,JE,"γ","\\gamma",!0),VE($E,qE,JE,"δ","\\delta",!0),VE($E,qE,JE,"ϵ","\\epsilon",!0),VE($E,qE,JE,"ζ","\\zeta",!0),VE($E,qE,JE,"η","\\eta",!0),VE($E,qE,JE,"θ","\\theta",!0),VE($E,qE,JE,"ι","\\iota",!0),VE($E,qE,JE,"κ","\\kappa",!0),VE($E,qE,JE,"λ","\\lambda",!0),VE($E,qE,JE,"μ","\\mu",!0),VE($E,qE,JE,"ν","\\nu",!0),VE($E,qE,JE,"ξ","\\xi",!0),VE($E,qE,JE,"ο","\\omicron",!0),VE($E,qE,JE,"π","\\pi",!0),VE($E,qE,JE,"ρ","\\rho",!0),VE($E,qE,JE,"σ","\\sigma",!0),VE($E,qE,JE,"τ","\\tau",!0),VE($E,qE,JE,"υ","\\upsilon",!0),VE($E,qE,JE,"ϕ","\\phi",!0),VE($E,qE,JE,"χ","\\chi",!0),VE($E,qE,JE,"ψ","\\psi",!0),VE($E,qE,JE,"ω","\\omega",!0),VE($E,qE,JE,"ε","\\varepsilon",!0),VE($E,qE,JE,"ϑ","\\vartheta",!0),VE($E,qE,JE,"ϖ","\\varpi",!0),VE($E,qE,JE,"ϱ","\\varrho",!0),VE($E,qE,JE,"ς","\\varsigma",!0),VE($E,qE,JE,"φ","\\varphi",!0),VE($E,qE,UE,"∗","*",!0),VE($E,qE,UE,"+","+"),VE($E,qE,UE,"−","-",!0),VE($E,qE,UE,"⋅","\\cdot",!0),VE($E,qE,UE,"∘","\\circ",!0),VE($E,qE,UE,"÷","\\div",!0),VE($E,qE,UE,"±","\\pm",!0),VE($E,qE,UE,"×","\\times",!0),VE($E,qE,UE,"∩","\\cap",!0),VE($E,qE,UE,"∪","\\cup",!0),VE($E,qE,UE,"∖","\\setminus",!0),VE($E,qE,UE,"∧","\\land"),VE($E,qE,UE,"∨","\\lor"),VE($E,qE,UE,"∧","\\wedge",!0),VE($E,qE,UE,"∨","\\vee",!0),VE($E,qE,tO,"√","\\surd"),VE($E,qE,YE,"⟨","\\langle",!0),VE($E,qE,YE,"∣","\\lvert"),VE($E,qE,YE,"∥","\\lVert"),VE($E,qE,GE,"?","?"),VE($E,qE,GE,"!","!"),VE($E,qE,GE,"⟩","\\rangle",!0),VE($E,qE,GE,"∣","\\rvert"),VE($E,qE,GE,"∥","\\rVert"),VE($E,qE,QE,"=","="),VE($E,qE,QE,":",":"),VE($E,qE,QE,"≈","\\approx",!0),VE($E,qE,QE,"≅","\\cong",!0),VE($E,qE,QE,"≥","\\ge"),VE($E,qE,QE,"≥","\\geq",!0),VE($E,qE,QE,"←","\\gets"),VE($E,qE,QE,">","\\gt",!0),VE($E,qE,QE,"∈","\\in",!0),VE($E,qE,QE,"","\\@not"),VE($E,qE,QE,"⊂","\\subset",!0),VE($E,qE,QE,"⊃","\\supset",!0),VE($E,qE,QE,"⊆","\\subseteq",!0),VE($E,qE,QE,"⊇","\\supseteq",!0),VE($E,FE,QE,"⊈","\\nsubseteq",!0),VE($E,FE,QE,"⊉","\\nsupseteq",!0),VE($E,qE,QE,"⊨","\\models"),VE($E,qE,QE,"←","\\leftarrow",!0),VE($E,qE,QE,"≤","\\le"),VE($E,qE,QE,"≤","\\leq",!0),VE($E,qE,QE,"<","\\lt",!0),VE($E,qE,QE,"→","\\rightarrow",!0),VE($E,qE,QE,"→","\\to"),VE($E,FE,QE,"≱","\\ngeq",!0),VE($E,FE,QE,"≰","\\nleq",!0),VE($E,qE,eO," ","\\ "),VE($E,qE,eO," ","\\space"),VE($E,qE,eO," ","\\nobreakspace"),VE(HE,qE,eO," ","\\ "),VE(HE,qE,eO," "," "),VE(HE,qE,eO," ","\\space"),VE(HE,qE,eO," ","\\nobreakspace"),VE($E,qE,eO,"","\\nobreak"),VE($E,qE,eO,"","\\allowbreak"),VE($E,qE,XE,",",","),VE($E,qE,XE,";",";"),VE($E,FE,UE,"⊼","\\barwedge",!0),VE($E,FE,UE,"⊻","\\veebar",!0),VE($E,qE,UE,"⊙","\\odot",!0),VE($E,qE,UE,"⊕","\\oplus",!0),VE($E,qE,UE,"⊗","\\otimes",!0),VE($E,qE,tO,"∂","\\partial",!0),VE($E,qE,UE,"⊘","\\oslash",!0),VE($E,FE,UE,"⊚","\\circledcirc",!0),VE($E,FE,UE,"⊡","\\boxdot",!0),VE($E,qE,UE,"△","\\bigtriangleup"),VE($E,qE,UE,"▽","\\bigtriangledown"),VE($E,qE,UE,"†","\\dagger"),VE($E,qE,UE,"⋄","\\diamond"),VE($E,qE,UE,"⋆","\\star"),VE($E,qE,UE,"◃","\\triangleleft"),VE($E,qE,UE,"▹","\\triangleright"),VE($E,qE,YE,"{","\\{"),VE(HE,qE,tO,"{","\\{"),VE(HE,qE,tO,"{","\\textbraceleft"),VE($E,qE,GE,"}","\\}"),VE(HE,qE,tO,"}","\\}"),VE(HE,qE,tO,"}","\\textbraceright"),VE($E,qE,YE,"{","\\lbrace"),VE($E,qE,GE,"}","\\rbrace"),VE($E,qE,YE,"[","\\lbrack",!0),VE(HE,qE,tO,"[","\\lbrack",!0),VE($E,qE,GE,"]","\\rbrack",!0),VE(HE,qE,tO,"]","\\rbrack",!0),VE($E,qE,YE,"(","\\lparen",!0),VE($E,qE,GE,")","\\rparen",!0),VE(HE,qE,tO,"<","\\textless",!0),VE(HE,qE,tO,">","\\textgreater",!0),VE($E,qE,YE,"⌊","\\lfloor",!0),VE($E,qE,GE,"⌋","\\rfloor",!0),VE($E,qE,YE,"⌈","\\lceil",!0),VE($E,qE,GE,"⌉","\\rceil",!0),VE($E,qE,tO,"\\","\\backslash"),VE($E,qE,tO,"∣","|"),VE($E,qE,tO,"∣","\\vert"),VE(HE,qE,tO,"|","\\textbar",!0),VE($E,qE,tO,"∥","\\|"),VE($E,qE,tO,"∥","\\Vert"),VE(HE,qE,tO,"∥","\\textbardbl"),VE(HE,qE,tO,"~","\\textasciitilde"),VE(HE,qE,tO,"\\","\\textbackslash"),VE(HE,qE,tO,"^","\\textasciicircum"),VE($E,qE,QE,"↑","\\uparrow",!0),VE($E,qE,QE,"⇑","\\Uparrow",!0),VE($E,qE,QE,"↓","\\downarrow",!0),VE($E,qE,QE,"⇓","\\Downarrow",!0),VE($E,qE,QE,"↕","\\updownarrow",!0),VE($E,qE,QE,"⇕","\\Updownarrow",!0),VE($E,qE,ZE,"∐","\\coprod"),VE($E,qE,ZE,"⋁","\\bigvee"),VE($E,qE,ZE,"⋀","\\bigwedge"),VE($E,qE,ZE,"⨄","\\biguplus"),VE($E,qE,ZE,"⋂","\\bigcap"),VE($E,qE,ZE,"⋃","\\bigcup"),VE($E,qE,ZE,"∫","\\int"),VE($E,qE,ZE,"∫","\\intop"),VE($E,qE,ZE,"∬","\\iint"),VE($E,qE,ZE,"∭","\\iiint"),VE($E,qE,ZE,"∏","\\prod"),VE($E,qE,ZE,"∑","\\sum"),VE($E,qE,ZE,"⨂","\\bigotimes"),VE($E,qE,ZE,"⨁","\\bigoplus"),VE($E,qE,ZE,"⨀","\\bigodot"),VE($E,qE,ZE,"∮","\\oint"),VE($E,qE,ZE,"∯","\\oiint"),VE($E,qE,ZE,"∰","\\oiiint"),VE($E,qE,ZE,"⨆","\\bigsqcup"),VE($E,qE,ZE,"∫","\\smallint"),VE(HE,qE,KE,"…","\\textellipsis"),VE($E,qE,KE,"…","\\mathellipsis"),VE(HE,qE,KE,"…","\\ldots",!0),VE($E,qE,KE,"…","\\ldots",!0),VE($E,qE,KE,"⋯","\\@cdots",!0),VE($E,qE,KE,"⋱","\\ddots",!0),VE($E,qE,tO,"⋮","\\varvdots"),VE(HE,qE,tO,"⋮","\\varvdots"),VE($E,qE,WE,"ˊ","\\acute"),VE($E,qE,WE,"ˋ","\\grave"),VE($E,qE,WE,"¨","\\ddot"),VE($E,qE,WE,"~","\\tilde"),VE($E,qE,WE,"ˉ","\\bar"),VE($E,qE,WE,"˘","\\breve"),VE($E,qE,WE,"ˇ","\\check"),VE($E,qE,WE,"^","\\hat"),VE($E,qE,WE,"⃗","\\vec"),VE($E,qE,WE,"˙","\\dot"),VE($E,qE,WE,"˚","\\mathring"),VE($E,qE,JE,"","\\@imath"),VE($E,qE,JE,"","\\@jmath"),VE($E,qE,tO,"ı","ı"),VE($E,qE,tO,"ȷ","ȷ"),VE(HE,qE,tO,"ı","\\i",!0),VE(HE,qE,tO,"ȷ","\\j",!0),VE(HE,qE,tO,"ß","\\ss",!0),VE(HE,qE,tO,"æ","\\ae",!0),VE(HE,qE,tO,"œ","\\oe",!0),VE(HE,qE,tO,"ø","\\o",!0),VE(HE,qE,tO,"Æ","\\AE",!0),VE(HE,qE,tO,"Œ","\\OE",!0),VE(HE,qE,tO,"Ø","\\O",!0),VE(HE,qE,WE,"ˊ","\\'"),VE(HE,qE,WE,"ˋ","\\`"),VE(HE,qE,WE,"ˆ","\\^"),VE(HE,qE,WE,"˜","\\~"),VE(HE,qE,WE,"ˉ","\\="),VE(HE,qE,WE,"˘","\\u"),VE(HE,qE,WE,"˙","\\."),VE(HE,qE,WE,"¸","\\c"),VE(HE,qE,WE,"˚","\\r"),VE(HE,qE,WE,"ˇ","\\v"),VE(HE,qE,WE,"¨",'\\"'),VE(HE,qE,WE,"˝","\\H"),VE(HE,qE,WE,"◯","\\textcircled");var nO={"--":!0,"---":!0,"``":!0,"''":!0};VE(HE,qE,tO,"–","--",!0),VE(HE,qE,tO,"–","\\textendash"),VE(HE,qE,tO,"—","---",!0),VE(HE,qE,tO,"—","\\textemdash"),VE(HE,qE,tO,"‘","`",!0),VE(HE,qE,tO,"‘","\\textquoteleft"),VE(HE,qE,tO,"’","'",!0),VE(HE,qE,tO,"’","\\textquoteright"),VE(HE,qE,tO,"“","``",!0),VE(HE,qE,tO,"“","\\textquotedblleft"),VE(HE,qE,tO,"”","''",!0),VE(HE,qE,tO,"”","\\textquotedblright"),VE($E,qE,tO,"°","\\degree",!0),VE(HE,qE,tO,"°","\\degree"),VE(HE,qE,tO,"°","\\textdegree",!0),VE($E,qE,tO,"£","\\pounds"),VE($E,qE,tO,"£","\\mathsterling",!0),VE(HE,qE,tO,"£","\\pounds"),VE(HE,qE,tO,"£","\\textsterling",!0),VE($E,FE,tO,"✠","\\maltese"),VE(HE,FE,tO,"✠","\\maltese");for(var rO='0123456789/@."',oO=0;oO<14;oO++){var iO=rO.charAt(oO);VE($E,qE,tO,iO,iO)}for(var sO='0123456789!@*()-=+";:?/.,',aO=0;aO<25;aO++){var lO=sO.charAt(aO);VE(HE,qE,tO,lO,lO)}for(var cO,dO="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",uO=0;uO<52;uO++){var hO=dO.charAt(uO);VE($E,qE,JE,hO,hO),VE(HE,qE,tO,hO,hO)}VE($E,FE,tO,"C","ℂ"),VE(HE,FE,tO,"C","ℂ"),VE($E,FE,tO,"H","ℍ"),VE(HE,FE,tO,"H","ℍ"),VE($E,FE,tO,"N","ℕ"),VE(HE,FE,tO,"N","ℕ"),VE($E,FE,tO,"P","ℙ"),VE(HE,FE,tO,"P","ℙ"),VE($E,FE,tO,"Q","ℚ"),VE(HE,FE,tO,"Q","ℚ"),VE($E,FE,tO,"R","ℝ"),VE(HE,FE,tO,"R","ℝ"),VE($E,FE,tO,"Z","ℤ"),VE(HE,FE,tO,"Z","ℤ"),VE($E,qE,JE,"h","ℎ"),VE(HE,qE,JE,"h","ℎ");for(var pO=0;pO<52;pO++){var fO=dO.charAt(pO);VE($E,qE,JE,fO,cO=String.fromCharCode(55349,56320+pO)),VE(HE,qE,tO,fO,cO),VE($E,qE,JE,fO,cO=String.fromCharCode(55349,56372+pO)),VE(HE,qE,tO,fO,cO),VE($E,qE,JE,fO,cO=String.fromCharCode(55349,56424+pO)),VE(HE,qE,tO,fO,cO),VE($E,qE,JE,fO,cO=String.fromCharCode(55349,56580+pO)),VE(HE,qE,tO,fO,cO),VE($E,qE,JE,fO,cO=String.fromCharCode(55349,56684+pO)),VE(HE,qE,tO,fO,cO),VE($E,qE,JE,fO,cO=String.fromCharCode(55349,56736+pO)),VE(HE,qE,tO,fO,cO),VE($E,qE,JE,fO,cO=String.fromCharCode(55349,56788+pO)),VE(HE,qE,tO,fO,cO),VE($E,qE,JE,fO,cO=String.fromCharCode(55349,56840+pO)),VE(HE,qE,tO,fO,cO),VE($E,qE,JE,fO,cO=String.fromCharCode(55349,56944+pO)),VE(HE,qE,tO,fO,cO),pO<26&&(VE($E,qE,JE,fO,cO=String.fromCharCode(55349,56632+pO)),VE(HE,qE,tO,fO,cO),VE($E,qE,JE,fO,cO=String.fromCharCode(55349,56476+pO)),VE(HE,qE,tO,fO,cO))}VE($E,qE,JE,"k",cO=String.fromCharCode(55349,56668)),VE(HE,qE,tO,"k",cO);for(var mO=0;mO<10;mO++){var gO=mO.toString();VE($E,qE,JE,gO,cO=String.fromCharCode(55349,57294+mO)),VE(HE,qE,tO,gO,cO),VE($E,qE,JE,gO,cO=String.fromCharCode(55349,57314+mO)),VE(HE,qE,tO,gO,cO),VE($E,qE,JE,gO,cO=String.fromCharCode(55349,57324+mO)),VE(HE,qE,tO,gO,cO),VE($E,qE,JE,gO,cO=String.fromCharCode(55349,57334+mO)),VE(HE,qE,tO,gO,cO)}for(var vO="ÐÞþ",yO=0;yO<3;yO++){var wO=vO.charAt(yO);VE($E,qE,JE,wO,wO),VE(HE,qE,tO,wO,wO)}var bO={mathClass:"mathbf",textClass:"textbf",font:"Main-Bold"},xO={mathClass:"mathnormal",textClass:"textit",font:"Math-Italic"},kO={mathClass:"boldsymbol",textClass:"boldsymbol",font:"Main-BoldItalic"},CO={mathClass:"",textClass:"",font:""},SO={mathClass:"mathfrak",textClass:"textfrak",font:"Fraktur-Regular"},MO={mathClass:"mathbb",textClass:"textbb",font:"AMS-Regular"},NO={mathClass:"mathboldfrak",textClass:"textboldfrak",font:"Fraktur-Regular"},EO={mathClass:"mathsf",textClass:"textsf",font:"SansSerif-Regular"},OO={mathClass:"mathboldsf",textClass:"textboldsf",font:"SansSerif-Bold"},AO={mathClass:"mathitsf",textClass:"textitsf",font:"SansSerif-Italic"},TO={mathClass:"mathtt",textClass:"texttt",font:"Typewriter-Regular"},DO=[bO,bO,xO,xO,kO,kO,{mathClass:"mathscr",textClass:"textscr",font:"Script-Regular"},CO,CO,CO,SO,SO,MO,MO,NO,NO,EO,EO,OO,OO,AO,AO,CO,CO,TO,TO],IO=[bO,CO,EO,OO,TO];function _O(e){var t=e.strict,n=e.errorCode,r=e.errorMsg,o=e.token,i=e.report,s=t;if("function"==typeof t)if(i)s=t(n,r,o);else try{s=t(n,r,o)}catch(e){s="error"}switch(s){case!0:case"error":if(i)throw new VN("LaTeX-incompatible input and strict mode is set to 'error': "+r+" ["+n+"]",o);return!0;case!1:case"ignore":if(!i)return!1;break;default:if("undefined"!=typeof console&&console.warn("LaTeX-incompatible input and strict mode is set to 'warn': "+r+" ["+n+"]"),!i)return!1}}var RO=function(e,t,n){if(jE[n][e]){var r=jE[n][e].replace;r&&(e=r)}return{value:e,metrics:PE(e,t,n)}},LO=function(e,t,n,r,o){var i,s=RO(e,t,n),a=s.metrics;if(e=s.value,a){var l=a.italic;("text"===n||r&&"mathit"===r.font)&&(l=0),i=new TE(e,a.height,a.depth,l,a.skew,a.width,o)}else _O({strict:r.strict,errorCode:"symbolNotInFont",errorMsg:"No character metrics for '"+e+"' in style '"+t+"' and mode '"+n+"'",report:!0}),i=new TE(e,0,0,0,0,0,o);i.maxFontSize=r.sizeMultiplier,r.style.isTight()&&i.classes.push("mtight");var c=r.getColor();return c&&(i.style.color=c),i},BO=function(e,t,n,r){return void 0===r&&(r=[]),"boldsymbol"===n.font&&RO(e,"Main-Bold",t).metrics?LO(e,"Main-Bold",t,n,r.concat(["mathbf"])):"\\"===e||"main"===jE[t][e].font?LO(e,"Main-Regular",t,n,r):LO(e,"AMS-Regular",t,n,r.concat(["amsrm"]))},PO=function(e,t){var n="mathord"===e.type?"mathord":"textord",r=e.mode,o=e.text,i=["mord"],s=t.font,a=t.fontFamily,l=t.fontWeight,c=t.fontShape,d="math"===r||"text"===r&&!!s,u=d?s:a,h="",p="";if(55349===o.charCodeAt(0)){var f=(e=>{var t=1024*(e.charCodeAt(0)-55296)+(e.charCodeAt(1)-56320)+65536;if(119808<=t&&t<120484){var n=Math.floor((t-119808)/26);return DO[n]}if(120782<=t&&t<=120831){var r=Math.floor((t-120782)/10);return IO[r]}if(120485===t||120486===t)return DO[0];if(120486<t&&t<120782)return CO;throw new VN("Unsupported character: "+e)})(o);h=f.font,p=f[r+"Class"]}if(h)return LO(o,h,r,t,i.concat(p));if(u){var m,g;if("boldsymbol"===u){var v=function(e,t,n){return"textord"!==n&&RO(e,"Math-BoldItalic",t).metrics?{fontName:"Math-BoldItalic",fontClass:"boldsymbol"}:{fontName:"Main-Bold",fontClass:"mathbf"}}(o,r,n);m=v.fontName,g=[v.fontClass]}else d?(m=JO[s].fontName,g=[s]):(m=KO(a,l,c),g=[a,l,c]);if(RO(o,m,r).metrics)return LO(o,m,r,t,i.concat(g));if(Object.prototype.hasOwnProperty.call(nO,o)&&"Typewriter"===m.slice(0,10)){for(var y=[],w=0;w<o.length;w++)y.push(LO(o[w],m,r,t,i.concat(g)));return FO(y)}}if("mathord"===n)return LO(o,"Math-Italic",r,t,i.concat(["mathnormal"]));if("textord"===n){var b=jE[r][o]&&jE[r][o].font;if("ams"===b){var x=KO("amsrm",l,c);return LO(o,x,r,t,i.concat("amsrm",l,c))}if("main"!==b&&b){var k=KO(b,l,c);return LO(o,k,r,t,i.concat(k,l,c))}var C=KO("textrm",l,c);return LO(o,C,r,t,i.concat(l,c))}throw new Error("unexpected type: "+n+" in makeOrd")},zO=(e,t)=>{if(bE(e.classes)!==bE(t.classes)||e.skew!==t.skew||e.maxFontSize!==t.maxFontSize||0!==e.italic&&e.hasClass("mathnormal"))return!1;if(1===e.classes.length){var n=e.classes[0];if("mbin"===n||"mord"===n)return!1}for(var r of Object.keys(e.style))if(e.style[r]!==t.style[r])return!1;for(var o of Object.keys(t.style))if(e.style[o]!==t.style[o])return!1;return!0},jO=e=>{for(var t=0;t<e.length-1;t++){var n=e[t],r=e[t+1];n instanceof TE&&r instanceof TE&&zO(n,r)&&(n.text+=r.text,n.height=Math.max(n.height,r.height),n.depth=Math.max(n.depth,r.depth),n.italic=r.italic,e.splice(t+1,1),t--)}return e},VO=function(e){for(var t=0,n=0,r=0,o=0;o<e.children.length;o++){var i=e.children[o];i.height>t&&(t=i.height),i.depth>n&&(n=i.depth),i.maxFontSize>r&&(r=i.maxFontSize)}e.height=t,e.depth=n,e.maxFontSize=r},$O=function(e,t,n,r){var o=new NE(e,t,n,r);return VO(o),o},HO=(e,t,n,r)=>new NE(e,t,n,r),qO=function(e,t,n){var r=$O([e],[],t);return r.height=Math.max(n||t.fontMetrics().defaultRuleThickness,t.minRuleThickness),r.style.borderBottomWidth=wE(r.height),r.maxFontSize=1,r},FO=function(e){var t=new fE(e);return VO(t),t},WO=function(e,t){return e instanceof fE?$O([],[e],t):e},UO=function(e,t){for(var n=function(e){if("individualShift"===e.positionType){for(var t=e.children,n=[t[0]],r=-t[0].shift-t[0].elem.depth,o=r,i=1;i<t.length;i++){var s=-t[i].shift-o-t[i].elem.depth,a=s-(t[i-1].elem.height+t[i-1].elem.depth);o+=s,n.push({type:"kern",size:a}),n.push(t[i])}return{children:n,depth:r}}var l;if("top"===e.positionType){for(var c=e.positionData,d=0;d<e.children.length;d++){var u=e.children[d];c-="kern"===u.type?u.size:u.elem.height+u.elem.depth}l=c}else if("bottom"===e.positionType)l=-e.positionData;else{var h=e.children[0];if("elem"!==h.type)throw new Error('First child must have type "elem".');if("shift"===e.positionType)l=-h.elem.depth-e.positionData;else{if("firstBaseline"!==e.positionType)throw new Error("Invalid positionType "+e.positionType+".");l=-h.elem.depth}}return{children:e.children,depth:l}}(e),r=n.children,o=n.depth,i=0,s=0;s<r.length;s++){var a=r[s];if("elem"===a.type){var l=a.elem;i=Math.max(i,l.maxFontSize,l.height)}}i+=2;var c=$O(["pstrut"],[]);c.style.height=wE(i);for(var d=[],u=o,h=o,p=o,f=0;f<r.length;f++){var m=r[f];if("kern"===m.type)p+=m.size;else{var g=m.elem,v=m.wrapperClasses||[],y=m.wrapperStyle||{},w=$O(v,[c,g],void 0,y);w.style.top=wE(-i-p-g.depth),m.marginLeft&&(w.style.marginLeft=m.marginLeft),m.marginRight&&(w.style.marginRight=m.marginRight),d.push(w),p+=g.height+g.depth}u=Math.min(u,p),h=Math.max(h,p)}var b,x=$O(["vlist"],d);if(x.style.height=wE(h),u<0){var k=$O([],[]),C=$O(["vlist"],[k]);C.style.height=wE(-u);var S=$O(["vlist-s"],[new TE("​")]);b=[$O(["vlist-r"],[x,S]),$O(["vlist-r"],[C])]}else b=[$O(["vlist-r"],[x])];var M=$O(["vlist-t"],b);return 2===b.length&&M.classes.push("vlist-t2"),M.height=h,M.depth=-u,M},GO=(e,t)=>{var n=$O(["mspace"],[],t),r=yE(e,t);return n.style.marginRight=wE(r),n},KO=(e,t,n)=>{var r;switch(e){case"amsrm":r="AMS";break;case"textrm":r="Main";break;case"textsf":r="SansSerif";break;case"texttt":r="Typewriter";break;default:r=e}return r+"-"+("textbf"===t&&"textit"===n?"BoldItalic":"textbf"===t?"Bold":"textit"===n?"Italic":"Regular")},JO={mathbf:{variant:"bold",fontName:"Main-Bold"},mathrm:{variant:"normal",fontName:"Main-Regular"},textit:{variant:"italic",fontName:"Main-Italic"},mathit:{variant:"italic",fontName:"Main-Italic"},mathnormal:{variant:"italic",fontName:"Math-Italic"},mathsfit:{variant:"sans-serif-italic",fontName:"SansSerif-Italic"},mathbb:{variant:"double-struck",fontName:"AMS-Regular"},mathcal:{variant:"script",fontName:"Caligraphic-Regular"},mathfrak:{variant:"fraktur",fontName:"Fraktur-Regular"},mathscr:{variant:"script",fontName:"Script-Regular"},mathsf:{variant:"sans-serif",fontName:"SansSerif-Regular"},mathtt:{variant:"monospace",fontName:"Typewriter-Regular"}},ZO={vec:["vec",.471,.714],oiintSize1:["oiintSize1",.957,.499],oiintSize2:["oiintSize2",1.472,.659],oiiintSize1:["oiiintSize1",1.304,.499],oiiintSize2:["oiiintSize2",1.98,.659]},YO=function(e,t){var n=ZO[e],r=n[0],o=n[1],i=n[2],s=new IE(r),a=new DE([s],{width:wE(o),height:wE(i),style:"width:"+wE(o),viewBox:"0 0 "+1e3*o+" "+1e3*i,preserveAspectRatio:"xMinYMin"}),l=HO(["katex-overlay"],[a],t);return l.height=i,l.style.height=wE(i),l.style.width=wE(o),l},XO={number:3,unit:"mu"},QO={number:4,unit:"mu"},eA={number:5,unit:"mu"},tA={mord:{mop:XO,mbin:QO,mrel:eA,minner:XO},mop:{mord:XO,mop:XO,mrel:eA,minner:XO},mbin:{mord:QO,mop:QO,mopen:QO,minner:QO},mrel:{mord:eA,mop:eA,mopen:eA,minner:eA},mopen:{},mclose:{mop:XO,mbin:QO,mrel:eA,minner:XO},mpunct:{mord:XO,mop:XO,mrel:eA,mopen:XO,mclose:XO,mpunct:XO,minner:XO},minner:{mord:XO,mop:XO,mbin:QO,mrel:eA,mopen:XO,mpunct:XO,minner:XO}},nA={mord:{mop:XO},mop:{mord:XO,mop:XO},mbin:{},mrel:{},mopen:{},mclose:{mop:XO},mpunct:{},minner:{mop:XO}},rA={},oA={},iA={};function sA(e){for(var t=e.type,n=e.names,r=e.htmlBuilder,o=e.mathmlBuilder,i=0;i<n.length;++i)rA[n[i]]=e;t&&(r&&(oA[t]=r),o&&(iA[t]=o))}function aA(e){var t=e.type,n=e.htmlBuilder,r=e.mathmlBuilder;n&&(oA[t]=n),r&&(iA[t]=r)}var lA=function(e){return"ordgroup"===e.type&&1===e.body.length?e.body[0]:e},cA=function(e){return"ordgroup"===e.type?e.body:[e]},dA=new Set(["leftmost","mbin","mopen","mrel","mop","mpunct"]),uA=new Set(["rightmost","mrel","mclose","mpunct"]),hA={display:aE.DISPLAY,text:aE.TEXT,script:aE.SCRIPT,scriptscript:aE.SCRIPTSCRIPT},pA={mord:"mord",mop:"mop",mbin:"mbin",mrel:"mrel",mopen:"mopen",mclose:"mclose",mpunct:"mpunct",minner:"minner"},fA=function(e,t,n,r){void 0===r&&(r=[null,null]);for(var o=[],i=0;i<e.length;i++){var s=bA(e[i],t);if(s instanceof fE){var a=s.children;o.push(...a)}else o.push(s)}if(jO(o),!n)return o;var l=t;if(1===e.length){var c=e[0];"sizing"===c.type?l=t.havingSize(c.size):"styling"===c.type&&(l=t.havingStyle(hA[c.style]))}var d=$O([r[0]||"leftmost"],[],t),u=$O([r[1]||"rightmost"],[],t),h="root"===n;return mA(o,(e,t)=>{var n=t.classes[0],r=e.classes[0];"mbin"===n&&uA.has(r)?t.classes[0]="mord":"mbin"===r&&dA.has(n)&&(e.classes[0]="mord")},{node:d},u,h),mA(o,(e,t)=>{var n,r,o=yA(t),i=yA(e),s=o&&i?e.hasClass("mtight")?null==(n=nA[o])?void 0:n[i]:null==(r=tA[o])?void 0:r[i]:null;if(s)return GO(s,l)},{node:d},u,h),o},mA=function(e,t,n,r,o){r&&e.push(r);for(var i=0;i<e.length;i++){var s=e[i],a=gA(s);if(a)mA(a.children,t,n,null,o);else{var l=!s.hasClass("mspace");if(l){var c=t(s,n.node);c&&(n.insertAfter?n.insertAfter(c):(e.unshift(c),i++))}l?n.node=s:o&&s.hasClass("katex-newline")&&(n.node=$O(["leftmost"])),n.insertAfter=(t=>n=>{e.splice(t+1,0,n),i++})(i)}}r&&e.pop()},gA=function(e){return e instanceof fE||e instanceof EE||e instanceof NE&&e.hasClass("enclosing")?e:null},vA=function(e,t){var n=gA(e);if(n){var r=n.children;if(r.length){if("right"===t)return vA(r[r.length-1],"right");if("left"===t)return vA(r[0],"left")}}return e},yA=function(e,t){if(!e)return null;t&&(e=vA(e,t));var n=e.classes[0];return pA[n]||null},wA=function(e,t){var n=["nulldelimiter"].concat(e.baseSizingClasses());return $O(t.concat(n))},bA=function(e,t,n){if(!e)return $O();if(oA[e.type]){var r=oA[e.type](e,t);if(n&&t.size!==n.size){r=$O(t.sizingClasses(n),[r],t);var o=t.sizeMultiplier/n.sizeMultiplier;r.height*=o,r.depth*=o}return r}throw new VN("Got group of unknown type: '"+e.type+"'")};function xA(e,t){var n=$O(["katex-base"],e,t),r=$O(["katex-strut"]);return r.style.height=wE(n.height+n.depth),n.depth&&(r.style.verticalAlign=wE(-n.depth)),n.children.unshift(r),n}function kA(e,t){var n=null;1===e.length&&"tag"===e[0].type&&(n=e[0].tag,e=e[0].body);var r,o=fA(e,t,"root");2===o.length&&o[1].hasClass("katex-tag")&&(r=o.pop());for(var i,s=[],a=[],l=0;l<o.length;l++)if(a.push(o[l]),o[l].hasClass("mbin")||o[l].hasClass("mrel")||o[l].hasClass("allowbreak")){for(var c=!1;l<o.length-1&&o[l+1].hasClass("mspace")&&!o[l+1].hasClass("katex-newline");)l++,a.push(o[l]),o[l].hasClass("nobreak")&&(c=!0);c||(s.push(xA(a,t)),a=[])}else o[l].hasClass("katex-newline")&&(a.pop(),a.length>0&&(s.push(xA(a,t)),a=[]),s.push(o[l]));a.length>0&&s.push(xA(a,t)),n?((i=xA(fA(n,t,!0),t)).classes=["katex-tag"],s.push(i)):r&&s.push(r);var d=$O(["katex-html"],s);if(d.setAttribute("aria-hidden","true"),i){var u=i.children[0];u.style.height=wE(d.height+d.depth),d.depth&&(u.style.verticalAlign=wE(-d.depth))}return d}function CA(e){return new fE(e)}class SA{constructor(e,t,n){this.type=void 0,this.attributes=void 0,this.children=void 0,this.classes=void 0,this.type=e,this.attributes={},this.children=t||[],this.classes=n||[]}setAttribute(e,t){this.attributes[e]=t}getAttribute(e){return this.attributes[e]}toNode(){var e=document.createElementNS("http://www.w3.org/1998/Math/MathML",this.type);for(var t of Object.entries(this.attributes)){var n=t[0],r=t[1];e.setAttribute(n,r)}this.classes.length>0&&(e.className=bE(this.classes));for(var o=0;o<this.children.length;o++)if(this.children[o]instanceof MA&&this.children[o+1]instanceof MA){for(var i=this.children[o].toText()+this.children[++o].toText();this.children[o+1]instanceof MA;)i+=this.children[++o].toText();e.appendChild(new MA(i).toNode())}else e.appendChild(this.children[o].toNode());return e}toMarkup(){var e="<"+this.type;for(var t of Object.entries(this.attributes)){var n=t[0],r=t[1];e+=" "+n+'="',e+=WN(r),e+='"'}this.classes.length>0&&(e+=' class ="'+WN(bE(this.classes))+'"'),e+=">";for(var o=0;o<this.children.length;o++)e+=this.children[o].toMarkup();return e+="</"+this.type+">"}toText(){return this.children.map(e=>e.toText()).join("")}}class MA{constructor(e){this.text=void 0,this.text=e}toNode(){return document.createTextNode(this.text)}toMarkup(){return WN(this.toText())}toText(){return this.text}}class NA{constructor(e){this.width=void 0,this.character=void 0,this.width=e,this.character=e>=.05555&&e<=.05556?" ":e>=.1666&&e<=.1667?" ":e>=.2222&&e<=.2223?" ":e>=.2777&&e<=.2778?"  ":e>=-.05556&&e<=-.05555?" ⁣":e>=-.1667&&e<=-.1666?" ⁣":e>=-.2223&&e<=-.2222?" ⁣":e>=-.2778&&e<=-.2777?" ⁣":null}toNode(){if(this.character)return document.createTextNode(this.character);var e=document.createElementNS("http://www.w3.org/1998/Math/MathML","mspace");return e.setAttribute("width",wE(this.width)),e}toMarkup(){return this.character?"<mtext>"+this.character+"</mtext>":'<mspace width="'+wE(this.width)+'"/>'}toText(){return this.character?this.character:" "}}var EA=new Set(["\\imath","\\jmath"]),OA=new Set(["mrow","mtable"]),AA=function(e,t,n){var r,o;return jE[t][e]&&jE[t][e].replace&&55349!==e.charCodeAt(0)&&(!Object.prototype.hasOwnProperty.call(nO,e)||"tt"!==(null==n||null==(r=n.fontFamily)?void 0:r.slice(4,6))&&"tt"!==(null==n||null==(o=n.font)?void 0:o.slice(4,6)))&&(e=jE[t][e].replace),new MA(e)},TA=function(e){return 1===e.length?e[0]:new SA("mrow",e)},DA={mathit:"italic",boldsymbol:e=>"textord"===e.type?"bold":"bold-italic",mathbf:"bold",mathbb:"double-struck",mathsfit:"sans-serif-italic",mathfrak:"fraktur",mathscr:"script",mathcal:"script",mathsf:"sans-serif",mathtt:"monospace"},IA=(e,t)=>{if("text"===e.mode){if("texttt"===t.fontFamily)return"monospace";if("textsf"===t.fontFamily)return"textit"===t.fontShape&&"textbf"===t.fontWeight?"sans-serif-bold-italic":"textit"===t.fontShape?"sans-serif-italic":"textbf"===t.fontWeight?"bold-sans-serif":"sans-serif";if("textit"===t.fontShape&&"textbf"===t.fontWeight)return"bold-italic";if("textit"===t.fontShape)return"italic";if("textbf"===t.fontWeight)return"bold"}var n=t.font;if(!n||"mathnormal"===n)return null;var r=e.mode,o=DA[n];if(o)return"function"==typeof o?o(e):o;var i=e.text;if(EA.has(i))return null;if(jE[r][i]){var s=jE[r][i].replace;s&&(i=s)}return PE(i,JO[n].fontName,r)?JO[n].variant:null};function _A(e){if(!e)return!1;if("mi"===e.type&&1===e.children.length){var t=e.children[0];return t instanceof MA&&"."===t.text}if("mo"===e.type&&1===e.children.length&&"true"===e.getAttribute("separator")&&"0em"===e.getAttribute("lspace")&&"0em"===e.getAttribute("rspace")){var n=e.children[0];return n instanceof MA&&","===n.text}return!1}var RA=function(e,t,n){if(1===e.length){var r=BA(e[0],t);return n&&r instanceof SA&&"mo"===r.type&&(r.setAttribute("lspace","0em"),r.setAttribute("rspace","0em")),[r]}for(var o,i=[],s=0;s<e.length;s++){var a=BA(e[s],t);if(a instanceof SA&&o instanceof SA){if("mtext"===a.type&&"mtext"===o.type&&a.getAttribute("mathvariant")===o.getAttribute("mathvariant")){o.children.push(...a.children);continue}if("mn"===a.type&&"mn"===o.type){o.children.push(...a.children);continue}if(_A(a)&&"mn"===o.type){o.children.push(...a.children);continue}if("mn"===a.type&&_A(o))a.children=[...o.children,...a.children],i.pop();else if(("msup"===a.type||"msub"===a.type)&&a.children.length>=1&&("mn"===o.type||_A(o))){var l=a.children[0];l instanceof SA&&"mn"===l.type&&(l.children=[...o.children,...l.children],i.pop())}else if("mi"===o.type&&1===o.children.length){var c=o.children[0];if(c instanceof MA&&"̸"===c.text&&("mo"===a.type||"mi"===a.type||"mn"===a.type)){var d=a.children[0];d instanceof MA&&d.text.length>0&&(d.text=d.text.slice(0,1)+"̸"+d.text.slice(1),i.pop())}}}i.push(a),o=a}return i},LA=function(e,t,n){return TA(RA(e,t,n))},BA=function(e,t){if(!e)return new SA("mrow");if(iA[e.type])return iA[e.type](e,t);throw new VN("Got group of unknown type: '"+e.type+"'")};function PA(e,t,n,r,o){var i,s=RA(e,n);i=1===s.length&&s[0]instanceof SA&&OA.has(s[0].type)?s[0]:new SA("mrow",s);var a=new SA("annotation",[new MA(t)]);a.setAttribute("encoding","application/x-tex");var l=new SA("semantics",[i,a]),c=new SA("math",[l]);return c.setAttribute("xmlns","http://www.w3.org/1998/Math/MathML"),r&&c.setAttribute("display","block"),$O([o?"katex":"katex-mathml"],[c])}var zA=[[1,1,1],[2,1,1],[3,1,1],[4,2,1],[5,2,1],[6,3,1],[7,4,2],[8,6,3],[9,7,6],[10,8,7],[11,10,9]],jA=[.5,.6,.7,.8,.9,1,1.2,1.44,1.728,2.074,2.488],VA=function(e,t){return t.size<2?e:zA[e-1][t.size-1]};class $A{constructor(e){this.style=void 0,this.color=void 0,this.size=void 0,this.textSize=void 0,this.phantom=void 0,this.font=void 0,this.fontFamily=void 0,this.fontWeight=void 0,this.fontShape=void 0,this.sizeMultiplier=void 0,this.maxSize=void 0,this.minRuleThickness=void 0,this._fontMetrics=void 0,this.strict=void 0,this.style=e.style,this.color=e.color,this.size=e.size||$A.BASESIZE,this.textSize=e.textSize||this.size,this.phantom=!!e.phantom,this.font=e.font||"",this.fontFamily=e.fontFamily||"",this.fontWeight=e.fontWeight||"",this.fontShape=e.fontShape||"",this.sizeMultiplier=jA[this.size-1],this.maxSize=e.maxSize,this.minRuleThickness=e.minRuleThickness,this.strict=e.strict,this._fontMetrics=void 0}extend(e){var t={style:this.style,size:this.size,textSize:this.textSize,color:this.color,phantom:this.phantom,font:this.font,fontFamily:this.fontFamily,fontWeight:this.fontWeight,fontShape:this.fontShape,maxSize:this.maxSize,minRuleThickness:this.minRuleThickness,strict:this.strict};return Object.assign(t,e),new $A(t)}havingStyle(e){return this.style===e?this:this.extend({style:e,size:VA(this.textSize,e)})}havingCrampedStyle(){return this.havingStyle(this.style.cramp())}havingSize(e){return this.size===e&&this.textSize===e?this:this.extend({style:this.style.text(),size:e,textSize:e,sizeMultiplier:jA[e-1]})}havingBaseStyle(e){e=e||this.style.text();var t=VA($A.BASESIZE,e);return this.size===t&&this.textSize===$A.BASESIZE&&this.style===e?this:this.extend({style:e,size:t})}havingBaseSizing(){var e;switch(this.style.id){case 4:case 5:e=3;break;case 6:case 7:e=1;break;default:e=6}return this.extend({style:this.style.text(),size:e})}withColor(e){return this.extend({color:e})}withPhantom(){return this.extend({phantom:!0})}withFont(e){return this.extend({font:e})}withTextFontFamily(e){return this.extend({fontFamily:e,font:""})}withTextFontWeight(e){return this.extend({fontWeight:e,font:""})}withTextFontShape(e){return this.extend({fontShape:e,font:""})}sizingClasses(e){return e.size!==this.size?["katex-sizing","reset-size"+e.size,"size"+this.size]:[]}baseSizingClasses(){return this.size!==$A.BASESIZE?["katex-sizing","reset-size"+this.size,"size"+$A.BASESIZE]:[]}fontMetrics(){return this._fontMetrics||(this._fontMetrics=function(e){var t;if(!zE[t=e>=5?0:e>=3?1:2]){var n=zE[t]={cssEmPerMu:LE.quad[t]/18};for(var r of Object.keys(LE))n[r]=LE[r][t]}return zE[t]}(this.size)),this._fontMetrics}getColor(){return this.phantom?"transparent":this.color}}$A.BASESIZE=6;var HA=e=>new $A({style:e.displayMode?aE.DISPLAY:aE.TEXT,maxSize:e.maxSize,minRuleThickness:e.minRuleThickness,strict:e.strict}),qA=function(e,t){if(t.displayMode){var n=["katex-display"];t.leqno&&n.push("leqno"),t.fleqn&&n.push("fleqn"),e=$O(n,[e])}return e},FA={widehat:"^",widecheck:"ˇ",widetilde:"~",utilde:"~",overleftarrow:"←",underleftarrow:"←",xleftarrow:"←",overrightarrow:"→",underrightarrow:"→",xrightarrow:"→",underbrace:"⏟",overbrace:"⏞",underbracket:"⎵",overbracket:"⎴",overgroup:"⏠",undergroup:"⏡",overleftrightarrow:"↔",underleftrightarrow:"↔",xleftrightarrow:"↔",Overrightarrow:"⇒",xRightarrow:"⇒",overleftharpoon:"↼",xleftharpoonup:"↼",overrightharpoon:"⇀",xrightharpoonup:"⇀",xLeftarrow:"⇐",xLeftrightarrow:"⇔",xhookleftarrow:"↩",xhookrightarrow:"↪",xmapsto:"↦",xrightharpoondown:"⇁",xleftharpoondown:"↽",xrightleftharpoons:"⇌",xleftrightharpoons:"⇋",xtwoheadleftarrow:"↞",xtwoheadrightarrow:"↠",xlongequal:"=",xtofrom:"⇄",xrightleftarrows:"⇄",xrightequilibrium:"⇌",xleftequilibrium:"⇋","\\cdrightarrow":"→","\\cdleftarrow":"←","\\cdlongequal":"="},WA=function(e){var t=new SA("mo",[new MA(FA[e.replace(/^\\/,"")])]);return t.setAttribute("stretchy","true"),t},UA={overrightarrow:[["rightarrow"],.888,522,"xMaxYMin"],overleftarrow:[["leftarrow"],.888,522,"xMinYMin"],underrightarrow:[["rightarrow"],.888,522,"xMaxYMin"],underleftarrow:[["leftarrow"],.888,522,"xMinYMin"],xrightarrow:[["rightarrow"],1.469,522,"xMaxYMin"],"\\cdrightarrow":[["rightarrow"],3,522,"xMaxYMin"],xleftarrow:[["leftarrow"],1.469,522,"xMinYMin"],"\\cdleftarrow":[["leftarrow"],3,522,"xMinYMin"],Overrightarrow:[["doublerightarrow"],.888,560,"xMaxYMin"],xRightarrow:[["doublerightarrow"],1.526,560,"xMaxYMin"],xLeftarrow:[["doubleleftarrow"],1.526,560,"xMinYMin"],overleftharpoon:[["leftharpoon"],.888,522,"xMinYMin"],xleftharpoonup:[["leftharpoon"],.888,522,"xMinYMin"],xleftharpoondown:[["leftharpoondown"],.888,522,"xMinYMin"],overrightharpoon:[["rightharpoon"],.888,522,"xMaxYMin"],xrightharpoonup:[["rightharpoon"],.888,522,"xMaxYMin"],xrightharpoondown:[["rightharpoondown"],.888,522,"xMaxYMin"],xlongequal:[["longequal"],.888,334,"xMinYMin"],"\\cdlongequal":[["longequal"],3,334,"xMinYMin"],xtwoheadleftarrow:[["twoheadleftarrow"],.888,334,"xMinYMin"],xtwoheadrightarrow:[["twoheadrightarrow"],.888,334,"xMaxYMin"],overleftrightarrow:[["leftarrow","rightarrow"],.888,522],overbrace:[["leftbrace","midbrace","rightbrace"],1.6,548],underbrace:[["leftbraceunder","midbraceunder","rightbraceunder"],1.6,548],underleftrightarrow:[["leftarrow","rightarrow"],.888,522],xleftrightarrow:[["leftarrow","rightarrow"],1.75,522],xLeftrightarrow:[["doubleleftarrow","doublerightarrow"],1.75,560],xrightleftharpoons:[["leftharpoondownplus","rightharpoonplus"],1.75,716],xleftrightharpoons:[["leftharpoonplus","rightharpoondownplus"],1.75,716],xhookleftarrow:[["leftarrow","righthook"],1.08,522],xhookrightarrow:[["lefthook","rightarrow"],1.08,522],overlinesegment:[["leftlinesegment","rightlinesegment"],.888,522],underlinesegment:[["leftlinesegment","rightlinesegment"],.888,522],overbracket:[["leftbracketover","rightbracketover"],1.6,440],underbracket:[["leftbracketunder","rightbracketunder"],1.6,410],overgroup:[["leftgroup","rightgroup"],.888,342],undergroup:[["leftgroupunder","rightgroupunder"],.888,342],xmapsto:[["leftmapsto","rightarrow"],1.5,522],xtofrom:[["leftToFrom","rightToFrom"],1.75,528],xrightleftarrows:[["baraboveleftarrow","rightarrowabovebar"],1.75,901],xrightequilibrium:[["baraboveshortleftharpoon","rightharpoonaboveshortbar"],1.75,716],xleftequilibrium:[["shortbaraboveleftharpoon","shortrightharpoonabovebar"],1.75,716]},GA=new Set(["widehat","widecheck","widetilde","utilde"]),KA=function(e,t){var n=function(){var n=4e5,r=e.label.slice(1);if(GA.has(r)&&"base"in e){var o,i,s,a="ordgroup"===e.base.type?e.base.body.length:1;if(a>5)"widehat"===r||"widecheck"===r?(o=420,n=2364,s=.42,i=r+"4"):(o=312,n=2340,s=.34,i="tilde4");else{var l=[1,1,2,2,3,3][a];"widehat"===r||"widecheck"===r?(n=[0,1062,2364,2364,2364][l],o=[0,239,300,360,420][l],s=[0,.24,.3,.3,.36,.42][l],i=r+l):(n=[0,600,1033,2339,2340][l],o=[0,260,286,306,312][l],s=[0,.26,.286,.3,.306,.34][l],i="tilde"+l)}var c=new IE(i),d=new DE([c],{width:"100%",height:wE(s),viewBox:"0 0 "+n+" "+o,preserveAspectRatio:"none"});return{span:HO([],[d],t),minWidth:0,height:s}}var u=[],h=UA[r];if(!h)throw new Error('No SVG data for "'+r+'".');var p,f,m=h[0],g=h[1],v=h[2],y=v/1e3,w=m.length;if(1===w){if(4!==h.length)throw new Error('Expected 4-tuple for single-path SVG data "'+r+'".');p=["hide-tail"],f=[h[3]]}else if(2===w)p=["halfarrow-left","halfarrow-right"],f=["xMinYMin","xMaxYMin"];else{if(3!==w)throw new Error("Correct katexImagesData or update code here to support\n "+w+" children.");p=["brace-left","brace-center","brace-right"],f=["xMinYMin","xMidYMin","xMaxYMin"]}for(var b=0;b<w;b++){var x=new IE(m[b]),k=new DE([x],{width:"400em",height:wE(y),viewBox:"0 0 "+n+" "+v,preserveAspectRatio:f[b]+" slice"}),C=HO([p[b]],[k],t);if(1===w)return{span:C,minWidth:g,height:y};C.style.height=wE(y),u.push(C)}return{span:$O(["katex-stretchy"],u,t),minWidth:g,height:y}}(),r=n.span,o=n.minWidth,i=n.height;return r.height=i,r.style.height=wE(i),o>0&&(r.style.minWidth=wE(o)),r},JA=new Set(["bin","close","inner","open","punct","rel"]),ZA=new Set(["accent-token","mathord","op-token","spacing","textord"]);function YA(e,t){if(!e||e.type!==t)throw new Error("Expected node of type "+t+", but got "+(e?"node of type "+e.type:String(e)));return e}function XA(e){var t=QA(e);if(!t)throw new Error("Expected node of symbol group type, but got "+(e?"node of type "+e.type:String(e)));return t}function QA(e){return"atom"===e.type||ZA.has(e.type)?e:null}function eT(e,t,n){var r="";for(var o of e.body)if("textord"===o.type)r+=o.text;else{if(!n||"spacing"!==o.type||" "!==o.text)throw new VN(t,e);r+=" "}return r}var tT=e=>{return e instanceof TE?e:((t=e)instanceof NE||t instanceof EE||t instanceof fE)&&1===e.children.length?tT(e.children[0]):void 0;var t},nT=(e,t)=>{var n,r,o;e&&"supsub"===e.type?(n=(r=YA(e.base,"accent")).base,e.base=n,o=function(e){if(e instanceof NE)return e;throw new Error("Expected span<HtmlDomNode> but got "+String(e)+".")}(bA(e,t)),e.base=r):n=(r=YA(e,"accent")).base;var i,s,a=bA(n,t.havingCrampedStyle()),l=0;r.isShifty&&KN(n)&&(l=null!=(i=null==(s=tT(a))?void 0:s.skew)?i:0);var c,d="\\c"===r.label,u=d?a.height+a.depth:Math.min(a.height,t.fontMetrics().xHeight);if(r.isStretchy)c=KA(r,t),c=UO({positionType:"firstBaseline",children:[{type:"elem",elem:a},{type:"elem",elem:c,wrapperClasses:["svg-align"],wrapperStyle:l>0?{width:"calc(100% - "+wE(2*l)+")",marginLeft:wE(2*l)}:void 0}]});else{var h,p;"\\vec"===r.label?(h=YO("vec",t),p=ZO.vec[1]):(h=function(e){if(e instanceof TE)return e;throw new Error("Expected symbolNode but got "+String(e)+".")}(h=PO({type:"textord",mode:r.mode,text:r.label},t)),h.italic=0,p=h.width,d&&(u+=h.depth)),c=$O(["accent-body"],[h]);var f="\\textcircled"===r.label;f&&(c.classes.push("accent-full"),u=a.height);var m=l;f||(m-=p/2),c.style.left=wE(m),"\\textcircled"===r.label&&(c.style.top=".2em"),c=UO({positionType:"firstBaseline",children:[{type:"elem",elem:a},{type:"kern",size:-u},{type:"elem",elem:c}]})}var g=$O(["mord","katex-accent"],[c],t);return o?(o.children[0]=g,o.height=Math.max(g.height,o.height),o.classes[0]="mord",o):g},rT=new RegExp(["\\acute","\\grave","\\ddot","\\tilde","\\bar","\\breve","\\check","\\hat","\\vec","\\dot","\\mathring"].map(e=>"\\"+e).join("|"));sA({type:"accent",names:["\\acute","\\grave","\\ddot","\\tilde","\\bar","\\breve","\\check","\\hat","\\vec","\\dot","\\mathring","\\widecheck","\\widehat","\\widetilde","\\overrightarrow","\\overleftarrow","\\Overrightarrow","\\overleftrightarrow","\\overgroup","\\overlinesegment","\\overleftharpoon","\\overrightharpoon"],numArgs:1,handler:(e,t)=>{var n=lA(t[0]),r=!rT.test(e.funcName),o=!r||"\\widehat"===e.funcName||"\\widetilde"===e.funcName||"\\widecheck"===e.funcName;return{type:"accent",mode:e.parser.mode,label:e.funcName,isStretchy:r,isShifty:o,base:n}},htmlBuilder:nT,mathmlBuilder:(e,t)=>{var n=e.isStretchy?WA(e.label):new SA("mo",[AA(e.label,e.mode)]),r=new SA("mover",[BA(e.base,t),n]);return r.setAttribute("accent","true"),r}}),sA({type:"accent",names:["\\'","\\`","\\^","\\~","\\=","\\u","\\.",'\\"',"\\c","\\r","\\H","\\v","\\textcircled"],numArgs:1,allowedInText:!0,allowedInMath:!0,argTypes:["primitive"],handler:(e,t)=>{var n=t[0],r=e.parser.mode;return"math"===r&&(_O({strict:e.parser.settings.strict,errorCode:"mathVsTextAccents",errorMsg:"LaTeX's accent "+e.funcName+" works only in text mode",report:!0}),r="text"),{type:"accent",mode:r,label:e.funcName,isStretchy:!1,isShifty:!0,base:n}}}),sA({type:"accentUnder",names:["\\underleftarrow","\\underrightarrow","\\underleftrightarrow","\\undergroup","\\underlinesegment","\\utilde"],numArgs:1,handler:(e,t)=>{var n=e.parser,r=e.funcName,o=t[0];return{type:"accentUnder",mode:n.mode,label:r,base:o}},htmlBuilder:(e,t)=>{var n=bA(e.base,t),r=KA(e,t),o="\\utilde"===e.label?.12:0,i=UO({positionType:"top",positionData:n.height,children:[{type:"elem",elem:r,wrapperClasses:["svg-align"]},{type:"kern",size:o},{type:"elem",elem:n}]});return $O(["mord","accentunder"],[i],t)},mathmlBuilder:(e,t)=>{var n=WA(e.label),r=new SA("munder",[BA(e.base,t),n]);return r.setAttribute("accentunder","true"),r}});var oT=e=>{var t=new SA("mpadded",e?[e]:[]);return t.setAttribute("width","+0.6em"),t.setAttribute("lspace","0.3em"),t};sA({type:"xArrow",names:["\\xleftarrow","\\xrightarrow","\\xLeftarrow","\\xRightarrow","\\xleftrightarrow","\\xLeftrightarrow","\\xhookleftarrow","\\xhookrightarrow","\\xmapsto","\\xrightharpoondown","\\xrightharpoonup","\\xleftharpoondown","\\xleftharpoonup","\\xrightleftharpoons","\\xleftrightharpoons","\\xlongequal","\\xtwoheadrightarrow","\\xtwoheadleftarrow","\\xtofrom","\\xrightleftarrows","\\xrightequilibrium","\\xleftequilibrium","\\\\cdrightarrow","\\\\cdleftarrow","\\\\cdlongequal"],numArgs:1,numOptionalArgs:1,handler(e,t,n){var r=e.parser,o=e.funcName;return{type:"xArrow",mode:r.mode,label:o,body:t[0],below:n[0]}},htmlBuilder(e,t){var n,r=t.style,o=t.havingStyle(r.sup()),i=WO(bA(e.body,o,t),t),s="\\x"===e.label.slice(0,2)?"x":"cd";i.classes.push(s+"-arrow-pad"),e.below&&(o=t.havingStyle(r.sub()),(n=WO(bA(e.below,o,t),t)).classes.push(s+"-arrow-pad"));var a,l=KA(e,t),c=-t.fontMetrics().axisHeight+.5*l.height,d=-t.fontMetrics().axisHeight-.5*l.height-.111;if((i.depth>.25||"\\xleftequilibrium"===e.label)&&(d-=i.depth),n){var u=-t.fontMetrics().axisHeight+n.height+.5*l.height+.111;a=UO({positionType:"individualShift",children:[{type:"elem",elem:i,shift:d},{type:"elem",elem:l,shift:c,wrapperClasses:["svg-align"]},{type:"elem",elem:n,shift:u}]})}else a=UO({positionType:"individualShift",children:[{type:"elem",elem:i,shift:d},{type:"elem",elem:l,shift:c,wrapperClasses:["svg-align"]}]});return $O(["mrel","x-arrow"],[a],t)},mathmlBuilder(e,t){var n,r=WA(e.label);if(r.setAttribute("minsize","x"===e.label.charAt(0)?"1.75em":"3.0em"),e.body){var o=oT(BA(e.body,t));if(e.below){var i=oT(BA(e.below,t));n=new SA("munderover",[r,i,o])}else n=new SA("mover",[r,o])}else if(e.below){var s=oT(BA(e.below,t));n=new SA("munder",[r,s])}else n=oT(),n=new SA("mover",[r,n]);return n}}),sA({type:"mclass",names:["\\mathord","\\mathbin","\\mathrel","\\mathopen","\\mathclose","\\mathpunct","\\mathinner"],numArgs:1,primitive:!0,handler(e,t){var n=e.parser,r=e.funcName,o=t[0];return{type:"mclass",mode:n.mode,mclass:"m"+r.slice(5),body:cA(o),isCharacterBox:KN(o)}},htmlBuilder:function(e,t){var n=fA(e.body,t,!0);return $O([e.mclass],n,t)},mathmlBuilder:function(e,t){var n,r=RA(e.body,t);return"minner"===e.mclass?n=new SA("mpadded",r):"mord"===e.mclass?e.isCharacterBox?(n=r[0]).type="mi":n=new SA("mi",r):(e.isCharacterBox?(n=r[0]).type="mo":n=new SA("mo",r),"mbin"===e.mclass?(n.attributes.lspace="0.22em",n.attributes.rspace="0.22em"):"mpunct"===e.mclass?(n.attributes.lspace="0em",n.attributes.rspace="0.17em"):"mopen"!==e.mclass&&"mclose"!==e.mclass||(n.attributes.lspace="0em",n.attributes.rspace="0em")),n}});var iT=e=>{var t="ordgroup"===e.type&&e.body.length?e.body[0]:e;return"atom"!==t.type||"bin"!==t.family&&"rel"!==t.family?"mord":"m"+t.family};sA({type:"mclass",names:["\\@binrel"],numArgs:2,handler:(e,t)=>({type:"mclass",mode:e.parser.mode,mclass:iT(t[0]),body:cA(t[1]),isCharacterBox:KN(t[1])})}),sA({type:"mclass",names:["\\stackrel","\\overset","\\underset"],numArgs:2,handler(e,t){var n,r=e.parser,o=e.funcName,i=t[1],s=t[0];n="\\stackrel"!==o?iT(i):"mrel";var a={type:"op",mode:i.mode,limits:!0,alwaysHandleSupSub:!0,parentIsSupSub:!1,symbol:!1,suppressBaseShift:"\\stackrel"!==o,body:cA(i)},l="\\underset"===o?{type:"supsub",mode:s.mode,base:a,sub:s}:{type:"supsub",mode:s.mode,base:a,sup:s};return{type:"mclass",mode:r.mode,mclass:n,body:[l],isCharacterBox:KN(l)}}}),sA({type:"pmb",names:["\\pmb"],numArgs:1,allowedInText:!0,handler:(e,t)=>({type:"pmb",mode:e.parser.mode,mclass:iT(t[0]),body:cA(t[0])}),htmlBuilder(e,t){var n=fA(e.body,t,!0),r=$O([e.mclass],n,t);return r.style.textShadow="0.02em 0.01em 0.04px",r},mathmlBuilder(e,t){var n=RA(e.body,t),r=new SA("mstyle",n);return r.setAttribute("style","text-shadow: 0.02em 0.01em 0.04px"),r}});var sT={">":"\\\\cdrightarrow","<":"\\\\cdleftarrow","=":"\\\\cdlongequal",A:"\\uparrow",V:"\\downarrow","|":"\\Vert",".":"no arrow"},aT=()=>({type:"styling",body:[],mode:"math",style:"display",resetFont:!0}),lT=e=>"textord"===e.type&&"@"===e.text,cT=(e,t)=>("mathord"===e.type||"atom"===e.type)&&e.text===t;function dT(e,t,n){var r=sT[e];switch(r){case"\\\\cdrightarrow":case"\\\\cdleftarrow":return n.callFunction(r,[t[0]],[t[1]]);case"\\uparrow":case"\\downarrow":var o={type:"atom",text:r,mode:"math",family:"rel"},i={type:"ordgroup",mode:"math",body:[n.callFunction("\\\\cdleft",[t[0]],[]),n.callFunction("\\Big",[o],[]),n.callFunction("\\\\cdright",[t[1]],[])]};return n.callFunction("\\\\cdparent",[i],[]);case"\\\\cdlongequal":return n.callFunction("\\\\cdlongequal",[],[]);case"\\Vert":return n.callFunction("\\Big",[{type:"textord",text:"\\Vert",mode:"math"}],[]);default:return{type:"textord",text:" ",mode:"math"}}}sA({type:"cdlabel",names:["\\\\cdleft","\\\\cdright"],numArgs:1,handler(e,t){var n=e.parser,r=e.funcName;return{type:"cdlabel",mode:n.mode,side:r.slice(4),label:t[0]}},htmlBuilder(e,t){var n=t.havingStyle(t.style.sup()),r=WO(bA(e.label,n,t),t);return r.classes.push("cd-label-"+e.side),r.style.bottom=wE(.8-r.depth),r.height=0,r.depth=0,r},mathmlBuilder(e,t){var n=new SA("mrow",[BA(e.label,t)]);return(n=new SA("mpadded",[n])).setAttribute("width","0"),"left"===e.side&&n.setAttribute("lspace","-1width"),n.setAttribute("voffset","0.7em"),(n=new SA("mstyle",[n])).setAttribute("displaystyle","false"),n.setAttribute("scriptlevel","1"),n}}),sA({type:"cdlabelparent",names:["\\\\cdparent"],numArgs:1,handler:(e,t)=>({type:"cdlabelparent",mode:e.parser.mode,fragment:t[0]}),htmlBuilder(e,t){var n=WO(bA(e.fragment,t),t);return n.classes.push("cd-vert-arrow"),n},mathmlBuilder:(e,t)=>new SA("mrow",[BA(e.fragment,t)])}),sA({type:"textord",names:["\\@char"],numArgs:1,allowedInText:!0,handler(e,t){var n,r=e.parser,o=eT(YA(t[0],"ordgroup"),"\\@char has non-numeric argument"),i=parseInt(o);if(isNaN(i))throw new VN("\\@char has non-numeric argument "+o);if(i<0||i>1114111)throw new VN("\\@char with invalid code point "+o);return i<=65535?n=String.fromCharCode(i):(i-=65536,n=String.fromCharCode(55296+(i>>10),56320+(1023&i))),{type:"textord",mode:r.mode,text:n}}});sA({type:"color",names:["\\textcolor"],numArgs:2,allowedInText:!0,argTypes:["color","original"],handler(e,t){var n=e.parser,r=YA(t[0],"color-token").color,o=t[1];return{type:"color",mode:n.mode,color:r,body:cA(o)}},htmlBuilder:(e,t)=>{var n=fA(e.body,t.withColor(e.color),!1);return FO(n)},mathmlBuilder:(e,t)=>{var n=RA(e.body,t.withColor(e.color)),r=new SA("mstyle",n);return r.setAttribute("mathcolor",e.color),r}}),sA({type:"color",names:["\\color"],numArgs:1,allowedInText:!0,argTypes:["color"],handler(e,t){var n=e.parser,r=e.breakOnTokenText,o=YA(t[0],"color-token").color;n.gullet.macros.set("\\current@color",o);var i=n.parseExpression(!0,r);return{type:"color",mode:n.mode,color:o,body:i}}}),sA({type:"cr",names:["\\\\"],numArgs:0,numOptionalArgs:0,allowedInText:!0,handler(e){var t=e.parser,n="["===t.gullet.future().text?t.parseSizeGroup(!0):null,r=!t.settings.displayMode||!_O({strict:t.settings.strict,errorCode:"newLineInDisplayMode",errorMsg:"In LaTeX, \\\\ or \\newline does nothing in display mode",report:!1});return{type:"cr",mode:t.mode,newLine:r,size:n&&YA(n,"size").value}},htmlBuilder(e,t){var n=$O(["mspace"],[],t);return e.newLine&&(n.classes.push("katex-newline"),e.size&&(n.style.marginTop=wE(yE(e.size,t)))),n},mathmlBuilder(e,t){var n=new SA("mspace");return e.newLine&&(n.setAttribute("linebreak","newline"),e.size&&n.setAttribute("height",wE(yE(e.size,t)))),n}});var uT={"\\global":"\\global","\\long":"\\\\globallong","\\\\globallong":"\\\\globallong","\\def":"\\gdef","\\gdef":"\\gdef","\\edef":"\\xdef","\\xdef":"\\xdef","\\let":"\\\\globallet","\\futurelet":"\\\\globalfuture"},hT=e=>{var t=e.text;if(/^(?:[\\{}$&#^_]|EOF)$/.test(t))throw new VN("Expected a control sequence",e);return t},pT=(e,t,n,r)=>{var o=e.gullet.macros.get(n.text);null==o&&(n.noexpand=!0,o={tokens:[n],numArgs:0,unexpandable:!e.gullet.isExpandable(n.text)}),e.gullet.macros.set(t,o,r)};sA({type:"internal",names:["\\global","\\long","\\\\globallong"],numArgs:0,allowedInText:!0,handler(e){var t=e.parser,n=e.funcName;t.consumeSpaces();var r=t.fetch();if(uT[r.text])return"\\global"!==n&&"\\\\globallong"!==n||(r.text=uT[r.text]),YA(t.parseFunction(),"internal");throw new VN("Invalid token after macro prefix",r)}}),sA({type:"internal",names:["\\def","\\gdef","\\edef","\\xdef"],numArgs:0,allowedInText:!0,primitive:!0,handler(e){var t=e.parser,n=e.funcName,r=t.gullet.popToken(),o=r.text;if(/^(?:[\\{}$&#^_]|EOF)$/.test(o))throw new VN("Expected a control sequence",r);for(var i,s=0,a=[[]];"{"!==t.gullet.future().text;)if("#"===(r=t.gullet.popToken()).text){if("{"===t.gullet.future().text){i=t.gullet.future(),a[s].push("{");break}if(r=t.gullet.popToken(),!/^[1-9]$/.test(r.text))throw new VN('Invalid argument number "'+r.text+'"');if(parseInt(r.text)!==s+1)throw new VN('Argument number "'+r.text+'" out of order');s++,a.push([])}else{if("EOF"===r.text)throw new VN("Expected a macro definition");a[s].push(r.text)}var l=t.gullet.consumeArg().tokens;return i&&l.unshift(i),"\\edef"!==n&&"\\xdef"!==n||(l=t.gullet.expandTokens(l)).reverse(),t.gullet.macros.set(o,{tokens:l,numArgs:s,delimiters:a},n===uT[n]),{type:"internal",mode:t.mode}}}),sA({type:"internal",names:["\\let","\\\\globallet"],numArgs:0,allowedInText:!0,primitive:!0,handler(e){var t=e.parser,n=e.funcName,r=hT(t.gullet.popToken());t.gullet.consumeSpaces();var o=(e=>{var t=e.gullet.popToken();return"="===t.text&&" "===(t=e.gullet.popToken()).text&&(t=e.gullet.popToken()),t})(t);return pT(t,r,o,"\\\\globallet"===n),{type:"internal",mode:t.mode}}}),sA({type:"internal",names:["\\futurelet","\\\\globalfuture"],numArgs:0,allowedInText:!0,primitive:!0,handler(e){var t=e.parser,n=e.funcName,r=hT(t.gullet.popToken()),o=t.gullet.popToken(),i=t.gullet.popToken();return pT(t,r,i,"\\\\globalfuture"===n),t.gullet.pushToken(i),t.gullet.pushToken(o),{type:"internal",mode:t.mode}}});var fT=function(e,t,n){var r=PE(jE.math[e]&&jE.math[e].replace||e,t,n);if(!r)throw new Error("Unsupported symbol "+e+" and font size "+t+".");return r},mT=function(e,t,n,r){var o=n.havingBaseStyle(t),i=$O(r.concat(o.sizingClasses(n)),[e],n),s=o.sizeMultiplier/n.sizeMultiplier;return i.height*=s,i.depth*=s,i.maxFontSize=o.sizeMultiplier,i},gT=function(e,t,n){var r=t.havingBaseStyle(n),o=(1-t.sizeMultiplier/r.sizeMultiplier)*t.fontMetrics().axisHeight;e.classes.push("delimcenter"),e.style.top=wE(o),e.height-=o,e.depth+=o},vT=function(e,t,n,r,o,i){var s=function(e,t,n,r){return LO(e,"Size"+t+"-Regular",n,r)}(e,t,o,r),a=mT($O(["delimsizing","size"+t],[s],r),aE.TEXT,r,i);return n&&gT(a,r,aE.TEXT),a},yT=function(e,t,n,r){return{type:"elem",elem:$O(["delimsizinginner","Size1-Regular"===t?"delim-size1":"delim-size4"],[$O([],[LO(e,t,n,r)])])}},wT=function(e,t,n){var r=RE["Size4-Regular"][e.charCodeAt(0)]?RE["Size4-Regular"][e.charCodeAt(0)][4]:RE["Size1-Regular"][e.charCodeAt(0)][4],o=new IE("inner",function(e,t){switch(e){case"⎜":return uE("M291 0 H417 V"+t+" H291z");case"∣":return uE("M145 0 H188 V"+t+" H145z");case"∥":return uE("M145 0 H188 V"+t+" H145z")+uE("M367 0 H410 V"+t+" H367z");case"⎟":return uE("M457 0 H583 V"+t+" H457z");case"⎢":return uE("M319 0 H403 V"+t+" H319z");case"⎥":return uE("M263 0 H347 V"+t+" H263z");case"⎪":return uE("M384 0 H504 V"+t+" H384z");case"⏐":return uE("M312 0 H355 V"+t+" H312z");case"‖":return uE("M257 0 H300 V"+t+" H257z")+uE("M478 0 H521 V"+t+" H478z");default:return""}}(e,Math.round(1e3*t))),i=new DE([o],{width:wE(r),height:wE(t),style:"width:"+wE(r),viewBox:"0 0 "+1e3*r+" "+Math.round(1e3*t),preserveAspectRatio:"xMinYMin"}),s=HO([],[i],n);return s.height=t,s.style.height=wE(t),s.style.width=wE(r),{type:"elem",elem:s}},bT={type:"kern",size:-.008},xT=new Set(["|","\\lvert","\\rvert","\\vert"]),kT=new Set(["\\|","\\lVert","\\rVert","\\Vert"]),CT=function(e,t,n,r,o,i){var s,a,l,c,d="",u=0;s=l=c=e,a=null;var h="Size1-Regular";"\\uparrow"===e?l=c="⏐":"\\Uparrow"===e?l=c="‖":"\\downarrow"===e?s=l="⏐":"\\Downarrow"===e?s=l="‖":"\\updownarrow"===e?(s="\\uparrow",l="⏐",c="\\downarrow"):"\\Updownarrow"===e?(s="\\Uparrow",l="‖",c="\\Downarrow"):xT.has(e)?(l="∣",d="vert",u=333):kT.has(e)?(l="∥",d="doublevert",u=556):"["===e||"\\lbrack"===e?(s="⎡",l="⎢",c="⎣",h="Size4-Regular",d="lbrack",u=667):"]"===e||"\\rbrack"===e?(s="⎤",l="⎥",c="⎦",h="Size4-Regular",d="rbrack",u=667):"\\lfloor"===e||"⌊"===e?(l=s="⎢",c="⎣",h="Size4-Regular",d="lfloor",u=667):"\\lceil"===e||"⌈"===e?(s="⎡",l=c="⎢",h="Size4-Regular",d="lceil",u=667):"\\rfloor"===e||"⌋"===e?(l=s="⎥",c="⎦",h="Size4-Regular",d="rfloor",u=667):"\\rceil"===e||"⌉"===e?(s="⎤",l=c="⎥",h="Size4-Regular",d="rceil",u=667):"("===e||"\\lparen"===e?(s="⎛",l="⎜",c="⎝",h="Size4-Regular",d="lparen",u=875):")"===e||"\\rparen"===e?(s="⎞",l="⎟",c="⎠",h="Size4-Regular",d="rparen",u=875):"\\{"===e||"\\lbrace"===e?(s="⎧",a="⎨",c="⎩",l="⎪",h="Size4-Regular"):"\\}"===e||"\\rbrace"===e?(s="⎫",a="⎬",c="⎭",l="⎪",h="Size4-Regular"):"\\lgroup"===e||"⟮"===e?(s="⎧",c="⎩",l="⎪",h="Size4-Regular"):"\\rgroup"===e||"⟯"===e?(s="⎫",c="⎭",l="⎪",h="Size4-Regular"):"\\lmoustache"===e||"⎰"===e?(s="⎧",c="⎭",l="⎪",h="Size4-Regular"):"\\rmoustache"!==e&&"⎱"!==e||(s="⎫",c="⎩",l="⎪",h="Size4-Regular");var p=fT(s,h,o),f=p.height+p.depth,m=fT(l,h,o),g=m.height+m.depth,v=fT(c,h,o),y=v.height+v.depth,w=0,b=1;if(null!==a){var x=fT(a,h,o);w=x.height+x.depth,b=2}var k=f+y+w,C=k+Math.max(0,Math.ceil((t-k)/(b*g)))*b*g,S=r.fontMetrics().axisHeight;n&&(S*=r.sizeMultiplier);var M=C/2-S,N=[];if(d.length>0){var E=C-f-y,O=Math.round(1e3*C),A=function(e,t){switch(e){case"lbrack":return"M403 1759 V84 H666 V0 H319 V1759 v"+t+" v1759 v84 h347 v-84\nH403z M403 1759 V0 H319 V1759 v"+t+" v1759 v84 h84z";case"rbrack":return"M347 1759 V0 H0 V84 H263 V1759 v"+t+" v1759 H0 v84 H347z\nM347 1759 V0 H263 V1759 v"+t+" v1759 h84z";case"vert":return"M145 15 v585 v"+t+" v585 c2.667,10,9.667,15,21,15\nc10,0,16.667,-5,20,-15 v-585 v"+-t+" v-585 c-2.667,-10,-9.667,-15,-21,-15\nc-10,0,-16.667,5,-20,15z M188 15 H145 v585 v"+t+" v585 h43z";case"doublevert":return"M145 15 v585 v"+t+" v585 c2.667,10,9.667,15,21,15\nc10,0,16.667,-5,20,-15 v-585 v"+-t+" v-585 c-2.667,-10,-9.667,-15,-21,-15\nc-10,0,-16.667,5,-20,15z M188 15 H145 v585 v"+t+" v585 h43z\nM367 15 v585 v"+t+" v585 c2.667,10,9.667,15,21,15\nc10,0,16.667,-5,20,-15 v-585 v"+-t+" v-585 c-2.667,-10,-9.667,-15,-21,-15\nc-10,0,-16.667,5,-20,15z M410 15 H367 v585 v"+t+" v585 h43z";case"lfloor":return"M319 602 V0 H403 V602 v"+t+" v1715 h263 v84 H319z\nMM319 602 V0 H403 V602 v"+t+" v1715 H319z";case"rfloor":return"M319 602 V0 H403 V602 v"+t+" v1799 H0 v-84 H319z\nMM319 602 V0 H403 V602 v"+t+" v1715 H319z";case"lceil":return"M403 1759 V84 H666 V0 H319 V1759 v"+t+" v602 h84z\nM403 1759 V0 H319 V1759 v"+t+" v602 h84z";case"rceil":return"M347 1759 V0 H0 V84 H263 V1759 v"+t+" v602 h84z\nM347 1759 V0 h-84 V1759 v"+t+" v602 h84z";case"lparen":return"M863,9c0,-2,-2,-5,-6,-9c0,0,-17,0,-17,0c-12.7,0,-19.3,0.3,-20,1\nc-5.3,5.3,-10.3,11,-15,17c-242.7,294.7,-395.3,682,-458,1162c-21.3,163.3,-33.3,349,\n-36,557 l0,"+(t+84)+"c0.2,6,0,26,0,60c2,159.3,10,310.7,24,454c53.3,528,210,\n949.7,470,1265c4.7,6,9.7,11.7,15,17c0.7,0.7,7,1,19,1c0,0,18,0,18,0c4,-4,6,-7,6,-9\nc0,-2.7,-3.3,-8.7,-10,-18c-135.3,-192.7,-235.5,-414.3,-300.5,-665c-65,-250.7,-102.5,\n-544.7,-112.5,-882c-2,-104,-3,-167,-3,-189\nl0,-"+(t+92)+"c0,-162.7,5.7,-314,17,-454c20.7,-272,63.7,-513,129,-723c65.3,\n-210,155.3,-396.3,270,-559c6.7,-9.3,10,-15.3,10,-18z";case"rparen":return"M76,0c-16.7,0,-25,3,-25,9c0,2,2,6.3,6,13c21.3,28.7,42.3,60.3,\n63,95c96.7,156.7,172.8,332.5,228.5,527.5c55.7,195,92.8,416.5,111.5,664.5\nc11.3,139.3,17,290.7,17,454c0,28,1.7,43,3.3,45l0,"+(t+9)+"\nc-3,4,-3.3,16.7,-3.3,38c0,162,-5.7,313.7,-17,455c-18.7,248,-55.8,469.3,-111.5,664\nc-55.7,194.7,-131.8,370.3,-228.5,527c-20.7,34.7,-41.7,66.3,-63,95c-2,3.3,-4,7,-6,11\nc0,7.3,5.7,11,17,11c0,0,11,0,11,0c9.3,0,14.3,-0.3,15,-1c5.3,-5.3,10.3,-11,15,-17\nc242.7,-294.7,395.3,-681.7,458,-1161c21.3,-164.7,33.3,-350.7,36,-558\nl0,-"+(t+144)+"c-2,-159.3,-10,-310.7,-24,-454c-53.3,-528,-210,-949.7,\n-470,-1265c-4.7,-6,-9.7,-11.7,-15,-17c-0.7,-0.7,-6.7,-1,-18,-1z";default:throw new Error("Unknown stretchy delimiter.")}}(d,Math.round(1e3*E)),T=new IE(d,A),D=wE(u/1e3),I=wE(O/1e3),_=new DE([T],{width:D,height:I,viewBox:"0 0 "+u+" "+O}),R=HO([],[_],r);R.height=O/1e3,R.style.width=D,R.style.height=I,N.push({type:"elem",elem:R})}else{if(N.push(yT(c,h,o,r)),N.push(bT),null===a){var L=C-f-y+.016;N.push(wT(l,L,r))}else{var B=(C-f-y-w)/2+.016;N.push(wT(l,B,r)),N.push(bT),N.push(yT(a,h,o,r)),N.push(bT),N.push(wT(l,B,r))}N.push(bT),N.push(yT(s,h,o,r))}var P=r.havingBaseStyle(aE.TEXT),z=UO({positionType:"bottom",positionData:M,children:N});return mT($O(["delimsizing","mult"],[z],P),aE.TEXT,r,i)},ST=.08,MT=function(e,t,n,r,o){var i=function(e,t,n){t*=1e3;var r="";switch(e){case"sqrtMain":r=function(e,t){return"M95,"+(622+e+t)+"\nc-2.7,0,-7.17,-2.7,-13.5,-8c-5.8,-5.3,-9.5,-10,-9.5,-14\nc0,-2,0.3,-3.3,1,-4c1.3,-2.7,23.83,-20.7,67.5,-54\nc44.2,-33.3,65.8,-50.3,66.5,-51c1.3,-1.3,3,-2,5,-2c4.7,0,8.7,3.3,12,10\ns173,378,173,378c0.7,0,35.3,-71,104,-213c68.7,-142,137.5,-285,206.5,-429\nc69,-144,104.5,-217.7,106.5,-221\nl"+e/2.075+" -"+e+"\nc5.3,-9.3,12,-14,20,-14\nH400000v"+(40+e)+"H845.2724\ns-225.272,467,-225.272,467s-235,486,-235,486c-2.7,4.7,-9,7,-19,7\nc-6,0,-10,-1,-12,-3s-194,-422,-194,-422s-65,47,-65,47z\nM"+(834+e)+" "+t+"h400000v"+(40+e)+"h-400000z"}(t,hE);break;case"sqrtSize1":r=function(e,t){return"M263,"+(601+e+t)+"c0.7,0,18,39.7,52,119\nc34,79.3,68.167,158.7,102.5,238c34.3,79.3,51.8,119.3,52.5,120\nc340,-704.7,510.7,-1060.3,512,-1067\nl"+e/2.084+" -"+e+"\nc4.7,-7.3,11,-11,19,-11\nH40000v"+(40+e)+"H1012.3\ns-271.3,567,-271.3,567c-38.7,80.7,-84,175,-136,283c-52,108,-89.167,185.3,-111.5,232\nc-22.3,46.7,-33.8,70.3,-34.5,71c-4.7,4.7,-12.3,7,-23,7s-12,-1,-12,-1\ns-109,-253,-109,-253c-72.7,-168,-109.3,-252,-110,-252c-10.7,8,-22,16.7,-34,26\nc-22,17.3,-33.3,26,-34,26s-26,-26,-26,-26s76,-59,76,-59s76,-60,76,-60z\nM"+(1001+e)+" "+t+"h400000v"+(40+e)+"h-400000z"}(t,hE);break;case"sqrtSize2":r=function(e,t){return"M983 "+(10+e+t)+"\nl"+e/3.13+" -"+e+"\nc4,-6.7,10,-10,18,-10 H400000v"+(40+e)+"\nH1013.1s-83.4,268,-264.1,840c-180.7,572,-277,876.3,-289,913c-4.7,4.7,-12.7,7,-24,7\ns-12,0,-12,0c-1.3,-3.3,-3.7,-11.7,-7,-25c-35.3,-125.3,-106.7,-373.3,-214,-744\nc-10,12,-21,25,-33,39s-32,39,-32,39c-6,-5.3,-15,-14,-27,-26s25,-30,25,-30\nc26.7,-32.7,52,-63,76,-91s52,-60,52,-60s208,722,208,722\nc56,-175.3,126.3,-397.3,211,-666c84.7,-268.7,153.8,-488.2,207.5,-658.5\nc53.7,-170.3,84.5,-266.8,92.5,-289.5z\nM"+(1001+e)+" "+t+"h400000v"+(40+e)+"h-400000z"}(t,hE);break;case"sqrtSize3":r=function(e,t){return"M424,"+(2398+e+t)+"\nc-1.3,-0.7,-38.5,-172,-111.5,-514c-73,-342,-109.8,-513.3,-110.5,-514\nc0,-2,-10.7,14.3,-32,49c-4.7,7.3,-9.8,15.7,-15.5,25c-5.7,9.3,-9.8,16,-12.5,20\ns-5,7,-5,7c-4,-3.3,-8.3,-7.7,-13,-13s-13,-13,-13,-13s76,-122,76,-122s77,-121,77,-121\ns209,968,209,968c0,-2,84.7,-361.7,254,-1079c169.3,-717.3,254.7,-1077.7,256,-1081\nl"+e/4.223+" -"+e+"c4,-6.7,10,-10,18,-10 H400000\nv"+(40+e)+"H1014.6\ns-87.3,378.7,-272.6,1166c-185.3,787.3,-279.3,1182.3,-282,1185\nc-2,6,-10,9,-24,9\nc-8,0,-12,-0.7,-12,-2z M"+(1001+e)+" "+t+"\nh400000v"+(40+e)+"h-400000z"}(t,hE);break;case"sqrtSize4":r=function(e,t){return"M473,"+(2713+e+t)+"\nc339.3,-1799.3,509.3,-2700,510,-2702 l"+e/5.298+" -"+e+"\nc3.3,-7.3,9.3,-11,18,-11 H400000v"+(40+e)+"H1017.7\ns-90.5,478,-276.2,1466c-185.7,988,-279.5,1483,-281.5,1485c-2,6,-10,9,-24,9\nc-8,0,-12,-0.7,-12,-2c0,-1.3,-5.3,-32,-16,-92c-50.7,-293.3,-119.7,-693.3,-207,-1200\nc0,-1.3,-5.3,8.7,-16,30c-10.7,21.3,-21.3,42.7,-32,64s-16,33,-16,33s-26,-26,-26,-26\ns76,-153,76,-153s77,-151,77,-151c0.7,0.7,35.7,202,105,604c67.3,400.7,102,602.7,104,\n606zM"+(1001+e)+" "+t+"h400000v"+(40+e)+"H1017.7z"}(t,hE);break;case"sqrtTall":r=function(e,t,n){return"M702 "+(e+t)+"H400000"+(40+e)+"\nH742v"+(n-54-t-e)+"l-4 4-4 4c-.667.7 -2 1.5-4 2.5s-4.167 1.833-6.5 2.5-5.5 1-9.5 1\nh-12l-28-84c-16.667-52-96.667 -294.333-240-727l-212 -643 -85 170\nc-4-3.333-8.333-7.667-13 -13l-13-13l77-155 77-156c66 199.333 139 419.667\n219 661 l218 661zM702 "+t+"H400000v"+(40+e)+"H742z"}(t,hE,n)}return r}(e,r,n),s=new IE(e,i),a=new DE([s],{width:"400em",height:wE(t),viewBox:"0 0 400000 "+n,preserveAspectRatio:"xMinYMin slice"});return HO(["hide-tail"],[a],o)},NT=new Set(["(","\\lparen",")","\\rparen","[","\\lbrack","]","\\rbrack","\\{","\\lbrace","\\}","\\rbrace","\\lfloor","\\rfloor","⌊","⌋","\\lceil","\\rceil","⌈","⌉","\\surd"]),ET=new Set(["\\uparrow","\\downarrow","\\updownarrow","\\Uparrow","\\Downarrow","\\Updownarrow","|","\\|","\\vert","\\Vert","\\lvert","\\rvert","\\lVert","\\rVert","\\lgroup","\\rgroup","⟮","⟯","\\lmoustache","\\rmoustache","⎰","⎱"]),OT=new Set(["<",">","\\langle","\\rangle","/","\\backslash","\\lt","\\gt"]),AT=[0,1.2,1.8,2.4,3],TT=function(e,t,n,r,o){if("<"===e||"\\lt"===e||"⟨"===e?e="\\langle":">"!==e&&"\\gt"!==e&&"⟩"!==e||(e="\\rangle"),NT.has(e)||OT.has(e))return vT(e,t,!1,n,r,o);if(ET.has(e))return CT(e,AT[t],!1,n,r,o);throw new VN("Illegal delimiter: '"+e+"'")},DT=[{type:"small",style:aE.SCRIPTSCRIPT},{type:"small",style:aE.SCRIPT},{type:"small",style:aE.TEXT},{type:"large",size:1},{type:"large",size:2},{type:"large",size:3},{type:"large",size:4}],IT=[{type:"small",style:aE.SCRIPTSCRIPT},{type:"small",style:aE.SCRIPT},{type:"small",style:aE.TEXT},{type:"stack"}],_T=[{type:"small",style:aE.SCRIPTSCRIPT},{type:"small",style:aE.SCRIPT},{type:"small",style:aE.TEXT},{type:"large",size:1},{type:"large",size:2},{type:"large",size:3},{type:"large",size:4},{type:"stack"}],RT=function(e){if("small"===e.type)return"Main-Regular";if("large"===e.type)return"Size"+e.size+"-Regular";if("stack"===e.type)return"Size4-Regular";var t=e.type;throw new Error("Add support for delim type '"+t+"' here.")},LT=function(e,t,n,r){for(var o=Math.min(2,3-r.style.size);o<n.length;o++){var i=n[o];if("stack"===i.type)break;var s=fT(e,RT(i),"math"),a=s.height+s.depth;if("small"===i.type)a*=r.havingBaseStyle(i.style).sizeMultiplier;if(a>t)return i}return n[n.length-1]},BT=function(e,t,n,r,o,i){var s;"<"===e||"\\lt"===e||"⟨"===e?e="\\langle":">"!==e&&"\\gt"!==e&&"⟩"!==e||(e="\\rangle"),s=OT.has(e)?DT:NT.has(e)?_T:IT;var a=LT(e,t,s,r);return"small"===a.type?function(e,t,n,r,o,i){var s=LO(e,"Main-Regular",o,r),a=mT(s,t,r,i);return gT(a,r,t),a}(e,a.style,0,r,o,i):"large"===a.type?vT(e,a.size,n,r,o,i):CT(e,t,n,r,o,i)},PT=function(e,t,n,r,o,i){var s=r.fontMetrics().axisHeight*r.sizeMultiplier,a=5/r.fontMetrics().ptPerEm,l=Math.max(t-s,n+s),c=Math.max(l/500*901,2*l-a);return BT(e,c,!0,r,o,i)},zT={"\\bigl":{mclass:"mopen",size:1},"\\Bigl":{mclass:"mopen",size:2},"\\biggl":{mclass:"mopen",size:3},"\\Biggl":{mclass:"mopen",size:4},"\\bigr":{mclass:"mclose",size:1},"\\Bigr":{mclass:"mclose",size:2},"\\biggr":{mclass:"mclose",size:3},"\\Biggr":{mclass:"mclose",size:4},"\\bigm":{mclass:"mrel",size:1},"\\Bigm":{mclass:"mrel",size:2},"\\biggm":{mclass:"mrel",size:3},"\\Biggm":{mclass:"mrel",size:4},"\\big":{mclass:"mord",size:1},"\\Big":{mclass:"mord",size:2},"\\bigg":{mclass:"mord",size:3},"\\Bigg":{mclass:"mord",size:4}},jT=new Set(["(","\\lparen",")","\\rparen","[","\\lbrack","]","\\rbrack","\\{","\\lbrace","\\}","\\rbrace","\\lfloor","\\rfloor","⌊","⌋","\\lceil","\\rceil","⌈","⌉","<",">","\\langle","⟨","\\rangle","⟩","\\lt","\\gt","\\lvert","\\rvert","\\lVert","\\rVert","\\lgroup","\\rgroup","⟮","⟯","\\lmoustache","\\rmoustache","⎰","⎱","/","\\backslash","|","\\vert","\\|","\\Vert","\\uparrow","\\Uparrow","\\downarrow","\\Downarrow","\\updownarrow","\\Updownarrow","."]);function VT(e){return"isMiddle"in e}function $T(e,t){var n=QA(e);if(n&&jT.has(n.text))return n;throw new VN(n?"Invalid delimiter '"+n.text+"' after '"+t.funcName+"'":"Invalid delimiter type '"+e.type+"'",e)}function HT(e){if(!e.body)throw new Error("Bug: The leftright ParseNode wasn't fully parsed.")}sA({type:"delimsizing",names:["\\bigl","\\Bigl","\\biggl","\\Biggl","\\bigr","\\Bigr","\\biggr","\\Biggr","\\bigm","\\Bigm","\\biggm","\\Biggm","\\big","\\Big","\\bigg","\\Bigg"],numArgs:1,argTypes:["primitive"],handler:(e,t)=>{var n=$T(lA(t[0]),e);return{type:"delimsizing",mode:e.parser.mode,size:zT[e.funcName].size,mclass:zT[e.funcName].mclass,delim:n.text}},htmlBuilder:(e,t)=>"."===e.delim?$O([e.mclass]):TT(e.delim,e.size,t,e.mode,[e.mclass]),mathmlBuilder:e=>{var t=[];"."!==e.delim&&t.push(AA(e.delim,e.mode));var n=new SA("mo",t);"mopen"===e.mclass||"mclose"===e.mclass?n.setAttribute("fence","true"):n.setAttribute("fence","false"),n.setAttribute("stretchy","true");var r=wE(AT[e.size]);return n.setAttribute("minsize",r),n.setAttribute("maxsize",r),n}}),sA({type:"leftright-right",names:["\\right"],numArgs:1,primitive:!0,handler:(e,t)=>{var n=e.parser.gullet.macros.get("\\current@color");if(n&&"string"!=typeof n)throw new VN("\\current@color set to non-string in \\right");return{type:"leftright-right",mode:e.parser.mode,delim:$T(t[0],e).text,color:n}}}),sA({type:"leftright",names:["\\left"],numArgs:1,primitive:!0,handler:(e,t)=>{var n=$T(t[0],e),r=e.parser;++r.leftrightDepth;var o=r.parseExpression(!1);--r.leftrightDepth,r.expect("\\right",!1);var i=YA(r.parseFunction(),"leftright-right");return{type:"leftright",mode:r.mode,body:o,left:n.text,right:i.delim,rightColor:i.color}},htmlBuilder:(e,t)=>{HT(e);for(var n,r,o=fA(e.body,t,!0,["mopen","mclose"]),i=0,s=0,a=!1,l=0;l<o.length;l++){VT(o[l])?a=!0:(i=Math.max(o[l].height,i),s=Math.max(o[l].depth,s))}if(i*=t.sizeMultiplier,s*=t.sizeMultiplier,n="."===e.left?wA(t,["mopen"]):PT(e.left,i,s,t,e.mode,["mopen"]),o.unshift(n),a)for(var c=1;c<o.length;c++){var d=o[c];if(VT(d)){var u=d.isMiddle;o[c]=PT(u.delim,i,s,u.options,e.mode,[])}}if("."===e.right)r=wA(t,["mclose"]);else{var h=e.rightColor?t.withColor(e.rightColor):t;r=PT(e.right,i,s,h,e.mode,["mclose"])}return o.push(r),$O(["minner"],o,t)},mathmlBuilder:(e,t)=>{HT(e);var n=RA(e.body,t);if("."!==e.left){var r=new SA("mo",[AA(e.left,e.mode)]);r.setAttribute("fence","true"),n.unshift(r)}if("."!==e.right){var o=new SA("mo",[AA(e.right,e.mode)]);o.setAttribute("fence","true"),e.rightColor&&o.setAttribute("mathcolor",e.rightColor),n.push(o)}return TA(n)}}),sA({type:"middle",names:["\\middle"],numArgs:1,primitive:!0,handler:(e,t)=>{var n=$T(t[0],e);if(!e.parser.leftrightDepth)throw new VN("\\middle without preceding \\left",n);return{type:"middle",mode:e.parser.mode,delim:n.text}},htmlBuilder:(e,t)=>{var n;return"."===e.delim?n=wA(t,[]):(n=TT(e.delim,1,t,e.mode,[])).isMiddle={delim:e.delim,options:t},n},mathmlBuilder:(e,t)=>{var n="\\vert"===e.delim||"|"===e.delim?AA("|","text"):AA(e.delim,e.mode),r=new SA("mo",[n]);return r.setAttribute("fence","true"),r.setAttribute("lspace","0.05em"),r.setAttribute("rspace","0.05em"),r}});sA({type:"enclose",names:["\\colorbox"],numArgs:2,allowedInText:!0,argTypes:["color","hbox"],handler(e,t,n){var r=e.parser,o=e.funcName,i=YA(t[0],"color-token").color,s=t[1];return{type:"enclose",mode:r.mode,label:o,backgroundColor:i,body:s}},htmlBuilder:(e,t)=>{var n,r,o,i,s=WO(bA(e.body,t),t),a=e.label.slice(1),l=t.sizeMultiplier,c=KN(e.body);if("sout"===a)(n=$O(["katex-stretchy","katex-sout"])).height=t.fontMetrics().defaultRuleThickness/l,r=-.5*t.fontMetrics().xHeight;else if("phase"===a){var d=yE({number:.6,unit:"pt"},t),u=yE({number:.35,unit:"ex"},t);l/=t.havingBaseSizing().sizeMultiplier;var h=s.height+s.depth+d+u;s.style.paddingLeft=wE(h/2+d);var p=Math.floor(1e3*h*l),f="M400000 "+(o=p)+" H0 L"+o/2+" 0 l65 45 L145 "+(o-80)+" H400000z",m=new DE([new IE("phase",f)],{width:"400em",height:wE(p/1e3),viewBox:"0 0 400000 "+p,preserveAspectRatio:"xMinYMin slice"});(n=HO(["hide-tail"],[m],t)).style.height=wE(h),r=s.depth+d+u}else{var g,v;/cancel/.test(a)?c||s.classes.push("cancel-pad"):"angl"===a?s.classes.push("anglpad"):s.classes.push("boxpad");var y=0;/box/.test(a)?(y=Math.max(t.fontMetrics().fboxrule,t.minRuleThickness),v=g=t.fontMetrics().fboxsep+("colorbox"===a?0:y)):"angl"===a?(g=4*(y=Math.max(t.fontMetrics().defaultRuleThickness,t.minRuleThickness)),v=Math.max(0,.25-s.depth)):v=g=c?.2:0,n=function(e,t,n,r,o){var i,s=e.height+e.depth+n+r;if(/fbox|color|angl/.test(t)){if(i=$O(["katex-stretchy",t],[],o),"fbox"===t){var a=o.color&&o.getColor();a&&(i.style.borderColor=a)}}else{var l=[];/^[bx]cancel$/.test(t)&&l.push(new _E({x1:"0",y1:"0",x2:"100%",y2:"100%","stroke-width":"0.046em"})),/^x?cancel$/.test(t)&&l.push(new _E({x1:"0",y1:"100%",x2:"100%",y2:"0","stroke-width":"0.046em"}));var c=new DE(l,{width:"100%",height:wE(s)});i=HO([],[c],o)}return i.height=s,i.style.height=wE(s),i}(s,a,g,v,t),/fbox|boxed|fcolorbox/.test(a)?(n.style.borderStyle="solid",n.style.borderWidth=wE(y)):"angl"===a&&.049!==y&&(n.style.borderTopWidth=wE(y),n.style.borderRightWidth=wE(y)),r=s.depth+v,e.backgroundColor&&(n.style.backgroundColor=e.backgroundColor,e.borderColor&&(n.style.borderColor=e.borderColor))}if(e.backgroundColor)i=UO({positionType:"individualShift",children:[{type:"elem",elem:n,shift:r},{type:"elem",elem:s,shift:0}]});else{var w=/cancel|phase/.test(a)?["svg-align"]:[];i=UO({positionType:"individualShift",children:[{type:"elem",elem:s,shift:0},{type:"elem",elem:n,shift:r,wrapperClasses:w}]})}return/cancel/.test(a)&&(i.height=s.height,i.depth=s.depth),/cancel/.test(a)&&!c?$O(["mord","cancel-lap"],[i],t):$O(["mord"],[i],t)},mathmlBuilder:(e,t)=>{var n,r=new SA(e.label.includes("colorbox")?"mpadded":"menclose",[BA(e.body,t)]);switch(e.label){case"\\cancel":r.setAttribute("notation","updiagonalstrike");break;case"\\bcancel":r.setAttribute("notation","downdiagonalstrike");break;case"\\phase":r.setAttribute("notation","phasorangle");break;case"\\sout":r.setAttribute("notation","horizontalstrike");break;case"\\fbox":r.setAttribute("notation","box");break;case"\\angl":r.setAttribute("notation","actuarial");break;case"\\fcolorbox":case"\\colorbox":if(n=t.fontMetrics().fboxsep*t.fontMetrics().ptPerEm,r.setAttribute("width","+"+2*n+"pt"),r.setAttribute("height","+"+2*n+"pt"),r.setAttribute("lspace",n+"pt"),r.setAttribute("voffset",n+"pt"),"\\fcolorbox"===e.label){var o=Math.max(t.fontMetrics().fboxrule,t.minRuleThickness);r.setAttribute("style","border: "+wE(o)+" solid "+e.borderColor)}break;case"\\xcancel":r.setAttribute("notation","updiagonalstrike downdiagonalstrike")}return e.backgroundColor&&r.setAttribute("mathbackground",e.backgroundColor),r}}),sA({type:"enclose",names:["\\fcolorbox"],numArgs:3,allowedInText:!0,argTypes:["color","color","hbox"],handler(e,t,n){var r=e.parser,o=e.funcName,i=YA(t[0],"color-token").color,s=YA(t[1],"color-token").color,a=t[2];return{type:"enclose",mode:r.mode,label:o,backgroundColor:s,borderColor:i,body:a}}}),sA({type:"enclose",names:["\\fbox"],numArgs:1,argTypes:["hbox"],allowedInText:!0,handler:(e,t)=>({type:"enclose",mode:e.parser.mode,label:"\\fbox",body:t[0]})}),sA({type:"enclose",names:["\\cancel","\\bcancel","\\xcancel","\\phase"],numArgs:1,handler(e,t){var n=e.parser,r=e.funcName,o=t[0];return{type:"enclose",mode:n.mode,label:r,body:o}}}),sA({type:"enclose",names:["\\sout"],numArgs:1,allowedInText:!0,handler(e,t){var n=e.parser,r=e.funcName;"math"===n.mode&&_O({strict:n.settings.strict,errorCode:"mathVsSout",errorMsg:"LaTeX's \\sout works only in text mode",report:!0});var o=t[0];return{type:"enclose",mode:n.mode,label:r,body:o}}}),sA({type:"enclose",names:["\\angl"],numArgs:1,argTypes:["hbox"],allowedInText:!1,handler:(e,t)=>({type:"enclose",mode:e.parser.mode,label:"\\angl",body:t[0]})});var qT={};function FT(e){for(var t=e.type,n=e.names,r=e.props,o=e.handler,i=e.htmlBuilder,s=e.mathmlBuilder,a={type:t,numArgs:r.numArgs||0,allowedInText:!1,numOptionalArgs:0,handler:o},l=0;l<n.length;++l)qT[n[l]]=a;i&&(oA[t]=i),s&&(iA[t]=s)}var WT={};function UT(e,t){WT[e]=t}class GT{constructor(e,t,n){this.lexer=void 0,this.start=void 0,this.end=void 0,this.lexer=e,this.start=t,this.end=n}static range(e,t){return t?e&&e.loc&&t.loc&&e.loc.lexer===t.loc.lexer?new GT(e.loc.lexer,e.loc.start,t.loc.end):null:e&&e.loc}}class KT{constructor(e,t){this.text=void 0,this.loc=void 0,this.noexpand=void 0,this.treatAsRelax=void 0,this.text=e,this.loc=t}range(e,t){return new KT(t,GT.range(this,e))}}function JT(e){var t=[];e.consumeSpaces();var n=e.fetch().text;for("\\relax"===n&&(e.consume(),e.consumeSpaces(),n=e.fetch().text);"\\hline"===n||"\\hdashline"===n;)e.consume(),t.push("\\hdashline"===n),e.consumeSpaces(),n=e.fetch().text;return t}var ZT=e=>{if(!e.parser.settings.displayMode)throw new VN("{"+e.envName+"} can be used only in display mode.")},YT=new Set(["gather","gather*"]);function XT(e){if(!e.includes("ed"))return!e.includes("*")}function QT(e,t,n){var r=t.hskipBeforeAndAfter,o=t.addJot,i=t.cols,s=t.arraystretch,a=t.colSeparationType,l=t.autoTag,c=t.singleRow,d=t.emptySingleRow,u=t.maxNumCols,h=t.leqno;if(e.gullet.beginGroup(),c||e.gullet.macros.set("\\cr","\\\\\\relax"),!s){var p=e.gullet.expandMacroAsText("\\arraystretch");if(null==p)s=1;else if(!(s=parseFloat(p))||s<0)throw new VN("Invalid \\arraystretch: "+p)}e.gullet.beginGroup();var f=[],m=[f],g=[],v=[],y=null!=l?[]:void 0;function w(){l&&e.gullet.macros.set("\\@eqnsw","1",!0)}function b(){y&&(e.gullet.macros.get("\\df@tag")?(y.push(e.subparse([new KT("\\df@tag")])),e.gullet.macros.set("\\df@tag",void 0,!0)):y.push(Boolean(l)&&"1"===e.gullet.macros.get("\\@eqnsw")))}for(w(),v.push(JT(e));;){var x=e.parseExpression(!1,c?"\\end":"\\\\");e.gullet.endGroup(),e.gullet.beginGroup();var k={type:"ordgroup",mode:e.mode,body:x};n&&(k={type:"styling",mode:e.mode,style:n,resetFont:!0,body:[k]}),f.push(k);var C=e.fetch().text;if("&"===C){if(u&&f.length===u){if(c||a)throw new VN("Too many tab characters: &",e.nextToken);_O({strict:e.settings.strict,errorCode:"textEnv",errorMsg:"Too few columns specified in the {array} column argument.",report:!0})}e.consume()}else{if("\\end"===C){b(),1!==f.length||"styling"!==k.type||1!==k.body.length||"ordgroup"!==k.body[0].type||0!==k.body[0].body.length||!(m.length>1)&&d||Array.isArray(null==y?void 0:y[y.length-1])||l&&!0===(null==y?void 0:y[y.length-1])||m.pop(),v.length<m.length+1&&v.push([]);break}if("\\\\"!==C)throw new VN("Expected & or \\\\ or \\cr or \\end",e.nextToken);e.consume();var S=void 0;" "!==e.gullet.future().text&&(S=e.parseSizeGroup(!0)),g.push(S?S.value:null),b(),v.push(JT(e)),f=[],m.push(f),w()}}return e.gullet.endGroup(),e.gullet.endGroup(),{type:"array",mode:e.mode,addJot:o,arraystretch:s,body:m,cols:i,rowGaps:g,hskipBeforeAndAfter:r,hLinesBeforeRow:v,colSeparationType:a,tags:y,leqno:h}}function eD(e){return"d"===e.slice(0,1)?"display":"text"}var tD=function(e,t){var n,r,o=e.body.length,i=e.hLinesBeforeRow,s=0,a=new Array(o),l=[],c=Math.max(t.fontMetrics().arrayRuleWidth,t.minRuleThickness),d=1/t.fontMetrics().ptPerEm,u=5*d;e.colSeparationType&&"small"===e.colSeparationType&&(u=t.havingStyle(aE.SCRIPT).sizeMultiplier/t.sizeMultiplier*.2778);var h="CD"===e.colSeparationType?yE({number:3,unit:"ex"},t):12*d,p=3*d,f=e.arraystretch*h,m=.7*f,g=.3*f,v=0;function y(e){for(var t=0;t<e.length;++t)t>0&&(v+=.25),l.push({pos:v,isDashed:e[t]})}for(y(i[0]),n=0;n<e.body.length;++n){var w=e.body[n],b=m,x=g;s<w.length&&(s=w.length);var k={cells:new Array(w.length),height:0,depth:0,pos:0};for(r=0;r<w.length;++r){var C=bA(w[r],t);x<C.depth&&(x=C.depth),b<C.height&&(b=C.height),k.cells[r]=C}var S=e.rowGaps[n],M=0;S&&(M=yE(S,t))>0&&(x<(M+=g)&&(x=M),M=0),e.addJot&&n<e.body.length-1&&(x+=p),k.height=b,k.depth=x,v+=b,k.pos=v,v+=x+M,a[n]=k,y(i[n+1])}var N,E,O=v/2+t.fontMetrics().axisHeight,A=e.cols||[],T=[],D=[];if(e.tags&&e.tags.some(e=>e))for(n=0;n<o;++n){var I=a[n],_=I.pos-O,R=e.tags[n],L=void 0;(L=!0===R?$O(["eqn-num"],[],t):$O([],!1===R?[]:fA(R,t,!0),t)).depth=I.depth,L.height=I.height,D.push({type:"elem",elem:L,shift:_})}for(r=0,E=0;r<s||E<A.length;++r,++E){for(var B,P=A[E],z=!0;"separator"===(null==(j=P)?void 0:j.type);){var j;if(z||((N=$O(["arraycolsep"],[])).style.width=wE(t.fontMetrics().doubleRuleSep),T.push(N)),"|"!==P.separator&&":"!==P.separator)throw new VN("Invalid separator type: "+P.separator);var V="|"===P.separator?"solid":"dashed",$=$O(["vertical-separator"],[],t);$.style.height=wE(v),$.style.borderRightWidth=wE(c),$.style.borderRightStyle=V,$.style.margin="0 "+wE(-c/2);var H=v-O;H&&($.style.verticalAlign=wE(-H)),T.push($),P=A[++E],z=!1}if(!(r>=s)){var q,F,W=void 0;if(r>0||e.hskipBeforeAndAfter)0!==(W=null!=(q=null==(F=P)?void 0:F.pregap)?q:u)&&((N=$O(["arraycolsep"],[])).style.width=wE(W),T.push(N));var U=[];for(n=0;n<o;++n){var G=a[n],K=G.cells[r];if(K){var J=G.pos-O;K.depth=G.depth,K.height=G.height,U.push({type:"elem",elem:K,shift:J})}}var Z,Y,X=UO({positionType:"individualShift",children:U}),Q=$O(["col-align-"+((null==(B=P)?void 0:B.align)||"c")],[X]);if(T.push(Q),r<s-1||e.hskipBeforeAndAfter)0!==(W=null!=(Z=null==(Y=P)?void 0:Y.postgap)?Z:u)&&((N=$O(["arraycolsep"],[])).style.width=wE(W),T.push(N))}}var ee=$O(["mtable"],T);if(l.length>0){for(var te=qO("katex-hline",t,c),ne=qO("katex-hdashline",t,c),re=[{type:"elem",elem:ee,shift:0}];l.length>0;){var oe=l.pop(),ie=oe.pos-O;oe.isDashed?re.push({type:"elem",elem:ne,shift:ie}):re.push({type:"elem",elem:te,shift:ie})}ee=UO({positionType:"individualShift",children:re})}if(0===D.length)return $O(["mord"],[ee],t);var se=UO({positionType:"individualShift",children:D}),ae=$O(["katex-tag"],[se],t);return FO([ee,ae])},nD={c:"center ",l:"left ",r:"right "},rD=function(e,t){for(var n=[],r=new SA("mtd",[],["mtr-glue"]),o=new SA("mtd",[],["mml-eqn-num"]),i=0;i<e.body.length;i++){for(var s=e.body[i],a=[],l=0;l<s.length;l++)a.push(new SA("mtd",[BA(s[l],t)]));e.tags&&e.tags[i]&&(a.unshift(r),a.push(r),e.leqno?a.unshift(o):a.push(o)),n.push(new SA("mtr",a))}var c=new SA("mtable",n),d=.5===e.arraystretch?.1:.16+e.arraystretch-1+(e.addJot?.09:0);c.setAttribute("rowspacing",wE(d));var u="",h="";if(e.cols&&e.cols.length>0){var p=e.cols,f="",m=!1,g=0,v=p.length;"separator"===p[0].type&&(u+="top ",g=1),"separator"===p[p.length-1].type&&(u+="bottom ",v-=1);for(var y=g;y<v;y++){var w=p[y];"align"===w.type?(h+=nD[w.align],m&&(f+="none "),m=!0):"separator"===w.type&&m&&(f+="|"===w.separator?"solid ":"dashed ",m=!1)}c.setAttribute("columnalign",h.trim()),/[sd]/.test(f)&&c.setAttribute("columnlines",f.trim())}if("align"===e.colSeparationType){for(var b=e.cols||[],x="",k=1;k<b.length;k++)x+=k%2?"0em ":"1em ";c.setAttribute("columnspacing",x.trim())}else"alignat"===e.colSeparationType||"gather"===e.colSeparationType?c.setAttribute("columnspacing","0em"):"small"===e.colSeparationType?c.setAttribute("columnspacing","0.2778em"):"CD"===e.colSeparationType?c.setAttribute("columnspacing","0.5em"):c.setAttribute("columnspacing","1em");var C="",S=e.hLinesBeforeRow;u+=S[0].length>0?"left ":"",u+=S[S.length-1].length>0?"right ":"";for(var M=1;M<S.length-1;M++)C+=0===S[M].length?"none ":S[M][0]?"dashed ":"solid ";return/[sd]/.test(C)&&c.setAttribute("rowlines",C.trim()),""!==u&&(c=new SA("menclose",[c])).setAttribute("notation",u.trim()),e.arraystretch&&e.arraystretch<1&&(c=new SA("mstyle",[c])).setAttribute("scriptlevel","1"),c},oD=function(e,t){e.envName.includes("ed")||ZT(e);var n=[],r="split"===e.envName,o=QT(e.parser,{cols:n,addJot:!0,autoTag:r?void 0:XT(e.envName),emptySingleRow:!0,colSeparationType:e.envName.includes("at")?"alignat":"align",maxNumCols:r?2:void 0,leqno:e.parser.settings.leqno},"display"),i=0,s=0,a={type:"ordgroup",mode:e.mode,body:[]};if(t[0]&&"ordgroup"===t[0].type){var l="Number of columns should be a positive integer",c=eT(t[0],l);if(!/^[0-9]+$/.test(c)||Number(c)<1)throw new VN(l,t[0]);i=Number(c),s=2*i}var d=!s;o.body.forEach(function(e){for(var t=1;t<e.length;t+=2){var n=YA(e[t],"styling");YA(n.body[0],"ordgroup").body.unshift(a)}if(d)s<e.length&&(s=e.length);else{var r=e.length/2;if(i<r)throw new VN("Too many math in a row: expected "+i+", but got "+r,e[0])}});for(var u=0;u<s;++u){var h="r",p=0;u%2==1?h="l":u>0&&d&&(p=1),n[u]={type:"align",align:h,pregap:p,postgap:0}}return o.colSeparationType=d?"align":"alignat",o};FT({type:"array",names:["array","darray"],props:{numArgs:1},handler(e,t){var n=(QA(t[0])?[t[0]]:YA(t[0],"ordgroup").body).map(function(e){var t=XA(e).text;if("lcr".includes(t))return{type:"align",align:t};if("|"===t)return{type:"separator",separator:"|"};if(":"===t)return{type:"separator",separator:":"};throw new VN("Unknown column alignment: "+t,e)}),r={cols:n,hskipBeforeAndAfter:!0,maxNumCols:n.length};return QT(e.parser,r,eD(e.envName))},htmlBuilder:tD,mathmlBuilder:rD}),FT({type:"array",names:["matrix","pmatrix","bmatrix","Bmatrix","vmatrix","Vmatrix","matrix*","pmatrix*","bmatrix*","Bmatrix*","vmatrix*","Vmatrix*"],props:{numArgs:0},handler(e){var t={matrix:null,pmatrix:["(",")"],bmatrix:["[","]"],Bmatrix:["\\{","\\}"],vmatrix:["|","|"],Vmatrix:["\\Vert","\\Vert"]}[e.envName.replace("*","")],n="c",r={hskipBeforeAndAfter:!1,cols:[{type:"align",align:n}]};if("*"===e.envName.charAt(e.envName.length-1)){var o=e.parser;if(o.consumeSpaces(),"["===o.fetch().text){if(o.consume(),o.consumeSpaces(),n=o.fetch().text,!"lcr".includes(n))throw new VN("Expected l or c or r",o.nextToken);o.consume(),o.consumeSpaces(),o.expect("]"),o.consume(),r.cols=[{type:"align",align:n}]}}var i=QT(e.parser,r,eD(e.envName)),s=Math.max(0,...i.body.map(e=>e.length));return i.cols=new Array(s).fill({type:"align",align:n}),t?{type:"leftright",mode:e.mode,body:[i],left:t[0],right:t[1],rightColor:void 0}:i},htmlBuilder:tD,mathmlBuilder:rD}),FT({type:"array",names:["smallmatrix"],props:{numArgs:0},handler(e){var t=QT(e.parser,{arraystretch:.5},"script");return t.colSeparationType="small",t},htmlBuilder:tD,mathmlBuilder:rD}),FT({type:"array",names:["subarray"],props:{numArgs:1},handler(e,t){var n=(QA(t[0])?[t[0]]:YA(t[0],"ordgroup").body).map(function(e){var t=XA(e).text;if("lc".includes(t))return{type:"align",align:t};throw new VN("Unknown column alignment: "+t,e)});if(n.length>1)throw new VN("{subarray} can contain only one column");var r={cols:n,hskipBeforeAndAfter:!1,arraystretch:.5},o=QT(e.parser,r,"script");if(o.body.length>0&&o.body[0].length>1)throw new VN("{subarray} can contain only one column");return o},htmlBuilder:tD,mathmlBuilder:rD}),FT({type:"array",names:["cases","dcases","rcases","drcases"],props:{numArgs:0},handler(e){var t=QT(e.parser,{arraystretch:1.2,cols:[{type:"align",align:"l",pregap:0,postgap:1},{type:"align",align:"l",pregap:0,postgap:0}]},eD(e.envName));return{type:"leftright",mode:e.mode,body:[t],left:e.envName.includes("r")?".":"\\{",right:e.envName.includes("r")?"\\}":".",rightColor:void 0}},htmlBuilder:tD,mathmlBuilder:rD}),FT({type:"array",names:["align","align*","aligned","split"],props:{numArgs:0},handler:oD,htmlBuilder:tD,mathmlBuilder:rD}),FT({type:"array",names:["gathered","gather","gather*"],props:{numArgs:0},handler(e){YT.has(e.envName)&&ZT(e);var t={cols:[{type:"align",align:"c"}],addJot:!0,colSeparationType:"gather",autoTag:XT(e.envName),emptySingleRow:!0,leqno:e.parser.settings.leqno};return QT(e.parser,t,"display")},htmlBuilder:tD,mathmlBuilder:rD}),FT({type:"array",names:["alignat","alignat*","alignedat"],props:{numArgs:1},handler:oD,htmlBuilder:tD,mathmlBuilder:rD}),FT({type:"array",names:["equation","equation*"],props:{numArgs:0},handler(e){ZT(e);var t={autoTag:XT(e.envName),emptySingleRow:!0,singleRow:!0,maxNumCols:1,leqno:e.parser.settings.leqno};return QT(e.parser,t,"display")},htmlBuilder:tD,mathmlBuilder:rD}),FT({type:"array",names:["CD"],props:{numArgs:0},handler:e=>(ZT(e),function(e){var t=[];for(e.gullet.beginGroup(),e.gullet.macros.set("\\cr","\\\\\\relax"),e.gullet.beginGroup();;){t.push(e.parseExpression(!1,"\\\\")),e.gullet.endGroup(),e.gullet.beginGroup();var n=e.fetch().text;if("&"!==n&&"\\\\"!==n){if("\\end"===n){0===t[t.length-1].length&&t.pop();break}throw new VN("Expected \\\\ or \\cr or \\end",e.nextToken)}e.consume()}for(var r=[],o=[r],i=0;i<t.length;i++){for(var s=t[i],a=aT(),l=0;l<s.length;l++)if(lT(s[l])){r.push(a);var c=XA(s[l+=1]).text,d=new Array(2);if(d[0]={type:"ordgroup",mode:"math",body:[]},d[1]={type:"ordgroup",mode:"math",body:[]},"=|.".includes(c));else{if(!"<>AV".includes(c))throw new VN('Expected one of "<>AV=|." after @',s[l]);for(var u=0;u<2;u++){for(var h=!0,p=l+1;p<s.length;p++){if(cT(s[p],c)){h=!1,l=p;break}if(lT(s[p]))throw new VN("Missing a "+c+" character to complete a CD arrow.",s[p]);d[u].body.push(s[p])}if(h)throw new VN("Missing a "+c+" character to complete a CD arrow.",s[l])}}var f={type:"styling",body:[dT(c,d,e)],mode:"math",style:"display",resetFont:!0};r.push(f),a=aT()}else a.body.push(s[l]);i%2==0?r.push(a):r.shift(),r=[],o.push(r)}return e.gullet.endGroup(),e.gullet.endGroup(),{type:"array",mode:"math",body:o,arraystretch:1,addJot:!0,rowGaps:[null],cols:new Array(o[0].length).fill({type:"align",align:"c",pregap:.25,postgap:.25}),colSeparationType:"CD",hLinesBeforeRow:new Array(o.length+1).fill([])}}(e.parser)),htmlBuilder:tD,mathmlBuilder:rD}),UT("\\nonumber","\\gdef\\@eqnsw{0}"),UT("\\notag","\\nonumber"),sA({type:"text",names:["\\hline","\\hdashline"],numArgs:0,allowedInText:!0,allowedInMath:!0,handler(e,t){throw new VN(e.funcName+" valid only within array environment")}});var iD=qT;sA({type:"environment",names:["\\begin","\\end"],numArgs:1,argTypes:["text"],handler(e,t){var n=e.parser,r=e.funcName,o=t[0];if("ordgroup"!==o.type)throw new VN("Invalid environment name",o);var i=eT(o,"Environment name should contain only text characters and spaces",!0);if("\\begin"===r){if(!Object.prototype.hasOwnProperty.call(iD,i))throw new VN("No such environment: "+i,o);var s=iD[i],a=n.parseArguments("\\begin{"+i+"}",s),l=a.args,c=a.optArgs,d={mode:n.mode,envName:i,parser:n},u=s.handler(d,l,c);n.expect("\\end",!1);var h=n.nextToken,p=YA(n.parseFunction(),"environment");if(p.name!==i)throw new VN("Mismatch: \\begin{"+i+"} matched by \\end{"+p.name+"}",h);return u}return{type:"environment",mode:n.mode,name:i,nameGroup:o}}});var sD={"\\Bbb":"\\mathbb","\\bold":"\\mathbf","\\frak":"\\mathfrak"};sA({type:"font",names:["\\mathrm","\\mathit","\\mathbf","\\mathnormal","\\mathsfit","\\mathbb","\\mathcal","\\mathfrak","\\mathscr","\\mathsf","\\mathtt","\\Bbb","\\bold","\\frak"],numArgs:1,allowedInArgument:!0,handler:(e,t)=>{var n=e.parser,r=e.funcName,o=lA(t[0]),i=r in sD?sD[r]:r;return{type:"font",mode:n.mode,font:i.slice(1),body:o}},htmlBuilder:(e,t)=>{var n=e.font,r=t.withFont(n);return bA(e.body,r)},mathmlBuilder:(e,t)=>{var n=e.font,r=t.withFont(n);return BA(e.body,r)}}),sA({type:"mclass",names:["\\boldsymbol","\\bm"],numArgs:1,handler:(e,t)=>{var n=e.parser,r=t[0];return{type:"mclass",mode:n.mode,mclass:iT(r),body:[{type:"font",mode:n.mode,font:"boldsymbol",body:r}],isCharacterBox:KN(r)}}}),sA({type:"font",names:["\\rm","\\sf","\\tt","\\bf","\\it","\\cal"],numArgs:0,allowedInText:!0,handler:(e,t)=>{var n=e.parser,r=e.funcName,o=e.breakOnTokenText,i=n.mode,s=n.parseExpression(!0,o);return{type:"font",mode:i,font:"math"+r.slice(1),body:{type:"ordgroup",mode:n.mode,body:s}}}});var aD=(e,t)=>t?{type:"styling",mode:e.mode,style:t,body:[e]}:e;sA({type:"genfrac",names:["\\cfrac","\\dfrac","\\frac","\\tfrac","\\dbinom","\\binom","\\tbinom","\\\\atopfrac","\\\\bracefrac","\\\\brackfrac"],numArgs:2,allowedInArgument:!0,handler:(e,t)=>{var n,r=e.parser,o=e.funcName,i=t[0],s=t[1],a=null,l=null;switch(o){case"\\cfrac":case"\\dfrac":case"\\frac":case"\\tfrac":n=!0;break;case"\\\\atopfrac":n=!1;break;case"\\dbinom":case"\\binom":case"\\tbinom":n=!1,a="(",l=")";break;case"\\\\bracefrac":n=!1,a="\\{",l="\\}";break;case"\\\\brackfrac":n=!1,a="[",l="]";break;default:throw new Error("Unrecognized genfrac command")}var c="\\cfrac"===o,d=null;return c||o.startsWith("\\d")?d="display":o.startsWith("\\t")&&(d="text"),aD({type:"genfrac",mode:r.mode,numer:i,denom:s,continued:c,hasBarLine:n,leftDelim:a,rightDelim:l,barSize:null},d)},htmlBuilder:(e,t)=>{var n,r=t.style,o=r.fracNum(),i=r.fracDen();n=t.havingStyle(o);var s=bA(e.numer,n,t);if(e.continued){var a=8.5/t.fontMetrics().ptPerEm,l=3.5/t.fontMetrics().ptPerEm;s.height=s.height<a?a:s.height,s.depth=s.depth<l?l:s.depth}n=t.havingStyle(i);var c,d,u,h,p,f,m,g,v,y,w=bA(e.denom,n,t);if(e.hasBarLine?(e.barSize?(d=yE(e.barSize,t),c=qO("frac-line",t,d)):c=qO("frac-line",t),d=c.height,u=c.height):(c=null,d=0,u=t.fontMetrics().defaultRuleThickness),r.size===aE.DISPLAY.size?(h=t.fontMetrics().num1,p=d>0?3*u:7*u,f=t.fontMetrics().denom1):(d>0?(h=t.fontMetrics().num2,p=u):(h=t.fontMetrics().num3,p=3*u),f=t.fontMetrics().denom2),c){var b=t.fontMetrics().axisHeight;h-s.depth-(b+.5*d)<p&&(h+=p-(h-s.depth-(b+.5*d))),b-.5*d-(w.height-f)<p&&(f+=p-(b-.5*d-(w.height-f))),m=UO({positionType:"individualShift",children:[{type:"elem",elem:w,shift:f},{type:"elem",elem:c,shift:-(b-.5*d)},{type:"elem",elem:s,shift:-h}]})}else{var x=h-s.depth-(w.height-f);x<p&&(h+=.5*(p-x),f+=.5*(p-x)),m=UO({positionType:"individualShift",children:[{type:"elem",elem:w,shift:f},{type:"elem",elem:s,shift:-h}]})}return n=t.havingStyle(r),m.height*=n.sizeMultiplier/t.sizeMultiplier,m.depth*=n.sizeMultiplier/t.sizeMultiplier,g=r.size===aE.DISPLAY.size?t.fontMetrics().delim1:r.size===aE.SCRIPTSCRIPT.size?t.havingStyle(aE.SCRIPT).fontMetrics().delim2:t.fontMetrics().delim2,v=null==e.leftDelim?wA(t,["mopen"]):BT(e.leftDelim,g,!0,t.havingStyle(r),e.mode,["mopen"]),y=e.continued?$O([]):null==e.rightDelim?wA(t,["mclose"]):BT(e.rightDelim,g,!0,t.havingStyle(r),e.mode,["mclose"]),$O(["mord"].concat(n.sizingClasses(t)),[v,$O(["mfrac"],[m]),y],t)},mathmlBuilder:(e,t)=>{var n=new SA("mfrac",[BA(e.numer,t),BA(e.denom,t)]);if(e.hasBarLine){if(e.barSize){var r=yE(e.barSize,t);n.setAttribute("linethickness",wE(r))}}else n.setAttribute("linethickness","0px");if(null!=e.leftDelim||null!=e.rightDelim){var o=[];if(null!=e.leftDelim){var i=new SA("mo",[new MA(e.leftDelim.replace("\\",""))]);i.setAttribute("fence","true"),o.push(i)}if(o.push(n),null!=e.rightDelim){var s=new SA("mo",[new MA(e.rightDelim.replace("\\",""))]);s.setAttribute("fence","true"),o.push(s)}return TA(o)}return n}}),sA({type:"infix",names:["\\over","\\choose","\\atop","\\brace","\\brack"],numArgs:0,infix:!0,handler(e){var t,n=e.parser,r=e.funcName,o=e.token;switch(r){case"\\over":t="\\frac";break;case"\\choose":t="\\binom";break;case"\\atop":t="\\\\atopfrac";break;case"\\brace":t="\\\\bracefrac";break;case"\\brack":t="\\\\brackfrac";break;default:throw new Error("Unrecognized infix genfrac command")}return{type:"infix",mode:n.mode,replaceWith:t,token:o}}});var lD=["display","text","script","scriptscript"],cD=function(e){var t=null;return e.length>0&&(t="."===(t=e)?null:t),t};sA({type:"genfrac",names:["\\genfrac"],numArgs:6,allowedInArgument:!0,argTypes:["math","math","size","text","math","math"],handler(e,t){var n,r=e.parser,o=t[4],i=t[5],s=lA(t[0]),a="atom"===s.type&&"open"===s.family?cD(s.text):null,l=lA(t[1]),c="atom"===l.type&&"close"===l.family?cD(l.text):null,d=YA(t[2],"size"),u=null;n=!!d.isBlank||(u=d.value).number>0;var h=null,p=t[3];if("ordgroup"===p.type){if(p.body.length>0){var f=YA(p.body[0],"textord");h=lD[Number(f.text)]}}else p=YA(p,"textord"),h=lD[Number(p.text)];return aD({type:"genfrac",mode:r.mode,numer:o,denom:i,continued:!1,hasBarLine:n,barSize:u,leftDelim:a,rightDelim:c},h)}}),sA({type:"infix",names:["\\above"],numArgs:1,argTypes:["size"],infix:!0,handler(e,t){var n=e.parser;e.funcName;var r=e.token;return{type:"infix",mode:n.mode,replaceWith:"\\\\abovefrac",size:YA(t[0],"size").value,token:r}}}),sA({type:"genfrac",names:["\\\\abovefrac"],numArgs:3,argTypes:["math","size","math"],handler:(e,t)=>{var n=e.parser;e.funcName;var r=t[0],o=YA(t[1],"infix").size;if(!o)throw new Error("\\\\abovefrac expected size, but got "+String(o));var i=t[2],s=o.number>0;return{type:"genfrac",mode:n.mode,numer:r,denom:i,continued:!1,hasBarLine:s,barSize:o,leftDelim:null,rightDelim:null}}});var dD=(e,t)=>{var n,r,o=t.style;"supsub"===e.type?(n=e.sup?bA(e.sup,t.havingStyle(o.sup()),t):bA(e.sub,t.havingStyle(o.sub()),t),r=YA(e.base,"horizBrace")):r=YA(e,"horizBrace");var i,s=bA(r.base,t.havingBaseStyle(aE.DISPLAY)),a=KA(r,t);if(i=r.isOver?UO({positionType:"firstBaseline",children:[{type:"elem",elem:s},{type:"kern",size:.1},{type:"elem",elem:a,wrapperClasses:["svg-align"]}]}):UO({positionType:"bottom",positionData:s.depth+.1+a.height,children:[{type:"elem",elem:a,wrapperClasses:["svg-align"]},{type:"kern",size:.1},{type:"elem",elem:s}]}),n){var l=$O(["minner",r.isOver?"mover":"munder"],[i],t);i=r.isOver?UO({positionType:"firstBaseline",children:[{type:"elem",elem:l},{type:"kern",size:.2},{type:"elem",elem:n}]}):UO({positionType:"bottom",positionData:l.depth+.2+n.height+n.depth,children:[{type:"elem",elem:n},{type:"kern",size:.2},{type:"elem",elem:l}]})}return $O(["minner",r.isOver?"mover":"munder"],[i],t)};sA({type:"horizBrace",names:["\\overbrace","\\underbrace","\\overbracket","\\underbracket"],numArgs:1,handler(e,t){var n=e.parser,r=e.funcName;return{type:"horizBrace",mode:n.mode,label:r,isOver:r.includes("\\over"),base:t[0]}},htmlBuilder:dD,mathmlBuilder:(e,t)=>{var n=WA(e.label);return new SA(e.isOver?"mover":"munder",[BA(e.base,t),n])}}),sA({type:"href",names:["\\href"],numArgs:2,argTypes:["url","original"],allowedInText:!0,handler:(e,t)=>{var n=e.parser,r=t[1],o=YA(t[0],"url").url;return n.settings.isTrusted({command:"\\href",url:o})?{type:"href",mode:n.mode,href:o,body:cA(r)}:n.formatUnsupportedCmd("\\href")},htmlBuilder:(e,t)=>{var n=fA(e.body,t,!1);return function(e,t,n,r){var o=new EE(e,t,n,r);return VO(o),o}(e.href,[],n,t)},mathmlBuilder:(e,t)=>{var n=LA(e.body,t);return n instanceof SA||(n=new SA("mrow",[n])),n.setAttribute("href",e.href),n}}),sA({type:"href",names:["\\url"],numArgs:1,argTypes:["url"],allowedInText:!0,handler:(e,t)=>{var n=e.parser,r=YA(t[0],"url").url;if(!n.settings.isTrusted({command:"\\url",url:r}))return n.formatUnsupportedCmd("\\url");for(var o=[],i=0;i<r.length;i++){var s=r[i];"~"===s&&(s="\\textasciitilde"),o.push({type:"textord",mode:"text",text:s})}var a={type:"text",mode:n.mode,font:"\\texttt",body:o};return{type:"href",mode:n.mode,href:r,body:cA(a)}}}),sA({type:"hbox",names:["\\hbox"],numArgs:1,argTypes:["text"],allowedInText:!0,primitive:!0,handler:(e,t)=>({type:"hbox",mode:e.parser.mode,body:cA(t[0])}),htmlBuilder(e,t){var n=fA(e.body,t.withFont(""),!1);return FO(n)},mathmlBuilder:(e,t)=>new SA("mrow",RA(e.body,t.withFont("")))}),sA({type:"html",names:["\\htmlClass","\\htmlId","\\htmlStyle","\\htmlData"],numArgs:2,argTypes:["raw","original"],allowedInText:!0,handler:(e,t)=>{var n=e.parser,r=e.funcName;e.token;var o,i=YA(t[0],"raw").string,s=t[1];n.settings.strict&&_O({strict:n.settings.strict,errorCode:"htmlExtension",errorMsg:"HTML extension is disabled on strict mode",report:!0});var a={};switch(r){case"\\htmlClass":a.class=i,o={command:"\\htmlClass",class:i};break;case"\\htmlId":a.id=i,o={command:"\\htmlId",id:i};break;case"\\htmlStyle":a.style=i,o={command:"\\htmlStyle",style:i};break;case"\\htmlData":for(var l=[],c="",d=0;d<i.length;d++)i.startsWith("{,}",d)?(c+=",",d+=2):","===i[d]?(l.push(c),c=""):c+=i[d];l.push(c);for(var u=0;u<l.length;u++){var h=l[u],p=h.indexOf("=");if(p<0)throw new VN("\\htmlData key/value '"+h+"' missing equals sign");var f=h.slice(0,p),m=h.slice(p+1);a["data-"+f.trim()]=m}o={command:"\\htmlData",attributes:a};break;default:throw new Error("Unrecognized html command")}return n.settings.isTrusted(o)?{type:"html",mode:n.mode,attributes:a,body:cA(s)}:n.formatUnsupportedCmd(r)},htmlBuilder:(e,t)=>{var n=fA(e.body,t,!1),r=["enclosing"];e.attributes.class&&r.push(...e.attributes.class.trim().split(/\s+/));var o=$O(r,n,t);for(var i of Object.entries(e.attributes)){var s=i[0],a=i[1];"class"!==s&&o.setAttribute(s,a)}return o},mathmlBuilder:(e,t)=>LA(e.body,t)}),sA({type:"htmlmathml",names:["\\html@mathml"],numArgs:2,allowedInArgument:!0,allowedInText:!0,handler:(e,t)=>({type:"htmlmathml",mode:e.parser.mode,html:cA(t[0]),mathml:cA(t[1])}),htmlBuilder:(e,t)=>{var n=fA(e.html,t,!1);return FO(n)},mathmlBuilder:(e,t)=>LA(e.mathml,t)});var uD=function(e){if(/^[-+]? *(\d+(\.\d*)?|\.\d+)$/.test(e))return{number:+e,unit:"bp"};var t=/([-+]?) *(\d+(?:\.\d*)?|\.\d+) *([a-z]{2})/.exec(e);if(!t)throw new VN("Invalid size: '"+e+"' in \\includegraphics");var n={number:+(t[1]+t[2]),unit:t[3]};if(!vE(n))throw new VN("Invalid unit: '"+n.unit+"' in \\includegraphics.");return n};sA({type:"includegraphics",names:["\\includegraphics"],numArgs:1,numOptionalArgs:1,argTypes:["raw","url"],allowedInText:!1,handler:(e,t,n)=>{var r=e.parser,o={number:0,unit:"em"},i={number:.9,unit:"em"},s={number:0,unit:"em"},a="";if(n[0])for(var l=YA(n[0],"raw").string.split(","),c=0;c<l.length;c++){var d=l[c].split("=");if(2===d.length){var u=d[1].trim();switch(d[0].trim()){case"alt":a=u;break;case"width":o=uD(u);break;case"height":i=uD(u);break;case"totalheight":s=uD(u);break;default:throw new VN("Invalid key: '"+d[0]+"' in \\includegraphics.")}}}var h=YA(t[0],"url").url;return""===a&&(a=(a=(a=h).replace(/^.*[\\/]/,"")).substring(0,a.lastIndexOf("."))),r.settings.isTrusted({command:"\\includegraphics",url:h})?{type:"includegraphics",mode:r.mode,alt:a,width:o,height:i,totalheight:s,src:h}:r.formatUnsupportedCmd("\\includegraphics")},htmlBuilder:(e,t)=>{var n=yE(e.height,t),r=0;e.totalheight.number>0&&(r=yE(e.totalheight,t)-n);var o=0;e.width.number>0&&(o=yE(e.width,t));var i={height:wE(n+r)};o>0&&(i.width=wE(o)),r>0&&(i.verticalAlign=wE(-r));var s=new OE(e.src,e.alt,i);return s.height=n,s.depth=r,s},mathmlBuilder:(e,t)=>{var n=new SA("mglyph",[]);n.setAttribute("alt",e.alt);var r=yE(e.height,t),o=0;if(e.totalheight.number>0&&(o=yE(e.totalheight,t)-r,n.setAttribute("valign",wE(-o))),n.setAttribute("height",wE(r+o)),e.width.number>0){var i=yE(e.width,t);n.setAttribute("width",wE(i))}return n.setAttribute("src",e.src),n}}),sA({type:"kern",names:["\\kern","\\mkern","\\hskip","\\mskip"],numArgs:1,argTypes:["size"],primitive:!0,allowedInText:!0,handler(e,t){var n=e.parser,r=e.funcName,o=YA(t[0],"size");if(n.settings.strict){var i="m"===r[1],s="mu"===o.value.unit;i?(s||_O({strict:n.settings.strict,errorCode:"mathVsTextUnits",errorMsg:"LaTeX's "+r+" supports only mu units, not "+o.value.unit+" units",report:!0}),"math"!==n.mode&&_O({strict:n.settings.strict,errorCode:"mathVsTextUnits",errorMsg:"LaTeX's "+r+" works only in math mode",report:!0})):s&&_O({strict:n.settings.strict,errorCode:"mathVsTextUnits",errorMsg:"LaTeX's "+r+" doesn't support mu units",report:!0})}return{type:"kern",mode:n.mode,dimension:o.value}},htmlBuilder:(e,t)=>GO(e.dimension,t),mathmlBuilder(e,t){var n=yE(e.dimension,t);return new NA(n)}}),sA({type:"lap",names:["\\mathllap","\\mathrlap","\\mathclap"],numArgs:1,allowedInText:!0,handler:(e,t)=>{var n=e.parser,r=e.funcName,o=t[0];return{type:"lap",mode:n.mode,alignment:r.slice(5),body:o}},htmlBuilder:(e,t)=>{var n;"clap"===e.alignment?(n=$O([],[bA(e.body,t)]),n=$O(["katex-inner"],[n],t)):n=$O(["katex-inner"],[bA(e.body,t)]);var r=$O(["katex-fix"],[]),o=$O([e.alignment],[n,r],t),i=$O(["katex-strut"]);return i.style.height=wE(o.height+o.depth),o.depth&&(i.style.verticalAlign=wE(-o.depth)),o.children.unshift(i),o=$O(["katex-thinbox"],[o],t),$O(["mord","katex-vbox"],[o],t)},mathmlBuilder:(e,t)=>{var n=new SA("mpadded",[BA(e.body,t)]);if("rlap"!==e.alignment){var r="llap"===e.alignment?"-1":"-0.5";n.setAttribute("lspace",r+"width")}return n.setAttribute("width","0px"),n}}),sA({type:"styling",names:["\\(","$"],numArgs:0,allowedInText:!0,allowedInMath:!1,handler(e,t){var n=e.funcName,r=e.parser,o=r.mode;r.switchMode("math");var i="\\("===n?"\\)":"$",s=r.parseExpression(!1,i);return r.expect(i),r.switchMode(o),{type:"styling",mode:r.mode,style:"text",resetFont:!0,body:s}}}),sA({type:"text",names:["\\)","\\]"],numArgs:0,allowedInText:!0,allowedInMath:!1,handler(e,t){throw new VN("Mismatched "+e.funcName)}});var hD=(e,t)=>{switch(t.style.size){case aE.DISPLAY.size:return e.display;case aE.TEXT.size:return e.text;case aE.SCRIPT.size:return e.script;case aE.SCRIPTSCRIPT.size:return e.scriptscript;default:return e.text}};sA({type:"mathchoice",names:["\\mathchoice"],numArgs:4,primitive:!0,handler:(e,t)=>({type:"mathchoice",mode:e.parser.mode,display:cA(t[0]),text:cA(t[1]),script:cA(t[2]),scriptscript:cA(t[3])}),htmlBuilder:(e,t)=>{var n=hD(e,t),r=fA(n,t,!1);return FO(r)},mathmlBuilder:(e,t)=>{var n=hD(e,t);return LA(n,t)}});var pD=(e,t,n,r,o,i,s)=>{e=$O([],[e]);var a,l,c,d=n&&KN(n);if(t){var u=bA(t,r.havingStyle(o.sup()),r);l={elem:u,kern:Math.max(r.fontMetrics().bigOpSpacing1,r.fontMetrics().bigOpSpacing3-u.depth)}}if(n){var h=bA(n,r.havingStyle(o.sub()),r);a={elem:h,kern:Math.max(r.fontMetrics().bigOpSpacing2,r.fontMetrics().bigOpSpacing4-h.height)}}if(l&&a){var p=r.fontMetrics().bigOpSpacing5+a.elem.height+a.elem.depth+a.kern+e.depth+s;c=UO({positionType:"bottom",positionData:p,children:[{type:"kern",size:r.fontMetrics().bigOpSpacing5},{type:"elem",elem:a.elem,marginLeft:wE(-i)},{type:"kern",size:a.kern},{type:"elem",elem:e},{type:"kern",size:l.kern},{type:"elem",elem:l.elem,marginLeft:wE(i)},{type:"kern",size:r.fontMetrics().bigOpSpacing5}]})}else if(a){var f=e.height-s;c=UO({positionType:"top",positionData:f,children:[{type:"kern",size:r.fontMetrics().bigOpSpacing5},{type:"elem",elem:a.elem,marginLeft:wE(-i)},{type:"kern",size:a.kern},{type:"elem",elem:e}]})}else{if(!l)return e;var m=e.depth+s;c=UO({positionType:"bottom",positionData:m,children:[{type:"elem",elem:e},{type:"kern",size:l.kern},{type:"elem",elem:l.elem,marginLeft:wE(i)},{type:"kern",size:r.fontMetrics().bigOpSpacing5}]})}var g=[c];if(a&&0!==i&&!d){var v=$O(["mspace"],[],r);v.style.marginRight=wE(i),g.unshift(v)}return $O(["mop","op-limits"],g,r)},fD=new Set(["\\smallint"]),mD=(e,t)=>{var n,r,o,i=!1;"supsub"===e.type?(n=e.sup,r=e.sub,o=YA(e.base,"op"),i=!0):o=YA(e,"op");var s,a,l=t.style,c=!1;if(l.size===aE.DISPLAY.size&&o.symbol&&!fD.has(o.name)&&(c=!0),o.symbol){var d=c?"Size2-Regular":"Size1-Regular",u="";if("\\oiint"!==o.name&&"\\oiiint"!==o.name||(u=o.name.slice(1),o.name="oiint"===u?"\\iint":"\\iiint"),a=(s=LO(o.name,d,"math",t,["mop","op-symbol",c?"large-op":"small-op"])).italic,u.length>0){var h=YO(u+"Size"+(c?"2":"1"),t);s=UO({positionType:"individualShift",children:[{type:"elem",elem:s,shift:0},{type:"elem",elem:h,shift:c?.08:0}]}),o.name="\\"+u,s.classes.unshift("mop"),s.italic=a}}else if(o.body){var p=fA(o.body,t,!0);1===p.length&&p[0]instanceof TE?(s=p[0]).classes[0]="mop":s=$O(["mop"],p,t)}else{for(var f=[],m=1;m<o.name.length;m++)f.push(BO(o.name[m],o.mode,t));s=$O(["mop"],f,t)}var g,v=0,y=0;(s instanceof TE||"\\oiint"===o.name||"\\oiiint"===o.name)&&!o.suppressBaseShift&&(v=(s.height-s.depth)/2-t.fontMetrics().axisHeight,y=null!=(g=s.italic)?g:0);return i?pD(s,n,r,t,l,y,v):(v&&(s.style.position="relative",s.style.top=wE(v)),s)},gD={"∏":"\\prod","∐":"\\coprod","∑":"\\sum","⋀":"\\bigwedge","⋁":"\\bigvee","⋂":"\\bigcap","⋃":"\\bigcup","⨀":"\\bigodot","⨁":"\\bigoplus","⨂":"\\bigotimes","⨄":"\\biguplus","⨆":"\\bigsqcup"};sA({type:"op",names:["\\coprod","\\bigvee","\\bigwedge","\\biguplus","\\bigcap","\\bigcup","\\intop","\\prod","\\sum","\\bigotimes","\\bigoplus","\\bigodot","\\bigsqcup","\\smallint","∏","∐","∑","⋀","⋁","⋂","⋃","⨀","⨁","⨂","⨄","⨆"],numArgs:0,handler:(e,t)=>{var n=e.parser,r=e.funcName;return 1===r.length&&(r=gD[r]),{type:"op",mode:n.mode,limits:!0,parentIsSupSub:!1,symbol:!0,name:r}},htmlBuilder:mD,mathmlBuilder:(e,t)=>{var n;if(e.symbol)n=new SA("mo",[AA(e.name,e.mode)]),fD.has(e.name)&&n.setAttribute("largeop","false");else if(e.body)n=new SA("mo",RA(e.body,t));else{n=new SA("mi",[new MA(e.name.slice(1))]);var r=new SA("mo",[AA("⁡","text")]);n=e.parentIsSupSub?new SA("mrow",[n,r]):CA([n,r])}return n}}),sA({type:"op",names:["\\mathop"],numArgs:1,primitive:!0,handler:(e,t)=>{var n=e.parser,r=t[0];return{type:"op",mode:n.mode,limits:!1,parentIsSupSub:!1,symbol:!1,body:cA(r)}}});var vD={"∫":"\\int","∬":"\\iint","∭":"\\iiint","∮":"\\oint","∯":"\\oiint","∰":"\\oiiint"};sA({type:"op",names:["\\arcsin","\\arccos","\\arctan","\\arctg","\\arcctg","\\arg","\\ch","\\cos","\\cosec","\\cosh","\\cot","\\cotg","\\coth","\\csc","\\ctg","\\cth","\\deg","\\dim","\\exp","\\hom","\\ker","\\lg","\\ln","\\log","\\sec","\\sin","\\sinh","\\sh","\\tan","\\tanh","\\tg","\\th"],numArgs:0,handler(e){var t=e.parser,n=e.funcName;return{type:"op",mode:t.mode,limits:!1,parentIsSupSub:!1,symbol:!1,name:n}}}),sA({type:"op",names:["\\det","\\gcd","\\inf","\\lim","\\max","\\min","\\Pr","\\sup"],numArgs:0,handler(e){var t=e.parser,n=e.funcName;return{type:"op",mode:t.mode,limits:!0,parentIsSupSub:!1,symbol:!1,name:n}}}),sA({type:"op",names:["\\int","\\iint","\\iiint","\\oint","\\oiint","\\oiiint","∫","∬","∭","∮","∯","∰"],numArgs:0,allowedInArgument:!0,handler(e){var t=e.parser,n=e.funcName;return 1===n.length&&(n=vD[n]),{type:"op",mode:t.mode,limits:!1,parentIsSupSub:!1,symbol:!0,name:n}}});var yD=(e,t)=>{var n,r,o,i,s=!1;if("supsub"===e.type?(n=e.sup,r=e.sub,o=YA(e.base,"operatorname"),s=!0):o=YA(e,"operatorname"),o.body.length>0){for(var a=(o.body.map(e=>{var t="text"in e?e.text:void 0;return"string"==typeof t?{type:"textord",mode:e.mode,text:t}:e})),l=fA(a,t.withFont("mathrm"),!0),c=0;c<l.length;c++){var d=l[c];d instanceof TE&&(d.text=d.text.replace(/\u2212/,"-").replace(/\u2217/,"*"))}i=$O(["mop"],l,t)}else i=$O(["mop"],[],t);return s?pD(i,n,r,t,t.style,0,0):i};sA({type:"operatorname",names:["\\operatorname@","\\operatornamewithlimits"],numArgs:1,handler:(e,t)=>{var n=e.parser,r=e.funcName,o=t[0];return{type:"operatorname",mode:n.mode,body:cA(o),alwaysHandleSupSub:"\\operatornamewithlimits"===r,limits:!1,parentIsSupSub:!1}},htmlBuilder:yD,mathmlBuilder:(e,t)=>{for(var n=RA(e.body,t.withFont("mathrm")),r=!0,o=0;o<n.length;o++){var i=n[o];if(i instanceof NA);else if(i instanceof SA)switch(i.type){case"mi":case"mn":case"mspace":case"mtext":break;case"mo":var s=i.children[0];1===i.children.length&&s instanceof MA?s.text=s.text.replace(/\u2212/,"-").replace(/\u2217/,"*"):r=!1;break;default:r=!1}else r=!1}if(r){var a=n.map(e=>e.toText()).join("");n=[new MA(a)]}var l=new SA("mi",n);l.setAttribute("mathvariant","normal");var c=new SA("mo",[AA("⁡","text")]);return e.parentIsSupSub?new SA("mrow",[l,c]):CA([l,c])}}),UT("\\operatorname","\\@ifstar\\operatornamewithlimits\\operatorname@"),aA({type:"ordgroup",htmlBuilder:(e,t)=>e.semisimple?FO(fA(e.body,t,!1)):$O(["mord"],fA(e.body,t,!0),t),mathmlBuilder:(e,t)=>LA(e.body,t,!0)}),sA({type:"overline",names:["\\overline"],numArgs:1,handler(e,t){var n=e.parser,r=t[0];return{type:"overline",mode:n.mode,body:r}},htmlBuilder(e,t){var n=bA(e.body,t.havingCrampedStyle()),r=qO("overline-line",t),o=t.fontMetrics().defaultRuleThickness,i=UO({positionType:"firstBaseline",children:[{type:"elem",elem:n},{type:"kern",size:3*o},{type:"elem",elem:r},{type:"kern",size:o}]});return $O(["mord","katex-overline"],[i],t)},mathmlBuilder(e,t){var n=new SA("mo",[new MA("‾")]);n.setAttribute("stretchy","true");var r=new SA("mover",[BA(e.body,t),n]);return r.setAttribute("accent","true"),r}}),sA({type:"phantom",names:["\\phantom"],numArgs:1,allowedInText:!0,handler:(e,t)=>{var n=e.parser,r=t[0];return{type:"phantom",mode:n.mode,body:cA(r)}},htmlBuilder:(e,t)=>{var n=fA(e.body,t.withPhantom(),!1);return FO(n)},mathmlBuilder:(e,t)=>{var n=RA(e.body,t);return new SA("mphantom",n)}}),UT("\\hphantom","\\smash{\\phantom{#1}}"),sA({type:"vphantom",names:["\\vphantom"],numArgs:1,allowedInText:!0,handler:(e,t)=>{var n=e.parser,r=t[0];return{type:"vphantom",mode:n.mode,body:r}},htmlBuilder:(e,t)=>{var n=$O(["katex-inner"],[bA(e.body,t.withPhantom())]),r=$O(["katex-fix"],[]);return $O(["mord","rlap"],[n,r],t)},mathmlBuilder:(e,t)=>{var n=RA(cA(e.body),t),r=new SA("mphantom",n),o=new SA("mpadded",[r]);return o.setAttribute("width","0px"),o}}),sA({type:"raisebox",names:["\\raisebox"],numArgs:2,argTypes:["size","hbox"],allowedInText:!0,handler(e,t){var n=e.parser,r=YA(t[0],"size").value,o=t[1];return{type:"raisebox",mode:n.mode,dy:r,body:o}},htmlBuilder(e,t){var n=bA(e.body,t),r=yE(e.dy,t);return UO({positionType:"shift",positionData:-r,children:[{type:"elem",elem:n}]})},mathmlBuilder(e,t){var n=new SA("mpadded",[BA(e.body,t)]),r=e.dy.number+e.dy.unit;return n.setAttribute("voffset",r),n}});var wD=(e,t)=>({type:"reflectbox",mode:e.parser.mode,body:t[0]});function bD(e,t,n){for(var r=fA(e,t,!1),o=t.sizeMultiplier/n.sizeMultiplier,i=0;i<r.length;i++){var s=r[i].classes.indexOf("katex-sizing");s<0?Array.prototype.push.apply(r[i].classes,t.sizingClasses(n)):r[i].classes[s+1]==="reset-size"+t.size&&(r[i].classes[s+1]="reset-size"+n.size),r[i].height*=o,r[i].depth*=o}return FO(r)}sA({type:"reflectbox",names:["\\reflectbox"],numArgs:1,argTypes:["hbox"],allowedInText:!0,handler:wD,htmlBuilder:(e,t)=>$O(["mord","reflectbox"],[bA(e.body,t)],t),mathmlBuilder:(e,t)=>BA(e.body,t)}),sA({type:"reflectbox",names:["\\mathreflectbox"],numArgs:1,argTypes:["math"],handler:wD}),sA({type:"internal",names:["\\relax"],numArgs:0,allowedInText:!0,allowedInArgument:!0,handler:e=>({type:"internal",mode:e.parser.mode})}),sA({type:"rule",names:["\\rule"],numArgs:2,numOptionalArgs:1,allowedInText:!0,allowedInMath:!0,argTypes:["size","size","size"],handler(e,t,n){var r=e.parser,o=n[0],i=YA(t[0],"size"),s=YA(t[1],"size");return{type:"rule",mode:r.mode,shift:o&&YA(o,"size").value,width:i.value,height:s.value}},htmlBuilder(e,t){var n=$O(["mord","katex-rule"],[],t),r=yE(e.width,t),o=yE(e.height,t),i=e.shift?yE(e.shift,t):0;return n.style.borderRightWidth=wE(r),n.style.borderTopWidth=wE(o),n.style.bottom=wE(i),n.width=r,n.height=o+i,n.depth=-i,n.maxFontSize=1.125*o*t.sizeMultiplier,n},mathmlBuilder(e,t){var n=yE(e.width,t),r=yE(e.height,t),o=e.shift?yE(e.shift,t):0,i=t.color&&t.getColor()||"black",s=new SA("mspace");s.setAttribute("mathbackground",i),s.setAttribute("width",wE(n)),s.setAttribute("height",wE(r));var a=new SA("mpadded",[s]);return o>=0?a.setAttribute("height",wE(o)):(a.setAttribute("height",wE(o)),a.setAttribute("depth",wE(-o))),a.setAttribute("voffset",wE(o)),a}});var xD=["\\tiny","\\sixptsize","\\scriptsize","\\footnotesize","\\small","\\normalsize","\\large","\\Large","\\LARGE","\\huge","\\Huge"];sA({type:"sizing",names:xD,numArgs:0,allowedInText:!0,handler:(e,t)=>{var n=e.breakOnTokenText,r=e.funcName,o=e.parser,i=o.parseExpression(!1,n);return{type:"sizing",mode:o.mode,size:xD.indexOf(r)+1,body:i}},htmlBuilder:(e,t)=>{var n=t.havingSize(e.size);return bD(e.body,n,t)},mathmlBuilder:(e,t)=>{var n=t.havingSize(e.size),r=RA(e.body,n),o=new SA("mstyle",r);return o.setAttribute("mathsize",wE(n.sizeMultiplier)),o}}),sA({type:"smash",names:["\\smash"],numArgs:1,numOptionalArgs:1,allowedInText:!0,handler:(e,t,n)=>{var r=e.parser,o=!1,i=!1,s=n[0]&&YA(n[0],"ordgroup");if(s)for(var a,l=0;l<s.body.length;++l){if("t"===(a=XA(s.body[l]).text))o=!0;else{if("b"!==a){o=!1,i=!1;break}i=!0}}else o=!0,i=!0;var c=t[0];return{type:"smash",mode:r.mode,body:c,smashHeight:o,smashDepth:i}},htmlBuilder:(e,t)=>{var n=$O([],[bA(e.body,t)]);if(!e.smashHeight&&!e.smashDepth)return n;if(e.smashHeight&&(n.height=0),e.smashDepth&&(n.depth=0),e.smashHeight&&e.smashDepth)return $O(["mord","katex-smash"],[n],t);if(n.children)for(var r=0;r<n.children.length;r++)e.smashHeight&&(n.children[r].height=0),e.smashDepth&&(n.children[r].depth=0);var o=UO({positionType:"firstBaseline",children:[{type:"elem",elem:n}]});return $O(["mord"],[o],t)},mathmlBuilder:(e,t)=>{var n=new SA("mpadded",[BA(e.body,t)]);return e.smashHeight&&n.setAttribute("height","0px"),e.smashDepth&&n.setAttribute("depth","0px"),n}}),sA({type:"sqrt",names:["\\sqrt"],numArgs:1,numOptionalArgs:1,handler(e,t,n){var r=e.parser,o=n[0],i=t[0];return{type:"sqrt",mode:r.mode,body:i,index:o}},htmlBuilder(e,t){var n=bA(e.body,t.havingCrampedStyle());0===n.height&&(n.height=t.fontMetrics().xHeight),n=WO(n,t);var r=t.fontMetrics().defaultRuleThickness,o=r;t.style.id<aE.TEXT.id&&(o=t.fontMetrics().xHeight);var i=r+o/4,s=function(e,t){var n,r,o,i,s,a=t.havingBaseSizing(),l=LT("\\surd",e*a.sizeMultiplier,_T,a),c=a.sizeMultiplier,d=Math.max(0,t.minRuleThickness-t.fontMetrics().sqrtRuleThickness);return"small"===l.type?(e<1?c=1:e<1.4&&(c=.7),o=(1+d)/c,(n=MT("sqrtMain",r=(1+d+ST)/c,i=1e3+1e3*d+80,d,t)).style.minWidth="0.853em",s=.833/c):"large"===l.type?(i=1080*AT[l.size],o=(AT[l.size]+d)/c,r=(AT[l.size]+d+ST)/c,(n=MT("sqrtSize"+l.size,r,i,d,t)).style.minWidth="1.02em",s=1/c):(r=e+d+ST,o=e+d,i=Math.floor(1e3*e+d)+80,(n=MT("sqrtTall",r,i,d,t)).style.minWidth="0.742em",s=1.056),n.height=o,n.style.height=wE(r),{span:n,advanceWidth:s,ruleWidth:(t.fontMetrics().sqrtRuleThickness+d)*c}}(n.height+n.depth+i+r,t),a=s.span,l=s.ruleWidth,c=s.advanceWidth,d=a.height-l;d>n.height+n.depth+i&&(i=(i+d-n.height-n.depth)/2);var u=a.height-n.height-i-l;n.style.paddingLeft=wE(c);var h=UO({positionType:"firstBaseline",children:[{type:"elem",elem:n,wrapperClasses:["svg-align"]},{type:"kern",size:-(n.height+u)},{type:"elem",elem:a},{type:"kern",size:l}]});if(e.index){var p=t.havingStyle(aE.SCRIPTSCRIPT),f=bA(e.index,p,t),m=.6*(h.height-h.depth),g=UO({positionType:"shift",positionData:-m,children:[{type:"elem",elem:f}]}),v=$O(["katex-root"],[g]);return $O(["mord","sqrt"],[v,h],t)}return $O(["mord","sqrt"],[h],t)},mathmlBuilder(e,t){var n=e.body,r=e.index;return r?new SA("mroot",[BA(n,t),BA(r,t)]):new SA("msqrt",[BA(n,t)])}});var kD={display:aE.DISPLAY,text:aE.TEXT,script:aE.SCRIPT,scriptscript:aE.SCRIPTSCRIPT};sA({type:"styling",names:["\\displaystyle","\\textstyle","\\scriptstyle","\\scriptscriptstyle"],numArgs:0,allowedInText:!0,primitive:!0,handler(e,t){var n=e.breakOnTokenText,r=e.funcName,o=e.parser,i=o.parseExpression(!0,n),s=r.slice(1,r.length-5);if(!(s in kD))throw new Error("Unknown style: "+s);return{type:"styling",mode:o.mode,style:s,body:i}},htmlBuilder(e,t){var n=kD[e.style],r=t.havingStyle(n);return e.resetFont&&(r=r.withFont("")),bD(e.body,r,t)},mathmlBuilder(e,t){var n=kD[e.style],r=t.havingStyle(n);e.resetFont&&(r=r.withFont(""));var o=RA(e.body,r),i=new SA("mstyle",o),s={display:["0","true"],text:["0","false"],script:["1","false"],scriptscript:["2","false"]}[e.style];return i.setAttribute("scriptlevel",s[0]),i.setAttribute("displaystyle",s[1]),i}});aA({type:"supsub",htmlBuilder(e,t){var n=function(e,t){var n=e.base;return n?"op"===n.type?n.limits&&(t.style.size===aE.DISPLAY.size||n.alwaysHandleSupSub)?mD:null:"operatorname"===n.type?n.alwaysHandleSupSub&&(t.style.size===aE.DISPLAY.size||n.limits)?yD:null:"accent"===n.type?KN(n.base)?nT:null:"horizBrace"===n.type&&!e.sub===n.isOver?dD:null:null}(e,t);if(n)return n(e,t);var r,o,i,s=e.base,a=e.sup,l=e.sub,c=bA(s,t),d=t.fontMetrics(),u=0,h=0,p=s&&KN(s);if(a){var f=t.havingStyle(t.style.sup());r=bA(a,f,t),p||(u=c.height-f.fontMetrics().supDrop*f.sizeMultiplier/t.sizeMultiplier)}if(l){var m=t.havingStyle(t.style.sub());o=bA(l,m,t),p||(h=c.depth+m.fontMetrics().subDrop*m.sizeMultiplier/t.sizeMultiplier)}i=t.style===aE.DISPLAY?d.sup1:t.style.cramped?d.sup3:d.sup2;var g,v=t.sizeMultiplier,y=wE(.5/d.ptPerEm/v),w=null;if(o){var b,x=e.base&&"op"===e.base.type&&e.base.name&&("\\oiint"===e.base.name||"\\oiiint"===e.base.name);if(c instanceof TE||x)w=wE(-(null!=(b=c.italic)?b:0))}if(r&&o){u=Math.max(u,i,r.depth+.25*d.xHeight),h=Math.max(h,d.sub2);var k=4*d.defaultRuleThickness;if(u-r.depth-(o.height-h)<k){h=k-(u-r.depth)+o.height;var C=.8*d.xHeight-(u-r.depth);C>0&&(u+=C,h-=C)}g=UO({positionType:"individualShift",children:[{type:"elem",elem:o,shift:h,marginRight:y,marginLeft:w},{type:"elem",elem:r,shift:-u,marginRight:y}]})}else if(o){h=Math.max(h,d.sub1,o.height-.8*d.xHeight),g=UO({positionType:"shift",positionData:h,children:[{type:"elem",elem:o,marginLeft:w,marginRight:y}]})}else{if(!r)throw new Error("supsub must have either sup or sub.");u=Math.max(u,i,r.depth+.25*d.xHeight),g=UO({positionType:"shift",positionData:-u,children:[{type:"elem",elem:r,marginRight:y}]})}var S=yA(c,"right")||"mord";return $O([S],[c,$O(["msupsub"],[g])],t)},mathmlBuilder(e,t){var n,r=!1;e.base&&"horizBrace"===e.base.type&&!!e.sup===e.base.isOver&&(r=!0,n=e.base.isOver),!e.base||"op"!==e.base.type&&"operatorname"!==e.base.type||(e.base.parentIsSupSub=!0);var o,i=[BA(e.base,t)];if(e.sub&&i.push(BA(e.sub,t)),e.sup&&i.push(BA(e.sup,t)),r)o=n?"mover":"munder";else if(e.sub)if(e.sup){var s=e.base;o=s&&"op"===s.type&&s.limits&&t.style===aE.DISPLAY||s&&"operatorname"===s.type&&s.alwaysHandleSupSub&&(t.style===aE.DISPLAY||s.limits)?"munderover":"msubsup"}else{var a=e.base;o=a&&"op"===a.type&&a.limits&&(t.style===aE.DISPLAY||a.alwaysHandleSupSub)||a&&"operatorname"===a.type&&a.alwaysHandleSupSub&&(a.limits||t.style===aE.DISPLAY)?"munder":"msub"}else{var l=e.base;o=l&&"op"===l.type&&l.limits&&(t.style===aE.DISPLAY||l.alwaysHandleSupSub)||l&&"operatorname"===l.type&&l.alwaysHandleSupSub&&(l.limits||t.style===aE.DISPLAY)?"mover":"msup"}return new SA(o,i)}}),aA({type:"atom",htmlBuilder:(e,t)=>BO(e.text,e.mode,t,["m"+e.family]),mathmlBuilder(e,t){var n=new SA("mo",[AA(e.text,e.mode)]);if("bin"===e.family){var r=IA(e,t);"bold-italic"===r&&n.setAttribute("mathvariant",r)}else"punct"===e.family?n.setAttribute("separator","true"):"open"!==e.family&&"close"!==e.family||n.setAttribute("stretchy","false");return n}});var CD={mi:"italic",mn:"normal",mtext:"normal"};aA({type:"mathord",htmlBuilder:(e,t)=>PO(e,t),mathmlBuilder(e,t){var n=new SA("mi",[AA(e.text,e.mode,t)]),r=IA(e,t)||"italic";return r!==CD[n.type]&&n.setAttribute("mathvariant",r),n}}),aA({type:"textord",htmlBuilder:(e,t)=>PO(e,t),mathmlBuilder(e,t){var n,r=AA(e.text,e.mode,t),o=IA(e,t)||"normal";return n="text"===e.mode?new SA("mtext",[r]):/[0-9]/.test(e.text)?new SA("mn",[r]):"\\prime"===e.text?new SA("mo",[r]):new SA("mi",[r]),o!==CD[n.type]&&n.setAttribute("mathvariant",o),n}});var SD=new Map([["\\nobreak","nobreak"],["\\allowbreak","allowbreak"]]),MD=new Map([[" ",{}],["\\ ",{}],["~",{className:"nobreak"}],["\\space",{}],["\\nobreakspace",{className:"nobreak"}]]);aA({type:"spacing",htmlBuilder(e,t){var n=MD.get(e.text),r=SD.get(e.text);if(n){var o=n.className||"";if("text"===e.mode){var i=PO(e,t);return i.classes.push(o),i}return $O(["mspace",o],[BO(e.text,e.mode,t)],t)}if(r)return $O(["mspace",r],[],t);throw new VN('Unknown type of space "'+e.text+'"')},mathmlBuilder(e,t){if(!MD.has(e.text)){if(SD.has(e.text))return new SA("mspace");throw new VN('Unknown type of space "'+e.text+'"')}return new SA("mtext",[new MA(" ")])}});var ND=()=>{var e=new SA("mtd",[]);return e.setAttribute("width","50%"),e};aA({type:"tag",mathmlBuilder(e,t){var n=new SA("mtable",[new SA("mtr",[ND(),new SA("mtd",[LA(e.body,t)]),ND(),new SA("mtd",[LA(e.tag,t)])])]);return n.setAttribute("width","100%"),n}});var ED={"\\text":void 0,"\\textrm":"textrm","\\textsf":"textsf","\\texttt":"texttt","\\textnormal":"textrm"},OD={"\\textbf":"textbf","\\textmd":"textmd"},AD={"\\textit":"textit","\\textup":"textup"},TD=(e,t)=>{var n=e.font;return n?ED[n]?t.withTextFontFamily(ED[n]):OD[n]?t.withTextFontWeight(OD[n]):"\\emph"===n?"textit"===t.fontShape?t.withTextFontShape("textup"):t.withTextFontShape("textit"):t.withTextFontShape(AD[n]):t};sA({type:"text",names:["\\text","\\textrm","\\textsf","\\texttt","\\textnormal","\\textbf","\\textmd","\\textit","\\textup","\\emph"],numArgs:1,argTypes:["text"],allowedInArgument:!0,allowedInText:!0,handler(e,t){var n=e.parser,r=e.funcName,o=t[0];return{type:"text",mode:n.mode,body:cA(o),font:r}},htmlBuilder(e,t){var n=TD(e,t),r=fA(e.body,n,!0);return $O(["mord","text"],r,n)},mathmlBuilder(e,t){var n=TD(e,t);return LA(e.body,n)}}),sA({type:"underline",names:["\\underline"],numArgs:1,allowedInText:!0,handler:(e,t)=>({type:"underline",mode:e.parser.mode,body:t[0]}),htmlBuilder(e,t){var n=bA(e.body,t),r=qO("underline-line",t),o=t.fontMetrics().defaultRuleThickness,i=UO({positionType:"top",positionData:n.height,children:[{type:"kern",size:o},{type:"elem",elem:r},{type:"kern",size:3*o},{type:"elem",elem:n}]});return $O(["mord","katex-underline"],[i],t)},mathmlBuilder(e,t){var n=new SA("mo",[new MA("‾")]);n.setAttribute("stretchy","true");var r=new SA("munder",[BA(e.body,t),n]);return r.setAttribute("accentunder","true"),r}}),sA({type:"vcenter",names:["\\vcenter"],numArgs:1,argTypes:["original"],allowedInText:!1,handler:(e,t)=>({type:"vcenter",mode:e.parser.mode,body:t[0]}),htmlBuilder(e,t){var n=bA(e.body,t),r=t.fontMetrics().axisHeight,o=.5*(n.height-r-(n.depth+r));return UO({positionType:"shift",positionData:o,children:[{type:"elem",elem:n}]})},mathmlBuilder(e,t){var n=new SA("mpadded",[BA(e.body,t)],["vcenter"]);return new SA("mrow",[n])}}),sA({type:"verb",names:["\\verb"],numArgs:0,allowedInText:!0,handler(e,t,n){throw new VN("\\verb ended by end of line instead of matching delimiter")},htmlBuilder(e,t){for(var n=DD(e),r=[],o=t.havingStyle(t.style.text()),i=0;i<n.length;i++){var s=n[i];"~"===s&&(s="\\textasciitilde"),r.push(LO(s,"Typewriter-Regular",e.mode,o,["mord","texttt"]))}return $O(["mord","text"].concat(o.sizingClasses(t)),jO(r),o)},mathmlBuilder(e,t){var n=new MA(DD(e)),r=new SA("mtext",[n]);return r.setAttribute("mathvariant","monospace"),r}});var DD=e=>e.body.replace(/ /g,e.star?"␣":" "),ID=rA,_D="[ \r\n\t]",RD="(\\\\[a-zA-Z@]+)"+_D+"*",LD="[̀-ͯ]",BD=new RegExp(LD+"+$"),PD="("+_D+"+)|\\\\(\n|[ \r\t]+\n?)[ \r\t]*|([!-\\[\\]-‧‪-퟿豈-￿]"+LD+"*|[\ud800-\udbff][\udc00-\udfff]"+LD+"*|\\\\verb\\*([^]).*?\\4|\\\\verb([^*a-zA-Z]).*?\\5|"+RD+"|\\\\[^\ud800-\udfff])";class zD{constructor(e,t){this.input=void 0,this.settings=void 0,this.tokenRegex=void 0,this.catcodes=void 0,this.input=e,this.settings=t,this.tokenRegex=new RegExp(PD,"g"),this.catcodes={"%":14,"~":13}}setCatcode(e,t){this.catcodes[e]=t}lex(){var e=this.input,t=this.tokenRegex.lastIndex;if(t===e.length)return new KT("EOF",new GT(this,t,t));var n=this.tokenRegex.exec(e);if(null===n||n.index!==t)throw new VN("Unexpected character: '"+e[t]+"'",new KT(e[t],new GT(this,t,t+1)));var r=n[6]||n[3]||(n[2]?"\\ ":" ");if(14===this.catcodes[r]){var o=e.indexOf("\n",this.tokenRegex.lastIndex);return-1===o?(this.tokenRegex.lastIndex=e.length,_O({strict:this.settings.strict,errorCode:"commentAtEnd",errorMsg:"% comment has no terminating newline; LaTeX would fail because of commenting the end of math mode (e.g. $)",report:!0})):this.tokenRegex.lastIndex=o+1,this.lex()}return new KT(r,new GT(this,t,this.tokenRegex.lastIndex))}}class jD{constructor(e,t){void 0===e&&(e={}),void 0===t&&(t={}),this.current=void 0,this.builtins=void 0,this.undefStack=void 0,this.current=t,this.builtins=e,this.undefStack=[]}beginGroup(){this.undefStack.push({})}endGroup(){if(0===this.undefStack.length)throw new VN("Unbalanced namespace destruction: attempt to pop global namespace; please report this as a bug");var e=this.undefStack.pop();for(var t of Object.keys(e))void 0===e[t]?delete this.current[t]:this.current[t]=e[t]}endGroups(){for(;this.undefStack.length>0;)this.endGroup()}has(e){return Object.prototype.hasOwnProperty.call(this.current,e)||Object.prototype.hasOwnProperty.call(this.builtins,e)}get(e){return Object.prototype.hasOwnProperty.call(this.current,e)?this.current[e]:Object.prototype.hasOwnProperty.call(this.builtins,e)?this.builtins[e]:void 0}set(e,t,n){if(void 0===n&&(n=!1),n){for(var r=0;r<this.undefStack.length;r++)delete this.undefStack[r][e];this.undefStack.length>0&&(this.undefStack[this.undefStack.length-1][e]=t)}else{var o=this.undefStack[this.undefStack.length-1];o&&!Object.prototype.hasOwnProperty.call(o,e)&&(o[e]=Object.prototype.hasOwnProperty.call(this.current,e)?this.current[e]:void 0)}null==t?delete this.current[e]:this.current[e]=t}}var VD=WT;UT("\\noexpand",function(e){var t=e.popToken();return e.isExpandable(t.text)&&(t.noexpand=!0,t.treatAsRelax=!0),{tokens:[t],numArgs:0}}),UT("\\expandafter",function(e){var t=e.popToken();return e.expandOnce(!0),{tokens:[t],numArgs:0}}),UT("\\@firstoftwo",function(e){return{tokens:e.consumeArgs(2)[0],numArgs:0}}),UT("\\@secondoftwo",function(e){return{tokens:e.consumeArgs(2)[1],numArgs:0}}),UT("\\@ifnextchar",function(e){var t=e.consumeArgs(3);e.consumeSpaces();var n=e.future();return 1===t[0].length&&t[0][0].text===n.text?{tokens:t[1],numArgs:0}:{tokens:t[2],numArgs:0}}),UT("\\@ifstar","\\@ifnextchar *{\\@firstoftwo{#1}}"),UT("\\TextOrMath",function(e){var t=e.consumeArgs(2);return"text"===e.mode?{tokens:t[0],numArgs:0}:{tokens:t[1],numArgs:0}});var $D={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,a:10,A:10,b:11,B:11,c:12,C:12,d:13,D:13,e:14,E:14,f:15,F:15};UT("\\char",function(e){var t,n=e.popToken(),r=0;if("'"===n.text)t=8,n=e.popToken();else if('"'===n.text)t=16,n=e.popToken();else if("`"===n.text)if("\\"===(n=e.popToken()).text[0])r=n.text.charCodeAt(1);else{if("EOF"===n.text)throw new VN("\\char` missing argument");r=n.text.charCodeAt(0)}else t=10;if(t){if(null==(r=$D[n.text])||r>=t)throw new VN("Invalid base-"+t+" digit "+n.text);for(var o;null!=(o=$D[e.future().text])&&o<t;)r*=t,r+=o,e.popToken()}return"\\@char{"+r+"}"});var HD=(e,t,n,r)=>{var o=e.consumeArg().tokens;if(1!==o.length)throw new VN("\\newcommand's first argument must be a macro name");var i=o[0].text,s=e.isDefined(i);if(s&&!t)throw new VN("\\newcommand{"+i+"} attempting to redefine "+i+"; use \\renewcommand");if(!s&&!n)throw new VN("\\renewcommand{"+i+"} when command "+i+" does not yet exist; use \\newcommand");var a=0;if(1===(o=e.consumeArg().tokens).length&&"["===o[0].text){for(var l="",c=e.expandNextToken();"]"!==c.text&&"EOF"!==c.text;)l+=c.text,c=e.expandNextToken();if(!l.match(/^\s*[0-9]+\s*$/))throw new VN("Invalid number of arguments: "+l);a=parseInt(l),o=e.consumeArg().tokens}return s&&r||e.macros.set(i,{tokens:o,numArgs:a}),""};UT("\\newcommand",e=>HD(e,!1,!0,!1)),UT("\\renewcommand",e=>HD(e,!0,!1,!1)),UT("\\providecommand",e=>HD(e,!0,!0,!0)),UT("\\message",e=>{var t=e.consumeArgs(1)[0];return console.log(t.reverse().map(e=>e.text).join("")),""}),UT("\\errmessage",e=>{var t=e.consumeArgs(1)[0];return console.error(t.reverse().map(e=>e.text).join("")),""}),UT("\\show",e=>{var t=e.popToken(),n=t.text;return console.log(t,e.macros.get(n),ID[n],jE.math[n],jE.text[n]),""}),UT("\\bgroup","{"),UT("\\egroup","}"),UT("~","\\nobreakspace"),UT("\\lq","`"),UT("\\rq","'"),UT("\\aa","\\r a"),UT("\\AA","\\r A"),UT("\\textcopyright","\\html@mathml{\\textcircled{c}}{\\char`©}"),UT("\\copyright","\\TextOrMath{\\textcopyright}{\\text{\\textcopyright}}"),UT("\\textregistered","\\html@mathml{\\textcircled{\\scriptsize R}}{\\char`®}"),UT("ℬ","\\mathscr{B}"),UT("ℰ","\\mathscr{E}"),UT("ℱ","\\mathscr{F}"),UT("ℋ","\\mathscr{H}"),UT("ℐ","\\mathscr{I}"),UT("ℒ","\\mathscr{L}"),UT("ℳ","\\mathscr{M}"),UT("ℛ","\\mathscr{R}"),UT("ℭ","\\mathfrak{C}"),UT("ℌ","\\mathfrak{H}"),UT("ℨ","\\mathfrak{Z}"),UT("\\Bbbk","\\Bbb{k}"),UT("\\llap","\\mathllap{\\textrm{#1}}"),UT("\\rlap","\\mathrlap{\\textrm{#1}}"),UT("\\clap","\\mathclap{\\textrm{#1}}"),UT("\\mathstrut","\\vphantom{(}"),UT("\\underbar","\\underline{\\text{#1}}"),UT("\\not",'\\html@mathml{\\mathrel{\\mathrlap\\@not}\\nobreak}{\\char"338}'),UT("\\neq","\\html@mathml{\\mathrel{\\not=}}{\\mathrel{\\char`≠}}"),UT("\\ne","\\neq"),UT("≠","\\neq"),UT("\\notin","\\html@mathml{\\mathrel{{\\in}\\mathllap{/\\mskip1mu}}}{\\mathrel{\\char`∉}}"),UT("∉","\\notin"),UT("≘","\\html@mathml{\\mathrel{=\\kern{-1em}\\raisebox{0.4em}{$\\scriptsize\\frown$}}}{\\mathrel{\\char`≘}}"),UT("≙","\\html@mathml{\\stackrel{\\tiny\\wedge}{=}}{\\mathrel{\\char`≘}}"),UT("≚","\\html@mathml{\\stackrel{\\tiny\\vee}{=}}{\\mathrel{\\char`≚}}"),UT("≛","\\html@mathml{\\stackrel{\\scriptsize\\star}{=}}{\\mathrel{\\char`≛}}"),UT("≝","\\html@mathml{\\stackrel{\\tiny\\mathrm{def}}{=}}{\\mathrel{\\char`≝}}"),UT("≞","\\html@mathml{\\stackrel{\\tiny\\mathrm{m}}{=}}{\\mathrel{\\char`≞}}"),UT("≟","\\html@mathml{\\stackrel{\\tiny?}{=}}{\\mathrel{\\char`≟}}"),UT("⟂","\\perp"),UT("‼","\\mathclose{!\\mkern-0.8mu!}"),UT("∌","\\notni"),UT("⌜","\\ulcorner"),UT("⌝","\\urcorner"),UT("⌞","\\llcorner"),UT("⌟","\\lrcorner"),UT("©","\\copyright"),UT("®","\\textregistered"),UT("\\ulcorner",'\\html@mathml{\\@ulcorner}{\\mathop{\\char"231c}}'),UT("\\urcorner",'\\html@mathml{\\@urcorner}{\\mathop{\\char"231d}}'),UT("\\llcorner",'\\html@mathml{\\@llcorner}{\\mathop{\\char"231e}}'),UT("\\lrcorner",'\\html@mathml{\\@lrcorner}{\\mathop{\\char"231f}}'),UT("\\vdots","{\\varvdots\\rule{0pt}{15pt}}"),UT("⋮","\\vdots"),UT("\\varGamma","\\mathit{\\Gamma}"),UT("\\varDelta","\\mathit{\\Delta}"),UT("\\varTheta","\\mathit{\\Theta}"),UT("\\varLambda","\\mathit{\\Lambda}"),UT("\\varXi","\\mathit{\\Xi}"),UT("\\varPi","\\mathit{\\Pi}"),UT("\\varSigma","\\mathit{\\Sigma}"),UT("\\varUpsilon","\\mathit{\\Upsilon}"),UT("\\varPhi","\\mathit{\\Phi}"),UT("\\varPsi","\\mathit{\\Psi}"),UT("\\varOmega","\\mathit{\\Omega}"),UT("\\substack","\\begin{subarray}{c}#1\\end{subarray}"),UT("\\colon","\\nobreak\\mskip2mu\\mathpunct{}\\mathchoice{\\mkern-3mu}{\\mkern-3mu}{}{}{:}\\mskip6mu\\relax"),UT("\\boxed","\\fbox{$\\displaystyle{#1}$}"),UT("\\iff","\\DOTSB\\;\\Longleftrightarrow\\;"),UT("\\implies","\\DOTSB\\;\\Longrightarrow\\;"),UT("\\impliedby","\\DOTSB\\;\\Longleftarrow\\;"),UT("\\dddot","{\\overset{\\raisebox{-0.1ex}{\\normalsize ...}}{#1}}"),UT("\\ddddot","{\\overset{\\raisebox{-0.1ex}{\\normalsize ....}}{#1}}");var qD={",":"\\dotsc","\\not":"\\dotsb","+":"\\dotsb","=":"\\dotsb","<":"\\dotsb",">":"\\dotsb","-":"\\dotsb","*":"\\dotsb",":":"\\dotsb","\\DOTSB":"\\dotsb","\\coprod":"\\dotsb","\\bigvee":"\\dotsb","\\bigwedge":"\\dotsb","\\biguplus":"\\dotsb","\\bigcap":"\\dotsb","\\bigcup":"\\dotsb","\\prod":"\\dotsb","\\sum":"\\dotsb","\\bigotimes":"\\dotsb","\\bigoplus":"\\dotsb","\\bigodot":"\\dotsb","\\bigsqcup":"\\dotsb","\\And":"\\dotsb","\\longrightarrow":"\\dotsb","\\Longrightarrow":"\\dotsb","\\longleftarrow":"\\dotsb","\\Longleftarrow":"\\dotsb","\\longleftrightarrow":"\\dotsb","\\Longleftrightarrow":"\\dotsb","\\mapsto":"\\dotsb","\\longmapsto":"\\dotsb","\\hookrightarrow":"\\dotsb","\\doteq":"\\dotsb","\\mathbin":"\\dotsb","\\mathrel":"\\dotsb","\\relbar":"\\dotsb","\\Relbar":"\\dotsb","\\xrightarrow":"\\dotsb","\\xleftarrow":"\\dotsb","\\DOTSI":"\\dotsi","\\int":"\\dotsi","\\oint":"\\dotsi","\\iint":"\\dotsi","\\iiint":"\\dotsi","\\iiiint":"\\dotsi","\\idotsint":"\\dotsi","\\DOTSX":"\\dotsx"},FD=new Set(["bin","rel"]);UT("\\dots",function(e){var t="\\dotso",n=e.expandAfterFuture().text;return n in qD?t=qD[n]:("\\not"===n.slice(0,4)||n in jE.math&&FD.has(jE.math[n].group))&&(t="\\dotsb"),t});var WD={")":!0,"]":!0,"\\rbrack":!0,"\\}":!0,"\\rbrace":!0,"\\rangle":!0,"\\rceil":!0,"\\rfloor":!0,"\\rgroup":!0,"\\rmoustache":!0,"\\right":!0,"\\bigr":!0,"\\biggr":!0,"\\Bigr":!0,"\\Biggr":!0,$:!0,";":!0,".":!0,",":!0};UT("\\dotso",function(e){return e.future().text in WD?"\\ldots\\,":"\\ldots"}),UT("\\dotsc",function(e){var t=e.future().text;return t in WD&&","!==t?"\\ldots\\,":"\\ldots"}),UT("\\cdots",function(e){return e.future().text in WD?"\\@cdots\\,":"\\@cdots"}),UT("\\dotsb","\\cdots"),UT("\\dotsm","\\cdots"),UT("\\dotsi","\\!\\cdots"),UT("\\dotsx","\\ldots\\,"),UT("\\DOTSI","\\relax"),UT("\\DOTSB","\\relax"),UT("\\DOTSX","\\relax"),UT("\\tmspace","\\TextOrMath{\\kern#1#3}{\\mskip#1#2}\\relax"),UT("\\,","\\tmspace+{3mu}{.1667em}"),UT("\\thinspace","\\,"),UT("\\>","\\mskip{4mu}"),UT("\\:","\\tmspace+{4mu}{.2222em}"),UT("\\medspace","\\:"),UT("\\;","\\tmspace+{5mu}{.2777em}"),UT("\\thickspace","\\;"),UT("\\!","\\tmspace-{3mu}{.1667em}"),UT("\\negthinspace","\\!"),UT("\\negmedspace","\\tmspace-{4mu}{.2222em}"),UT("\\negthickspace","\\tmspace-{5mu}{.277em}"),UT("\\enspace","\\kern.5em "),UT("\\enskip","\\hskip.5em\\relax"),UT("\\quad","\\hskip1em\\relax"),UT("\\qquad","\\hskip2em\\relax"),UT("\\tag","\\@ifstar\\tag@literal\\tag@paren"),UT("\\tag@paren","\\tag@literal{({#1})}"),UT("\\tag@literal",e=>{if(e.macros.get("\\df@tag"))throw new VN("Multiple \\tag");return"\\gdef\\df@tag{\\text{#1}}"}),UT("\\bmod","\\mathchoice{\\mskip1mu}{\\mskip1mu}{\\mskip5mu}{\\mskip5mu}\\mathbin{\\rm mod}\\mathchoice{\\mskip1mu}{\\mskip1mu}{\\mskip5mu}{\\mskip5mu}"),UT("\\pod","\\allowbreak\\mathchoice{\\mkern18mu}{\\mkern8mu}{\\mkern8mu}{\\mkern8mu}(#1)"),UT("\\pmod","\\pod{{\\rm mod}\\mkern6mu#1}"),UT("\\mod","\\allowbreak\\mathchoice{\\mkern18mu}{\\mkern12mu}{\\mkern12mu}{\\mkern12mu}{\\rm mod}\\,\\,#1"),UT("\\newline","\\\\\\relax"),UT("\\TeX","\\textrm{\\html@mathml{T\\kern-.1667em\\raisebox{-.5ex}{E}\\kern-.125emX}{TeX}}");var UD=wE(RE["Main-Regular"]["T".charCodeAt(0)][1]-.7*RE["Main-Regular"]["A".charCodeAt(0)][1]);UT("\\LaTeX","\\textrm{\\html@mathml{L\\kern-.36em\\raisebox{"+UD+"}{\\scriptstyle A}\\kern-.15em\\TeX}{LaTeX}}"),UT("\\KaTeX","\\textrm{\\html@mathml{K\\kern-.17em\\raisebox{"+UD+"}{\\scriptstyle A}\\kern-.15em\\TeX}{KaTeX}}"),UT("\\hspace","\\@ifstar\\@hspacer\\@hspace"),UT("\\@hspace","\\hskip #1\\relax"),UT("\\@hspacer","\\rule{0pt}{0pt}\\hskip #1\\relax"),UT("\\ordinarycolon",":"),UT("\\vcentcolon","\\mathrel{\\mathop\\ordinarycolon}"),UT("\\dblcolon",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-.9mu}\\vcentcolon}}{\\mathop{\\char"2237}}'),UT("\\coloneqq",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}=}}{\\mathop{\\char"2254}}'),UT("\\Coloneqq",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}=}}{\\mathop{\\char"2237\\char"3d}}'),UT("\\coloneq",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\mathrel{-}}}{\\mathop{\\char"3a\\char"2212}}'),UT("\\Coloneq",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\mathrel{-}}}{\\mathop{\\char"2237\\char"2212}}'),UT("\\eqqcolon",'\\html@mathml{\\mathrel{=\\mathrel{\\mkern-1.2mu}\\vcentcolon}}{\\mathop{\\char"2255}}'),UT("\\Eqqcolon",'\\html@mathml{\\mathrel{=\\mathrel{\\mkern-1.2mu}\\dblcolon}}{\\mathop{\\char"3d\\char"2237}}'),UT("\\eqcolon",'\\html@mathml{\\mathrel{\\mathrel{-}\\mathrel{\\mkern-1.2mu}\\vcentcolon}}{\\mathop{\\char"2239}}'),UT("\\Eqcolon",'\\html@mathml{\\mathrel{\\mathrel{-}\\mathrel{\\mkern-1.2mu}\\dblcolon}}{\\mathop{\\char"2212\\char"2237}}'),UT("\\colonapprox",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\approx}}{\\mathop{\\char"3a\\char"2248}}'),UT("\\Colonapprox",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\approx}}{\\mathop{\\char"2237\\char"2248}}'),UT("\\colonsim",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\sim}}{\\mathop{\\char"3a\\char"223c}}'),UT("\\Colonsim",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\sim}}{\\mathop{\\char"2237\\char"223c}}'),UT("∷","\\dblcolon"),UT("∹","\\eqcolon"),UT("≔","\\coloneqq"),UT("≕","\\eqqcolon"),UT("⩴","\\Coloneqq"),UT("\\ratio","\\vcentcolon"),UT("\\coloncolon","\\dblcolon"),UT("\\colonequals","\\coloneqq"),UT("\\coloncolonequals","\\Coloneqq"),UT("\\equalscolon","\\eqqcolon"),UT("\\equalscoloncolon","\\Eqqcolon"),UT("\\colonminus","\\coloneq"),UT("\\coloncolonminus","\\Coloneq"),UT("\\minuscolon","\\eqcolon"),UT("\\minuscoloncolon","\\Eqcolon"),UT("\\coloncolonapprox","\\Colonapprox"),UT("\\coloncolonsim","\\Colonsim"),UT("\\simcolon","\\mathrel{\\sim\\mathrel{\\mkern-1.2mu}\\vcentcolon}"),UT("\\simcoloncolon","\\mathrel{\\sim\\mathrel{\\mkern-1.2mu}\\dblcolon}"),UT("\\approxcolon","\\mathrel{\\approx\\mathrel{\\mkern-1.2mu}\\vcentcolon}"),UT("\\approxcoloncolon","\\mathrel{\\approx\\mathrel{\\mkern-1.2mu}\\dblcolon}"),UT("\\notni","\\html@mathml{\\not\\ni}{\\mathrel{\\char`∌}}"),UT("\\limsup","\\DOTSB\\operatorname*{lim\\,sup}"),UT("\\liminf","\\DOTSB\\operatorname*{lim\\,inf}"),UT("\\injlim","\\DOTSB\\operatorname*{inj\\,lim}"),UT("\\projlim","\\DOTSB\\operatorname*{proj\\,lim}"),UT("\\varlimsup","\\DOTSB\\operatorname*{\\overline{lim}}"),UT("\\varliminf","\\DOTSB\\operatorname*{\\underline{lim}}"),UT("\\varinjlim","\\DOTSB\\operatorname*{\\underrightarrow{lim}}"),UT("\\varprojlim","\\DOTSB\\operatorname*{\\underleftarrow{lim}}"),UT("\\gvertneqq","\\html@mathml{\\@gvertneqq}{≩}"),UT("\\lvertneqq","\\html@mathml{\\@lvertneqq}{≨}"),UT("\\ngeqq","\\html@mathml{\\@ngeqq}{≱}"),UT("\\ngeqslant","\\html@mathml{\\@ngeqslant}{≱}"),UT("\\nleqq","\\html@mathml{\\@nleqq}{≰}"),UT("\\nleqslant","\\html@mathml{\\@nleqslant}{≰}"),UT("\\nshortmid","\\html@mathml{\\@nshortmid}{∤}"),UT("\\nshortparallel","\\html@mathml{\\@nshortparallel}{∦}"),UT("\\nsubseteqq","\\html@mathml{\\@nsubseteqq}{⊈}"),UT("\\nsupseteqq","\\html@mathml{\\@nsupseteqq}{⊉}"),UT("\\varsubsetneq","\\html@mathml{\\@varsubsetneq}{⊊}"),UT("\\varsubsetneqq","\\html@mathml{\\@varsubsetneqq}{⫋}"),UT("\\varsupsetneq","\\html@mathml{\\@varsupsetneq}{⊋}"),UT("\\varsupsetneqq","\\html@mathml{\\@varsupsetneqq}{⫌}"),UT("\\imath","\\html@mathml{\\@imath}{ı}"),UT("\\jmath","\\html@mathml{\\@jmath}{ȷ}"),UT("\\llbracket","\\html@mathml{\\mathopen{[\\mkern-3.2mu[}}{\\mathopen{\\char`⟦}}"),UT("\\rrbracket","\\html@mathml{\\mathclose{]\\mkern-3.2mu]}}{\\mathclose{\\char`⟧}}"),UT("⟦","\\llbracket"),UT("⟧","\\rrbracket"),UT("\\lBrace","\\html@mathml{\\mathopen{\\{\\mkern-3.2mu[}}{\\mathopen{\\char`⦃}}"),UT("\\rBrace","\\html@mathml{\\mathclose{]\\mkern-3.2mu\\}}}{\\mathclose{\\char`⦄}}"),UT("↤","\\mapsfrom"),UT("\\mapsfrom","\\html@mathml{\\mathrel{\\mathreflectbox{\\mapsto}}}{\\mathrel{\\char`↤}}"),UT("⦃","\\lBrace"),UT("⦄","\\rBrace"),UT("\\minuso","\\mathbin{\\html@mathml{{\\mathrlap{\\mathchoice{\\kern{0.145em}}{\\kern{0.145em}}{\\kern{0.1015em}}{\\kern{0.0725em}}\\circ}{-}}}{\\char`⦵}}"),UT("⦵","\\minuso"),UT("\\darr","\\downarrow"),UT("\\dArr","\\Downarrow"),UT("\\Darr","\\Downarrow"),UT("\\lang","\\langle"),UT("\\rang","\\rangle"),UT("\\uarr","\\uparrow"),UT("\\uArr","\\Uparrow"),UT("\\Uarr","\\Uparrow"),UT("\\N","\\mathbb{N}"),UT("\\R","\\mathbb{R}"),UT("\\Z","\\mathbb{Z}"),UT("\\alef","\\aleph"),UT("\\alefsym","\\aleph"),UT("\\Alpha","\\mathrm{A}"),UT("\\Beta","\\mathrm{B}"),UT("\\bull","\\bullet"),UT("\\Chi","\\mathrm{X}"),UT("\\clubs","\\clubsuit"),UT("\\cnums","\\mathbb{C}"),UT("\\Complex","\\mathbb{C}"),UT("\\Dagger","\\ddagger"),UT("\\diamonds","\\diamondsuit"),UT("\\empty","\\emptyset"),UT("\\Epsilon","\\mathrm{E}"),UT("\\Eta","\\mathrm{H}"),UT("\\exist","\\exists"),UT("\\harr","\\leftrightarrow"),UT("\\hArr","\\Leftrightarrow"),UT("\\Harr","\\Leftrightarrow"),UT("\\hearts","\\heartsuit"),UT("\\image","\\Im"),UT("\\infin","\\infty"),UT("\\Iota","\\mathrm{I}"),UT("\\isin","\\in"),UT("\\Kappa","\\mathrm{K}"),UT("\\larr","\\leftarrow"),UT("\\lArr","\\Leftarrow"),UT("\\Larr","\\Leftarrow"),UT("\\lrarr","\\leftrightarrow"),UT("\\lrArr","\\Leftrightarrow"),UT("\\Lrarr","\\Leftrightarrow"),UT("\\Mu","\\mathrm{M}"),UT("\\natnums","\\mathbb{N}"),UT("\\Nu","\\mathrm{N}"),UT("\\Omicron","\\mathrm{O}"),UT("\\plusmn","\\pm"),UT("\\rarr","\\rightarrow"),UT("\\rArr","\\Rightarrow"),UT("\\Rarr","\\Rightarrow"),UT("\\real","\\Re"),UT("\\reals","\\mathbb{R}"),UT("\\Reals","\\mathbb{R}"),UT("\\Rho","\\mathrm{P}"),UT("\\sdot","\\cdot"),UT("\\sect","\\S"),UT("\\spades","\\spadesuit"),UT("\\sub","\\subset"),UT("\\sube","\\subseteq"),UT("\\supe","\\supseteq"),UT("\\Tau","\\mathrm{T}"),UT("\\thetasym","\\vartheta"),UT("\\weierp","\\wp"),UT("\\Zeta","\\mathrm{Z}"),UT("\\argmin","\\DOTSB\\operatorname*{arg\\,min}"),UT("\\argmax","\\DOTSB\\operatorname*{arg\\,max}"),UT("\\plim","\\DOTSB\\mathop{\\operatorname{plim}}\\limits"),UT("\\bra","\\mathinner{\\langle{#1}|}"),UT("\\ket","\\mathinner{|{#1}\\rangle}"),UT("\\braket","\\mathinner{\\langle{#1}\\rangle}"),UT("\\Bra","\\left\\langle#1\\right|"),UT("\\Ket","\\left|#1\\right\\rangle");var GD=e=>t=>{var n=t.consumeArg().tokens,r=t.consumeArg().tokens,o=t.consumeArg().tokens,i=t.consumeArg().tokens,s=t.macros.get("|"),a=t.macros.get("\\|");t.macros.beginGroup();var l=t=>n=>{e&&(n.macros.set("|",s),o.length&&n.macros.set("\\|",a));var i=t;!t&&o.length&&("|"===n.future().text&&(n.popToken(),i=!0));return{tokens:i?o:r,numArgs:0}};t.macros.set("|",l(!1)),o.length&&t.macros.set("\\|",l(!0));var c=t.consumeArg().tokens,d=t.expandTokens([...i,...c,...n]);return t.macros.endGroup(),{tokens:d.reverse(),numArgs:0}};UT("\\bra@ket",GD(!1)),UT("\\bra@set",GD(!0)),UT("\\Braket","\\bra@ket{\\left\\langle}{\\,\\middle\\vert\\,}{\\,\\middle\\vert\\,}{\\right\\rangle}"),UT("\\Set","\\bra@set{\\left\\{\\:}{\\;\\middle\\vert\\;}{\\;\\middle\\Vert\\;}{\\:\\right\\}}"),UT("\\set","\\bra@set{\\{\\,}{\\mid}{}{\\,\\}}"),UT("\\angln","{\\angl n}"),UT("\\blue","\\textcolor{##6495ed}{#1}"),UT("\\orange","\\textcolor{##ffa500}{#1}"),UT("\\pink","\\textcolor{##ff00af}{#1}"),UT("\\red","\\textcolor{##df0030}{#1}"),UT("\\green","\\textcolor{##28ae7b}{#1}"),UT("\\gray","\\textcolor{gray}{#1}"),UT("\\purple","\\textcolor{##9d38bd}{#1}"),UT("\\blueA","\\textcolor{##ccfaff}{#1}"),UT("\\blueB","\\textcolor{##80f6ff}{#1}"),UT("\\blueC","\\textcolor{##63d9ea}{#1}"),UT("\\blueD","\\textcolor{##11accd}{#1}"),UT("\\blueE","\\textcolor{##0c7f99}{#1}"),UT("\\tealA","\\textcolor{##94fff5}{#1}"),UT("\\tealB","\\textcolor{##26edd5}{#1}"),UT("\\tealC","\\textcolor{##01d1c1}{#1}"),UT("\\tealD","\\textcolor{##01a995}{#1}"),UT("\\tealE","\\textcolor{##208170}{#1}"),UT("\\greenA","\\textcolor{##b6ffb0}{#1}"),UT("\\greenB","\\textcolor{##8af281}{#1}"),UT("\\greenC","\\textcolor{##74cf70}{#1}"),UT("\\greenD","\\textcolor{##1fab54}{#1}"),UT("\\greenE","\\textcolor{##0d923f}{#1}"),UT("\\goldA","\\textcolor{##ffd0a9}{#1}"),UT("\\goldB","\\textcolor{##ffbb71}{#1}"),UT("\\goldC","\\textcolor{##ff9c39}{#1}"),UT("\\goldD","\\textcolor{##e07d10}{#1}"),UT("\\goldE","\\textcolor{##a75a05}{#1}"),UT("\\redA","\\textcolor{##fca9a9}{#1}"),UT("\\redB","\\textcolor{##ff8482}{#1}"),UT("\\redC","\\textcolor{##f9685d}{#1}"),UT("\\redD","\\textcolor{##e84d39}{#1}"),UT("\\redE","\\textcolor{##bc2612}{#1}"),UT("\\maroonA","\\textcolor{##ffbde0}{#1}"),UT("\\maroonB","\\textcolor{##ff92c6}{#1}"),UT("\\maroonC","\\textcolor{##ed5fa6}{#1}"),UT("\\maroonD","\\textcolor{##ca337c}{#1}"),UT("\\maroonE","\\textcolor{##9e034e}{#1}"),UT("\\purpleA","\\textcolor{##ddd7ff}{#1}"),UT("\\purpleB","\\textcolor{##c6b9fc}{#1}"),UT("\\purpleC","\\textcolor{##aa87ff}{#1}"),UT("\\purpleD","\\textcolor{##7854ab}{#1}"),UT("\\purpleE","\\textcolor{##543b78}{#1}"),UT("\\mintA","\\textcolor{##f5f9e8}{#1}"),UT("\\mintB","\\textcolor{##edf2df}{#1}"),UT("\\mintC","\\textcolor{##e0e5cc}{#1}"),UT("\\grayA","\\textcolor{##f6f7f7}{#1}"),UT("\\grayB","\\textcolor{##f0f1f2}{#1}"),UT("\\grayC","\\textcolor{##e3e5e6}{#1}"),UT("\\grayD","\\textcolor{##d6d8da}{#1}"),UT("\\grayE","\\textcolor{##babec2}{#1}"),UT("\\grayF","\\textcolor{##888d93}{#1}"),UT("\\grayG","\\textcolor{##626569}{#1}"),UT("\\grayH","\\textcolor{##3b3e40}{#1}"),UT("\\grayI","\\textcolor{##21242c}{#1}"),UT("\\kaBlue","\\textcolor{##314453}{#1}"),UT("\\kaGreen","\\textcolor{##71B307}{#1}");var KD={"^":!0,_:!0,"\\limits":!0,"\\nolimits":!0};class JD{constructor(e,t,n){this.settings=void 0,this.expansionCount=void 0,this.lexer=void 0,this.macros=void 0,this.stack=void 0,this.mode=void 0,this.settings=t,this.expansionCount=0,this.feed(e),this.macros=new jD(VD,t.macros),this.mode=n,this.stack=[]}feed(e){this.lexer=new zD(e,this.settings)}switchMode(e){this.mode=e}beginGroup(){this.macros.beginGroup()}endGroup(){this.macros.endGroup()}endGroups(){this.macros.endGroups()}future(){return 0===this.stack.length&&this.pushToken(this.lexer.lex()),this.stack[this.stack.length-1]}popToken(){return this.future(),this.stack.pop()}pushToken(e){this.stack.push(e)}pushTokens(e){this.stack.push(...e)}scanArgument(e){var t,n,r;if(e){if(this.consumeSpaces(),"["!==this.future().text)return null;t=this.popToken();var o=this.consumeArg(["]"]);r=o.tokens,n=o.end}else{var i=this.consumeArg();r=i.tokens,t=i.start,n=i.end}return this.pushToken(new KT("EOF",n.loc)),this.pushTokens(r),new KT("",GT.range(t,n))}consumeSpaces(){for(;;){if(" "!==this.future().text)break;this.stack.pop()}}consumeArg(e){var t=[],n=e&&e.length>0;n||this.consumeSpaces();var r,o=this.future(),i=0,s=0;do{if(r=this.popToken(),t.push(r),"{"===r.text)++i;else if("}"===r.text){if(-1===--i)throw new VN("Extra }",r)}else if("EOF"===r.text)throw new VN("Unexpected end of input in a macro argument, expected '"+(e&&n?e[s]:"}")+"'",r);if(e&&n)if((0===i||1===i&&"{"===e[s])&&r.text===e[s]){if(++s===e.length){t.splice(-s,s);break}}else s=0}while(0!==i||n);return"{"===o.text&&"}"===t[t.length-1].text&&(t.pop(),t.shift()),t.reverse(),{tokens:t,start:o,end:r}}consumeArgs(e,t){if(t){if(t.length!==e+1)throw new VN("The length of delimiters doesn't match the number of args!");for(var n=t[0],r=0;r<n.length;r++){var o=this.popToken();if(n[r]!==o.text)throw new VN("Use of the macro doesn't match its definition",o)}}for(var i=[],s=0;s<e;s++)i.push(this.consumeArg(t&&t[s+1]).tokens);return i}countExpansion(e){if(this.expansionCount+=e,this.expansionCount>this.settings.maxExpand)throw new VN("Too many expansions: infinite loop or need to increase maxExpand setting")}expandOnce(e){var t=this.popToken(),n=t.text,r=t.noexpand?null:this._getExpansion(n);if(null==r||e&&r.unexpandable){if(e&&null==r&&"\\"===n[0]&&!this.isDefined(n))throw new VN("Undefined control sequence: "+n);return this.pushToken(t),!1}this.countExpansion(1);var o=r.tokens,i=this.consumeArgs(r.numArgs,r.delimiters);if(r.numArgs)for(var s=(o=o.slice()).length-1;s>=0;--s){var a=o[s];if("#"===a.text){if(0===s)throw new VN("Incomplete placeholder at end of macro body",a);if("#"===(a=o[--s]).text)o.splice(s+1,1);else{if(!/^[1-9]$/.test(a.text))throw new VN("Not a valid argument number",a);o.splice(s,2,...i[+a.text-1])}}}return this.pushTokens(o),o.length}expandAfterFuture(){return this.expandOnce(),this.future()}expandNextToken(){for(;;)if(!1===this.expandOnce()){var e=this.stack.pop();return e.treatAsRelax&&(e.text="\\relax"),e}}expandMacro(e){return this.macros.has(e)?this.expandTokens([new KT(e)]):void 0}expandTokens(e){var t=[],n=this.stack.length;for(this.pushTokens(e);this.stack.length>n;)if(!1===this.expandOnce(!0)){var r=this.stack.pop();r.treatAsRelax&&(r.noexpand=!1,r.treatAsRelax=!1),t.push(r)}return this.countExpansion(t.length),t}expandMacroAsText(e){var t=this.expandMacro(e);return t?t.map(e=>e.text).join(""):t}_getExpansion(e){var t=this.macros.get(e);if(null==t)return t;if(1===e.length){var n=this.lexer.catcodes[e];if(null!=n&&13!==n)return}var r="function"==typeof t?t(this):t;if("string"==typeof r){var o=0;if(r.includes("#"))for(var i=r.replace(/##/g,"");i.includes("#"+(o+1));)++o;for(var s=new zD(r,this.settings),a=[],l=s.lex();"EOF"!==l.text;)a.push(l),l=s.lex();return a.reverse(),{tokens:a,numArgs:o}}return r}isDefined(e){return this.macros.has(e)||Object.prototype.hasOwnProperty.call(ID,e)||Object.prototype.hasOwnProperty.call(jE.math,e)||Object.prototype.hasOwnProperty.call(jE.text,e)||Object.prototype.hasOwnProperty.call(KD,e)}isExpandable(e){var t=this.macros.get(e);return null!=t?"string"==typeof t||"function"==typeof t||!t.unexpandable:Object.prototype.hasOwnProperty.call(ID,e)&&!ID[e].primitive}}var ZD=/^[₊₋₌₍₎₀₁₂₃₄₅₆₇₈₉ₐₑₕᵢⱼₖₗₘₙₒₚᵣₛₜᵤᵥₓᵦᵧᵨᵩᵪ]/,YD=Object.freeze({"₊":"+","₋":"-","₌":"=","₍":"(","₎":")","₀":"0","₁":"1","₂":"2","₃":"3","₄":"4","₅":"5","₆":"6","₇":"7","₈":"8","₉":"9","ₐ":"a","ₑ":"e","ₕ":"h","ᵢ":"i","ⱼ":"j","ₖ":"k","ₗ":"l","ₘ":"m","ₙ":"n","ₒ":"o","ₚ":"p","ᵣ":"r","ₛ":"s","ₜ":"t","ᵤ":"u","ᵥ":"v","ₓ":"x","ᵦ":"β","ᵧ":"γ","ᵨ":"ρ","ᵩ":"ϕ","ᵪ":"χ","⁺":"+","⁻":"-","⁼":"=","⁽":"(","⁾":")","⁰":"0","¹":"1","²":"2","³":"3","⁴":"4","⁵":"5","⁶":"6","⁷":"7","⁸":"8","⁹":"9","ᴬ":"A","ᴮ":"B","ᴰ":"D","ᴱ":"E","ᴳ":"G","ᴴ":"H","ᴵ":"I","ᴶ":"J","ᴷ":"K","ᴸ":"L","ᴹ":"M","ᴺ":"N","ᴼ":"O","ᴾ":"P","ᴿ":"R","ᵀ":"T","ᵁ":"U","ⱽ":"V","ᵂ":"W","ᵃ":"a","ᵇ":"b","ᶜ":"c","ᵈ":"d","ᵉ":"e","ᶠ":"f","ᵍ":"g","ʰ":"h","ⁱ":"i","ʲ":"j","ᵏ":"k","ˡ":"l","ᵐ":"m","ⁿ":"n","ᵒ":"o","ᵖ":"p","ʳ":"r","ˢ":"s","ᵗ":"t","ᵘ":"u","ᵛ":"v","ʷ":"w","ˣ":"x","ʸ":"y","ᶻ":"z","ᵝ":"β","ᵞ":"γ","ᵟ":"δ","ᵠ":"ϕ","ᵡ":"χ","ᶿ":"θ"}),XD={"́":{text:"\\'",math:"\\acute"},"̀":{text:"\\`",math:"\\grave"},"̈":{text:'\\"',math:"\\ddot"},"̃":{text:"\\~",math:"\\tilde"},"̄":{text:"\\=",math:"\\bar"},"̆":{text:"\\u",math:"\\breve"},"̌":{text:"\\v",math:"\\check"},"̂":{text:"\\^",math:"\\hat"},"̇":{text:"\\.",math:"\\dot"},"̊":{text:"\\r",math:"\\mathring"},"̋":{text:"\\H"},"̧":{text:"\\c"}},QD={"á":"á","à":"à","ä":"ä","ǟ":"ǟ","ã":"ã","ā":"ā","ă":"ă","ắ":"ắ","ằ":"ằ","ẵ":"ẵ","ǎ":"ǎ","â":"â","ấ":"ấ","ầ":"ầ","ẫ":"ẫ","ȧ":"ȧ","ǡ":"ǡ","å":"å","ǻ":"ǻ","ḃ":"ḃ","ć":"ć","ḉ":"ḉ","č":"č","ĉ":"ĉ","ċ":"ċ","ç":"ç","ď":"ď","ḋ":"ḋ","ḑ":"ḑ","é":"é","è":"è","ë":"ë","ẽ":"ẽ","ē":"ē","ḗ":"ḗ","ḕ":"ḕ","ĕ":"ĕ","ḝ":"ḝ","ě":"ě","ê":"ê","ế":"ế","ề":"ề","ễ":"ễ","ė":"ė","ȩ":"ȩ","ḟ":"ḟ","ǵ":"ǵ","ḡ":"ḡ","ğ":"ğ","ǧ":"ǧ","ĝ":"ĝ","ġ":"ġ","ģ":"ģ","ḧ":"ḧ","ȟ":"ȟ","ĥ":"ĥ","ḣ":"ḣ","ḩ":"ḩ","í":"í","ì":"ì","ï":"ï","ḯ":"ḯ","ĩ":"ĩ","ī":"ī","ĭ":"ĭ","ǐ":"ǐ","î":"î","ǰ":"ǰ","ĵ":"ĵ","ḱ":"ḱ","ǩ":"ǩ","ķ":"ķ","ĺ":"ĺ","ľ":"ľ","ļ":"ļ","ḿ":"ḿ","ṁ":"ṁ","ń":"ń","ǹ":"ǹ","ñ":"ñ","ň":"ň","ṅ":"ṅ","ņ":"ņ","ó":"ó","ò":"ò","ö":"ö","ȫ":"ȫ","õ":"õ","ṍ":"ṍ","ṏ":"ṏ","ȭ":"ȭ","ō":"ō","ṓ":"ṓ","ṑ":"ṑ","ŏ":"ŏ","ǒ":"ǒ","ô":"ô","ố":"ố","ồ":"ồ","ỗ":"ỗ","ȯ":"ȯ","ȱ":"ȱ","ő":"ő","ṕ":"ṕ","ṗ":"ṗ","ŕ":"ŕ","ř":"ř","ṙ":"ṙ","ŗ":"ŗ","ś":"ś","ṥ":"ṥ","š":"š","ṧ":"ṧ","ŝ":"ŝ","ṡ":"ṡ","ş":"ş","ẗ":"ẗ","ť":"ť","ṫ":"ṫ","ţ":"ţ","ú":"ú","ù":"ù","ü":"ü","ǘ":"ǘ","ǜ":"ǜ","ǖ":"ǖ","ǚ":"ǚ","ũ":"ũ","ṹ":"ṹ","ū":"ū","ṻ":"ṻ","ŭ":"ŭ","ǔ":"ǔ","û":"û","ů":"ů","ű":"ű","ṽ":"ṽ","ẃ":"ẃ","ẁ":"ẁ","ẅ":"ẅ","ŵ":"ŵ","ẇ":"ẇ","ẘ":"ẘ","ẍ":"ẍ","ẋ":"ẋ","ý":"ý","ỳ":"ỳ","ÿ":"ÿ","ỹ":"ỹ","ȳ":"ȳ","ŷ":"ŷ","ẏ":"ẏ","ẙ":"ẙ","ź":"ź","ž":"ž","ẑ":"ẑ","ż":"ż","Á":"Á","À":"À","Ä":"Ä","Ǟ":"Ǟ","Ã":"Ã","Ā":"Ā","Ă":"Ă","Ắ":"Ắ","Ằ":"Ằ","Ẵ":"Ẵ","Ǎ":"Ǎ","Â":"Â","Ấ":"Ấ","Ầ":"Ầ","Ẫ":"Ẫ","Ȧ":"Ȧ","Ǡ":"Ǡ","Å":"Å","Ǻ":"Ǻ","Ḃ":"Ḃ","Ć":"Ć","Ḉ":"Ḉ","Č":"Č","Ĉ":"Ĉ","Ċ":"Ċ","Ç":"Ç","Ď":"Ď","Ḋ":"Ḋ","Ḑ":"Ḑ","É":"É","È":"È","Ë":"Ë","Ẽ":"Ẽ","Ē":"Ē","Ḗ":"Ḗ","Ḕ":"Ḕ","Ĕ":"Ĕ","Ḝ":"Ḝ","Ě":"Ě","Ê":"Ê","Ế":"Ế","Ề":"Ề","Ễ":"Ễ","Ė":"Ė","Ȩ":"Ȩ","Ḟ":"Ḟ","Ǵ":"Ǵ","Ḡ":"Ḡ","Ğ":"Ğ","Ǧ":"Ǧ","Ĝ":"Ĝ","Ġ":"Ġ","Ģ":"Ģ","Ḧ":"Ḧ","Ȟ":"Ȟ","Ĥ":"Ĥ","Ḣ":"Ḣ","Ḩ":"Ḩ","Í":"Í","Ì":"Ì","Ï":"Ï","Ḯ":"Ḯ","Ĩ":"Ĩ","Ī":"Ī","Ĭ":"Ĭ","Ǐ":"Ǐ","Î":"Î","İ":"İ","Ĵ":"Ĵ","Ḱ":"Ḱ","Ǩ":"Ǩ","Ķ":"Ķ","Ĺ":"Ĺ","Ľ":"Ľ","Ļ":"Ļ","Ḿ":"Ḿ","Ṁ":"Ṁ","Ń":"Ń","Ǹ":"Ǹ","Ñ":"Ñ","Ň":"Ň","Ṅ":"Ṅ","Ņ":"Ņ","Ó":"Ó","Ò":"Ò","Ö":"Ö","Ȫ":"Ȫ","Õ":"Õ","Ṍ":"Ṍ","Ṏ":"Ṏ","Ȭ":"Ȭ","Ō":"Ō","Ṓ":"Ṓ","Ṑ":"Ṑ","Ŏ":"Ŏ","Ǒ":"Ǒ","Ô":"Ô","Ố":"Ố","Ồ":"Ồ","Ỗ":"Ỗ","Ȯ":"Ȯ","Ȱ":"Ȱ","Ő":"Ő","Ṕ":"Ṕ","Ṗ":"Ṗ","Ŕ":"Ŕ","Ř":"Ř","Ṙ":"Ṙ","Ŗ":"Ŗ","Ś":"Ś","Ṥ":"Ṥ","Š":"Š","Ṧ":"Ṧ","Ŝ":"Ŝ","Ṡ":"Ṡ","Ş":"Ş","Ť":"Ť","Ṫ":"Ṫ","Ţ":"Ţ","Ú":"Ú","Ù":"Ù","Ü":"Ü","Ǘ":"Ǘ","Ǜ":"Ǜ","Ǖ":"Ǖ","Ǚ":"Ǚ","Ũ":"Ũ","Ṹ":"Ṹ","Ū":"Ū","Ṻ":"Ṻ","Ŭ":"Ŭ","Ǔ":"Ǔ","Û":"Û","Ů":"Ů","Ű":"Ű","Ṽ":"Ṽ","Ẃ":"Ẃ","Ẁ":"Ẁ","Ẅ":"Ẅ","Ŵ":"Ŵ","Ẇ":"Ẇ","Ẍ":"Ẍ","Ẋ":"Ẋ","Ý":"Ý","Ỳ":"Ỳ","Ÿ":"Ÿ","Ỹ":"Ỹ","Ȳ":"Ȳ","Ŷ":"Ŷ","Ẏ":"Ẏ","Ź":"Ź","Ž":"Ž","Ẑ":"Ẑ","Ż":"Ż","ά":"ά","ὰ":"ὰ","ᾱ":"ᾱ","ᾰ":"ᾰ","έ":"έ","ὲ":"ὲ","ή":"ή","ὴ":"ὴ","ί":"ί","ὶ":"ὶ","ϊ":"ϊ","ΐ":"ΐ","ῒ":"ῒ","ῑ":"ῑ","ῐ":"ῐ","ό":"ό","ὸ":"ὸ","ύ":"ύ","ὺ":"ὺ","ϋ":"ϋ","ΰ":"ΰ","ῢ":"ῢ","ῡ":"ῡ","ῠ":"ῠ","ώ":"ώ","ὼ":"ὼ","Ύ":"Ύ","Ὺ":"Ὺ","Ϋ":"Ϋ","Ῡ":"Ῡ","Ῠ":"Ῠ","Ώ":"Ώ","Ὼ":"Ὼ"};class eI{constructor(e,t){this.mode=void 0,this.gullet=void 0,this.settings=void 0,this.leftrightDepth=void 0,this.nextToken=void 0,this.mode="math",this.gullet=new JD(e,t,this.mode),this.settings=t,this.leftrightDepth=0,this.nextToken=null}expect(e,t){if(void 0===t&&(t=!0),this.fetch().text!==e)throw new VN("Expected '"+e+"', got '"+this.fetch().text+"'",this.fetch());t&&this.consume()}consume(){this.nextToken=null}fetch(){return null==this.nextToken&&(this.nextToken=this.gullet.expandNextToken()),this.nextToken}switchMode(e){this.mode=e,this.gullet.switchMode(e)}parse(){this.settings.globalGroup||this.gullet.beginGroup(),this.settings.colorIsTextColor&&this.gullet.macros.set("\\color","\\textcolor");try{var e=this.parseExpression(!1);return this.expect("EOF"),this.settings.globalGroup||this.gullet.endGroup(),e}finally{this.gullet.endGroups()}}subparse(e){var t=this.nextToken;this.consume(),this.gullet.pushToken(new KT("}")),this.gullet.pushTokens(e);var n=this.parseExpression(!1);return this.expect("}"),this.nextToken=t,n}parseExpression(e,t){for(var n=[];;){"math"===this.mode&&this.consumeSpaces();var r=this.fetch();if(eI.endOfExpression.has(r.text))break;if(t&&r.text===t)break;if(e&&ID[r.text]&&ID[r.text].infix)break;var o=this.parseAtom(t);if(!o)break;"internal"!==o.type&&n.push(o)}return"text"===this.mode&&this.formLigatures(n),this.handleInfixNodes(n)}handleInfixNodes(e){for(var t,n=-1,r=0;r<e.length;r++){var o=e[r];if("infix"===o.type){if(-1!==n)throw new VN("only one infix operator per group",o.token);n=r,t=o.replaceWith}}if(-1!==n&&t){var i,s,a=e.slice(0,n),l=e.slice(n+1);return i=1===a.length&&"ordgroup"===a[0].type?a[0]:{type:"ordgroup",mode:this.mode,body:a},s=1===l.length&&"ordgroup"===l[0].type?l[0]:{type:"ordgroup",mode:this.mode,body:l},["\\\\abovefrac"===t?this.callFunction(t,[i,e[n],s],[]):this.callFunction(t,[i,s],[])]}return e}handleSupSubscript(e){var t,n=this.fetch(),r=n.text;this.consume(),this.consumeSpaces();do{var o;t=this.parseGroup(e)}while("internal"===(null==(o=t)?void 0:o.type));if(!t)throw new VN("Expected group after '"+r+"'",n);return t}formatUnsupportedCmd(e){for(var t=[],n=0;n<e.length;n++)t.push({type:"textord",mode:"text",text:e[n]});var r={type:"text",mode:this.mode,body:t};return{type:"color",mode:this.mode,color:this.settings.errorColor,body:[r]}}parseAtom(e){var t,n,r=this.parseGroup("atom",e);if("internal"===(null==r?void 0:r.type))return r;if("text"===this.mode)return r;for(;;){this.consumeSpaces();var o=this.fetch();if("\\limits"===o.text||"\\nolimits"===o.text){if(r&&"op"===r.type)r.limits="\\limits"===o.text,r.alwaysHandleSupSub=!0;else{if(!r||"operatorname"!==r.type)throw new VN("Limit controls must follow a math operator",o);r.alwaysHandleSupSub&&(r.limits="\\limits"===o.text)}this.consume()}else if("^"===o.text){if(t)throw new VN("Double superscript",o);t=this.handleSupSubscript("superscript")}else if("_"===o.text){if(n)throw new VN("Double subscript",o);n=this.handleSupSubscript("subscript")}else if("'"===o.text){if(t)throw new VN("Double superscript",o);var i={type:"textord",mode:this.mode,text:"\\prime"},s=[i];for(this.consume();"'"===this.fetch().text;)s.push(i),this.consume();"^"===this.fetch().text&&s.push(this.handleSupSubscript("superscript")),t={type:"ordgroup",mode:this.mode,body:s}}else{if(!YD[o.text])break;var a=ZD.test(o.text),l=[];for(l.push(new KT(YD[o.text])),this.consume();;){var c=this.fetch().text;if(!YD[c])break;if(ZD.test(c)!==a)break;l.unshift(new KT(YD[c])),this.consume()}var d=this.subparse(l);a?n={type:"ordgroup",mode:"math",body:d}:t={type:"ordgroup",mode:"math",body:d}}}return t&&n?{type:"supsub",mode:this.mode,base:r,sup:t,sub:n}:t?{type:"supsub",mode:this.mode,base:r,sup:t}:n?{type:"supsub",mode:this.mode,base:r,sub:n}:r}parseFunction(e,t){var n=this.fetch(),r=n.text,o=ID[r];if(!o)return null;if(this.consume(),t&&"atom"!==t&&!o.allowedInArgument)throw new VN("Got function '"+r+"' with no arguments"+(t?" as "+t:""),n);if("text"===this.mode&&!o.allowedInText)throw new VN("Can't use function '"+r+"' in text mode",n);if("math"===this.mode&&!1===o.allowedInMath)throw new VN("Can't use function '"+r+"' in math mode",n);var i=this.parseArguments(r,o),s=i.args,a=i.optArgs;return this.callFunction(r,s,a,n,e)}callFunction(e,t,n,r,o){var i={funcName:e,parser:this,token:r,breakOnTokenText:o},s=ID[e];if(s&&s.handler)return s.handler(i,t,n);throw new VN("No function handler for "+e)}parseArguments(e,t){var n,r=null!=(n=t.numOptionalArgs)?n:0,o=t.numArgs+r;if(0===o)return{args:[],optArgs:[]};for(var i=[],s=[],a=0;a<o;a++){var l,c=null==(l=t.argTypes)?void 0:l[a],d=a<r;("primitive"in t&&t.primitive&&null==c||"sqrt"===t.type&&1===a&&null==s[0])&&(c="primitive");var u=this.parseGroupOfType("argument to '"+e+"'",c,d);if(d)s.push(u);else{if(null==u)throw new VN("Null argument, please report this as a bug");i.push(u)}}return{args:i,optArgs:s}}parseGroupOfType(e,t,n){switch(t){case"color":return this.parseColorGroup(n);case"size":return this.parseSizeGroup(n);case"url":return this.parseUrlGroup(n);case"math":case"text":return this.parseArgumentGroup(n,t);case"hbox":var r=this.parseArgumentGroup(n,"text");return null!=r?{type:"styling",mode:r.mode,body:[r],style:"text",resetFont:!0}:null;case"raw":this.gullet.consumeSpaces();var o=this.gullet.lexer.catcodes["%"];this.gullet.lexer.setCatcode("%",12);var i=this.parseStringGroup(n);return this.gullet.lexer.setCatcode("%",o),null!=i?{type:"raw",mode:"text",string:i.text}:null;case"primitive":if(n)throw new VN("A primitive argument cannot be optional");var s=this.parseGroup(e);if(null==s)throw new VN("Expected group as "+e,this.fetch());return s;case"original":case void 0:return this.parseArgumentGroup(n);default:throw new VN("Unknown group type as "+e,this.fetch())}}consumeSpaces(){for(;" "===this.fetch().text;)this.consume()}parseStringGroup(e){var t=this.gullet.scanArgument(e);if(null==t)return null;for(var n,r="";"EOF"!==(n=this.fetch()).text;)r+=n.text,this.consume();return this.consume(),t.text=r,t}parseRegexGroup(e,t){for(var n,r=this.fetch(),o=r,i="";"EOF"!==(n=this.fetch()).text&&e.test(i+n.text);)i+=(o=n).text,this.consume();if(""===i)throw new VN("Invalid "+t+": '"+r.text+"'",r);return r.range(o,i)}parseColorGroup(e){var t=this.parseStringGroup(e);if(null==t)return null;var n=/^(#[a-f0-9]{3,4}|#[a-f0-9]{6}|#[a-f0-9]{8}|[a-f0-9]{6}|[a-z]+)$/i.exec(t.text);if(!n)throw new VN("Invalid color: '"+t.text+"'",t);var r=n[0];return/^[0-9a-f]{6}$/i.test(r)&&(r="#"+r),{type:"color-token",mode:this.mode,color:r}}parseSizeGroup(e){var t,n=!1;if(this.gullet.consumeSpaces(),!(t=e||"{"===this.gullet.future().text?this.parseStringGroup(e):this.parseRegexGroup(/^[-+]? *(?:$|\d+|\d+\.\d*|\.\d*) *[a-z]{0,2} *$/,"size")))return null;e||0!==t.text.length||(t.text="0pt",n=!0);var r=/([-+]?) *(\d+(?:\.\d*)?|\.\d+) *([a-z]{2})/.exec(t.text);if(!r)throw new VN("Invalid size: '"+t.text+"'",t);var o={number:+(r[1]+r[2]),unit:r[3]};if(!vE(o))throw new VN("Invalid unit: '"+o.unit+"'",t);return{type:"size",mode:this.mode,value:o,isBlank:n}}parseUrlGroup(e){var t=this.gullet.lexer.catcodes["%"],n=this.gullet.lexer.catcodes["~"];this.gullet.lexer.setCatcode("%",13),this.gullet.lexer.setCatcode("~",12);var r=this.parseStringGroup(e);if(this.gullet.lexer.setCatcode("%",t),this.gullet.lexer.setCatcode("~",n),null==r)return null;var o=r.text.replace(/\\([#$%&~_^{}])/g,"$1");return{type:"url",mode:this.mode,url:o}}parseArgumentGroup(e,t){var n=this.gullet.scanArgument(e);if(null==n)return null;var r=this.mode;t&&this.switchMode(t),this.gullet.beginGroup();var o=this.parseExpression(!1,"EOF");this.expect("EOF"),this.gullet.endGroup();var i={type:"ordgroup",mode:this.mode,loc:n.loc,body:o};return t&&this.switchMode(r),i}parseGroup(e,t){var n,r=this.fetch(),o=r.text;if("{"===o||"\\begingroup"===o){this.consume();var i="{"===o?"}":"\\endgroup";this.gullet.beginGroup();var s=this.parseExpression(!1,i),a=this.fetch();this.expect(i),this.gullet.endGroup(),n={type:"ordgroup",mode:this.mode,loc:GT.range(r,a),body:s,semisimple:"\\begingroup"===o||void 0}}else if(null==(n=this.parseFunction(t,e)||this.parseSymbol())&&"\\"===o[0]&&!Object.prototype.hasOwnProperty.call(KD,o)){if(this.settings.throwOnError)throw new VN("Undefined control sequence: "+o,r);n=this.formatUnsupportedCmd(o),this.consume()}return n}formLigatures(e){for(var t=e.length-1,n=0;n<t;++n){var r=e[n];if("textord"===r.type){var o=r.text,i=e[n+1];if(i&&"textord"===i.type){if("-"===o&&"-"===i.text){var s=e[n+2];n+1<t&&s&&"textord"===s.type&&"-"===s.text?(e.splice(n,3,{type:"textord",mode:"text",loc:GT.range(r,s),text:"---"}),t-=2):(e.splice(n,2,{type:"textord",mode:"text",loc:GT.range(r,i),text:"--"}),t-=1)}"'"!==o&&"`"!==o||i.text!==o||(e.splice(n,2,{type:"textord",mode:"text",loc:GT.range(r,i),text:o+o}),t-=1)}}}}parseSymbol(){var e=this.fetch(),t=e.text;if(/^\\verb[^a-zA-Z]/.test(t)){this.consume();var n=t.slice(5),r="*"===n.charAt(0);if(r&&(n=n.slice(1)),n.length<2||n.charAt(0)!==n.slice(-1))throw new VN("\\verb assertion failed --\n please report what input caused this bug");return{type:"verb",mode:"text",body:n=n.slice(1,-1),star:r}}Object.prototype.hasOwnProperty.call(QD,t[0])&&!jE[this.mode][t[0]]&&(this.settings.strict&&"math"===this.mode&&_O({strict:this.settings.strict,errorCode:"unicodeTextInMathMode",errorMsg:'Accented Unicode text character "'+t[0]+'" used in math mode',report:!0,token:e}),t=QD[t[0]]+t.slice(1));var o,i,s=BD.exec(t);if(s&&("i"===(t=t.substring(0,s.index))?t="ı":"j"===t&&(t="ȷ")),jE[this.mode][t]){this.settings.strict&&"math"===this.mode&&vO.includes(t)&&_O({strict:this.settings.strict,errorCode:"unicodeTextInMathMode",errorMsg:'Latin-1/Unicode text character "'+t[0]+'" used in math mode',report:!0,token:e});var a=jE[this.mode][t].group,l=GT.range(e);i=a,o=JA.has(i)?{type:"atom",mode:this.mode,family:a,loc:l,text:t}:{type:a,mode:this.mode,loc:l,text:t}}else{if(!(t.charCodeAt(0)>=128))return null;this.settings.strict&&(dE(t.charCodeAt(0))?"math"===this.mode&&_O({strict:this.settings.strict,errorCode:"unicodeTextInMathMode",errorMsg:'Unicode text character "'+t[0]+'" used in math mode',report:!0,token:e}):_O({strict:this.settings.strict,errorCode:"unknownSymbol",errorMsg:'Unrecognized Unicode character "'+t[0]+'" ('+t.charCodeAt(0)+")",report:!0,token:e})),o={type:"textord",mode:"text",loc:GT.range(e),text:t}}if(this.consume(),s)for(var c=0;c<s[0].length;c++){var d=s[0][c];if(!XD[d])throw new VN("Unknown accent ' "+d+"'",e);var u=XD[d][this.mode]||XD[d].text;if(!u)throw new VN("Accent "+d+" unsupported in "+this.mode+" mode",e);o={type:"accent",mode:this.mode,loc:GT.range(e),label:u,isStretchy:!1,isShifty:!0,base:o}}return o}}eI.endOfExpression=new Set(["}","\\endgroup","\\end","\\right","&"]);var tI=function(e,t){if(!("string"==typeof e||e instanceof String))throw new TypeError("KaTeX can only parse string typed expression");var n=new eI(e,t);delete n.gullet.macros.current["\\df@tag"];var r=n.parse();if(delete n.gullet.macros.current["\\current@color"],delete n.gullet.macros.current["\\color"],n.gullet.macros.get("\\df@tag")){if(!t.displayMode)throw new VN("\\tag works only in display equations");r=[{type:"tag",mode:"text",body:r,tag:n.subparse([new KT("\\df@tag")])}]}return r},nI=function(e,t,n){t.textContent="";var r=oI(e,n).toNode();t.appendChild(r)};"undefined"!=typeof document&&"CSS1Compat"!==document.compatMode&&("undefined"!=typeof console&&console.warn("Warning: KaTeX doesn't work in quirks mode. Make sure your website has a suitable doctype."),nI=function(){throw new VN("KaTeX doesn't work in quirks mode.")});var rI=function(e,t,n){if(n.throwOnError||!(e instanceof VN))throw e;var r=$O(["katex-error"],[new TE(t)]);return r.setAttribute("title",e.toString()),r.setAttribute("style","color:"+n.errorColor),r},oI=function(e,t){var n=new XN(t);try{return function(e,t,n){var r,o=HA(n);if("mathml"===n.output)return PA(e,t,o,n.displayMode,!0);if("html"===n.output){var i=kA(e,o);r=$O(["katex"],[i])}else{var s=PA(e,t,o,n.displayMode,!1),a=kA(e,o);r=$O(["katex"],[s,a])}return qA(r,n)}(tI(e,n),e,n)}catch(t){return rI(t,e,n)}},iI={version:"0.19.1",render:nI,renderToString:function(e,t){return oI(e,t).toMarkup()},ParseError:VN,SETTINGS_SCHEMA:JN,__parse:function(e,t){var n=new XN(t);return tI(e,n)},__renderToDomTree:oI,__renderToHTMLTree:function(e,t){var n=new XN(t);try{return function(e,t){var n=kA(e,HA(t)),r=$O(["katex"],[n]);return qA(r,t)}(tI(e,n),n)}catch(t){return rI(t,e,n)}},__setFontMetrics:function(e,t){RE[e]=t},__defineSymbol:VE,__defineFunction:sA,__defineMacro:UT,__domTree:{Span:NE,Anchor:EE,SymbolNode:TE,SvgNode:DE,PathNode:IE,LineNode:_E}},sI=Object.defineProperty,aI=Object.getOwnPropertySymbols,lI=Object.prototype.hasOwnProperty,cI=Object.prototype.propertyIsEnumerable,dI=(e,t,n)=>t in e?sI(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,uI=(e,t)=>{for(var n in t||(t={}))lI.call(t,n)&&dI(e,n,t[n]);if(aI)for(var n of aI(t))cI.call(t,n)&&dI(e,n,t[n]);return e};function hI(e,t){return Object.assign(e,{meta:uI({package:"@milkdown/components"},t)}),e}var pI=Object.defineProperty,fI=Object.getOwnPropertySymbols,mI=Object.prototype.hasOwnProperty,gI=Object.prototype.propertyIsEnumerable,vI=(e,t,n)=>t in e?pI(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,yI=(e,t)=>{for(var n in t||(t={}))mI.call(t,n)&&vI(e,n,t[n]);if(fI)for(var n of fI(t))gI.call(t,n)&&vI(e,n,t[n]);return e};const wI=Md(yI({},{mode:"preview"}),"linkTooltipStateCtx");hI(wI,{displayName:"State<link-tooltip>",group:"LinkTooltip"});const bI=Md(yI({},{addLink:()=>{},editLink:()=>{},removeLink:()=>{}}),"linkTooltipAPICtx");hI(wI,{displayName:"API<link-tooltip>",group:"LinkTooltip"});const xI=Md(yI({},{linkIcon:"🔗",editButton:"✎",removeButton:"⌫",confirmButton:"Confirm ⏎",onCopyLink:()=>{},inputPlaceholder:"Paste link..."}),"linkTooltipConfigCtx");hI(wI,{displayName:"Config<link-tooltip>",group:"LinkTooltip"});const kI=yd("ToggleLink",e=>()=>t=>{const{doc:n,selection:r}=t,o=gu.type(e);return n.rangeHasMark(r.from,r.to,o)?(e.get(bI.key).removeLink(r.from,r.to),!0):(e.get(bI.key).addLink(r.from,r.to),!0)}),CI=Bk("LINK_PREVIEW");hI(CI[0],{displayName:"PreviewTooltipSpec<link-tooltip>",group:"LinkTooltip"}),hI(CI[1],{displayName:"PreviewTooltipPlugin<link-tooltip>",group:"LinkTooltip"});const SI=Bk("LINK_EDIT");function MI({icon:e,class:t,onClick:n}){return Yw("span",{class:_e("milkdown-icon",t),onPointerdown:n,innerHTML:e?Re.sanitize(e.trim()):void 0})}hI(SI[0],{displayName:"EditTooltipSpec<link-tooltip>",group:"LinkTooltip"}),hI(SI[1],{displayName:"EditTooltipPlugin<link-tooltip>",group:"LinkTooltip"}),MI.props={icon:{type:String,required:!1},class:{type:String,required:!1},onClick:{type:Function,required:!1}};const NI=gd("abcdefghijklmnopqrstuvwxyz0123456789",8);const EI=mv({props:{config:{type:Object,required:!0},src:{type:Object,required:!0},onConfirm:{type:Function,required:!0},onCancel:{type:Function,required:!0}},setup({config:e,src:t,onConfirm:n,onCancel:r}){const o=Wm(t),i=`${"milkdown-link-edit"}-${NI()}`;iv(t,e=>{o.value=e});const s=()=>{n(o.value)},a=e=>{e.stopPropagation(),"Enter"===e.key&&(e.preventDefault(),s()),"Escape"===e.key&&(e.preventDefault(),r())};return()=>Yw("div",{class:"link-edit"},Yw("input",{id:i,class:"input-area",placeholder:e.value.inputPlaceholder,onKeydown:a,onInput:e=>{o.value=e.target.value},value:o.value}),o.value?Yw(MI,{class:"button confirm",icon:e.value.confirmButton,onClick:s}):null)}});var OI,AI,TI,DI,II,_I,RI,LI,BI,PI,zI,jI,VI=Object.defineProperty,$I=Object.defineProperties,HI=Object.getOwnPropertyDescriptors,qI=Object.getOwnPropertySymbols,FI=Object.prototype.hasOwnProperty,WI=Object.prototype.propertyIsEnumerable,UI=e=>{throw TypeError(e)},GI=(e,t,n)=>t in e?VI(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,KI=(e,t)=>{for(var n in t||(t={}))FI.call(t,n)&&GI(e,n,t[n]);if(qI)for(var n of qI(t))WI.call(t,n)&&GI(e,n,t[n]);return e},JI=(e,t)=>$I(e,HI(t)),ZI=(e,t,n)=>t.has(e)||UI("Cannot "+n),YI=(e,t,n)=>(ZI(e,t,"read from private field"),n?n.call(e):t.get(e)),XI=(e,t,n)=>t.has(e)?UI("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),QI=(e,t,n,r)=>(ZI(e,t,"write to private field"),t.set(e,n),n);const e_={from:-1,to:-1,mark:null};class t_{constructor(e,t){this.ctx=e,XI(this,OI),XI(this,AI),XI(this,TI,KI({},e_)),XI(this,DI),XI(this,II),XI(this,_I,Wm("")),XI(this,RI,()=>{YI(this,PI).call(this),YI(this,AI).hide(),this.ctx.update(wI.key,e=>JI(KI({},e),{mode:"preview"})),QI(this,TI,KI({},e_))}),XI(this,LI,e=>{const t=e.target;t&&(YI(this,OI).contains(t)||YI(this,RI).call(this))}),XI(this,BI,()=>{document.addEventListener("pointerdown",YI(this,LI),!0)}),XI(this,PI,()=>{document.removeEventListener("pointerdown",YI(this,LI),!0)}),XI(this,zI,e=>{const t=this.ctx.get(ac),{from:n,to:r,mark:o}=YI(this,TI),i=gu.type(this.ctx),s=fu(e);if(o&&o.attrs.href===s)return void YI(this,RI).call(this);const a=t.state.tr;if(o&&a.removeMark(n,r,o),n===r){if(!s)return void YI(this,RI).call(this);const e=i.create({href:s});a.insertText(s,n),a.addMark(n,n+s.length,e)}else a.addMark(n,r,i.create({href:s}));t.dispatch(a),YI(this,RI).call(this)}),XI(this,jI,(e,t,n)=>{const r=this.ctx.get(xI.key);YI(this,II).value=r,YI(this,_I).value=e,this.ctx.update(wI.key,e=>JI(KI({},e),{mode:"edit"}));const o=this.ctx.get(ac);o.dispatch(o.state.tr.setSelection(Fr.create(o.state.doc,t,n))),YI(this,AI).show({getBoundingClientRect:()=>yi(o,t,n)},o),YI(this,BI).call(this),requestAnimationFrame(()=>{var e;null==(e=YI(this,OI).querySelector("input"))||e.focus()})}),this.update=e=>{const{state:t}=e,{selection:n}=t;if(!(n instanceof Fr))return;const{from:r,to:o}=n;r===YI(this,TI).from&&o===YI(this,TI).to||YI(this,RI).call(this)},this.destroy=()=>{YI(this,PI).call(this),YI(this,DI).unmount(),YI(this,AI).destroy(),YI(this,OI).remove()},this.addLink=(e,t)=>{QI(this,TI,{from:e,to:t,mark:null}),YI(this,jI).call(this,"",e,t)},this.editLink=(e,t,n)=>{QI(this,TI,{from:t,to:n,mark:e}),YI(this,jI).call(this,e.attrs.href,t,n)},this.removeLink=(e,t)=>{const n=this.ctx.get(ac),r=n.state.tr;r.removeMark(e,t,gu.type(this.ctx)),n.dispatch(r),YI(this,RI).call(this)},QI(this,II,Wm(this.ctx.get(xI.key)));const n=document.createElement("div");n.className="milkdown-link-edit";const r=Db(EI,{config:YI(this,II),src:YI(this,_I),onConfirm:YI(this,zI),onCancel:YI(this,RI)});r.mount(n),QI(this,DI,r),QI(this,OI,n),QI(this,AI,new Lk({content:n,debounce:0,shouldShow:()=>!1})),YI(this,AI).onHide=()=>{requestAnimationFrame(()=>{t.dom.focus({preventScroll:!0})})},YI(this,AI).update(t)}}OI=new WeakMap,AI=new WeakMap,TI=new WeakMap,DI=new WeakMap,II=new WeakMap,_I=new WeakMap,RI=new WeakMap,LI=new WeakMap,BI=new WeakMap,PI=new WeakMap,zI=new WeakMap,jI=new WeakMap;var n_=Object.defineProperty,r_=Object.defineProperties,o_=Object.getOwnPropertyDescriptors,i_=Object.getOwnPropertySymbols,s_=Object.prototype.hasOwnProperty,a_=Object.prototype.propertyIsEnumerable,l_=(e,t,n)=>t in e?n_(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;function c_(e){let t;e.update(bI.key,e=>{return n=((e,t)=>{for(var n in t||(t={}))s_.call(t,n)&&l_(e,n,t[n]);if(i_)for(var n of i_(t))a_.call(t,n)&&l_(e,n,t[n]);return e})({},e),r_(n,o_({addLink:(e,n)=>{null==t||t.addLink(e,n)},editLink:(e,n,r)=>{null==t||t.editLink(e,n,r)},removeLink:(e,n)=>{null==t||t.removeLink(e,n)}}));var n}),e.set(SI.key,{view:n=>(t=new t_(e,n),t)})}const d_=mv({props:{config:{type:Object,required:!0},src:{type:Object,required:!0},onEdit:{type:Object,required:!0},onRemove:{type:Object,required:!0}},setup({config:e,src:t,onEdit:n,onRemove:r}){const o=Zw(()=>fu(t.value)),i=e=>{e.preventDefault(),e.stopPropagation(),n.value()},s=e=>{e.preventDefault(),e.stopPropagation(),r.value()},a=n=>{n.preventDefault();const r=t.value;navigator.clipboard&&r&&navigator.clipboard.writeText(r).then(()=>{e.value.onCopyLink(r)}).catch(e=>console.error(e))};return()=>Yw("div",{class:"link-preview"},Yw(MI,{class:"button link-icon",icon:e.value.linkIcon,onClick:a}),Yw("a",{href:o.value,target:"_blank",rel:"noopener noreferrer",class:"link-display"},t.value),Yw(MI,{class:"button link-edit-button",icon:e.value.editButton,onClick:i}),Yw(MI,{class:"button link-remove-button",icon:e.value.removeButton,onClick:s}))}});var u_,h_,p_,f_,m_,g_,v_,y_,w_,b_,x_,k_,C_,S_,M_=e=>{throw TypeError(e)},N_=(e,t,n)=>t.has(e)||M_("Cannot "+n),E_=(e,t,n)=>(N_(e,t,"read from private field"),n?n.call(e):t.get(e)),O_=(e,t,n)=>t.has(e)?M_("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),A_=(e,t,n,r)=>(N_(e,t,"write to private field"),t.set(e,n),n);class T_{constructor(e,t){this.ctx=e,O_(this,u_),O_(this,h_),O_(this,p_),O_(this,f_),O_(this,m_,Wm("")),O_(this,g_,Wm(()=>{})),O_(this,v_,Wm(()=>{})),O_(this,y_),O_(this,w_),O_(this,b_,!1),O_(this,x_,({mode:e})=>{"edit"===e&&E_(this,S_).call(this)}),O_(this,k_,()=>{A_(this,b_,!0)}),O_(this,C_,()=>{A_(this,b_,!1)}),O_(this,S_,()=>{E_(this,h_).hide(),E_(this,h_).element.removeEventListener("mouseenter",E_(this,k_)),E_(this,h_).element.removeEventListener("mouseleave",E_(this,C_))}),this.show=(e,t,n,r)=>{E_(this,f_).value=this.ctx.get(xI.key),E_(this,m_).value=e.attrs.href,E_(this,g_).value=()=>{this.ctx.get(bI.key).editLink(e,t,n)},E_(this,v_).value=()=>{this.ctx.get(bI.key).removeLink(t,n),E_(this,S_).call(this)},E_(this,h_).show({getBoundingClientRect:()=>r},E_(this,w_)),E_(this,h_).element.addEventListener("mouseenter",E_(this,k_)),E_(this,h_).element.addEventListener("mouseleave",E_(this,C_))},this.hide=()=>{E_(this,b_)||E_(this,S_).call(this)},this.update=()=>{},this.destroy=()=>{E_(this,y_).unmount(),E_(this,p_).off(E_(this,x_)),E_(this,h_).destroy(),E_(this,u_).remove()},A_(this,w_,t),A_(this,f_,Wm(this.ctx.get(xI.key))),A_(this,y_,Db(d_,{config:E_(this,f_),src:E_(this,m_),onEdit:E_(this,g_),onRemove:E_(this,v_)})),A_(this,u_,document.createElement("div")),E_(this,u_).className="milkdown-link-preview",E_(this,y_).mount(E_(this,u_)),A_(this,h_,new Lk({debounce:0,content:E_(this,u_),shouldShow:()=>!1})),E_(this,h_).update(t),A_(this,p_,e.use(wI.key)),E_(this,p_).on(E_(this,x_))}}function D_(e){let t;const n=He((n,r)=>{if(!t)return;if(!n.hasFocus())return;if("edit"===e.get(wI.key).mode)return;const o=function(e,t,n){const r=t.posAtCoords({left:n.clientX,top:n.clientY});if(!r)return;const{pos:o}=r,i=t.state.doc.nodeAt(o);if(!i)return;const s=i.marks.find(t=>t.type===gu.mark.type(e));if(!s)return;return CI.pluginKey()?{show:!0,pos:o,node:i,mark:s}:void 0}(e,n,r);if(o){const e=n.state.doc.resolve(o.pos),r=function(e,t,n,r,o){let i={start:-1,end:-1};return n.nodesBetween(r,o,(n,r)=>{if(i.start>-1)return!1;-1===i.start&&e.isInSet(n.marks)&&t===n&&(i={start:r,end:r+Math.max(n.textContent.length,1)})}),i}(o.mark,o.node,n.state.doc,e.before(),e.after()),i=r.start,s=r.end;return void t.show(o.mark,i,s,yi(n,i,s))}t.hide()},50);e.set(CI.key,{props:{handleDOMEvents:{mousemove:n,mouseleave:()=>{setTimeout(()=>{null==t||t.hide()},50)}}},view:n=>(t=new T_(e,n),t)})}function I_(e){D_(e),c_(e)}u_=new WeakMap,h_=new WeakMap,p_=new WeakMap,f_=new WeakMap,m_=new WeakMap,g_=new WeakMap,v_=new WeakMap,y_=new WeakMap,w_=new WeakMap,b_=new WeakMap,x_=new WeakMap,k_=new WeakMap,C_=new WeakMap,S_=new WeakMap;const __=[wI,bI,xI,CI,SI,kI].flat();var R_=Object.defineProperty,L_=Object.getOwnPropertySymbols,B_=Object.prototype.hasOwnProperty,P_=Object.prototype.propertyIsEnumerable,z_=(e,t,n)=>t in e?R_(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,j_=(e,t)=>{for(var n in t||(t={}))B_.call(t,n)&&z_(e,n,t[n]);if(L_)for(var n of L_(t))P_.call(t,n)&&z_(e,n,t[n]);return e};function V_(e,t){return Object.assign(e,{meta:j_({package:"@milkdown/components"},t)}),e}const $_=Md({renderLabel:({label:e,listType:t,checked:n})=>null==n?"bullet"===t?"⦿":e:n?"☑":"□"},"listItemBlockConfigCtx");function H_({icon:e,class:t,onClick:n}){return Yw("span",{class:_e("milkdown-icon",t),onPointerdown:n,innerHTML:e?Re.sanitize(e.trim()):void 0})}V_($_,{displayName:"Config<list-item-block>",group:"ListItemBlock"}),H_.props={icon:{type:String,required:!1},class:{type:String,required:!1},onClick:{type:Function,required:!1}};const q_=mv({props:{label:{type:Object,required:!0},checked:{type:Object,required:!0},listType:{type:Object,required:!0},config:{type:Object,required:!0},readonly:{type:Object,required:!0},selected:{type:Object,required:!0},setAttr:{type:Function,required:!0},onMount:{type:Function,required:!0}},setup({label:e,checked:t,listType:n,config:r,readonly:o,setAttr:i,onMount:s,selected:a}){const l=e=>{null!=e&&e instanceof Element&&s(e)},c=e=>{null!=t.value&&(e.stopPropagation(),e.preventDefault(),i("checked",!t.value))},d=Zw(()=>r.renderLabel({label:e.value,listType:n.value,checked:t.value,readonly:o.value})),u=Zw(()=>null==t.value?"bullet"===n.value?"bullet":"ordered":t.value?"checked":"unchecked");return()=>Yw("li",{class:_e("list-item",a.value&&"ProseMirror-selectednode")},Yw("div",{class:"label-wrapper",onPointerdown:c,contenteditable:!1},Yw(H_,{class:_e("label",o.value&&"readonly",u.value),icon:d.value})),Yw("div",{class:"children",ref:l}))}}),F_=new WeakMap;const W_=Sd(wh.node,e=>(t,n,r)=>{const o=document.createElement("div");o.className="milkdown-list-item-block";const i=document.createElement("div");i.setAttribute("data-content-dom","true"),i.classList.add("content-dom");const s=Wm(t.attrs.label),a=Wm(t.attrs.checked),l=Wm(t.attrs.listType),c=Wm(!n.editable),d=e.get($_.key),u=Wm(!1),h=ov(()=>{u.value?o.classList.add("selected"):o.classList.remove("selected")});let p=null;const f=Db(q_,{label:s,checked:a,listType:l,readonly:c,config:d,selected:u,setAttr:(e,t)=>{if(!n.editable)return;const o=r();null!=o&&(n.hasFocus()||n.focus(),n.dispatch(n.state.tr.setNodeAttribute(o,e,t)))},onMount:e=>{if(e===p)return;p=e;const{anchor:t,head:r}=n.state.selection;e.appendChild(i),function(e,t,n){let r=F_.get(e);if(!r){const t=new Map;r=t,F_.set(e,t),requestAnimationFrame(()=>{if(F_.delete(e),e.isDestroyed)return;const{state:n}=e,r=n.doc.content.size;let o;for(const e of t.values())e.anchor<=r&&e.head<=r&&(o=e);if(!o)return;const i=n.doc.resolve(o.anchor),s=n.doc.resolve(o.head),a=Fr.between(i,s);e.dispatch(n.tr.setSelection(a))})}r.delete(t),r.set(t,n)}(n,o,{anchor:t,head:r})}});f.mount(o);const m=e=>{l.value=e.attrs.listType,s.value=e.attrs.label,a.value=e.attrs.checked,c.value=!n.editable};m(t);let g=t;return{dom:o,contentDOM:i,update:e=>e.type===t.type&&(e.sameMarkup(g)&&e.content.eq(g.content)||(g=e,m(e)),!0),ignoreMutation:e=>!o||!i||"selection"!==e.type&&(i===e.target&&"attributes"===e.type||!i.contains(e.target)),selectNode:()=>{u.value=!0},deselectNode:()=>{u.value=!1},destroy:()=>{var e;null==(e=F_.get(n))||e.delete(o),h(),f.unmount(),o.remove(),i.remove()}}});V_(W_,{displayName:"NodeView<list-item-block>",group:"ListItemBlock"});const U_=[$_,W_];var G_=Object.defineProperty,K_=Object.getOwnPropertySymbols,J_=Object.prototype.hasOwnProperty,Z_=Object.prototype.propertyIsEnumerable,Y_=(e,t,n)=>t in e?G_(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,X_=(e,t)=>{for(var n in t||(t={}))J_.call(t,n)&&Y_(e,n,t[n]);if(K_)for(var n of K_(t))Z_.call(t,n)&&Y_(e,n,t[n]);return e};function Q_(e,t){return Object.assign(e,{meta:X_({package:"@milkdown/components"},t)}),e}var eR=Object.defineProperty,tR=Object.getOwnPropertySymbols,nR=Object.prototype.hasOwnProperty,rR=Object.prototype.propertyIsEnumerable,oR=(e,t,n)=>t in e?eR(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;const iR=Md(((e,t)=>{for(var n in t||(t={}))nR.call(t,n)&&oR(e,n,t[n]);if(tR)for(var n of tR(t))rR.call(t,n)&&oR(e,n,t[n]);return e})({},{renderButton:e=>{switch(e){case"add_row":case"add_col":return"+";case"delete_row":case"delete_col":return"-";case"align_col_left":return"left";case"align_col_center":return"center";case"align_col_right":return"right";case"col_drag_handle":case"row_drag_handle":return"="}}}),"tableBlockConfigCtx");function sR({icon:e,class:t,onClick:n}){return Yw("span",{class:_e("milkdown-icon",t),onPointerdown:n,innerHTML:e?Re.sanitize(e.trim()):void 0})}function aR(e){const{dragPreviewRef:t,tableWrapperRef:n,contentWrapperRef:r,yLineHandleRef:o,xLineHandleRef:i,colHandleRef:s,rowHandleRef:a}=e,l=t.value;if(!l)return;const c=n.value;if(!c)return;const d=r.value;if(!d)return;const u=d.querySelector("tbody");if(!u)return;const h=l.querySelector("tbody");if(!h)return;const p=o.value;if(!p)return;const f=i.value;if(!f)return;const m=s.value;if(!m)return;const g=a.value;if(!g)return;return{preview:l,wrapper:c,content:d,contentRoot:u,previewRoot:h,yHandle:p,xHandle:f,colHandle:m,rowHandle:g}}function lR(e){for(;e.firstChild;)e.removeChild(e.firstChild)}function cR(e,t,n,r,o){const{width:i,height:s}=r.querySelector("tbody").getBoundingClientRect();if("y"===e){const e=r.querySelectorAll("tr")[o];if(!e)return;n.appendChild(e.cloneNode(!0));const s=e.getBoundingClientRect().height;return Object.assign(t.style,{width:`${i}px`,height:`${s}px`}),void(t.dataset.show="true")}if("x"===e){const e=r.querySelectorAll("tr");let i;return Array.from(e).forEach(e=>{const t=e.children[o];if(!t)return;void 0===i&&(i=t.getBoundingClientRect().width);const r=t.parentElement.cloneNode(!1),s=t.cloneNode(!0);r.appendChild(s),n.appendChild(r)}),Object.assign(t.style,{width:`${i}px`,height:`${s}px`}),void(t.dataset.show="true")}}function dR(e,t,n,r){const{xHandle:o,yHandle:i,colHandle:s,rowHandle:a,preview:l}=n;o.dataset.displayType="y"===e?"indicator":"none",i.dataset.displayType="x"===e?"indicator":"none","y"===e?(s.dataset.show="false",hR(a)):(a.dataset.show="false",hR(s));const{hoverIndex:c,dragInfo:d}=r,[u,h]=c.value;d.value={startCoords:[t.clientX,t.clientY],startIndex:"y"===e?u:h,endIndex:"y"===e?u:h,type:"y"===e?"row":"col"},l.dataset.direction="y"===e?"vertical":"horizontal"}function uR(e,t,n,r){const o=null==n?void 0:n.get(ac);if(!(null==o?void 0:o.editable))return;t.stopPropagation(),t.dataTransfer&&(t.dataTransfer.effectAllowed="move");const i=aR(e);i&&requestAnimationFrame(()=>{r(i)})}function hR(e){var t;null==(t=e.querySelector(".button-group"))||t.setAttribute("data-show","false")}function pR(e,t){for(let n=0;n<e.childCount;n++)if(e.child(n)===t)return n;return-1}function fR(e,[t,n]){const r=e.value;if(!r)return;const o=r.querySelectorAll("tr"),i=o[t];if(!i)return;const s=o[0];if(!s)return;const a=s.children[n];if(!a)return;const l=i.children[n];return l?{row:i,col:l,headerCol:a}:void 0}function mR({refs:e,index:t,before:n,after:r}){const{contentWrapperRef:o,colHandleRef:i,hoverIndex:s}=e,a=i.value;if(!a)return;s.value=t;const l=fR(o,t);if(!l)return;const{headerCol:c}=l;a.dataset.show="true",n&&n(a),Be(c,a,{placement:"top"}).then(({x:e,y:t})=>{Object.assign(a.style,{left:`${e}px`,top:`${t}px`}),r&&r(a)}).catch(console.error)}function gR({refs:e,index:t,before:n,after:r}){const{contentWrapperRef:o,rowHandleRef:i,hoverIndex:s}=e,a=i.value;if(!a)return;s.value=t;const l=fR(o,t);if(!l)return;const{row:c}=l;a.dataset.show="true",n&&n(a),Be(c,a,{placement:"left"}).then(({x:e,y:t})=>{Object.assign(a.style,{left:`${e}px`,top:`${t}px`}),r&&r(a)}).catch(console.error)}function vR(e,t,n){const r="x"===n?"left":"top",o="x"===n?"right":"bottom",i=e.length-1,s=e.findIndex((e,n)=>{const s=e.getBoundingClientRect(),a=s[r],l=s[o];return a<=t&&t<=l||(n===i&&t>l||0===n&&t<a)}),a=e[s];return a?[a,s]:void 0}function yR(e){return $e(t=>{const n=aR(e);if(!n)return;const{preview:r,content:o,contentRoot:i,xHandle:s,yHandle:a}=n,{dragInfo:l,hoverIndex:c}=e;if("false"===r.dataset.show)return;const d=fR(e.contentWrapperRef,c.value);if(!d)return;if(!i.querySelector("tr"))return;const u=l.value;if(!u)return;if(!i.offsetParent)return;const h=i.offsetParent.offsetTop,p=i.offsetParent.offsetLeft;if("col"===u.type){const e=d.col.getBoundingClientRect().width,{left:n,width:s}=i.getBoundingClientRect(),l=p-n,c=t.clientX+l-e/2,[f]=u.startCoords,m=f<t.clientX?"right":"left";r.style.top=`${h}px`;const g=c<n+l-20?n+l-20:c>n+s+l-e+20?n+s+l-e+20:c;r.style.left=`${g}px`;const v=function(e,t){const n=e.querySelector("tr");if(!n)return;return vR(Array.from(n.children),t,"x")}(i,t.clientX);if(v){const[e,t]=v,n=a.getBoundingClientRect().width,r=o.getBoundingClientRect();u.endIndex=t,Be(e,a,{placement:"left"===m?"left":"right",middleware:[ze("left"===m?-1*n:0)]}).then(({x:e})=>{a.dataset.show="true",Object.assign(a.style,{height:`${r.height}px`,left:`${e}px`,top:`${h}px`})}).catch(console.error)}}else if("row"===u.type){const e=d.row.getBoundingClientRect().height,{top:n,height:a}=i.getBoundingClientRect(),l=h-n,c=t.clientY+l-e/2,[f,m]=u.startCoords,g=m<t.clientY?"down":"up",v=c<n+l-20?n+l-20:c>n+a+l-e+20?n+a+l-e+20:c;r.style.top=`${v}px`,r.style.left=`${p}px`;const y=function(e,t){return vR(Array.from(e.querySelectorAll("tr")),t,"y")}(i,t.clientY);if(y){const[e,t]=y,n=s.getBoundingClientRect().height,r=o.getBoundingClientRect();u.endIndex=t,Be(e,s,{placement:"up"===g?"top":"bottom",middleware:[ze("up"===g?-1*n:0)]}).then(({y:e})=>{s.dataset.show="true",Object.assign(s.style,{width:`${r.width}px`,top:`${e}px`})}).catch(console.error)}}},20)}function wR(e,t,n){const{dragPreviewRef:r,yLineHandleRef:o,xLineHandleRef:i,dragInfo:s}=e,a=function(e,t){return n=>{uR(e,n,t,t=>{dR("y",n,t,e);const{preview:r,content:o,previewRoot:i}=t;lR(i);const{hoverIndex:s}=e,[a]=s.value;cR("y",r,i,o,a)})}}(e,t),l=function(e,t){return n=>{uR(e,n,t,t=>{dR("x",n,t,e);const{preview:r,content:o,previewRoot:i}=t,{hoverIndex:s}=e,[a,l]=s.value;lR(i),cR("x",r,i,o,l)})}}(e,t),c=()=>{const e=r.value;if(!e)return;if("false"===e.dataset.show)return;const t=null==e?void 0:e.querySelector("tbody");for(;null==t?void 0:t.firstChild;)null==t||t.removeChild(t.firstChild);e&&(e.dataset.show="false")},d=()=>{var a;const l=r.value;if(!l)return;const c=o.value;if(!c)return;const d=i.value;if(!d)return;const u=s.value;if(!u)return;if(!t)return;if("false"===l.dataset.show)return;if(!e.colHandleRef.value)return;if(!e.rowHandleRef.value)return;if(c.dataset.show="false",d.dataset.show="false",u.startIndex===u.endIndex)return;const h=t.get(Ac),p={from:u.startIndex,to:u.endIndex,pos:(null!=(a=null==n?void 0:n())?a:0)+1};if("col"===u.type){h.call(SM.key,{pos:p.pos,index:u.startIndex}),h.call(kM.key,p);const t=[0,u.endIndex];mR({refs:e,index:t})}else{h.call(CM.key,{pos:p.pos,index:u.startIndex}),h.call(xM.key,p);const t=[u.endIndex,0];gR({refs:e,index:t})}requestAnimationFrame(()=>{t.get(ac).focus()})},u=yR(e);return Dv(()=>{window.addEventListener("dragover",u),window.addEventListener("dragend",c),window.addEventListener("drop",d)}),Lv(()=>{window.removeEventListener("dragover",u),window.removeEventListener("dragend",c),window.removeEventListener("drop",d)}),{dragRow:a,dragCol:l}}function bR(e,t){return $e(n=>{if(!(null==t?void 0:t.editable))return;const{contentWrapperRef:r,yLineHandleRef:o,xLineHandleRef:i,colHandleRef:s,rowHandleRef:a,hoverIndex:l,lineHoverIndex:c}=e,d=o.value;if(!d)return;const u=i.value;if(!u)return;const h=r.value;if(!h)return;const p=a.value;if(!p)return;const f=s.value;if(!f)return;const m=function(e,t){var n,r,o;if(t)try{const i=t.posAtCoords({left:e.clientX,top:e.clientY});if(!i)return;const s=null==i?void 0:i.inside;if(null==s||s<0)return;const a=t.state.doc.resolve(s),l=t.state.doc.nodeAt(s);if(!l)return;const c=["table_cell","table_header"],d=["table_row","table_header_row"],u=c.includes(l.type.name)?l:null==(n=xi(e=>c.includes(e.type.name))(a))?void 0:n.node,h=null==(r=xi(e=>d.includes(e.type.name))(a))?void 0:r.node,p=null==(o=xi(e=>"table"===e.type.name)(a))?void 0:o.node;if(!u||!h||!p)return;const f=pR(h,u);return[pR(p,h),f]}catch(e){return}}(n,t);if(!m)return;const g=fR(r,m);if(!g)return;const[v,y]=m,w=g.col.getBoundingClientRect(),b=Math.abs(n.clientX-w.left)<8,x=Math.abs(w.right-n.clientX)<8,k=Math.abs(n.clientY-w.top)<8,C=Math.abs(w.bottom-n.clientY)<8,S=b||x||k||C,M=p.querySelector(".button-group"),N=f.querySelector(".button-group");if(M&&(M.dataset.show="false"),N&&(N.dataset.show="false"),S){const e=h.getBoundingClientRect();p.dataset.show="false",f.dataset.show="false",u.dataset.displayType="tool",d.dataset.displayType="tool";const t=d.getBoundingClientRect().width,n=u.getBoundingClientRect().height;return b||x?(c.value[1]=b?y:y+1,Be(g.col,d,{placement:b?"left":"right",middleware:[ze(b?-1*t:0)]}).then(({x:t})=>{d.dataset.show="true",Object.assign(d.style,{height:`${e.height}px`,left:`${t}px`})}).catch(console.error)):d.dataset.show="false",void(0!==m[0]&&(k||C)?(c.value[0]=k?v:v+1,Be(g.row,u,{placement:k?"top":"bottom",middleware:[ze(k?-1*n:0)]}).then(({y:t})=>{u.dataset.show="true",Object.assign(u.style,{width:`${e.width}px`,top:`${t}px`})}).catch(console.error)):u.dataset.show="false")}c.value=[-1,-1],d.dataset.show="false",u.dataset.show="false",p.dataset.show="true",f.dataset.show="true",gR({refs:e,index:m}),mR({refs:e,index:m}),l.value=m},20)}function xR(e,t){const n=bR(e,t),r=function(e){return()=>{const{rowHandleRef:t,colHandleRef:n,yLineHandleRef:r,xLineHandleRef:o}=e;setTimeout(()=>{const e=t.value;if(!e)return;const i=n.value;if(!i)return;const s=r.value;if(!s)return;const a=o.value;a&&(e.dataset.show="false",i.dataset.show="false",s.dataset.show="false",a.dataset.show="false")},200)}}(e);return{pointerMove:n,pointerLeave:r}}Q_(iR,{displayName:"Config<table-block>",group:"TableBlock"}),sR.props={icon:{type:String,required:!1},class:{type:String,required:!1},onClick:{type:Function,required:!1}};const kR=mv({props:{view:{type:Object,required:!0},ctx:{type:Object,required:!0},getPos:{type:Function,required:!0},config:{type:Object,required:!0},onMount:{type:Function,required:!0},node:{type:Object,required:!0}},setup({view:e,node:t,ctx:n,getPos:r,config:o,onMount:i}){const s=Wm(),a=e=>{null!=e&&(e instanceof HTMLElement?(s.value=e,i(e)):s.value=void 0)},l=Wm(),c=Wm(),d=Wm(),u=Wm(),h=Wm(),p=Wm(),f=Wm([0,0]),m=Wm([-1,-1]),g=Wm(),v={dragPreviewRef:p,tableWrapperRef:h,contentWrapperRef:s,yLineHandleRef:u,xLineHandleRef:d,colHandleRef:l,rowHandleRef:c,hoverIndex:f,lineHoverIndex:m,dragInfo:g},{pointerLeave:y,pointerMove:w}=xR(v,e),{dragRow:b,dragCol:x}=wR(v,n,r),{onAddRow:k,onAddCol:C,selectCol:S,selectRow:M,deleteSelected:N,onAlign:E}=function(e,t,n){const{xLineHandleRef:r,contentWrapperRef:o,colHandleRef:i,rowHandleRef:s,hoverIndex:a,lineHoverIndex:l}=e;return{onAddRow:()=>{var e,i,s;if(!t)return;const a=r.value;if(!a)return;const[c]=l.value;if(c<0)return;if(!t.get(ac).editable)return;const d=Array.from(null!=(i=null==(e=o.value)?void 0:e.querySelectorAll("tr"))?i:[]),u=t.get(Ac),h=(null!=(s=null==n?void 0:n())?s:0)+1;d.length===c?(u.call(CM.key,{pos:h,index:c-1}),u.call(TM.key)):(u.call(CM.key,{pos:h,index:c}),u.call(AM.key)),u.call(CM.key,{pos:h,index:c}),a.dataset.show="false"},onAddCol:()=>{var e,i,s,a;if(!t)return;if(!r.value)return;const[c,d]=l.value;if(d<0)return;if(!t.get(ac).editable)return;const u=Array.from(null!=(s=null==(i=null==(e=o.value)?void 0:e.querySelector("tr"))?void 0:i.children)?s:[]),h=t.get(Ac),p=(null!=(a=null==n?void 0:n())?a:0)+1;u.length===d?(h.call(SM.key,{pos:p,index:d-1}),h.call(OM.key)):(h.call(SM.key,{pos:p,index:d}),h.call(EM.key)),h.call(SM.key,{pos:p,index:d})},selectCol:()=>{var e,r;if(!t)return;const[o,s]=a.value,l=t.get(Ac),c=(null!=(e=null==n?void 0:n())?e:0)+1;l.call(SM.key,{pos:c,index:s});const d=null==(r=i.value)?void 0:r.querySelector(".button-group");d&&(d.dataset.show="true"===d.dataset.show?"false":"true")},selectRow:()=>{var e,r;if(!t)return;const[o,i]=a.value,l=t.get(Ac),c=(null!=(e=null==n?void 0:n())?e:0)+1;l.call(CM.key,{pos:c,index:o});const d=null==(r=s.value)?void 0:r.querySelector(".button-group");d&&o>0&&(d.dataset.show="true"===d.dataset.show?"false":"true")},deleteSelected:e=>{t&&t.get(ac).editable&&(e.preventDefault(),e.stopPropagation(),t.get(Ac).call(NM.key),requestAnimationFrame(()=>{t.get(ac).focus()}))},onAlign:e=>n=>{t&&t.get(ac).editable&&(n.preventDefault(),n.stopPropagation(),t.get(Ac).call(DM.key,e),requestAnimationFrame(()=>{t.get(ac).focus()}))}}}(v,n,r);return Dv(()=>{requestAnimationFrame(()=>{e.editable&&function(e,t,n){if(!n)return;if(!t)return;const{selection:r}=t.state;if(!(r instanceof qC))return;const{$from:o}=r,i=XC(o);if(i&&i.node===n){if(r.isColSelection()){const{$head:t}=r;return void mR({refs:e,index:[0,t.index(t.depth-1)],before:e=>{var t;null==(t=e.querySelector(".button-group"))||t.setAttribute("data-show","true")}})}if(r.isRowSelection()){const{$head:t}=r,n=xi(e=>"table_row"===e.type.name||"table_header_row"===e.type.name)(t);if(!n)return;const o=pR(i.node,n.node);gR({refs:e,index:[o,0],before:e=>{var t;o>0&&(null==(t=e.querySelector(".button-group"))||t.setAttribute("data-show","true"))}})}}}(v,e,t.value)})}),()=>Yw("div",{onDragstart:e=>e.preventDefault(),onDragover:e=>e.preventDefault(),onDragleave:e=>e.preventDefault(),onPointermove:w,onPointerleave:y},Yw("div",{"data-show":"false",contenteditable:"false",draggable:"true","data-role":"col-drag-handle",class:"handle cell-handle",onDragstart:x,onClick:S,onPointerdown:e=>e.stopPropagation(),onPointermove:e=>e.stopPropagation(),ref:l},Yw(sR,{icon:o.renderButton("col_drag_handle")}),Yw("div",{"data-show":"false",class:"button-group",onPointermove:e=>e.stopPropagation()},Yw("button",{type:"button",onPointerdown:E("left")},Yw(sR,{icon:o.renderButton("align_col_left")})),Yw("button",{type:"button",onPointerdown:E("center")},Yw(sR,{icon:o.renderButton("align_col_center")})),Yw("button",{type:"button",onPointerdown:E("right")},Yw(sR,{icon:o.renderButton("align_col_right")})),Yw("button",{type:"button",onPointerdown:N},Yw(sR,{icon:o.renderButton("delete_col")})))),Yw("div",{"data-show":"false",contenteditable:"false",draggable:"true","data-role":"row-drag-handle",class:"handle cell-handle",onDragstart:b,onClick:M,onPointerdown:e=>e.stopPropagation(),onPointermove:e=>e.stopPropagation(),ref:c},Yw(sR,{icon:o.renderButton("row_drag_handle")}),Yw("div",{"data-show":"false",class:"button-group",onPointermove:e=>e.stopPropagation()},Yw("button",{type:"button",onPointerdown:N},Yw(sR,{icon:o.renderButton("delete_row")})))),Yw("div",{class:"table-wrapper",ref:h},Yw("div",{"data-show":"false",class:"drag-preview","data-direction":"vertical",ref:p},Yw("table",null,Yw("tbody",null))),Yw("div",{"data-show":"false",contenteditable:"false","data-display-type":"tool","data-role":"x-line-drag-handle",class:"handle line-handle",onPointermove:e=>e.stopPropagation(),ref:d},Yw("button",{type:"button",onClick:k,class:"add-button"},Yw(sR,{icon:o.renderButton("add_row")}))),Yw("div",{"data-show":"false",contenteditable:"false","data-display-type":"tool","data-role":"y-line-drag-handle",class:"handle line-handle",onPointermove:e=>e.stopPropagation(),ref:u},Yw("button",{type:"button",onClick:C,class:"add-button"},Yw(sR,{icon:o.renderButton("add_col")}))),Yw("table",{ref:a,class:"children"})))}});var CR,SR,MR=e=>{throw TypeError(e)},NR=(e,t,n)=>(((e,t,n)=>{t.has(e)||MR("Cannot "+n)})(e,t,"access private method"),n);class ER{constructor(e,t,n,r){var o,i,s;this.ctx=e,this.node=t,this.view=n,this.getPos=r,o=this,(i=CR).has(o)?MR("Cannot add the same private member more than once"):i instanceof WeakSet?i.add(o):i.set(o,s);const a=document.createElement("div");a.className="milkdown-table-block";const l=document.createElement("tbody");this.contentDOM=l,l.setAttribute("data-content-dom","true"),l.classList.add("content-dom"),this.nodeRef=Um(t);const c=Db(kR,{view:n,ctx:e,getPos:r,config:e.get(iR.key),onMount:e=>{e.appendChild(l)},node:this.nodeRef});c.mount(a),this.app=c,this.dom=a}update(e){return e.type===this.node.type&&((!e.sameMarkup(this.node)||!e.content.eq(this.node.content))&&(this.node=e,this.nodeRef.value=e,!0))}stopEvent(e){if("drop"===e.type||e.type.startsWith("drag"))return!0;if("mousedown"===e.type||"pointerdown"===e.type){if(e.target instanceof Element&&e.target.closest("button"))return!0;const t=e.target;if(t instanceof HTMLElement&&(t.closest("th")||t.closest("td"))){const t=e;return NR(this,CR,SR).call(this,t)}}return!1}ignoreMutation(e){return!this.dom||!this.contentDOM||"selection"!==e.type&&(this.contentDOM===e.target&&"attributes"===e.type||!this.contentDOM.contains(e.target))}destroy(){this.app.unmount(),this.dom.remove(),this.contentDOM.remove()}}CR=new WeakSet,SR=function(e){const t=this.view;if(!t.editable)return!1;const{state:n,dispatch:r}=t,o=t.posAtCoords({left:e.clientX,top:e.clientY});if(!o)return!1;const i=n.doc.resolve(o.inside),s=xi(e=>"table_cell"===e.type.name||"table_header"===e.type.name)(i);if(!s)return!1;if(n.selection instanceof Fr){const e=xi(e=>"table_cell"===e.type.name||"table_header"===e.type.name)(n.selection.$from);if((null==e?void 0:e.node)===s.node)return!1}const{from:a}=s,l=Ur.create(n.doc,a+1);return!n.selection.eq(l)&&(n.selection instanceof qC?setTimeout(()=>{r(n.tr.setSelection(l).scrollIntoView())},20):requestAnimationFrame(()=>{r(n.tr.setSelection(l).scrollIntoView())}),!0)};const OR=Sd(sM.node,e=>(t,n,r)=>new ER(e,t,n,r));Q_(OR,{displayName:"NodeView<table-block>",group:"TableBlock"});const AR=[iR,OR];function TR(e){if(!e)return!1;if(Array.isArray(e))return!(e.length>1)&&TR(e[0]);const t=e.content;return t?TR(t):"text"===e.type}function DR(e,t){const n=bi(t);if(n)return e.dispatch(e.state.tr.replaceSelectionWith(n,!0)),!0;try{return e.dispatch(e.state.tr.replaceSelection(t)),!0}catch{return!1}}var IR,_R,RR=kd(e=>{const t=e.get(Cc);e.update(ad,e=>({...e,editable:e.editable??(()=>!0),transformPastedHTML:(t,n)=>{const r=e.transformPastedHTML;return r&&(t=r(t,n)),t.includes("docs-internal-guid")&&(t=(t=t.replace(/<b[^>]*id="docs-internal-guid[^"]*"[^>]*>([\s\S]*)<\/b>/,"$1")).replace(/<div[^>]*>(<table[\s\S]*?<\/table>)<\/div>/g,"$1")),t}}));const n=new lo("MILKDOWN_CLIPBOARD");return new io({key:n,props:{handlePaste:(n,r,o)=>{const i=e.get(Vc),s=n.props.editable?.(n.state),{clipboardData:a}=r;if(!s||!a)return!1;if(n.state.selection.$from.node().type.spec.code)return!1;const l=a.getData("text/plain"),c=a.getData("vscode-editor-data");if(c){const e=JSON.parse(c)?.mode;if(l&&e){const{tr:r}=n.state,o=ki("code_block",t);return r.replaceSelectionWith(o.create({language:e})).setSelection(Fr.near(r.doc.resolve(Math.max(0,r.selection.from-2)))).insertText(l.replace(/\r\n?/g,"\n")),n.dispatch(r),!0}}const d=a.getData("text/html");if(0===d.length&&0===l.length)return!1;if(d.length>0&&o)return DR(n,o);const u=Bn.fromSchema(t);let h;if(0===d.length){const e=i(l);if(!e||"string"==typeof e)return!1;h=Un.fromSchema(t).serializeFragment(e.content)}else{const e=document.createElement("template");e.innerHTML=d,h=e.content.cloneNode(!0),e.remove()}return DR(n,u.parseSlice(h))},clipboardTextSerializer:n=>{const r=e.get(Uc);if(TR(n.content.toJSON()))return n.content.textBetween(0,n.content.size,"\n\n");const o=t.topNodeType.createAndFill(void 0,n.content);return o?r(o):""}}})});function LR(e,t){return Object.assign(e,{meta:{package:"@milkdown/plugin-history",...t}}),e}IR=RR,_R={displayName:"Prose<clipboard>"},Object.assign(IR,{meta:{package:"@milkdown/plugin-clipboard",..._R}});var BR=yd("Undo",()=>()=>mp);LR(BR,{displayName:"Command<undo>"});var PR=yd("Redo",()=>()=>gp);LR(PR,{displayName:"Command<redo>"});var zR=Md({},"historyProviderConfig");LR(zR,{displayName:"Ctx<historyProviderConfig>"});var jR=kd(e=>pp(e.get(zR.key)));LR(jR,{displayName:"Ctx<historyProviderPlugin>"});var VR=Od("historyKeymap",{Undo:{shortcuts:"Mod-z",command:e=>{const t=e.get(Ac);return()=>t.call(BR.key)}},Redo:{shortcuts:["Mod-y","Shift-Mod-z"],command:e=>{const t=e.get(Ac);return()=>t.call(PR.key)}}});LR(VR.ctx,{displayName:"KeymapCtx<history>"}),LR(VR.shortcuts,{displayName:"Keymap<history>"});var $R=[zR,jR,VR,BR,PR].flat();var HR=Md({type:"space",size:2},"indentConfig");HR.meta={package:"@milkdown/plugin-indent",displayName:"Ctx<indentConfig>"};var qR=Cd(e=>({Tab:(t,n)=>{const r=e.get(HR.key),{tr:o}=t,i=function(e,t){const{doc:n,selection:r}=e;if(!n||!r)return e;if(!(r instanceof Fr||r instanceof Kr))return e;const{to:o}=r,i="space"===t.type?Array(t.size).fill(" ").join(""):"\t";return e.insertText(i,o)}(o,r);return!!i.docChanged&&(n?.(i),!0)}}));qR.meta={package:"@milkdown/plugin-indent",displayName:"Shortcut<indent>"};var FR=[HR,qR],WR=class{constructor(){this.beforeMountedListeners=[],this.mountedListeners=[],this.updatedListeners=[],this.selectionUpdatedListeners=[],this.markdownUpdatedListeners=[],this.blurListeners=[],this.focusListeners=[],this.destroyListeners=[],this.beforeMount=e=>(this.beforeMountedListeners.push(e),this),this.mounted=e=>(this.mountedListeners.push(e),this),this.updated=e=>(this.updatedListeners.push(e),this)}get listeners(){return{beforeMount:this.beforeMountedListeners,mounted:this.mountedListeners,updated:this.updatedListeners,markdownUpdated:this.markdownUpdatedListeners,blur:this.blurListeners,focus:this.focusListeners,destroy:this.destroyListeners,selectionUpdated:this.selectionUpdatedListeners}}markdownUpdated(e){return this.markdownUpdatedListeners.push(e),this}blur(e){return this.blurListeners.push(e),this}focus(e){return this.focusListeners.push(e),this}destroy(e){return this.destroyListeners.push(e),this}selectionUpdated(e){return this.selectionUpdatedListeners.push(e),this}},UR=Dt(new WR,"listener"),GR=new lo("MILKDOWN_LISTENER"),KR=e=>(e.inject(UR,new WR),async()=>{await e.wait(wc);const{listeners:t}=e.get(UR);t.beforeMount.forEach(t=>t(e)),await e.wait(qc);const n=e.get(Uc);let r=null,o=null,i=null,s=null;const a=He(()=>{if(!s)return;const{doc:i}=s;if(t.updated.length>0&&r&&!r.eq(i)&&t.updated.forEach(t=>{t(e,i,r)}),t.markdownUpdated.length>0&&r&&!r.eq(i)){const r=n(i);t.markdownUpdated.forEach(t=>{t(e,r,o)}),o=r}r=i,s=null},200),l=new io({key:GR,view:()=>({destroy:()=>{a.cancel(),t.destroy.forEach(t=>t(e))}}),props:{handleDOMEvents:{focus:()=>(t.focus.forEach(t=>t(e)),!1),blur:()=>(t.blur.forEach(t=>t(e)),!1)}},state:{init:(e,t)=>{r=t.doc,o=n(t.doc)},apply:n=>{const r=n.selection;(!i&&r||i&&!r.eq(i))&&(t.selectionUpdated.forEach(t=>{t(e,r,i)}),i=r),(n.docChanged||n.storedMarksSet)&&!1!==n.getMeta("addToHistory")&&(s=n,a())}}});e.update(hc,e=>e.concat(l)),await e.wait(id),t.mounted.forEach(t=>t(e))});KR.meta={package:"@milkdown/plugin-listener",displayName:"Listener"};var JR=Md({shouldAppend:e=>!!e&&!["heading","paragraph"].includes(e.type.name),getNode:e=>e.schema.nodes.paragraph.create()},"trailingConfig");JR.meta={package:"@milkdown/plugin-trailing",displayName:"Ctx<trailingConfig>"};var ZR=kd(e=>{const t=new lo("MILKDOWN_TRAILING"),{shouldAppend:n,getNode:r}=e.get(JR.key),o=new io({key:t,state:{init:(e,t)=>{const r=t.tr.doc.lastChild;return n(r,t)},apply:(e,t,r,o)=>{if(!e.docChanged)return t;const i=e.doc.lastChild;return n(i,o)}},appendTransaction:(e,t,n)=>{const{doc:i,tr:s}=n,a=r?.(n),l=o.getState(n),c=i.content.size;if(l&&a)return s.insert(c,a)}});return o});ZR.meta={package:"@milkdown/plugin-trailing",displayName:"Prose<trailing>"};var YR=[JR,ZR];var XR=Md({uploader:async(e,t)=>{const n=[];for(let t=0;t<e.length;t++){const r=e.item(t);r&&(r.type.includes("image")&&n.push(r))}const{image:r}=t.nodes;if(!r)throw Nt("image");return(await Promise.all(n.map(e=>{return t=e,new Promise(e=>{const n=new FileReader;n.addEventListener("load",()=>{e({alt:t.name,src:n.result})},!1),n.readAsDataURL(t)});var t}))).map(({alt:e,src:t})=>r.createAndFill({src:t,alt:e}))},enableHtmlFileUploader:!1,uploadWidgetFactory:(e,t)=>{const n=document.createElement("span");return n.textContent="Upload in progress...",Nl.widget(e,n,t)}},"uploadConfig");XR.meta={package:"@milkdown/plugin-upload",displayName:"Ctx<uploadConfig>"};var QR=kd(e=>{const t=new lo("MILKDOWN_UPLOAD"),n=(n,r,o)=>{if(!o||o.length<=0)return!1;const i=Symbol("upload symbol"),s=e.get(Cc),{uploader:a,getInsertPos:l}=e.get(XR.key),{tr:c}=n.state,d=r instanceof DragEvent?n.posAtCoords({left:r.clientX,top:r.clientY})?.pos??c.selection.from:c.selection.from,u="function"==typeof l?l(r,e,d):d;return n.dispatch(c.setMeta(t,{add:{id:i,pos:u}})),a(o,s,e,u).then(e=>{const r=((e,n)=>{const r=t.getState(e);if(!r)return-1;const o=r.find(void 0,void 0,e=>e.id===n);return o.length?o[0]?.from??-1:-1})(n.state,i);r<0||n.dispatch(n.state.tr.replaceWith(r,r,e).setMeta(t,{remove:{id:i}}))}).catch(e=>{console.error(e)}),!0};return new io({key:t,state:{init:()=>Al.empty,apply(t,n){const r=n.map(t.mapping,t.doc),o=t.getMeta(this);if(!o)return r;if(o.add){const{uploadWidgetFactory:n}=e.get(XR.key),i=n(o.add.pos,{id:o.add.id});return r.add(t.doc,[i])}if(o.remove){const e=r.find(void 0,void 0,e=>e.id===o.remove.id);return r.remove(e)}return r}},props:{decorations(e){return this.getState(e)},handlePaste:(t,r)=>{const{enableHtmlFileUploader:o}=e.get(XR.key);return r instanceof ClipboardEvent&&(!(!o&&r.clipboardData?.getData("text/html"))&&n(t,r,r.clipboardData?.files))},handleDrop:(e,t)=>t instanceof DragEvent&&n(e,t,t.dataTransfer?.files)}})});QR.meta={package:"@milkdown/plugin-upload",displayName:"Prose<upload>"};var eL=[XR,QR],tL=(e=>(e.CodeMirror="code-mirror",e.ListItem="list-item",e.LinkTooltip="link-tooltip",e.Cursor="cursor",e.ImageBlock="image-block",e.BlockEdit="block-edit",e.Toolbar="toolbar",e.Placeholder="placeholder",e.Table="table",e.Latex="latex",e.TopBar="top-bar",e.AI="ai",e))(tL||{});const nL={cursor:!0,"list-item":!0,"link-tooltip":!0,"image-block":!0,"block-edit":!0,placeholder:!0,toolbar:!0,"code-mirror":!0,table:!0,latex:!0,"top-bar":!1,ai:!1},rL='\n <svg\n xmlns="http://www.w3.org/2000/svg"\n width="24"\n height="24"\n viewBox="0 0 24 24"\n >\n <path\n fill="currentColor"\n d="M19 9l1.25-2.75L23 5l-2.75-1.25L19 1l-1.25 2.75L15 5l2.75 1.25zm0 14l1.25-2.75L23 19l-2.75-1.25L19 15l-1.25 2.75L15 19l2.75 1.25zM9 20l3-6.5L18 10l-6-3.5L9 0L6 6.5L0 10l6 3.5z"\n transform="translate(3 3) scale(0.75)"\n />\n </svg>\n',oL='\n <svg\n xmlns="http://www.w3.org/2000/svg"\n width="24"\n height="24"\n viewBox="0 0 24 24"\n >\n <path\n d="M8.85758 18.625C8.4358 18.625 8.07715 18.4772 7.78163 18.1817C7.48613 17.8862 7.33838 17.5275 7.33838 17.1058V6.8942C7.33838 6.47242 7.48613 6.11377 7.78163 5.81825C8.07715 5.52275 8.4358 5.375 8.85758 5.375H12.1999C13.2191 5.375 14.1406 5.69231 14.9643 6.32693C15.788 6.96154 16.1999 7.81603 16.1999 8.89038C16.1999 9.63779 16.0194 10.2471 15.6585 10.7183C15.2976 11.1894 14.9088 11.5314 14.4922 11.7442C15.005 11.9211 15.4947 12.2708 15.9614 12.7933C16.428 13.3157 16.6614 14.0192 16.6614 14.9038C16.6614 16.182 16.1902 17.1217 15.2479 17.723C14.3056 18.3243 13.3563 18.625 12.3999 18.625H8.85758ZM9.4883 16.6327H12.3191C13.1063 16.6327 13.6627 16.4141 13.9884 15.9769C14.314 15.5397 14.4768 15.1205 14.4768 14.7192C14.4768 14.3179 14.314 13.8987 13.9884 13.4615C13.6627 13.0243 13.0909 12.8057 12.273 12.8057H9.4883V16.6327ZM9.4883 10.875H12.0826C12.6903 10.875 13.172 10.7013 13.5278 10.3539C13.8836 10.0064 14.0615 9.59037 14.0615 9.10575C14.0615 8.59035 13.8733 8.16918 13.497 7.84225C13.1207 7.51533 12.6595 7.35188 12.1133 7.35188H9.4883V10.875Z"\n />\n </svg>\n',iL='\n <svg\n xmlns="http://www.w3.org/2000/svg"\n width="24"\n height="24"\n viewBox="0 0 24 24"\n >\n <g clip-path="url(#clip0_977_8070)">\n <path\n d="M4 10.5C3.17 10.5 2.5 11.17 2.5 12C2.5 12.83 3.17 13.5 4 13.5C4.83 13.5 5.5 12.83 5.5 12C5.5 11.17 4.83 10.5 4 10.5ZM4 4.5C3.17 4.5 2.5 5.17 2.5 6C2.5 6.83 3.17 7.5 4 7.5C4.83 7.5 5.5 6.83 5.5 6C5.5 5.17 4.83 4.5 4 4.5ZM4 16.5C3.17 16.5 2.5 17.18 2.5 18C2.5 18.82 3.18 19.5 4 19.5C4.82 19.5 5.5 18.82 5.5 18C5.5 17.18 4.83 16.5 4 16.5ZM8 19H20C20.55 19 21 18.55 21 18C21 17.45 20.55 17 20 17H8C7.45 17 7 17.45 7 18C7 18.55 7.45 19 8 19ZM8 13H20C20.55 13 21 12.55 21 12C21 11.45 20.55 11 20 11H8C7.45 11 7 11.45 7 12C7 12.55 7.45 13 8 13ZM7 6C7 6.55 7.45 7 8 7H20C20.55 7 21 6.55 21 6C21 5.45 20.55 5 20 5H8C7.45 5 7 5.45 7 6Z"\n />\n </g>\n <defs>\n <clipPath id="clip0_977_8070">\n <rect width="24" height="24" />\n </clipPath>\n </defs>\n </svg>\n',sL='\n <svg\n xmlns="http://www.w3.org/2000/svg"\n fill="none"\n viewBox="0 0 24 24"\n stroke-width="1.5"\n stroke="currentColor"\n class="w-6 h-6"\n >\n <path\n stroke-linecap="round"\n stroke-linejoin="round"\n d="M19.5 8.25l-7.5 7.5-7.5-7.5"\n />\n </svg>\n',aL='\n <svg\n xmlns="http://www.w3.org/2000/svg"\n width="24"\n height="24"\n viewBox="0 0 24 24"\n >\n <g clip-path="url(#clip0_1098_15553)">\n <path\n d="M18.3007 5.70973C17.9107 5.31973 17.2807 5.31973 16.8907 5.70973L12.0007 10.5897L7.1107 5.69973C6.7207 5.30973 6.0907 5.30973 5.7007 5.69973C5.3107 6.08973 5.3107 6.71973 5.7007 7.10973L10.5907 11.9997L5.7007 16.8897C5.3107 17.2797 5.3107 17.9097 5.7007 18.2997C6.0907 18.6897 6.7207 18.6897 7.1107 18.2997L12.0007 13.4097L16.8907 18.2997C17.2807 18.6897 17.9107 18.6897 18.3007 18.2997C18.6907 17.9097 18.6907 17.2797 18.3007 16.8897L13.4107 11.9997L18.3007 7.10973C18.6807 6.72973 18.6807 6.08973 18.3007 5.70973Z"\n />\n </g>\n <defs>\n <clipPath id="clip0_1098_15553">\n <rect width="24" height="24" />\n </clipPath>\n </defs>\n </svg>\n',lL='\n <svg\n xmlns="http://www.w3.org/2000/svg"\n width="24"\n height="24"\n viewBox="0 0 24 24"\n >\n <g clip-path="url(#clip0_977_8081)">\n <path\n d="M9.4 16.6L4.8 12L9.4 7.4L8 6L2 12L8 18L9.4 16.6ZM14.6 16.6L19.2 12L14.6 7.4L16 6L22 12L16 18L14.6 16.6Z"\n />\n </g>\n <defs>\n <clipPath id="clip0_977_8081">\n <rect width="24" height="24" />\n </clipPath>\n </defs>\n </svg>\n',cL='\n <svg\n xmlns="http://www.w3.org/2000/svg"\n width="24"\n height="24"\n viewBox="0 0 24 24"\n fill="none"\n >\n <g clip-path="url(#clip0_1013_1606)">\n <path\n d="M9.00012 16.1998L5.50012 12.6998C5.11012 12.3098 4.49012 12.3098 4.10012 12.6998C3.71012 13.0898 3.71012 13.7098 4.10012 14.0998L8.29012 18.2898C8.68012 18.6798 9.31012 18.6798 9.70012 18.2898L20.3001 7.69982C20.6901 7.30982 20.6901 6.68982 20.3001 6.29982C19.9101 5.90982 19.2901 5.90982 18.9001 6.29982L9.00012 16.1998Z"\n fill="#817567"\n />\n </g>\n <defs>\n <clipPath id="clip0_1013_1606">\n <rect width="24" height="24" />\n </clipPath>\n </defs>\n </svg>\n',dL='\n <svg\n xmlns="http://www.w3.org/2000/svg"\n height="24px"\n viewBox="0 -960 960 960"\n width="24px"\n fill="none"\n >\n <path\n d="M360-240q-33 0-56.5-23.5T280-320v-480q0-33 23.5-56.5T360-880h360q33 0 56.5 23.5T800-800v480q0 33-23.5 56.5T720-240H360Zm0-80h360v-480H360v480ZM200-80q-33 0-56.5-23.5T120-160v-560h80v560h440v80H200Zm160-240v-480 480Z"\n />\n </svg>\n',uL='\n <svg\n xmlns="http://www.w3.org/2000/svg"\n width="24"\n height="24"\n viewBox="0 0 24 24"\n >\n <g clip-path="url(#clip0_977_7900)">\n <path\n fill-rule="evenodd"\n clip-rule="evenodd"\n d="M19 13H5C4.45 13 4 12.55 4 12C4 11.45 4.45 11 5 11H19C19.55 11 20 11.45 20 12C20 12.55 19.55 13 19 13Z"\n />\n </g>\n <defs>\n <clipPath id="clip0_977_7900">\n <rect width="24" height="24" />\n </clipPath>\n </defs>\n </svg>\n',hL='\n <svg\n xmlns="http://www.w3.org/2000/svg"\n width="16"\n height="16"\n viewBox="0 0 16 16"\n >\n <path\n d="M3.5 9.83366C3.35833 9.83366 3.23961 9.78571 3.14383 9.68983C3.04794 9.59394 3 9.47516 3 9.33349C3 9.19171 3.04794 9.07299 3.14383 8.97733C3.23961 8.88155 3.35833 8.83366 3.5 8.83366H12.5C12.6417 8.83366 12.7604 8.8816 12.8562 8.97749C12.9521 9.07338 13 9.19216 13 9.33383C13 9.4756 12.9521 9.59433 12.8562 9.68999C12.7604 9.78577 12.6417 9.83366 12.5 9.83366H3.5ZM3.5 7.16699C3.35833 7.16699 3.23961 7.11905 3.14383 7.02316C3.04794 6.92727 3 6.80849 3 6.66683C3 6.52505 3.04794 6.40633 3.14383 6.31066C3.23961 6.21488 3.35833 6.16699 3.5 6.16699H12.5C12.6417 6.16699 12.7604 6.21494 12.8562 6.31083C12.9521 6.40671 13 6.52549 13 6.66716C13 6.80894 12.9521 6.92766 12.8562 7.02333C12.7604 7.1191 12.6417 7.16699 12.5 7.16699H3.5Z"\n />\n </svg>\n',pL='\n <svg\n xmlns="http://www.w3.org/2000/svg"\n width="24"\n height="24"\n viewBox="0 0 24 24"\n >\n <g clip-path="url(#clip0_1013_1585)">\n <path\n d="M14.06 9.02L14.98 9.94L5.92 19H5V18.08L14.06 9.02ZM17.66 3C17.41 3 17.15 3.1 16.96 3.29L15.13 5.12L18.88 8.87L20.71 7.04C21.1 6.65 21.1 6.02 20.71 5.63L18.37 3.29C18.17 3.09 17.92 3 17.66 3ZM14.06 6.19L3 17.25V21H6.75L17.81 9.94L14.06 6.19Z"\n />\n </g>\n <defs>\n <clipPath id="clip0_1013_1585">\n <rect width="24" height="24" />\n </clipPath>\n </defs>\n </svg>\n',fL='\n <svg\n xmlns="http://www.w3.org/2000/svg"\n width="24"\n height="24"\n viewBox="0 0 24 24"\n >\n <path\n fill="currentColor"\n d="M9 16l-5-5l5-5l1.4 1.4L7.825 10H18V6h2v6H7.825l2.575 2.6z"\n />\n </svg>\n',mL='\n <svg\n xmlns="http://www.w3.org/2000/svg"\n width="24"\n height="24"\n viewBox="0 0 24 24"\n >\n <g clip-path="url(#clip0_977_8075)">\n <path\n d="M19 5V19H5V5H19ZM19 3H5C3.9 3 3 3.9 3 5V19C3 20.1 3.9 21 5 21H19C20.1 21 21 20.1 21 19V5C21 3.9 20.1 3 19 3ZM14.14 11.86L11.14 15.73L9 13.14L6 17H18L14.14 11.86Z"\n />\n </g>\n <defs>\n <clipPath id="clip0_977_8075">\n <rect width="24" height="24" />\n </clipPath>\n </defs>\n </svg>\n',gL='\n <svg\n xmlns="http://www.w3.org/2000/svg"\n width="24"\n height="24"\n viewBox="0 0 24 24"\n >\n <path\n d="M6.29811 18.625C6.04505 18.625 5.83115 18.5375 5.65641 18.3626C5.48166 18.1877 5.39429 17.9736 5.39429 17.7203C5.39429 17.467 5.48166 17.2532 5.65641 17.0788C5.83115 16.9045 6.04505 16.8173 6.29811 16.8173H9.21159L12.452 7.18265H9.53851C9.28545 7.18265 9.07155 7.0952 8.89681 6.9203C8.72206 6.7454 8.63469 6.5313 8.63469 6.278C8.63469 6.02472 8.72206 5.81089 8.89681 5.63652C9.07155 5.46217 9.28545 5.375 9.53851 5.375H16.8847C17.1377 5.375 17.3516 5.46245 17.5264 5.63735C17.7011 5.81225 17.7885 6.02634 17.7885 6.27962C17.7885 6.53293 17.7011 6.74676 17.5264 6.92113C17.3516 7.09548 17.1377 7.18265 16.8847 7.18265H14.2789L11.0385 16.8173H13.6443C13.8973 16.8173 14.1112 16.9048 14.286 17.0797C14.4607 17.2546 14.5481 17.4687 14.5481 17.722C14.5481 17.9752 14.4607 18.1891 14.286 18.3634C14.1112 18.5378 13.8973 18.625 13.6443 18.625H6.29811Z"\n />\n </svg>\n',vL='\n <svg\n xmlns="http://www.w3.org/2000/svg"\n width="24"\n height="24"\n viewBox="0 0 24 24"\n >\n <path\n d="M17.0385 19.5003V16.5388H14.0769V15.0388H17.0385V12.0773H18.5384V15.0388H21.5V16.5388H18.5384V19.5003H17.0385ZM10.8077 16.5388H7.03845C5.78282 16.5388 4.7125 16.0963 3.8275 15.2114C2.9425 14.3266 2.5 13.2564 2.5 12.0009C2.5 10.7454 2.9425 9.67504 3.8275 8.78979C4.7125 7.90454 5.78282 7.46191 7.03845 7.46191H10.8077V8.96186H7.03845C6.1987 8.96186 5.48235 9.25834 4.8894 9.85129C4.29645 10.4442 3.99998 11.1606 3.99998 12.0003C3.99998 12.8401 4.29645 13.5564 4.8894 14.1494C5.48235 14.7423 6.1987 15.0388 7.03845 15.0388H10.8077V16.5388ZM8.25 12.7503V11.2504H15.75V12.7503H8.25ZM21.5 12.0003H20C20 11.1606 19.7035 10.4442 19.1106 9.85129C18.5176 9.25834 17.8013 8.96186 16.9615 8.96186H13.1923V7.46191H16.9615C18.2171 7.46191 19.2875 7.90441 20.1725 8.78939C21.0575 9.67439 21.5 10.7447 21.5 12.0003Z"\n />\n </svg>\n',yL='\n <svg\n xmlns="http://www.w3.org/2000/svg"\n width="24"\n height="24"\n viewBox="0 0 24 24"\n >\n <g clip-path="url(#clip0_977_8067)">\n <path\n d="M8 7H20C20.55 7 21 6.55 21 6C21 5.45 20.55 5 20 5H8C7.45 5 7 5.45 7 6C7 6.55 7.45 7 8 7ZM20 17H8C7.45 17 7 17.45 7 18C7 18.55 7.45 19 8 19H20C20.55 19 21 18.55 21 18C21 17.45 20.55 17 20 17ZM20 11H8C7.45 11 7 11.45 7 12C7 12.55 7.45 13 8 13H20C20.55 13 21 12.55 21 12C21 11.45 20.55 11 20 11ZM4.5 16H2.5C2.22 16 2 16.22 2 16.5C2 16.78 2.22 17 2.5 17H4V17.5H3.5C3.22 17.5 3 17.72 3 18C3 18.28 3.22 18.5 3.5 18.5H4V19H2.5C2.22 19 2 19.22 2 19.5C2 19.78 2.22 20 2.5 20H4.5C4.78 20 5 19.78 5 19.5V16.5C5 16.22 4.78 16 4.5 16ZM2.5 5H3V7.5C3 7.78 3.22 8 3.5 8C3.78 8 4 7.78 4 7.5V4.5C4 4.22 3.78 4 3.5 4H2.5C2.22 4 2 4.22 2 4.5C2 4.78 2.22 5 2.5 5ZM4.5 10H2.5C2.22 10 2 10.22 2 10.5C2 10.78 2.22 11 2.5 11H3.8L2.12 12.96C2.04 13.05 2 13.17 2 13.28V13.5C2 13.78 2.22 14 2.5 14H4.5C4.78 14 5 13.78 5 13.5C5 13.22 4.78 13 4.5 13H3.2L4.88 11.04C4.96 10.95 5 10.83 5 10.72V10.5C5 10.22 4.78 10 4.5 10Z"\n />\n </g>\n <defs>\n <clipPath id="clip0_977_8067">\n <rect width="24" height="24" />\n </clipPath>\n </defs>\n </svg>\n',wL='\n <svg\n xmlns="http://www.w3.org/2000/svg"\n width="24"\n height="24"\n viewBox="0 0 24 24"\n >\n <g clip-path="url(#clip0_971_7676)">\n <path\n d="M18 13H13V18C13 18.55 12.55 19 12 19C11.45 19 11 18.55 11 18V13H6C5.45 13 5 12.55 5 12C5 11.45 5.45 11 6 11H11V6C11 5.45 11.45 5 12 5C12.55 5 13 5.45 13 6V11H18C18.55 11 19 11.45 19 12C19 12.55 18.55 13 18 13Z"\n />\n </g>\n <defs>\n <clipPath id="clip0_971_7676">\n <rect width="24" height="24" />\n </clipPath>\n </defs>\n </svg>\n',bL='\n <svg\n xmlns="http://www.w3.org/2000/svg"\n width="24"\n height="24"\n viewBox="0 0 24 24"\n >\n <g clip-path="url(#clip0_977_7897)">\n <path\n d="M7.17 17C7.68 17 8.15 16.71 8.37 16.26L9.79 13.42C9.93 13.14 10 12.84 10 12.53V8C10 7.45 9.55 7 9 7H5C4.45 7 4 7.45 4 8V12C4 12.55 4.45 13 5 13H7L5.97 15.06C5.52 15.95 6.17 17 7.17 17ZM17.17 17C17.68 17 18.15 16.71 18.37 16.26L19.79 13.42C19.93 13.14 20 12.84 20 12.53V8C20 7.45 19.55 7 19 7H15C14.45 7 14 7.45 14 8V12C14 12.55 14.45 13 15 13H17L15.97 15.06C15.52 15.95 16.17 17 17.17 17Z"\n />\n </g>\n <defs>\n <clipPath id="clip0_977_7897">\n <rect width="24" height="24" />\n </clipPath>\n </defs>\n </svg>\n',xL='\n <svg\n xmlns="http://www.w3.org/2000/svg"\n width="24"\n height="24"\n viewBox="0 0 24 24"\n >\n <path\n d="M7.30775 20.4997C6.81058 20.4997 6.385 20.3227 6.031 19.9687C5.677 19.6147 5.5 19.1892 5.5 18.692V5.99973H5.25C5.0375 5.99973 4.85942 5.92782 4.71575 5.78398C4.57192 5.64015 4.5 5.46198 4.5 5.24948C4.5 5.03682 4.57192 4.85873 4.71575 4.71523C4.85942 4.57157 5.0375 4.49973 5.25 4.49973H9C9 4.2549 9.08625 4.04624 9.25875 3.87374C9.43108 3.7014 9.63967 3.61523 9.8845 3.61523H14.1155C14.3603 3.61523 14.5689 3.7014 14.7413 3.87374C14.9138 4.04624 15 4.2549 15 4.49973H18.75C18.9625 4.49973 19.1406 4.57165 19.2843 4.71548C19.4281 4.85932 19.5 5.03748 19.5 5.24998C19.5 5.46265 19.4281 5.64073 19.2843 5.78423C19.1406 5.9279 18.9625 5.99973 18.75 5.99973H18.5V18.692C18.5 19.1892 18.323 19.6147 17.969 19.9687C17.615 20.3227 17.1894 20.4997 16.6923 20.4997H7.30775ZM17 5.99973H7V18.692C7 18.7818 7.02883 18.8556 7.0865 18.9132C7.14417 18.9709 7.21792 18.9997 7.30775 18.9997H16.6923C16.7821 18.9997 16.8558 18.9709 16.9135 18.9132C16.9712 18.8556 17 18.7818 17 18.692V5.99973ZM10.1543 16.9997C10.3668 16.9997 10.5448 16.9279 10.6885 16.7842C10.832 16.6404 10.9037 16.4622 10.9037 16.2497V8.74973C10.9037 8.53723 10.8318 8.35907 10.688 8.21523C10.5443 8.07157 10.3662 7.99973 10.1535 7.99973C9.941 7.99973 9.76292 8.07157 9.61925 8.21523C9.47575 8.35907 9.404 8.53723 9.404 8.74973V16.2497C9.404 16.4622 9.47583 16.6404 9.6195 16.7842C9.76333 16.9279 9.94158 16.9997 10.1543 16.9997ZM13.8465 16.9997C14.059 16.9997 14.2371 16.9279 14.3807 16.7842C14.5243 16.6404 14.596 16.4622 14.596 16.2497V8.74973C14.596 8.53723 14.5242 8.35907 14.3805 8.21523C14.2367 8.07157 14.0584 7.99973 13.8458 7.99973C13.6333 7.99973 13.4552 8.07157 13.3115 8.21523C13.168 8.35907 13.0962 8.53723 13.0962 8.74973V16.2497C13.0962 16.4622 13.1682 16.6404 13.312 16.7842C13.4557 16.9279 13.6338 16.9997 13.8465 16.9997Z"\n />\n </svg>\n',kL='\n <svg\n xmlns="http://www.w3.org/2000/svg"\n fill="none"\n viewBox="0 0 24 24"\n stroke-width="1.5"\n stroke="currentColor"\n class="w-6 h-6"\n >\n <path\n stroke-linecap="round"\n stroke-linejoin="round"\n d="M21 21l-5.197-5.197m0 0A7.5 7.5 0 105.196 5.196a7.5 7.5 0 0010.607 10.607z"\n />\n </svg>\n',CL='\n <svg\n xmlns="http://www.w3.org/2000/svg"\n width="24"\n height="24"\n viewBox="0 0 24 24"\n >\n <path\n d="M3.25 13.7404C3.0375 13.7404 2.85938 13.6684 2.71563 13.5246C2.57188 13.3808 2.5 13.2026 2.5 12.99C2.5 12.7774 2.57188 12.5993 2.71563 12.4558C2.85938 12.3122 3.0375 12.2404 3.25 12.2404H20.75C20.9625 12.2404 21.1406 12.3123 21.2843 12.4561C21.4281 12.5999 21.5 12.7781 21.5 12.9907C21.5 13.2033 21.4281 13.3814 21.2843 13.525C21.1406 13.6686 20.9625 13.7404 20.75 13.7404H3.25ZM10.9423 10.2596V6.62495H6.5673C6.2735 6.62495 6.02377 6.52201 5.8181 6.31613C5.61245 6.11026 5.50963 5.86027 5.50963 5.56615C5.50963 5.27205 5.61245 5.02083 5.8181 4.8125C6.02377 4.60417 6.2735 4.5 6.5673 4.5H17.4423C17.7361 4.5 17.9858 4.60294 18.1915 4.80883C18.3971 5.01471 18.5 5.2647 18.5 5.5588C18.5 5.85292 18.3971 6.10413 18.1915 6.31245C17.9858 6.52078 17.7361 6.62495 17.4423 6.62495H13.0673V10.2596H10.9423ZM10.9423 15.7211H13.0673V18.4423C13.0673 18.7361 12.9643 18.9858 12.7584 19.1915C12.5526 19.3971 12.3026 19.5 12.0085 19.5C11.7144 19.5 11.4631 19.3962 11.2548 19.1887C11.0465 18.9811 10.9423 18.7291 10.9423 18.4327V15.7211Z"\n />\n </svg>\n',SL='\n <svg\n xmlns="http://www.w3.org/2000/svg"\n width="24"\n height="24"\n viewBox="0 0 24 24"\n >\n <g clip-path="url(#clip0_977_8078)">\n <path\n d="M20 3H5C3.9 3 3 3.9 3 5V19C3 20.1 3.9 21 5 21H20C21.1 21 22 20.1 22 19V5C22 3.9 21.1 3 20 3ZM20 5V8H5V5H20ZM15 19H10V10H15V19ZM5 10H8V19H5V10ZM17 19V10H20V19H17Z"\n />\n </g>\n <defs>\n <clipPath id="clip0_977_8078">\n <rect width="24" height="24" />\n </clipPath>\n </defs>\n </svg>\n',ML='\n <svg\n xmlns="http://www.w3.org/2000/svg"\n width="24"\n height="24"\n viewBox="0 0 24 24"\n >\n <path\n d="M5.66936 16.3389L9.39244 12.6158C9.54115 12.4671 9.71679 12.3937 9.91936 12.3957C10.1219 12.3976 10.2975 12.4761 10.4463 12.6312C10.5847 12.7823 10.654 12.9585 10.654 13.1599C10.654 13.3613 10.5847 13.5363 10.4463 13.6851L6.32704 17.8197C6.14627 18.0004 5.93538 18.0908 5.69436 18.0908C5.45333 18.0908 5.24243 18.0004 5.06166 17.8197L3.01744 15.7754C2.87899 15.637 2.81136 15.4629 2.81456 15.2533C2.81776 15.0437 2.88859 14.8697 3.02706 14.7312C3.16551 14.5928 3.34008 14.5235 3.55076 14.5235C3.76144 14.5235 3.93494 14.5928 4.07126 14.7312L5.66936 16.3389ZM5.66936 8.72359L9.39244 5.00049C9.54115 4.85177 9.71679 4.77838 9.91936 4.78031C10.1219 4.78223 10.2975 4.86075 10.4463 5.01586C10.5847 5.16691 10.654 5.34314 10.654 5.54454C10.654 5.74592 10.5847 5.92097 10.4463 6.06969L6.32704 10.2043C6.14627 10.3851 5.93538 10.4755 5.69436 10.4755C5.45333 10.4755 5.24243 10.3851 5.06166 10.2043L3.01744 8.16009C2.87899 8.02162 2.81136 7.84759 2.81456 7.63799C2.81776 7.42837 2.88859 7.25433 3.02706 7.11586C3.16551 6.97741 3.34008 6.90819 3.55076 6.90819C3.76144 6.90819 3.93494 6.97741 4.07126 7.11586L5.66936 8.72359ZM13.7597 16.5581C13.5472 16.5581 13.3691 16.4862 13.2253 16.3424C13.0816 16.1986 13.0097 16.0204 13.0097 15.8078C13.0097 15.5952 13.0816 15.4171 13.2253 15.2735C13.3691 15.13 13.5472 15.0582 13.7597 15.0582H20.7597C20.9722 15.0582 21.1503 15.1301 21.2941 15.2739C21.4378 15.4177 21.5097 15.5959 21.5097 15.8085C21.5097 16.0211 21.4378 16.1992 21.2941 16.3427C21.1503 16.4863 20.9722 16.5581 20.7597 16.5581H13.7597ZM13.7597 8.94276C13.5472 8.94276 13.3691 8.87085 13.2253 8.72704C13.0816 8.58324 13.0097 8.40504 13.0097 8.19244C13.0097 7.97985 13.0816 7.80177 13.2253 7.65819C13.3691 7.5146 13.5472 7.44281 13.7597 7.44281H20.7597C20.9722 7.44281 21.1503 7.51471 21.2941 7.65851C21.4378 7.80233 21.5097 7.98053 21.5097 8.19311C21.5097 8.40571 21.4378 8.5838 21.2941 8.72739C21.1503 8.87097 20.9722 8.94276 20.7597 8.94276H13.7597Z"\n />\n </svg>\n',NL='\n <svg\n xmlns="http://www.w3.org/2000/svg"\n width="24"\n height="24"\n viewBox="0 0 24 24"\n >\n <path\n fill="currentColor"\n d="m12.9 16l-2.55-2.5l.05-.05q1.45-1.6 2.262-3.117T13.95 7H16V5h-6V3H8v2H2v2h9.1q-.5 1.2-1.225 2.387T8 11.7q-.6-.6-1.187-1.412T5.85 8.6H3.85q.5 1.4 1.3 2.7T6.95 13.7L2.85 17.75L4.25 19.15L8 15.4L10.55 17.95zM18.5 22h-2L21 10h2l4.5 12h-2l-1.05-3h-4.9zm1.6-5h3.6l-1.8-5.1z"\n />\n </svg>\n',EL='\n <svg\n xmlns="http://www.w3.org/2000/svg"\n width="32"\n height="32"\n viewBox="0 0 24 24"\n >\n <path\n fill="currentColor"\n d="M7 19v-.808L13.096 12L7 5.808V5h10v1.25H9.102L14.727 12l-5.625 5.77H17V19z"\n />\n </svg>\n',OL='\n <svg\n xmlns="http://www.w3.org/2000/svg"\n height="24px"\n viewBox="0 -960 960 960"\n width="24px"\n >\n <path\n d="m644-428-58-58q9-47-27-88t-93-32l-58-58q17-8 34.5-12t37.5-4q75 0 127.5 52.5T660-500q0 20-4 37.5T644-428Zm128 126-58-56q38-29 67.5-63.5T832-500q-50-101-143.5-160.5T480-720q-29 0-57 4t-55 12l-62-62q41-17 84-25.5t90-8.5q151 0 269 83.5T920-500q-23 59-60.5 109.5T772-302Zm20 246L624-222q-35 11-70.5 16.5T480-200q-151 0-269-83.5T40-500q21-53 53-98.5t73-81.5L56-792l56-56 736 736-56 56ZM222-624q-29 26-53 57t-41 67q50 101 143.5 160.5T480-280q20 0 39-2.5t39-5.5l-36-38q-11 3-21 4.5t-21 1.5q-75 0-127.5-52.5T300-500q0-11 1.5-21t4.5-21l-84-82Zm319 93Zm-151 75Z"\n />\n </svg>\n',AL={[tL.CodeMirror]:{theme:L,languages:jd,expandIcon:sL,searchIcon:kL,clearSearchIcon:aL,searchPlaceholder:"Search language",noResultText:"No result",previewToggleIcon:e=>e?pL:OL}},TL=Dt([],"FeaturesCtx"),DL=Dt({},"CrepeCtx");function IL(e){return e.use("FeaturesCtx")}function _L(e){return t=>{IL(t).update(t=>t.includes(e)?t:[...t,e])}}function RL(e,t){var n;const r=e.get(ac),o=e.get(Uc),{state:i}=r,s=o(i.doc);let a="";if(!i.selection.empty){const{from:e,to:t}=i.selection,r=i.doc.slice(e,t),{schema:s}=i.doc.type;let l=s.topNodeType.createAndFill(null,r.content);if(!l){const e=null==(n=s.nodes.paragraph)?void 0:n.createAndFill(null,r.content);e&&(l=s.topNodeType.createAndFill(null,e))}a=l?o(l):i.doc.textBetween(e,t)}return{document:s,selection:a,instruction:t}}const LL=Md({provider:void 0,buildContext:void 0,diffReviewOnEnd:!0,onError:e=>{console.error(`[milkdown/ai] [${e.code}]`,e)},aiIcon:void 0},"aiProviderConfig"),BL=Md({abortController:null,label:"",lastInstruction:"",lastLabel:void 0,lastFrom:-1,lastTo:-1,diffOwnedByAI:!1},"aiSession");function PL(e,t){const n=e.get(LL.key);try{n.onError(t)}catch(e){console.error("[milkdown/ai] onError handler failed:",e)}}function zL(e){const t=e.get(BL.key);e.set(BL.key,{...t,abortController:null,label:""})}async function jL(e,t,n,r){try{const o=t(n,r.signal),i=e.get(Ac);for await(const e of o){if(r.signal.aborted)break;i.call(Dk.key,e)}if(r.signal.aborted)return;const s=e.get(LL.key);if(s.diffReviewOnEnd){const t=e.get(BL.key);e.set(BL.key,{...t,diffOwnedByAI:!0})}const a=i.call(Ik.key,{diffReview:s.diffReviewOnEnd});if(s.diffReviewOnEnd&&!a){const t=e.get(BL.key);e.set(BL.key,{...t,diffOwnedByAI:!1})}}catch(t){if(r.signal.aborted)return;PL(e,function(e){const t=e instanceof Error?e.message:Et(e);return new wt(yt.aiProviderError,`AI provider error: ${t}`,{cause:e})}(t));e.get(Ac).call(_k.key,{keep:!1})}finally{e.get(BL.key).abortController===r&&zL(e)}}const VL=yd("RunAI",e=>t=>(n,r)=>{var o,i,s,a;if(!(null==t?void 0:t.instruction))return!1;const l=e.get(LL.key);if(!l.provider)return!1;if(e.get(BL.key).abortController)return!1;if(null==(o=Ok.getState(n))?void 0:o.active)return!1;if(null==(i=Tx.getState(n))?void 0:i.active)return!1;if(!r)return!0;const c=new AbortController,{from:d,to:u}=n.selection;e.set(BL.key,{abortController:c,label:null!=(s=t.label)?s:"",lastInstruction:t.instruction,lastLabel:t.label,lastFrom:d,lastTo:u,diffOwnedByAI:!1});const h=e.get(Ac),p=n.selection.empty?"cursor":"selection";if(!h.call(Tk.key,{insertAt:p}))return zL(e),!1;let f;try{f=(null!=(a=l.buildContext)?a:RL)(e,t.instruction)}catch(t){const n=function(e){const t=e instanceof Error?e.message:Et(e);return new wt(yt.aiBuildContextError,`AI buildContext failed: ${t}`,{cause:e})}(t);return PL(e,n),h.call(_k.key,{keep:!1}),zL(e),!1}return jL(e,l.provider,f,c),!0}),$L=yd("AbortAI",e=>t=>(n,r)=>{var o;const i=e.get(BL.key);if(!r)return!!i.abortController;if(!i.abortController)return!1;if(i.abortController.abort(),zL(e),null==(o=Ok.getState(n))?void 0:o.active){e.get(Ac).call(_k.key,t)}return!0});var HL,qL,FL,WL,UL,GL,KL,JL,ZL,YL,XL,QL,eB,tB,nB,rB,oB=e=>{throw TypeError(e)},iB=(e,t,n)=>t.has(e)||oB("Cannot "+n),sB=(e,t,n)=>(iB(e,t,"read from private field"),n?n.call(e):t.get(e)),aB=(e,t,n)=>t.has(e)?oB("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),lB=(e,t,n,r)=>(iB(e,t,"write to private field"),t.set(e,n),n),cB=(e,t,n)=>(iB(e,t,"access private method"),n);const dB="milkdown-ai-diff-actions";function uB(e,t){e.innerHTML=Re.sanitize(t.trim())}class hB{constructor(e,t,n){this.ctx=e,aB(this,ZL),aB(this,HL),aB(this,qL),aB(this,FL),aB(this,WL),aB(this,UL,!1),aB(this,GL,!1),aB(this,KL,null),aB(this,JL,!1),aB(this,eB,()=>{const e=this.ctx.get(BL.key);if(!e.lastInstruction)return;if(!sB(this,JL)||!cB(this,ZL,tB).call(this))return;const t=this.ctx.get(Ac);t.call(Vx.key);const n=this.ctx.get(ac),{doc:r}=n.state,o=Math.min(Math.max(e.lastFrom,0),r.content.size),i=Math.min(Math.max(e.lastTo,0),r.content.size);n.dispatch(n.state.tr.setSelection(Fr.create(n.state.doc,o,i))),t.call(VL.key,{instruction:e.lastInstruction,label:e.lastLabel})}),aB(this,nB,()=>{this.ctx.get(Ac).call(Vx.key)}),aB(this,rB,()=>{this.ctx.get(Ac).call(jx.key)}),lB(this,WL,n),lB(this,qL,cB(this,ZL,YL).call(this,t));const r=document.createElement("div");r.className=dB,r.dataset.show="false",lB(this,FL,cB(this,ZL,XL).call(this,"retry",n.retryIcon,n.retryLabel,sB(this,eB))),r.appendChild(sB(this,FL)),r.appendChild(cB(this,ZL,XL).call(this,"reject",n.rejectIcon,n.rejectAllLabel,sB(this,nB)));const o=cB(this,ZL,XL).call(this,"accept",n.acceptIcon,n.acceptAllLabel,sB(this,rB));o.appendChild(cB(this,ZL,QL).call(this)),r.appendChild(o),lB(this,HL,r),sB(this,qL).appendChild(r),this.update(t)}update(e){var t;const n=!!(null==(t=Tx.getState(e.state))?void 0:t.active);if(n!==sB(this,GL))if(lB(this,GL,n),n){const t=this.ctx.get(BL.key);lB(this,JL,t.diffOwnedByAI),lB(this,KL,e.state.doc)}else{lB(this,JL,!1),lB(this,KL,null);const e=this.ctx.get(BL.key);e.diffOwnedByAI&&this.ctx.set(BL.key,{...e,diffOwnedByAI:!1})}const r=n&&sB(this,JL);if(r!==sB(this,UL)&&(lB(this,UL,r),sB(this,HL).dataset.show=r?"true":"false"),r){const t=this.ctx.get(BL.key),n=!!sB(this,KL)&&e.state.doc.eq(sB(this,KL));sB(this,FL).disabled=!t.lastInstruction||!n}}destroy(){sB(this,HL).remove()}}HL=new WeakMap,qL=new WeakMap,FL=new WeakMap,WL=new WeakMap,UL=new WeakMap,GL=new WeakMap,KL=new WeakMap,JL=new WeakMap,ZL=new WeakSet,YL=function(e){var t;return null!=(t=e.dom.closest(".milkdown"))?t:document.body},XL=function(e,t,n,r){const o=document.createElement("button");o.type="button",o.className=`${dB}-btn ${dB}-btn-${e}`,o.appendChild(function(e){const t=document.createElement("span");return t.className=`${dB}-icon`,uB(t,e),t}(t));const i=document.createElement("span");return i.textContent=n,o.appendChild(i),o.addEventListener("mousedown",e=>e.preventDefault()),o.addEventListener("click",e=>{e.preventDefault(),e.stopPropagation(),r()}),o},QL=function(){const e=document.createElement("span");e.className=`${dB}-shortcut`;const t=document.createElement("span");t.textContent=sB(this,WL).modSymbol;const n=document.createElement("span");return n.className=`${dB}-shortcut-icon`,uB(n,sB(this,WL).enterKeyIcon),e.append(t,n),e},eB=new WeakMap,tB=function(){if(!sB(this,KL))return!1;return this.ctx.get(ac).state.doc.eq(sB(this,KL))},nB=new WeakMap,rB=new WeakMap;const pB=new lo("CREPE_AI_DIFF_ACTIONS_PANEL");const fB=function(){var e,t,n,r;if("undefined"==typeof navigator)return"⌘";const o=navigator,i=null!=(r=null!=(n=null!=(t=null==(e=o.userAgentData)?void 0:e.platform)?t:o.platform)?n:o.userAgent)?r:"";return/mac|iphone|ipad|ipod/i.test(i)?"⌘":"Ctrl"}();function mB(e={}){const t=function(e){var t,n,r,o,i,s,a;const{config:l,enterKeyIcon:c}=e;return{retryLabel:null!=(t=null==l?void 0:l.retryLabel)?t:"Retry",rejectAllLabel:null!=(n=null==l?void 0:l.rejectAllLabel)?n:"Reject all",acceptAllLabel:null!=(r=null==l?void 0:l.acceptAllLabel)?r:"Accept all",retryIcon:null!=(o=null==l?void 0:l.retryIcon)?o:'\n <svg\n xmlns="http://www.w3.org/2000/svg"\n width="24"\n height="24"\n viewBox="0 0 24 24"\n >\n <path\n fill="currentColor"\n d="M12 20q-3.35 0-5.675-2.325T4 12q0-3.35 2.325-5.675T12 4q1.725 0 3.3.713T18 6.75V4h2v7h-7V9h4.2q-.8-1.4-2.187-2.2T12 6Q9.5 6 7.75 7.75T6 12q0 2.5 1.75 4.25T12 18q1.925 0 3.475-1.1T17.65 14h2.1q-.7 2.65-2.85 4.325T12 20"\n />\n </svg>\n',rejectIcon:null!=(i=null==l?void 0:l.rejectIcon)?i:aL,acceptIcon:null!=(s=null==l?void 0:l.acceptIcon)?s:cL,enterKeyIcon:null!=c?c:fL,modSymbol:null!=(a=null==l?void 0:l.modSymbol)?a:fB}}(e);return kd(e=>new io({key:pB,view:n=>new hB(e,n,t),props:{handleKeyDown(t,n){var r;if("Enter"!==n.key)return!1;if(!n.metaKey&&!n.ctrlKey)return!1;if(!(null==(r=Tx.getState(t.state))?void 0:r.active))return!1;if(!e.get(BL.key).diffOwnedByAI)return!1;n.preventDefault();return e.get(Ac).call(jx.key),!0}}}))}var gB,vB,yB=e=>{throw TypeError(e)},wB=(e,t,n)=>t.has(e)||yB("Cannot "+n),bB=(e,t,n)=>(wB(e,t,"read from private field"),n?n.call(e):t.get(e)),xB=(e,t,n)=>t.has(e)?yB("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),kB=(e,t,n,r)=>(wB(e,t,"write to private field"),t.set(e,n),n);function CB(e){const t={addItem:(n,r)=>(e.items.set(n,r),t),removeItem:n=>(e.items.delete(n),t),getItem:t=>e.items.get(t),clear:()=>(e.items.clear(),t)};return t}class SB{constructor(){xB(this,gB,[]),this.addItem=(e,t)=>(bB(this,vB).call(this,e),bB(this,gB).push({kind:"item",id:e,item:t}),this),this.addSubmenu=(e,t,n)=>{bB(this,vB).call(this,e);const r={def:t,items:new Map};return n&&n(CB(r)),bB(this,gB).push({kind:"submenu",id:e,node:r}),this},this.removeItem=e=>(bB(this,vB).call(this,e),this),this.getItem=e=>{const t=bB(this,gB).find(t=>"item"===t.kind&&t.id===e);return"item"===(null==t?void 0:t.kind)?t.item:void 0},this.getSubmenu=e=>{const t=bB(this,gB).find(t=>"submenu"===t.kind&&t.id===e);return"submenu"===(null==t?void 0:t.kind)?CB(t.node):void 0},this.clear=()=>(kB(this,gB,[]),this),this.build=()=>{const e=[],t={};for(const n of bB(this,gB))"item"===n.kind?e.push({kind:"item",id:n.id,item:n.item}):(e.push({kind:"submenu",id:n.id,def:n.node.def}),t[n.id]={def:n.node.def,items:Array.from(n.node.items.entries()).map(([e,t])=>({id:e,item:t}))});return{main:e,submenus:t}},xB(this,vB,e=>{kB(this,gB,bB(this,gB).filter(t=>t.id!==e))})}}gB=new WeakMap,vB=new WeakMap;const MB=mv({props:{placeholder:{type:Object,required:!0},resetSignal:{type:Object,required:!0},suggestions:{type:Object,required:!0},chrome:{type:Object,required:!0},onConfirm:{type:Function,required:!0},onCancel:{type:Function,required:!0}},setup({placeholder:e,resetSignal:t,suggestions:n,chrome:r,onConfirm:o,onCancel:i}){const s=Wm(""),a=Wm({kind:"main"}),l=Wm(0),c=Wm(null),d=Wm(null),u=`ai-instruction-list-${Math.random().toString(36).slice(2,9)}`,h=e=>`${u}-opt-${e}`,p=`ai-instruction-input-${Math.random().toString(36).slice(2,9)}`;iv(t,()=>{s.value="",a.value={kind:"main"},l.value=0});const f=Zw(()=>{if("submenu"===a.value.kind){const e=n.submenus[a.value.id];return e?e.items.map(({id:e,item:t})=>({id:e,icon:t.icon,label:t.label,hasSubmenu:!1,prompt:{text:t.prompt,streamingLabel:t.streamingLabel}})):[]}return n.main.map(e=>"item"===e.kind?{id:e.id,icon:e.item.icon,label:e.item.label,hasSubmenu:!1,prompt:{text:e.item.prompt,streamingLabel:e.item.streamingLabel}}:{id:e.id,icon:e.def.icon,label:e.def.label,hasSubmenu:!0})}),m=Zw(()=>{var e,t;return"submenu"!==a.value.kind?null:null!=(t=null==(e=n.submenus[a.value.id])?void 0:e.def)?t:null}),g=Zw(()=>{const e=s.value.trim().toLowerCase();return e?f.value.filter(t=>t.label.toLowerCase().includes(e)):f.value}),v=Zw(()=>s.value.trim().length>0),y=Zw(()=>g.value.length+(v.value?1:0));iv([g,a,v],()=>{l.value=v.value?g.value.length:0});const w=()=>{xg(()=>{var e;return null==(e=c.value)?void 0:e.focus()})},b=()=>{a.value={kind:"main"},s.value="",l.value=0,w()},x=e=>{e.hasSubmenu?(e=>{a.value={kind:"submenu",id:e},s.value="",l.value=0,w()})(e.id):e.prompt&&(o(e.prompt.text,e.prompt.streamingLabel),s.value="")},k=()=>{const e=s.value.trim();e&&(o(e),s.value="")},C=()=>{xg(()=>{const e=d.value;if(!e)return;const t=e.querySelector(`[data-index="${l.value}"]`);null==t||t.scrollIntoView({block:"nearest"})})},S=e=>{if(e.stopPropagation(),"ArrowDown"===e.key){if(e.preventDefault(),0===y.value)return;return l.value=(l.value+1)%y.value,void C()}if("ArrowUp"===e.key){if(e.preventDefault(),0===y.value)return;return l.value=(l.value-1+y.value)%y.value,void C()}return"Enter"===e.key?(e.preventDefault(),void(()=>{const e=l.value,t=g.value;e<t.length?x(t[e]):v.value&&k()})()):"Escape"===e.key?(e.preventDefault(),void("submenu"===a.value.kind?b():i())):void("Backspace"===e.key&&""===s.value&&"submenu"===a.value.kind&&(e.preventDefault(),b()))},M=e=>{e.preventDefault()};return()=>{const t=g.value,n=v.value,o=m.value;return Yw("div",{class:"ai-instruction"},Yw("div",{class:"ai-instruction-input"},Yw("span",{class:"ai-instruction-input-prefix"},Yw(Pk,{icon:r.aiIcon})),Yw("input",{ref:c,id:p,class:"ai-instruction-input-field",role:"combobox","aria-expanded":"true","aria-autocomplete":"list","aria-controls":u,"aria-activedescendant":y.value>0?h(l.value):void 0,placeholder:o?o.searchPlaceholder:e.value,value:s.value,onInput:e=>{s.value=e.target.value},onKeydown:S}),Yw("button",{type:"button",class:"ai-instruction-submit","aria-label":r.submitButtonLabel,disabled:!n,onMousedown:M,onClick:k},Yw(Pk,{icon:r.sendIcon}))),Yw("div",{class:"ai-instruction-list",ref:d,id:u,role:"listbox","aria-label":r.listboxLabel},o&&Yw("button",{type:"button",class:"ai-instruction-back",onMousedown:M,onClick:b},Yw("span",{class:"ai-instruction-back-icon","aria-hidden":"true"},Yw(Pk,{icon:r.chevronLeftIcon})),Yw("span",null,o.title)),t.length>0&&Yw("div",{class:"ai-instruction-section"},Yw("div",{class:"ai-instruction-section-header"},r.suggestionsHeaderLabel),t.map((e,t)=>Yw("div",{key:e.id,id:h(t),"data-index":t,role:"option","aria-selected":t===l.value,class:["ai-instruction-item",t===l.value?"active":""],onMousedown:M,onClick:()=>x(e),onPointerenter:()=>{l.value=t}},Yw("span",{class:"ai-instruction-item-icon"},Yw(Pk,{icon:e.icon})),Yw("span",{class:"ai-instruction-item-label"},function(e,t){const n=t.trim();if(!n)return[e];const r=e.toLowerCase(),o=n.toLowerCase(),i=r.indexOf(o);return-1===i?[e]:[e.slice(0,i),Yw("mark",null,e.slice(i,i+n.length)),e.slice(i+n.length)]}(e.label,s.value)),e.hasSubmenu&&Yw("span",{class:"ai-instruction-item-arrow"},Yw(Pk,{icon:r.chevronRightIcon}))))),n&&Yw("div",{class:"ai-instruction-section"},Yw("div",{class:"ai-instruction-section-header"},r.sendAsPromptHeaderLabel),Yw("div",{id:h(t.length),"data-index":t.length,role:"option","aria-selected":l.value===t.length,class:["ai-instruction-item","ai-instruction-item-prompt",l.value===t.length?"active":""],onMousedown:M,onClick:k,onPointerenter:()=>{l.value=t.length}},Yw("span",{class:"ai-instruction-item-icon"},Yw(Pk,{icon:r.sendPromptIcon})),Yw("span",{class:"ai-instruction-item-label"},r.sendAsPromptLabel," ",Yw("span",{class:"ai-instruction-item-quote"},'"',s.value,'"')),Yw("span",{class:"ai-instruction-item-shortcut"},Yw(Pk,{icon:r.enterKeyIcon}))))))}}});var NB,EB,OB,AB,TB,DB,IB,_B,RB,LB,BB=e=>{throw TypeError(e)},PB=(e,t,n)=>t.has(e)||BB("Cannot "+n),zB=(e,t,n)=>(PB(e,t,"read from private field"),n?n.call(e):t.get(e)),jB=(e,t,n)=>t.has(e)?BB("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),VB=(e,t,n,r)=>(PB(e,t,"write to private field"),t.set(e,n),n);class $B{constructor(e,t,n){this.ctx=e,jB(this,NB),jB(this,EB),jB(this,OB),jB(this,AB),jB(this,TB),jB(this,DB,-1),jB(this,IB,-1),jB(this,_B,!1),jB(this,RB,(e,t)=>{if(!e.trim())return;this.ctx.get(Ac).call(VL.key,{instruction:e,label:t})&&(VB(this,_B,!1),zB(this,EB).hide())}),jB(this,LB,()=>{VB(this,_B,!1),zB(this,EB).hide()}),this.show=(e,t)=>{VB(this,DB,e),VB(this,IB,t),zB(this,TB).value++,VB(this,_B,!0);const n=this.ctx.get(ac);zB(this,EB).show({getBoundingClientRect:()=>yi(n,e,t)},n),requestAnimationFrame(()=>{var e;null==(e=zB(this,NB).querySelector("input"))||e.focus()})},this.update=(e,t)=>{const{selection:n}=e.state,r=n instanceof Fr,o=n.from!==zB(this,DB)||n.to!==zB(this,IB);if(!r||o)return VB(this,_B,!1),void zB(this,EB).hide();zB(this,EB).update(e,t)},this.destroy=()=>{zB(this,OB).unmount(),zB(this,EB).destroy(),zB(this,NB).remove()},VB(this,AB,Wm(n.placeholder)),VB(this,TB,Wm(0));const r=document.createElement("div");r.className="milkdown-ai-instruction";const o=Db(MB,{placeholder:zB(this,AB),resetSignal:zB(this,TB),suggestions:n.suggestions,chrome:n.chrome,onConfirm:zB(this,RB),onCancel:zB(this,LB)});o.mount(r),VB(this,OB,o),VB(this,NB,r),VB(this,EB,new Lk({content:r,debounce:0,offset:10,shouldShow:()=>zB(this,_B),floatingUIOptions:{placement:"bottom"}})),zB(this,EB).onHide=()=>{VB(this,_B,!1),requestAnimationFrame(()=>{try{const e=zB(this,NB).getRootNode().activeElement;if(!e||!zB(this,NB).contains(e))return;this.ctx.get(ac).dom.focus({preventScroll:!0})}catch(e){}})},zB(this,EB).update(t)}}NB=new WeakMap,EB=new WeakMap,OB=new WeakMap,AB=new WeakMap,TB=new WeakMap,DB=new WeakMap,IB=new WeakMap,_B=new WeakMap,RB=new WeakMap,LB=new WeakMap;const HB=Md({show:()=>{}},"aiInstructionTooltipAPI"),qB=Bk("CREPE_AI_INSTRUCTION");function FB(e){var t,n,r,o,i,s,a,l,c,d,u;return{aiIcon:null!=(t=null==e?void 0:e.aiIcon)?t:rL,sendIcon:null!=(n=null==e?void 0:e.sendIcon)?n:'\n <svg\n xmlns="http://www.w3.org/2000/svg"\n width="24"\n height="24"\n viewBox="0 0 24 24"\n >\n <path\n fill="currentColor"\n d="M11 20V7.825l-5.6 5.6L4 12l8-8l8 8l-1.4 1.425l-5.6-5.6V20z"\n />\n </svg>\n',sendPromptIcon:null!=(r=null==e?void 0:e.sendPromptIcon)?r:'\n <svg\n xmlns="http://www.w3.org/2000/svg"\n width="24"\n height="24"\n viewBox="0 0 24 24"\n >\n <path\n fill="currentColor"\n d="M3 20v-6l8-2l-8-2V4l19 8z"\n />\n </svg>\n',enterKeyIcon:null!=(o=null==e?void 0:e.enterKeyIcon)?o:fL,chevronLeftIcon:null!=(i=null==e?void 0:e.chevronLeftIcon)?i:'\n <svg\n xmlns="http://www.w3.org/2000/svg"\n fill="none"\n viewBox="0 0 24 24"\n stroke-width="1.5"\n stroke="currentColor"\n >\n <path\n stroke-linecap="round"\n stroke-linejoin="round"\n d="M15.75 19.5L8.25 12l7.5-7.5"\n />\n </svg>\n',chevronRightIcon:null!=(s=null==e?void 0:e.chevronRightIcon)?s:'\n <svg\n xmlns="http://www.w3.org/2000/svg"\n fill="none"\n viewBox="0 0 24 24"\n stroke-width="1.5"\n stroke="currentColor"\n >\n <path\n stroke-linecap="round"\n stroke-linejoin="round"\n d="M8.25 4.5l7.5 7.5-7.5 7.5"\n />\n </svg>\n',suggestionsHeaderLabel:null!=(a=null==e?void 0:e.suggestionsHeaderLabel)?a:"SUGGESTIONS",sendAsPromptHeaderLabel:null!=(l=null==e?void 0:e.sendAsPromptHeaderLabel)?l:"SEND AS PROMPT",sendAsPromptLabel:null!=(c=null==e?void 0:e.sendAsPromptLabel)?c:"Ask AI:",submitButtonLabel:null!=(d=null==e?void 0:e.submitButtonLabel)?d:"Send prompt",listboxLabel:null!=(u=null==e?void 0:e.listboxLabel)?u:"AI suggestions"}}function WB(e){var t,n;const r=new SB;return function(e){e.addItem("improve",{icon:rL,label:"Improve writing",streamingLabel:"Improving writing",prompt:"Improve the writing while preserving the original meaning."}).addItem("grammar",{icon:'\n <svg\n xmlns="http://www.w3.org/2000/svg"\n width="24"\n height="24"\n viewBox="0 0 24 24"\n >\n <path\n fill="currentColor"\n d="M9.55 17.575L4.225 12.25l1.4-1.425L9.55 14.75l8.825-8.825l1.4 1.425z"\n />\n </svg>\n',label:"Fix grammar & spelling",streamingLabel:"Fixing grammar & spelling",prompt:"Fix any grammar and spelling errors without changing the meaning."}).addItem("shorter",{icon:'\n <svg\n xmlns="http://www.w3.org/2000/svg"\n width="24"\n height="24"\n viewBox="0 0 24 24"\n >\n <path\n fill="currentColor"\n d="M5 13v-2h14v2z"\n />\n </svg>\n',label:"Make shorter",streamingLabel:"Making shorter",prompt:"Make this shorter while preserving the key information."}).addItem("longer",{icon:'\n <svg\n xmlns="http://www.w3.org/2000/svg"\n width="24"\n height="24"\n viewBox="0 0 24 24"\n >\n <path\n fill="currentColor"\n d="M3 18v-2h13v2zm0-5v-2h18v2zm0-5V6h18v2zm15 13v-3h-3v-2h3v-3h2v3h3v2h-3v3z"\n />\n </svg>\n',label:"Make longer",streamingLabel:"Expanding",prompt:"Expand this with more detail and examples."}),e.addSubmenu("tone",{icon:pL,label:"Change tone…",title:"Change tone",searchPlaceholder:"Search tones…"},e=>{const t=[["professional","Professional"],["casual","Casual"],["confident","Confident"],["friendly","Friendly"],["direct","Direct"],["formal","Formal"]];for(const[n,r]of t)e.addItem(n,{icon:pL,label:r,streamingLabel:"Adjusting tone",prompt:`Rewrite this in a ${r.toLowerCase()} tone.`})}),e.addSubmenu("translate",{icon:NL,label:"Translate…",title:"Translate",searchPlaceholder:"Search languages…"},e=>{const t=[["english","English","English"],["chinese","Chinese","Chinese (Simplified)"],["japanese","Japanese","Japanese"],["korean","Korean","Korean"],["spanish","Spanish","Spanish"],["french","French","French"],["german","German","German"]];for(const[n,r,o]of t)e.addItem(n,{icon:NL,label:r,streamingLabel:`Translating to ${r}`,prompt:`Translate this to ${o}.`})})}(r),null==(t=null==e?void 0:e.buildAISuggestions)||t.call(e,r),{placeholder:null!=(n=null==e?void 0:e.instructionPlaceholder)?n:"Tell AI what to do with the selection…",chrome:FB(e),suggestions:r.build()}}var UB,GB,KB,JB,ZB,YB,XB,QB=e=>{throw TypeError(e)},eP=(e,t,n)=>t.has(e)||QB("Cannot "+n),tP=(e,t,n)=>(eP(e,t,"read from private field"),n?n.call(e):t.get(e)),nP=(e,t,n)=>t.has(e)?QB("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),rP=(e,t,n,r)=>(eP(e,t,"write to private field"),t.set(e,n),n);const oP="milkdown-ai-streaming",iP=new lo("CREPE_AI_STREAMING_INDICATOR");class sP{constructor(e,t,n){nP(this,UB),nP(this,GB),nP(this,KB),nP(this,JB,performance.now()),nP(this,ZB,""),nP(this,YB,0),nP(this,XB,()=>{const e=(performance.now()-tP(this,JB))/800*360;tP(this,UB).style.transform=`rotate(${e}deg)`,rP(this,YB,requestAnimationFrame(tP(this,XB)))}),rP(this,KB,t);const r=document.createElement("span");r.className=`${oP}-indicator`,r.contentEditable="false",r.setAttribute("role","status"),r.setAttribute("aria-live","polite");const o=document.createElement("span");o.className=`${oP}-spinner`,o.setAttribute("aria-hidden","true"),r.appendChild(o);const i=document.createElement("span");i.className=`${oP}-label`,r.appendChild(i);const s=document.createElement("span");s.className=`${oP}-esc`,s.textContent=n,r.appendChild(s),this.dom=r,rP(this,UB,o),rP(this,GB,i),this.setLabel(e),tP(this,XB).call(this)}setLabel(e){const t=`${e.get(BL.key).label||tP(this,KB)}…`;t!==tP(this,ZB)&&(rP(this,ZB,t),tP(this,GB).textContent=t)}destroy(){tP(this,YB)&&cancelAnimationFrame(tP(this,YB)),rP(this,YB,0)}}function aP(e={}){var t,n;const{config:r}=e,o=null!=(t=null==r?void 0:r.fallbackLabel)?t:"Generating",i=null!=(n=null==r?void 0:r.cancelHint)?n:"Esc to cancel";return kd(e=>{let t=null;function n(){t&&(t.destroy(),t=null)}function r(n,r){const s=Math.min(r,n.content.size),a=Nl.widget(s,(t?t.setLabel(e):t=new sP(e,o,i),t).dom,{side:1,key:"ai-streaming-indicator"});return Al.create(n,[a])}return new io({key:iP,state:{init:()=>Al.empty,apply(e,t,o,i){const s=Ok.getState(i);return(null==s?void 0:s.active)&&null!=s.insertEndPos?e.getMeta(Ok)||e.docChanged?r(i.doc,s.insertEndPos):t.map(e.mapping,e.doc):(n(),Al.empty)}},view:()=>({destroy(){n()}}),props:{decorations(e){var t;return null!=(t=iP.getState(e))?t:Al.empty},handleKeyDown(t,n){var r;if("Escape"!==n.key)return!1;const o=e.get(Ac);return e.get(BL.key).abortController?(n.preventDefault(),o.call($L.key,{keep:!0}),!0):!!(null==(r=Ok.getState(t.state))?void 0:r.active)&&(n.preventDefault(),o.call(_k.key,{keep:!0}),!0)}}})})}UB=new WeakMap,GB=new WeakMap,KB=new WeakMap,JB=new WeakMap,ZB=new WeakMap,YB=new WeakMap,XB=new WeakMap;const lP=["table","image-block","code_block"],cP={heading:["id"]},dP=(e,t)=>{var n,r;const o=null!=(n=null==t?void 0:t.diff)?n:{},i=null!=(r=null==t?void 0:t.streaming)?r:{};e.config(_L(tL.AI)).config(e=>{e.update(Ax.key,e=>{var t;return{...e,ignoreAttrs:null!=(t=o.ignoreAttrs)?t:cP}});const{ignoreAttrs:t,...n}=o;e.update(Zx.key,e=>{var t;return{...e,customBlockTypes:null!=(t=n.customBlockTypes)?t:lP,...n}})}).use($x).use(gk).config(e=>{e.update(yk.key,e=>{var n;return{...e,...i,ignoreAttrs:null!=(n=i.ignoreAttrs)?n:cP,...void 0!==(null==t?void 0:t.diffReviewOnEnd)?{diffReviewOnEnd:t.diffReviewOnEnd}:{}}})}).use(Rk).config(e=>{e.update(LL.key,e=>{var n;return{...e,...void 0!==(null==t?void 0:t.provider)?{provider:t.provider}:{},...void 0!==(null==t?void 0:t.buildContext)?{buildContext:t.buildContext}:{},diffReviewOnEnd:null!=(n=null==t?void 0:t.diffReviewOnEnd)?n:e.diffReviewOnEnd,...void 0!==(null==t?void 0:t.onError)?{onError:t.onError}:{},...void 0!==(null==t?void 0:t.aiIcon)?{aiIcon:t.aiIcon}:{}}})}).use(LL).use(BL).use(VL).use($L).config(function(e){return t=>{const n=WB(e);let r=null;t.update(HB.key,e=>({...e,show:(e,t)=>{null==r||r.show(e,t)}})),t.set(qB.key,{view:e=>(r=new $B(t,e,n),r)})}}(t)).use(HB).use(qB).use(aP({config:null==t?void 0:t.streamingIndicator})).use(mB({config:null==t?void 0:t.diffActions,enterKeyIcon:null==t?void 0:t.enterKeyIcon}))};function uP(e){return"code_block"===e.$from.parent.type.name}function hP(e){var t;const n=null==(t=e.$from.node(e.$from.depth-1))?void 0:t.type;return"list_item"===(null==n?void 0:n.name)}var pP,fP,mP=e=>{throw TypeError(e)},gP=(e,t,n)=>t.has(e)||mP("Cannot "+n),vP=(e,t,n)=>(gP(e,t,"read from private field"),n?n.call(e):t.get(e)),yP=(e,t,n)=>t.has(e)?mP("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n);class wP{constructor(){yP(this,pP,[]),this.clear=()=>{var e,t,n;return n=[],gP(e=this,t=pP,"write to private field"),t.set(e,n),this},yP(this,fP,e=>{const t={group:e,addItem:(n,r)=>{const o={...r,key:n};return e.items.push(o),t},clear:()=>(e.items=[],t)};return t}),this.addGroup=(e,t)=>{const n={key:e,label:t,items:[]};return vP(this,pP).push(n),vP(this,fP).call(this,n)},this.getGroup=e=>{const t=vP(this,pP).find(t=>t.key===e);if(!t)throw new Error(`Group with key ${e} not found`);return vP(this,fP).call(this,t)},this.build=()=>vP(this,pP)}}pP=new WeakMap,fP=new WeakMap;const bP=mv({props:{ctx:{type:Object,required:!0},show:{type:Object,required:!0},filter:{type:Object,required:!0},hide:{type:Function,required:!0},config:{type:Object,required:!1}},setup({ctx:e,show:t,filter:n,hide:r,config:o}){const i=Wm(),s=Zw(()=>function(e,t,n){var r,o,i,s,a,l,c,d,u,h,p,f,m,g,v,y,w,b,x,k,C,S,M,N,E,O,A,T,D,I,_,R,L,B,P,z,j,V,$,H,q,F,W,U,G,K,J,Z,Y,X,Q,ee,te,ne,re,oe,ie,se,ae,le,ce,de,ue,he,pe,fe,me,ge,ve,ye,we,be,xe,ke,Ce,Se,Me,Ne,Ee,Oe,Ae,Te,De,Ie,_e,Re,Le,Be,Pe,ze,je,Ve,$e,He,qe,Fe,We,Ue,Ge,Ke,Je,Ze,Ye,Xe,Qe,et,tt,nt,rt,ot,it,st,at,lt,ct,dt,ut,ht,pt;const ft=n&&IL(n).get(),mt=null==ft?void 0:ft.includes(tL.Latex),gt=null==ft?void 0:ft.includes(tL.ImageBlock),vt=null==ft?void 0:ft.includes(tL.Table),yt=new wP;if(null!==(null==t?void 0:t.textGroup)){const e=yt.addGroup("text",null!=(o=null==(r=null==t?void 0:t.textGroup)?void 0:r.label)?o:"Text");null!==(null==(i=null==t?void 0:t.textGroup)?void 0:i.text)&&e.addItem("text",{label:null!=(l=null==(a=null==(s=null==t?void 0:t.textGroup)?void 0:s.text)?void 0:a.label)?l:"Text",icon:null!=(u=null==(d=null==(c=null==t?void 0:t.textGroup)?void 0:c.text)?void 0:d.icon)?u:'\n <svg\n xmlns="http://www.w3.org/2000/svg"\n width="24"\n height="24"\n viewBox="0 0 24 24"\n >\n <g clip-path="url(#clip0_992_5547)">\n <path\n d="M5 5.5C5 6.33 5.67 7 6.5 7H10.5V17.5C10.5 18.33 11.17 19 12 19C12.83 19 13.5 18.33 13.5 17.5V7H17.5C18.33 7 19 6.33 19 5.5C19 4.67 18.33 4 17.5 4H6.5C5.67 4 5 4.67 5 5.5Z"\n />\n </g>\n <defs>\n <clipPath id="clip0_992_5547">\n <rect width="24" height="24" />\n </clipPath>\n </defs>\n </svg>\n',onRun:e=>{const t=e.get(Ac),n=Au.type(e);t.call(_h.key),t.call(Rh.key,{nodeType:n})}}),null!==(null==(h=null==t?void 0:t.textGroup)?void 0:h.h1)&&e.addItem("h1",{label:null!=(m=null==(f=null==(p=null==t?void 0:t.textGroup)?void 0:p.h1)?void 0:f.label)?m:"Heading 1",icon:null!=(y=null==(v=null==(g=null==t?void 0:t.textGroup)?void 0:g.h1)?void 0:v.icon)?y:'\n <svg\n xmlns="http://www.w3.org/2000/svg"\n width="24"\n height="24"\n viewBox="0 0 24 24"\n >\n <g clip-path="url(#clip0_992_5553)">\n <path\n d="M19 3H5C3.9 3 3 3.9 3 5V19C3 20.1 3.9 21 5 21H19C20.1 21 21 20.1 21 19V5C21 3.9 20.1 3 19 3ZM19 19H5V5H19V19ZM12 17H14V7H10V9H12V17Z"\n />\n </g>\n <defs>\n <clipPath id="clip0_992_5553">\n <rect width="24" height="24" />\n </clipPath>\n </defs>\n </svg>\n',onRun:e=>{const t=e.get(Ac),n=Lu.type(e);t.call(_h.key),t.call(Rh.key,{nodeType:n,attrs:{level:1}})}}),null!==(null==(w=null==t?void 0:t.textGroup)?void 0:w.h2)&&e.addItem("h2",{label:null!=(k=null==(x=null==(b=null==t?void 0:t.textGroup)?void 0:b.h2)?void 0:x.label)?k:"Heading 2",icon:null!=(M=null==(S=null==(C=null==t?void 0:t.textGroup)?void 0:C.h2)?void 0:S.icon)?M:'\n <svg\n xmlns="http://www.w3.org/2000/svg"\n width="24"\n height="24"\n viewBox="0 0 24 24"\n >\n <g clip-path="url(#clip0_992_5559)">\n <path\n d="M19 3H5C3.9 3 3 3.9 3 5V19C3 20.1 3.9 21 5 21H19C20.1 21 21 20.1 21 19V5C21 3.9 20.1 3 19 3ZM19 19H5V5H19V19ZM15 15H11V13H13C14.1 13 15 12.11 15 11V9C15 7.89 14.1 7 13 7H9V9H13V11H11C9.9 11 9 11.89 9 13V17H15V15Z"\n />\n </g>\n <defs>\n <clipPath id="clip0_992_5559">\n <rect width="24" height="24" />\n </clipPath>\n </defs>\n </svg>\n',onRun:e=>{const t=e.get(Ac),n=Lu.type(e);t.call(_h.key),t.call(Rh.key,{nodeType:n,attrs:{level:2}})}}),null!==(null==(N=null==t?void 0:t.textGroup)?void 0:N.h3)&&e.addItem("h3",{label:null!=(A=null==(O=null==(E=null==t?void 0:t.textGroup)?void 0:E.h3)?void 0:O.label)?A:"Heading 3",icon:null!=(I=null==(D=null==(T=null==t?void 0:t.textGroup)?void 0:T.h3)?void 0:D.icon)?I:'\n <svg\n xmlns="http://www.w3.org/2000/svg"\n width="24"\n height="24"\n viewBox="0 0 24 24"\n >\n <g clip-path="url(#clip0_992_5565)">\n <path\n d="M19 3H5C3.9 3 3 3.9 3 5V19C3 20.1 3.9 21 5 21H19C20.1 21 21 20.1 21 19V5C21 3.9 20.1 3 19 3ZM19 19H5V5H19V19ZM15 15V13.5C15 12.67 14.33 12 13.5 12C14.33 12 15 11.33 15 10.5V9C15 7.89 14.1 7 13 7H9V9H13V11H11V13H13V15H9V17H13C14.1 17 15 16.11 15 15Z"\n />\n </g>\n <defs>\n <clipPath id="clip0_992_5565">\n <rect width="24" height="24" />\n </clipPath>\n </defs>\n </svg>\n',onRun:e=>{const t=e.get(Ac),n=Lu.type(e);t.call(_h.key),t.call(Rh.key,{nodeType:n,attrs:{level:3}})}}),null!==(null==(_=null==t?void 0:t.textGroup)?void 0:_.h4)&&e.addItem("h4",{label:null!=(B=null==(L=null==(R=null==t?void 0:t.textGroup)?void 0:R.h4)?void 0:L.label)?B:"Heading 4",icon:null!=(j=null==(z=null==(P=null==t?void 0:t.textGroup)?void 0:P.h4)?void 0:z.icon)?j:'\n <svg\n xmlns="http://www.w3.org/2000/svg"\n width="24"\n height="24"\n viewBox="0 0 24 24"\n >\n <g clip-path="url(#clip0_977_7757)">\n <path\n d="M19.04 3H5.04004C3.94004 3 3.04004 3.9 3.04004 5V19C3.04004 20.1 3.94004 21 5.04004 21H19.04C20.14 21 21.04 20.1 21.04 19V5C21.04 3.9 20.14 3 19.04 3ZM19.04 19H5.04004V5H19.04V19ZM13.04 17H15.04V7H13.04V11H11.04V7H9.04004V13H13.04V17Z"\n />\n </g>\n <defs>\n <clipPath id="clip0_977_7757">\n <rect width="24" height="24" />\n </clipPath>\n </defs>\n </svg>\n',onRun:e=>{const t=e.get(Ac),n=Lu.type(e);t.call(_h.key),t.call(Rh.key,{nodeType:n,attrs:{level:4}})}}),null!==(null==(V=null==t?void 0:t.textGroup)?void 0:V.h5)&&e.addItem("h5",{label:null!=(q=null==(H=null==($=null==t?void 0:t.textGroup)?void 0:$.h5)?void 0:H.label)?q:"Heading 5",icon:null!=(U=null==(W=null==(F=null==t?void 0:t.textGroup)?void 0:F.h5)?void 0:W.icon)?U:'\n <svg\n xmlns="http://www.w3.org/2000/svg"\n width="24"\n height="24"\n viewBox="0 0 24 24"\n >\n <g clip-path="url(#clip0_977_7760)">\n <path\n d="M19 3H5C3.9 3 3 3.9 3 5V19C3 20.1 3.9 21 5 21H19C20.1 21 21 20.1 21 19V5C21 3.9 20.1 3 19 3ZM19 19H5V5H19V19ZM15 15V13C15 11.89 14.1 11 13 11H11V9H15V7H9V13H13V15H9V17H13C14.1 17 15 16.11 15 15Z"\n />\n </g>\n <defs>\n <clipPath id="clip0_977_7760">\n <rect width="24" height="24" />\n </clipPath>\n </defs>\n </svg>\n',onRun:e=>{const t=e.get(Ac),n=Lu.type(e);t.call(_h.key),t.call(Rh.key,{nodeType:n,attrs:{level:5}})}}),null!==(null==(G=null==t?void 0:t.textGroup)?void 0:G.h6)&&e.addItem("h6",{label:null!=(Z=null==(J=null==(K=null==t?void 0:t.textGroup)?void 0:K.h6)?void 0:J.label)?Z:"Heading 6",icon:null!=(Q=null==(X=null==(Y=null==t?void 0:t.textGroup)?void 0:Y.h6)?void 0:X.icon)?Q:'\n <svg\n xmlns="http://www.w3.org/2000/svg"\n width="24"\n height="24"\n viewBox="0 0 24 24"\n >\n <g clip-path="url(#clip0_977_7763)">\n <path\n d="M11 17H13C14.1 17 15 16.11 15 15V13C15 11.89 14.1 11 13 11H11V9H15V7H11C9.9 7 9 7.89 9 9V15C9 16.11 9.9 17 11 17ZM11 13H13V15H11V13ZM19 3H5C3.9 3 3 3.9 3 5V19C3 20.1 3.9 21 5 21H19C20.1 21 21 20.1 21 19V5C21 3.9 20.1 3 19 3ZM19 19H5V5H19V19Z"\n />\n </g>\n <defs>\n <clipPath id="clip0_977_7763">\n <rect width="24" height="24" />\n </clipPath>\n </defs>\n </svg>\n',onRun:e=>{const t=e.get(Ac),n=Lu.type(e);t.call(_h.key),t.call(Rh.key,{nodeType:n,attrs:{level:6}})}}),null!==(null==(ee=null==t?void 0:t.textGroup)?void 0:ee.quote)&&e.addItem("quote",{label:null!=(re=null==(ne=null==(te=null==t?void 0:t.textGroup)?void 0:te.quote)?void 0:ne.label)?re:"Quote",icon:null!=(se=null==(ie=null==(oe=null==t?void 0:t.textGroup)?void 0:oe.quote)?void 0:ie.icon)?se:bL,onRun:e=>{const t=e.get(Ac),n=$u.type(e);t.call(_h.key),t.call(Lh.key,{nodeType:n})}}),null!==(null==(ae=null==t?void 0:t.textGroup)?void 0:ae.divider)&&e.addItem("divider",{label:null!=(de=null==(ce=null==(le=null==t?void 0:t.textGroup)?void 0:le.divider)?void 0:ce.label)?de:"Divider",icon:null!=(pe=null==(he=null==(ue=null==t?void 0:t.textGroup)?void 0:ue.divider)?void 0:he.icon)?pe:uL,onRun:e=>{const t=e.get(Ac),n=ih.type(e);t.call(_h.key),t.call(Bh.key,{nodeType:n})}})}if(null!==(null==t?void 0:t.listGroup)){const e=yt.addGroup("list",null!=(me=null==(fe=null==t?void 0:t.listGroup)?void 0:fe.label)?me:"List");null!==(null==(ge=null==t?void 0:t.listGroup)?void 0:ge.bulletList)&&e.addItem("bullet-list",{label:null!=(we=null==(ye=null==(ve=null==t?void 0:t.listGroup)?void 0:ve.bulletList)?void 0:ye.label)?we:"Bullet List",icon:null!=(ke=null==(xe=null==(be=null==t?void 0:t.listGroup)?void 0:be.bulletList)?void 0:xe.icon)?ke:iL,onRun:e=>{const t=e.get(Ac),n=ch.type(e);t.call(_h.key),t.call(Lh.key,{nodeType:n})}}),null!==(null==(Ce=null==t?void 0:t.listGroup)?void 0:Ce.orderedList)&&e.addItem("ordered-list",{label:null!=(Ne=null==(Me=null==(Se=null==t?void 0:t.listGroup)?void 0:Se.orderedList)?void 0:Me.label)?Ne:"Ordered List",icon:null!=(Ae=null==(Oe=null==(Ee=null==t?void 0:t.listGroup)?void 0:Ee.orderedList)?void 0:Oe.icon)?Ae:yL,onRun:e=>{const t=e.get(Ac),n=fh.type(e);t.call(_h.key),t.call(Lh.key,{nodeType:n})}}),null!==(null==(Te=null==t?void 0:t.listGroup)?void 0:Te.taskList)&&e.addItem("task-list",{label:null!=(_e=null==(Ie=null==(De=null==t?void 0:t.listGroup)?void 0:De.taskList)?void 0:Ie.label)?_e:"Task List",icon:null!=(Be=null==(Le=null==(Re=null==t?void 0:t.listGroup)?void 0:Re.taskList)?void 0:Le.icon)?Be:ML,onRun:e=>{const t=e.get(Ac),n=wh.type(e);t.call(_h.key),t.call(Lh.key,{nodeType:n,attrs:{checked:!1}})}})}if(null!==(null==t?void 0:t.advancedGroup)){const e=yt.addGroup("advanced",null!=(ze=null==(Pe=null==t?void 0:t.advancedGroup)?void 0:Pe.label)?ze:"Advanced");null!==(null==(je=null==t?void 0:t.advancedGroup)?void 0:je.image)&&gt&&e.addItem("image",{label:null!=(He=null==($e=null==(Ve=null==t?void 0:t.advancedGroup)?void 0:Ve.image)?void 0:$e.label)?He:"Image",icon:null!=(We=null==(Fe=null==(qe=null==t?void 0:t.advancedGroup)?void 0:qe.image)?void 0:Fe.icon)?We:mL,onRun:e=>{const t=e.get(Ac),n=hC.type(e);t.call(_h.key),t.call(Bh.key,{nodeType:n})}}),null!==(null==(Ue=null==t?void 0:t.advancedGroup)?void 0:Ue.codeBlock)&&e.addItem("code",{label:null!=(Je=null==(Ke=null==(Ge=null==t?void 0:t.advancedGroup)?void 0:Ge.codeBlock)?void 0:Ke.label)?Je:"Code",icon:null!=(Xe=null==(Ye=null==(Ze=null==t?void 0:t.advancedGroup)?void 0:Ze.codeBlock)?void 0:Ye.icon)?Xe:lL,onRun:e=>{const t=e.get(Ac),n=Uu.type(e);t.call(_h.key),t.call(Rh.key,{nodeType:n})}}),null!==(null==(Qe=null==t?void 0:t.advancedGroup)?void 0:Qe.table)&&vt&&e.addItem("table",{label:null!=(nt=null==(tt=null==(et=null==t?void 0:t.advancedGroup)?void 0:et.table)?void 0:tt.label)?nt:"Table",icon:null!=(it=null==(ot=null==(rt=null==t?void 0:t.advancedGroup)?void 0:rt.table)?void 0:ot.icon)?it:SL,onRun:e=>{const t=e.get(Ac),n=e.get(ac);t.call(_h.key);const{from:r}=n.state.selection;t.call(Bh.key,{nodeType:uM(e,3,3)}),t.call(Ph.key,{pos:r})}}),null!==(null==(st=null==t?void 0:t.advancedGroup)?void 0:st.math)&&mt&&e.addItem("math",{label:null!=(ct=null==(lt=null==(at=null==t?void 0:t.advancedGroup)?void 0:at.math)?void 0:lt.label)?ct:"Math",icon:null!=(ht=null==(ut=null==(dt=null==t?void 0:t.advancedGroup)?void 0:dt.math)?void 0:ut.icon)?ht:EL,onRun:e=>{const t=e.get(Ac),n=Uu.type(e);t.call(_h.key),t.call(Bh.key,{nodeType:n,attrs:{language:"LaTeX"}})}})}null==(pt=null==t?void 0:t.buildMenu)||pt.call(t,yt);let wt=yt.build();e&&(wt=wt.map(t=>{const n=t.items.filter(t=>t.label.toLowerCase().includes(e.toLowerCase()));return{...t,items:n}}).filter(e=>e.items.length>0));const bt=wt.flatMap(e=>e.items);return bt.forEach((e,t)=>{Object.assign(e,{index:t})}),wt.reduce((e,t)=>{const n=e+t.items.length;return Object.assign(t,{range:[e,n]}),n},0),{groups:wt,size:bt.length}}(n.value,o,e)),a=Wm(0),l=Wm({x:-999,y:-999}),c=e=>{const{x:t,y:n}=e;l.value={x:t,y:n}};iv([s,t],()=>{const{size:e}=s.value;0===e&&t.value?r():a.value>=e&&(a.value=0)});const d=(e,t)=>{const n=a.value,r="function"==typeof e?e(n):e;null==t||t(r),a.value=r},u=e=>{var t,n;const r=null==(t=i.value)?void 0:t.querySelector(`[data-index="${e}"]`),o=null==(n=i.value)?void 0:n.querySelector(".menu-groups");r&&o&&(o.scrollTop=r.offsetTop-o.offsetTop)},h=t=>{const n=s.value.groups.flatMap(e=>e.items).at(t);(null==n?void 0:n.onRun)&&e&&n.onRun(e),r()},p=e=>{const{size:t,groups:n}=s.value;return"Escape"===e.key?(e.preventDefault(),void(null==r||r())):"ArrowDown"===e.key?(e.preventDefault(),d(e=>e<t-1?e+1:e,u)):"ArrowUp"===e.key?(e.preventDefault(),d(e=>e<=0?e:e-1,u)):"ArrowLeft"===e.key?(e.preventDefault(),d(e=>{const t=n.find(t=>t.range[0]<=e&&t.range[1]>e);if(!t)return e;const r=n[n.indexOf(t)-1];return r?r.range[1]-1:e},u)):"ArrowRight"===e.key?(e.preventDefault(),d(e=>{const t=n.find(t=>t.range[0]<=e&&t.range[1]>e);if(!t)return e;const r=n[n.indexOf(t)+1];return r?r.range[0]:e},u)):void("Enter"===e.key&&(e.preventDefault(),h(a.value)))};return ov(()=>{t.value?window.addEventListener("keydown",p,{capture:!0}):window.removeEventListener("keydown",p,{capture:!0})}),Lv(()=>{window.removeEventListener("keydown",p,{capture:!0})}),()=>Yw("div",{ref:i,onPointerdown:e=>e.preventDefault()},Yw("nav",{class:"tab-group"},Yw("ul",null,s.value.groups.map(e=>Yw("li",{key:e.key,onPointerdown:()=>d(e.range[0],u),class:a.value>=e.range[0]&&a.value<e.range[1]?"selected":""},e.label)))),Yw("div",{class:"menu-groups",onPointermove:c},s.value.groups.map(e=>Yw("div",{key:e.key,class:"menu-group"},Yw("h6",null,e.label),Yw("ul",null,e.items.map(e=>{return Yw("li",{key:e.key,"data-index":e.index,class:a.value===e.index?"hover":"",onPointerenter:(t=e.index,e=>{const n=l.value;if(!n)return;const{x:r,y:o}=e;r===n.x&&o===n.y||d(t)}),onPointerdown:()=>{var t,n;null==(n=null==(t=i.value)?void 0:t.querySelector(`[data-index="${e.index}"]`))||n.classList.add("active")},onPointerup:()=>{var t,n;null==(n=null==(t=i.value)?void 0:t.querySelector(`[data-index="${e.index}"]`))||n.classList.remove("active"),h(e.index)}},Yw(Pk,{icon:e.icon}),Yw("span",null,e.label));var t}))))))}});var xP,kP,CP,SP,MP,NP=e=>{throw TypeError(e)},EP=(e,t,n)=>t.has(e)||NP("Cannot "+n),OP=(e,t,n)=>(EP(e,t,"read from private field"),n?n.call(e):t.get(e)),AP=(e,t,n)=>t.has(e)?NP("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),TP=(e,t,n,r)=>(EP(e,t,"write to private field"),t.set(e,n),n);const DP=function(e){const t=Md({},`${e}_SLASH_SPEC`),n=kd(n=>{const r=n.get(t.key);return new io({key:new lo(`${e}_SLASH`),...r})}),r=[t,n];return r.key=t.key,r.pluginKey=n.key,t.meta={package:"@milkdown/plugin-slash",displayName:`Ctx<slashSpec>|${e}`},n.meta={package:"@milkdown/plugin-slash",displayName:`Prose<slash>|${e}`},r}("CREPE_MENU"),IP=Md({show:()=>{},hide:()=>{}},"menuAPICtx");class _P{constructor(e,t,n){var r,o;AP(this,xP),AP(this,kP),AP(this,CP),AP(this,SP),AP(this,MP,null),this.update=e=>{OP(this,SP).update(e)},this.show=e=>{TP(this,MP,e),OP(this,CP).value="",OP(this,SP).show()},this.hide=()=>{TP(this,MP,null),OP(this,SP).hide()},this.destroy=()=>{OP(this,SP).destroy(),OP(this,kP).unmount(),OP(this,xP).remove()};const i=document.createElement("div");i.classList.add("milkdown-slash-menu");const s=Wm(!1),a=Wm("");TP(this,CP,a);const l=this.hide,c=Db(bP,{ctx:e,config:n,show:s,filter:a,hide:l});TP(this,kP,c),c.mount(i),TP(this,xP,i);const d=this,u=null!=(r=null==n?void 0:n.slashMenu)?r:{};TP(this,SP,new Kk({content:OP(this,xP),debounce:20,shouldShow(e){if(uP(e.state.selection)||hP(e.state.selection))return!1;const t=this.getContent(e,e=>["paragraph","heading"].includes(e.type.name));if(null==t)return!1;if(!function(e){if(!(e instanceof Fr))return!1;const{$head:t}=e,n=t.parent,r=t.parentOffset;return r===n.content.size}(e.state.selection))return!1;const n=OP(d,MP);if(a.value=t.startsWith("/")?t.slice(1):t,"number"==typeof n){const t=e.state.doc.nodeSize-2,r=Math.min(n,t);return e.state.doc.resolve(r).node()===e.state.doc.resolve(e.state.selection.from).node()||(TP(d,MP,null),!1)}return!!t.startsWith("/")},offset:null!=(o=u.offset)?o:10,middleware:u.middleware,floatingUIOptions:u.floatingUIOptions,root:u.root})),OP(this,SP).onShow=()=>{s.value=!0},OP(this,SP).onHide=()=>{s.value=!1},this.update(t),e.set(IP.key,{show:e=>this.show(e),hide:()=>this.hide()})}}xP=new WeakMap,kP=new WeakMap,CP=new WeakMap,SP=new WeakMap,MP=new WeakMap;const RP=mv({props:{onAdd:{type:Function,required:!0},addIcon:{type:String,required:!0},handleIcon:{type:String,required:!0}},setup(e){const t=Wm();return()=>Yw(iw,null,Yw("div",{ref:t,class:"operation-item",onPointerdown:e=>{var n;e.preventDefault(),e.stopPropagation(),null==(n=t.value)||n.classList.add("active")},onPointerup:n=>{var r;n.preventDefault(),n.stopPropagation(),null==(r=t.value)||r.classList.remove("active"),e.onAdd()}},Yw(Pk,{icon:e.addIcon})),Yw("div",{class:"operation-item"},Yw(Pk,{icon:e.handleIcon})))}});var LP,BP,PP,zP,jP=e=>{throw TypeError(e)},VP=(e,t,n)=>t.has(e)||jP("Cannot "+n),$P=(e,t,n)=>(VP(e,t,"read from private field"),n?n.call(e):t.get(e)),HP=(e,t,n)=>t.has(e)?jP("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),qP=(e,t,n,r)=>(VP(e,t,"write to private field"),t.set(e,n),n);class FP{constructor(e,t){var n,r,o,i,s;HP(this,LP),HP(this,BP),HP(this,PP),HP(this,zP),this.update=()=>{$P(this,BP).update()},this.destroy=()=>{$P(this,BP).destroy(),$P(this,LP).remove(),$P(this,PP).unmount()},this.onAdd=()=>{const e=$P(this,zP),t=e.get(ac);t.hasFocus()||t.focus();const{state:n,dispatch:r}=t,o=$P(this,BP).active;if(!o)return;const i=o.$pos.pos+o.node.nodeSize;let s=n.tr.insert(i,Au.type(e).create());s=s.setSelection(Fr.near(s.doc.resolve(i))),r(s.scrollIntoView()),$P(this,BP).hide(),e.get(IP.key).show(s.selection.from)},qP(this,zP,e);const a=document.createElement("div");a.classList.add("milkdown-block-handle");const l=Db(RP,{onAdd:this.onAdd,addIcon:null!=(n=null==t?void 0:t.handleAddIcon)?n:wL,handleIcon:null!=(r=null==t?void 0:t.handleDragIcon)?r:'\n <svg\n xmlns="http://www.w3.org/2000/svg"\n width="24"\n height="24"\n viewBox="0 0 24 24"\n >\n <g clip-path="url(#clip0_971_7680)">\n <path\n d="M11 18C11 19.1 10.1 20 9 20C7.9 20 7 19.1 7 18C7 16.9 7.9 16 9 16C10.1 16 11 16.9 11 18ZM9 10C7.9 10 7 10.9 7 12C7 13.1 7.9 14 9 14C10.1 14 11 13.1 11 12C11 10.9 10.1 10 9 10ZM9 4C7.9 4 7 4.9 7 6C7 7.1 7.9 8 9 8C10.1 8 11 7.1 11 6C11 4.9 10.1 4 9 4ZM15 8C16.1 8 17 7.1 17 6C17 4.9 16.1 4 15 4C13.9 4 13 4.9 13 6C13 7.1 13.9 8 15 8ZM15 10C13.9 10 13 10.9 13 12C13 13.1 13.9 14 15 14C16.1 14 17 13.1 17 12C17 10.9 16.1 10 15 10ZM15 16C13.9 16 13 16.9 13 18C13 19.1 13.9 20 15 20C16.1 20 17 19.1 17 18C17 16.9 16.1 16 15 16Z"\n />\n </g>\n <defs>\n <clipPath id="clip0_971_7680">\n <rect width="24" height="24" />\n </clipPath>\n </defs>\n </svg>\n'});l.mount(a),qP(this,PP,l),qP(this,LP,a);const c=null!=(o=null==t?void 0:t.blockHandle)?o:{};qP(this,BP,new Uk({ctx:e,content:a,getOffset:null!=(i=c.getOffset)?i:()=>16,getPlacement:null!=(s=c.getPlacement)?s:({active:e,blockDom:t})=>{if("heading"===e.node.type.name)return"left";let n=0;e.node.descendants(e=>{n+=e.childCount});const r=e.el,o=r.getBoundingClientRect(),i=t.getBoundingClientRect(),s=window.getComputedStyle(r),a=Number.parseInt(s.paddingTop,10)||0,l=Number.parseInt(s.paddingBottom,10)||0,c=o.height-a-l,d=i.height;return n>2||d<c?"left-start":"left"},shouldShow:c.shouldShow,getPosition:c.getPosition,middleware:c.middleware,floatingUIOptions:c.floatingUIOptions,root:c.root})),this.update()}}LP=new WeakMap,BP=new WeakMap,PP=new WeakMap,zP=new WeakMap;const WP=(e,t)=>{e.config(_L(tL.BlockEdit)).config(e=>function(e,t){e.set(jk.key,{filterNodes:e=>!xi(e=>["table","blockquote","math_inline"].includes(e.type.name))(e)}),e.set(Gk.key,{view:()=>new FP(e,t)})}(e,t)).config(e=>function(e,t){e.set(DP.key,{view:n=>new _P(e,n,t)})}(e,t)).use(IP).use(Gk).use(DP)},UP=Dt([],"CodeMirrorThemeCtx"),GP=Uu.extendSchema(e=>t=>{const n=e(t);return{...n,toMarkdown:{match:n.toMarkdown.match,runner:(e,t)=>{var r,o;if("latex"!==(null!=(r=t.attrs.language)?r:"").toLowerCase())return n.toMarkdown.runner(e,t);e.addNode("math",void 0,(null==(o=t.content.firstChild)?void 0:o.text)||"")}}}}),KP="math_inline",JP=Nd(KP,()=>({group:"inline",inline:!0,draggable:!0,atom:!0,attrs:{value:{default:""}},parseDOM:[{tag:`span[data-type="${KP}"]`,getAttrs:e=>{var t;return{value:null!=(t=e.dataset.value)?t:""}}}],toDOM:e=>{const t=e.attrs.value,n=document.createElement("span");return n.dataset.type=KP,n.dataset.value=t,iI.render(t,n,{throwOnError:!1}),n},parseMarkdown:{match:e=>"inlineMath"===e.type,runner:(e,t,n)=>{e.addNode(n,{value:t.value})}},toMarkdown:{match:e=>e.type.name===KP,runner:(e,t)=>{e.addNode("inlineMath",void 0,t.attrs.value)}}})),ZP=yd("ToggleLatex",e=>()=>(t,n)=>{const{hasNode:r,pos:o,target:i}=Mi(t,JP.type(e)),{selection:s,doc:a,tr:l}=t;if(!r){const t=a.textBetween(s.from,s.to);let r=l.replaceSelectionWith(JP.type(e).create({value:t}));return n&&n(r.setSelection(Ur.create(r.doc,s.from))),!0}const{from:c,to:d}=s;if(!i||o<0)return!1;let u=l.delete(o,o+1);const h=i.attrs.value;return u=u.insertText(h,o),n&&n(u.setSelection(Fr.create(u.doc,c,d+h.length-1))),!0}),YP=Bk("INLINE_LATEX"),XP=mv({props:{config:{type:Object,required:!0},innerView:{type:Object,required:!0},updateValue:{type:Object,required:!0}},setup(e){const t=t=>{if(t&&t instanceof HTMLElement){for(;t.firstChild;)t.removeChild(t.firstChild);e.innerView.value&&t.appendChild(e.innerView.value.dom)}},n=t=>{t.preventDefault(),e.updateValue.value()};return()=>Yw("div",{class:"container"},e.innerView.value&&Yw("div",{ref:t}),Yw("button",{type:"button",onPointerdown:n},Yw(Pk,{icon:e.config.inlineEditConfirm})))}});var QP,ez,tz,nz,rz,oz,iz,sz,az=e=>{throw TypeError(e)},lz=(e,t,n)=>t.has(e)||az("Cannot "+n),cz=(e,t,n)=>(lz(e,t,"read from private field"),n?n.call(e):t.get(e)),dz=(e,t,n)=>t.has(e)?az("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),uz=(e,t,n,r)=>(lz(e,t,"write to private field"),t.set(e,n),n);class hz{constructor(e,t,n){this.ctx=e,dz(this,QP),dz(this,ez),dz(this,tz),dz(this,nz,Um(null)),dz(this,rz,Um(()=>{})),dz(this,oz),dz(this,iz,()=>{cz(this,nz).value&&(cz(this,nz).value.destroy(),cz(this,nz).value=null)}),dz(this,sz,e=>{const t=(()=>{if(!e.editable)return!1;const{selection:t,schema:n}=e.state;if(t.empty)return!1;if(!(t instanceof Ur))return!1;const r=t.node;if(r.type.name!==KP)return!1;const o=t.from,i=n.nodes.paragraph.create(null,n.text(r.attrs.value)),s=new Ql(cz(this,tz),{state:ro.create({doc:i,schema:new Rn({nodes:{doc:{content:"block+"},paragraph:{content:"inline*",group:"block",parseDOM:[{tag:"p"}],toDOM:()=>["p",0]},text:{group:"inline"}}}),plugins:[Ti({"Mod-z":mp,"Mod-Z":gp,"Mod-y":gp,Enter:()=>(cz(this,rz).value(),!0)})]})});return cz(this,nz).value=s,cz(this,rz).value=()=>{const{tr:t}=e.state;t.setNodeAttribute(o,"value",s.state.doc.textContent),e.dispatch(t),requestAnimationFrame(()=>{e.focus()})},!0})();return t||cz(this,iz).call(this),t}),this.update=(e,t)=>{cz(this,ez).update(e,t)},this.destroy=()=>{cz(this,oz).unmount(),cz(this,ez).destroy(),cz(this,QP).remove()};const r=document.createElement("div");r.className="milkdown-latex-inline-edit",uz(this,QP,r),uz(this,oz,Db(XP,{config:n,innerView:cz(this,nz),updateValue:cz(this,rz)})),cz(this,oz).mount(r),uz(this,ez,new Lk({debounce:0,content:cz(this,QP),shouldShow:cz(this,sz),offset:10,floatingUIOptions:{placement:"bottom"}})),cz(this,ez).update(t),uz(this,tz,document.createElement("div"))}}QP=new WeakMap,ez=new WeakMap,tz=new WeakMap,nz=new WeakMap,rz=new WeakMap,oz=new WeakMap,iz=new WeakMap,sz=new WeakMap;const pz=/\$([^\s$](?:[^$]*[^\s$])?)\$$/,fz=wd(e=>function(e,t,n={}){return new Ro(e,(e,r,o,i)=>{var s,a,l;const{tr:c}=e;let d=r[1],u=r[0];const h={group:d,fullMatch:u,start:o,end:i},p=null==(s=n.updateCaptured)?void 0:s.call(n,h);if(Object.assign(h,p),({group:d,fullMatch:u,start:o,end:i}=h),null===u)return null;if(!d||""===d.trim())return null;const f=null==(a=n.getAttr)?void 0:a.call(n,r),m=t.createAndFill(f);return m&&(c.replaceRangeWith(t.isBlock?c.doc.resolve(o).before():o,i,m),null==(l=n.beforeDispatch)||l.call(n,{match:[u,d],start:o,end:i,tr:c})),c})}(pz,JP.type(e),{getAttr:e=>{var t;return{value:null!=(t=e[1])?t:""}}})),mz=wd(e=>Po(/^\$\$[\s\n]$/,Uu.type(e),()=>({language:"LaTeX"}))),gz=Dd("remarkMath",()=>Y);function vz(e){return G(e,"math",(e,t,n)=>{const{value:r}=e,o={type:"code",lang:"LaTeX",value:r};n.children.splice(t,1,o)})}const yz=Dd("remarkMathBlock",()=>()=>vz);function wz(e,t){const n="string"==typeof t.value?t.value:void 0;n&&G(e,"inlineMath",(e,t,r)=>{var o,i,s;const a=null==(o=e.position)?void 0:o.start.offset,l=null==(i=e.position)?void 0:i.end.offset;if(null==a||null==l||"$"===n[a+1])return;const c=n.slice(a,l);!/^\$\s/.test(c)&&!/\s\$$/.test(c)&&!/\d/.test(null!=(s=n[l])?s:"")||r.children.splice(t,1,{type:"text",value:c})})}const bz=Dd("remarkInlineMathGuard",()=>()=>wz),xz=(e,t)=>{e.config(_L(tL.Latex)).config(e=>{if(!IL(e).get().includes(tL.CodeMirror))throw new Error("You need to enable CodeMirror to use LaTeX feature");e.update(jb.key,e=>({...e,renderPreview:(n,r,o)=>{if("latex"===n.toLowerCase()&&r.length>0)return function(e,t){const n=iI.renderToString(e,{...t,throwOnError:!1,displayMode:!0});return n}(r,null==t?void 0:t.katexOptions);return(0,e.renderPreview)(n,r,o)}})),e.set(YP.key,{view:n=>{var r;return new hz(e,n,{inlineEditConfirm:null!=(r=null==t?void 0:t.inlineEditConfirm)?r:cL,...t})}})}).use(gz).use(yz).use(bz).use(JP).use(YP).use(fz).use(mz).use(GP).use(ZP)};const kz=(e,t)=>{e.config(_L(tL.ListItem)).config(e=>function(e,t){e.set($_.key,{renderLabel:({label:e,listType:n,checked:r})=>{var o,i,s;return null==r?"bullet"===n?null!=(o=null==t?void 0:t.bulletIcon)?o:'\n <svg\n xmlns="http://www.w3.org/2000/svg"\n width="24"\n height="24"\n viewBox="0 0 24 24"\n >\n <g clip-path="url(#clip0_952_6527)">\n <circle cx="12" cy="12" r="3" />\n </g>\n <defs>\n <clipPath id="clip0_952_6527">\n <rect width="24" height="24" />\n </clipPath>\n </defs>\n </svg>\n':e:r?null!=(i=null==t?void 0:t.checkBoxCheckedIcon)?i:'\n <svg\n xmlns="http://www.w3.org/2000/svg"\n width="24"\n height="24"\n viewBox="0 0 24 24"\n >\n <g clip-path="url(#clip0_1803_1151)">\n <path\n d="M19 3H5C3.9 3 3 3.9 3 5V19C3 20.1 3.9 21 5 21H19C20.1 21 21 20.1 21 19V5C21 3.9 20.1 3 19 3ZM10.71 16.29C10.32 16.68 9.69 16.68 9.3 16.29L5.71 12.7C5.32 12.31 5.32 11.68 5.71 11.29C6.1 10.9 6.73 10.9 7.12 11.29L10 14.17L16.88 7.29C17.27 6.9 17.9 6.9 18.29 7.29C18.68 7.68 18.68 8.31 18.29 8.7L10.71 16.29Z"\n />\n </g>\n <defs>\n <clipPath id="clip0_1803_1151">\n <rect width="24" height="24" />\n </clipPath>\n </defs>\n </svg>\n':null!=(s=null==t?void 0:t.checkBoxUncheckedIcon)?s:'\n <svg\n xmlns="http://www.w3.org/2000/svg"\n width="24"\n height="24"\n viewBox="0 0 24 24"\n >\n <g clip-path="url(#clip0_1803_535)">\n <path\n d="M18 19H6C5.45 19 5 18.55 5 18V6C5 5.45 5.45 5 6 5H18C18.55 5 19 5.45 19 6V18C19 18.55 18.55 19 18 19ZM19 3H5C3.9 3 3 3.9 3 5V19C3 20.1 3.9 21 5 21H19C20.1 21 21 20.1 21 19V5C21 3.9 20.1 3 19 3Z"\n />\n </g>\n <defs>\n <clipPath id="clip0_1803_535">\n <rect width="24" height="24" />\n </clipPath>\n </defs>\n </svg>\n'}})}(e,t)).use(U_)};const Cz=Md({text:"Please enter...",mode:"block"},"placeholderConfigCtx"),Sz=kd(e=>new io({key:new lo("CREPE_PLACEHOLDER"),props:{decorations:t=>{var n;const r=function(e){return e.get("CrepeCtx")}(e);if(r.readonly)return null;const o=e.get(Cz.key);if("doc"===o.mode&&!function(e){var t;return e.childCount<=1&&!(null==(t=e.firstChild)?void 0:t.content.size)}(t.doc))return null;if(uP(t.selection)||hP(t.selection))return null;const i=function(e,t){const{selection:n}=e;if(!n.empty)return null;const r=n.$anchor,o=r.parent;if(o.content.size>0)return null;if(xi(e=>"table"===e.type.name)(r))return null;const i=r.before();return Nl.node(i,i+o.nodeSize,{class:"crepe-placeholder","data-placeholder":t})}(t,null!=(n=o.text)?n:"Please enter...");return i?Al.create(t.doc,[i]):null}}}));function Mz(e,t){return{slice:e,entry:t}}function Nz(e,t){if(!e.isInjected(t.slice))return;const n=e.get(t.slice)[t.entry],r=n?[n.shortcuts].flat()[0]:void 0;return r?function(e,t){var n;const r=e.split(/-(?!$)/),o=null!=(n=r[r.length-1])?n:"",i=r.slice(0,-1);let s=!1,a=!1,l=!1,c=!1;for(const e of i)switch(e.toLowerCase()){case"mod":t?s=!0:a=!0;break;case"meta":case"cmd":case"m":s=!0;break;case"ctrl":case"control":case"c":a=!0;break;case"alt":case"option":case"a":l=!0;break;case"shift":case"s":c=!0}const d=function(e){if(" "===e||"space"===e.toLowerCase())return{display:"Space",aria:" "};if(1===e.length){const t=e.toUpperCase();return{display:t,aria:t}}return{display:e,aria:e}}(o);return{display:t?[a&&"⌃",l&&"⌥",c&&"⇧",s&&"⌘",d.display].filter(Boolean).join(""):[a&&"Ctrl",l&&"Alt",c&&"Shift",s&&"Meta",d.display].filter(Boolean).join("+"),aria:[s&&"Meta",a&&"Control",l&&"Alt",c&&"Shift",d.aria].filter(Boolean).join("+")}}(r,ri.mac):void 0}const Ez=mv({props:{ctx:{type:Object,required:!0},hide:{type:Function,required:!0},show:{type:Object,required:!0},selection:{type:Object,required:!0},config:{type:Object,required:!1}},setup(e){const{ctx:t,config:n}=e;function r(n){e.selection.value;return t.get(dc).status===pd.Created&&n(t)}const o=Zw(()=>function(e,t){var n,r,o,i,s,a,l,c,d,u,h,p,f,m,g,v;const y=new wP;y.addGroup("formatting","Formatting").addItem("bold",{icon:null!=(n=null==e?void 0:e.boldIcon)?n:oL,label:null!=(r=null==e?void 0:e.boldLabel)?r:"Bold",keymap:Mz(su.key,"ToggleBold"),active:e=>e.get(Ac).call(Dh.key,ru.type(e)),onRun:e=>{e.get(Ac).call(ou.key)}}).addItem("italic",{icon:null!=(o=null==e?void 0:e.italicIcon)?o:gL,label:null!=(i=null==e?void 0:e.italicLabel)?i:"Italic",keymap:Mz(tu.key,"ToggleEmphasis"),active:e=>e.get(Ac).call(Dh.key,Yd.type(e)),onRun:e=>{e.get(Ac).call(Xd.key)}}).addItem("strikethrough",{icon:null!=(s=null==e?void 0:e.strikethroughIcon)?s:CL,label:null!=(a=null==e?void 0:e.strikethroughLabel)?a:"Strikethrough",keymap:Mz(rM.key,"ToggleStrikethrough"),active:e=>e.get(Ac).call(Dh.key,eM.type(e)),onRun:e=>{e.get(Ac).call(tM.key)}});const w=y.addGroup("function","Function");w.addItem("code",{icon:null!=(l=null==e?void 0:e.codeIcon)?l:lL,label:null!=(c=null==e?void 0:e.codeLabel)?c:"Inline code",keymap:Mz(uu.key,"ToggleInlineCode"),active:e=>e.get(Ac).call(Dh.key,lu.type(e)),onRun:e=>{e.get(Ac).call(cu.key)}});const b=t&&IL(t).get();if((null==b?void 0:b.includes(tL.Latex))&&w.addItem("latex",{icon:null!=(d=null==e?void 0:e.latexIcon)?d:EL,label:null!=(u=null==e?void 0:e.latexLabel)?u:"Inline math",active:e=>{const t=e.get(Ac),n=e.get(Cc).nodes[KP];return t.call(Ih.key,n)},onRun:e=>{e.get(Ac).call("ToggleLatex")}}),w.addItem("link",{icon:null!=(h=null==e?void 0:e.linkIcon)?h:vL,label:null!=(p=null==e?void 0:e.linkLabel)?p:"Link",active:e=>e.get(Ac).call(Dh.key,gu.type(e)),onRun:e=>{e.get(Ac).call(kI.key)}}),t&&(null==b?void 0:b.includes(tL.AI))){const n=t.get(LL.key);n.provider&&w.addItem("ai",{icon:null!=(m=null!=(f=null==e?void 0:e.aiIcon)?f:n.aiIcon)?m:rL,label:null!=(g=null==e?void 0:e.aiLabel)?g:"Ask AI",active:()=>!1,onRun:e=>{const t=e.get(HB.key),n=e.get(ac),{from:r,to:o}=n.state.selection;t.show(r,o)}})}null==(v=null==e?void 0:e.buildToolbar)||v.call(e,y);const x=y.build();if(t)for(const e of x)for(const n of e.items){if(!n.keymap)continue;const e=Nz(t,n.keymap);e&&(null!=n.shortcut||(n.shortcut=e.display),null!=n.ariaKeyshortcuts||(n.ariaKeyshortcuts=e.aria))}return x}(n,t));function i(e){if(e.label)return e.shortcut?`${e.label} (${e.shortcut})`:e.label}return()=>Yw(iw,null,o.value.map(e=>e.items.map(e=>{return Yw("button",{type:"button",class:_e("toolbar-item",t&&r(e.active)&&"active"),"data-toolbar-item":e.key,title:i(e),"aria-label":e.label,"aria-keyshortcuts":e.ariaKeyshortcuts,onPointerdown:(n=e.onRun,e=>{e.preventDefault(),t&&(null==n||n(t))})},Yw(Pk,{icon:e.icon}));var n})).reduce((e,t,n)=>(0===n?e.push(...t):e.push(Yw("div",{class:"divider"}),...t),e),[]))}});var Oz,Az,Tz,Dz,Iz,_z=e=>{throw TypeError(e)},Rz=(e,t,n)=>t.has(e)||_z("Cannot "+n),Lz=(e,t,n)=>(Rz(e,t,"read from private field"),n?n.call(e):t.get(e)),Bz=(e,t,n)=>t.has(e)?_z("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),Pz=(e,t,n,r)=>(Rz(e,t,"write to private field"),t.set(e,n),n);const zz=Bk("CREPE_TOOLBAR");class jz{constructor(e,t,n){Bz(this,Oz),Bz(this,Az),Bz(this,Tz),Bz(this,Dz),Bz(this,Iz,Wm(!1)),this.update=(e,t)=>{Lz(this,Oz).update(e,t),Lz(this,Dz).value=e.state.selection},this.destroy=()=>{Lz(this,Oz).destroy(),Lz(this,Tz).unmount(),Lz(this,Az).remove()},this.hide=()=>{Lz(this,Oz).hide()};const r=document.createElement("div");r.className="milkdown-toolbar",Pz(this,Dz,Um(t.state.selection));const o=Db(Ez,{ctx:e,hide:this.hide,config:n,selection:Lz(this,Dz),show:Lz(this,Iz)});o.mount(r),Pz(this,Az,r),Pz(this,Tz,o),Pz(this,Oz,new Lk({content:Lz(this,Az),debounce:20,offset:10,shouldShow(e){const{doc:t,selection:n}=e.state,{empty:o,from:i,to:s}=n,a=!t.textBetween(i,s).length&&n instanceof Fr,l=!(n instanceof Fr),c=e.dom.getRootNode().activeElement,d=r.contains(c),u=!e.hasFocus()&&!d,h=!e.editable;return!(u||l||o||a||h)}})),Lz(this,Oz).onShow=()=>{Lz(this,Iz).value=!0},Lz(this,Oz).onHide=()=>{Lz(this,Iz).value=!1},this.update(t)}}Oz=new WeakMap,Az=new WeakMap,Tz=new WeakMap,Dz=new WeakMap,Iz=new WeakMap;const Vz=[{label:"Paragraph",level:null},{label:"Heading 1",level:1},{label:"Heading 2",level:2},{label:"Heading 3",level:3},{label:"Heading 4",level:4},{label:"Heading 5",level:5},{label:"Heading 6",level:6}];function $z(e,t){if(e.get(Ac).call(Dh.key,t))return!0;const n=e.get(ac),{state:r}=n;if(r.storedMarks)return r.storedMarks.some(e=>e.type===t);if(r.selection instanceof Fr){const{$cursor:e}=r.selection;if(e)return e.marks().some(e=>e.type===t)}return!1}function Hz(e,t){const n=null!=e?e:Vz;return{icon:"",active:()=>!1,selector:{chevronIcon:null!=t?t:sL,activeLabel:e=>function(e,t){var n,r;const o=null!=t?t:Vz,i=e.get(ac),{$from:s}=i.state.selection,a=s.parent,l=null!=(n=o.find(e=>null===e.level))?n:o[0];if(a.type===Lu.type(e)){const e=a.attrs.level;return null!=(r=o.find(t=>t.level===e))?r:l}return l}(e,n).label,options:n.map(e=>({label:e.label,onSelect:t=>function(e,t){const n=e.get(Ac);if(null==t){const t=Au.type(e);n.call(Rh.key,{nodeType:t})}else{const r=Lu.type(e);n.call(Rh.key,{nodeType:r,attrs:{level:t}})}}(t,e.level)}))}}}const qz=mv({props:{ctx:{type:Object,required:!0},version:{type:Object,required:!0},config:{type:Object,required:!1}},setup(e){const{ctx:t,config:n}=e,r=Wm(null);function o(){return t.get(dc).status===pd.Created}function i(){e.version.value}const s=e=>{e.target.closest(".top-bar-heading-selector")||(r.value=null)};Dv(()=>{window.addEventListener("pointerdown",s)}),Lv(()=>{window.removeEventListener("pointerdown",s)});const a=Zw(()=>function(e,t){var n,r,o,i,s,a,l,c,d,u,h,p,f,m,g;const v=t&&IL(t).get(),y=null==v?void 0:v.includes(tL.Latex),w=null==v?void 0:v.includes(tL.ImageBlock),b=null==v?void 0:v.includes(tL.Table),x=new wP;x.addGroup("heading","Heading").addItem("heading-selector",{...Hz(null==e?void 0:e.headingOptions,null==e?void 0:e.chevronDownIcon)}),x.addGroup("formatting","Formatting").addItem("bold",{icon:null!=(n=null==e?void 0:e.boldIcon)?n:oL,active:e=>$z(e,ru.type(e)),onRun:e=>{e.get(Ac).call(ou.key)}}).addItem("italic",{icon:null!=(r=null==e?void 0:e.italicIcon)?r:gL,active:e=>$z(e,Yd.type(e)),onRun:e=>{e.get(Ac).call(Xd.key)}}).addItem("strikethrough",{icon:null!=(o=null==e?void 0:e.strikethroughIcon)?o:CL,active:e=>$z(e,eM.type(e)),onRun:e=>{e.get(Ac).call(tM.key)}}).addItem("code",{icon:null!=(i=null==e?void 0:e.codeIcon)?i:lL,active:e=>$z(e,lu.type(e)),onRun:e=>{const t=e.get(ac),{state:n}=t;if(n.selection.empty){const r=lu.type(e);$z(e,r)?t.dispatch(n.tr.removeStoredMark(r)):t.dispatch(n.tr.addStoredMark(r.create()))}else e.get(Ac).call(cu.key)}}),x.addGroup("list","List").addItem("bullet-list",{icon:null!=(s=null==e?void 0:e.bulletListIcon)?s:iL,active:()=>!1,onRun:e=>{const t=e.get(Ac),n=ch.type(e);t.call(Lh.key,{nodeType:n})}}).addItem("ordered-list",{icon:null!=(a=null==e?void 0:e.orderedListIcon)?a:yL,active:()=>!1,onRun:e=>{const t=e.get(Ac),n=fh.type(e);t.call(Lh.key,{nodeType:n})}}).addItem("task-list",{icon:null!=(l=null==e?void 0:e.taskListIcon)?l:ML,active:()=>!1,onRun:e=>{const t=e.get(Ac),n=wh.type(e);t.call(Lh.key,{nodeType:n,attrs:{checked:!1}})}});const k=x.addGroup("insert","Insert");k.addItem("link",{icon:null!=(c=null==e?void 0:e.linkIcon)?c:vL,active:e=>$z(e,gu.type(e)),onRun:e=>{const t=e.get(ac),{state:n}=t,r=gu.type(e);n.selection.empty&&$z(e,r)?t.dispatch(n.tr.removeStoredMark(r)):e.get(Ac).call(kI.key)}}),w&&k.addItem("image",{icon:null!=(d=null==e?void 0:e.imageIcon)?d:mL,active:()=>!1,onRun:e=>{const t=e.get(Ac),n=hC.type(e);t.call(Bh.key,{nodeType:n})}}),b&&k.addItem("table",{icon:null!=(u=null==e?void 0:e.tableIcon)?u:SL,active:()=>!1,onRun:e=>{const t=e.get(Ac),n=e.get(ac),{from:r}=n.state.selection;t.call(Bh.key,{nodeType:uM(e,3,3)}),t.call(Ph.key,{pos:r})}});const C=x.addGroup("block","Block");return C.addItem("code-block",{icon:null!=(h=null==e?void 0:e.codeBlockIcon)?h:'\n <svg\n xmlns="http://www.w3.org/2000/svg"\n width="24"\n height="24"\n viewBox="0 0 24 24"\n >\n <path\n d="M3 3h18a1 1 0 0 1 1 1v16a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1zm1 2v14h16V5H4zm8 10h6v2h-6v-2zm-3.333-3L5.838 9.172l1.415-1.415L11.495 12l-4.242 4.243-1.415-1.415L8.667 12z"\n />\n </svg>\n',active:()=>!1,onRun:e=>{const t=e.get(Ac),n=Uu.type(e);t.call(Rh.key,{nodeType:n})}}),y&&C.addItem("math",{icon:null!=(p=null==e?void 0:e.mathIcon)?p:EL,active:()=>!1,onRun:e=>{const t=e.get(Ac),n=Uu.type(e);t.call(Bh.key,{nodeType:n,attrs:{language:"LaTeX"}})}}),x.addGroup("more","More").addItem("quote",{icon:null!=(f=null==e?void 0:e.quoteIcon)?f:bL,active:()=>!1,onRun:e=>{const t=e.get(Ac),n=$u.type(e);t.call(Lh.key,{nodeType:n})}}).addItem("hr",{icon:null!=(m=null==e?void 0:e.hrIcon)?m:uL,active:()=>!1,onRun:e=>{const t=e.get(Ac),n=ih.type(e);t.call(Bh.key,{nodeType:n})}}),null==(g=null==e?void 0:e.buildTopBar)||g.call(e,x),x.build()}(n,t));function l(e,n){const s=r.value===e,a=function(e){var n,r;return i(),o()?e.activeLabel(t):null!=(r=null==(n=e.options[0])?void 0:n.label)?r:""}(n);return Yw("div",{key:e,class:"top-bar-heading-selector"},Yw("button",{type:"button",class:"top-bar-heading-button",onPointerdown:t=>function(e,t){t.preventDefault(),t.stopPropagation(),r.value=r.value===e?null:e}(e,t)},Yw("span",{class:"top-bar-heading-label"},a),n.chevronIcon&&Yw("span",{class:"top-bar-chevron"},Yw(Pk,{icon:n.chevronIcon}))),s&&Yw("div",{class:"top-bar-heading-dropdown"},n.options.map((n,o)=>Yw("button",{key:`${e}-${o}`,type:"button",class:_e("top-bar-heading-option",a===n.label&&"active"),onPointerdown:e=>{e.preventDefault(),e.stopPropagation(),r.value=null,n.onSelect(t)}},n.label))))}return()=>{i();const e=o()?t.get(ac):null;return!!e&&!e.editable?null:Yw("div",{class:"top-bar-inner"},a.value.map(e=>e.items.map(e=>e.selector?l(e.key,e.selector):e.onRun?function(e){return Yw("button",{key:e.key,type:"button",class:_e("top-bar-item",(r=e.active,i(),!!o()&&r(t)&&"active")),onPointerdown:(n=e.onRun,e=>{e.preventDefault(),t&&n(t)})},Yw(Pk,{icon:e.icon}));var n,r}(e):null)).reduce((e,t,n)=>{var r,o;if(0===n)e.push(...t);else{const i=null!=(o=null==(r=a.value[n])?void 0:r.key)?o:n;e.push(Yw("div",{key:`divider-${i}`,class:"top-bar-divider"}),...t)}return e},[]))}}});var Fz,Wz,Uz,Gz=e=>{throw TypeError(e)},Kz=(e,t,n)=>t.has(e)||Gz("Cannot "+n),Jz=(e,t,n)=>(Kz(e,t,"read from private field"),n?n.call(e):t.get(e)),Zz=(e,t,n)=>t.has(e)?Gz("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),Yz=(e,t,n,r)=>(Kz(e,t,"write to private field"),t.set(e,n),n);const Xz=new lo("CREPE_TOP_BAR");class Qz{constructor(e,t,n){Zz(this,Fz),Zz(this,Wz),Zz(this,Uz),this.update=(e,t)=>{Jz(this,Fz).style.display=e.editable?"":"none",Jz(this,Uz).value++},this.destroy=()=>{Jz(this,Wz).unmount(),Jz(this,Fz).remove()},Yz(this,Uz,Wm(0));const r=document.createElement("div");r.className="milkdown-top-bar";const o=Db(qz,{ctx:e,config:n,version:Jz(this,Uz)});o.mount(r),Yz(this,Fz,r),Yz(this,Wz,o);const i=t.dom.parentElement;i&&i.insertBefore(r,i.firstChild),this.update(t)}}Fz=new WeakMap,Wz=new WeakMap,Uz=new WeakMap;const ej=Md({view:()=>({update:()=>{},destroy:()=>{}})},"topBarConfig"),tj=kd(e=>{const t=e.get(ej.key);return new io({key:Xz,view:t.view})});function nj(e,t,n){switch(e){case tL.CodeMirror:return((e,t={})=>{e.config(_L(tL.CodeMirror)).config(e=>{const{languages:n=[],theme:r=[]}=t,o=u.of(A.concat(B)),i=e=>{var n;return[o,QM,e,...null!=(n=t.extensions)?n:[]]};e.inject(UP,r),e.use(UP).on(t=>{e.update(jb.key,e=>({...e,extensions:i(t)}))}),e.update(jb.key,e=>{var o;return{extensions:i(r),languages:n,expandIcon:t.expandIcon||sL,searchIcon:t.searchIcon||kL,clearSearchIcon:t.clearSearchIcon||aL,searchPlaceholder:t.searchPlaceholder||"Search language",copyText:t.copyText||"Copy",copyIcon:t.copyIcon||dL,onCopy:t.onCopy||(()=>{}),noResultText:t.noResultText||"No result",renderLanguage:t.renderLanguage||e.renderLanguage,renderPreview:t.renderPreview||e.renderPreview,previewToggleButton:e=>{var n,r;return[(null==(n=t.previewToggleIcon)?void 0:n.call(t,e))||(e?pL:OL),(null==(r=t.previewToggleText)?void 0:r.call(t,e))||(e?"Edit":"Hide")].map(e=>e.trim()).join(" ")},previewLabel:t.previewLabel||e.previewLabel,previewLoading:t.previewLoading||e.previewLoading,previewOnlyByDefault:null!=(o=t.previewOnlyByDefault)?o:e.previewOnlyByDefault}})}).use(nx)})(t,n);case tL.ListItem:return kz(t,n);case tL.LinkTooltip:return((e,t)=>{e.config(_L(tL.LinkTooltip)).config(I_).config(e=>{e.update(xI.key,e=>{var n,r,o,i,s,a;return{...e,linkIcon:null!=(n=null==t?void 0:t.linkIcon)?n:dL,editButton:null!=(r=null==t?void 0:t.editButton)?r:pL,removeButton:null!=(o=null==t?void 0:t.removeButton)?o:xL,confirmButton:null!=(i=null==t?void 0:t.confirmButton)?i:cL,inputPlaceholder:null!=(s=null==t?void 0:t.inputPlaceholder)?s:"Paste link...",onCopyLink:null!=(a=null==t?void 0:t.onCopyLink)?a:()=>{}}})}).use(__)})(t,n);case tL.ImageBlock:return((e,t)=>{e.config(_L(tL.ImageBlock)).config(e=>{e.update(IN.key,e=>{var n,r,o,i,s,a;return{uploadButton:null!=(n=null==t?void 0:t.inlineUploadButton)?n:"Upload",imageIcon:null!=(r=null==t?void 0:t.inlineImageIcon)?r:mL,confirmButton:null!=(o=null==t?void 0:t.inlineConfirmButton)?o:cL,uploadPlaceholderText:null!=(i=null==t?void 0:t.inlineUploadPlaceholderText)?i:"or paste link",onUpload:null!=(a=null!=(s=null==t?void 0:t.inlineOnUpload)?s:null==t?void 0:t.onUpload)?a:e.onUpload,proxyDomURL:null==t?void 0:t.proxyDomURL}}),e.update(nC.key,e=>{var n,r,o,i,s,a,l,c,d;return{uploadButton:null!=(n=null==t?void 0:t.blockUploadButton)?n:"Upload file",imageIcon:null!=(r=null==t?void 0:t.blockImageIcon)?r:mL,captionIcon:null!=(o=null==t?void 0:t.blockCaptionIcon)?o:'\n <svg\n xmlns="http://www.w3.org/2000/svg"\n width="32"\n height="32"\n viewBox="0 0 24 24"\n >\n <path\n fill="currentColor"\n d="M9 22a1 1 0 0 1-1-1v-3H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2h-6.1l-3.7 3.71c-.2.19-.45.29-.7.29zm1-6v3.08L13.08 16H20V4H4v12z"\n />\n </svg>\n',confirmButton:null!=(i=null==t?void 0:t.blockConfirmButton)?i:"Confirm",captionPlaceholderText:null!=(s=null==t?void 0:t.blockCaptionPlaceholderText)?s:"Write Image Caption",uploadPlaceholderText:null!=(a=null==t?void 0:t.blockUploadPlaceholderText)?a:"or paste link",onUpload:null!=(c=null!=(l=null==t?void 0:t.blockOnUpload)?l:null==t?void 0:t.onUpload)?c:e.onUpload,proxyDomURL:null==t?void 0:t.proxyDomURL,onImageLoadError:null!=(d=null==t?void 0:t.onImageLoadError)?d:e.onImageLoadError,maxWidth:null==t?void 0:t.maxWidth,maxHeight:null==t?void 0:t.maxHeight}})}).use(MC).use(jN)})(t,n);case tL.Cursor:return((e,t)=>{if(e.config(_L(tL.Cursor)).config(e=>{e.update(mN.key,()=>{var e,n;return{class:"crepe-drop-cursor",width:null!=(e=null==t?void 0:t.width)?e:4,color:null!=(n=null==t?void 0:t.color)&&n}})}).use(bN),!1===(null==t?void 0:t.virtual))return;const n=xN({skipWarning:["inlineCode"]});e.use(kd(()=>n))})(t,n);case tL.BlockEdit:return WP(t,n);case tL.Placeholder:return((e,t)=>{e.config(_L(tL.Placeholder)).config(e=>{t&&e.update(Cz.key,e=>({...e,...t}))}).use(Sz).use(Cz)})(t,n);case tL.Toolbar:return((e,t)=>{e.config(_L(tL.Toolbar)).config(e=>{e.set(zz.key,{view:n=>new jz(e,n,t)})}).use(zz)})(t,n);case tL.Table:return((e,t)=>{e.config(_L(tL.Table)).config(e=>{e.update(iR.key,e=>({...e,renderButton:e=>{var n,r,o,i,s,a,l,c,d;switch(e){case"add_row":return null!=(n=null==t?void 0:t.addRowIcon)?n:wL;case"add_col":return null!=(r=null==t?void 0:t.addColIcon)?r:wL;case"delete_row":return null!=(o=null==t?void 0:t.deleteRowIcon)?o:xL;case"delete_col":return null!=(i=null==t?void 0:t.deleteColIcon)?i:xL;case"align_col_left":return null!=(s=null==t?void 0:t.alignLeftIcon)?s:'\n <svg\n xmlns="http://www.w3.org/2000/svg"\n width="24"\n height="24"\n viewBox="0 0 24 24"\n >\n <path\n d="M4.25 20.5C4.0375 20.5 3.85942 20.4281 3.71575 20.2843C3.57192 20.1404 3.5 19.9622 3.5 19.7498C3.5 19.5371 3.57192 19.359 3.71575 19.2155C3.85942 19.0718 4.0375 19 4.25 19H19.75C19.9625 19 20.1406 19.0719 20.2843 19.2158C20.4281 19.3596 20.5 19.5378 20.5 19.7502C20.5 19.9629 20.4281 20.141 20.2843 20.2845C20.1406 20.4282 19.9625 20.5 19.75 20.5H4.25ZM4.25 16.625C4.0375 16.625 3.85942 16.5531 3.71575 16.4093C3.57192 16.2654 3.5 16.0872 3.5 15.8748C3.5 15.6621 3.57192 15.484 3.71575 15.3405C3.85942 15.1968 4.0375 15.125 4.25 15.125H13.75C13.9625 15.125 14.1406 15.1969 14.2843 15.3408C14.4281 15.4846 14.5 15.6628 14.5 15.8753C14.5 16.0879 14.4281 16.266 14.2843 16.4095C14.1406 16.5532 13.9625 16.625 13.75 16.625H4.25ZM4.25 12.75C4.0375 12.75 3.85942 12.6781 3.71575 12.5343C3.57192 12.3904 3.5 12.2122 3.5 11.9998C3.5 11.7871 3.57192 11.609 3.71575 11.4655C3.85942 11.3218 4.0375 11.25 4.25 11.25H19.75C19.9625 11.25 20.1406 11.3219 20.2843 11.4658C20.4281 11.6096 20.5 11.7878 20.5 12.0003C20.5 12.2129 20.4281 12.391 20.2843 12.5345C20.1406 12.6782 19.9625 12.75 19.75 12.75H4.25ZM4.25 8.875C4.0375 8.875 3.85942 8.80308 3.71575 8.65925C3.57192 8.51542 3.5 8.33725 3.5 8.12475C3.5 7.91208 3.57192 7.734 3.71575 7.5905C3.85942 7.44683 4.0375 7.375 4.25 7.375H13.75C13.9625 7.375 14.1406 7.44692 14.2843 7.59075C14.4281 7.73458 14.5 7.91275 14.5 8.12525C14.5 8.33792 14.4281 8.516 14.2843 8.6595C14.1406 8.80317 13.9625 8.875 13.75 8.875H4.25ZM4.25 5C4.0375 5 3.85942 4.92808 3.71575 4.78425C3.57192 4.64042 3.5 4.46225 3.5 4.24975C3.5 4.03708 3.57192 3.859 3.71575 3.7155C3.85942 3.57183 4.0375 3.5 4.25 3.5H19.75C19.9625 3.5 20.1406 3.57192 20.2843 3.71575C20.4281 3.85958 20.5 4.03775 20.5 4.25025C20.5 4.46292 20.4281 4.641 20.2843 4.7845C20.1406 4.92817 19.9625 5 19.75 5H4.25Z"\n />\n </svg>\n';case"align_col_center":return null!=(a=null==t?void 0:t.alignCenterIcon)?a:'\n <svg\n xmlns="http://www.w3.org/2000/svg"\n width="24"\n height="24"\n viewBox="0 0 24 24"\n >\n <path\n d="M4.25 20.5C4.0375 20.5 3.85942 20.4281 3.71575 20.2843C3.57192 20.1404 3.5 19.9622 3.5 19.7498C3.5 19.5371 3.57192 19.359 3.71575 19.2155C3.85942 19.0718 4.0375 19 4.25 19H19.75C19.9625 19 20.1406 19.0719 20.2843 19.2158C20.4281 19.3596 20.5 19.5378 20.5 19.7502C20.5 19.9629 20.4281 20.141 20.2843 20.2845C20.1406 20.4282 19.9625 20.5 19.75 20.5H4.25ZM8.25 16.625C8.0375 16.625 7.85942 16.5531 7.71575 16.4093C7.57192 16.2654 7.5 16.0872 7.5 15.8748C7.5 15.6621 7.57192 15.484 7.71575 15.3405C7.85942 15.1968 8.0375 15.125 8.25 15.125H15.75C15.9625 15.125 16.1406 15.1969 16.2843 15.3408C16.4281 15.4846 16.5 15.6628 16.5 15.8753C16.5 16.0879 16.4281 16.266 16.2843 16.4095C16.1406 16.5532 15.9625 16.625 15.75 16.625H8.25ZM4.25 12.75C4.0375 12.75 3.85942 12.6781 3.71575 12.5343C3.57192 12.3904 3.5 12.2122 3.5 11.9998C3.5 11.7871 3.57192 11.609 3.71575 11.4655C3.85942 11.3218 4.0375 11.25 4.25 11.25H19.75C19.9625 11.25 20.1406 11.3219 20.2843 11.4658C20.4281 11.6096 20.5 11.7878 20.5 12.0003C20.5 12.2129 20.4281 12.391 20.2843 12.5345C20.1406 12.6782 19.9625 12.75 19.75 12.75H4.25ZM8.25 8.875C8.0375 8.875 7.85942 8.80308 7.71575 8.65925C7.57192 8.51542 7.5 8.33725 7.5 8.12475C7.5 7.91208 7.57192 7.734 7.71575 7.5905C7.85942 7.44683 8.0375 7.375 8.25 7.375H15.75C15.9625 7.375 16.1406 7.44692 16.2843 7.59075C16.4281 7.73458 16.5 7.91275 16.5 8.12525C16.5 8.33792 16.4281 8.516 16.2843 8.6595C16.1406 8.80317 15.9625 8.875 15.75 8.875H8.25ZM4.25 5C4.0375 5 3.85942 4.92808 3.71575 4.78425C3.57192 4.64042 3.5 4.46225 3.5 4.24975C3.5 4.03708 3.57192 3.859 3.71575 3.7155C3.85942 3.57183 4.0375 3.5 4.25 3.5H19.75C19.9625 3.5 20.1406 3.57192 20.2843 3.71575C20.4281 3.85958 20.5 4.03775 20.5 4.25025C20.5 4.46292 20.4281 4.641 20.2843 4.7845C20.1406 4.92817 19.9625 5 19.75 5H4.25Z"\n />\n </svg>\n';case"align_col_right":return null!=(l=null==t?void 0:t.alignRightIcon)?l:'\n <svg\n xmlns="http://www.w3.org/2000/svg"\n width="24"\n height="24"\n viewBox="0 0 24 24"\n >\n <path\n d="M4.25 5C4.0375 5 3.85942 4.92808 3.71575 4.78425C3.57192 4.64042 3.5 4.46225 3.5 4.24975C3.5 4.03708 3.57192 3.859 3.71575 3.7155C3.85942 3.57183 4.0375 3.5 4.25 3.5H19.75C19.9625 3.5 20.1406 3.57192 20.2843 3.71575C20.4281 3.85958 20.5 4.03775 20.5 4.25025C20.5 4.46292 20.4281 4.641 20.2843 4.7845C20.1406 4.92817 19.9625 5 19.75 5H4.25ZM10.25 8.875C10.0375 8.875 9.85942 8.80308 9.71575 8.65925C9.57192 8.51542 9.5 8.33725 9.5 8.12475C9.5 7.91208 9.57192 7.734 9.71575 7.5905C9.85942 7.44683 10.0375 7.375 10.25 7.375H19.75C19.9625 7.375 20.1406 7.44692 20.2843 7.59075C20.4281 7.73458 20.5 7.91275 20.5 8.12525C20.5 8.33792 20.4281 8.516 20.2843 8.6595C20.1406 8.80317 19.9625 8.875 19.75 8.875H10.25ZM4.25 12.75C4.0375 12.75 3.85942 12.6781 3.71575 12.5343C3.57192 12.3904 3.5 12.2122 3.5 11.9998C3.5 11.7871 3.57192 11.609 3.71575 11.4655C3.85942 11.3218 4.0375 11.25 4.25 11.25H19.75C19.9625 11.25 20.1406 11.3219 20.2843 11.4658C20.4281 11.6096 20.5 11.7878 20.5 12.0003C20.5 12.2129 20.4281 12.391 20.2843 12.5345C20.1406 12.6782 19.9625 12.75 19.75 12.75H4.25ZM10.25 16.625C10.0375 16.625 9.85942 16.5531 9.71575 16.4093C9.57192 16.2654 9.5 16.0872 9.5 15.8748C9.5 15.6621 9.57192 15.484 9.71575 15.3405C9.85942 15.1968 10.0375 15.125 10.25 15.125H19.75C19.9625 15.125 20.1406 15.1969 20.2843 15.3408C20.4281 15.4846 20.5 15.6628 20.5 15.8753C20.5 16.0879 20.4281 16.266 20.2843 16.4095C20.1406 16.5532 19.9625 16.625 19.75 16.625H10.25ZM4.25 20.5C4.0375 20.5 3.85942 20.4281 3.71575 20.2843C3.57192 20.1404 3.5 19.9622 3.5 19.7498C3.5 19.5371 3.57192 19.359 3.71575 19.2155C3.85942 19.0718 4.0375 19 4.25 19H19.75C19.9625 19 20.1406 19.0719 20.2843 19.2158C20.4281 19.3596 20.5 19.5378 20.5 19.7502C20.5 19.9629 20.4281 20.141 20.2843 20.2845C20.1406 20.4282 19.9625 20.5 19.75 20.5H4.25Z"\n />\n </svg>\n';case"col_drag_handle":return null!=(c=null==t?void 0:t.colDragHandleIcon)?c:hL;case"row_drag_handle":return null!=(d=null==t?void 0:t.rowDragHandleIcon)?d:hL}}}))}).use(AR)})(t,n);case tL.Latex:return xz(t,n);case tL.TopBar:return((e,t)=>{e.config(_L(tL.TopBar)).config(e=>{e.set(ej.key,{view:n=>new Qz(e,n,t)})}).use(ej).use(tj)})(t,n);case tL.AI:return dP(t,n)}}var rj,oj,ij,sj=e=>{throw TypeError(e)},aj=(e,t,n)=>t.has(e)||sj("Cannot "+n),lj=(e,t,n)=>(aj(e,t,"read from private field"),n?n.call(e):t.get(e)),cj=(e,t,n)=>t.has(e)?sj("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),dj=(e,t,n,r)=>(aj(e,t,"write to private field"),t.set(e,n),n);class uj{constructor({root:e,defaultValue:t=""}={}){var n;cj(this,rj),cj(this,oj),cj(this,ij,!0),this.addFeature=(e,t)=>(e(lj(this,rj),t),this),this.create=()=>lj(this,rj).create(),this.destroy=()=>lj(this,rj).destroy(),this.setReadonly=e=>(dj(this,ij,!e),lj(this,rj).action(t=>{if(lj(this,rj).status===pd.Created){t.get(ac).setProps({editable:()=>!e})}}),this),this.getMarkdown=()=>lj(this,rj).action(Id()),this.on=e=>lj(this,rj).status!==pd.Created?(lj(this,rj).config(t=>{const n=t.get(UR);e(n)}),this):(lj(this,rj).action(t=>{const n=t.get(UR);e(n)}),this),dj(this,oj,null!=(n="string"==typeof e?document.querySelector(e):e)?n:document.body),dj(this,rj,fd.make().config(e=>{e.inject(DL,this),e.inject(TL,[])}).config(e=>{e.set(ld,lj(this,oj)),e.set(Kc,t),e.set(ad,{editable:()=>lj(this,ij)}),e.update(HR.key,e=>({...e,size:4})),e.update(XR.key,e=>({...e,uploader:async(e,t,n)=>{const r=IL(n).get().includes(tL.ImageBlock),o=r?t.nodes["image-block"]:t.nodes.image;if(!o)return[];const i=r?n.get(nC.key).onUpload:void 0,s=[];for(let t=0;t<e.length;t++){const n=e.item(t);n&&n.type.includes("image")&&s.push(n)}return await Promise.all(s.map(async e=>{const t=i?await i(e):URL.createObjectURL(e);return o.createAndFill({src:t})}))}}))}).use(Yh).use(KR).use($R).use(FR).use(YR).use(RR).use(eL).use(XM))}get editor(){return lj(this,rj)}get readonly(){return!lj(this,ij)}}rj=new WeakMap,oj=new WeakMap,ij=new WeakMap;class hj extends uj{constructor({features:e={},featureConfigs:t={},...n}={}){super(n);const r=ix(t,AL);Object.entries({...nL,...e}).filter(([,e])=>e).map(([e])=>e).forEach(e=>{const t=r[e];nj(e,this.editor,t)})}}hj.Feature=tL;const pj=new lo("nodeHighlight"),fj=new io({key:pj,state:{init:()=>Al.empty,apply(e,t){const n=e.getMeta(pj);if(n){if("clear"in n)return Al.empty;const t=n.ranges.map(({from:e,to:t})=>Nl.node(e,t,{class:n.className}));return Al.create(e.doc,t)}return t.map(e.mapping,e.doc)}},props:{decorations:e=>pj.getState(e)}}),mj=l.theme({"&":{backgroundColor:"#fff"}},{dark:!1}),gj=(t,n)=>async(r,o)=>{const i=[];for(let e=0;e<r.length;e++){const t=r.item(e);t&&(t.type.includes("image/")&&i.push(t))}t(Ce.LOADING);const s=await Promise.all(i.map(async t=>{const{status:r,message:i,content:s}=await Je(t,!1);return r===Ce.SUCCESS&&o?.nodes?.image?(n({type:ge.SUCCESS,message:e(ve,{children:i})}),o.nodes.image.createAndFill({src:s.imageUrl,alt:t.name})):(n({type:ge.ERROR,message:e(ve,{children:i})}),null)}));return t(Ce.SUCCESS),s},vj=s.define({token:e=>(e.skipToEnd(),null)}),yj=new i(vj),wj=[o.of({...jd.find(e=>"C"===e.name),name:Me.C.toLowerCase(),load:()=>import("./index-DDBuqExW.js").then(e=>e.cpp())}),o.of({...jd.find(e=>"C"===e.name),name:Me.C.toLowerCase()+`/${X.EDITOR}`,load:()=>import("./index-DDBuqExW.js").then(e=>e.cpp())}),o.of({...jd.find(e=>"C++"===e.name),name:Me.CPP.toLowerCase(),load:()=>import("./index-DDBuqExW.js").then(e=>e.cpp())}),o.of({...jd.find(e=>"C++"===e.name),name:Me.CPP.toLowerCase()+`/${X.EDITOR}`,load:()=>import("./index-DDBuqExW.js").then(e=>e.cpp())}),o.of({...jd.find(e=>"Java"===e.name),name:Me.JAVA.toLowerCase(),load:()=>import("./index-D6A8P_xS.js").then(e=>e.java())}),o.of({...jd.find(e=>"Java"===e.name),name:Me.JAVA.toLowerCase()+`/${X.EDITOR}`,load:()=>import("./index-D6A8P_xS.js").then(e=>e.java())}),o.of({...jd.find(e=>"Python"===e.name),name:Me.PYTHON.toLowerCase(),load:()=>import("./index-BNvG4PUn.js").then(e=>e.python())}),o.of({...jd.find(e=>"Python"===e.name),name:Me.PYTHON.toLowerCase()+`/${X.EDITOR}`,load:()=>import("./index-BNvG4PUn.js").then(e=>e.python())}),o.of({...jd.find(e=>"JavaScript"===e.name),name:Me.JAVASCRIPT.toLowerCase(),load:()=>import("./index-BpFtavDh.js").then(e=>e.javascript())}),o.of({...jd.find(e=>"JavaScript"===e.name),name:Me.JAVASCRIPT.toLowerCase()+`/${X.EDITOR}`,load:()=>import("./index-BpFtavDh.js").then(e=>e.javascript())}),o.of({...jd.find(e=>"TypeScript"===e.name),name:Me.TYPESCRIPT.toLowerCase(),load:()=>import("./index-BpFtavDh.js").then(e=>e.javascript({typescript:!0}))}),o.of({...jd.find(e=>"JSX"===e.name),name:Me.JSX.toLowerCase(),load:()=>import("./index-BpFtavDh.js").then(e=>e.javascript({jsx:!0}))}),o.of({name:Me.MDX.toLowerCase(),alias:["mdx"],extensions:["mdx"],load:()=>Promise.all([import("./index-C_OMDe9Q.js"),import("./index-BpFtavDh.js")]).then(([{markdown:e},{javascript:t}])=>e({codeLanguages:[o.of({name:"javascript",load:async()=>t({jsx:!0})})]}))}),o.of({...jd.find(e=>"TSX"===e.name),name:Me.TSX.toLowerCase(),load:()=>import("./index-BpFtavDh.js").then(e=>e.javascript({typescript:!0,jsx:!0}))}),o.of({...jd.find(e=>"HTML"===e.name),name:Me.HTML.toLowerCase(),load:()=>import("./index-Dn0pnDCC.js").then(e=>e.html())}),o.of({...jd.find(e=>"JSON"===e.name),name:Me.JSON.toLowerCase(),load:()=>import("./index-vxKx70Pe.js").then(e=>e.json())}),o.of({...jd.find(e=>"Markdown"===e.name),name:Me.MARKDOWN.toLowerCase(),load:()=>import("./index-C_OMDe9Q.js").then(e=>e.markdown())}),o.of({...jd.find(e=>"LaTeX"===e.name),name:Me.LATEX.toLowerCase(),support:new i(s.define($d))}),o.of({name:Me.DOT.toLowerCase(),alias:["dot"],extensions:["dot"],load:()=>import("./index-CiHwAkdd.js").then(e=>e.dot())}),o.of({name:Me.DOT.toLowerCase()+`/${X.IMAGE}`,alias:["dot"],extensions:["dot"],load:()=>import("./index-CiHwAkdd.js").then(e=>e.dot())}),o.of({name:Me.MERMAID.toLowerCase(),alias:["mmd"],extensions:["mmd"],load:()=>import("./index-DBdTqY1b.js").then(e=>e.mermaid())}),o.of({name:Me.MERMAID.toLowerCase()+`/${X.IMAGE}`,alias:["mmd"],extensions:["mmd"],load:()=>import("./index-DBdTqY1b.js").then(e=>e.mermaid())}),o.of({name:Me.BASH.toLowerCase(),alias:["bash","sh","shell"],extensions:["sh","bash"],load:()=>import("./shell-BLav31RL.js").then(e=>new i(s.define(e.shell)))}),o.of({name:Me.TEXT.toLowerCase(),alias:["plaintext"],extensions:["txt","text"],support:yj})];function bj(e){let t=e.replace(/\n{3,}/g,"\n\n");return t=t.replace(/&#x20;/gi," "),t.replace(/\n+$/g,"")+"\n"}const xj=ce(function({value:t,onChange:n,setLoader:r},o){const i=he(n),{addNotification:s}=pe(),a=fe(e=>e.user.settings[Ne.THEME]),l=te(t),c=re(()=>t===l.current?0:Date.now(),[t]),d=me(e=>e.i18n.t),{get:u}=function(e,t=[]){const n=ie(_d),r=se(e,t);return ae(()=>{n.setEditorFactory(()=>r)},[n,r]),{loading:n.loading,get:()=>n.editor.current}}(n=>new hj({root:n,defaultValue:t,featureConfigs:{[hj.Feature.BlockEdit]:{blockHandle:{floatingUIOptions:{strategy:"fixed"}}},[hj.Feature.CodeMirror]:{renderLanguage(e,t){const[n,r]=e.split("/");return(t?"✔ ":"")+(Se[n.toUpperCase()]?.label??n)+d(r===X.EDITOR?" (render as code editor)":r===X.IMAGE?" (render as image)":"")},searchPlaceholder:"Find a language...",noResultText:"No language found"},[hj.Feature.ImageBlock]:{async onUpload(t){r(Ce.LOADING);const{status:n,message:o,content:i}=await Je(t,!1);return n===Ce.SUCCESS?(s({type:ge.SUCCESS,message:e(ve,{children:o})}),r(Ce.SUCCESS),i.imageUrl):(s({type:ge.ERROR,message:e(ve,{children:o})}),r(Ce.ERROR),"")},inlineUploadPlaceholderText:"???"}}}).editor.use(KR).use(eL).use(bN).use(YR).config(e=>{e.get(UR).markdownUpdated((e,t,n)=>{const r=bj(t);r!==bj(n)&&(i.current?.(r),l.current=r)}),e.update(XR.key,e=>({...e,uploader:gj(r,s),uploadWidgetFactory:(e,t)=>{const n=document.createElement("span");return Nl.widget(e,n,t)}})),e.update(jb.key,e=>({...e,languages:wj,extensions:[P(),...a===Ee.DARK?[L]:[mj]],previewToggleButton:()=>"edit",renderPreview:(e,t)=>{const[n,r]=e.split("/");return"latex"===n?.toLowerCase()&&t.length>0?function(e){return Q.renderToString(e,{throwOnError:!1,displayMode:!0})}(t):"mermaid"===n?.toLowerCase()&&r===X.IMAGE&&t.length>0?function(e){if("undefined"!=typeof document){const t=document.createElement("div");return t.className="mermaid",t.innerHTML=e,setTimeout(()=>{Le.initialize({startOnLoad:!1,theme:"default",look:"classic",layout:"dagre"}),Le.run({querySelector:".mermaid"})},0),t}return null}(t):r===X.IMAGE&&t.length>0?function(e,t){if("undefined"!=typeof document){const n=document.createElement("div"),r=Oe();n.id=r;const o=document.createElement("div");return o.textContent=t("loading graph"),o.style.fontStyle="italic",n.appendChild(o),Ke().then(n=>{try{const t=document.getElementById(r);t&&(t.innerHTML="",e.split("---").map(e=>{const r=n.renderSVGElement(e,{});t.appendChild(r)}))}catch(e){const n=document.getElementById(r);if(n){n.innerHTML="";const r=document.createElement("div");r.textContent=`${t("error rendering graph")}: ${e?.message||e}`,r.style.color="red",r.style.whiteSpace="pre-wrap",n.appendChild(r)}}}).catch(e=>{const n=document.getElementById(r);if(n){n.innerHTML="";const r=document.createElement("div");r.textContent=`${t("error initializing Viz.js")}: ${e?.message||e}`,r.style.color="red",n.appendChild(r)}}),n}return null}(t,d):null}})),e.set(vc,{bullet:"-",rule:"-"}),e.update(JR.key,e=>({...e,shouldAppend:()=>!1})),e.update(hc,e=>[...e,fj])}),[c,a,d]);return de(o,()=>({getSelectionMarkdown:()=>{const e=u();return e?e.action(e=>{const t=e.get(ac),n=e.get(Uc),r=e.get(Cc),{from:o,to:i,empty:s}=t.state.selection;if(s)return"";const a=t.state.doc.resolve(o),l=t.state.doc.resolve(i),c=a.depth>=1?a.before(1):0,d=l.depth>=1?l.after(1):t.state.doc.content.size,u=t.state.doc.slice(c,d);return n(r.node("doc",null,u.content))})??"":""},replaceSelectionWithMarkdown:e=>{const t=u();t&&t.action(t=>{const n=t.get(ac),r=t.get(Vc),{from:o,to:i}=n.state.selection,s=n.state.doc.resolve(o),a=n.state.doc.resolve(i),l=s.depth>=1?s.before(1):0,c=a.depth>=1?a.after(1):n.state.doc.content.size,d=r(e);n.dispatch(n.state.tr.replaceWith(l,c,d.content))})},highlightSelectionNodes:e=>{const t=u();t&&t.action(t=>{const n=t.get(ac),{from:r,to:o,empty:i}=n.state.selection;if(i)return;const s=n.state.doc.resolve(r),a=n.state.doc.resolve(o),l=s.depth>=1?s.before(1):0,c=a.depth>=1?a.after(1):n.state.doc.content.size,d=[];n.state.doc.nodesBetween(l,c,(e,t,r)=>r!==n.state.doc||(d.push({from:t,to:t+e.nodeSize}),!1));const u={ranges:d,className:e};n.dispatch(n.state.tr.setMeta(pj,u))})},clearHighlight:()=>{const e=u();e&&e.action(e=>{const t=e.get(ac);t.dispatch(t.state.tr.setMeta(pj,{clear:!0}))})}}),[u]),e("div",{className:"jk-md-math-milkdown-editor jk-md-math wh-100 pn-re jk-br-ie",children:e(Rd,{})})});function kj(t){const{value:n,onChange:r,setLoader:o,enableImageUpload:i}=t,s=te(null),{addNotification:a}=pe();return e("div",{className:"jk-br-ie",onPaste:i?async t=>{const n=t.clipboardData?.items;if(n){const i=[];for(const e of n)if("file"===e.kind){const t=e.getAsFile();t&&t.type.startsWith("image/")&&i.push(t)}if(i.length>0){t.stopPropagation(),t.preventDefault();let n="";o(Ce.LOADING);for(const t of i){const{status:r,message:o,content:i}=await Je(t,!1);r===Ce.SUCCESS?(a({type:ge.SUCCESS,message:e(ve,{children:o})}),n+=(n?"\n\n":"")+`![image alt](${i.imageUrl})`):a({type:ge.ERROR,message:e(ve,{children:o})})}o(Ce.NONE),(e=>{const t=s.current;if(!t)return;const n=t.selectionStart,o=t.selectionEnd,i=s.current?.value??"",a=i.substring(0,n)+e+i.substring(o);r?.(a),setTimeout(()=>{t.selectionStart=t.selectionEnd=n+e.length},0)})(n)}}}:void 0,children:e(ye,{ref:s,value:n,onChange:e=>{r?.(e)}})})}var Cj;!function(e){e.WYSIWYG="WYSIWYG",e.TEXT_PLAIN="TEXT_PLAIN"}(Cj||(Cj={}));const Sj=ue(function({enableDownload:t,enableTextPlain:n,setMode:r,mode:o}){const[,i]=Bd(),s=re(()=>[...n?[{icon:o===Cj.TEXT_PLAIN?e(Te,{size:"tiny",onClick:()=>r(Cj.WYSIWYG),"data-tooltip-id":"jk-tooltip","data-tooltip-content":"WYSIWYG","data-tooltip-place":"left"}):e(De,{size:"tiny",onClick:()=>r(Cj.TEXT_PLAIN),"data-tooltip-id":"jk-tooltip","data-tooltip-content":"view as text plain","data-tooltip-place":"left"})}]:[],...t?[{icon:e(Ie,{size:"tiny"}),buttons:[{icon:e(Ie,{size:"tiny"}),label:e(ve,{children:"md"}),onClick:()=>ke(new Blob([i()?.action(Id())??""],{type:"text/plain"}),"file.md")}]}]:[]],[t,n,i,o,r]);return e(we,{actionButtons:s,offset:4})});function Mj({mode:t}){const[n,r]=Bd(),[o,i]=ne(!1);return e(be,{isOpen:o,onClose:()=>i(!1),copyButtons:!0,onPickImageUrl:({imageUrl:e})=>{if(t===Cj.TEXT_PLAIN);else if(t===Cj.WYSIWYG){if(n)return;const t=r();if(!t)return;t.action(function(e,t=!1){return n=>{const r=n.get(ac),o=n.get(Vc)(e);if(!o)return;if(!t){const e=r.state.selection.content();return r.dispatch(r.state.tr.replaceSelection(new Zt(o.content,e.openStart,e.openEnd)).scrollIntoView())}const i=n.get(Cc),s=Un.fromSchema(i).serializeFragment(o.content),a=Bn.fromSchema(i).parseSlice(s),l=bi(a);l?r.dispatch(r.state.tr.replaceSelectionWith(l,!0)):r.dispatch(r.state.tr.replaceSelection(a))}}(`![image](${e})`)),i(!1)}}})}const Nj=()=>{const[e,t]=Bd();return le(()=>{if(!e){const e=t();e&&e.action(e=>{e.get(ac).focus()})}},[e,t]),null},Ej=ce(function(n,r){const{value:o,onChange:i,className:s,enableTextPlain:a=!1,enableDownload:l=!1,enableImageUpload:c=!1,onBlur:d}=n,[u,h]=ne(Ce.NONE),[p,f]=ne(Cj.WYSIWYG),m=te(null);de(r,()=>({getSelectionMarkdown:()=>m.current?.getSelectionMarkdown()??"",replaceSelectionWithMarkdown:e=>m.current?.replaceSelectionWithMarkdown(e),highlightSelectionNodes:e=>m.current?.highlightSelectionNodes(e),clearHighlight:()=>m.current?.clearHighlight()}),[]);const g=te(null),v=he(d);return le(()=>{function e(e){g.current&&!g.current.contains?.(e.target)&&v.current?.()}return document.addEventListener("mousedown",e),()=>{document.removeEventListener("mousedown",e)}},[g,v]),e(Ld,{children:t("div",{ref:g,className:xe("jk-md-math-editor wh-100 pn-re",s),onBlur:e=>{const t=e.relatedTarget;t&&!e.currentTarget.contains(t)&&d?.()},children:[!!d&&e(Nj,{}),u===Ce.LOADING&&e(Ae,{}),u===Ce.LOADING&&t("div",{className:"jk-loader-layer pn-ae jk-col",children:[e("div",{className:"jk-loader-layer pn-ae jk-overlay-backdrop",style:{opacity:.8,zIndex:1}}),e("div",{className:"jk-row",style:{zIndex:1,position:"sticky",margin:"0 auto",top:0,bottom:"50%",transform:"translate(0, 100%)"},children:t("div",{className:"jk-row bc-sf-md jk-pg-sm jk-br-ie",style:{alignItems:"baseline"},children:[e(ve,{className:"tt-se",children:"uploading images"}),"  ",e("div",{className:"dot-flashing"})]})})]}),e(Sj,{enableTextPlain:a,enableDownload:l,setMode:f,mode:p}),e(Mj,{mode:p}),p===Cj.WYSIWYG&&e(xj,{ref:m,value:o,onChange:i,setLoader:h,enableImageUpload:c}),p===Cj.TEXT_PLAIN&&e(kj,{value:o,onChange:i,setLoader:h,enableImageUpload:c})]})})});export{Ej as default};