ryugi-artifacts 1.98.0 → 1.98.1

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 (113) hide show
  1. package/dist/cli.cjs +160 -160
  2. package/dist/server.cjs +358 -358
  3. package/dist/viewer/{ActionBar-Biry6aL5.js → ActionBar-DWtp5Qmr.js} +1 -1
  4. package/dist/viewer/{ActionIcon-SqXLRjVo.js → ActionIcon-DjdRCXwQ.js} +1 -1
  5. package/dist/viewer/{AgentStatusPill-Cc74xoEj.js → AgentStatusPill-Duhhx2hz.js} +1 -1
  6. package/dist/viewer/{ArtboardLayout-9jjBpj8f.js → ArtboardLayout-BPslNA50.js} +7 -7
  7. package/dist/viewer/{ArtifactList-8-qgvG2C.js → ArtifactList-D3NG0mLO.js} +2 -2
  8. package/dist/viewer/{ArtifactModal-DiFkBbCg.js → ArtifactModal-DZb4hDro.js} +1 -1
  9. package/dist/viewer/{Avatar-CrOBu-Qd.js → Avatar-CbeqL_CL.js} +1 -1
  10. package/dist/viewer/{BottomSheet-DJa-XSjc.js → BottomSheet-D25rnHaJ.js} +1 -1
  11. package/dist/viewer/{Canvas-DyLfUjLf.js → Canvas-DlygiGRS.js} +1 -1
  12. package/dist/viewer/{CloudLegalNotice-BuOFMP8N.js → CloudLegalNotice-Bz-n_IjY.js} +1 -1
  13. package/dist/viewer/{CompositeItem-BPnQUHu9.js → CompositeItem-v6ZoNO20.js} +1 -1
  14. package/dist/viewer/{DocumentExportMenu-DKBR7jfK.js → DocumentExportMenu-B-YcC332.js} +1 -1
  15. package/dist/viewer/DocumentLayout-DEhrlnw5.js +2 -0
  16. package/dist/viewer/DocumentPage-BsiEp5VJ.js +3 -0
  17. package/dist/viewer/{DraggablePanel--O9gpTfN.js → DraggablePanel-CWSxO0Z4.js} +1 -1
  18. package/dist/viewer/DropdownMenu-CGfr1dYf.js +1 -0
  19. package/dist/viewer/{FieldControl-C3xPya4i.js → FieldControl-DGpeJj9m.js} +1 -1
  20. package/dist/viewer/{GroupVerdict-CWzivWx3.js → GroupVerdict-BMtgApuY.js} +1 -1
  21. package/dist/viewer/{HtmlLayout-BSX3W57A.js → HtmlLayout-DEDmkyJP.js} +1 -1
  22. package/dist/viewer/{Input-CJZTb9TF.js → Input-kOMqSdqr.js} +1 -1
  23. package/dist/viewer/{MenuTrigger-CutC0j9R.js → MenuTrigger-D6bgsLyh.js} +1 -1
  24. package/dist/viewer/{PhoneArtboardBar-Dd1T4XKJ.js → PhoneArtboardBar-cQkMjfNo.js} +1 -1
  25. package/dist/viewer/PhoneSheet-BFHnCaor.js +1 -0
  26. package/dist/viewer/Popover-SpQ2AaeF.js +1 -0
  27. package/dist/viewer/{PreviewLayout-wuyQZ8dH.js → PreviewLayout-CgeV3CcG.js} +2 -2
  28. package/dist/viewer/PublishMenu-CiPDZC83.js +1 -0
  29. package/dist/viewer/ReportLayout-DfJ9d1Yr.js +6 -0
  30. package/dist/viewer/{Segmented-C0FRvSfr.js → Segmented-Cv7ZOIW6.js} +1 -1
  31. package/dist/viewer/{Select-pZSV9wOB.js → Select-RTaSC0oo.js} +1 -1
  32. package/dist/viewer/{SlidesLayout-PnKVus8m.js → SlidesLayout-BmC2PDqi.js} +4 -4
  33. package/dist/viewer/SnapshotDocument-BPjCxjsJ.js +1 -0
  34. package/dist/viewer/{SplitFrame-C9fcDhx1.js → SplitFrame-BDFEELdh.js} +1 -1
  35. package/dist/viewer/StoryboardLayout-BQc4k_HF.js +1 -0
  36. package/dist/viewer/{StoryboardRender-wLk8mpKx.js → StoryboardRender-JcwM2MDT.js} +1 -1
  37. package/dist/viewer/ThreadView-DeOGk_TC.js +1 -0
  38. package/dist/viewer/{VerifyLayout-CQniWqtk.js → VerifyLayout-CM2vUe1T.js} +1 -1
  39. package/dist/viewer/{VirtualizedEditor-uWe43zaI-Anor5Nwh.js → VirtualizedEditor-uWe43zaI-BRcAvxeK.js} +1 -1
  40. package/dist/viewer/{VirtualizedRenderer-C_d95FXi-B_irCOvp.js → VirtualizedRenderer-C_d95FXi-DxT29thk.js} +1 -1
  41. package/dist/viewer/{WarningsBadge-DdEgrzxp.js → WarningsBadge-DyOdkZ7T.js} +1 -1
  42. package/dist/viewer/WhiteboardEditor-cZ32fLqJ-BLzZ145n.js +22 -0
  43. package/dist/viewer/{WhiteboardLayout-CV5kBRX6.js → WhiteboardLayout-CF1lJ168.js} +1 -1
  44. package/dist/viewer/{WritingCursor-BjkqKjHd.js → WritingCursor-CPLktLAf.js} +1 -1
  45. package/dist/viewer/{api-CNaIyZwq.js → api-BAxn6SRB.js} +1 -1
  46. package/dist/viewer/{artifact-list-Cc-9ngqf.js → artifact-list-BK2hcnfW.js} +1 -1
  47. package/dist/viewer/{auto-publish-BVAcCtYl.js → auto-publish-BKGFl6OJ.js} +1 -1
  48. package/dist/viewer/channel-ChZ3PTkq.js +4 -0
  49. package/dist/viewer/{dist-D9BU2zVj.js → dist--0_vgHPU.js} +1 -1
  50. package/dist/viewer/{dist-BKsX1kgy.js → dist-5cNPnySQ.js} +1 -1
  51. package/dist/viewer/{dist-sCgxmP2r.js → dist-B2hz7vjm.js} +1 -1
  52. package/dist/viewer/{dist-7SpQ0VmF.js → dist-BC6CmHwt.js} +1 -1
  53. package/dist/viewer/{dist-Bd3puggc.js → dist-BHkZJk_e.js} +1 -1
  54. package/dist/viewer/{dist-w5qy25IO.js → dist-BPDQlu-c.js} +1 -1
  55. package/dist/viewer/{dist-D3CF7h1o.js → dist-BvozLH61.js} +1 -1
  56. package/dist/viewer/{dist-LLXFtXcU.js → dist-BzJkOSSc.js} +1 -1
  57. package/dist/viewer/{dist-CZeYzkEf.js → dist-C2rh2R7r.js} +1 -1
  58. package/dist/viewer/{dist-B3EYxWxJ.js → dist-CGajTBk9.js} +1 -1
  59. package/dist/viewer/{dist-xhqxlzoc.js → dist-CLexpG_J.js} +1 -1
  60. package/dist/viewer/{dist-CRmGGW-3.js → dist-CR0zX7Bp.js} +1 -1
  61. package/dist/viewer/{dist-Cgge_pG9.js → dist-CUJ2XvSA.js} +1 -1
  62. package/dist/viewer/{dist-DWl-moVY.js → dist-CoeGaEBP.js} +1 -1
  63. package/dist/viewer/{dist-DP5xwgvs.js → dist-D0sBjJsT.js} +1 -1
  64. package/dist/viewer/{dist--m0UR3qt.js → dist-D4S167fr.js} +1 -1
  65. package/dist/viewer/{dist-C7tR88km.js → dist-DOXCCP97.js} +1 -1
  66. package/dist/viewer/{dist-CY9z7ymj.js → dist-DeWoQYEi.js} +1 -1
  67. package/dist/viewer/{dist-DEyaWQuj.js → dist-DhrfZoIM.js} +1 -1
  68. package/dist/viewer/{dist-C42NAGpB.js → dist-DpW71NzV.js} +2 -2
  69. package/dist/viewer/{dist-CmJ72-w2.js → dist-jWJVIaq9.js} +1 -1
  70. package/dist/viewer/{dist-RflTLYgB.js → dist-nbZF_bbc.js} +1 -1
  71. package/dist/viewer/{dist-fznba_JF.js → dist-qkhnSsz9.js} +1 -1
  72. package/dist/viewer/{dist-Aw1suV-i.js → dist-tXqD8pO8.js} +1 -1
  73. package/dist/viewer/{editor-XYSNzDA1.js → editor-Bmn3nE8d.js} +9 -9
  74. package/dist/viewer/{icons-PkMKxr1Y.js → icons-CjIZOElv.js} +1 -1
  75. package/dist/viewer/index.html +3 -3
  76. package/dist/viewer/index.js +2 -2
  77. package/dist/viewer/index5.css +4 -0
  78. package/dist/viewer/{Composer-DJQ0JcGC.js → labels-BJippP37.js} +1 -1
  79. package/dist/viewer/{local-split-host-CN8vV6GA.js → local-split-host-CzJU7wm6.js} +1 -1
  80. package/dist/viewer/preview.html +5 -5
  81. package/dist/viewer/preview.js +1 -1
  82. package/dist/viewer/{printDocument-DYh63cZB.js → printDocument-urwKBSr9.js} +1 -1
  83. package/dist/viewer/read-resolutions-BsCOpZ5l.js +1 -0
  84. package/dist/viewer/{ref-C9JJsFNs.js → ref-Cedo6wF_.js} +1 -1
  85. package/dist/viewer/{route-CN-OwC39.js → route-DKb67VAS.js} +2 -2
  86. package/dist/viewer/{route-messages-CdanDnM2.js → route-messages-DTBG4zPi.js} +1 -1
  87. package/dist/viewer/{settings-Cm1axXsb.js → settings-CsXL-wDx.js} +1 -1
  88. package/dist/viewer/{snap-BVO6kr4g.js → snap-Cv3gKs1G.js} +1 -1
  89. package/dist/viewer/{split-BxEdVxwG.js → split-DZQB_dA1.js} +2 -2
  90. package/dist/viewer/{tokens.stylex-B1iGVCL9.js → tokens.stylex-B_MFlNTz.js} +1 -1
  91. package/dist/viewer/{url-CM6ePw4h.js → url-joPIox6x.js} +2 -2
  92. package/dist/viewer/{useArtifactFeed-CP3JDUh7.js → useArtifactFeed-BZ7I48hI.js} +1 -1
  93. package/dist/viewer/{useCloudStatus-7g45b5TM.js → useCloudStatus-BoGRwUZB.js} +1 -1
  94. package/dist/viewer/{useScrollLock-Dgg_Xdnj.js → useScrollLock-BdnvUdlj.js} +1 -1
  95. package/dist/viewer/{useStoryboardData-CHBJMW-l.js → useStoryboardData-CbvxUp-3.js} +1 -1
  96. package/dist/viewer/{useTranslation--h_e4r6x.js → useTranslation-BK2QkHSS.js} +1 -1
  97. package/dist/viewer/{useTriggerFocusGuards-8qZvK-3_.js → useTriggerFocusGuards-B2ToX9xu.js} +1 -1
  98. package/dist/viewer/{view-uKRKLD0h.js → view-C8MCT5AM.js} +1 -1
  99. package/dist/viewer/{viewport-CFJHn_Y6-51w4nIby.js → viewport-CFJHn_Y6-DxM2QUCB.js} +1 -1
  100. package/package.json +1 -1
  101. package/dist/viewer/DocumentLayout-Davg8V6g.js +0 -2
  102. package/dist/viewer/DocumentPage-BMxunv6j.js +0 -3
  103. package/dist/viewer/DropdownMenu-Bkdj7OgV.js +0 -1
  104. package/dist/viewer/PhoneSheet-DEREJN8c.js +0 -1
  105. package/dist/viewer/Popover-BalXdBOr.js +0 -1
  106. package/dist/viewer/PublishMenu-BF6oURW1.js +0 -1
  107. package/dist/viewer/ReportLayout-BXIP9UbU.js +0 -6
  108. package/dist/viewer/SnapshotDocument-CEsSzNSO.js +0 -1
  109. package/dist/viewer/StoryboardLayout-wz2BkR4c.js +0 -1
  110. package/dist/viewer/ThreadView-CX0IPnrz.js +0 -1
  111. package/dist/viewer/WhiteboardEditor-cZ32fLqJ-DwX13Gis.js +0 -22
  112. package/dist/viewer/channel-C75RHrCF.js +0 -4
  113. package/dist/viewer/read-resolutions-DKpamrGD.js +0 -1
@@ -0,0 +1,22 @@
1
+ import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{b as t,v as n,w as r}from"./route-DKb67VAS.js";import{t as i}from"./react-DlmbjZJV.js";import{An as a,Ct as o,Dn as s,Dr as c,Dt as l,En as u,Er as d,Et as f,G as p,J as m,K as h,Nn as g,On as _,Or as v,Ot as y,Qn as b,St as x,Tn as S,Tt as C,X as w,Xn as T,Y as E,Z as D,Zn as ee,at as te,bn as ne,bt as re,ct as ie,ft as ae,gt as oe,ht as se,ir as ce,it as le,jn as ue,jt as de,kn as fe,kr as pe,lt as me,mr as he,ot as ge,pt as _e,q as ve,st as ye,vr as be,vt as xe,wn as Se,wr as Ce,wt as we,xn as Te,xt as Ee,yt as De}from"./url-joPIox6x.js";import{t as Oe}from"./jsx-runtime-LKYXHABd.js";import{$ as ke,B as Ae,G as je,Q as Me,S as Ne,T as Pe,V as Fe,X as Ie,Z as Le,_ as Re,c as ze,d as Be,et as Ve,h as He,k as Ue,nt as We,o as Ge,q as Ke,rt as qe,tt as Je,w as Ye,x as Xe,z as Ze}from"./mergeRefs-DM4719JU.js";import{An as Qe,C as $e,Cn as et,E as tt,Gt as nt,I as rt,In as it,Jn as at,K as ot,Nt as st,Pt as ct,R as lt,Tn as ut,Ut as dt,Vn as ft,Z as pt,Zn as mt,an as ht,b as gt,bn as _t,dt as vt,g as yt,gn as bt,hn as xt,in as St,n as Ct,on as wt,ot as Tt,pn as Et,rn as Dt,un as Ot,z as kt}from"./useScrollLock-BdnvUdlj.js";import{Tt as At}from"./MotionConfigContext-B3czw3wn.js";import{$ as jt,B as Mt,C as Nt,F as Pt,H as Ft,I as It,J as Lt,K as Rt,L as zt,P as Bt,Q as Vt,R as Ht,S as Ut,T as Wt,U as Gt,V as Kt,X as qt,Y as Jt,Z as Yt,_ as Xt,a as Zt,at as Qt,b as $t,c as en,d as tn,et as nn,f as O,g as rn,h as an,i as on,it as sn,l as cn,lt as ln,m as un,n as dn,o as fn,p as pn,q as mn,r as hn,rt as gn,s as _n,st as vn,tt as yn,ut as bn,v as xn,x as Sn,y as Cn,z as wn}from"./Popover-SpQ2AaeF.js";import{t as k}from"./arrow-up-kdcWAnXX.js";import{d as Tn,f as En}from"./useTriggerFocusGuards-B2ToX9xu.js";import{n as Dn,t as On}from"./type-DA3yqyzM.js";import{a as kn,i as An,n as jn,r as Mn,t as Nn}from"./minus-YVaskeP9.js";import{n as Pn,r as Fn,t as In}from"./mouse-pointer-2-DZzayYM4.js";import{t as Ln}from"./code-DZDLeByL.js";import{a as Rn,c as zn,i as Bn,n as Vn,o as Hn,r as Un,s as Wn,t as Gn}from"./text-align-start-CvIfWAwj.js";import{a as Kn,i as qn,n as Jn,t as Yn}from"./ruler-C-6kncvn.js";import{t as Xn}from"./image-DSbKs3OG.js";import{n as Zn,r as Qn,t as $n}from"./zoom-out-DsqNailP.js";import{t as er}from"./maximize-2-BEWXAYRs.js";import{i as tr,n as nr,r as rr,t as ir}from"./stringifyLocale-Dx2d4AZJ.js";import{n as ar,t as or}from"./trash-Px68lJtC.js";import{t as sr}from"./MenuTrigger-D6bgsLyh.js";var cr={name:`activity`,size:24,node:[[`path`,{d:`M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2`,key:`169zse`}]]};cr.node;var lr=At(cr),ur={name:`arrow-down-to-line`,size:24,node:[[`path`,{d:`M12 17V3`,key:`1cwfxf`}],[`path`,{d:`m6 11 6 6 6-6`,key:`12ii2o`}],[`path`,{d:`M19 21H5`,key:`150jfl`}]]};ur.node;var dr=At(ur),fr={name:`arrow-up-to-line`,size:24,node:[[`path`,{d:`M5 3h14`,key:`7usisc`}],[`path`,{d:`m18 13-6-6-6 6`,key:`1kf1n9`}],[`path`,{d:`M12 7v14`,key:`1akyts`}]]};fr.node;var pr=At(fr),mr={name:`diamond`,size:24,node:[[`path`,{d:`M2.7 10.3a2.41 2.41 0 0 0 0 3.41l7.59 7.59a2.41 2.41 0 0 0 3.41 0l7.59-7.59a2.41 2.41 0 0 0 0-3.41l-7.59-7.59a2.41 2.41 0 0 0-3.41 0Z`,key:`1f1r0c`}]]};mr.node;var hr=At(mr),gr={name:`dot`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}]]};gr.node;var _r=At(gr),vr={name:`equal`,size:24,node:[[`line`,{x1:`5`,x2:`19`,y1:`9`,y2:`9`,key:`1nwqeh`}],[`line`,{x1:`5`,x2:`19`,y1:`15`,y2:`15`,key:`g8yjpy`}]]};vr.node;var yr=At(vr),br={name:`grip-horizontal`,size:24,node:[[`circle`,{cx:`12`,cy:`9`,r:`1`,key:`124mty`}],[`circle`,{cx:`19`,cy:`9`,r:`1`,key:`1ruzo2`}],[`circle`,{cx:`5`,cy:`9`,r:`1`,key:`1a8b28`}],[`circle`,{cx:`12`,cy:`15`,r:`1`,key:`1e56xg`}],[`circle`,{cx:`19`,cy:`15`,r:`1`,key:`1a92ep`}],[`circle`,{cx:`5`,cy:`15`,r:`1`,key:`5r1jwy`}]]};br.node;var xr=At(br),Sr={name:`group`,size:24,node:[[`path`,{d:`M3 7V5c0-1.1.9-2 2-2h2`,key:`adw53z`}],[`path`,{d:`M17 3h2c1.1 0 2 .9 2 2v2`,key:`an4l38`}],[`path`,{d:`M21 17v2c0 1.1-.9 2-2 2h-2`,key:`144t0e`}],[`path`,{d:`M7 21H5c-1.1 0-2-.9-2-2v-2`,key:`rtnfgi`}],[`rect`,{width:`7`,height:`5`,x:`7`,y:`7`,rx:`1`,key:`1eyiv7`}],[`rect`,{width:`7`,height:`5`,x:`10`,y:`12`,rx:`1`,key:`1qlmkx`}]]};Sr.node;var Cr=At(Sr),wr={name:`hash`,size:24,node:[[`line`,{x1:`4`,x2:`20`,y1:`9`,y2:`9`,key:`4lhtct`}],[`line`,{x1:`4`,x2:`20`,y1:`15`,y2:`15`,key:`vyu0kd`}],[`line`,{x1:`10`,x2:`8`,y1:`3`,y2:`21`,key:`1ggp8o`}],[`line`,{x1:`16`,x2:`14`,y1:`3`,y2:`21`,key:`weycgp`}]]};wr.node;var Tr=At(wr),Er={name:`highlighter`,size:24,node:[[`path`,{d:`m9 11-6 6v3h9l3-3`,key:`1a3l36`}],[`path`,{d:`m22 12-4.6 4.6a2 2 0 0 1-2.8 0l-5.2-5.2a2 2 0 0 1 0-2.8L14 4`,key:`14a9rk`}]]};Er.node;var Dr=At(Er),Or={name:`letter-h`,size:24,node:[[`path`,{d:`M18 20V4`,key:`o2hl4u`}],[`path`,{d:`M6 12H18`,key:`1fx1vx`}],[`path`,{d:`M6 20V4`,key:`1w1bmo`}]],aliases:[`heading`]};Or.node;var kr=At(Or),Ar={name:`list-ordered`,size:24,node:[[`path`,{d:`M11 5h10`,key:`1cz7ny`}],[`path`,{d:`M11 12h10`,key:`1438ji`}],[`path`,{d:`M11 19h10`,key:`11t30w`}],[`path`,{d:`M4 4h1v5`,key:`10yrso`}],[`path`,{d:`M4 9h2`,key:`r1h2o0`}],[`path`,{d:`M6.5 20H3.4c0-1 2.6-1.925 2.6-3.5a1.5 1.5 0 0 0-2.6-1.02`,key:`xtkcd5`}]]};Ar.node;var jr=At(Ar),Mr={name:`menu`,size:24,node:[[`path`,{d:`M4 5h16`,key:`1tepv9`}],[`path`,{d:`M4 12h16`,key:`1lakjw`}],[`path`,{d:`M4 19h16`,key:`1djgab`}]]};Mr.node;var Nr=At(Mr),Pr={name:`move-right`,size:24,node:[[`path`,{d:`M18 8L22 12L18 16`,key:`1r0oui`}],[`path`,{d:`M2 12H22`,key:`1m8cig`}]]};Pr.node;var Fr=At(Pr),Ir={name:`pencil`,size:24,node:[[`path`,{d:`M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z`,key:`1a8usu`}],[`path`,{d:`m15 5 4 4`,key:`1mk7zo`}]]};Ir.node;var Lr=At(Ir),Rr={name:`scan-search`,size:24,node:[[`path`,{d:`M3 7V5a2 2 0 0 1 2-2h2`,key:`aa7l1z`}],[`path`,{d:`M17 3h2a2 2 0 0 1 2 2v2`,key:`4qcy5o`}],[`path`,{d:`M21 17v2a2 2 0 0 1-2 2h-2`,key:`6vwrx8`}],[`path`,{d:`M7 21H5a2 2 0 0 1-2-2v-2`,key:`ioqczr`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}],[`path`,{d:`m16 16-1.9-1.9`,key:`1dq9hf`}]]};Rr.node;var zr=At(Rr),Br={name:`slash`,size:24,node:[[`path`,{d:`M22 2 2 22`,key:`y4kqgn`}]]};Br.node;var Vr=At(Br),Hr={name:`spline`,size:24,node:[[`circle`,{cx:`19`,cy:`5`,r:`2`,key:`mhkx31`}],[`circle`,{cx:`5`,cy:`19`,r:`2`,key:`v8kfzx`}],[`path`,{d:`M5 17A12 12 0 0 1 17 5`,key:`1okkup`}]]};Hr.node;var Ur=At(Hr),Wr={name:`squircle`,size:24,node:[[`path`,{d:`M12 3c7.2 0 9 1.8 9 9s-1.8 9-9 9-9-1.8-9-9 1.8-9 9-9`,key:`garfkc`}]]};Wr.node;var Gr=At(Wr),Kr={name:`strikethrough`,size:24,node:[[`path`,{d:`M16 4H9a3 3 0 0 0-2.83 4`,key:`43sutm`}],[`path`,{d:`M14 12a4 4 0 0 1 0 8H6`,key:`nlfj13`}],[`line`,{x1:`4`,x2:`20`,y1:`12`,y2:`12`,key:`1e0a9i`}]]};Kr.node;var qr=At(Kr),Jr={name:`ungroup`,size:24,node:[[`rect`,{x:`11`,y:`14`,width:`10`,height:`7`,rx:`2`,key:`nfm8rk`}],[`rect`,{x:`3`,y:`3`,width:`10`,height:`7`,rx:`2`,key:`1ljebb`}]]};Jr.node;var Yr=At(Jr),Xr={name:`waypoints`,size:24,node:[[`path`,{d:`m10.586 5.414-5.172 5.172`,key:`4mc350`}],[`path`,{d:`m18.586 13.414-5.172 5.172`,key:`8c96vv`}],[`path`,{d:`M6 12h12`,key:`8npq4p`}],[`circle`,{cx:`12`,cy:`20`,r:`2`,key:`144qzu`}],[`circle`,{cx:`12`,cy:`4`,r:`2`,key:`muu5ef`}],[`circle`,{cx:`20`,cy:`12`,r:`2`,key:`1xzzfp`}],[`circle`,{cx:`4`,cy:`12`,r:`2`,key:`1hvhnz`}]]};Xr.node;var Zr=At(Xr),A=e(i(),1),j=Oe(),Qr=function(e){let{delay:t,closeDelay:n,timeout:r=400}=e,i=A.useMemo(()=>({open:t,close:n}),[t,n]);return(0,j.jsx)(qt.Provider,{value:t,children:(0,j.jsx)(yn,{delay:i,timeoutMs:r,children:e.children})})},$r=class extends nn{constructor(){super(Vt(),`Tooltip`)}open(e){this.openByTrigger(e)}close(){this.closePopup()}get isOpen(){return this.attachedStore?.select(`open`)??!1}};function ei(){return new $r}var ti=A.createContext(void 0);function ni(){let e=A.useContext(ti);if(e===void 0)throw Error(Le(34));return e}var ri=A.forwardRef(function(e,t){let{render:n,className:r,value:i,defaultValue:a,onValueChange:o,disabled:s=!1,style:c,"aria-labelledby":l,...u}=e,[d,f]=A.useState(void 0),[p,m]=pe({controlled:i,default:a,name:`MenuRadioGroup`}),h=We((e,t)=>{o?.(e,t),t.isCanceled||m(e)}),g=je(`div`,e,{state:{disabled:s},ref:t,props:{role:`group`,"aria-labelledby":l??d,"aria-disabled":s||void 0,...u}}),_=A.useMemo(()=>({value:p,setValue:h,disabled:s}),[p,h,s]);return(0,j.jsx)(Ee.Provider,{value:f,children:(0,j.jsx)(ti.Provider,{value:_,children:g})})}),ii=A.memo(A.forwardRef(function(e,t){let n=l()?.RadioGroup??ri;return(0,j.jsx)(n,{...e,ref:t})})),ai=A.createContext(void 0);function oi(){let e=A.useContext(ai);if(e===void 0)throw Error(Le(35));return e}var si=A.forwardRef(function(e,t){let{render:n,className:r,id:i,label:a,nativeButton:o=!1,disabled:s=!1,closeOnClick:l=!1,value:u,style:d,...p}=e,{store:m}=de(),{value:h,setValue:g,disabled:_}=ni(),v=c({guess:!0,label:a}),y=Fe(i),b=m.useState(`isActive`,v.index),x=m.useState(`floatingNodeId`),S=m.useState(`itemProps`),w=m.useState(`disabled`),T=s||_||w,E=h===u,{getItemProps:D,itemRef:ee}=f({closeOnClick:l,disabled:T,highlighted:b,id:y,store:m,nativeButton:o,nodeId:x,itemMetadata:C}),te=A.useMemo(()=>({disabled:T,highlighted:b,checked:E}),[T,b,E]);function ne(e){let t=Ze(Pe,e.nativeEvent,void 0,{preventUnmountOnClose:Je});g(u,t)}let re=je(`div`,e,{state:te,stateAttributesMapping:we,props:[S,{role:`menuitemradio`,"aria-checked":E,onClick:ne},p,D],ref:[ee,t,v.ref]});return(0,j.jsx)(ai.Provider,{value:te,children:re})}),ci=A.forwardRef(function(e,t){let n=y(e,t);return n.visible?(0,j.jsx)(si,{...e,ref:n.ref}):null}),li=A.forwardRef(function(e,t){let{render:n,className:r,style:i,keepMounted:a=!1,...o}=e,s=oi(),c=A.useRef(null),{transitionStatus:l,mounted:u,setMounted:d}=mt(s.checked);_t({batch:!0,enabled:!s.checked,open:s.checked,ref:c,onComplete(){s.checked||d(!1)}});let f={checked:s.checked,disabled:s.disabled,highlighted:s.highlighted,transitionStatus:l};return je(`span`,e,{state:f,stateAttributesMapping:we,ref:[t,c],props:{"aria-hidden":!0,...o},enabled:a||u})}),ui=e(r(),1),di=new Map;function fi(e={}){let{locale:t,...n}=e,r={usage:`search`,sensitivity:`base`,ignorePunctuation:!0,...n},i=`${ir(t)}|${JSON.stringify(r)}`,a=di.get(i);if(a)return a;let o=new Intl.Collator(t,r),s={contains(e,t,n){if(!t)return!0;let r=Ft(e,n);for(let e=0;e<=r.length-t.length;e+=1)if(o.compare(r.slice(e,e+t.length),t)===0)return!0;return!1},startsWith(e,t,n){if(!t)return!0;let r=Ft(e,n);return o.compare(r.slice(0,t.length),t)===0},endsWith(e,t,n){if(!t)return!0;let r=Ft(e,n),i=t.length;return r.length>=i&&o.compare(r.slice(r.length-i),t)===0}};return di.set(i,s),s}var pi=`⁠`;function mi(e){let t=e.ownerDocument.createTreeWalker(e,NodeFilter.SHOW_TEXT),n=null;for(;t.nextNode();){let e=t.currentNode;e.nodeValue!==``&&(n=e)}return n}function hi(e=!0){let t=ze(),n=A.useRef(null);return A.useEffect(()=>{if(!e||bt)return;let r=n.current;if(r==null)return;let i=mi(r);if(i==null)return;let a=i.data,o=`${a}${pi}`;return i.nodeValue=o,t.start(200,()=>{i.nodeValue===o&&(i.nodeValue=a)}),()=>{t.clear(),i.nodeValue===o&&(i.nodeValue=a)}},[e,n,t]),n}function gi(e,t,n,r,i,a,o,s,c,l=2){let u=Tt(n.current,{event:e,orientation:r,loopFocus:i,rtl:a,cols:l,disabledIndices:o,minIndex:s,maxIndex:c,prevIndex:t>c?s:t,stopEvent:!0});return vt(n.current,u)?void 0:u}var _i=A.createContext(void 0),vi=A.createContext(void 0),yi=A.createContext(void 0),bi=A.createContext(!1),xi=A.createContext(``);function Si(){let e=A.useContext(_i);if(!e)throw Error(Le(22));return e}function Ci(){let e=A.useContext(vi);if(!e)throw Error(Le(23));return e}function wi(){let e=A.useContext(yi);if(!e)throw Error(Le(24));return e}function Ti(){return A.useContext(xi)}function Ei(){return A.useContext(bi)}var Di={id:e=>e.id,labelId:e=>e.labelId,items:e=>e.items,selectedValue:e=>e.selectedValue,hasSelectionChips:e=>{let t=e.selectedValue;return Array.isArray(t)&&t.length>0},hasSelectedValue:e=>{let{selectedValue:t,selectionMode:n}=e;return t==null?!1:n===`multiple`&&Array.isArray(t)?t.length>0:!0},hasNullItemLabel:(e,t)=>t?Mt(e.items):!1,open:e=>e.open,mounted:e=>e.mounted,forceMounted:e=>e.forceMounted,inline:e=>e.inline,activeIndex:e=>e.activeIndex,selectedIndex:e=>e.selectedIndex,isActive:(e,t)=>e.activeIndex===t,isSelected:(e,t)=>{let n=e.isItemEqualToValue,r=e.selectedValue;return Array.isArray(r)?r.some(e=>rn(t,e,n)):rn(t,r,n)},transitionStatus:e=>e.transitionStatus,popupProps:e=>e.popupProps,listProps:e=>e.listProps,inputProps:e=>e.inputProps,triggerProps:e=>e.triggerProps,itemRoot:e=>e.itemRoot,positionerElement:e=>e.positionerElement,listElement:e=>e.listElement,popupId:e=>e.popupId,triggerElement:e=>e.triggerElement,inputElement:e=>e.inputElement,inputGroupElement:e=>e.inputGroupElement,popupSide:e=>e.popupSide,openMethod:e=>e.openMethod,inputInsidePopup:e=>e.inputInsidePopup,inputOwnsFormValue:e=>e.inputOwnsFormValue,selectionMode:e=>e.selectionMode,name:e=>e.name,form:e=>e.form,disabled:e=>e.disabled,readOnly:e=>e.readOnly,required:e=>e.required,grid:e=>e.grid,virtualized:e=>e.virtualized,itemToStringLabel:e=>e.itemToStringLabel,isItemEqualToValue:e=>e.isItemEqualToValue,modal:e=>e.modal,autoHighlight:e=>e.autoHighlight};function Oi(e){return e==null?void 0:`${e}-popup`}function ki(e,t){return(n,r)=>n!=null&&e.contains(n,r,t)}var Ai=fi;function ji(e,t=!1){let{overflowY:n}=Qe(e);return n!==`auto`&&n!==`scroll`?!1:t?e.clientHeight>0:e.scrollHeight>e.clientHeight}var Mi=Symbol(`none`),Ni={value:Mi,index:-1};function Pi(e,t,n){let r=e.get(t);if(r!==void 0||n===Xt)return r;for(let[r,i]of e)if(rn(r,t,n))return i}function Fi(e){let{id:t,onOpenChangeComplete:n,defaultSelectedValue:r=null,selectedValue:i,onSelectedValueChange:o,defaultInputValue:s,inputValue:c,open:l,defaultOpen:d=!1,selectionMode:f,onItemHighlighted:p,name:m,form:h,disabled:g=!1,readOnly:_=!1,required:v=!1,inputRef:y,grid:b=!1,items:x,filteredItems:C,filter:w,filterQuery:T,openOnInputClick:E=!0,autoHighlight:D=!1,keepHighlight:ee=!1,highlightItemOnHover:te=!0,loopFocus:re=!0,itemToStringLabel:ae,itemToStringValue:oe,isItemEqualToValue:se=Xt,virtualized:le=!1,inline:ue=!1,fillInputOnItemPress:de=!0,modal:fe=!1,limit:ge=-1,autoComplete:_e=`list`,formAutoComplete:ve,locale:ye,submitOnItemClick:xe=!1}=e,{clearErrors:Se}=S(),{setDirty:Ce,validityData:we,setFilled:Ee,name:De,disabled:Oe,setTouched:je,setFocused:Fe,validationMode:ze,validation:Be}=a(),He=ce(),Ge=Te({id:t}),Qe=Ai({locale:ye}),nt=Array.isArray(x)?null:x;if(nt&&typeof nt.label!=`function`)throw Error(Le(100));let at=nt?nt.data:x,ot=nt?.value,ut=ot?void 0:at,dt=A.useMemo(()=>{if(!C||!ot)return;let e=wn(C),t=e.map(ot),n;return{values:t,findItem(r,i){if(!n){n=new Map;for(let r=0;r<t.length;r+=1)n.has(t[r])||n.set(t[r],e[r])}return Pi(n,r,i)}}},[C,ot]),pt=A.useMemo(()=>nt?e=>nt.label(e,se,e=>{let t=dt?.findItem(e,se);return t==null?Ft(e,ae):nt.itemLabel(t)}):ae,[nt,ae,dt,se]),mt=A.useMemo(()=>nt?Object.assign(e=>nt.itemLabel(e),{selected:e=>Ft(e,pt)}):ae,[nt,pt,ae]);function _t(e){return Ft(e,pt)}let[vt,yt]=A.useState(!1),[bt,xt]=A.useState(null),Ct=A.useRef(bt),Tt=A.useRef([]),Et=A.useRef([]),Ot=A.useRef(null),kt=A.useRef(null),At=A.useRef(null),Mt=A.useRef(null),Pt=A.useRef(null),It=A.useRef(!1),Lt=A.useRef(null),Rt=A.useRef(null),zt=A.useRef(null),Bt=A.useRef(Ni),Vt=A.useRef(null),Ht=A.useRef([]),Ut=A.useRef(null),qt=Oe||g,Jt=De??m,Yt=f===`multiple`,Zt=f===`single`,Qt=c!==void 0||s!==void 0,en=at!==void 0,tn=C!==void 0,nn;nn=D===`always`?`always`:D?`input-change`:!1;let[O,an]=pe({controlled:i,default:Yt?r??ke:r,name:`Combobox`,state:`selectedValue`}),on=A.useMemo(()=>w===null?()=>!0:w===void 0?ki(Qe,mt):w,[w,Qe,mt]),sn=qe(()=>Qt?s??``:Zt?_t(O):``).current,[cn,ln]=pe({controlled:c,default:sn,name:`Combobox`,state:`inputValue`}),[un,dn]=pe({controlled:l,default:d,name:`Combobox`,state:`open`}),fn=Kt(at),pn=!un&&bt!==null?bt:String(cn).trim(),mn=Zt?_t(O):``,hn=Zt&&!vt&&pn!==``&&mn.length===pn.length&&Qe.contains(mn,pn),gn=hn?``:T??pn,_n=en&&tn&&hn&&(!nt||nt.hasValue(O,se)),vn=A.useMemo(()=>at?wn(at):ke,[at]),yn=A.useMemo(()=>{if(C&&!_n)return C;if(!at)return ke;if(fn){let e=at,t=[],n=0;for(let r of e){if(ge>-1&&n>=ge)break;let e=ge>-1?ge-n:1/0,i=gn===``?r.items.slice(0,e):[];if(gn!==``)for(let t of r.items){if(i.length>=e)break;on(t,gn,mt)&&i.push(t)}if(i.length>0){let e={...r,items:i};t.push(e),n+=i.length}}return t}if(gn===``)return ge>-1?vn.slice(0,ge):vn;let e=[];for(let t of vn){if(ge>-1&&e.length>=ge)break;on(t,gn,mt)&&e.push(t)}return e},[C,_n,at,fn,gn,ge,on,mt,vn]),bn=A.useMemo(()=>{if(dt&&yn===C)return dt.values;let e=wn(yn);return ot?e.map(e=>ot(e)):e},[yn,C,dt,ot]),k=qe(()=>{let e=null;return ue&&un&&en&&f!==`none`&&(e=Cn(bn,O,se,Yt)),new gt({id:Ge,labelId:void 0,selectedValue:O,open:un,items:ut,selectionMode:f,name:Jt,form:h,disabled:qt,readOnly:_,required:v,grid:b,virtualized:le,openOnInputClick:E,itemToStringLabel:pt,isItemEqualToValue:se,modal:fe,autoHighlight:nn,submitOnItemClick:xe,hasInputValue:Qt,mounted:!1,forceMounted:!1,transitionStatus:`idle`,inline:ue,activeIndex:null,selectedIndex:e,popupProps:{},listProps:{},inputProps:{},triggerProps:{},itemRoot:{props:Ve,id:Ge,selectionMode:f,disabled:qt,readOnly:_,isItemEqualToValue:se},positionerElement:null,listElement:null,popupId:void 0,triggerElement:null,inputElement:null,inputGroupElement:null,popupSide:null,openMethod:null,inputInsidePopup:!0,inputOwnsFormValue:f===`none`},{onOpenChangeComplete:Je,setOpen:Je,setInputValue:Je,setSelectedValue:Je,setIndices:Je,handleSelection:Je,forceMount:Je,requestSubmit:Je,listRef:Tt,labelsRef:Et,popupRef:Ot,emptyRef:Pt,inputRef:kt,startDismissRef:At,endDismissRef:Mt,chipsContainerRef:Lt,clearRef:Rt,valuesRef:Ht,pointerDownItemRef:Ut,selectionEventRef:zt},Di)}).current,Tn=f===`none`?cn:O,En=A.useMemo(()=>f===`none`?Tn:Array.isArray(O)?O.map(e=>Gt(e,oe)):Gt(O,oe),[Tn,oe,f,O]),Dn=We(p),On=We(n),kn=k.useState(`activeIndex`),An=k.useState(`selectedIndex`),jn=k.useState(`positionerElement`),Mn=k.useState(`listElement`),Nn=k.useState(`triggerElement`),Pn=k.useState(`inputElement`),Fn=k.useState(`inputGroupElement`),In=k.useState(`inline`),Ln=k.useState(`inputInsidePopup`),Rn=k.useState(`inputOwnsFormValue`),zn=Zt&&!Ln&&cn===mn,Bn=et(Nn),{openMethod:Vn,triggerProps:Hn}=me(un),Un=We(()=>En);u(Ln?Bn:kt,Ge,Tn,Un,!qt,m);let Wn=We(()=>{at?Et.current=bn.map(_t):k.set(`forceMounted`,!0)}),Gn=We((e,t,n,r)=>{if(t===-1){if(Bt.current===Ni)return;Bt.current=Ni}else Bt.current={value:e,index:t};Dn(e,Ae(n,r,{index:t}))}),Kn=We(e=>{let t={};e.activeIndex!==void 0&&(t.activeIndex=e.activeIndex),e.selectedIndex!==void 0&&(t.selectedIndex=e.selectedIndex),k.update(t);let n=e.activeIndex;if(n===void 0)return;let r=e.type||`none`;n===null?Gn(void 0,-1,r,e.event):Gn(Ht.current[n],n,r,e.event)}),qn=We((t,n)=>{if(e.onInputValueChange?.(t,n),!n.isCanceled){if(It.current=n.reason===Ne,n.reason===`input-change`){un&&bt!==null&&xt(null);let e=n.event,r=e.inputType;if(e.type===`compositionend`||r!=null&&r!==``&&r!==`insertReplacementText`){let e=t.trim()!==``;e&&yt(!0),Vt.current={hasQuery:e};let n=k.state.listElement;if(!k.state.virtualized&&n){let e=Ot.current;for(let t of it(n.firstElementChild??n)){if(!ft(t)||(e?!ht(e,t):t.getAttribute(`role`)===`dialog`))break;if(ji(t)){t.scrollTop=0;break}}}e&&nn&&k.state.activeIndex==null&&(un||In)&&k.set(`activeIndex`,0)}}else n.reason===`input-clear`&&t===``&&k.state.inputInsidePopup&&(Vt.current={hasQuery:!1,selection:!0});ln(t)}}),Jn=We(e=>{let t=!e&&Ln&&!In&&cn!==``&&(String(cn).trim()===bt||cn===mn);!e&&(t||cn===``||zn)&&yt(!1),xt(null),t&&qn(``,Ze(Ne))}),[Yn,Xn]=A.useState(!1),Zn=We((t,n)=>{if(un===t)return;n.reason===`escape-key`&&en&&bn.length===0&&!Pt.current&&n.allowPropagation();let r=n,i=tt(r);if(e.onOpenChange?.(t,r),Vt.current?.hasQuery&&n.reason===`input-change`===n.isCanceled&&(Vt.current=null),!n.isCanceled&&(t&&bt!==null&&Jn(n.reason===Xe),!t&&vt&&(Zt?(In||xt(pn),pn===``&&yt(!1)):Yt&&(In||xt(pn),Ln&&Kn({activeIndex:null}),(!Ln||In)&&qn(``,Ze(Ne,n.event,void 0,{isItemPress:n.reason===Pe})))),t||Xn(i()),dn(t),!t&&Ln&&(n.reason===`focus-out`||n.reason===`outside-press`)&&(je(!0),Fe(!1),ze===`onBlur`))){let e=f===`none`?cn:O;Be.commit(e)}}),Qn=We((e,t)=>{o?.(e,t),t.isCanceled||(an(e),(f===`none`&&Ot.current&&de||Zt&&!k.state.inputInsidePopup)&&qn(_t(e),Ze(t.reason,t.event)))}),$n=We((e,t)=>{let n=wt(e),r=zt.current??e;zt.current=null;let i=Ze(Pe,r),a=St(n,`a`)?.getAttribute(`href`);if(a)a.startsWith(`#`)&&Zn(!1,i);else if(Yt){let e=Array.isArray(O)?O:[],n=Nt(e,t,se),r=n?Sn(e,t,se):[...e,t];if(Qn(r,i),i.isCanceled||!(kt.current&&kt.current.value.trim()!==``))return;if(k.state.inputInsidePopup){qn(``,Ze(Ne,i.event,void 0,{isItemPress:!0}));let e=Vt.current;e&&!n&&(e.toggledValue=t)}else Zn(!1,i)}else{if(Qn(t,i),i.isCanceled)return;Zn(!1,i)}}),er=We(()=>{let e=Be.inputRef.current?.form??k.state.inputElement?.form;e&&typeof e.requestSubmit==`function`&&e.requestSubmit()}),tr=We(()=>{if(On?.(!1),yt(!1),xt(null),Kn(f===`none`?{activeIndex:null,selectedIndex:null}:{activeIndex:null}),Yt&&kt.current&&kt.current.value!==``&&!It.current&&qn(``,Ze(Ne)),Zt){if(k.state.inputInsidePopup)kt.current&&kt.current.value!==``&&qn(``,Ze(Ne));else{let e=_t(O);kt.current&&kt.current.value!==e&&qn(e,Ze(e===``?Ne:Ue))}}}),nr=A.useMemo(()=>In&&jn?{current:St(jn,`[role="dialog"]`)}:Ot,[In,jn]),{mounted:rr,transitionStatus:ir,forceUnmount:ar}=rt({open:un,ref:nr,preventUnmountOnClose:Yn,setPreventUnmountOnClose:Xn,onUnmount:tr});A.useImperativeHandle(e.actionsRef,()=>({unmount:ar,close:()=>Zn(!1,Ze(Re))}),[ar,Zn]),Me(function(){let e=Ct.current!==null&&bt===null;if(Ct.current=bt,un&&(!e||!en)||(un||(Ut.current=null),f===`none`))return;let t=en?bn:Ht.current;Kn({selectedIndex:Cn(t,O,se,Yt)})},[un,bt,O,f,Yt,en,bn,se,Kn]),Me(()=>{at&&(Ht.current=bn,Tt.current.length=bn.length)},[at,bn]),Me(()=>{!un&&Vt.current?.hasQuery&&(Vt.current=null)},[un]),Me(()=>{if(!un&&In&&nr.current){Vt.current=null;return}let e=en||tn?bn:Ht.current,t=Vt.current;if(t){let n=un||In||k.state.positionerElement?.hidden===!1;if(t.hasQuery){let t=kt.current;!nn||String(cn).trim()===``||In&&nn!==`always`&&(!t||Dt(t.ownerDocument)!==t)?Vt.current=null:n&&(e[0]!==void 0||!en&&!tn)&&(k.set(`activeIndex`,0),Vt.current=null)}else if(String(cn).trim()===``&&(Vt.current=null,n)){let e=t.selection;nn===`always`&&!e&&k.state.selectionMode===`none`&&k.set(`activeIndex`,0),queueMicrotask(()=>{if(!k.state.open&&(!k.state.inline||nr.current)||kt.current&&kt.current.value.trim()!==``)return;let n=k.state.selectedValue,r=k.state.selectionMode===`multiple`;if(r&&Array.isArray(n)?n.length>0:k.state.selectionMode!==`none`&&n!=null){let e=en||tn?bn:Ht.current,i=xn(e,t.toggledValue,k.state.isItemEqualToValue);k.set(`activeIndex`,i===-1?Cn(e,n,k.state.isItemEqualToValue,r):i)}else e?k.set(`activeIndex`,null):nn===`always`&&k.set(`activeIndex`,0)})}}if(!un&&!In)return;let n=k.state.activeIndex;if(n==null){if(nn===`always`&&e.length>0){k.set(`activeIndex`,0);return}Gn(void 0,-1,Ue);return}if(n>=e.length){Gn(void 0,-1,Ue),k.set(`activeIndex`,null);return}let r=e[n],i=Bt.current.value,a=i!==Mi&&rn(r,i,k.state.isItemEqualToValue);Bt.current.index===n&&a||Gn(r,n,Ue)},[kn,nn,Gn,tn,en,bn,In,un,nr,k,cn]),Me(()=>{Ee(f===`none`?String(cn)!==``:Yt?Array.isArray(O)&&O.length>0:O!=null)},[Ee,f,cn,O,Yt]),A.useEffect(()=>{en&&nn&&bn.length===0&&Kn({activeIndex:null})},[en,nn,bn.length,Kn]);function or(){un&&pn!==``&&pn!==String(sn)&&!zn&&yt(!0)}function sr(){un&&bt!==null&&Jn(!1)}let cr=!1;function lr(){!cr&&cn!==mn&&(cr=!0,qn(mn,Ze(Ue)))}function ur(){f!==`none`&&(Se(Jt),Ce($t(O,we.initialValue,se)),Be.change(O),Zt&&!Qt&&!Ln&&lr())}function dr(){Zt&&!Qt&&!Ln&&!vt&&lr()}function fr(){f===`none`&&(Se(Jt),Ce(cn!==we.initialValue),Be.change(cn))}ne(pn,or),ne(un,sr),ne(O,ur),ne(mn,dr),ne(at,dr),ne(cn,fr);let pr=jt({open:In?!0:un,onOpenChange:Zn,elements:{reference:Ln?Nn:Pn,floating:jn}}),mr=b?`grid`:`listbox`,hr=un||In,gr=hr?`true`:`false`,_r=A.useMemo(()=>{let e=Pn?.tagName===`INPUT`,t=Pn==null||e,n=t||hr,r=t?{autoComplete:`off`,spellCheck:`false`,autoCorrect:`off`,autoCapitalize:`none`}:{};return n&&(r.role=`combobox`,r[`aria-expanded`]=gr,r[`aria-haspopup`]=mr,r[`aria-controls`]=hr?Mn?.id:void 0,r[`aria-autocomplete`]=_?`none`:_e),{reference:r,floating:{role:`presentation`}}},[Pn,hr,gr,mr,Mn?.id,_e,_]),vr=be(pr,{enabled:!qt&&E,event:`mousedown-only`,toggle:!1,touchOpenDelay:Ln?0:100,reason:Ye}),yr=lt(pr,{enabled:!qt&&!In,outsidePressEvent:{mouse:`sloppy`,touch:`intentional`},bubbles:In?!0:void 0,outsidePress(e){let t=wt(e);return!ht(Nn,t)&&!ht(Rt.current,t)&&!ht(Lt.current,t)&&!ht(Fn,t)}}),br=he(pr,{enabled:!qt,id:Ge,listRef:Tt,activeIndex:kn,selectedIndex:An,virtual:!0,loopFocus:re,allowEscape:re&&!nn,focusItemOnOpen:vt||f===`none`&&!nn?!1:`auto`,focusItemOnHover:te,resetOnPointerLeave:!ee,orientation:b?`horizontal`:void 0,rtl:He===`rtl`,disabledIndices:ke,grid:b?gi:void 0,onNavigate(e,t){(t||un||In&&e===null)&&ir!==`ending`&&Kn({activeIndex:e,type:ie(t),event:t?.nativeEvent})}}),xr=A.useMemo(()=>Ke(br.reference,{onKeyDown(e){b&&k.state.activeIndex==null&&(e.key===`ArrowLeft`||e.key===`ArrowRight`)&&e.preventBaseUIHandler()}},yr.reference,vr.reference,_r.reference),[br.reference,yr.reference,vr.reference,_r.reference,b,k]),Sr=A.useMemo(()=>Ke($e,yr.floating),[yr.floating]),Cr=A.useMemo(()=>Ke(br.floating,_r.floating),[br.floating,_r.floating]),wr=A.useMemo(()=>{let e=br.item;return{props:e?{...e,onFocus:void 0}:Ve,id:Ge,selectionMode:f,disabled:qt,readOnly:_,isItemEqualToValue:se}},[br.item,Ge,f,qt,_,se]);k.useContextCallback(`setOpen`,Zn),k.useContextCallback(`setInputValue`,qn),k.useContextCallback(`setSelectedValue`,Qn),k.useContextCallback(`setIndices`,Kn),k.useContextCallback(`handleSelection`,$n),k.useContextCallback(`forceMount`,Wn),k.useContextCallback(`requestSubmit`,er),k.useContextCallback(`onOpenChangeComplete`,n),Wt(()=>{k.update({inline:ue,popupProps:Sr,listProps:Cr,inputProps:xr,triggerProps:Hn,itemRoot:wr})});let Tr={id:Ge,selectedValue:O,open:un,mounted:rr,transitionStatus:ir,items:ut,inline:ue,popupProps:Sr,listProps:Cr,inputProps:xr,triggerProps:Hn,itemRoot:wr,openMethod:Vn,selectionMode:f,name:Jt,form:h,disabled:qt,readOnly:_,required:v,grid:b,virtualized:le,openOnInputClick:E,itemToStringLabel:pt,modal:fe,autoHighlight:nn,isItemEqualToValue:se,submitOnItemClick:xe,hasInputValue:Qt};Me(()=>{k.update({...Tr,inputOwnsFormValue:f===`none`&&(ue||!k.state.inputInsidePopup)})},[k,...Object.values(Tr)]);let Er=Ie(y,Be.inputRef),Dr=A.useMemo(()=>({query:pn,hasItems:en,filteredItems:yn,flatFilteredValues:bn}),[pn,en,yn,bn]),Or=A.useMemo(()=>Array.isArray(Tn)?``:Gt(Tn,oe),[Tn,oe]),kr=Yt&&Array.isArray(O)&&O.length>0,Ar=Yt||f===`none`&&Rn?void 0:Jt,jr=A.useMemo(()=>!Yt||!Array.isArray(O)||!Jt?null:O.map(e=>{let t=Gt(e,oe);return(0,j.jsx)(`input`,{type:`hidden`,form:h,name:Jt,value:t,disabled:qt},t)}),[Yt,O,h,Jt,oe,qt]),Mr=(0,j.jsxs)(A.Fragment,{children:[e.children,(0,j.jsx)(`input`,{...Be.getValidationProps(qt,{onFocus(){Ln?Nn?.focus():(kt.current||Nn)?.focus()},onChange(e){if(e.nativeEvent.defaultPrevented||qt||_)return;let t=e.currentTarget.value,n=t.toLowerCase(),r=Ze(Ue,e.nativeEvent),i=()=>Ht.current.findIndex(e=>Gt(e,oe).toLowerCase()===n||_t(e).toLowerCase()===n);function a(){if(Yt)return;if(f===`none`){qn(t,r);return}let e=i();e===-1&&(e=Ht.current.findIndex((e,t)=>{let r=Et.current[t];return r!=null&&r.toLowerCase()===n}));let a=e===-1?void 0:Ht.current[e];a!=null&&Qn?.(a,r)}Zt&&(Wn(),at&&i()===-1&&k.set(`forceMounted`,!0)),queueMicrotask(a)}}),id:Ge&&Ar==null?`${Ge}-hidden-input`:void 0,form:h,name:Ar,autoComplete:ve,disabled:qt,required:v&&!kr,readOnly:_,value:Or,ref:Er,style:Ar?ct:st,tabIndex:-1,"aria-hidden":!0,suppressHydrationWarning:!0}),jr]});return(0,j.jsx)(_i.Provider,{value:k,children:(0,j.jsx)(vi.Provider,{value:pr,children:(0,j.jsx)(bi.Provider,{value:en,children:(0,j.jsx)(yi.Provider,{value:Dr,children:(0,j.jsx)(xi.Provider,{value:cn,children:Mr})})})})})}var Ii=`data-popup-side`,Li=`data-list-empty`,Ri={...nt,...g,popupSide:e=>e?{[Ii]:e}:null,listEmpty:e=>e?{[Li]:``}:null};function zi(e){let t=e.useState(`mounted`),n=e.useState(`popupSide`),r=e.useState(`positionerElement`);return t&&r?n:null}function Bi(){return wi().filteredItems.length===0}function Vi(e){return e===`rtl`?[`ArrowRight`,`ArrowLeft`]:[`ArrowLeft`,`ArrowRight`]}function Hi(e,t,n){let r=e.context.listRef.current[t];r&&(e.context.selectionEventRef.current=n,r.click(),e.context.selectionEventRef.current=null)}var Ui=A.createContext(void 0);function Wi(){return A.useContext(Ui)}var Gi=A.createContext(void 0);function Ki(e){let t=A.useContext(Gi);if(t===void 0&&!e)throw Error(Le(21));return t}var qi=A.forwardRef(function(e,t){let n=Si(),{buttonRef:r,getButtonProps:i}=ut({native:!1}),a=Ie(t,r);function o(e){n.context.setOpen(!1,Ze(Be,e.nativeEvent,e.currentTarget))}let s=i({onClick:o});return(0,j.jsx)(`span`,{ref:a,...s,"aria-label":`Dismiss`,tabIndex:void 0,style:ct})}),Ji=A.forwardRef(function(e,t){let{render:n,className:r,disabled:i=!1,id:o,style:c,...l}=e,{state:u,disabled:d,setTouched:f,validationMode:p,validation:m}=a(),{labelId:h}=Se(),g=Wi(),v=!!Ki(!0),y=Si(),b=Ti(),x=ce(),S=y.useState(`required`),C=y.useState(`disabled`),w=y.useState(`readOnly`),T=y.useState(`name`),E=y.useState(`form`),D=y.useState(`selectionMode`),ee=y.useState(`autoHighlight`),te=y.useState(`inputProps`),ne=y.useState(`triggerProps`),re=y.useState(`open`),ae=y.useState(`mounted`),oe=y.useState(`selectedValue`),se=y.useState(`id`),le=y.useState(`inline`),de=y.useState(`modal`),pe=!!ee,me=zi(y),he=d||C||i,ge=Bi(),_e=s(he,y.context.inputRef),ve=v||le,ye=!ve||de,be=Fe(o??(ve?void 0:se)),xe=v?ue:u,[Ce,we]=A.useState(null),Te=A.useRef(!1),Ee=A.useRef(null);Me(()=>{re||(Ee.current=null)},[re]);let De=D===`none`&&!v,Oe=We(e=>{let t=v||y.state.inline;t&&!y.state.hasInputValue&&y.context.setInputValue(``,Ze(Ue)),y.update({inputElement:e,inputInsidePopup:t,inputOwnsFormValue:De})}),ke=v?l:m.getValidationProps(he,l);function Ae(e){y.context.setIndices({activeIndex:null,selectedIndex:null,type:ie(e),event:e})}let Pe={...xe,open:re,disabled:he,readOnly:w,popupSide:me,listEmpty:ge};function Ie(e){if(!g)return;let t,n=g.chipsRef.current.length,[r]=Vi(x);return e.key===r&&(e.currentTarget.selectionStart??0)===0&&oe.length>0&&(e.preventDefault(),t=n>0?n-1:void 0),t}let Le=je(`input`,e,{state:Pe,ref:[t,y.context.inputRef,Oe],props:[te,ne,{value:Ce??b,"aria-readonly":w||void 0,"aria-required":S||void 0,"aria-labelledby":h,disabled:he,readOnly:w,required:D===`none`?S:void 0,form:E,...De&&T&&{name:T},id:be,onFocus(){if(_e(!0),!le)return;let e=Ee.current;Ee.current=null,e!=null&&Object.hasOwn(y.context.valuesRef.current,e)&&y.context.setIndices({activeIndex:e})},onBlur(){f(!0),_e(!1);let e=y.state.activeIndex;if(le&&e!==null&&ee!==`always`&&(Ee.current=e,y.context.setIndices({activeIndex:null})),p===`onBlur`){let e=D===`none`?b:oe;m.commit(e)}},onCompositionStart(e){xt||(Te.current=!0,we(e.currentTarget.value))},onCompositionEnd(e){Te.current=!1;let t=e.currentTarget.value;we(null),y.context.setInputValue(t,Ze(Xe,e.nativeEvent))},onChange(e){let t=e.nativeEvent,n=t.inputType,r=!n||n===`insertReplacementText`,i=Te.current||!r;function a(e){!w&&!he&&e&&i&&(y.context.setOpen(!0,Ze(Xe,t)),pe||Ae(t))}if(Te.current){let n=e.currentTarget.value;we(n),n===``&&!y.state.openOnInputClick&&!y.state.inputInsidePopup&&y.context.setOpen(!1,Ze(Ne,t));let r=n.trim(),i=pe&&r!==``;a(r),re&&y.state.activeIndex!==null&&!i&&Ae(t);return}let o=Ze(Xe,t);if(y.context.setInputValue(e.currentTarget.value,o),o.isCanceled)return;let s=e.currentTarget.value===``,c=Ze(Ne,t);s&&!y.state.inputInsidePopup&&(D===`single`&&y.context.setSelectedValue(null,c),y.state.openOnInputClick||y.context.setOpen(!1,c)),a(e.currentTarget.value.trim()),re&&y.state.activeIndex!==null&&!pe&&Ae(t)},onKeyDown(e){if(e.ctrlKey||e.shiftKey||e.altKey||e.metaKey)return;if(he||w){w&&e.key===`Enter`&&re&&y.state.activeIndex!==null&&Ot(e);return}let t=e.currentTarget,n=t.scrollWidth-t.clientWidth,r=x===`rtl`;if(e.key===`Home`){Ot(e);let n=Et&&r?t.value.length:0;t.setSelectionRange(n,n),t.scrollLeft=0;return}if(e.key===`End`){Ot(e);let i=Et&&r?0:t.value.length;t.setSelectionRange(i,i),t.scrollLeft=r?-n:n;return}if(!ae&&e.key===`Escape`){let t=D===`multiple`&&Array.isArray(oe)?oe.length===0:oe===null,n=Ze(He,e.nativeEvent),r=D===`multiple`?[]:null;y.context.setInputValue(``,n),y.context.setSelectedValue(r,n),t||y.state.inline||n.isPropagationAllowed||e.stopPropagation();return}if(g&&e.key===`Backspace`&&t.value===``&&Array.isArray(oe)&&oe.length>0){let t=g.chipsRef.current.length,n=t>0?t-1:oe.length-1,r=oe.filter((e,t)=>t!==n);Ae(e.nativeEvent),y.context.setSelectedValue(r,Ze(Ue,e.nativeEvent));return}let i=Ie(e);if(i!==void 0&&g?.chipsRef.current[i]?.focus(),e.which!==229&&e.key===`Enter`&&re){let t=y.state.activeIndex,n=e.nativeEvent;if(t===null){if(le)return;y.context.setOpen(!1,Ze(Ue,n));return}Ot(e),Hi(y,t,n)}}},ke],stateAttributesMapping:Ri}),Re=v?(0,j.jsx)(fe.Provider,{value:_,children:Le}):Le;return(0,j.jsxs)(A.Fragment,{children:[re&&ye&&(0,j.jsx)(qi,{ref:y.context.startDismissRef}),Re]})}),Yi=A.createContext(null);function Xi(){return A.useContext(Yi)}function Zi(e){let{children:t}=e,{filteredItems:n}=wi(),r=Xi(),i=r?r.items:n;return(0,j.jsx)(A.Fragment,{children:i.map(t)})}var Qi=A.forwardRef(function(e,t){var n;let{render:r,className:i,style:a,children:o,...s}=e,c=Si(),l=Ci(),u=!!Ki(!0),{filteredItems:d,hasItems:f}=wi(),p=c.useState(`selectionMode`),m=c.useState(`grid`),h=c.useState(`readOnly`),g=c.useState(`listProps`),_=c.useState(`virtualized`),y=c.useState(`forceMounted`),b=p===`multiple`,x=d.length===0,S=We(e=>{c.set(`positionerElement`,e)}),C=We(e=>{c.set(`listElement`,e)}),w=A.useMemo(()=>typeof o==`function`?n||=(0,j.jsx)(Zi,{children:o}):o,[o]),T={empty:x},E=l.useState(`floatingId`),D=je(`div`,e,{state:T,ref:[t,C,u?null:S],props:[g,{children:w,tabIndex:-1,id:E,role:m?`grid`:`listbox`,"aria-multiselectable":b?`true`:void 0,"aria-readonly":!m&&h?!0:void 0,onKeyDown(e){if(!(c.state.disabled||c.state.readOnly)&&e.key===`Enter`){let t=c.state.activeIndex;if(t==null)return;Ot(e),Hi(c,t,e.nativeEvent)}}},s]});if(_)return D;let ee=f&&!y?void 0:c.context.labelsRef;return(0,j.jsx)(v,{elementsRef:c.context.listRef,labelsRef:ee,children:D})}),$i=A.createContext(void 0);function ea(){let e=A.useContext($i);if(e===void 0)throw Error(Le(20));return e}var ta=A.forwardRef(function(e,t){let{keepMounted:n=!1,...r}=e,i=Si(),a=i.useState(`mounted`),o=i.useState(`forceMounted`);return a||n||o?(0,j.jsx)($i.Provider,{value:n,children:(0,j.jsx)(ot,{ref:t,...r})}):null}),na=A.forwardRef(function(e,t){let{render:n,className:r,anchor:i,positionMethod:a,side:o,align:s,sideOffset:c,alignOffset:l,collisionBoundary:u=`clipping-ancestors`,collisionPadding:d,arrowPadding:f,sticky:p,disableAnchorTracking:m=!1,collisionAvoidance:h=pt,style:g,..._}=e,v=Si(),y=Ci(),x=ea(),S=v.useState(`modal`),C=v.useState(`open`),w=v.useState(`mounted`),E=v.useState(`openMethod`),D=v.useState(`positionerElement`),ee=v.useState(`triggerElement`),te=v.useState(`inputElement`),ne=v.useState(`inputGroupElement`),re=v.useState(`inputInsidePopup`),ie=v.useState(`transitionStatus`),ae=Bi(),oe=b({anchor:i??(re?ee:ne??te),floatingRootContext:y,positionMethod:a,mounted:w,side:o,sideOffset:c,align:s,alignOffset:l,arrowPadding:f,collisionBoundary:u,collisionPadding:d,sticky:p,disableAnchorTracking:m,keepMounted:x,collisionAvoidance:h,lazyFlip:!0});_e(C&&S,E===`touch`,D,ee);let se={open:C,side:oe.side,align:oe.align,anchorHidden:oe.anchorHidden,empty:ae};Me(()=>{v.set(`popupSide`,oe.side)},[v,oe.side]);let ce=We(e=>{v.set(`positionerElement`,e)}),le=T(e,se,{styles:oe.positionerStyles,transitionStatus:ie,props:_,refs:[t,ce],hidden:!w,inert:!C});return(0,j.jsxs)(Gi.Provider,{value:oe,children:[w&&S&&(0,j.jsx)(Ct,{inert:yt(!C),cutout:ne??te??ee}),le]})}),ra={...dt,...at},ia=A.forwardRef(function(e,t){let{render:n,className:r,style:i,initialFocus:a,finalFocus:o,...s}=e,c=Si(),l=Ki(),u=Ci(),d=c.useState(`mounted`),f=c.useState(`open`),p=c.useState(`openMethod`),m=c.useState(`popupProps`),h=c.useState(`transitionStatus`),g=c.useState(`inputInsidePopup`),_=c.useState(`inputElement`),v=c.useState(`modal`),y=c.useState(`id`),b=Bi(),x=s.id??(g?Oi(y):void 0);Me(()=>(c.set(`popupId`,c.context.popupRef.current?.id||x),()=>{c.set(`popupId`,void 0)}),[c,x]),_t({open:f,ref:c.context.popupRef,onComplete(){f&&c.context.onOpenChangeComplete(!0)}});let S={open:f,side:l.side,align:l.align,anchorHidden:l.anchorHidden,transitionStatus:h,empty:b},C=je(`div`,e,{state:S,ref:[t,c.context.popupRef],props:[m,{id:x,role:g?`dialog`:`presentation`,onFocus(e){let t=wt(e.nativeEvent);p!==`touch`&&(ht(c.state.listElement,t)||t===e.currentTarget)&&c.context.inputRef.current?.focus()}},ee(h),s],stateAttributesMapping:ra}),w=a===void 0?g?e=>e===`touch`?c.context.popupRef.current:_:!1:a,T;T=o??(g?void 0:!1);let E=!g||v;return(0,j.jsx)(kt,{context:u,disabled:!d,modal:E,openInteractionType:p,initialFocus:w,returnFocus:T,getInsideElements:()=>[c.context.startDismissRef.current,c.context.endDismissRef.current],children:(0,j.jsxs)(A.Fragment,{children:[C,E&&(0,j.jsx)(qi,{ref:c.context.endDismissRef})]})})}),aa=A.createContext(void 0),oa=A.createContext(!1);function sa(){return A.useContext(oa)}function ca(e){let{componentProps:t,forwardedRef:n,virtualized:r,indexFromFilter:i}=e,{render:a,className:o,style:s,value:l=null,index:u,disabled:d=!1,nativeButton:f=!1,...p}=t,m=A.useRef(null),h=c({guess:!0,index:u,textRef:m}),g=Si(),_=sa(),v=Ei(),{props:y,id:b,selectionMode:x,disabled:S,readOnly:C,isItemEqualToValue:w}=g.useState(`itemRoot`),T=S||d,E=x!==`none`,D=u??i??h.index,ee=D!==-1,te=g.useState(`isActive`,D),ne=g.useState(`isSelected`,l),re=A.useRef(null),ie=b!=null&&ee?`${b}-${D}`:void 0,ae=ne&&E;Me(()=>{if(!ee||!r&&u==null)return;let e=g.context.listRef.current;return e[D]=re.current,()=>{delete e[D]}},[ee,r,D,u,g]),Me(()=>{if(!ee||v)return;let e=g.context.valuesRef.current;return e[D]=l,()=>{delete e[D]}},[ee,v,D,l,g]),Me(()=>{if(!ee||v)return;let e=g.state.selectedValue,t=g.state.selectedIndex;g.state.selectionMode===`multiple`&&Array.isArray(e)?t=Ut(D,l,g.context.valuesRef.current,e,w,t):rn(l,e,w)&&(t=D),g.set(`selectedIndex`,t)},[ee,v,g,D,l,w]);let{getButtonProps:oe,buttonRef:se}=ut({disabled:T,focusableWhenDisabled:!0,native:f,composite:!0}),ce={disabled:T,selected:ae,highlighted:te};function le(e){function t(){g.context.handleSelection(e,l)}g.state.submitOnItemClick?(ui.flushSync(t),g.context.requestSubmit()):t()}let ue={id:ie,role:_?`gridcell`:`option`,"aria-selected":E?ae:void 0,tabIndex:void 0,onPointerDownCapture(e){e.isPrimary&&(g.context.pointerDownItemRef.current=e.currentTarget),e.preventDefault()},onMouseDown(e){e.preventDefault()},onClick(e){T||C||le(e.nativeEvent)},onMouseUp(e){let t=g.context.pointerDownItemRef.current===e.currentTarget;g.context.pointerDownItemRef.current=null,T||C||e.button!==0||t||!te||le(e.nativeEvent)}},de=je(`div`,t,{ref:[se,n,h.ref,re],state:ce,props:[y,ue,p,oe]}),fe=A.useMemo(()=>({selected:ae,textRef:m}),[ae,m]);return(0,j.jsx)(aa.Provider,{value:fe,children:de})}function la(e){let{componentProps:t,forwardedRef:n}=e,r=Si().useState(`isItemEqualToValue`),{flatFilteredValues:i}=wi(),a=t.value??null,o=xn(i,a,r);return(0,j.jsx)(ca,{componentProps:t,forwardedRef:n,virtualized:!0,indexFromFilter:o})}var ua=A.memo(A.forwardRef(function(e,t){let n=Si().useState(`virtualized`);return n&&e.index==null?(0,j.jsx)(la,{componentProps:e,forwardedRef:t}):(0,j.jsx)(ca,{componentProps:e,forwardedRef:t,virtualized:n,indexFromFilter:void 0})})),da=A.forwardRef(function(e,t){let{render:n,className:r,style:i,children:a,...o}=e,{filteredItems:s}=wi(),c=Si(),l=hi(),u=s.length===0?a:null;return je(`div`,e,{ref:[t,c.context.emptyRef,l],props:[{children:u,role:`status`,"aria-live":`polite`,"aria-atomic":!0},o]})}),fa=n(),pa=(0,A.createContext)(null);function ma(e,t){let n=null;return e!=null&&(n=e[1]),{getTheme:function(){return t??(n==null?null:n.getTheme())}}}function ha(){let e=(0,A.useContext)(pa);return e??function(e,...t){throw function(e,...t){let n=new URL(`https://lexical.dev/docs/error`),r=new URLSearchParams;r.append(`code`,e);for(let e of t)r.append(`v`,e);return n.search=r.toString(),Error(`Minified Lexical error #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}(e,...t)}(8),e}function ga(e,...t){let n=new URL(`https://lexical.dev/docs/error`),r=new URLSearchParams;r.append(`code`,e);for(let e of t)r.append(`v`,e);return n.search=r.toString(),Error(`Minified Lexical error #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}function M(e,...t){throw ga(e,...t)}function _a(e,...t){let n=new URL(`https://lexical.dev/docs/error`),r=new URLSearchParams;r.append(`code`,e);for(let e of t)r.append(`v`,e);n.search=r.toString(),console.warn(`Minified Lexical warning #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}function va(){return typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0}var ya=va();function ba(){return ya&&`documentMode`in document?document.documentMode:null}var xa=ba();function Sa(e){return ya&&e.test(navigator.platform)}function Ca(e){return ya&&e.test(navigator.userAgent)}var wa=Sa(/Mac|iPod|iPhone|iPad/),Ta=Ca(/^(?!.*Seamonkey)(?=.*Firefox).*/i);function Ea(){return!(!ya||!(`InputEvent`in window)||xa)&&`getTargetRanges`in new window.InputEvent(`input`)}var Da=Ea();function Oa(){return ya&&!window.MSStream&&(/iPad|iPhone|iPod/.test(navigator.userAgent)||/Macintosh/.test(navigator.userAgent)&&navigator.maxTouchPoints>1)}var ka=Oa(),Aa=Ca(/Android/),ja=Ca(/Version\/[\d.]+.*Safari/)&&!Aa,Ma=Ca(/^(?=.*Chrome).*/i),Na=ya&&Aa&&Ma,Pa=Ca(/AppleWebKit\/[\d.]+/)&&wa&&!Ma;function Fa(){return 2047}var Ia=Fa(),La=ja||ka||Pa?`\xA0`:`​`,Ra=`
2
+
3
+ `,za=Ta?`\xA0`:La,Ba={bold:1,capitalize:1024,code:16,highlight:128,italic:2,lowercase:256,strikethrough:4,subscript:32,superscript:64,underline:8,uppercase:512},Va={directionless:1,unmergeable:2},Ha={center:2,end:6,justify:4,left:1,right:3,start:5};function Ua(e){let t={};for(let n of Object.keys(e))t[e[n]]=n;return t}var Wa=Ua(Ha),Ga={normal:0,segmented:2,token:1},Ka=Ua(Ga),qa=Symbol.for(`@lexical/ctrlOrOtherKey`),Ja=`$config`;function Ya(e){return()=>{}}function N(e){return{type:e}}var Xa=N(`SELECTION_CHANGE_COMMAND`),Za=N(`SELECTION_INSERT_CLIPBOARD_NODES_COMMAND`),Qa=N(`CLICK_COMMAND`),$a=N(`BEFORE_INPUT_COMMAND`),eo=N(`INPUT_COMMAND`),to=N(`COMPOSITION_START_COMMAND`),no=N(`COMPOSITION_END_COMMAND`),ro=N(`DELETE_CHARACTER_COMMAND`),io=N(`INSERT_LINE_BREAK_COMMAND`),ao=N(`INSERT_PARAGRAPH_COMMAND`),oo=N(`CONTROLLED_TEXT_INSERTION_COMMAND`),so=N(`PASTE_COMMAND`),co=N(`REMOVE_TEXT_COMMAND`),lo=N(`DELETE_WORD_COMMAND`),uo=N(`DELETE_LINE_COMMAND`),fo=N(`FORMAT_TEXT_COMMAND`),po=N(`SET_TEXT_FORMAT_COMMAND`),mo=N(`UNDO_COMMAND`),ho=N(`REDO_COMMAND`),go=N(`KEYDOWN_COMMAND`),_o=N(`KEY_ARROW_RIGHT_COMMAND`),vo=N(`MOVE_TO_END`),yo=N(`KEY_ARROW_LEFT_COMMAND`),bo=N(`MOVE_TO_START`),xo=N(`KEY_ARROW_UP_COMMAND`),So=N(`KEY_ARROW_DOWN_COMMAND`),Co=N(`KEY_ENTER_COMMAND`),wo=N(`KEY_SPACE_COMMAND`),To=N(`KEY_BACKSPACE_COMMAND`),Eo=N(`KEY_ESCAPE_COMMAND`),Do=N(`KEY_DELETE_COMMAND`),Oo=N(`KEY_TAB_COMMAND`),ko=N(`INSERT_TAB_COMMAND`),Ao=N(`INDENT_CONTENT_COMMAND`),jo=N(`OUTDENT_CONTENT_COMMAND`),Mo=N(`DROP_COMMAND`),No=N(`FORMAT_ELEMENT_COMMAND`),Po=N(`DRAGSTART_COMMAND`),Fo=N(`DRAGOVER_COMMAND`),Io=N(`DRAGEND_COMMAND`),Lo=N(`COPY_COMMAND`),Ro=N(`CUT_COMMAND`),zo=N(`SELECT_ALL_COMMAND`),Bo=N(`CLEAR_EDITOR_COMMAND`),Vo=N(`CLEAR_HISTORY_COMMAND`),Ho=N(`CAN_REDO_COMMAND`),Uo=N(`CAN_UNDO_COMMAND`),Wo=N(`FOCUS_COMMAND`),Go=N(`BLUR_COMMAND`),Ko=N(`KEY_MODIFIER_COMMAND`);function qo(e,t){return{...t,[qa]:e}}var Jo=qo(`metaKey`,{ctrlKey:!wa,metaKey:wa}),Yo=qo(`altKey`,{altKey:wa,ctrlKey:!wa}),Xo=[[`altKey`,1],[`ctrlKey`,2],[`metaKey`,4],[`shiftKey`,8]];function Zo(e,t,n){let r=e.get(t);r?r.push(n):e.set(t,[n])}var Qo=class{byKey=new Map;byCode=new Map;add(e){let{key:t,modifiers:n={}}=e;t.length>0||M(399);let r=t.toLowerCase();for(let i of function(e){let t=[0];for(let[n,r]of Xo){let i=e[n]||!1;i===`any`?t=t.concat(t.map(e=>e|r)):i&&(t=t.map(e=>e|r))}return t}(n))Zo(this.byKey,`${i}:${r}`,e),t.length===1&&(/[0-9]/.test(t)?Zo(this.byCode,`${i}:Digit${t}`,e):/[a-z]/.test(r)&&Zo(this.byCode,`${i}:Key${r.toUpperCase()}`,e));return this}matches(e){let t=e.key;if(!t)return[];let n=function(e){let t=0;for(let[n,r]of Xo)e[n]&&(t|=r);return t}(e),r=this.byKey.get(`${n}:${t.toLowerCase()}`),i=r?r.slice():[];if(this.byCode.size>0&&!(t.length===1&&t.charCodeAt(0)<=127)){let t=this.byCode.get(`${n}:${e.code}`);t&&i.push(...t)}return i}match(e){return this.matches(e)[0]}};function $o(e){let t=new Qo;for(let n of e)t.add(n);return t}function es(e){let t=new Map;return{dispose(){for(let e of t.values())e.dispose();t.clear()},register(n,r){let i=t.get(n);i===void 0&&(i={dispose:e(n,r),holders:new Set},t.set(n,i));let a=()=>{let e=t.get(n);e&&e.holders.delete(a)&&e.holders.size===0&&(t.delete(n),e.dispose())};return i.holders.add(a),a}}}function ts(){let e;try{e=`0.53.0+prod.esm`}catch{}return e??`"<unknown>+source"`}var ns=ts(),rs=class{_front=new Set;_back=new Set;_cache;get size(){return this._front.size+this._back.size}addBack(e){return delete this._cache,this._front.has(e)||this._back.add(e),this}addFront(e){return delete this._cache,this._back.has(e)||this._front.add(e),this}delete(e){return delete this._cache,this._front.delete(e)||this._back.delete(e)}toArray(){let e=Array.from(this._front).reverse();for(let t of this._back)e.push(t);return e}toReadonlyArray(){return this._cache=this._cache||this.toArray(),this._cache}[Symbol.iterator](){return this.toReadonlyArray()[Symbol.iterator]()}},is=null;function as(e,t=1e3){return e instanceof os?e.clone():e.size<t?new Map(e):new os().init(new Map(e),void 0,e.size)}var os=class e{_mutable=!1;_old=void 0;_nursery=void 0;_size=0;clone(){return this._mutable=!1,new e().init(this._old,this._nursery,this._size)}init(e,t,n){return this._old=e,this._nursery=t,this._size=n,this}get size(){return this._size}has(e){return this.get(e)!==void 0}getWithTombstone(e){let t=this._nursery&&this._nursery.get(e);return t===void 0?this._old&&this._old.get(e):t}get(e){let t=this.getWithTombstone(e);return t===is?void 0:t}shouldCompact(){return this._nursery!==void 0&&2*this._nursery.size>this._size}getNursery(){return this._mutable&&this._nursery||(this.compact(),this._nursery=new Map(this._nursery),this._mutable=!0),this._nursery}compact(e=!1){if(this._nursery&&this._nursery.size>0&&(e||this.shouldCompact())){let e=new Map(this._old);for(let[t,n]of this._nursery)n===is?e.delete(t):e.set(t,n);this._old=e,this._nursery=void 0}return this._mutable=!1,this}set(e,t){let n=this.getWithTombstone(e);if(n===t)return this;let r=this.getNursery();return n!==is&&n!==void 0||(this._size++,n===is&&r.delete(e)),r.set(e,t),this}delete(e){let t=this.has(e);return t&&(this.getNursery().set(e,is),this._size--),t}getOrInsert(e,t){let n=this.get(e);return n===void 0?(this.set(e,t),t):n}getOrInsertComputed(e,t){let n=this.get(e);if(n!==void 0)return n;let r=t(e);return this.set(e,r),r}clear(){this._mutable=!1,this._old=void 0,this._nursery=void 0,this._size=0}*keys(){for(let e of this.entries())yield e[0]}*values(){for(let e of this.entries())yield e[1]}*entries(){let e=this._nursery,t=this._old;if(e){if(t)for(let n of t){let t=n[0],r=e.get(t);r!==is&&(r!==void 0&&(n[1]=r),yield n)}for(let n of e)n[1]===is||t&&t.has(n[0])||(yield n)}else t&&(yield*t)}forEach(e,t){t!==void 0&&(e=e.bind(t));for(let[t,n]of this.entries())e(n,t,this)}get[Symbol.toStringTag](){return`GenMap`}[Symbol.iterator](){return this.entries()}},ss=!1;function cs(e,t,...n){let r=ss,i;try{ss=e,i=t()}finally{ss=r}var a;return(a=i)===null||typeof a!=`object`&&typeof a!=`function`||typeof a.then!=`function`||M(421),i}function ls(){return ss}function us(e){let t=e.exportJSON(ss),n=e.constructor;return t.type!==n.getType()&&M(130,n.name),I(e)&&!Array.isArray(t.children)&&M(59,n.name),t}function ds(){return Jf()._blockCursorElement}function fs(e){return e!==null&&e.nodeType===1&&e.hasAttribute(`data-lexical-slot`)}var ps=Pa||ka||ja;function ms(){let e=Af().createElement(`img`);e.setAttribute(`data-lexical-decorator-boundary`,`true`),e.alt=``;for(let[t,n]of[[`position`,`absolute`],[`width`,`0px`],[`height`,`0px`],[`border`,`0px`],[`margin`,`0px`],[`padding`,`0px`]])e.style.setProperty(t,n,`important`);return e}function hs(e){return e!==null&&e.nodeType===1&&e.hasAttribute(`data-lexical-decorator-boundary`)}var gs=class e{element;before;after;constructor(e,t,n){this.element=e,this.before=t||null,this.after=n||null}withBefore(t){return new e(this.element,t,this.after)}withAfter(t){return new e(this.element,this.before,t)}withElement(t){return this.element===t?this:new e(t,this.before,this.after)}insertChild(e){let t=this.getInsertionAnchor();return t!==null&&t.parentElement!==this.element&&M(357),this.element.insertBefore(e,t),this}removeChild(e){return e.parentElement!==this.element&&M(358),this.element.removeChild(e),this}replaceChild(e,t){return t.parentElement!==this.element&&M(359),this.element.replaceChild(e,t),this}getFirstChild(){let e=this.getFirstChildAnchor(),t=e?e.nextSibling:this.element.firstChild;return t===this.getInsertionAnchor()?null:t}getFirstChildAnchor(){return this.after}resolveLeafPosition(e,t,n){if(this.element===e)return t===e&&n===0?`before`:`after`;let r=_s(e,this.element);if(r===null)return`after`;let i=Array.prototype.indexOf.call(e.childNodes,r);if(i<0)return`after`;if(t===e)return n<=i?`before`:`after`;let a=_s(e,t);if(a===null)return`after`;let o=Array.prototype.indexOf.call(e.childNodes,a);return o>=0&&o<=i?`before`:`after`}getInsertionAnchor(){return this.before}};function _s(e,t){let n=t;for(;n!==null&&n.parentNode!==e;)n=n.parentNode;return n}var vs=class e extends gs{withBefore(t){return new e(this.element,t,this.after)}withAfter(t){return new e(this.element,this.before,t)}withElement(t){return this.element===t?this:new e(t,this.before,this.after)}getInsertionAnchor(){return super.getInsertionAnchor()||this.getManagedLineBreak()||this.getDecoratorBoundaryAnchor(`trailing`)}getFirstChildAnchor(){let e=super.getFirstChildAnchor(),t=e?e.nextSibling:this.element.firstChild;for(;fs(t);)e=t,t=t.nextSibling;hs(t)&&(e=t,t=t.nextSibling);let n=e?e.nextSibling:this.element.firstChild;return n!==null&&n===ds()?n:e}getDecoratorBoundaryAnchor(e){let t;if(e===`leading`){let e=super.getFirstChildAnchor();for(t=e?e.nextSibling:this.element.firstChild;fs(t);)t=t.nextSibling}else t=this.before?this.before.previousSibling:this.element.lastChild,t!==null&&t===ds()&&(t=t.previousSibling);return hs(t)?t:null}setDecoratorBoundaryAnchor(e,t){let n=this.getDecoratorBoundaryAnchor(e);if(t!==(n!==null)){if(n!==null)this.element.removeChild(n);else if(e===`leading`){let e=this.getFirstChildAnchor();this.element.insertBefore(ms(),e?e.nextSibling:this.element.firstChild)}else this.element.insertBefore(ms(),this.before)}}getManagedLineBreak(){return this.element.__lexicalLineBreak||null}setManagedLineBreak(e){let t=this.element,n=this.after===null?t.firstChild:this.after.nextSibling,r=e===`empty`&&fs(n)?null:e;if(t.__lexicalLastChildKind!==r){if(t.__lexicalLastChildKind=r,r===null)this.removeManagedLineBreak();else{let e=r===`decorator`&&ps;this.insertManagedLineBreak(e)}}}removeManagedLineBreak(){let e=this.element,t=this.getManagedLineBreak();if(t){t.remove();for(let t of e.querySelectorAll(`:scope > [data-lexical-managed-linebreak]`))t.remove();e.__lexicalLineBreak=void 0}}insertManagedLineBreak(e){let t=this.element,n=this.getManagedLineBreak();if(n){let r=e?n.nextSibling:n;if(r&&r===t.querySelector(`:scope > br[data-lexical-managed-linebreak]`))return;this.removeManagedLineBreak()}let r=this.before||this.getDecoratorBoundaryAnchor(`trailing`),i=Af().createElement(`br`);if(i.setAttribute(`data-lexical-managed-linebreak`,`true`),t.insertBefore(i,r),e){let e=Af().createElement(`img`);e.setAttribute(`data-lexical-managed-linebreak`,`true`),e.style.setProperty(`display`,`inline`,`important`),e.style.setProperty(`border`,`0px`,`important`),e.style.setProperty(`margin`,`0px`,`important`),e.alt=``,t.insertBefore(e,i),t.__lexicalLineBreak=e}else t.__lexicalLineBreak=i}getFirstChildOffset(){let e=this.getFirstChild(),t=this.getInsertionAnchor(),n=0;for(let r=this.element.firstChild;r!==null&&r!==e&&r!==t;r=r.nextSibling)n++;return n}resolveChildIndex(e,t,n,r){if(n===this.element){let t=this.getFirstChildOffset(),n=ds(),i=this.element.childNodes,a=Math.min(r,i.length),o=0;for(let e=t;e<a;e++)i[e]!==n&&o++;return[e,Math.min(o,e.getChildrenSize())]}let i=ys(t,n);i.push(r);let a=ys(t,this.element),o=e.getIndexWithinParent();for(let e=0;e<a.length;e++){let t=i[e],n=a[e];if(t===void 0||t<n)break;if(t>n){o+=1;break}}return[e.getParentOrThrow(),o]}};function ys(e,t){let n=[],r=t;for(;r!==e&&r!==null;r=r.parentNode){let e=0;for(let t=r.previousSibling;t!==null;t=t.previousSibling)e++;n.push(e)}return r!==e&&M(225),n.reverse()}var bs=!1,xs=0;function Ss(){xs=performance.now()}function Cs(e){return W(e)&&e.hasAttribute(`data-lexical-managed-linebreak`)}function ws(e,t,n){let r=Cf(pf(n)),i=r&&Nf(r,n._rootElement),a=null,o=null;i!==null&&i.anchorNode===e&&(a=i.anchorOffset,o=i.focusOffset);let s=e.nodeValue;s!==null&&Gd(t,s,a,o,!1)}function Ts(e,t,n){if(q(e)){let t=e.anchor.getNode();if(t.is(n)&&e.format!==t.getFormat())return!1}return _d(t)&&n.isAttached()}function Es(e,t,n){for(let r=e;r&&!cp(r);r=af(r)){let e=Ad(r,t);if(e!==void 0){let t=B(e,n);if(t)return L(t)||!W(r)?void 0:[r,t]}}}function Ds(e,t,n,r){bs=!0;let i=e._inputState.unprocessedBeforeInputData===null&&performance.now()-xs>100;try{eh(e,()=>{let a=J()||function(e){return e.read(`latest`,()=>{let e=J();return e===null?null:e.clone()})}(e),o=new Map,s=e._editorState,c=e._blockCursorElement,l=!1,u=``;for(let n of t){let t=n.type,d=n.target,f=Es(d,e,s);if(!f)continue;let[p,m]=f;if(t===`characterData`)r?R(m)&&m.isAttached()&&m.markDirty():i&&R(m)&&_d(d)&&Ts(a,d,m)&&ws(d,m,e);else{l=!0;for(let t of n.addedNodes){let n=Ad(t,e);if(t!==c&&t.parentNode===d&&(n?e.getElementByKey(n)!==t:!(e._slotsUsed&&W(t)&&t.hasAttribute(`data-lexical-slot`)||cp(t)))){if(Ta){let e=(W(t)?t.innerText:null)||t.nodeValue;e&&(u+=e)}d.removeChild(t)}}for(let e of n.removedNodes){let t=c===e;if(t||hs(e)||Cs(e)){let t=n.nextSibling,r=n.previousSibling;d.insertBefore(e,t&&t.parentNode!==d?r?r.parentNode===d?r.nextSibling:null:d.firstChild:t)}t||o.set(p,m)}}}for(let[t,n]of o)n.reconcileObservedMutation(t,e);let d=n.takeRecords();for(let t of d)for(let n of t.addedNodes)n.nodeName!==`BR`||Ad(n,e)||Cs(n)||n.remove();n.takeRecords(),a!==null&&(l&&Id(a),Ta&&nf(e)&&a.insertRawText(u))})}finally{bs=!1}}function Os(e,t,n){let r=e._observer;if(r!==null){let i=r.takeRecords();(!n||i.length>0)&&Ds(e,i,r,t)}}function ks(e){(function(e){pf(e).addEventListener(`textInput`,Ss,!0)})(e),e._observer=new MutationObserver((t,n)=>{Ds(e,t,n)})}function As(e,t,n){let{isEqual:r}=e;return t===n||r!==void 0&&r(t,n)}function js(e,t){return As(e,t,e.defaultValue)}function Ms(e){return typeof e==`object`&&!!e}function Ns(e,t){let n=Rs(e,t).getter;return Ms(n)&&n.getterTable!==void 0||M(405,t),Ls(n.getterTable)}function Ps(e,t){let n=Rs(e,t).setter;return Ms(n)&&n.setterTable!==void 0||M(406,t),Ls(n.setterTable)}function Fs(e,t,n){let{meta:r}=Rs(e,t);for(let e=0;;)if(r.kind===`aliased`){if(e===n)return Ls(r.aliases);e++,r=r.inner.meta}else r.kind===`nullable`||r.kind===`optional`?r=r.inner.meta:r.kind===`array`?r=r.item.meta:M(407,t,String(n))}function Is(e,t){let n=Rs(e,t),{setter:r}=n;Ms(r)&&r.setterTable!==void 0||M(408,t);let i=String(n.defaultValue);return qs(r.setterTable,i)||M(409,t,i),r.setterTable[i]}function Ls(e){return Object.assign(Object.create(null),e)}function Rs(e,t){let n=e.get(t);return n===void 0&&M(410,t),n}function zs(e,t,n,r,i){i!==void 0&&Bs.add(i);let a=n===void 0,o=a?e(void 0):n;return a&&Us(o),Object.assign(e,{accepts:i,defaultValue:o,isEqual:r,meta:t})}var Bs=new WeakSet,Vs=new WeakSet;function Hs(e){return typeof e==`object`&&e&&Vs.add(e),e}function Us(e){if(typeof e==`object`&&e&&!Object.isFrozen(e)&&!Vs.has(e)){Object.freeze(e);for(let t of Object.values(e))Us(t)}}function Ws(e){let{isEqual:t}=e;return t===void 0?void 0:(e,n)=>e==null||n==null?e===n:t(e,n)}function Gs(e,t){return n=>t(n)||Ks(e,n)}function Ks(e,t){let{accepts:n}=e;return n===void 0?function(e,t){let{accepts:n}=e;if(n!==void 0)return Ks(e,t)?{parsed:e(t)}:void 0;let r=e(t);return js(e,r)&&t!==e.defaultValue?void 0:{parsed:r}}(e,t)!==void 0:n.call(e,t)}function qs(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function Js(e=``){return zs(t=>typeof t==`string`?t:e,{kind:`string`},void 0,void 0,e=>typeof e==`string`)}var Ys=/^-?(?:0|[1-9]\d*)(?:\.\d+)?(?:[eE][+-]?\d+)?$/;function Xs(e=0,t={}){let{integer:n,clamp:r}=t,i=n&&t.min!==void 0?Math.ceil(t.min):t.min,a=n&&t.max!==void 0?Math.floor(t.max):t.max,o=e=>typeof e==`string`&&Ys.test(e)?Number(e):e,s=e=>typeof e==`number`&&Number.isFinite(e)&&(!n||Number.isInteger(e)),c=e=>s(e)&&(i===void 0||e>=i)&&(a===void 0||e<=a);return zs(t=>{let n=o(t);return r&&s(n)?i!==void 0&&n<i?i:a!==void 0&&n>a?a:n:c(n)?n:e},{clamp:r,integer:n,kind:`number`,max:a,min:i},void 0,void 0,e=>r?s(o(e)):c(o(e)))}function Zs(e=!1){return zs(t=>typeof t==`boolean`?t:e,{kind:`boolean`},void 0,void 0,e=>typeof e==`boolean`)}function Qs(e,...t){let n=Hs(t.length===0?e[0]:t[0]),r=new Set(e);return zs(e=>e!==void 0&&r.has(e)?e:n,{kind:`enum`,values:e},n,void 0,e=>r.has(e)&&(e!==void 0||n===void 0))}function $s(e,t={}){let{defaultAsNull:n}=t;return zs(t=>{if(t==null)return null;let r=e(t);return n&&js(e,r)?null:r},{defaultAsNull:n,inner:e,kind:`nullable`},void 0,Ws(e),Gs(e,e=>e==null))}function ec(e,t={}){let{omitDefault:n}=t;return zs(t=>{if(t===void 0)return;let r=e(t);return n&&js(e,r)?void 0:r},{inner:e,kind:`optional`,omitDefault:n},void 0,Ws(e),Gs(e,e=>e===void 0))}function tc(){return e=>function(e){return{meta:{fields:e,kind:`node`}}}(e)}function nc(e,t){let n=e=>typeof e==`string`&&qs(t,e);return zs(r=>n(r)?t[r]:e(r),{aliases:t,inner:e,kind:`aliased`},e.defaultValue,e.isEqual,t=>n(t)||Ks(e,t))}function rc(e){return zs(t=>{if(!Array.isArray(t))return[];let n=Array(t.length);for(let r=0;r<t.length;r++)n[r]=e(t[r]);return n},{item:e,kind:`array`},void 0,(t,n)=>{if(!Array.isArray(t)||!Array.isArray(n)||t.length!==n.length)return!1;for(let r=0;r<t.length;r++)if(!As(e,t[r],n[r]))return!1;return!0},e=>Array.isArray(e))}function ic(e,t){return oc(0,e,{getter:{field:t.field,getterTable:t.getterTable,method:t.getter,when:t.when},setter:{field:t.field,method:t.setter,setterTable:t.setterTable}},!0===t.derived)}function ac(e,t){return oc(0,e,{getter:t.getter,setter:t.setter},!0===t.derived)}function oc(e,t,n,r=!1){return Object.assign(e=>t(e),{accepts:t.accepts,defaultValue:t.defaultValue,...r?{derived:!0}:{},getter:n.getter,isEqual:t.isEqual,meta:t.meta,setter:n.setter})}var sc=`latest`,cc=class{key;parse;unparse;isEqual;defaultValue;resetOnCopyNode;derived;schema;constructor(e,t){this.key=e,this.derived=!0===t.derived;let n=`meta`in(r=t.parse)&&typeof r.meta==`object`&&r.meta!==null&&`kind`in r.meta&&typeof r.meta.kind==`string`&&`defaultValue`in r?t.parse:void 0;var r;this.schema=n,this.parse=t.parse.bind(t),this.unparse=(t.unparse||yc).bind(t),this.isEqual=t.isEqual?t.isEqual.bind(t):n!==void 0&&n.isEqual!==void 0?(e,t)=>As(n,e,t):Object.is,this.defaultValue=n===void 0?this.parse(void 0):n.defaultValue,this.resetOnCopyNode=t.resetOnCopyNode||!1}};function lc(e,t){return new cc(e,t)}function uc(e,t,n=sc){let r=(n===`latest`?e.getLatest():e).__state;return r?r.getValue(t):t.defaultValue}function dc(e,t,n){let r;if(Nm(),typeof n==`function`){let i=e.getLatest(),a=uc(i,t);if(r=fc(t,n(a)),t.isEqual(a,r))return i}else r=fc(t,n);let i=e.getWritable();return gc(i).updateFromKnown(t,r),i}function fc(e,t){let{schema:n}=e;return n!==void 0&&n.meta.kind===`set`?e.parse(t):t}function pc(e){let t=new Map,n=new Set;for(let{ownNodeConfig:r}of Bp(typeof e==`function`?e:e.replace))if(r&&r.stateConfigs)for(let e of r.stateConfigs){let r;`stateConfig`in e?(r=e.stateConfig,e.flat&&n.add(r.key)):r=e,t.set(r.key,r)}return{flatKeys:n,sharedConfigMap:t}}var mc=new Set([`__proto__`,`constructor`,`prototype`]),hc=class e{node;knownState;unknownState;sharedNodeState;size;constructor(e,t,n=void 0,r=new Map,i=void 0){this.node=e,this.sharedNodeState=t,this.unknownState=n,this.knownState=r;let{sharedConfigMap:a}=this.sharedNodeState,o=i===void 0?function(e,t,n){let r=n.size;if(t)for(let i in t){let t=e.get(i);t&&n.has(t)||r++}return r}(a,n,r):i;this.size=o}getValue(e){let t=this.knownState.get(e);if(t!==void 0)return t;this.sharedNodeState.sharedConfigMap.set(e.key,e);let n=e.defaultValue;if(this.unknownState&&e.key in this.unknownState){let t=this.unknownState[e.key];t!==void 0&&(n=e.parse(t)),this.knownState.set(e,n)}return n}getInternalState(){return[this.unknownState,this.knownState]}toJSON(){let e={...this.unknownState},t={};for(let[t,n]of this.knownState)t.isEqual(n,t.defaultValue)?delete e[t.key]:e[t.key]=t.unparse(n);for(let n of this.sharedNodeState.flatKeys)n in e&&(t[n]=e[n],delete e[n]);return vc(e)&&(t.$=e),t}getWritable(t){if(this.node===t)return this;let{sharedNodeState:n,unknownState:r}=this,i=new Map(this.knownState);return new e(t,n,function(e,t,n){let r;if(n)for(let[i,a]of Object.entries(n)){if(mc.has(i))continue;let n=e.get(i);n?t.has(n)||t.set(n,n.parse(a)):(r||={},r[i]=a)}return r}(n.sharedConfigMap,i,r),i,this.size)}resetOnCopyNode(){for(let e of this.knownState.keys())e.resetOnCopyNode&&this.knownState.set(e,e.defaultValue);return this}updateFromKnown(e,t){let n=e.key;this.sharedNodeState.sharedConfigMap.set(n,e);let{knownState:r,unknownState:i}=this;i&&n in i?(delete i[n],this.unknownState=vc(i)):r.has(e)||this.size++,r.set(e,t)}updateFromUnknown(e,t){if(mc.has(e))return;let n=this.sharedNodeState.sharedConfigMap.get(e);n?this.updateFromKnown(n,n.parse(t)):(this.unknownState=this.unknownState||{},e in this.unknownState||this.size++,this.unknownState[e]=t)}updateFromJSON(e){let{knownState:t}=this;for(let e of t.keys())t.set(e,e.defaultValue);if(this.size=t.size,this.unknownState=void 0,e)for(let[t,n]of Object.entries(e))this.updateFromUnknown(t,n)}};function gc(e){let t=e.getWritable(),n=t.__state?t.__state.getWritable(t):new hc(t,function(e){return e.__state?e.__state.sharedNodeState:od(Jf(),e.getType()).sharedNodeState}(t));return t.__state=n,n}function _c(e,t){let n=e.getWritable(),r=t.$;return(n.__state||r)&&gc(e).updateFromJSON(r),n}function vc(e){if(e)for(let t in e)return e}function yc(e){return e}function bc(e,t,n){for(let[r,i]of t.knownState){if(e.has(r.key))continue;e.add(r.key);let t=n?n.getValue(r):r.defaultValue;if(t!==i&&!r.isEqual(t,i))return!0}return!1}function xc(e,t,n){let{unknownState:r}=t,i=n?n.unknownState:void 0;if(r){for(let[t,n]of Object.entries(r))if(!e.has(t)&&(e.add(t),n!==(i?i[t]:void 0)))return!0}return!1}function Sc(e,t){let n=e.__state;return n&&n.node===e?n.getWritable(t):n}function Cc(e){return!iu(e)&&e.getTextContent!==$l.prototype.getTextContent}var wc=Symbol.for(`@lexical/CachedTextSize`);function Tc(e,t){return Bc.read(()=>{let n=0,r=e;for(let e=0;e<t&&r!==null;e++){let i=zc.get(r);if(i===void 0&&M(345,r),I(i)){let a=Vc.get(r);if(a!==void 0&&I(a)&&a.__parent!==i.__parent)n+=i.getTextContentSize();else{let e=Hc.get(r),t=e&&e.__lexicalTextContent;typeof t!=`string`&&M(346,i.getType()),n+=t.length}e<t-1&&!i.isInline()&&(n+=2)}else if(il(i).size>0)n+=i.getTextContentSize();else{let e=i[wc];e===void 0&&M(347,i.getType(),r),n+=e}r=i.__next}return n},{editor:P})}function Ec(e){I(e)||il(e).size>0||e[wc]===void 0&&(e[wc]=R(e)?e.__text.length:e.getTextContentSize())}var Dc=4,Oc,P,kc,F=``,Ac=null,jc=null,Mc=null;function Nc(){return{firstTextKey:Mc,format:Ac,style:jc}}function Pc(e){e.firstTextKey!==null&&(Ac=e.format,jc=e.style,Mc=e.firstTextKey)}function Fc(e){if(Mc!==null)return;let t=e.__lexicalFirstTextKey;if(t===void 0&&M(348),t===null)return;let n=Vc.get(t);R(n)&&(Ac=n.getFormat(),jc=n.getStyle(),Mc=t)}var Ic,Lc,Rc,zc,Bc,Vc,Hc,Uc,Wc,Gc,Kc=!1,qc=!1;function Jc(e,t){let n=zc.get(e),r=Vc.has(e);if(t!==null){let n=yl(e);n.parentNode===t&&t.removeChild(n)}if(!r){if(P._keyToDOMMap.delete(e),I(n)){let e=Hp(n,zc);Yc(e,0,e.length-1,null)}if(n!==void 0){for(let e of il(n).values()){let t=ol(e);Jc(e,null),t!==null&&t.remove()}Qd(Wc,kc,Ic,n,`destroyed`)}}}function Yc(e,t,n,r){for(let i=t;i<=n;++i){let t=e[i];t!==void 0&&Jc(t,r)}}function Xc(e,t){e.setProperty(`text-align`,t)}var Zc=`40px`;function Qc(e,t){let n=Oc.theme.indent;if(typeof n==`string`){let r=e.classList.contains(n);t>0&&!r?e.classList.add(n):t<1&&r&&e.classList.remove(n)}e.style.setProperty(`padding-inline-start`,t===0?``:`calc(${t} * var(--lexical-indent-base-value, ${Zc}))`),Xd(e,`class`),Xd(e,`style`)}function $c(e,t){let n=e.style;t===0?Xc(n,``):t===1?Xc(n,`left`):t===2?Xc(n,`center`):t===3?Xc(n,`right`):t===4?Xc(n,`justify`):t===5?Xc(n,`start`):t===6&&Xc(n,`end`),Xd(e,`style`)}function el(e,t){let n=function(e){let t=e.__dir;if(t!==null)return t;if(iu(e))return null;let n=e.getParent();return n===null||U(n)&&n.__dir===null?`auto`:null}(t);n===null?e.removeAttribute(`dir`):e.dir=n}function tl(e){let t=Af().createElement(`div`);return t.setAttribute(`data-lexical-slot`,e),t.style.display=`none`,t}function nl(e,t,n){t||e.contentEditable===`false`?lp(n,P):n.removeAttribute(`contenteditable`)}function rl(e,t,n){let r=F,i=Nc();F=``;let a=``,o=L(e);for(let[r,i]of n){let n=tl(r);nl(t,o,n),t.appendChild(n),F=``;let s=Nc();cl(i,Xf(e,n,P)),Pc(s),al(e,r,t,n),a+=F}return Pc(i),F=r,a}function il(e){return d_(e)&&e.__slots!==null?e.__slots:u_}function al(e,t,n,r){let i=Gc.$getSlotTargetElement(e,t,n,P);i!==null&&(r.parentElement!==i&&i.appendChild(r),r.style.display=``)}function ol(e){let t=Hc.get(e);return t===void 0?null:t.parentElement}function sl(e,t,n){let r=il(e),i=il(t);for(let[e,t]of r)if(!i.has(e)){let e=ol(t);Jc(t,null),e!==null&&e.remove()}let a=F,o=Nc(),s=``,c=null,l=L(t);for(let[e,a]of i){let i=r.get(e),o=i===void 0?null:ol(i);F=``;let u=Nc();if(o===null){o=tl(e);let r=null;for(let e of n.children)if(!e.hasAttribute(`data-lexical-slot`)){r=e;break}n.insertBefore(o,r),cl(a,Xf(t,o,P))}else i===a?ml(a,o):(i!==void 0&&Jc(i,o),cl(a,Xf(t,o,P)));if(Pc(u),nl(n,l,o),al(t,e,n,o),s+=F,o.parentElement===n){let e=c===null?n.firstChild:c.nextSibling;e!==o&&n.insertBefore(o,e),c=o}}return Pc(o),F=a,s}function cl(e,t){let n=Vc.get(e);if(n===void 0&&M(60),t!==null){let r=zc.get(e);if(r!==void 0){let i=Hc.get(e);if(i!==void 0){let a=f_(r)?r.__slotHost:null,o=f_(n)?n.__slotHost:null,s=r.__parent!==n.__parent||a!==o,c=o!==null&&i.parentElement!==t.element;if(s||c)return t.insertChild(i),ml(e,t.element)}}}let r=Gc.$createDOM(n,P);if(function(e,t,n){let r=n._keyToDOMMap;kd(t,n,e),r.set(e,t)}(e,r,P),R(n)?r.setAttribute(`data-lexical-text`,`true`):L(n)&&(r.setAttribute(`data-lexical-decorator`,`true`),sp(r,{captureSelection:!0})),I(n)){let e=F,t=n.__indent,i=n.__size;el(r,n),t!==0&&Qc(r,t);let a=il(n),o=a.size>0?rl(n,r,a):``;if(i===0)r.__lexicalTextContent=o,r.__lexicalFirstTextKey=null,F+=o,a.size>0&&(r.__lexicalSlotTextLength=o.length);else{let t=i-1;if(ll(Hp(n,Vc),n,0,t,Xf(n,r,P)),o!==``){let t=r.__lexicalTextContent||``;r.__lexicalTextContent=o+t,F=e+o+t}a.size>0&&(r.__lexicalSlotTextLength=o.length)}if(Cc(n)){let t=n.getTextContent();r.__lexicalTextContent=t,F=e+t}let s=n.__format;s!==0&&$c(r,s),n.isInline()||(fl(0,n,r),dl(n,r))}else{let t=n.getTextContent();if(L(n)){let t=n.decorate(P,Oc);t!==null&&hl(e,t),r.contentEditable=`false`;let i=il(n);i.size>0&&rl(n,r,i)}F+=t}return t!==null&&t.insertChild(r),Gc.$decorateDOM(n,null,r,P),Ec(n),Qd(Wc,kc,Ic,n,`created`),r}function ll(e,t,n,r,i){let a=F,o=Nc();F=``,Ac=null,jc=null,Mc=null;let s=n;for(;s<=r;++s){let t=Nc();cl(e[s],i);let n=Vc.get(e[s]);n!==null&&R(n)?Ac===null&&(Ac=n.getFormat(),jc=n.getStyle(),Mc=n.__key):I(n)&&s<r&&!n.isInline()&&(F+=Ra),Pc(t)}let c=P._keyToDOMMap.get(t.__key);c===void 0&&M(349,t.__key),c.__lexicalTextContent=F,c.__lexicalFirstTextKey=Mc,F=a+F,Pc(o)}function ul(e){return L(e)&&!e.isInline()}function dl(e,t,n=Xf(e,t,P)){n.setDecoratorBoundaryAnchor(`leading`,ul(e.getFirstChild())),n.setDecoratorBoundaryAnchor(`trailing`,ul(e.getLastChild()))}function fl(e,t,n){let r=Xf(t,n,P),i=function(e,t){if(e){let n=e.__last;if(n){let e=t.get(n);if(e)return lm(e)?`line-break`:L(e)&&e.isInline()?`decorator`:null}return`empty`}return null}(t,Vc);r.setManagedLineBreak(i)}function pl(e,t,n){let r=t.__lexicalFirstTextKey;if(r!=null){let t=e.__key,i=r;for(;i!==null;){let e=Vc.get(i);if(e===void 0){i=null;break}if(e.__parent===t)break;i=e.__parent}if(i!==null&&!n.has(i)){let e=Vc.get(r);if(R(e))return Ac=e.getFormat(),void(jc=e.getStyle())}}t.__lexicalFirstTextKey=Mc}function ml(e,t){let n=zc.get(e),r=Vc.get(e);n!==void 0&&r!==void 0||M(61);let i=Kc||Rc.has(e)||Lc.has(e),a=rf(P,e);if(n===r&&!i){let e;if(I(n)){let t=a.__lexicalTextContent;typeof t!=`string`&&M(355,n.getType()),e=t,Fc(a)}else e=n.getTextContent();return F+=e,a}if(n!==r&&i&&Qd(Wc,kc,Ic,r,`updated`),Gc.$updateDOM(r,n,a,P)){let n=cl(e,null);return t===null&&M(62),t.replaceChild(n,a),Jc(e,null),n}if(I(n)){I(r)||M(334,e);let t=r.__indent;(Kc||t!==n.__indent)&&Qc(a,t);let o=r.__format;(Kc||o!==n.__format)&&$c(a,o);let s=i&&(il(r).size>0||il(n).size>0)?sl(n,r,a):``;if(i){let e=F;if(function(e,t,n){var r;Ac=null,jc=null,Mc=null,function(e,t,n){let r=F,i=e.__size,a=t.__size;F=``;let o=n.element,s=P._keyToDOMMap.get(t.__key);s===void 0&&M(351,t.__key);let c=a-i;if(!Kc&&Math.abs(c)<=1&&i>=Dc&&e.__first===t.__first&&(c!==0||!P._cloneNotNeeded.has(e.__key))){let i=s.__lexicalTextContent,l=Uc.get(e.__key);if(!Kc&&!Cc(t)&&typeof i==`string`&&l!==void 0){let a=function(e,t){let n=t.size;if(n===0||n>=e.__size)return null;let r=e.__last,i=null,a=0;for(;r!==null&&a<n;){if(!t.has(r))return null;i=r;let e=Vc.get(r);if(e===void 0)return null;r=e.__prev,a++}return a!==n||r!==null&&t.has(r)?null:i}(t,l);if(a!==null){let u=l.size;if(c===0){let e=Tc(a,u),n=a,c=0;for(;n!==null&&c<u;){let e=Vc.get(n);if(e===void 0)break;let t=Nc();ml(n,o),R(e)&&Ac===null&&(Ac=e.getFormat(),jc=e.getStyle(),Mc=e.__key),Pc(t),n=e.__next,c++}let d=``;for(n=a,c=0;n!==null&&c<u;){let e=Vc.get(n);if(e===void 0)break;let t;if(I(e)){let r=P._keyToDOMMap.get(n),i=r&&r.__lexicalTextContent;typeof i!=`string`&&M(352,e.getType()),t=i}else t=e.getTextContent();d+=t,c<u-1&&I(e)&&!e.isInline()&&(d+=Ra),n=e.__next,c++}let f=s.__lexicalSlotTextLength||0,p=f>0?i.slice(f):i,m=p.slice(0,p.length-e)+d;s.__lexicalTextContent=m,F=r+m,pl(t,s,l);return}if(function(e,t,n,r,i,a,o,s){if(s!==1&&s!==-1||o!==(s===1?2:1))return!1;let c=o-s,l=e.__last;for(let e=0;e<c-1;e++){if(l===null)return!1;let e=zc.get(l);if(e===void 0)return!1;l=e.__prev}if(l===null)return!1;let u=Vc.get(a),d=zc.get(l);if(u===void 0||d===void 0||u.__prev!==d.__prev)return!1;let f=[],p=a;for(let e=0;e<o;e++){if(p===null)return!1;f.push(p);let e=Vc.get(p);p=e?e.__next:null}let m=[];p=l;for(let e=0;e<c;e++){if(p===null)return!1;m.push(p);let e=zc.get(p);p=e?e.__next:null}let h=new Set(m),g=new Set(f),_=[],v=0,y=0;for(;v<c&&y<o;)if(f[y]===m[v])_.push({key:f[y],kind:`reconcile`}),v++,y++;else if(g.has(m[v])){if(h.has(f[y]))return!1;_.push({key:f[y],kind:`create`,nextIndex:y}),y++}else _.push({key:m[v],kind:`destroy`}),v++;for(;v<c;)_.push({key:m[v++],kind:`destroy`});for(;y<o;)_.push({key:f[y],kind:`create`,nextIndex:y}),y++;let b=Tc(l,c);for(let e of _){let t=Nc();if(e.kind===`reconcile`)ml(e.key,n.element);else if(e.kind===`destroy`)Jc(e.key,n.element);else{let t=null;for(let n=e.nextIndex+1;n<o;n++){let e=P._keyToDOMMap.get(f[n]);if(e!==void 0){t=e;break}}cl(e.key,n.withBefore(t??n.before))}if(e.kind!==`destroy`){let t=Vc.get(e.key);t&&R(t)&&Ac===null&&(Ac=t.getFormat(),jc=t.getStyle(),Mc=t.__key)}Pc(t)}let x=``;for(let e=0;e<o;e++){let t=Vc.get(f[e]);if(t===void 0)return!1;let n;if(I(t)){let r=P._keyToDOMMap.get(f[e]),i=r&&r.__lexicalTextContent;typeof i!=`string`&&M(350,t.getType()),n=i}else n=t.getTextContent();x+=n,e<o-1&&I(t)&&!t.isInline()&&(x+=Ra)}let S=r.__lexicalSlotTextLength||0,C=S>0?i.slice(S):i;return r.__lexicalTextContent=C.slice(0,C.length-b)+x,!0}(e,0,n,s,i,a,u,c)){let e=s.__lexicalTextContent;typeof e!=`string`&&M(353),F=r+e,pl(t,s,l);return}}}if(c===0){let t=e.__first,n=0;for(;t!==null;){let e=Vc.get(t);if(e===void 0)break;let r=Kc||Rc.has(t)||Lc.has(t),i=Nc();if(r)ml(t,o);else{let n,r;if(I(e)){r=Hc.get(t);let i=r&&r.__lexicalTextContent;typeof i!=`string`&&M(354,e.getType()),n=i}else n=e.getTextContent();F+=n,r!==void 0&&Fc(r)}R(e)?Ac===null&&(Ac=e.getFormat(),jc=e.getStyle(),Mc=e.__key):I(e)&&n<a-1&&!e.isInline()&&(F+=Ra),Pc(i),t=e.__next,n++}s.__lexicalTextContent=F,s.__lexicalFirstTextKey=Mc,F=r+F;return}}if(i===1&&a===1){let r=e.__first,i=t.__first;if(r===i)ml(r,o);else{let e=yl(r),t=cl(i,null);try{e.parentNode===o?o.replaceChild(t,e):n.insertChild(t)}catch(n){if(typeof n==`object`&&n){let a=`${n.toString()} Parent: ${o.tagName}, new child: {tag: ${t.tagName} key: ${i}}, old child: {tag: ${e.tagName}, key: ${r}}.`;throw Error(a)}throw n}Jc(r,null)}let a=Vc.get(i);R(a)&&Ac===null&&(Ac=a.getFormat(),jc=a.getStyle(),Mc=a.__key)}else{let r=Hp(e,zc),s=Hp(t,Vc);if(r.length!==i&&M(227),s.length!==a&&M(228),i===0)a!==0&&ll(s,t,0,a-1,n);else if(a===0){if(i!==0){let e=n.after==null&&n.before==null&&il(t).size===0&&n.element.__lexicalLineBreak==null;Yc(r,0,i-1,e?null:o),e&&(o.textContent=``)}}else(function(e,t,n,r,i,a){let o=r-1,s=i-1,c,l,u=a.getFirstChild(),d=0,f=0;for(;d<=o&&f<=s;){let e=t[d],r=n[f],i=Nc();if(e===r)u=gl(ml(r,a.element)),d++,f++;else{if(l===void 0&&(l=_l(n,f)),c===void 0)c=_l(t,d);else if(!c.has(e)){d++,Pc(i);continue}if(!l.has(e)){let t=yl(e);t.parentNode===a.element&&(u=gl(t)),Jc(e,a.element),d++,c.delete(e),Pc(i);continue}if(c.has(r)){let e=rf(P,r);e!==u&&a.withBefore(u??a.before).insertChild(e),u=gl(ml(r,a.element)),d++,f++}else cl(r,a.withBefore(u??a.before)),f++}let o=Vc.get(r);o!==null&&R(o)?Ac===null&&(Ac=o.getFormat(),jc=o.getStyle(),Mc=o.__key):I(o)&&f<=s&&!o.isInline()&&(F+=Ra),Pc(i)}let p=d>o,m=f>s;if(p&&!m){let t=n[s+1],r=t===void 0?null:P.getElementByKey(t);ll(n,e,f,s,a.withBefore(r??a.before))}else m&&!p&&Yc(t,d,o,a.element)})(t,r,s,i,a,n)}s.__lexicalTextContent=F,s.__lexicalFirstTextKey=Mc,F=r+F}(e,t,Xf(t,n,P)),U(t)||(r=t,Ac==null||Ac===r.__textFormat||qc||r.setTextFormat(Ac),function(e){jc==null||jc===e.__textStyle||qc||e.setTextStyle(jc)}(t))}(n,r,a),r.isInline()||(iu(r)||fl(0,r,a),dl(r,a)),s!==``){let t=a.__lexicalTextContent||``;a.__lexicalTextContent=s+t,F=e+s+t,a.__lexicalSlotTextLength=s.length}else(il(r).size>0||il(n).size>0)&&(a.__lexicalSlotTextLength=0);if(Cc(r)){let t=r.getTextContent();a.__lexicalTextContent=t,F=e+t}}else{let e=a.__lexicalTextContent;typeof e!=`string`&&M(356,n.getType()),F+=e,Fc(a)}if((Kc||r.__dir!==n.__dir||r.__parent!==n.__parent)&&(el(a,r),iu(r)&&!Kc))for(let e of r.getChildren())I(e)&&el(rf(P,e.getKey()),e)}else{let t=r.getTextContent();if(L(r)){let t=r.decorate(P,Oc);t!==null&&hl(e,t),i&&(il(r).size>0||il(n).size>0)&&sl(n,r,a)}F+=t}if(!qc&&iu(r)){let e=r.getLatest();if(e.__cachedText!==F){let t=e.getWritable();t.__cachedText=F,r=t}}return Gc.$decorateDOM(r,n,a,P),Ec(r),a}function hl(e,t){let n=P._pendingDecorators,r=P._decorators;if(n===null){if(r[e]===t)return;n=Md(P)}n[e]=t}function gl(e){let t=e.nextSibling;return t!==null&&t===P._blockCursorElement&&(t=t.nextSibling),t}function _l(e,t){let n=new Set;for(let r=t;r<e.length;r++)n.add(e[r]);return n}function vl(e,t,n,r,i,a){F=``,Ac=null,jc=null,Mc=null,Kc=r===2,P=n,Oc=n._config,Gc=n._config.dom||gm,kc=n._nodes,Ic=P._listeners.mutation,Lc=i,Rc=a,zc=e._nodeMap,Bc=e,Vc=t._nodeMap,qc=t._readOnly,Hc=as(n._keyToDOMMap),Uc=function(){let e=new Map,t=t=>{for(let n of t){let t=Vc.get(n);if(t===void 0)continue;let r=t.__parent;if(r===null)continue;let i=e.get(r);i===void 0&&(i=new Set,e.set(r,i)),i.add(n)}};return t(Lc.keys()),t(Rc),e}();let o=new Map;return Wc=o,ml(`root`,null),P=void 0,kc=void 0,Lc=void 0,Rc=void 0,zc=void 0,Bc=void 0,Vc=void 0,Oc=void 0,Hc=void 0,Uc=void 0,Wc=void 0,Gc=gm,o}function yl(e){let t=Hc.get(e);return t===void 0&&M(75,e),t}function bl(e,t,n){Nm();let r=e.__key,i=e.getParent();if(i===null)return void(p_(e)!==null&&M(367,r,String(p_(e))));let a=function(e){let t=J();if(!q(t)||!I(e))return t;let{anchor:n,focus:r}=t,i=n.getNode(),a=r.getNode();return df(i,e)&&n.set(e.__key,0,`element`),df(a,e)&&r.set(e.__key,0,`element`),t}(e),o=!1;if(q(a)&&t){let t=a.anchor,n=a.focus;t.key===r&&(Hg(t,e,i,e.getPreviousSibling(),e.getNextSibling()),o=!0),n.key===r&&(Hg(n,e,i,e.getPreviousSibling(),e.getNextSibling()),o=!0)}else lg(a)&&t&&e.isSelected()&&e.selectPrevious();o_(e.getWritable(),t&&!o&&q(a)?a:null),n||U(i)||i.canBeEmpty()||!i.isEmpty()||bl(i,t),t&&a&&iu(i)&&i.isEmpty()&&i.selectEnd()}function xl(e){return e}var Sl=Symbol.for(`ephemeral`);function Cl(e){return e[Sl]||!1}var wl={configurable:!0,enumerable:!1,value:void 0,writable:!0},Tl=class{__type;__key;__parent;__prev;__next;__state;static getType(){let{ownNodeType:e}=Mp(this);return e===void 0&&M(64,this.name),e}static clone(e){M(65,this.name)}$config(){return{}}config(e,t){let n=t.extends||Up(this.constructor);return Object.assign(t,{extends:n}),typeof e==`string`&&Object.assign(t,{type:e}),{[e]:t}}afterCloneFrom(e){this.__key===e.__key?(this.__parent=e.__parent,this.__next=e.__next,this.__prev=e.__prev,this.__state=e.__state):e.__state&&(this.__state=e.__state.getWritable(this))}resetOnCopyNodeFrom(e){this.__state&&=this.__state.getWritable(this).resetOnCopyNode()}static importDOM;constructor(e){this.__type=this.constructor.getType(),this.__parent=null,this.__prev=null,this.__next=null,Object.defineProperty(this,"__state",wl),Object.defineProperty(this,wc,wl),Sd(this,e)}getType(){return this.__type}isInline(){M(137,this.constructor.name)}isAttached(){let e=this.__key;for(;e!==null;){if(e===`root`)return!0;let t=B(e);if(t===null)break;e=t.__parent===null?p_(t):t.__parent}return!1}isSelected(e){let t=e||J();if(t==null)return!1;let n=t.getNodes().some(e=>e.__key===this.__key);if(R(this))return n;if(q(t)&&t.anchor.type===`element`&&t.focus.type===`element`){if(t.isCollapsed())return!1;let e=this.getParent();if(L(this)&&this.isInline()&&e){let n=t.isBackward()?t.focus:t.anchor;if(e.is(n.getNode())&&n.offset===e.getChildrenSize()&&this.is(e.getLastChild()))return!1}}return n}getKey(){return this.__key}getIndexWithinParent(){let e=this.getParent();if(e===null)return-1;let t=e.getFirstChild(),n=0;for(;t!==null;){if(this.is(t))return n;n++,t=t.getNextSibling()}return-1}getParent(){let e=this.getLatest().__parent;return e===null?null:B(e)}getParentOrThrow(){let e=this.getParent();return e===null&&M(66,this.__key),e}getTopLevelElement(){let e=this;for(;e!==null;){let t=e.getParent();if(U(t)||p_(e)!==null)return I(e)||e===this&&L(e)||M(194),e;e=t}return null}getTopLevelElementOrThrow(){let e=this.getTopLevelElement();return e===null&&M(67,this.__key),e}getParents(){let e=[],t=this.getParent();for(;t!==null;)e.push(t),t=t.getParent();return e}getParentKeys(){let e=[],t=this.getParent();for(;t!==null;)e.push(t.__key),t=t.getParent();return e}getPreviousSibling(){let e=this.getLatest().__prev;return e===null?null:B(e)}getPreviousSiblings(){return l_(this.getPreviousSibling(),`previous`).reverse()}getNextSibling(){let e=this.getLatest().__next;return e===null?null:B(e)}getNextSiblings(){return l_(this.getNextSibling(),`next`)}is(e){return e!=null&&this.__key===e.__key}isBefore(e){let t=dv(this,e);return t!==null&&(t.type===`descendant`||(t.type===`branch`?cv(t)===-1:(t.type!==`same`&&t.type!==`ancestor`&&M(279),!1)))}isParentOf(e){return df(e,this)}getNodesBetween(e){let t=this.isBefore(e),n=[],r=this,i=!0,a=0;for(;r!==null&&((i||a===0)&&n.push(r),!r.is(e));){!i&&a>0&&a--;let e=i&&I(r)?t?r.getFirstChild():r.getLastChild():null;e!==null&&a++;let n=e||(t?r.getNextSibling():r.getPreviousSibling());i=n!==null,r=n||r.getParent()}return t?n:n.reverse()}isDirty(){let e=K()._dirtyLeaves;return e!==null&&e.has(this.__key)}getLatest(){if(Cl(this))return this;let e=B(this.__key);return e===null&&M(442,this.__key,this.__type),e}getWritable(){if(Cl(this))return this;Nm();let e=Fm(),t=K(),n=this.__key,r=t._cloneNotNeeded,i=r.get(n),a=e._selection;if(a!==null&&a.setCachedNodes(null),i!==void 0)return wd(i),i;let o=e._nodeMap,s=o.get(n);s===void 0&&M(442,n,this.__type);let c=np(s);return r.set(n,c),o.set(n,c),wd(c),c}getTextContent(){return D_(this)}getTextContentSize(){return this.getTextContent().length}createDOM(e,t){M(70)}updateDOM(e,t,n){M(71)}getDOMSlot(e){return new gs(e)}exportDOM(e){return{element:Yf(e).$createDOM(this,e)}}exportJSON(e=!1){let t=function(e,t){let n=mp(pp(e.constructor)),{generated:r,isCompactDefault:i}=n,a=r===null?void 0:t?r.exportCompactJSON:r.exportJSON;return a===void 0?function(e,t,n){let r=n?{type:e.__type}:{};return I(e)&&(r.children=[]),function(e,t,n,r){for(let i=0;i<t.length;i++){let a=t[i];if(r&&a.derived)continue;let o;if(a.kind===`ownField`){let t=Dp(e)[a.field];o=a.getterTable===void 0?t:qs(a.getterTable,t)?a.getterTable[t]:void 0}else o=a.getter.call(e);a.kind===`ownField`&&a.when!==void 0&&(!Op(a,o)&&a.when.call(e)||(o=void 0)),r&&Op(a,o)||(n[a.key]=o)}}(e,t,r,n),n||(r.type=e.__type,r.version=1),r}(e,n.getters,t):t?a(e,i):a(e)}(this,e),n=this.__state?this.__state.toJSON():void 0;return n!==void 0&&Object.assign(t,n),t}static importJSON(e){M(18,this.name)}updateFromJSON(e){return jp(_c(this,e),e)}static transform(){return null}remove(e){bl(this,!0,e)}replace(e,t){Nm();let n=J();n!==null&&(n=n.clone()),yf(this,e);let r=this.getLatest(),i=this.__key,a=m_(r);a!==null&&M(400,i,r.getType(),a.getKey(),a.getType());let o=e.__key,s=e.getWritable(),c=this.getParentOrThrow().getWritable(),l=c.__size,u=s.getParent();o_(s,q(n)?n:null);let d=r.getPreviousSibling(),f=r.getNextSibling();bl(r,!1,!0),i_(c,s,d&&d.getWritable(),f&&f.getWritable()),c.__size=u!==null&&u.is(c)?l-1:l;let p=0;if(t&&(I(this)&&I(s)||M(139),p=s.getChildrenSize(),s.splice(p,0,this.getChildren())),q(n)){Id(n);for(let e of[n.anchor,n.focus])e.key===i&&(t&&e.type===`element`?e.set(s.__key,p+e.offset,`element`):ng(e,s))}return Ed()===i&&Td(o),s}insertAfter(e,t=!0){return s_(this,`next`,e,t)}insertBefore(e,t=!0){return s_(this,`previous`,e,t)}isParentRequired(){return!1}createParentElementNode(){return z()}selectStart(){return this.selectPrevious()}selectEnd(){return this.selectNext(0,0)}selectPrevious(e,t){return c_(Y(this,`previous`),e,t)}selectNext(e,t){return c_(Y(this,`next`),e,t)}markDirty(){this.getWritable()}reconcileObservedMutation(e,t){this.markDirty()}};function El(e){return e instanceof Tl}function Dl(e,t){let n=e.__mode,r=e.__format,i=e.__style,a=t.__mode,o=t.__format,s=t.__style,c=e.__state,l=t.__state;return(n===null||n===a)&&(r===null||r===o)&&(i===null||i===s)&&(e.__state===null||c===l||function(e,t){if(e===t)return!0;let n=new Set;return!(e&&bc(n,e,t)||t&&bc(n,t,e)||e&&xc(n,e,t)||t&&xc(n,t,e))}(c,l))}function Ol(e,t){let n=e.mergeWithSibling(t),r=K()._normalizedNodes;return r.add(e.__key),r.add(t.__key),n}function kl(e){let t,n,r=e;if(!Dd(r)){if(r.__text!==``||!r.isSimpleText()||r.isUnmergeable()){for(;(t=r.getPreviousSibling())!==null&&R(t)&&t.isSimpleText()&&!t.isUnmergeable()&&!Dd(t);){if(t.__text!==``){if(Dl(t,r)){r=Ol(t,r);break}break}t.remove()}for(;(n=r.getNextSibling())!==null&&R(n)&&n.isSimpleText()&&!n.isUnmergeable()&&!Dd(n);){if(n.__text!==``){if(Dl(r,n)){r=Ol(r,n);break}break}n.remove()}}else r.remove()}}function Al(e){return jl(e.anchor),jl(e.focus),e}function jl(e){for(;e.type===`element`;){let t=e.getNode(),n=e.offset,r,i;if(n===t.getChildrenSize()?(r=t.getChildAtIndex(n-1),i=!0):(r=t.getChildAtIndex(n),i=!1),R(r)){e.set(r.__key,i?r.getTextContentSize():0,`text`,!0);break}if(!I(r))break;e.set(r.__key,i?r.getChildrenSize():0,`element`,!0)}}var Ml=/^-?(?:0|[1-9]\d*)(?:\.\d+)?(?:[eE][+-]?\d+)?$/;function Nl(e,t){if(typeof e==`number`)return Number.isFinite(e)?e:t;if(typeof e!=`string`||!Ml.test(e))return t;let n=Number(e);return Number.isFinite(n)?n:t}function Pl(e,t,n,r,i){let a=Nl(e,t);return a>=n&&a<=r&&Number.isInteger(a)?a:t}var Fl=e=>{let t=Ns(e,`format`),n=Ps(e,`format`),r=Is(e,`format`);return{exportJSON:function(e){let n=e.__textFormat,r=e.__textStyle,i=(n!==0||r!==``)&&e.shouldSerializeTextStyles();return{children:[],direction:e.__dir,format:t[e.__format],indent:e.__indent,textFormat:n!==0&&i?n:void 0,textStyle:r!==``&&i?r:void 0,type:e.__type,version:1}},exportCompactJSON:function(e){let n=e.__textFormat,r=e.__textStyle,i=(n!==0||r!==``)&&e.shouldSerializeTextStyles(),a={type:e.__type,children:[]},o=e.__dir;o!=null&&(a.direction=o);let s=t[e.__format];s!==void 0&&s!==``&&(a.format=s);let c=e.__indent;return c!==void 0&&c!==0&&(a.indent=c),n!==void 0&&n!==0&&i&&(a.textFormat=n),r!==void 0&&r!==``&&i&&(a.textStyle=r),a},updateFromJSON:function(e,t){let i=t.direction;e.__dir=i===null||i===`ltr`||i===`rtl`?i:null;let a=t.format;e.__format=typeof a==`string`&&a in n?n[a]:r,e.__indent=Pl(t.indent,0,0,1/0),e.__textFormat=Nl(t.textFormat,0);let o=t.textStyle;return e.__textStyle=typeof o==`string`?o:``,e}}};function Il(e,t){e.__detail=t.__detail,e.__format=t.__format,e.__mode=t.__mode,e.__style=t.__style,e.__text=t.__text}var Ll=e=>{let t=Ns(e,`mode`),n=Fs(e,`detail`,0),r=Fs(e,`format`,0),i=Ps(e,`mode`),a=Is(e,`mode`);return{exportJSON:function(e){return{detail:e.__detail,format:e.__format,mode:t[e.__mode],style:e.__style,text:e.__text,type:e.__type,version:1}},exportCompactJSON:function(e){let n={type:e.__type},r=e.__detail;r!==void 0&&r!==0&&(n.detail=r);let i=e.__format;i!==void 0&&i!==0&&(n.format=i);let a=t[e.__mode];a!==void 0&&a!==`normal`&&(n.mode=a);let o=e.__style;o!==void 0&&o!==``&&(n.style=o);let s=e.__text;return s!==void 0&&s!==``&&(n.text=s),n},updateFromJSON:function(e,t){let o=t.detail;e.__detail=typeof o==`string`&&o in n?n[o]:Nl(o,0);let s=t.format;e.__format=typeof s==`string`&&s in r?r[s]:Nl(s,0);let c=t.mode;e.__mode=typeof c==`string`&&c in i?i[c]:a;let l=t.style;e.__style=typeof l==`string`?l:``;let u=t.text;return e.__text=typeof u==`string`?u:``,e},afterCloneFrom:Il}},Rl=e=>{let t=Ns(e,`format`),n=Ps(e,`format`),r=Is(e,`format`);return{exportJSON:function(e){let n=e.__textFormat,r=e.__textStyle,i=(n!==0||r!==``)&&e.shouldSerializeTextStyles();return{children:[],direction:e.__dir,format:t[e.__format],indent:e.__indent,textFormat:n!==0&&i?n:void 0,textStyle:r!==``&&i?r:void 0,type:e.__type,version:1}},exportCompactJSON:function(e){let n=e.__textFormat,r=e.__textStyle,i=(n!==0||r!==``)&&e.shouldSerializeTextStyles(),a={type:e.__type,children:[]},o=e.__dir;o!=null&&(a.direction=o);let s=t[e.__format];s!==void 0&&s!==``&&(a.format=s);let c=e.__indent;return c!==void 0&&c!==0&&(a.indent=c),n!==void 0&&n!==0&&i&&(a.textFormat=n),r!==void 0&&r!==``&&i&&(a.textStyle=r),a},updateFromJSON:function(e,t){let i=t.direction;e.__dir=i===null||i===`ltr`||i===`rtl`?i:null;let a=t.format;e.__format=typeof a==`string`&&a in n?n[a]:r,e.__indent=Pl(t.indent,0,0,1/0),e.__textFormat=Nl(t.textFormat,0);let o=t.textStyle;return e.__textStyle=typeof o==`string`?o:``,e}}},zl=()=>({exportJSON:function(e){return{type:e.__type,version:1}},exportCompactJSON:function(e){return{type:e.__type}}}),Bl=e=>{let t=Ns(e,`mode`),n=Fs(e,`format`,0);return{exportJSON:function(e){return{detail:e.__detail,mode:t[e.__mode],text:e.__text,format:e.__format,style:e.__style,type:e.__type,version:1}},exportCompactJSON:function(e){let t={type:e.__type},n=e.__format;n!==void 0&&n!==0&&(t.format=n);let r=e.__style;return r!==void 0&&r!==``&&(t.style=r),t},updateFromJSON:function(e,t){let r=t.format;e.__format=typeof r==`string`&&r in n?n[r]:Nl(r,0);let i=t.style;return e.__style=typeof i==`string`?i:``,e}}},Vl=new WeakMap;function Hl(e,t){for(let n=e;n!==null&&n!==t;n=Object.getPrototypeOf(n)){let t=n.prototype;if(t!==void 0&&Object.prototype.hasOwnProperty.call(t,`isInline`)&&typeof t.isInline==`function`&&!Fp(t.isInline))try{let t=e.prototype.isInline.call(Object.create(e.prototype));return typeof t==`boolean`?t:null}catch{return null}}}function Ul(e){for(let{ownNodeConfig:t}of Bp(e))if(t&&t.children!==void 0)return t.children}function Wl(e){let t=Vl.get(e);if(t===void 0){let n={},r={},i=!1;for(let{klass:t,ownNodeConfig:a}of Bp(e))a&&(r.inline===void 0&&a.inline!==void 0&&(n.inline=a.inline,r.inline=t),r.children===void 0&&a.children!==void 0&&(n.children=a.children,r.children=t),i||a.mergeAdjacent===void 0||(i=!0,!1!==a.mergeAdjacent&&(n.mergeAdjacent=a.mergeAdjacent,r.mergeAdjacent=t)));let a=function(e){let t=new Set,n=Cp(e);for(let e of Object.keys(n))!0===n[e].derived&&t.add(e);for(let{ownNodeConfig:n}of Bp(e)){let e=n&&n.stateConfigs;if(e)for(let n of e){let e=n instanceof cc?n:n.stateConfig;e.derived&&t.add(e.key)}}return t}(e);r.inline!==void 0&&r.inline!==e&&Hl(e,r.inline)!==void 0&&Hl(e,r.inline)!==n.inline&&(delete n.inline,delete r.inline),r.mergeAdjacent===void 0||r.mergeAdjacent===e||function(e,t,n){let r=Cp(e);for(let e of t.by)if(typeof e==`string`){if(!(e in r))return{entry:e,reason:`unknown`};if(n.has(e))return{entry:e,reason:`derived`}}else if(e.derived)return{entry:String(e.key),reason:`derived-state`};return null}(e,n.mergeAdjacent,a)===null&&function(e,t){if(!Array.isArray(t)||t.includes(`inline`))return null;for(let n of t){if(n===`inline`)continue;let t=Ul(n);if(!(t===`inline`||Array.isArray(t)&&t.includes(`inline`)&&t.every(t=>t===`inline`||t===e||e.prototype instanceof t)))return n}return null}(e,n.children)===null||(delete n.mergeAdjacent,delete r.mergeAdjacent),t=Object.freeze({...n,declaredBy:Object.freeze(r),derived:a,derivedNames:a}),Vl.set(e,t)}return t}function Gl(e){let{derivedNames:t,...n}=Wl(e);return Object.freeze({...n,derived:new Set(t)})}function Kl(e){return!1}function ql(){return{...Wa,0:``}}function Jl(){return{...Ha,"":0}}var Yl=ql(),Xl=Jl(),Zl=tc()({direction:ic(Qs([null,`ltr`,`rtl`]),{field:`__dir`}),format:ic(Qs([``,`left`,`start`,`center`,`right`,`end`,`justify`]),{field:`__format`,getter:`getFormatType`,getterTable:Yl,setter:`setFormat`,setterTable:Xl}),indent:ic(Xs(0,{integer:!0,min:0}),{field:`__indent`}),textFormat:ac(Xs(),{getter:{field:`__textFormat`,method:`getSerializedTextFormat`,when:`shouldSerializeTextStyles`},setter:{field:`__textFormat`}}),textStyle:ac(Js(),{getter:{field:`__textStyle`,method:`getSerializedTextStyle`,when:`shouldSerializeTextStyles`},setter:{field:`__textStyle`}})});function Ql(e){if(U(e)&&!Kl(K())){let t=null;for(let n of e.getChildren())t=n.isInline()?(t||n.replace(n.createParentElementNode())).append(n):null}}var $l=class extends Tl{__first;__last;__size;__format;__style;__indent;__dir;__textFormat;__textStyle;__slotHost;__slots;$config(){return this.config(Symbol.for(`ElementNode`),{$transform:Ql,extends:Tl,generated:Fl,json:Zl})}constructor(e){super(e),this.__first=null,this.__last=null,this.__size=0,this.__format=0,this.__style=``,this.__indent=0,this.__dir=null,this.__textFormat=0,this.__textStyle=``,this.__slotHost=null,this.__slots=null}afterCloneFrom(e){super.afterCloneFrom(e),this.__key===e.__key&&(this.__first=e.__first,this.__last=e.__last,this.__size=e.__size,this.__slotHost=e.__slotHost,this.__slotHost!==null&&this.__parent!==null&&M(384,this.__key,String(this.__slotHost),String(this.__parent)),this.__slots=e.__slots),this.__style=e.__style,function(e,t){e.__dir=t.__dir,e.__format=t.__format,e.__indent=t.__indent,e.__textFormat=t.__textFormat,e.__textStyle=t.__textStyle}(this,e)}getFormat(){return this.getLatest().__format}getFormatType(){return Wa[this.getFormat()]||``}getStyle(){return this.getLatest().__style}getIndent(){return this.getLatest().__indent}getChildren(){return l_(this.getFirstChild(),`next`)}getChildrenKeys(){let e=[],t=this.getFirstChild();for(;t!==null;)e.push(t.__key),t=t.getNextSibling();return e}getChildrenSize(){return this.getLatest().__size}isEmpty(){return this.getChildrenSize()===0&&y_(this).length===0}isDirty(){let e=K()._dirtyElements;return e!==null&&e.has(this.__key)}isLastChild(){let e=this.getLatest(),t=this.getParentOrThrow().getLastChild();return t!==null&&t.is(e)}getAllTextNodes(){let e=[];for(let t of y_(this)){let n=b_(this,t);if(I(n))for(let t of n.getAllTextNodes())e.push(t)}let t=this.getFirstChild();for(;t!==null;){if(R(t)&&e.push(t),I(t))for(let n of t.getAllTextNodes())e.push(n);t=t.getNextSibling()}return e}getFirstDescendant(){let e=this.getFirstChild();for(;I(e);){let t=e.getFirstChild();if(t===null)break;e=t}return e}getLastDescendant(){let e=this.getLastChild();for(;I(e);){let t=e.getLastChild();if(t===null)break;e=t}return e}getDescendantByIndex(e){let t=e>=this.getChildrenSize(),n=t?this.getLastChild():this.getChildAtIndex(e);return I(n)&&(t?n.getLastDescendant():n.getFirstDescendant())||n}getFirstChild(){let e=this.getLatest().__first;return e===null?null:B(e)}getFirstChildOrThrow(){let e=this.getFirstChild();return e===null&&M(45,this.__key),e}getLastChild(){let e=this.getLatest().__last;return e===null?null:B(e)}getLastChildOrThrow(){let e=this.getLastChild();return e===null&&M(96,this.__key),e}getChildAtIndex(e){let t=this.getChildrenSize(),n,r;if(e<t/2){for(n=this.getFirstChild(),r=0;n!==null&&r<=e;){if(r===e)return n;n=n.getNextSibling(),r++}return null}for(n=this.getLastChild(),r=t-1;n!==null&&r>=e;){if(r===e)return n;n=n.getPreviousSibling(),r--}return null}getTextContent(){let e=D_(this),t=this.getChildren(),n=t.length;for(let r=0;r<n;r++){let i=t[r];e+=i.getTextContent(),I(i)&&r!==n-1&&!i.isInline()&&(e+=Ra)}return e}getTextContentSize(){let e=function(e){let t=0;for(let n of v_(e).values()){let e=B(n);e!==null&&(t+=e.getTextContentSize())}return t}(this),t=this.getChildren(),n=t.length;for(let r=0;r<n;r++){let i=t[r];e+=i.getTextContentSize(),I(i)&&r!==n-1&&!i.isInline()&&(e+=2)}return e}getDirection(){return this.getLatest().__dir}getTextFormat(){return this.getLatest().__textFormat}hasFormat(e){if(e!==``){let t=Ha[e];return(this.getFormat()&t)!==0}return!1}hasTextFormat(e){let t=Ba[e];return(this.getTextFormat()&t)!==0}getFormatFlags(e,t){return bd(this.getLatest().__textFormat,e,t)}getTextStyle(){return this.getLatest().__textStyle}select(e,t){Nm();let n=J(),r=e,i=t,a=this.getChildrenSize();if(!this.canBeEmpty()){if(e===0&&t===0){let e=this.getFirstChild();if(R(e)||I(e))return e.select(0,0)}else if(!(e!==void 0&&e!==a||t!==void 0&&t!==a)){let e=this.getLastChild();if(R(e)||I(e))return e.select()}}r===void 0&&(r=a),i===void 0&&(i=a);let o=this.__key;return q(n)?(n.anchor.set(o,r,`element`),n.focus.set(o,i,`element`),n.dirty=!0,n):Mg(o,r,o,i,`element`,`element`)}selectStart(){let e=this.getFirstDescendant();return e?e.selectStart():this.select()}selectEnd(){let e=this.getLastDescendant();return e?e.selectEnd():this.select()}clear(){let e=this.getWritable();return this.getChildren().forEach(e=>e.remove()),e}append(...e){return this.splice(this.getChildrenSize(),0,e)}setDirection(e){let t=this.getWritable();return t.__dir=e,t}setFormat(e){let t=this.getWritable();return t.__format=e!==``&&Ha[e]||0,t}setStyle(e){let t=this.getWritable();return t.__style=e||``,t}setTextFormat(e){let t=this.getWritable();return t.__textFormat=e,t}setTextStyle(e){let t=this.getWritable();return t.__textStyle=e,t}setIndent(e){let t=this.getWritable();return t.__indent=e,t}splice(e,t,n){Cl(this)&&M(324,this.__key,this.__type);let r=this.getChildrenSize(),i=this.getWritable();e+t<=r||M(226,String(e),String(t),String(r));for(let e of n);let a=i.__key,o=[],s=[],c=this.getChildAtIndex(e+t),l=null,u=r-t+n.length;if(e!==0){if(e===r)l=this.getLastChild();else{let t=this.getChildAtIndex(e);t!==null&&(l=t.getPreviousSibling())}}t>0&&(s=function(e,t,n,r){let i=[],a=t;for(let e=0;e<n;e++){a===null&&M(100);let e=a.getNextSibling();i.push(a.getWritable()),a=e}return n_(e,r&&r.getWritable(),a&&a.getWritable()),e.__size-=i.length,i.map(e=>(r_(e),e.__prev=null,e.__next=null,e.__parent=null,e.__key))}(i,l===null?this.getFirstChild():l.getNextSibling(),t,l));let d=n.length>0&&l!==null?l.getWritable():null;for(let e of n){d!==null&&e.is(d)&&(l=d.getPreviousSibling(),d=l&&l.getWritable()),c!==null&&e.is(c)&&(c=c.getNextSibling());let t=e.getWritable();t.__parent===a&&u--,a_(t);let n=e.__key;i_(i,t,d,c&&c.getWritable()),e.__key===a&&M(76),o.push(n),d=t}if(i.__size=u,s.length){let e=J();if(q(e)){let t=new Set(s),n=new Set(o);for(let r of[e.anchor,e.focus])eu(r,t,n)&&Hg(r,r.getNode(),this,l,c);u!==0||this.canBeEmpty()||U(this)||this.remove()}}return i}getDOMSlot(e){return new vs(e)}exportDOM(e){let{element:t}=super.exportDOM(e);if(W(t)){let e=this.getIndent();e>0&&(t.style.paddingInlineStart=40*e+`px`,t.setAttribute(`data-lexical-indent`,String(e)));let n=this.getDirection();n&&(t.dir=n)}return{element:t}}shouldSerializeTextStyles(){if(U(this))return!1;for(let e=this.getFirstChild();e!==null;e=e.getNextSibling())if(R(e))return!1;return!0}getSerializedTextFormat(){let e=this.getTextFormat();return e!==0&&this.shouldSerializeTextStyles()?e:void 0}getSerializedTextStyle(){let e=this.getTextStyle();return e!==``&&this.shouldSerializeTextStyles()?e:void 0}insertNewAfter(e,t){return null}canIndent(){return!0}collapseAtStart(e){return!1}excludeFromCopy(e){return!1}canReplaceWith(e){return!0}canInsertAfter(e){return!0}canBeEmpty(){return!0}canInsertTextBefore(){return!0}canInsertTextAfter(){return!0}isInline(){return!1}isShadowRoot(){return!1}canMergeWith(e){return!1}extractWithChild(e,t,n){return!1}canMergeWhenEmpty(){return!1}reconcileObservedMutation(e,t){t.read(`latest`,()=>{let n=Xf(this,e,t),r=n.element;n.after&&n.after.parentNode!==r&&(n=n.withAfter(null)),n.before&&n.before.parentNode!==r&&(n=n.withBefore(null));let i=n.getManagedLineBreak();i&&n.insertManagedLineBreak(i.nodeName===`IMG`);let a=n.getFirstChild();for(let e of this.getChildrenKeys()){let i=t.getElementByKey(e);if(!i)continue;let o,s=a;for(;s&&!(o=Ad(s,t))&&cp(s);)s=s.nextSibling;s!==i&&r.insertBefore(i,o?s:a||n.getInsertionAnchor()),a=i.nextSibling}dl(this,e,n)})}};function I(e){return e instanceof $l}function eu(e,t,n){let r=e.getNode();for(;r;){let e=r.__key;if(t.has(e)&&!n.has(e))return!0;r=r.getParent()}return!1}var tu=class extends Tl{__slotHost;__slots;constructor(e){super(e),this.__slotHost=null,this.__slots=null}afterCloneFrom(e){super.afterCloneFrom(e),this.__key===e.__key&&(this.__slotHost=e.__slotHost,this.__slotHost!==null&&this.__parent!==null&&M(383,this.__key,String(this.__slotHost),String(this.__parent)),this.__slots=e.__slots)}decorate(e,t){return null}isIsolated(){return!1}isInline(){return!0}isKeyboardSelectable(){return!0}};function L(e){return e instanceof tu}function nu(e){let t=e.getLatest().__cachedText;return t===null||!Mm()&&K()._dirtyType!==0?null:t}var ru=class extends $l{__cachedText;$config(){return this.config(`root`,{extends:$l})}constructor(){super(`root`),this.__cachedText=null}getTopLevelElementOrThrow(){M(51)}getTextContent(){let e=nu(this);return e===null?super.getTextContent():e}getTextContentSize(){let e=nu(this);return e===null?super.getTextContentSize():e.length}remove(){M(52)}replace(e){M(53)}insertBefore(e){M(54)}insertAfter(e){M(55)}updateDOM(e,t){return!1}splice(e,t,n){for(let e of n)I(e)||L(e)||M(282);return super.splice(e,t,n)}static importJSON(e){return V().updateFromJSON(e)}collapseAtStart(){return!0}};function iu(e){return e instanceof ru}function au(e){let t={};if(!e)return t;let n=``,r=``,i=null,a=!1,o=!1,s=!1,c=0,l=e.length,u=-1;for(let d=0;d<l;d++){let l=e[d];if(a)l===`*`&&e[d+1]===`/`&&(a=!1,d++);else if(o)u===-1&&(u=d),o=!1;else if(i===null){if(l!==`/`||e[d+1]!==`*`){if(l!==`"`&&l!==`'`){if(l!==`(`){if(l!==`)`){if(s||l!==`:`||c!==0){if(l===`;`&&c===0){u!==-1&&(s?r+=e.slice(u,d):n+=e.slice(u,d),u=-1);let i=n.trim(),a=r.trim();i!==``&&a!==``&&(t[i]=a),n=``,r=``,s=!1;continue}u===-1&&(u=d)}else u!==-1&&(n+=e.slice(u,d),u=-1),s=!0}else u===-1&&(u=d),c=Math.max(0,c-1)}else u===-1&&(u=d),c++}else u===-1&&(u=d),i=l}else u!==-1&&(s?r+=e.slice(u,d):n+=e.slice(u,d),u=-1),a=!0,d++}else u===-1&&(u=d),l===`\\`?o=!0:l===i&&(i=null)}u!==-1&&(s?r+=e.slice(u,l):n+=e.slice(u,l));let d=n.trim(),f=r.trim();return d!==``&&f!==``&&(t[d]=f),t}function ou(e,t,n){let r=n.trimEnd(),i=r.length-10;i>=0&&r.slice(i).toLowerCase()===`!important`?e.setProperty(t,r.slice(0,i).trim(),`important`):e.setProperty(t,n,``)}function su(e,t,n=``){if(t===n)return;let r=au(n),i=au(t);for(let t in i)delete r[t],ou(e,t,i[t]);for(let t in r)e.removeProperty(t)}var cu=tc()({detail:ic(nc(Xs(),Va),{field:`__detail`}),format:ic(nc(Xs(),Ba),{field:`__format`}),mode:ic(Qs([`normal`,`token`,`segmented`]),{field:`__mode`,getterTable:Ka,setterTable:Ga}),style:ic(Js(),{field:`__style`}),text:ic(Js(),{field:`__text`,getter:`getTextContent`,setter:`setTextContent`})});function lu(e,t){return 16&t?`code`:128&t?`mark`:32&t?`sub`:64&t?`sup`:null}function uu(e,t){return 1&t?`strong`:2&t?`em`:`span`}function du(e,t,n,r,i){let a=r.classList,o=Zd(i,`base`);o!==void 0&&a.add(...o),o=Zd(i,`underlineStrikethrough`);let s=!1,c=8&t&&4&t;o!==void 0&&(8&n&&4&n?(s=!0,c||a.add(...o)):c&&a.remove(...o));for(let e in Ba){let r=Ba[e];if(o=Zd(i,e),o!==void 0){if(n&r){if(s&&(e===`underline`||e===`strikethrough`)){t&r&&a.remove(...o);continue}((t&r)===0||c&&e===`underline`||e===`strikethrough`)&&a.add(...o)}else t&r&&a.remove(...o)}}Xd(r,`class`)}function fu(e,t,n){let r=n.isComposing(),i=e+(r?La:``),a=Jf(),o=Yf(a).$getDOMSlot(n,t,a),s=o.getFirstChild();if(s===null||s.nodeType!==Node.TEXT_NODE)return void o.insertChild(Af().createTextNode(i));let c=s,l=c.nodeValue;if(l!==i){if(r||Ta||Ma){let[e,t,n]=function(e,t){let n=e.length,r=t.length,i=0,a=0;for(;i<n&&i<r&&e[i]===t[i];)i++;for(;a+i<n&&a+i<r&&e[n-a-1]===t[r-a-1];)a++;return[i,n-i-a,t.slice(i,r-a)]}(l,i);c.replaceData(e,t,n)}else c.nodeValue=i}}function pu(e,t,n,r,i,a){fu(i,e,t);let o=a.theme.text;o!==void 0&&du(0,0,r,e,o)}function mu(e,t){let n=Af().createElement(t);return n.appendChild(e),n}function hu(e){return e!=null&&!0===e.__isInlineFormattable}var gu=class extends Tl{__text;__format;__style;__mode;__detail;get __isInlineFormattable(){return!0}$config(){return this.config(`text`,{extends:Tl,generated:Ll,importDOM:{"#text":()=>({conversion:xu,priority:0}),b:()=>({conversion:vu,priority:0}),code:()=>({conversion:wu,priority:0}),em:()=>({conversion:wu,priority:0}),i:()=>({conversion:wu,priority:0}),mark:()=>({conversion:wu,priority:0}),s:()=>({conversion:wu,priority:0}),span:()=>({conversion:_u,priority:0}),strong:()=>({conversion:wu,priority:0}),sub:()=>({conversion:wu,priority:0}),sup:()=>({conversion:wu,priority:0}),u:()=>({conversion:wu,priority:0})},json:cu})}constructor(e=``,t){super(t),this.__text=e,this.__format=0,this.__style=``,this.__mode=0,this.__detail=0}getFormat(){return this.getLatest().__format}getDetail(){return this.getLatest().__detail}getMode(){return Ka[this.getLatest().__mode]}getStyle(){return this.getLatest().__style}isToken(){return this.getLatest().__mode===1}isComposing(){return this.__key===Ed()}isSegmented(){return this.getLatest().__mode===2}isDirectionless(){return!!(1&this.getLatest().__detail)}isUnmergeable(){return!!(2&this.getLatest().__detail)}hasFormat(e){let t=Ba[e];return(this.getFormat()&t)!==0}isSimpleText(){let e=this.getLatest();return e.__type===`text`&&e.__mode===0}getTextContent(){return this.getLatest().__text}getFormatFlags(e,t){return bd(this.getLatest().__format,e,t)}canHaveFormat(){return!0}isInline(){return!0}createDOM(e,t){let n=this.__format,r=lu(0,n),i=uu(0,n),a=r===null?i:r,o=Af().createElement(a),s=o;this.hasFormat(`code`)&&o.setAttribute(`spellcheck`,`false`),r!==null&&(s=Af().createElement(i),o.appendChild(s)),pu(s,this,0,n,this.__text,e);let c=this.__style;return c!==``&&su(o.style,c),o}updateDOM(e,t,n){let r=this.__text,i=e.__format,a=this.__format,o=lu(0,i),s=lu(0,a),c=uu(0,i),l=uu(0,a);if((o===null?c:o)!==(s===null?l:s))return!0;if(o===s&&c!==l){let e=t.firstChild;e??M(48);let i=Af().createElement(l);return pu(i,this,0,a,r,n),t.replaceChild(i,e),!1}let u=t;s!==null&&o!==null&&(u=t.firstChild,u??M(49)),fu(r,u,this);let d=n.theme.text;d!==void 0&&i!==a&&du(0,i,a,u,d);let f=e.__style,p=this.__style;return f!==p&&(su(t.style,p,f),Xd(t,`style`)),!1}exportDOM(e){let{element:t}=super.exportDOM(e);return W(t)||M(132),t.style.whiteSpace=`pre-wrap`,this.hasFormat(`lowercase`)?t.style.textTransform=`lowercase`:this.hasFormat(`uppercase`)?t.style.textTransform=`uppercase`:this.hasFormat(`capitalize`)&&(t.style.textTransform=`capitalize`),this.hasFormat(`bold`)&&(t=mu(t,`b`)),this.hasFormat(`italic`)&&(t=mu(t,`i`)),this.hasFormat(`strikethrough`)&&(t=mu(t,`s`)),this.hasFormat(`underline`)&&(t=mu(t,`u`)),{element:t}}selectionTransform(e,t){}setFormat(e){let t=this.getWritable();return t.__format=typeof e==`string`?Ba[e]:e,t}setDetail(e){let t=this.getWritable();return t.__detail=typeof e==`string`?Va[e]:e,t}setStyle(e){let t=this.getWritable();return t.__style=e,t}toggleFormat(e){let t=bd(this.getFormat(),e,null);return this.setFormat(t)}toggleDirectionless(){let e=this.getWritable();return e.__detail^=1,e}toggleUnmergeable(){let e=this.getWritable();return e.__detail^=2,e}setMode(e){let t=Ga[e];if(this.getLatest().__mode===t)return this;let n=this.getWritable();return n.__mode=t,n}setTextContent(e){if(this.getLatest().__text===e)return this;let t=this.getWritable();return t.__text=e,t}select(e,t){Nm();let n=e,r=t,i=J(),a=this.getTextContent(),o=this.__key;if(typeof a==`string`){let e=a.length;n===void 0&&(n=e),r===void 0&&(r=e)}else n=0,r=0;if(!q(i))return Mg(o,n,o,r,`text`,`text`);{let e=Ed();e!==i.anchor.key&&e!==i.focus.key||Td(o),i.setTextNodeRange(this,n,this,r)}return i}selectStart(){return this.select(0,0)}selectEnd(){let e=this.getTextContentSize();return this.select(e,e)}spliceText(e,t,n,r){let i=this.getWritable(),a=i.__text,o=n.length,s=e;s<0&&(s=o+s,s<0&&(s=0));let c=J();if(r&&q(c)){let t=e+o;c.setTextNodeRange(i,t,i,t)}return i.__text=a.slice(0,s)+n+a.slice(s+t),i}canInsertTextBefore(){return!0}canInsertTextAfter(){return!0}splitText(...e){Nm();let t=this.getLatest(),n=t.getTextContent();if(n===``)return[];let r=t.__key,i=Ed(),a=n.length;e.sort((e,t)=>e-t),e.push(a);let o=[],s=e.length;for(let t=0,r=0;t<a&&r<=s;r++){let i=e[r];i>t&&(o.push(n.slice(t,i)),t=i)}let c=o.length;if(c===1)return[t];let l=o[0],u=t.getParent(),d,f=t.getFormat(),p=t.getStyle(),m=t.__detail,h=!1,g=null,_=null,v=J();if(q(v)){let[e,t]=v.isBackward()?[v.focus,v.anchor]:[v.anchor,v.focus];e.type===`text`&&e.key===r&&(g=e),t.type===`text`&&t.key===r&&(_=t)}t.isSegmented()?(d=Tu(l),d.__format=f,d.__style=p,d.__detail=m,d.__state=Sc(t,d),h=!0):d=t.setTextContent(l);let y=[d];for(let e=1;e<c;e++){let n=Tu(o[e]);n.__format=f,n.__style=p,n.__detail=m,n.__state=Sc(t,n);let a=n.__key;i===r&&Td(a),y.push(n)}let b=g?g.offset:null,x=_?_.offset:null,S=0;for(let e of y){if(!g&&!_)break;let t=S+e.getTextContentSize();if(g!==null&&b!==null&&b<=t&&b>=S&&(g.set(e.getKey(),b-S,`text`),b<t&&(g=null)),_!==null&&x!==null&&x<=t&&x>=S){_.set(e.getKey(),x-S,`text`);break}S=t}if(u!==null){(function(e){let t=e.getPreviousSibling(),n=e.getNextSibling();t!==null&&wd(t),n!==null&&wd(n)})(this);let e=u.getWritable(),t=this.getIndexWithinParent();h?(e.splice(t,0,y),this.remove()):e.splice(t,1,y),q(v)&&Vg(v,u,t,c-1)}return y}mergeWithSibling(e){let t=e===this.getPreviousSibling();t||e===this.getNextSibling()||M(50);let n=this.__key,r=e.__key,i=this.__text,a=i.length;Ed()===r&&Td(n);let o=J();if(q(o)){let i=o.anchor,s=o.focus;i!==null&&i.key===r&&Ug(i,t,n,e,a),s!==null&&s.key===r&&Ug(s,t,n,e,a)}let s=e.__text,c=t?s+i:i+s;this.setTextContent(c);let l=this.getWritable();return e.remove(),l}isTextEntity(){return!1}};function _u(e){return{forChild:Eu(e.style),node:null}}function vu(e){let t=e,n=t.style.fontWeight===`normal`;return{forChild:Eu(t.style,n?void 0:`bold`),node:null}}var yu=new WeakMap;function bu(e){if(!W(e))return!1;if(e.nodeName===`PRE`)return!0;let t=e.style.whiteSpace;return typeof t==`string`&&t.startsWith(`pre`)}function xu(e){let t=e;e.parentElement===null&&M(129);let n=t.textContent||``;if(function(e){let t,n=e.parentNode,r=[e];for(;n!==null&&(t=yu.get(n))===void 0&&!bu(n);)r.push(n),n=n.parentNode;let i=t===void 0?n:t;for(let e=0;e<r.length;e++)yu.set(r[e],i);return i}(t)!==null)return{node:Yg(n)};if(n=n.replace(/\r/g,``).replace(/[ \t\n]+/g,` `),n===``)return{node:null};if(n[0]===` `){let e=t,r=!0;for(;e!==null&&(e=Su(e,!1))!==null;){let t=e.textContent||``;if(t.length>0){/[ \t\n]$/.test(t)&&(n=n.slice(1)),r=!1;break}}r&&(n=n.slice(1))}if(n[n.length-1]===` `){let e=t,r=!0;for(;e!==null&&(e=Su(e,!0))!==null;)if((e.textContent||``).replace(/^( |\t|\r?\n)+/,``).length>0){r=!1;break}r&&(n=n.slice(0,n.length-1))}return n===``?{node:null}:{node:Tu(n)}}function Su(e,t){let n=e;for(;;){let e;for(;(e=t?n.nextSibling:n.previousSibling)===null;){let e=n.parentElement;if(e===null)return null;n=e}if(n=e,W(n)){let e=n.style.display;if(e===``&&!Wf(n)||e!==``&&!e.startsWith(`inline`))return null}let r=n;for(;(r=t?n.firstChild:n.lastChild)!==null;)n=r;if(_d(n))return n;if(n.nodeName===`BR`)return null}}var Cu={code:`code`,em:`italic`,i:`italic`,mark:`highlight`,s:`strikethrough`,strong:`bold`,sub:`subscript`,sup:`superscript`,u:`underline`};function wu(e){let t=Cu[e.nodeName.toLowerCase()];return t===void 0?{node:null}:{forChild:Eu(e.style,t),node:null}}function Tu(e=``){return vf(new gu(e))}function R(e){return e instanceof gu}function Eu(e,t){let n=e.fontWeight,r=e.textDecoration.split(` `),i=n===`700`||n===`bold`,a=r.includes(`line-through`),o=e.fontStyle===`italic`,s=r.includes(`underline`),c=e.verticalAlign,l=e.textTransform;return e=>((R(e)||hu(e))&&(i&&!e.hasFormat(`bold`)&&e.toggleFormat(`bold`),a&&!e.hasFormat(`strikethrough`)&&e.toggleFormat(`strikethrough`),o&&!e.hasFormat(`italic`)&&e.toggleFormat(`italic`),s&&!e.hasFormat(`underline`)&&e.toggleFormat(`underline`),c!==`sub`||e.hasFormat(`subscript`)||e.toggleFormat(`subscript`),c!==`super`||e.hasFormat(`superscript`)||e.toggleFormat(`superscript`),l!==`lowercase`&&l!==`uppercase`&&l!==`capitalize`||e.hasFormat(l)||e.toggleFormat(l),t&&!e.hasFormat(t)&&e.toggleFormat(t)),e)}function Du(e,t){let{type:n,key:r,offset:i}=e,a=bf(e.key);return n===`text`?(R(a)||M(266,a.getType(),r),G_(a,t,i)):(I(a)||M(267,a.getType(),r),Bu(a,e.offset,t))}function Ou(e,t){let{origin:n,direction:r}=t,i=r===`next`;z_(t)?e.set(n.getKey(),t.offset,`text`):B_(t)?R(n)?e.set(n.getKey(),K_(n,r),`text`):e.set(n.getParentOrThrow().getKey(),n.getIndexWithinParent()+ +!!i,`element`):(V_(t)&&I(n)||M(268),e.set(n.getKey(),i?0:n.getChildrenSize(),`element`))}function ku(e){let t=J(),n=q(t)?t:Ng();return Au(n,e),Id(n),n}function Au(e,t){Ou(e.anchor,t.anchor),Ou(e.focus,t.focus)}function ju(e){let{anchor:t,focus:n}=e,r=Du(t,`next`),i=Du(n,`next`),a=av(r,i)<=0?`next`:`previous`;return rv(ev(r,a),ev(i,a))}function Mu(e){let{direction:t,origin:n}=e,r=Y(n,F_(t)).getNodeAtCaret();return r?Y(r,t):J_(n.getParentOrThrow(),t)}function Nu(e,t=`root`){let n=[e];for(let r=V_(e)?e.getParentCaret(t):e.getSiblingCaret();r!==null;r=r.getParentCaret(t))n.push(Mu(r));return n}function Pu(e){return!!e&&e.origin.isAttached()}function Fu(e,t=`removeEmptySlices`){if(e.isCollapsed())return e;let n=`root`,r=`next`,i=t,a=zu(e,r),o=a.anchor.origin;for(;o!==null&&!U(o);)o=o.getParent();let s=I(o)?o.getFirstChild():null,c=Nu(a.anchor,n),l=Nu(a.focus.getFlipped(),n),u=new Set,d=[];for(let e of a.iterNodeCarets(n))if(V_(e))u.add(e.origin.getKey());else if(B_(e)){let{origin:t}=e;I(t)&&!u.has(t.getKey())||d.push(t)}let f=new Set;for(let e of d){let t=e.getParent();t===null||u.has(t.getKey())||f.add(t),Cd(e)}for(let e of f)!e.canBeEmpty()&&!U(e)&&e.isEmpty()&&e.isAttached()&&e.remove();for(let e of a.getTextSlices()){if(!e)continue;let{origin:t}=e.caret,n=t.getTextContentSize(),a=Mu(Y(t,r)),o=t.getMode();if(Math.abs(e.distance)===n&&i===`removeEmptySlices`||o===`token`&&e.distance!==0)a.remove();else if(e.distance!==0){i=`removeEmptySlices`;let t=e.removeTextSlice(),n=e.caret.origin;if(o===`segmented`){let e=t.origin,n=Tu(e.getTextContent()).setStyle(e.getStyle()).setFormat(e.getFormat());a.replaceOrInsert(n),t=G_(n,r,t.offset)}n.is(c[0].origin)&&(c[0]=t),n.is(l[0].origin)&&(l[0]=t.getFlipped())}}let p=Iu(c),m=Iu(l),h=function(e,t,n){let r=e&&e.getParentAtCaret(),i=t&&t.getParentAtCaret(),a=r&&i&&dv(r,i);if(!a||a.type!==`branch`)return null;let o=(e,t)=>{let r;for(let i=e;i&&!i.is(a.commonAncestor);i=i.getParent()){if(U(i))return;t&&!n.has(i.__key)||!qf(i)||(r=i)}return r},s=o(r,!1),c=s&&o(i,!0);return s&&c&&y_(c).length===0?[s,c]:null}(p,m,u);if(h){let[e,t]=h;J_(e,`previous`).splice(0,t.getChildren());let n=t.getParent();for(t.remove(!0);n&&n.isEmpty();){let e=n;n=n.getParent(),e.remove(!0)}}else if(m){let e=function(e){if(V_(e)){let t=e.origin;if(qf(t))return t}else{let t=e.getParentAtCaret();if(t&&qf(t))return t}return null}(m),t=e&&e.getParent(),n=e&&e.getParents().findLast(gf);if(e&&t&&!iu(t)&&e.isEmpty()&&u.has(e.getKey())&&y_(e).length===0&&(!n||u.has(n.getKey()))){e.remove(!0);let n=t;for(;n&&!iu(n)&&n.isEmpty();){let e=n.getParent();if(e&&iu(e)&&e.getChildrenSize()<=1&&n.canBeEmpty())break;let t=n;n=e,t.remove(!0)}}}Fd(o,s)!==null||o===null||o.isAttached()||Fd(V(),null);let g=Iu([p,m,...c,...l]);if(g)return nv(ev(g,e.direction));M(269,JSON.stringify(c.map(e=>e.origin.__key)))}function Iu(e){let t=e.find(Pu);return t&&Lu(t)}function Lu(e){let t=function(e){let t=e;for(;V_(t);){let e=X_(t);if(!V_(e))break;t=e}return t}(e.getLatest()),{direction:n}=t;if(R(t.origin))return z_(t)?t:G_(t.origin,n,n);let r=t.getAdjacentCaret();return B_(r)&&R(r.origin)?G_(r.origin,n,F_(n)):t}function Ru(e){return z_(e)&&e.offset!==K_(e.origin,e.direction)}function zu(e,t){return e.direction===t?e:rv(ev(e.focus,t),ev(e.anchor,t))}function Bu(e,t,n){let r=e.getChildrenSize(),i=(t>0?Math.min(Math.ceil(t),r):0)-+(n===`next`),a=i<0||i>=r?null:e.getChildAtIndex(i);return a===null?J_(e,n):Y(a,n)}function Vu(e,t=`root`){let n=0,r=e,i=X_(r);for(;i===null;){if(n--,i=r.getParentCaret(t),!i)return null;r=i,i=X_(r)}return i&&[i,n]}function Hu(e){let{origin:t,offset:n,direction:r}=e;if(n===K_(t,r))return e.getSiblingCaret();if(n===K_(t,F_(r)))return Mu(e.getSiblingCaret());let[i]=t.splitText(n);return R(i)||M(281),ev(Y(i,`next`),r)}function Uu(e,t){for(let n of e)if(n!==null&&n.caret.origin.is(t))return n}function Wu(e,t=null){let{origin:n}=e.caret,[r,i]=e.getSliceIndices();if(r===i)return null;if(r===0&&i===n.getTextContentSize())return n;let a=n.getParent(),o=t&&a&&Bg(t,a)?n.getIndexWithinParent():-1,s=t?[t.anchor,t.focus].map(e=>[e,e.key===n.__key&&e.type===`text`?e.offset-r:a!==null&&e.key===a.__key&&e.offset===o?0:null]):[],c=n.splitText(r,i),l=c[r===0?0:1];a&&t&&t!==J()&&Vg(t,a,o,c.length-1);for(let[e,t]of s)t!==null&&e.set(l.__key,t,`text`);return l}function Gu(e,t){return!0}function Ku(e,{$copyElementNode:t=_f,$splitTextPointCaretNext:n=Hu,rootMode:r=`shadowRoot`,$shouldSplit:i=Gu,removeEmptyDestination:a=!1}={}){if(z_(e))return n(e);let o=e.getParentCaret(r);if(o){let{origin:n}=o;if(V_(e)){let e=Mu(o);if(a&&n.isEmpty())return n.remove(),e;if(!n.canBeEmpty()||!i(n,`first`))return e}let r=l_((s=e).getNodeAtCaret(),s.direction);(r.length>0||!a&&n.canBeEmpty()&&i(n,`last`))&&o.insert(t(n).splice(0,0,r))}var s;return o}function qu(e,t,n){let r=ev(t,`next`);z_(r)&&(r.offset===0?r=Y(r.origin,`previous`).getFlipped():r.offset===r.origin.getTextContentSize()&&(r=Y(r.origin,`next`))),r.origin.is(e)&&(B_(r)||M(342,e.getKey(),e.getType()),r=Mu(r)),(e.is(r.getNodeAtCaret())||e.is(r.getFlipped().getNodeAtCaret()))&&e.remove(!0);for(let e=r;e;e=Ku(e,n))r=e;return z_(r)&&M(283),r.insert(e.isInline()?z().append(e):e),ev(Y(e.getLatest(),`next`),t.direction)}function Ju(e,t){let n=zu(q(t)?ju(t):t,`next`),r=g_(n.anchor.origin),i=g_(e.getLatest());if(r===null?i!==null:!r.is(i))return!1;let a=Lu(J_(e,`next`)),o=ev(Lu(J_(e,`previous`)),`next`);return av(n.anchor,a)<=0&&av(n.focus,o)>=0}var Yu=class extends $l{$config(){return this.config(`paragraph`,{children:`inline`,extends:$l,generated:Rl,importDOM:{p:()=>({conversion:Xu,priority:0})}})}createDOM(e){let t=Af().createElement(`p`),n=Zd(e.theme,`paragraph`);return n!==void 0&&t.classList.add(...n),t}updateDOM(e,t,n){return!1}exportDOM(e){let{element:t}=super.exportDOM(e);if(W(t)){this.isEmpty()&&t.append(Af().createElement(`br`));let e=this.getFormatType();e&&(t.style.textAlign=e)}return{element:t}}exportJSON(e=!1){let t=super.exportJSON(e);if(t.textFormat===void 0||t.textStyle===void 0){let n=this.getChildren().find(R),r=n?n.getFormat():this.getTextFormat(),i=n?n.getStyle():this.getTextStyle();e&&r===0||(t.textFormat=r),e&&i===``||(t.textStyle=i)}return t}extractWithChild(e,t,n){if(!q(t)||this.getFormatType()===``&&this.getIndent()===0&&this.getStyle()===``)return!1;if(Ju(this,t)){let e=this.getTextContent();return e!==``&&t.getTextContent()===e}return!1}insertNewAfter(e,t){let n=z();n.setTextFormat(e.format),n.setTextStyle(e.style);let r=this.getDirection();return n.setDirection(r),n.setFormat(this.getFormatType()),n.setStyle(this.getStyle()),this.insertAfter(n,t),n}collapseAtStart(){if(this.getChildren().every(e=>R(e)&&!/\S/.test(e.getTextContent()))){if(this.getNextSibling()!==null)return this.selectNext(),this.remove(),!0;if(this.getPreviousSibling()!==null)return this.selectPrevious(),this.remove(),!0}return!1}};function Xu(e){let t=z();if(op(t,e),ip(e,t),t.getFormatType()===``){let n=e.getAttribute(`align`);n&&n&&n in Ha&&t.setFormat(n)}return ap(t,e),{node:t}}function z(){return vf(new Yu)}function Zu(e){return e instanceof Yu}var Qu=tc()({detail:ac(Xs(2),{getter:{field:`__detail`},setter:null}),mode:ac(Qs([`normal`]),{getter:{field:`__mode`,getterTable:{0:`normal`}},setter:null}),text:ac(Js(` `),{getter:{field:`__text`,method:`getTextContent`},setter:null})}),$u=class extends gu{$config(){return this.config(`tab`,{extends:gu,generated:Bl,json:Qu})}constructor(e=void 0){super(` `,e),this.__detail=2}createDOM(e){let t=super.createDOM(e),n=Zd(e.theme,`tab`);return n!==void 0&&t.classList.add(...n),t}setTextContent(e){return super.setTextContent(` `)}spliceText(e,t,n,r){return n===``&&t===0||n===` `&&t===1||M(286),this}setDetail(e){return e!==2&&M(127),this}setMode(e){return e!==`normal`&&M(128),this}canInsertTextBefore(){return!1}canInsertTextAfter(){return!1}};function ed(){return vf(new $u)}function td(e){return e instanceof $u}var nd=null;function rd(e){nd=e}var id=Symbol(`INTERNAL_SKIP_AFTER_CLONE_FROM`),ad=1;function od(e,t){let n=sd(e,t);return n===void 0&&M(30,t),n}function sd(e,t){return e._nodes.get(t)}var cd=typeof queueMicrotask==`function`?queueMicrotask:e=>{Promise.resolve().then(e)};function ld(e,t){let n=t===void 0?(()=>{let t=e.getRootNode();return vd(t)||Tf(t)?Rf(t):null})():t;if(!W(n)||n.hasAttribute(`data-lexical-slot`))return!1;let r=jd(n),i=n.nodeName;return El(r)&&(i===`INPUT`||i===`TEXTAREA`||n.contentEditable===`true`&&md(n)==null)}function ud(e){let t=e===null?null:zf(e);return Vf(t)&&ld(t)}function dd(e,t,n){let r=e.getRootElement();if(!r)return!1;try{if(!t||!r.contains(t)||!r.contains(n))return!1}catch{return!1}return pd(t)===e&&e.read(`latest`,()=>!ld(t))}function fd(e){return e instanceof bm}function pd(e){let t=e;for(;t!=null;){let e=md(t);if(fd(e))return e;t=af(t)}return null}function md(e){return e?e.__lexicalEditor:null}function hd(e){return td(e)||e.isToken()}function gd(e){return hd(e)||e.isSegmented()}function _d(e){return Vf(e)&&e.nodeType===3}function vd(e){return Vf(e)&&e.nodeType===9}function yd(e){let t=e;for(;t!=null;){if(_d(t))return t;t=t.firstChild}return null}function bd(e,t,n){let r=Ba[t];if(n!==null&&(e&r)===(n&r))return e;let i=e^r;return t===`subscript`?i&=~Ba.superscript:t===`superscript`?i&=~Ba.subscript:t===`lowercase`?(i&=~Ba.uppercase,i&=~Ba.capitalize):t===`uppercase`?(i&=~Ba.lowercase,i&=~Ba.capitalize):t===`capitalize`&&(i&=~Ba.lowercase,i&=~Ba.uppercase),i}function xd(e){return R(e)||lm(e)||L(e)}function Sd(e,t){let n=function(){let e=nd;return nd=null,e}();if((t||=n&&n.__key)!=null)return void(e.__key=t);Nm(),Pm();let r=K(),i=Fm(),a=``+ad++;i._nodeMap.set(a,e),I(e)?r._dirtyElements.set(a,!0):r._dirtyLeaves.add(a),r._cloneNotNeeded.set(a,e),r._dirtyType===0&&(r._dirtyType=1),e.__key=a}function Cd(e){a_(e.getParent()===null?e:e.getWritable())}function wd(e){Pm(),Cl(e)&&M(323,e.__key,e.__type);let t=e.__parent===null?f_(e)?e.__slotHost:null:e.__parent,n=Fm(),r=K(),i=n._nodeMap,a=r._dirtyElements;t!==null&&function(e,t,n){let r=e;for(;r!==null;){if(n.has(r))return;let e=t.get(r);if(e===void 0)break;n.set(r,!1),r=e.__parent===null?f_(e)?e.__slotHost:null:e.__parent}}(t,i,a);let o=e.__key;r._dirtyType===0&&(r._dirtyType=1),I(e)?a.set(o,!0):r._dirtyLeaves.add(o)}function Td(e){Nm();let t=K(),n=t._compositionKey;if(e!==n){if(t._compositionKey=e,n!==null){let e=B(n);e!==null&&e.getWritable()}if(e!==null){let t=B(e);t!==null&&t.getWritable()}}}function Ed(){return Mm()?null:K()._compositionKey}function Dd(e){return!ka&&(ja||Pa)&&e.__text===``&&e.__key===K()._compositionKey}function B(e,t){let n=(t||Fm())._nodeMap.get(e);return n===void 0?null:n}function Od(e,t){let n=Ad(e,K());return n===void 0?null:B(n,t)}function kd(e,t,n){e[`__lexicalKey_${t._key}`]=n}function Ad(e,t){return e[`__lexicalKey_${t._key}`]}function jd(e,t){let n=e;for(;n!=null;){let e=Od(n,t);if(e!==null)return e;n=af(n)}return null}function Md(e){let t=e._decorators,n=Object.assign({},t);return e._pendingDecorators=n,n}function Nd(e){return e.read(()=>V().getTextContent())}function Pd(e,t){let n=tp(e.getEditorState()),r=[];for(let e of t){let t=n.get(e);t&&r.push(t)}r.length!==0&&e.update(()=>{for(let e of r)for(let t of e.keys()){let e=B(t);e&&e.markDirty()}},e._pendingEditorState===null?{tag:`history-merge`}:void 0)}function V(){return Fm()._nodeMap.get(`root`)}function Fd(e,t){if(!(U(e)&&e.isAttached()&&(iu(e)?e.getChildrenSize()===0:e.isEmpty())&&(iu(e)||t!==null&&qf(t))))return null;let n=z();return e.append(n),n}function Id(e){Nm();let t=Fm();e!==null&&(e.dirty=!0,e.setCachedNodes(null),q(e)&&K()._slotsUsed&&Og(e)),t._selection=e}function Ld(e){Nm(),Os(K(),e)}function Rd(e){let t=function(e,t){let n=e;for(;n!=null;){let e=Ad(n,t);if(e!==void 0)return e;n=af(n)}return null}(e,K());return t===null?null:B(t)}function zd(e){return/[\uD800-\uDBFF][\uDC00-\uDFFF]/g.test(e)}function Bd(e){let t=[];for(let n=e;n!==null;n=n._parentEditor)t.push(n);return t}var Vd=0;function Hd(){return ya?Math.random().toString(36).replace(/[^a-z]+/g,``).substring(0,5):`s${(++Vd).toString(36)}`}function Ud(e){return _d(e)?e.nodeValue:null}function Wd(e,t,n){let r=Cf(pf(t));if(r===null)return;let i=Nf(r,t._rootElement),a=i.anchorNode,{anchorOffset:o,focusOffset:s}=i;if(a!==null){let t=Ud(a),r=jd(a);if(t!==null&&R(r)){if((t===La||t===za)&&n){let e=n.length;t=n,o=e,s=e}t!==null&&Gd(r,t,o,s,e)}}}function Gd(e,t,n,r,i){let a=e;if(a.isAttached()&&(i||!a.isDirty())){let o=a.isComposing(),s=!ka&&(ja||Pa);if(a.isToken()&&o)return;let c=t;if((o||i)&&(!t.endsWith(La)||s&&t===a.getTextContent()||(c=t.slice(0,-La.length)),i&&!s)){let e=za,t;for(;(t=c.indexOf(e))!==-1;)c=c.slice(0,t)+c.slice(t+e.length),n!==null&&n>t&&(n=Math.max(t,n-e.length)),r!==null&&r>t&&(r=Math.max(t,r-e.length))}let l=a.getTextContent();if(i||c!==l){let t=J();if(c===``){if(o&&!i&&s)return void Kd(a,``,t);if(Td(null),ja||ka||Pa)a.remove();else{let e=K();Kd(a,``,t),setTimeout(()=>{e.update(()=>{a.isAttached()&&a.getTextContent()===``&&a.remove()})},20)}return}let l=a.getParent(),u=zg(),d=a.getTextContentSize(),f=Ed(),p=a.getKey();if(a.isToken()&&!o||f!==null&&p===f&&!o||q(u)&&(l!==null&&!l.canInsertTextBefore()&&u.anchor.offset===0||u.anchor.key===e.__key&&u.anchor.offset===0&&!a.canInsertTextBefore()&&!o||u.focus.key===e.__key&&u.focus.offset===d&&!a.canInsertTextAfter()&&!o))return void a.markDirty();if(!q(t)||n===null||r===null)return void Kd(a,c,t);if(t.setTextNodeRange(a,n,a,r),a.isSegmented()){let e=Tu(a.getTextContent());a.replace(e),a=e}Kd(a,c,t)}}}function Kd(e,t,n){if(e.setTextContent(t),q(n)){let t=e.getKey(),r=!1;for(let i of[`anchor`,`focus`]){let a=n[i];a.type===`text`&&a.key===t&&(a.offset=K_(e,a.offset,`clamp`),r=!0)}r&&(n._cachedNodes=null,n._cachedIsBackward=null)}}function qd(e){let t=e;for(;t!==null;){let e=t.getParent();if(e===null)return null;if(iu(e))return t;t=e}return null}function Jd(e,t){let{anchor:n,focus:r}=e,i=n.key,a=n.offset,o=n.type,s=r.key,c=r.offset,l=r.type;if(Al(e),!iu(t))return e;let u=qd(n.getNode());return I(u)&&u.isShadowRoot()&&u.is(qd(r.getNode()))&&(n.set(i,a,o),r.set(s,c,l)),e}function Yd(e){let t=V();if(q(e)){let t=e.anchor,n=e.focus,r=t.getNode();if(iu(r))return t.set(r.getKey(),0,`element`),n.set(r.getKey(),r.getChildrenSize(),`element`),Jd(e,r),e;let i=r.getTopLevelElementOrThrow(),a=i.getParent();return a===null?(I(i)&&(t.set(i.getKey(),0,`element`),n.set(i.getKey(),i.getChildrenSize(),`element`),Jd(e,i)),e):(t.set(a.getKey(),0,`element`),n.set(a.getKey(),a.getChildrenSize(),`element`),Jd(e,a),e)}{let e=t.select(0,t.getChildrenSize());return Id(Jd(e,t)),e}}function Xd(e,t){e.getAttribute(t)===``&&e.removeAttribute(t)}function Zd(e,t){e.__lexicalClassNameCache===void 0&&(e.__lexicalClassNameCache={});let n=e.__lexicalClassNameCache,r=n[t];if(r!==void 0)return r;let i=e[t];if(typeof i==`string`){let e=pv(i);return n[t]=e,e}return i}function Qd(e,t,n,r,i){if(n.size===0)return;let a=r.__type,o=r.__key,s=t.get(a);s===void 0&&M(33,a);let c=s.klass,l=e.get(c);l===void 0&&(l=new Map,e.set(c,l));let u=l.get(o),d=u===`destroyed`&&i===`created`;(u===void 0||d)&&l.set(o,d?`updated`:i)}function $d(e){let t=e.getType(),n=Fm();if(n._readOnly){let e=tp(n).get(t);return e?Array.from(e.values()):[]}let r=n._nodeMap,i=[];for(let[,n]of r)n instanceof e&&n.__type===t&&n.isAttached()&&i.push(n);return i}function ef(e,t,n){let r=e.getParent(),i=n,a=e;return r!==null&&(t&&n===0?(i=a.getIndexWithinParent(),a=r):t||n!==a.getChildrenSize()||(i=a.getIndexWithinParent()+1,a=r)),a.getChildAtIndex(t?i-1:i)}function tf(e,t){let n=e.offset;if(e.type===`element`)return ef(e.getNode(),t,n);{let r=e.getNode();if(t&&n===0||!t&&n===r.getTextContentSize()){let e=t?r.getPreviousSibling():r.getNextSibling();return e===null?ef(r.getParentOrThrow(),t,r.getIndexWithinParent()+ +!t):e}}return null}function nf(e){let t=pf(e).event,n=t&&t.inputType;return n===`insertFromPaste`||n===`insertFromPasteAsQuotation`}function H(e,t,...n){return Ym(e,t,n[0],e)}function rf(e,t){let n=e._keyToDOMMap.get(t);return n===void 0&&M(75,t),n}function af(e){let t=e.assignedSlot||e.parentElement;if(t!==null)return t;let n=e.parentNode;return Tf(n)?n.host:null}function of(e){return vd(e)?e:W(e)?e.ownerDocument:null}function sf(e,t){let n=parseFloat(e);return isFinite(n)?e.endsWith(`%`)?n*t/100:n:0}function cf(e,t,n,r){let i=t.clientWidth,a=t.scrollWidth-i;if(a<=0)return 0;let o=e.getComputedStyle(t);if(o.overflowX!==`auto`&&o.overflowX!==`scroll`)return 0;let s=t.getBoundingClientRect(),c=t.offsetWidth,l=c>0&&Math.abs(s.width-c)>1?s.width/c:1,u=o.direction===`rtl`,d=s.left+t.clientLeft*l,f=d+sf(o.scrollPaddingLeft,i)*l,p=d+(i-sf(o.scrollPaddingRight,i))*l,m=n,h=Math.max(r,n+1);h-m>p-f&&(u?m=h-1:h=m+1);let g=0;if(m<f?g=m-f:h>p&&(g=h-p),g===0)return 0;let _=t.scrollLeft,v=_+g/l,y=g>0?Math.ceil(v):Math.floor(v),b=u?Math.min(0,Math.max(-a,y)):Math.max(0,Math.min(a,y)),x=_*l;return Math.abs(b)<Math.abs(_)&&m+x>=f&&h+x<=p&&(b=0),b===_?0:(t.scrollLeft=b,(t.scrollLeft-_)*l)}function lf(e){Nm(),K()._updateTags.add(e)}function uf(e){Nm(),K()._deferred.push(e)}function df(e,t){let n=e.getParent();for(;n!==null;){if(n.is(t))return!0;n=n.getParent()}return!1}function ff(e){let t=of(e);return t?t.defaultView:null}function pf(e){let t=e._window;return t===null&&M(78),t}function mf(e){return I(e)&&e.isInline()||L(e)&&e.isInline()}function hf(e){let t=e.getLatest();for(;t!==null;){if(p_(t)!==null&&I(t))return t;let e=t.getParentOrThrow();if(U(e))return e;t=e}return t}function gf(e){return I(e)&&e.isShadowRoot()}function U(e){return iu(e)||gf(e)}function _f(e,t=!1){let n=e.constructor.clone(e,id);return Sd(n,null),n.afterCloneFrom(e),t||n.resetOnCopyNodeFrom(e),n}function vf(e){let t=K(),n=e.getType(),r=sd(t,n);r===void 0&&M(200,e.constructor.name,n);let{replace:i,replaceWithKlass:a}=r;if(i!==null){let t=i(e),r=t.constructor;return a===null?t instanceof e.constructor&&r!==e.constructor||M(202,r.name,r.getType(),e.constructor.name,n):t instanceof a||M(201,a.name,a.getType(),r.name,r.getType(),e.constructor.name,n),t.__key===e.__key&&M(203,e.constructor.name,n,r.name,r.getType()),t}return e}function yf(e,t){!iu(e.getParent())||I(t)||L(t)||M(99)}function bf(e){let t=B(e);return t===null&&M(63,e),t}function xf(e){if(!e||e.isInline())return!1;if(L(e))return!0;if(I(e)){if(e.isShadowRoot()){let t=e.getParent();return!(I(t)&&t.isShadowRoot())}return!e.canBeEmpty()}return!1}function Sf(e,t,n){n.style.removeProperty(`caret-color`),t._blockCursorElement=null;let r=e.parentElement;r!==null&&r.removeChild(e)}function Cf(e){return ya?(e||window).getSelection():null}function wf(e){let t=ff(e);return t?t.getSelection():null}function Tf(e){return Hf(e)&&`host`in e}var Ef=[];function Df(e){let t=e.getRootNode();if(t===e||!Tf(t))return Ef;let n=[t],r=t.host;for(;;){let e=r.getRootNode();if(e===r||!Tf(e))break;n.push(e),r=e.host}return n}function*Of(e){let t=[e],n;for(;n=t.pop();){yield*n.querySelectorAll(`[data-lexical-editor="true"]`);let e=(vd(n)?n:n.ownerDocument).createTreeWalker(n,NodeFilter.SHOW_ELEMENT),r;for(;r=e.nextNode();)r.shadowRoot&&t.push(r.shadowRoot)}}function kf(e){return e===null?document:e.ownerDocument}function Af(){let e=zm();return kf(e===null?null:e._rootElement)}function jf(e,t){if(t===null||typeof e.getComposedRanges!=`function`)return null;let n=Df(t);if(n.length===0)return null;let r=e.getComposedRanges;try{let t=r.call(e,{shadowRoots:n})[0];if(t!==void 0)return t}catch{}try{let t=r.apply(e,n)[0];if(t!==void 0)return t}catch{}return null}function Mf(e,t){let n=jf(e,t);if(n!==null){let e=Pf(n);if(e!==null)return e}return e.rangeCount>0?e.getRangeAt(0):null}function Nf(e,t){let n=jf(e,t);return n===null?e:Ff(n,If(e))}function Pf(e){let t=e.startContainer.ownerDocument;if(t===null)return null;let n=t.createRange();try{return n.setStart(e.startContainer,e.startOffset),n.setEnd(e.endContainer,e.endOffset),n}catch{return null}}function Ff(e,t){let{startContainer:n,startOffset:r,endContainer:i,endOffset:a}=e;return t===`backward`?{anchorNode:i,anchorOffset:a,direction:t,focusNode:n,focusOffset:r}:{anchorNode:n,anchorOffset:r,direction:t,focusNode:i,focusOffset:a}}function If(e){return e.direction}function Lf(e){let t=e.getRootNode();return vd(t)||Tf(t)?t.activeElement:null}function Rf(e){let t=e.activeElement;for(;t!==null&&t.shadowRoot!==null;){let e=t.shadowRoot.activeElement;if(e===null)break;t=e}return t}function zf(e){let t=e.target;if(t!==null&&W(t)&&t.shadowRoot!==null&&typeof e.composedPath==`function`){let t=e.composedPath();if(t.length>0)return t[0]}return t}function Bf(e){return W(e)&&e.tagName===`A`}function W(e){return Vf(e)&&e.nodeType===1}function Vf(e){return typeof e==`object`&&!!e&&`nodeType`in e&&typeof e.nodeType==`number`}function Hf(e){return Vf(e)&&e.nodeType===11}var Uf=/^(a|abbr|acronym|b|cite|code|del|em|i|ins|kbd|label|mark|output|q|ruby|s|samp|span|strong|sub|sup|time|u|tt|var|#text)$/i;function Wf(e){return!(!W(e)||!e.style.display.startsWith(`inline`))||Uf.test(e.nodeName)}var Gf=/^(address|article|aside|blockquote|canvas|dd|div|dl|dt|fieldset|figcaption|figure|footer|form|h1|h2|h3|h4|h5|h6|header|hr|li|main|nav|noscript|ol|p|pre|section|table|td|tfoot|ul|video)$/i;function Kf(e){return(!W(e)||!e.style.display.startsWith(`inline`))&&Gf.test(e.nodeName)}function qf(e){if(L(e)&&!e.isInline())return!0;if(!I(e)||U(e))return!1;let t=e.getFirstChild(),n=t===null||lm(t)||R(t)||t.isInline();return!e.isInline()&&!1!==e.canBeEmpty()&&n}function Jf(){return K()}function Yf(e=Jf()){return e._config.dom||gm}function Xf(e,t,n=Jf()){let r=Yf(n).$getDOMSlot(e,t,n);return I(e)&&(Zf(r)||M(344,e.getKey(),e.getType())),r}function Zf(e){return e instanceof vs}function Qf(e,t,n=Jf()){return yd(Xf(e,t,n).element)}var $f=new WeakMap,ep=new Map;function tp(e){if(!e._readOnly&&e.isEmpty())return ep;e._readOnly||M(192);let t=$f.get(e);return t||(t=function(e){let t=new Map;for(let[n,r]of e._nodeMap){let e=r.__type,i=t.get(e);i||(i=new Map,t.set(e,i)),i.set(n,r)}return t}(e),$f.set(e,t)),t}function np(e){let t=e.constructor.clone(e,id);return t.afterCloneFrom(e),t}function rp(e){return(t=np(e))[Sl]=!0,t;var t}function ip(e,t){let n=e.getAttribute(`data-lexical-indent`);if(n!==null){let e=parseInt(n,10);if(Number.isFinite(e)&&e>=0)return void t.setIndent(e)}let r=parseInt(e.style.paddingInlineStart,10)||0,i=Math.round(r/40);t.setIndent(i)}function ap(e,t){let n=t.getAttribute(`dir`);return n===`ltr`||n===`rtl`?e.setDirection(n):e}function op(e,t){let n=t.style.textAlign;return n&&n in Ha?e.setFormat(n):e}function sp(e,t){e.__lexicalUnmanaged=!0,t&&t.captureSelection!==void 0&&(e.__lexicalCapturedSelection=t.captureSelection)}function cp(e){return!0===e.__lexicalUnmanaged}function lp(e,t=Jf()){let n=t.isEditable();e.contentEditable=n?`true`:`false`,n?e.__lexicalEditor=t:delete e.__lexicalEditor}function up(e,t){let n=e;for(;n!=null;){if(!0===n.__lexicalCapturedSelection)return!0;if(W(n)&&n.hasAttribute(`data-lexical-slot`)||Ad(n,t)!==void 0)return!1;n=af(n)}return!1}function dp(e,t){return qs(e,t)&&e[t]!==Tl[t]}var fp=new WeakMap;function pp(e){let t=fp.get(e);return t===void 0?function(e){let t=e.prototype!=null&&Ja in e.prototype?e.prototype[Ja]():void 0,n=function(e){if(!(e===Tl||e.prototype instanceof Tl)){let t=`<unknown>`,n=`<unknown>`;try{t=e.getType()}catch{}try{bm.version&&(n=JSON.parse(bm.version))}catch{}M(290,e.name,t,n)}return e===tu||e===$l||e===Tl}(e),r=!n&&dp(e,`getType`)?e.getType:void 0,i=r&&!(hp in r)?r.call(e):void 0,a,o=i;if(t){if(i)a=t[i];else{for(let[e,n]of Object.entries(t))o=e,a=n;if(!a)for(let e of Object.getOwnPropertySymbols(t)){let n=t[e];if(n){a=n;break}}}}let s={compiled:void 0,composed:void 0,config:{declaresOwnConfig:qs(e.prototype,Ja),klass:e,ownNodeConfig:a,ownNodeType:o},ownFieldsValidated:!1};fp.set(e,s);try{let t=function(e){let t=e.prototype,n=new Map,{fieldsBaseFirst:r}=Sp(e);for(let[i,a]of r){let r=Ep(e,i,a);if(r===null)continue;if(Ms(r)){let t=r.field;if(t===`__proto__`&&M(430,e.name,i),r.setterTable!==void 0){let{setterTable:t}=r,{meta:n}=a;for(let r of n.kind===`enum`?n.values:[a.defaultValue])qs(t,String(r))||M(431,e.name,i,JSON.stringify(r))}n.set(i,{field:t,key:i,kind:`ownField`,schema:a,setterTable:r.setterTable});continue}let o=t[r];typeof o!=`function`&&M(432,e.name,i,r),n.set(i,{key:i,kind:`field`,schema:a,setter:o})}return n.size===0?gp:[...n.values()]}(e),r=function(e){let t=e.prototype,n=new Map;for(let[r,i]of Sp(e).fieldsDerivedFirst){let a=Tp(e,r,i);if(a===null)continue;if(Ms(a)){let o=a.field;o===`__proto__`&&M(426,e.name,r);let s=a.when,c;if(s!==void 0){let n=t[s];typeof n!=`function`&&M(427,e.name,r,s),c=n}n.set(r,{defaultValue:i.defaultValue,derived:i.setter===null,field:o,getterTable:a.getterTable,isEqual:i.isEqual,key:r,kind:`ownField`,schema:i,when:c});continue}let o=t[a];typeof o!=`function`&&M(428,e.name,r,a),n.set(r,{defaultValue:i.defaultValue,derived:i.setter===null,getter:o,isEqual:i.isEqual,key:r,kind:`method`,schema:i})}return n.size===0?wp:[...n.values()]}(e),i=Sp(e),c=function(e,t,n){let r,i=e;for(let{klass:t,ownNodeConfig:n}of Bp(e))n&&n.generated!==void 0&&(r===void 0?(r=n.generated,i=t):n.generated===r&&(i=t));return r===void 0?null:i===e||function(e,t){if(e.getters.length!==t.getters.length||e.setters.length!==t.setters.length)return!1;for(let n=0;n<e.getters.length;n++){let r=e.getters[n],i=t.getters[n];if(r.kind!==i.kind||r.key!==i.key||r.schema!==i.schema||r.derived!==i.derived||r.isEqual!==i.isEqual||!Object.is(r.defaultValue,i.defaultValue)||r.kind===`ownField`&&i.kind===`ownField`&&(r.field!==i.field||r.getterTable===void 0!=(i.getterTable===void 0)))return!1}for(let n=0;n<e.setters.length;n++){let r=e.setters[n],i=t.setters[n];if(r.kind!==i.kind||r.key!==i.key||r.schema!==i.schema||r.kind===`ownField`&&i.kind===`ownField`&&(r.field!==i.field||r.setterTable===void 0!=(i.setterTable===void 0)))return!1}return!0}(n,mp(pp(i)))?r:null}(e,0,{getters:r,setters:t});s.compiled={flatStates:i.flatStates,generated:c===null?null:c(i.fields),getters:r,isCompactDefault:kp(r),setters:t},function(e,t,n,r){if(!t&&n){if(!dp(e,`getType`)){let t=e,r=function(){return this===t?n:Tl.getType.call(this)};r[hp]=!0,e.getType=r}if(dp(e,`clone`)||(e.clone=(t,n)=>{rd(t);let r=new e;return n!==id&&r.afterCloneFrom(t),r}),dp(e,`importJSON`)||(e.importJSON=r&&r.$importJSON||function(e){return t=>{let n=Vp(e);return n.updateFromJSON===Tl.prototype.updateFromJSON?function(e,t){return jp(e.__state||t.$!==void 0?_c(e,t):e,t)}(n,t):n.updateFromJSON(t)}}(e)),!dp(e,`importDOM`)&&r){let{importDOM:t}=r;t&&(e.importDOM=()=>t)}let t=e.prototype;qs(t,`getTextContent`)&&!qs(t,`getTextContentSize`)&&(e.prototype.getTextContentSize=Tl.prototype.getTextContentSize)}}(e,n,o,a),function(e){for(let{klass:t,ownNodeConfig:n}of Bp(e)){let e=t.prototype;if(qs(e,`afterCloneFrom`))continue;let r=zp(t);if(r.length===0)continue;let i=Object.getPrototypeOf(e),a=n&&n.generated!==void 0?mp(pp(t)).generated:null,o=a!==null&&a.afterCloneFrom||((e,t)=>{let n=e,i=t;for(let e=0;e<r.length;e++){let t=r[e];n[t]=i[t]}});e.afterCloneFrom=function(e){i.afterCloneFrom.call(this,e),o(this,e)},e.afterCloneFrom[Lp]=!0}}(e),function(e,t){t&&t.inline!==void 0&&qs(e.prototype,Ja)&&!Object.prototype.hasOwnProperty.call(e.prototype,`isInline`)&&Object.defineProperty(e.prototype,"isInline",{configurable:!0,value:t.inline?Np:Pp,writable:!0})}(e,a)}catch(t){throw fp.delete(e),t}return s}(e):t}function mp(e){let{compiled:t}=e;return t===void 0&&M(422,e.config.klass.name),t}var hp=Symbol(`lexical.synthesizedGetType`),gp=[];function _p(e,t,n,r){let i=n.method===void 0?r:n.method,a=Sp(e).declaredBy.get(t);if(a===void 0)return n;let o=e.prototype,s=a.prototype;return vp(o,s,i)&&vp(o,s,r)?n:i}function vp(e,t,n){return e[n]===t[n]}function yp(e){return`set${e.charAt(0).toUpperCase()}${e.slice(1)}`}function bp(e){return`get${e.charAt(0).toUpperCase()}${e.slice(1)}`}var xp={declaredBy:new Map,fields:new Map,fieldsBaseFirst:[],fieldsDerivedFirst:[],flatStates:[]};function Sp(e){let t=pp(e);return t.composed===void 0&&(t.composed=function(e){let t=[],n=[],r=[];for(let{klass:i,ownNodeConfig:a}of Bp(e)){let e=a&&a.json;n.push(i),t.push(e&&e.meta.kind===`node`?Object.entries(e.meta.fields):[]);let o=[];if(a&&a.stateConfigs)for(let e of a.stateConfigs)`stateConfig`in e&&e.flat&&o.push(e.stateConfig);r.push(o)}let i=new Map;for(let e=0;e<t.length;e++)for(let[n,r]of t[e])i.has(n)||i.set(n,r);let a=new Map,o=new Map,s=new Map;for(let e=t.length-1;e>=0;e--){for(let[r,s]of t[e]){let t=i.get(r);t===void 0||a.has(r)||a.set(r,t),t===void 0||s!==t||o.has(r)||o.set(r,n[e])}for(let t of r[e])s.has(t.key)||s.set(t.key,t)}return i.size===0&&s.size===0?xp:{declaredBy:o,fields:a,fieldsBaseFirst:[...a],fieldsDerivedFirst:[...i],flatStates:[...s.values()]}}(e)),t.composed}function Cp(e){let{fieldsDerivedFirst:t,flatStates:n}=Sp(e),r={};for(let e of n)e.schema&&(r[e.key]=e.schema);for(let[e,n]of t)r[e]=n;return r}var wp=[];function Tp(e,t,n){let r=n.getter;if(r===null)return null;let i=r===void 0?bp(t):r;return Ms(i)?_p(e,t,i,bp(t)):i}function Ep(e,t,n){let r=n.setter;if(r===null)return null;let i=r===void 0?yp(t):r;return Ms(i)?_p(e,t,i,yp(t)):i}function Dp(e){return e}function Op(e,t){let{defaultValue:n,isEqual:r}=e;return t===void 0||t===n||r!==void 0&&r(t,n)}function kp(e){let t;return(n,r)=>{t===void 0&&(t=new Map(e.map(e=>[e.key,e])));let i=t.get(n);return i!==void 0&&Op(i,r)}}function Ap(e){let{setterTable:t,schema:n}=e,{defaultValue:r}=n;return t===void 0?r:t[String(r)]}function jp(e,t){let{flatStates:n,generated:r,setters:i}=mp(pp(e.constructor)),a=function(e,t,n){let r=e;for(let e=0;e<n.length;e++){let i=n[e],a=t[i.key];if(a!==void 0){let e=i.parse(a);r=dc(r,i,()=>e)}}return r}(e,t,n);return r!==null&&r.updateFromJSON!==void 0?r.updateFromJSON(a,t):function(e,t,n){for(let r=0;r<n.length;r++){let i=n[r],a=i.schema(t[i.key]);i.kind===`ownField`?Dp(e)[i.field]=i.setterTable===void 0?a:qs(i.setterTable,a)?i.setterTable[a]:Ap(i):i.setter.call(e,a)}return e}(a,t,i)}function Mp(e){return pp(e).config}function Np(){return!0}function Pp(){return!1}function Fp(e){return e===Np||e===Pp}function Ip(e){let t=[];for(let n of[e.getter,e.setter])Ms(n)&&n.field!==`__proto__`&&!t.includes(n.field)&&t.push(n.field);return t}var Lp=`__lexicalSynthesizedAfterCloneFrom`;function Rp(e){let{declaredBy:t,fieldsBaseFirst:n}=Sp(e),r=[];for(let[i,a]of n)if(t.get(i)===e)for(let e of Ip(a))r.includes(e)||r.push(e);return r}function zp(e){let t=Rp(e);if(t.length===0)return t;let n=new Set;for(let{klass:t}of Bp(e))if(t!==e)for(let e of Rp(t))n.add(e);return n.size===0?t:t.filter(e=>!n.has(e))}function*Bp(e){for(let t=e;t&&(t===Tl||El(t.prototype));){let e=Mp(t),n=e.declaresOwnConfig;yield n?e:{...e,ownNodeConfig:void 0},t=n&&e.ownNodeConfig&&e.ownNodeConfig.extends||Up(t)}}function Vp(e){let t=Jf();Nm();let n=t.resolveRegisteredNodeAfterReplacements(t.getRegisteredNode(e)),r=new n.klass;return n.replace===null?r:vf(r)}var G=(e,t)=>{let n=e;for(;n!=null&&!iu(n);){if(t(n))return n;n=n.getParent()}return null};function Hp(e,t){let n=[],r=e.__first;for(;r!==null;){let e=t===null?B(r):t.get(r);e??M(174),n.push(r),r=e.__next}return n}function Up(e){let t=Object.getPrototypeOf(e);if(typeof t==`function`&&t!==Function.prototype)return t;let n=e.prototype&&Object.getPrototypeOf(e.prototype);return n?n.constructor:null}function Wp(e){return new Jp(as(e._nodeMap),null,e._slotsUsed)}function Gp(){return new Jp(new Map([[`root`,new ru]]),null,!1)}function Kp(e){let t=e.constructor,n=us(e);if(I(e)){let t=n.children,r=e.getChildren();for(let e=0;e<r.length;e++)t.push(Kp(r[e]))}let r=y_(e);if(r.length>0){let i={};for(let n of r){let r=b_(e,n);r===null&&M(366,t.name,n),i[n]=Kp(r)}n.$slots=i}return n}function qp(e){return e instanceof Jp}var Jp=class e{_nodeMap;_movedNodes;_selection;_flushSync;_readOnly;_parsed;_slotsUsed;constructor(e,t=null,n=!1){this._nodeMap=e,this._movedNodes=null,this._selection=t||null,this._flushSync=!1,this._readOnly=!1,this._parsed=!1,this._slotsUsed=n}isEmpty(){return this._nodeMap.size<=1&&this._selection===null}read(e,t){return Gm(t&&t.editor||null,this,e)}clone(t){let n=new e(this._nodeMap,t===void 0?this._selection:t,this._slotsUsed);return n._readOnly=!0,n._parsed=this._parsed,n}toJSON(e){return cs(typeof e==`boolean`&&e,()=>Gm(null,this,()=>({root:Kp(V())})))}},Yp=`historic`,Xp=`history-push`,Zp=`history-merge`,Qp=`paste`,$p=`collaboration`,em=`skip-collab`,tm=`skip-scroll-into-view`,nm=`skip-dom-selection`,rm=`skip-selection-focus`,im=`composition-end`,am=class extends $l{$config(){return this.config(`artificial`,{extends:$l})}createDOM(e){return Af().createElement(`div`)}},om=class extends Tl{$config(){return this.config(`linebreak`,{extends:Tl,generated:zl,importDOM:{br:e=>um(e)||dm(e)?null:{conversion:sm,priority:0}}})}getTextContent(){return`
4
+ `}createDOM(){return Af().createElement(`br`)}updateDOM(){return!1}isInline(){return!0}};function sm(e){return{node:cm()}}function cm(){return vf(new om)}function lm(e){return e instanceof om}function um(e){let t=e.parentElement;if(t!==null&&Kf(t)){let n=t.firstChild;if(n===e||n.nextSibling===e&&fm(n)){let n=t.lastChild;if(n===e||n.previousSibling===e&&fm(n))return!0}}return!1}function dm(e){let t=e.parentElement;if(t!==null&&Kf(t)){let n=t.firstChild;if(n===e||n.nextSibling===e&&fm(n))return!1;let r=t.lastChild;if(r===e||r.previousSibling===e&&fm(r))return!0}return!1}function fm(e){return _d(e)&&/^( |\t|\r?\n)+$/.test(e.textContent||``)}function pm(e){console.warn(e)}function mm(e,t,n,r,i){let a=e._keyToDOMMap;a.clear(),e._editorState=Gp(),e._pendingEditorState=r,e._compositionKey=null,e._dirtyType=0,e._cloneNotNeeded.clear(),e._dirtyLeaves=new Set,e._dirtyElements.clear(),e._normalizedNodes=new Set,i&&i.preserveUpdateQueue||(e._updateTags=new Set,e._updates=[],e._cascadeCount=0),e._blockCursorElement=null,e._inputState.handledSelectionCommandTimeoutId!==null&&clearTimeout(e._inputState.handledSelectionCommandTimeoutId),t!==null&&yh(e,t),e._inputState={collapsedSelectionFormat:{format:0,key:`root`,offset:0,style:``,timeStamp:0},composedSegmentedKey:null,compositionPhase:`idle`,hadOrphanedCompositionEvents:!1,handledSelectionCommandTimeoutId:null,isInsertLineBreak:!1,isInsertTextAfterHandledSelectionCommand:!1,isSelectionChangeFromDOMUpdate:!1,isSelectionChangeFromMouseDown:!1,isShiftKeyDown:!1,lastBeforeInputInsertTextTimeStamp:0,lastKeyCode:null,lastKeyDownTimeStamp:0,lastPointerType:``,mouseDrag:null,postDeleteSelectionToRestore:null,savedInputMode:void 0,selectionChangeFromDOMUpdatePoints:null,unprocessedBeforeInputData:null};let o=e._observer;o!==null&&(o.disconnect(),e._observer=null),t!==null&&(t.textContent=``,function(e,t){delete e[`__lexicalKey_${t._key}`]}(t,e)),n!==null&&(n.textContent=``,a.set(`root`,n),kd(n,e,`root`))}function hm(e){let t=new Set,n=new Set;for(let{klass:r,ownNodeConfig:i}of Bp(e)){let e=r.transform;if(!n.has(e)){n.add(e);let i=r.transform();i&&t.add(i)}if(i){let e=i.$transform;e&&t.add(e)}}return t}var gm={$createDOM:(e,t)=>e.createDOM(t._config,t),$decorateDOM:(e,t,n,r)=>{},$exportDOM:(e,t)=>{let n=sd(t,e.getType());return n&&n.exportDOM!==void 0?n.exportDOM(t,e):e.exportDOM(t)},$extractWithChild:(e,t,n,r,i)=>I(e)&&e.extractWithChild(t,n,r),$getDOMSlot:(e,t,n)=>e.getDOMSlot(t),$getSlotTargetElement:(e,t,n,r)=>null,$shouldExclude:(e,t,n)=>I(e)&&e.excludeFromCopy(`html`),$shouldInclude:(e,t,n)=>!t||e.isSelected(t),$updateDOM:(e,t,n,r)=>e.updateDOM(t,n,r._config)};function _m(e){let t=e||{},n=zm(),r=t.theme||{},i=e===void 0?n:t.parentEditor||null,a=t.disableEvents||!1,o=Gp(),s=t.namespace||(i===null?Hd():i._config.namespace),c=t.editorState,l=[ru,gu,om,$u,Yu,am,...t.nodes||[]],{onError:u,onWarn:d,html:f}=t,p=t.editable===void 0||t.editable,m;if(e===void 0&&n!==null)m=n._nodes;else{m=new Map;for(let e=0;e<l.length;e++){let n=l[e],r=null,i=null;if(n&&typeof n==`object`){let e=n;n=e.replace,r=e.with,i=e.withKlass||null}if(typeof n!=`function`||!n.prototype||!(n===Tl||n.prototype instanceof Tl)){let r=`<unknown>`;try{r=JSON.parse(ns)}catch{}M(365,String(e-l.length+(t.nodes?t.nodes.length:0)),typeof n==`function`?`${n.name}${typeof n.getType==`function`?` (type ${String(n.getType())})`:``}`:String(n),String(r))}Mp(n);let a=n.getType(),o=hm(n);m.set(a,{exportDOM:f&&f.export?f.export.get(n):void 0,klass:n,replace:r,replaceWithKlass:i,sharedNodeState:pc(l[e]),transforms:o})}}let h=new bm(o,i,m,{disableEvents:a,dom:{...gm,...e&&e.dom},namespace:s,theme:r},u||console.error,d||pm,function(e,t){let n=new Map,r=new Set,i=e=>{Object.keys(e).forEach(t=>{let r=n.get(t);r===void 0&&(r=[],n.set(t,r)),r.push(e[t])})};return e.forEach(e=>{let t=e.klass.importDOM;if(t==null||r.has(t))return;r.add(t);let n=t.call(e.klass);n!==null&&i(n)}),t&&i(t),n}(m,f?f.import:void 0),p,e);return c!==void 0&&(h._pendingEditorState=c,h._dirtyType=2),function(e){e.registerCommand($a,kh,0),e.registerCommand(eo,jh,0),e.registerCommand(to,Nh,0),e.registerCommand(no,Ph,0),e.registerCommand(go,Gh,0)}(h),h}function vm(e,t){let n=e.get(t);e.delete(t),n&&n()}function ym(e,t,n){return e.set(t,n),vm.bind(null,e,t)}var bm=class{static version=ns;_headless;_recordNodeMoves;_parentEditor;_rootElement;_editorState;_pendingEditorState;_compositionKey;_deferred;_keyToDOMMap;_updates;_updating;_cascadeCount;_listeners;_commands;_nodes;_decorators;_pendingDecorators;_config;_dirtyType;_cloneNotNeeded;_dirtyLeaves;_dirtyElements;_normalizedNodes;_updateTags;_observer;_key;_onError;_onWarn;_htmlConversions;_window;_editable;_blockCursorElement;_slotsUsed;_keyDownShortcuts;_inputState;_lastNotifiedSelection;_createEditorArgs;constructor(e,t,n,r,i,a,o,s,c){this._createEditorArgs=c,this._parentEditor=t,this._rootElement=null,this._editorState=e,this._pendingEditorState=null,this._compositionKey=null,this._deferred=[],this._keyToDOMMap=new os,this._updates=[],this._updating=!1,this._cascadeCount=0,this._listeners={decorator:new Map,editable:new Map,mutation:new Map,root:new Map,textcontent:new Map,update:new Map},this._commands=new Map,this._config=r,this._nodes=n,this._decorators={},this._pendingDecorators=null,this._dirtyType=0,this._cloneNotNeeded=new Map,this._dirtyLeaves=new Set,this._dirtyElements=new Map,this._normalizedNodes=new Set,this._updateTags=new Set,this._observer=null,this._key=Hd(),this._onError=i,this._onWarn=a,this._htmlConversions=o,this._editable=s,this._headless=t!==null&&t._headless,this._recordNodeMoves=!1,this._window=null,this._blockCursorElement=null,this._slotsUsed=!1,this._keyDownShortcuts=null,this._inputState={collapsedSelectionFormat:{format:0,key:`root`,offset:0,style:``,timeStamp:0},composedSegmentedKey:null,compositionPhase:`idle`,hadOrphanedCompositionEvents:!1,handledSelectionCommandTimeoutId:null,isInsertLineBreak:!1,isInsertTextAfterHandledSelectionCommand:!1,isSelectionChangeFromDOMUpdate:!1,isSelectionChangeFromMouseDown:!1,isShiftKeyDown:!1,lastBeforeInputInsertTextTimeStamp:0,lastKeyCode:null,lastKeyDownTimeStamp:0,lastPointerType:``,mouseDrag:null,postDeleteSelectionToRestore:null,savedInputMode:void 0,selectionChangeFromDOMUpdatePoints:null,unprocessedBeforeInputData:null},this._lastNotifiedSelection=null}isComposing(){return this._compositionKey!=null}registerUpdateListener(e){return ym(this._listeners.update,e)}registerEditableListener(e){return ym(this._listeners.editable,e)}registerDecoratorListener(e){return ym(this._listeners.decorator,e)}registerTextContentListener(e){return ym(this._listeners.textcontent,e)}registerRootListener(e){let t=this._listeners.root;return th(ym(t,e,e(this._rootElement,null)||void 0),()=>function(e,t,n){let r=e.get(t);r&&r(),e.set(t,t(...n)||void 0)}(t,e,[null,this._rootElement]))}registerCommand(e,t,n){n===void 0&&M(35);let r=this._commands;r.has(e)||r.set(e,[new rs,new rs,new rs,new rs,new rs]);let i=r.get(e);i===void 0&&M(36,String(e));let a=function(e){return 7&e}(n),o=i[a];return a===n?o.addBack(t):o.addFront(t),()=>{o.delete(t),i.every(e=>e.size===0)&&r.delete(e)}}registerMutationListener(e,t,n){let r=this.resolveRegisteredNodeAfterReplacements(this.getRegisteredNode(e)).klass,i=this._listeners.mutation,a=i.get(t);a===void 0&&(a=new Set,i.set(t,a)),a.add(r);let o=n&&n.skipInitialization;return o!==void 0&&o||this.initializeMutationListener(t,r),()=>{a.delete(r),a.size===0&&i.delete(t)}}getRegisteredNode(e){let t=this._nodes.get(e.getType());return t===void 0&&M(37,e.name),t}resolveRegisteredNodeAfterReplacements(e){for(;e.replaceWithKlass;)e=this.getRegisteredNode(e.replaceWithKlass);return e}initializeMutationListener(e,t){let n=this._editorState,r=tp(n).get(t.getType());if(!r)return;let i=new Map;for(let e of r.keys())i.set(e,`created`);i.size>0&&e(i,{dirtyLeaves:new Set,prevEditorState:n,updateTags:new Set([`registerMutationListener`])})}registerNodeTransformToKlass(e,t){let n=this.getRegisteredNode(e);return n.transforms.add(t),n}registerNodeTransform(e,t){let n=this.registerNodeTransformToKlass(e,t),r=[n],i=n.replaceWithKlass;if(i!=null){let e=this.registerNodeTransformToKlass(i,t);r.push(e)}return Pd(this,r.map(e=>e.klass.getType())),()=>{r.forEach(e=>e.transforms.delete(t))}}hasNode(e){return this._nodes.has(e.getType())}hasNodes(e){return e.every(this.hasNode.bind(this))}dispatchCommand(e,...t){return H(this,e,...t)}getDecorators(){return this._decorators}getRootElement(){return this._rootElement}getKey(){return this._key}setRootElement(e){let t=this._rootElement;if(e!==t){let n=Zd(this._config.theme,`root`),r=this._pendingEditorState||this._editorState;if(this._rootElement=e,mm(this,t,e,r,{preserveUpdateQueue:!0}),t!==null&&(this._config.disableEvents||function(e){let t=ah.get(e);if(t===void 0)return void Qh();let n=oh.get(t);if(n===void 0)return void Qh();ah.delete(e);let r=md(e);fd(r)?(function(e){if(e._parentEditor!==null){let t=Bd(e),n=t[t.length-1]._key;Jh.get(n)===e&&Jh.delete(n)}else Jh.delete(e._key)}(r),n.editors.delete(r),n.hasShadowEditor=void 0,e.__lexicalEditor=null):r&&M(198);let i=Kh(e);for(let e=0;e<i.length;e++)i[e]();e.__lexicalEventHandles=[]}(t),n!=null&&t.classList.remove(...n)),e!==null){let t=ff(e),r=e.style;r.userSelect=`text`,r.whiteSpace=`pre-wrap`,r.wordBreak=`break-word`,e.setAttribute(`data-lexical-editor`,`true`),this._window=t,this._dirtyType=2,ks(this),this._updateTags.add(Zp),Km(this),this._config.disableEvents||function(e,t){let n=e.ownerDocument;ah.set(e,n);let r=oh.get(n);r===void 0&&(r={editors:new Set,hasShadowEditor:void 0},oh.set(n,r)),r.editors.add(t),r.hasShadowEditor=void 0,e.__lexicalEditor=t;let i=Kh(e);i.push(sh.register(n));let a={blur:Go,click:mh,compositionend:Lh,compositionstart:Mh,copy:Lo,cut:Ro,dragend:Io,dragover:Fo,dragstart:Po,drop:Mo,focus:Wo,input:Ah,keydown:Rh,paste:so,pointerdown:bh,...Da&&{beforeinput:Oh},...ka&&{keyup:zh,mousedown:_h}};for(let[n,r]of Object.entries(a))i.push(nh(e,n,i=>{Zh(i)||(Xh(i),n===`blur`&&(yh(t,e),t._inputState.isShiftKeyDown=!1,t._inputState.isInsertLineBreak=!1),(t.isEditable()||n===`click`||n===`copy`)&&(typeof r==`function`?r(i,t):H(t,r,i)))}));let o,s=()=>{t._inputState.mouseDrag=null},c=n=>{let i=t._inputState,a=i.mouseDrag;if(o&&o.defaultPrevented&&!n.buttons&&(i.isSelectionChangeFromMouseDown=!1),!a||n.pointerType!==`mouse`)return;let c=n.type===`pointerup`;if(n.type===`pointercancel`||!c&&n.buttons!==1)return s();i.mouseDrag=c?null:n,eh(t,()=>{let o=Cf(pf(t));if(a.type!==`mousedown`){let r=c&&o&&q(J())&&Lg(zg(),o,t,new Event(`selectionchange`));return r&&Id(r),Sh(t,n,c&&o?Nf(o,e).focusNode:null)}let l=Fg(o,t);if(a.defaultPrevented||!a.shiftKey&&l&&!l.isCollapsed())s();else if(o&&i.isSelectionChangeFromMouseDown){qh(t,o,new Event(`selectionchange`),r),Sh(t,a,Nf(o,e).focusNode);let n=J();q(n)&&n.isCollapsed()&&!n.is(zg())&&ph(t,n)}})};i.push(rh(n,{pointercancel:c,pointermove:c,pointerup:c},!0),nh(pf(t),`blur`,s),t.registerEditableListener(s),rh(e,{contextmenu:s,dragstart:s,keydown:e=>e.getModifierState&&e.getModifierState(e.key)||s(),mousedown:e=>{let n=t._inputState;n.mouseDrag=e.button!==0||e.detail!==1||e.defaultPrevented||n.lastPointerType!==`mouse`||!t.isEditable()||t.isComposing()||up(zf(e),t)?null:e}}),nh(e,`pointerdown`,e=>{o=e,t._inputState.lastPointerType=e.pointerType},!0)),ka&&i.push(function(e,t){let n=null,r={capture:!0,passive:!0};return th(nh(e,`touchstart`,e=>{let t=e.touches.length===1?e.touches[0]:null;n=t?{x:t.clientX,y:t.clientY}:null},r),nh(e,`touchend`,e=>{let r=e.changedTouches[0];n!==null&&r&&e.touches.length===0&&Math.abs(r.clientX-n.x)<=hh&&Math.abs(r.clientY-n.y)<=hh&&t(e),n=null},r))}(e,n=>function(e,t,n){t._inputState.savedInputMode!==void 0&&(vh(e,t,n)||(Rf(n.ownerDocument)===n&&n.blur(),yh(t,n)))}(n,t,e)))}(e,this),n!=null&&e.classList.add(...n)}else this._window=null,this._updateTags.add(Zp),Km(this);qm(`root`,this,!1,e,t)}}getElementByKey(e){return this._keyToDOMMap.get(e)||null}getEditorState(){return this._editorState}setEditorState(e,t){let n=e.isEmpty(),r=e;r._readOnly&&(r=Wp(e),r._selection=e._selection?e._selection.clone():null),Os(this);let i=this._pendingEditorState,a=t===void 0?null:t.tag;i===null||i.isEmpty()||(a!=null&&this._updateTags.add(a),Km(this)),this._pendingEditorState=r,this._dirtyType=2,this._dirtyElements.set(`root`,!1),this._compositionKey=null,this._slotsUsed=this._slotsUsed||e._slotsUsed,eh(this,()=>{if(a&&this._updateTags.add(a),n&&(_a(38),V().append(z())),e._parsed)for(let[e,t]of r._nodeMap.entries())I(t)?this._dirtyElements.set(e,!0):this._dirtyLeaves.add(e)},{discrete:!this._updating||void 0})}parseEditorState(e,t){return function(e,t,n){let r=Gp(),i=Sm,a=wm,o=Cm,s=t._dirtyElements,c=t._dirtyLeaves,l=t._cloneNotNeeded,u=t._dirtyType;t._dirtyElements=new Map,t._dirtyLeaves=new Set,t._cloneNotNeeded=new Map,t._dirtyType=0,Sm=r,wm=!1,Cm=t,rd(null);try{let i=t._nodes;Wm(e.root,i),n&&n(),r._readOnly=!0,r._parsed=!0}catch(e){e instanceof Error&&t._onError(e)}finally{t._dirtyElements=s,t._dirtyLeaves=c,t._cloneNotNeeded=l,t._dirtyType=u,Sm=i,wm=a,Cm=o}return r}(typeof e==`string`?JSON.parse(e):e,this,t)}read(...e){let[t,n]=e.length===1?[`force-commit`,e[0]]:e;return t===`force-commit`&&(km.has(this)||Km(this)),(t===`pending`?this._pendingEditorState||this._editorState:this.getEditorState()).read(n,{editor:this})}update(e,t){(function(e,t,n){e._updating?e._updates.push([t,n]):$m(e,t,n)})(this,e,t)}focus(e,t={}){let n=this._rootElement;n!==null&&(n.setAttribute(`autocapitalize`,`off`),eh(this,()=>{let r=J(),i=V();r===null?i.getChildrenSize()!==0&&(t.defaultSelection===`rootStart`?i.selectStart():i.selectEnd()):r.dirty||Id(r.clone()),lf(`focus`),uf(()=>{n.removeAttribute(`autocapitalize`),e&&e()})}),this._pendingEditorState===null&&n.removeAttribute(`autocapitalize`))}blur(){let e=this._rootElement;e!==null&&e.blur();let t=Cf(this._window);t!==null&&t.removeAllRanges()}isEditable(){return this._editable}setEditable(e){this._editable!==e&&(this._editable=e,qm(`editable`,this,!0,e),this._slotsUsed&&this.update(()=>Lm()))}toJSON(){return{editorState:this._editorState.toJSON(ls())}}};function xm(e,t,n,r,i,a){if(I(e)){let o=e.__first;for(;o!==null;){let e=r.get(o);if(e===void 0)break;let s=I(e);e.__parent!==t||s&&a.has(o)||((s||d_(e)&&e.__slots!==null)&&xm(e,o,n,r,i,a),n.has(o)||a.delete(o),i.push(o)),o=e.__next}}for(let o of d_(e)&&e.__slots!==null?e.__slots.values():[]){let e=r.get(o);e!==void 0&&f_(e)&&e.__slotHost===t&&((I(e)||d_(e)&&e.__slots!==null)&&xm(e,o,n,r,i,a),n.has(o)||a.delete(o),i.push(o))}}var Sm=null,Cm=null,wm=!1,Tm=!1,Em=!1,Dm=new Set,Om=new Set,km=new Set,Am=0,jm={characterData:!0,childList:!0,subtree:!0};function Mm(){return wm||Sm!==null&&Sm._readOnly}function Nm(){wm&&M(13)}function Pm(){Am>99&&M(14)}function Fm(){return Sm===null&&M(195,Rm()),Sm}function Im(e){Fm()!==null&&Cm===null&&(Cm=e),Cm!==e&&_a(378)}function K(){return Cm===null&&M(337,Rm()),Cm}function Lm(){K()._dirtyType=2}function Rm(){let e=0,t=new Set,n=bm.version;if(typeof window<`u`)for(let r of Of(document)){let i=md(r);if(fd(i))e++;else if(i){let e=String(i.constructor.version||`<0.17.1`);e===n&&(e+=` (separately built, likely a bundler configuration issue)`),t.add(e)}}let r=` Detected on the page: ${e} compatible editor(s) with version ${n}`;return t.size&&(r+=` and incompatible editors with versions ${Array.from(t).join(`, `)}`),r}function zm(){return Cm}function Bm(e,t,n){let r=t.__type,i=od(e,r),a=n.get(r);a===void 0&&(a=Array.from(i.transforms),n.set(r,a));let o=a.length;for(let e=0;e<o&&(a[e](t),t.isAttached());e++);}function Vm(e,t){return e!==void 0&&e.__key!==t&&e.isAttached()}function Hm(e,t){if(!t)return;let n=e._updateTags,r=t;Array.isArray(t)||(r=[t]);for(let e of r)n.add(e)}function Um(e){return Wm(e,K()._nodes)}function Wm(e,t){let n=e.type,r=t.get(n);r===void 0&&M(17,n);let i=r.klass;e.type!==i.getType()&&M(18,i.name);let a=i.importJSON(e),o=e.children;if(I(a)&&Array.isArray(o))for(let e=0;e<o.length;e++){let n=Wm(o[e],t);a.append(n)}let s=e.$slots;if(s){d_(a)||M(379,i.name);for(let e in s)k_(a,e,Wm(s[e],t))}return a}function Gm(e,t,n){let r=Sm,i=wm,a=Cm;Sm=t,wm=!0,Cm=e;try{return n()}finally{Sm=r,wm=i,Cm=a}}function Km(e,t){e._pendingEditorState!==null&&Cm!==e&&Os(e,!1,!0);let n=Em;Em=!0;try{let n=function(e){if(Om.has(e))return!1;Om.add(e);try{for(let t=0;e._pendingEditorState!==null;t++){let n=e._pendingEditorState._selection,r=e._rootElement;if(!Jm(e,n))return!1;let i=(n===null||q(n))&&(e._headless||r===null||!r.isConnected);if(i||t===100)return e._lastNotifiedSelection=n===null?null:n.clone(),!i;$m(e,()=>e.dispatchCommand(Xa),void 0,!0)}return!1}finally{Om.delete(e)}}(e);(function(e,t){let n=e._pendingEditorState,r=e._rootElement,i=e._headless||r===null;if(n===null)return void(!e._updating&&e._deferred.length>0&&Xm(e,e._deferred));let a=e._editorState,o=a._selection,s=n._selection,c=e._dirtyType!==0,l=Sm,u=wm,d=Cm,f=e._updating,p=e._observer,m=null;if(e._pendingEditorState=null,e._editorState=n,!i&&c&&p!==null){Cm=e,Sm=n,wm=!1,e._updating=!0;try{let t=e._dirtyType,r=e._dirtyElements,i=e._dirtyLeaves;p.disconnect(),m=vl(a,n,e,t,r,i)}catch(t){if(t instanceof Error&&e._onError(t),Tm)throw t;mm(e,null,r,n),ks(e),e._dirtyType=2,Tm=!0,Km(e,a),Tm=!1;return}finally{p.observe(r,jm),e._updating=f,Sm=l,wm=u,Cm=d}}n._readOnly||=!0;let h=e._dirtyLeaves,g=e._dirtyElements,_=e._normalizedNodes,v=e._updateTags;c&&(e._dirtyType=0,e._cloneNotNeeded.clear(),e._dirtyLeaves=new Set,e._dirtyElements=new Map,e._normalizedNodes=new Set),e._updateTags=new Set;let y=e._deferred;f||(e._deferred=[]),function(e,t){let n=e._decorators,r=e._pendingDecorators||n,i=t._nodeMap,a;for(a in r)i.has(a)||(r===n&&(r=Md(e)),delete r[a])}(e,n);let b=i?null:Cf(pf(e));if(e._editable&&b!==null&&(c||s===null||s.dirty||!s.is(o))&&r!==null&&!v.has(`skip-dom-selection`)){Cm=e,Sm=n;try{if(p!==null&&p.disconnect(),c||s===null||s.dirty){let t=e._blockCursorElement;t!==null&&Sf(t,e,r),Kg(o,s,e,b,v,r)}(function(e,t,n){let r=e._blockCursorElement;if(q(n)&&n.isCollapsed()&&n.anchor.type===`element`&&t.contains(Lf(t))){let i=n.anchor,a=i.getNode(),o=i.offset,s=!1,c=null;if(o===a.getChildrenSize())xf(a.getChildAtIndex(o-1))&&(s=!0);else{let t=a.getChildAtIndex(o);t!==null&&xf(t)&&(s=!0,c=e.getElementByKey(t.__key))}if(s){let n=Xf(a,e.getElementByKey(a.__key),e).element;r===null&&(e._blockCursorElement=r=function(e){let t=e.theme,n=Af().createElement(`div`);n.contentEditable=`false`,n.setAttribute(`data-lexical-cursor`,`true`);let r=t.blockCursor;return r!==void 0&&(typeof r==`string`&&(r=t.blockCursor=pv(r)),r!==void 0&&n.classList.add(...r)),n}(e._config)),t.style.caretColor=`transparent`,c===null?n.appendChild(r):n.insertBefore(r,c);return}}r!==null&&Sf(r,e,t)})(e,r,s)}finally{p!==null&&p.observe(r,jm),Cm=d,Sm=l}}let x=km.has(e);km.add(e);try{m!==null&&function(e,t,n,r,i){let a=Array.from(e._listeners.mutation),o=a.length;for(let e=0;e<o;e++){let[o,s]=a[e];for(let e of s){let a=t.get(e);a!==void 0&&o(a,{dirtyLeaves:r,prevEditorState:i,updateTags:n})}}}(e,m,v,h,a);let r=e._pendingDecorators;r!==null&&(e._decorators=r,e._pendingDecorators=null,qm(`decorator`,e,!0,r)),function(e,t,n){let r=Nd(t),i=Nd(n);r!==i&&qm(`textcontent`,e,!0,i)}(e,t||a,n),qm(`update`,e,!0,{dirtyElements:g,dirtyLeaves:h,editorState:n,mutatedNodes:m,normalizedNodes:_,prevEditorState:t||a,tags:v})}finally{x||km.delete(e)}f||Xm(e,y),function(e){let t=e._updates;if(t.length===0)return void(e._cascadeCount=0);if(function(e){Dm.has(e)||(Dm.add(e),setTimeout(()=>{Dm.delete(e),e._cascadeCount=0},0))}(e),e._cascadeCount++>99)return e._updates=[],e._cascadeCount=0,void e._onWarn(ga(437,e._config.namespace));let n=t.shift();if(n){let[t,r]=n;$m(e,t,r)}}(e)})(e,t),n&&e._onWarn(ga(436))}finally{Em=n}}function qm(e,t,n,...r){let i=t._updating;t._updating=n;try{let n=t._listeners[e],i=Array.from(n);for(let[e,t]of i){t&&t();let i=e(...r),a=typeof i==`function`?i:void 0;n.has(e)?n.set(e,a):a&&a()}}finally{t._updating=i}}function Jm(e,t){let n=e._lastNotifiedSelection;return t===null?n!==null:!t.is(n)}function Ym(e,t,n,r){let i=Bd(e),a;if(!Em)for(let e=0;e<i.length;e++)i[e]._updating||(i[e]._cascadeCount=0);if(t===Xa){if(Cm!==e||wm){let i=!1;return eh(e,()=>{i=Ym(e,t,n,r)}),i}let i=Fm()._selection;e._lastNotifiedSelection=i===null?null:i.clone()}for(let e=4;e>=0;e--)for(let o=0;o<i.length;o++){let s=i[o];if(o>0&&s._updating){a=s;break}let c=s._commands.get(t);if(c!==void 0){let t=c[e];if(t.size>0){let e=!1;if(eh(s,()=>{for(let i of t)if(i(n,r))return void(e=!0)}),e)return e}}}return a&&a.update(()=>{Ym(a,t,n,r)}),!1}function Xm(e,t){if(e._deferred===t&&(e._deferred=[]),t.length!==0){let n=e._updating;e._updating=!0;try{for(let e=0;e<t.length;e++)t[e]()}finally{e._updating=n}}}function Zm(e,t){let n=e._updates,r=t||!1;for(;n.length!==0;){let t=n.shift();if(t){let[n,i]=t,a=e._pendingEditorState,o;i!==void 0&&(o=i.onUpdate,i.skipTransforms&&(r=!0),i.discrete&&(a===null&&M(191),a._flushSync=!0),o&&e._deferred.push(o),Hm(e,i.tag)),a==null?$m(e,n,i):n()}}return r}function Qm(){let e=Fm();Nm(),e._flushSync=!0}function $m(e,t,n,r=!1){let i=e._updateTags,a,o=!1,s=!1;n!==void 0&&(a=n.onUpdate,Hm(e,n.tag),o=n.skipTransforms||!1,s=n.discrete||!1),a&&e._deferred.push(a);let c=e._editorState,l=e._pendingEditorState,u=!1;(l===null||l._readOnly)&&(l=e._pendingEditorState=Wp(l||c),u=!0),l._flushSync=s;let d=Sm,f=wm,p=Cm,m=e._updating,h=e._lastNotifiedSelection;Sm=l,wm=!1,e._updating=!0,Cm=e;let g=e._headless||e.getRootElement()===null;rd(null);try{u&&(g?c._selection!==null&&(l._selection=c._selection.clone()):l._selection=function(e,t){let n=e.getEditorState()._selection,r=Cf(pf(e));return q(n)||n==null?Lg(n,r,e,t):n.clone()}(e,n&&n.event||null));let r=e._compositionKey;t(),o=Zm(e,o),function(e,t){let n=t.getEditorState()._selection,r=e._selection;if(q(r)){let e=r.anchor,t=r.focus,i;if(e.type===`text`&&(i=e.getNode(),i.selectionTransform(n,r)),t.type===`text`){let e=t.getNode();i!==e&&e.selectionTransform(n,r)}}}(l,e),e._dirtyType!==0&&(o?function(e,t){let n=t._dirtyLeaves,r=e._nodeMap;for(let e of n){let t=r.get(e);R(t)&&t.isAttached()&&t.isSimpleText()&&!t.isUnmergeable()&&kl(t)}}(l,e):function(e,t){let n=t._dirtyLeaves,r=t._dirtyElements,i=e._nodeMap,a=Ed(),o=new Map,s=n,c=s.size,l=r,u=l.size;for(;c>0||u>0;){if(c>0){t._dirtyLeaves=new Set;for(let e of s){let r=i.get(e);R(r)&&r.isAttached()&&r.isSimpleText()&&!r.isUnmergeable()&&kl(r),r!==void 0&&Vm(r,a)&&Bm(t,r,o),n.add(e)}if(s=t._dirtyLeaves,c=s.size,c>0){Am++;continue}}t._dirtyLeaves=new Set,t._dirtyElements=new Map,l.delete(`root`)&&l.set(`root`,!0);for(let e of l){let n=e[0],s=e[1];if(r.set(n,s),!s)continue;let c=i.get(n);c!==void 0&&Vm(c,a)&&Bm(t,c,o)}s=t._dirtyLeaves,c=s.size,l=t._dirtyElements,u=l.size,Am++}t._dirtyLeaves=n,t._dirtyElements=r}(l,e),Zm(e),function(e,t,n,r){let i=e._nodeMap,a=t._nodeMap,o=[];for(let[e]of r){let t=a.get(e);t!==void 0&&(t.isAttached()||(I(t)&&xm(t,e,i,a,o,r),i.has(e)||r.delete(e),o.push(e)))}for(let e of n){let t=a.get(e);t===void 0||t.isAttached()||(d_(t)&&t.__slots!==null&&xm(t,e,i,a,o,n),i.has(e)||n.delete(e),o.push(e))}let s=K(),c=s._cloneNotNeeded;for(let e of o)a.delete(e),c.delete(e);let l=s._compositionKey;l===null||a.has(l)||(s._compositionKey=null)}(c,l,e._dirtyLeaves,e._dirtyElements)),r!==e._compositionKey&&(l._flushSync=!0);let i=l._selection;if(q(i)){e._slotsUsed&&Og(i);let t=l._nodeMap,n=i.anchor.key,r=i.focus.key;t.get(n)!==void 0&&t.get(r)!==void 0||M(19)}else lg(i)&&i._nodes.size===0&&(l._selection=null)}catch(t){t instanceof Error&&e._onError(t),e._pendingEditorState=c;let n=c._selection;e._lastNotifiedSelection=n===null?null:n.clone(),e._dirtyType=2,e._cloneNotNeeded.clear(),e._dirtyLeaves=new Set,e._dirtyElements.clear(),Km(e);return}finally{Sm=d,wm=f,Cm=p,e._updating=m,Am=0}r||(e._dirtyType!==0||e._deferred.length>0||function(e,t){let n=t.getEditorState()._selection,r=e._selection;if(r!==null){if(r.dirty||!r.is(n))return!0}else if(n!==null)return!0;return!1}(l,e)?l._flushSync?(l._flushSync=!1,Km(e)):u&&cd(()=>{Km(e)}):(l._flushSync=!1,u&&(i.clear(),e._deferred=[],e._pendingEditorState=null,e._lastNotifiedSelection=h)))}function eh(e,t,n){Cm===e&&n===void 0?Mm()?$m(e,t,n):t():$m(e,t,n)}function th(...e){return()=>{for(let t=e.length-1;t>=0;t--)e[t]();e.length=0}}function nh(e,t,n,r){return e.addEventListener(t,n,r),e.removeEventListener.bind(e,t,n,r)}function rh(e,t,n){return th(...Object.entries(t).map(([t,r])=>nh(e,t,r,n)))}var ih=30,ah=new WeakMap,oh=new WeakMap,sh=es(e=>(e.addEventListener(`selectionchange`,Yh),()=>e.removeEventListener(`selectionchange`,Yh)));function ch(e,t,n,r,i,a){let o=e.anchor,s=e.focus,c=o.getNode(),l=K(),u;if(a!==void 0)u=a;else{let e=Cf(pf(l));u=e===null?null:Nf(e,l._rootElement)}let d=u===null?null:u.anchorNode,f=o.key,p=l.getElementByKey(f),m=n.length;return f!==s.key||!R(c)||(!i&&(!Da||l._inputState.lastBeforeInputInsertTextTimeStamp<r+50)||c.isDirty()&&m<2||zd(n))&&o.offset!==s.offset&&!c.isComposing()||gd(c)||c.isDirty()&&m>1||(i||!Da)&&p!==null&&!c.isComposing()&&d!==Qf(c,p,l)||u!==null&&t!==null&&(!t.collapsed||t.startContainer!==u.anchorNode||t.startOffset!==u.anchorOffset)||!c.isComposing()&&(c.getFormat()!==e.format||c.getStyle()!==e.style)||function(e,t){if(t.isSegmented())return!0;if(!e.isCollapsed())return!1;let n=e.anchor.offset,r=t.getParentOrThrow(),i=hd(t);return n===0?!t.canInsertTextBefore()||!r.canInsertTextBefore()&&!t.isComposing()||i||function(e){let t=e.getPreviousSibling();return(R(t)||I(t)&&t.isInline())&&!t.canInsertTextAfter()}(t):n===t.getTextContentSize()&&(!t.canInsertTextAfter()||!r.canInsertTextAfter()&&!t.isComposing()||i)}(e,c)}function lh(e,t){return _d(e)&&e.nodeValue!==null&&t!==0&&t!==e.nodeValue.length}function uh(e,t,n){let{anchorNode:r,anchorOffset:i,focusNode:a,focusOffset:o}=Nf(e,t._rootElement),s=t._inputState;if(s.isSelectionChangeFromDOMUpdate){s.isSelectionChangeFromDOMUpdate=!1;let e=s.selectionChangeFromDOMUpdatePoints;if(s.selectionChangeFromDOMUpdatePoints=null,lh(r,i)&&lh(a,o)&&!s.postDeleteSelectionToRestore&&(e===null||e.anchorNode===r&&e.anchorOffset===i&&e.focusNode===a&&e.focusOffset===o))return}eh(t,()=>{if(!n)return void Id(null);if(!dd(t,r,a))return;let c=s.mouseDrag;!c||c.type===`mousedown`&&c.defaultPrevented||Sh(t,c,a);let l=xh.has(c),u=J();if(s.postDeleteSelectionToRestore&&q(u)&&u.isCollapsed()){let e=u.anchor,t=s.postDeleteSelectionToRestore.anchor;(e.key===t.key&&e.offset===t.offset+1||e.offset===1&&t.getNode().is(e.getNode().getPreviousSibling()))&&(u=s.postDeleteSelectionToRestore.clone(),Id(u))}if(s.postDeleteSelectionToRestore=null,q(u)){let n=u.anchor;if(u.isCollapsed())e.type===`Range`&&r===a&&(u.dirty=!0),ph(t,u);else{let e=n.key,t=u.focus,r=t.key,a=u.getNodes(),s=a.length,c=u.isBackward(),[d,f]=l?[n.offset,t.offset]:[i,o],p=c?f:d,m=c?d:f,h=c?r:e,g=c?e:r,_=Ia,v=!1;for(let e=0;e<s;e++){let t=a[e],n=t.getTextContentSize();if(R(t)&&n!==0&&!(e===0&&t.__key===h&&p===n||e===s-1&&t.__key===g&&m===0)&&(v=!0,_&=t.getFormat(),_===0))break}u.format=v?_:0}}(function(e,t,n=!1){(n||Jm(e,t))&&e.dispatchCommand(Xa)})(t,u,u!==null&&(u.dirty&&!l||!q(u)))})}function dh(e,t,n){e.format===t&&e.style===n||(e.format=t,e.style=n,e.dirty=!0)}function fh(e,t){dh(e,t.getFormat(),t.getStyle())}function ph(e,t){let n=t.anchor,r=n.getNode(),i=pf(e).event,a=i?i.timeStamp:performance.now(),{format:o,style:s,offset:c,key:l,timeStamp:u}=e._inputState.collapsedSelectionFormat;a<u+200&&n.offset===c&&n.key===l?dh(t,o,s):n.type===`text`?(R(r)||M(141),fh(t,r)):(e.isComposing()||V().getTextContent()!==``)&&(I(r)||M(259),r.isEmpty()?Rg(t,``):dh(t,t.format,``))}function mh(e,t){eh(t,()=>{let n=J(),r=Cf(pf(t)),i=zg();if(r){if(q(n)){let e=n.anchor,t=e.getNode();e.type===`element`&&e.offset===0&&n.isCollapsed()&&!iu(t)&&V().getChildrenSize()===1&&t.getTopLevelElementOrThrow().isEmpty()&&i!==null&&n.is(i)&&(r.removeAllRanges(),n.dirty=!0)}else if(e.pointerType===`touch`||e.pointerType===`pen`||ka&&t._inputState.lastPointerType!==`mouse`){let n=Nf(r,t._rootElement).anchorNode;(W(n)||_d(n))&&Id(Lg(i,r,t,e))}}if(Ta&&r!==null&&r.rangeCount===0){let n=t._rootElement;if(n!==null&&e.target===n){let a=e.clientY,o=n.childNodes.length;for(let e=0;e<n.childNodes.length;e++){let t=n.childNodes[e];if(W(t)){let n=t.getBoundingClientRect();if(a<=(n.top+n.bottom)/2){o=e;break}}}r.setBaseAndExtent(n,o,n,o);let s=Lg(i,r,t,e);s===null?r.removeAllRanges():Id(s)}}H(t,Qa,e)})}var hh=10,gh=`input:not(:disabled),textarea:not(:disabled),select:not(:disabled),button:not(:disabled),a[href],area[href],label,summary,iframe,object,embed,audio[controls],video[controls],[tabindex],[contenteditable]:not([contenteditable="false"])`;function _h(e,t){let n=t.getRootElement();n!==null&&(vh(e,t,n)?(e.preventDefault(),Rf(n.ownerDocument)!==n&&(t._inputState.savedInputMode===void 0&&(t._inputState.savedInputMode=n.getAttribute(`inputmode`)),n.setAttribute(`inputmode`,`none`),n.focus({preventScroll:!0}))):yh(t,n))}function vh(e,t,n){if(t._inputState.lastPointerType===`mouse`)return!1;let r=zf(e);if(!Vf(r))return!1;let i=!1;for(let e=r;e!==null;e=af(e)){if(e===n)return i;if(e.nodeType===1){let t=e;if(t.matches(gh))return!1;t.getAttribute(`data-lexical-decorator`)===`true`&&(i=!0)}}return!1}function yh(e,t){let n=e._inputState.savedInputMode;n!==void 0&&(e._inputState.savedInputMode=void 0,n===null?t.removeAttribute(`inputmode`):t.setAttribute(`inputmode`,n))}function bh(e,t){let n=zf(e),r=e.pointerType;Vf(n)&&r!==`touch`&&r!==`pen`&&e.button===0&&eh(t,()=>{up(n,t)||(t._inputState.isSelectionChangeFromMouseDown=!0)})}var xh=new WeakSet;function Sh(e,t,n=null){let r=J(),i=r&&r.clone();(function(e,t,n){let r=zg(),i=t.type===`mousedown`,a=i&&!t.shiftKey,o=n&&jd(n);L(o)&&(i?a&&o.isInline()&&o.selectPrevious():q(r)&&Id(r.clone()));let s=J(),c=s||(a?Ng():q(r)?r.clone():null),l=e.getRootElement(),u=l&&l.getRootNode();if(!q(c)||a&&!c.isCollapsed()||!vd(u)&&!Tf(u))return;let{anchor:d,focus:f}=c;if(!i&&q(r)){let{key:e,offset:t,type:n}=r.anchor;d.set(e,t,n,!0)}let{clientX:p,clientY:m}=t,h=u.elementFromPoint&&u.elementFromPoint(p,m),g=h&&jd(h),_=(e,t)=>I(e)?t===`next`?e.getLastDescendant():e.getFirstDescendant():e,v=[null],y=I(g)&&!g.isInline()&&(iu(g)?G(f.getNode(),jg):g);for(let e of y?J_(y,`next`):[])v.push(Y(e.origin,`previous`),e);let b=pf(e),x=b.document.createRange(),S=null;for(let t of v){let n=t?_(t.origin,t.direction):g;if(!L(n)||!n.isInline()||n===S)continue;let r=e.getElementByKey(n.getKey());if(!r)continue;x.selectNodeContents(r);let i=x.getBoundingClientRect(),o=r.getBoundingClientRect(),{bottom:l,left:u,right:h,top:v}=i.height>o.height?i:o;if(t&&(m<v||m>l)){S=n;continue}let y=b.getComputedStyle(af(r)||r).direction===`rtl`,C=2*p>u+h!==y,w=C?`next`:`previous`,T=t&&t.getNodeAtCaret(),E=T&&e.getElementByKey(T.getKey()),D=E?E.getClientRects():[],ee=D[C?0:D.length-1];if(!t||t.direction===w&&b.getComputedStyle(r).cssFloat===`none`&&(!T||lm(T)||ee&&(C===y?2*ee.right>u+h:2*ee.left<u+h))){if(!n.is(_(tf(f,C),w))){let e=Y(n,w);Ou(f,e),a&&Ou(d,e)}s||Id(c);return}}if(L(o)&&!i){let t=b.document,n=t.caretPositionFromPoint&&t.caretPositionFromPoint(p,m,{shadowRoots:Tf(u)?[u]:[]}),r=n&&Cg(n.offsetNode,n.offset,null,e);if(r){let[{key:e,offset:t,type:n}]=r;f.set(e,t,n)}}})(e,t,n);let a=J(),o=e._inputState.mouseDrag;o&&a&&!a.is(i)&&xh.add(o),t.type===`mousedown`&&q(a)&&Rg(a,q(i)?i.anchor.key:``)}function Ch(e){if(!e.getTargetRanges)return null;let t=e.getTargetRanges();return t.length===0?null:t[0]}function wh(e){let{lastKeyCode:t}=K()._inputState;if(e==null||e.length<=1||t==null)return;let n=t.length===1?t:t===`Enter`?`
5
+ `:t===`Tab`?` `:null;if(!n)return;let r=J();if(!q(r)||!r.isCollapsed())return;let i=r.anchor.getNode();if(!R(i))return;let{offset:a}=r.anchor;if(i.getTextContentSize()===a){let e=i.getNextSibling();if(n===`
6
+ `){if(ka)return;if(lm(e))e.selectEnd();else if(!e){let e=G(i,jg),t=e&&e.getNextSibling();I(t)&&t.selectStart()}}else n===` `?td(e)&&e.selectEnd():R(e)&&e.getTextContent()[0]===n&&e.select(1,1)}else i.getTextContent()[a]===n&&i.select(a+1,a+1)}function Th(e){e.isInsertTextAfterHandledSelectionCommand=!1,e.handledSelectionCommandTimeoutId!==null&&(clearTimeout(e.handledSelectionCommandTimeoutId),e.handledSelectionCommandTimeoutId=null)}function Eh(e){wa&&!ka&&Ma&&(Th(e),e.isInsertTextAfterHandledSelectionCommand=!0,e.handledSelectionCommandTimeoutId=setTimeout(()=>Th(e),0))}function Dh(e,t){let n=zf(e);if(W(n)&&up(n,t))return!0;let r=t.getRootElement();if(r===null)return!1;let i=Rf(r.ownerDocument);return i!==null&&r.contains(i)&&(up(i,t)||ld(r,i))}function Oh(e,t){let n=e.inputType;n===`deleteCompositionText`||Ta&&nf(t)||n!==`insertCompositionText`&&eh(t,()=>{Dh(e,t)||H(t,$a,e)},{event:e})}function kh(e){let t=e.inputType,n=Ch(e),r=K(),i=r._inputState,a=J();if(t===`insertText`&&e.data&&i.isInsertTextAfterHandledSelectionCommand){if(Th(i),e.preventDefault(),q(a)&&!a.isCollapsed()){let e=a.isBackward()?a.anchor:a.focus;a.anchor.set(e.key,e.offset,e.type),a.focus.set(e.key,e.offset,e.type)}return!0}if(t===`deleteContentBackward`){if(a===null){let e=zg();if(!q(e))return!0;Id(e.clone())}if(q(a)){let t=a.anchor.key===a.focus.key;if(function(e,t){return e.lastKeyCode===`MediaLast`&&t<e.lastKeyDownTimeStamp+ih}(i,e.timeStamp)&&r.isComposing()&&t){if(Td(null),i.lastKeyDownTimeStamp=0,setTimeout(()=>{eh(r,()=>{Td(null)})},ih),q(a)){let e=a.anchor.getNode();e.markDirty(),R(e)||M(142),fh(a,e)}}else{if(Td(null),ka&&n!==null&&!n.collapsed&&(a.applyDOMRange(n),!a.isCollapsed()))return e.preventDefault(),a.removeText(),!0;e.preventDefault();let o=a.anchor.getNode(),s=o.getTextContent(),c=o.canInsertTextAfter(),l=a.anchor.offset===0&&a.focus.offset===s.length,u=Na&&t&&!l&&c;if(u&&a.isCollapsed()&&(u=!L(tf(a.anchor,!0))),!u){H(r,ro,!0);let e=J();Na&&q(e)&&e.isCollapsed()&&(i.postDeleteSelectionToRestore=e,setTimeout(()=>i.postDeleteSelectionToRestore=null))}}return!0}}if(!q(a))return t!==`historyUndo`&&t!==`historyRedo`||(e.preventDefault(),H(r,t===`historyUndo`?mo:ho)),!0;let o=e.data;i.unprocessedBeforeInputData!==null&&Wd(!1,r,i.unprocessedBeforeInputData);let s=!1;if((!a.dirty||i.unprocessedBeforeInputData!==null)&&a.isCollapsed()&&!iu(a.anchor.getNode())&&n!==null){let{key:e,offset:i,type:o}=a.anchor,c=r._slotsUsed&&Tg(a.anchor);a.applyDOMRange(n);let l=t.endsWith(`Forward`);if(!1!==c&&(l||t.endsWith(`Backward`))){let n=eg(e,i,o),{anchor:r,focus:u}=a,d=!Dg(Tg(r),c)||!Dg(Tg(u),c),f=!d&&c!==null&&(l?r.isBefore(n)||u.isBefore(n):n.isBefore(r)||n.isBefore(u));(d||f)&&(r.set(e,i,o),u.set(e,i,o),s=f&&t===`deleteContentForward`)}}i.unprocessedBeforeInputData=null;let c=a.anchor,l=a.focus,u=c.getNode(),d=l.getNode();if(t===`insertText`||t===`insertTranspose`){if(o===`
7
+ `)e.preventDefault(),H(r,io,!1);else if(o===Ra)e.preventDefault(),H(r,ao);else if(o==null&&e.dataTransfer){let t=e.dataTransfer.getData(`text/plain`);e.preventDefault(),a.insertRawText(t)}else o!=null&&ch(a,n,o,e.timeStamp,!0)?(e.preventDefault(),H(r,oo,o),wh(o)):i.unprocessedBeforeInputData=o;return i.lastBeforeInputInsertTextTimeStamp=e.timeStamp,!0}switch(e.preventDefault(),t){case`insertFromYank`:case`insertFromDrop`:case`insertReplacementText`:H(r,oo,e),wh((e.dataTransfer?e.dataTransfer.getData(`text/plain`):null)??e.data);break;case`insertFromComposition`:{i.compositionPhase=`idle`;let t=i.hadOrphanedCompositionEvents;i.hadOrphanedCompositionEvents=!1;let n=r._compositionKey;Td(null),t||H(r,oo,e),Fh(n);break}case`insertLineBreak`:Td(null),i.isInsertLineBreak=!1,H(r,io,!1);break;case`insertParagraph`:Td(null),i.isInsertLineBreak?(i.isInsertLineBreak=!1,H(r,io,!1)):H(r,ao);break;case`insertFromPaste`:case`insertFromPasteAsQuotation`:H(r,so,e);break;case`deleteByComposition`:(function(e,t){return e!==t||I(e)||I(t)||!hd(e)||!hd(t)})(u,d)&&H(r,co,e);break;case`deleteByDrag`:lf(rm),H(r,co,e);break;case`deleteByCut`:H(r,co,e);break;case`deleteContent`:H(r,ro,!1);break;case`deleteWordBackward`:H(r,lo,!0);break;case`deleteWordForward`:H(r,lo,!1);break;case`deleteHardLineBackward`:case`deleteSoftLineBackward`:H(r,uo,!0);break;case`deleteContentForward`:case`deleteHardLineForward`:case`deleteSoftLineForward`:H(r,s?ro:uo,!1);break;case`formatStrikeThrough`:H(r,fo,`strikethrough`);break;case`formatBold`:H(r,fo,`bold`);break;case`formatItalic`:H(r,fo,`italic`);break;case`formatUnderline`:H(r,fo,`underline`);break;case`historyUndo`:H(r,mo);break;case`historyRedo`:H(r,ho)}return!0}function Ah(e,t){e.stopPropagation();let n=t._inputState;Th(n),eh(t,()=>{Dh(e,t)||t.dispatchCommand(eo,e)},{event:e}),n.unprocessedBeforeInputData=null}function jh(e){let t=K(),n=t._inputState,r=J(),i=e.data,a=Ch(e),o=!1,s=!1;if(i!=null&&q(r)){let c=Cf(pf(t)),l=c===null?null:Nf(c,t._rootElement),u=e.inputType===`insertCompositionText`&&n.compositionPhase!==`ending-firefox`&&!t.isComposing();u&&(n.hadOrphanedCompositionEvents=!0);let d=r.anchor.getNode(),f=e.inputType===`insertCompositionText`&&n.compositionPhase!==`ending-firefox`&&t.isComposing()&&R(d)&&gd(d);if(!u&&!f&&ch(r,a,i,e.timeStamp,!1,l)){if(o=!0,n.compositionPhase===`ending-firefox`){let e=Ih(t,i);if(n.compositionPhase=`idle`,e)return lf(im),Ld(),!0}let a=r.anchor.getNode();if(c===null||l===null)return!0;let u=r.isBackward(),d=u?r.anchor.offset:r.focus.offset,f=u?r.focus.offset:r.anchor.offset;Da&&!r.isCollapsed()&&R(a)&&l.anchorNode!==null&&a.getTextContent().slice(0,d)+i+a.getTextContent().slice(d+f)===Ud(l.anchorNode)||(H(t,oo,i),s=e.inputType===`insertText`);let p=i.length;Ta&&p>1&&e.inputType===`insertCompositionText`&&!t.isComposing()&&(r.anchor.offset-=p,r._cachedNodes=null,r._cachedIsBackward=null),Na&&t.isComposing()&&(n.lastKeyDownTimeStamp=0,Td(null))}}return o||(Wd(!1,t,i===null?void 0:i),n.compositionPhase===`ending-firefox`&&(Ih(t,i||void 0),lf(`composition-end`),n.compositionPhase=`idle`)),Ld(s),!0}function Mh(e,t){H(t,to,e)}function Nh(e){let t=K(),n=t._inputState,r=J();if(q(r)&&!t.isComposing()){n.compositionPhase=`composing`,n.hadOrphanedCompositionEvents=!1;let i=r.anchor,a=r.anchor.getNode();if(Td(i.key),lf(`composition-start`),e.timeStamp<n.lastKeyDownTimeStamp+ih||i.type===`element`||!r.isCollapsed()||!Na&&(a.getFormat()!==r.format||R(a)&&a.getStyle()!==r.style)||R(a)&&(gd(a)||i.offset===0&&!a.canInsertTextBefore()||i.offset===a.getTextContentSize()&&!a.canInsertTextAfter())){ka||!ja&&!Pa?H(t,oo,za):function(e){ig(e,``,!0)}(r);let e=J();q(e)&&Td(e.anchor.key)}}return!0}function Ph(e){let t=K();return t._inputState.compositionPhase=`idle`,Ih(t,e.data),lf(im),!0}function Fh(e){let t=K()._inputState,n=t.composedSegmentedKey;if(t.composedSegmentedKey=null,e===null||e!==n)return;let r=B(e);if(!R(r)||r.getType()===`text`||gd(r)||!r.isAttached())return;let i=J(),a=q(i)&&i.anchor.key===e?i.anchor.offset:null,o=Tu(r.getTextContent());if(o.setFormat(r.getFormat()),o.setStyle(r.getStyle()),r.replace(o),a!==null){let e=Math.min(a,o.getTextContentSize());o.select(e,e)}}function Ih(e,t){let n=e._compositionKey;if(Td(null),n!==null&&t!=null){if(t===``){let t=B(n),r=e.getElementByKey(n),i=r!==null&&R(t)?Qf(t,r,e):null;if(i!==null&&i.nodeValue!==null&&R(t)){let n=Cf(pf(e)),r=n&&Nf(n,e._rootElement),a=null,o=null;r!==null&&r.anchorNode===i&&(a=r.anchorOffset,o=r.focusOffset),Gd(t,i.nodeValue,a,o,!0)}return Fh(n),!1}if(t[t.length-1]===`
8
+ `){let t=J();if(q(t)||lg(t)){if(q(t)){let e=t.focus;t.anchor.set(e.key,e.offset,e.type)}return H(e,Co,null),Fh(n),!1}}let r=B(n);if(r!==null&&R(r)&&gd(r)){r.markDirty();let e=J(),i=r.getTextContentSize(),a=q(e)&&e.anchor.key===n?e.anchor.offset:i;return r.select(a,a).insertText(t),!0}}return Wd(!0,e,t),Fh(n),!1}function Lh(e,t){let n=t._inputState;Ta?n.compositionPhase=`ending-firefox`:(e.data===``||ka||!ja&&!Pa)&&H(t,no,e)}function Rh(e,t){let n=t._inputState;ka&&(n.isShiftKeyDown=e.key===`Shift`||n.isShiftKeyDown&&e.shiftKey&&e.key!==`CapsLock`),n.lastKeyDownTimeStamp=e.timeStamp,n.lastKeyCode=e.key,e.key!==`Backspace`&&Th(n),t.isComposing()||!ka&&(ja||Pa)&&e.keyCode===229||H(t,go,e)}function zh(e,t){e.shiftKey&&e.key!==`CapsLock`||(t._inputState.isShiftKeyDown=!1)}var Bh={altKey:`any`,ctrlKey:`any`,metaKey:`any`,shiftKey:`any`},Vh={ctrlKey:!0},Hh={metaKey:!0},Uh={shiftKey:`any`},Wh={altKey:`any`,shiftKey:`any`};function Gh(e){let t=K();if(e.key==null)return!0;let n=t._keyDownShortcuts;n===null&&(n=$o(function(){let e=(e,t,n)=>({key:e,modifiers:t,onMatch:(e,t)=>{H(t,n,e)}}),t=(e,t,n,r)=>({key:e,modifiers:t,onMatch:(e,t)=>{e.preventDefault(),H(t,n,r)}}),n=(e,t)=>({key:`Enter`,modifiers:e,onMatch:(e,n)=>{let r=n._inputState;r.isInsertLineBreak=t&&(!ka||r.isShiftKeyDown),H(n,Co,e),e.defaultPrevented&&(r.isInsertLineBreak=!1)}}),r=(e,t)=>({key:e,modifiers:Jo,onMatch:(e,n)=>{let r=n._editorState._selection;r===null||q(r)||ud(e)||(e.preventDefault(),H(n,t,e))}});return[e(`ArrowRight`,Uh,_o),e(`ArrowLeft`,Uh,yo),e(`ArrowUp`,Wh,xo),e(`ArrowDown`,Wh,So),n({...Bh,shiftKey:!0},!0),n({...Bh,shiftKey:!1},!1),e(` `,Bh,wo),{key:`Backspace`,modifiers:Uh,onMatch:(e,t)=>{H(t,To,e)&&Eh(t._inputState)}},e(`Escape`,Bh,Eo),e(`Delete`,{},Do),t(`Backspace`,Yo,lo,!0),t(`Delete`,Yo,lo,!1),t(`b`,Jo,fo,`bold`),t(`u`,Jo,fo,`underline`),t(`i`,Jo,fo,`italic`),e(`Tab`,Uh,Oo),t(`z`,Jo,mo,void 0),t(`z`,{...Jo,shiftKey:!0},ho,void 0),...wa?[{key:`o`,modifiers:Vh,onMatch:(e,t)=>{e.preventDefault(),H(t,io,!0)}},e(`ArrowLeft`,{metaKey:!0,...Uh},bo),e(`ArrowRight`,{metaKey:!0,...Uh},vo),t(`h`,Vh,ro,!0),t(`d`,Vh,ro,!1),t(`Backspace`,Hh,uo,!0),t(`Delete`,Hh,uo,!1),t(`k`,Vh,uo,!1)]:[e(`Home`,Uh,bo),e(`End`,Uh,vo),t(`y`,Vh,ho,void 0)],{key:`a`,modifiers:Jo,onMatch:(e,t)=>{e.preventDefault(),H(t,zo,e)&&Eh(t._inputState)}},r(`c`,Lo),r(`x`,Ro)]}()),t._keyDownShortcuts=n);let r=n.match(e);return r&&r.onMatch(e,t),function(e){return e.ctrlKey||e.shiftKey||e.altKey||e.metaKey}(e)&&t.dispatchCommand(Ko,e),!0}function Kh(e){let t=e.__lexicalEventHandles;return t===void 0&&(t=[],e.__lexicalEventHandles=t),t}function qh(e,t,n,r){if(r!==void 0)for(let e of r.editors)e._inputState.isSelectionChangeFromMouseDown=!1;let i=Nf(t,e._rootElement).anchorNode;(W(i)||_d(i))&&Id(Lg(zg(),t,e,n))}var Jh=new Map;function Yh(e){let t=e.target;if(W(t)&&(t.nodeName===`INPUT`||t.nodeName===`TEXTAREA`))return;let n=wf(t);if(n===null)return;let r=of(t),i=null,a=r===null?void 0:oh.get(r);if(r!==null){if(a!==void 0){let e=a.editors,t=a.hasShadowEditor;if(t===void 0){t=!1;for(let n of e)if(n._rootElement!==null&&Tf(n._rootElement.getRootNode())){t=!0;break}a.hasShadowEditor=t}if(t){let t=null;for(let r of e){let e=r._rootElement;if(e===null)continue;let a=Nf(n,e).anchorNode;if(a!==null&&pd(a)===r){if(Tf(e.getRootNode())){i=r;break}t===null&&(t=r)}}i===null&&t!==null&&(i=t)}else{let e=n.anchorNode;e===null||W(e)&&e.shadowRoot!==null||(i=pd(e))}}if(i===null){let e=Rf(r);i=e===null?null:pd(e)}}if(i===null)return;i._inputState.isSelectionChangeFromMouseDown&&eh(i,()=>qh(i,n,e,a));let o=Bd(i),s=o[o.length-1],c=s._key,l=Jh.get(c),u=l||s;u!==i&&uh(n,u,!1),uh(n,i,!0),i===s?l&&Jh.delete(c):Jh.set(c,i)}function Xh(e){e._lexicalHandled=!0}function Zh(e){return!0===e._lexicalHandled}var Qh=Ya(),$h=class{key;offset;type;_selection;constructor(e,t,n){this._selection=null,this.key=e,this.offset=t,this.type=n}is(e){return this.key===e.key&&this.offset===e.offset&&this.type===e.type}isBefore(e){return this.key===e.key?this.offset<e.offset:av(Lu(Du(this,`next`)),Lu(Du(e,`next`)))<0}getNode(){let e=B(this.key);return e===null&&M(20),e}set(e,t,n,r){let i=this._selection,a=this.key;r&&this.key===e&&this.offset===t&&this.type===n||(this.key=e,this.offset=t,this.type=n,Mm()||(Ed()===a&&Td(e),i!==null&&(i.setCachedNodes(null),q(i)&&(i._cachedIsBackward=null),i.dirty=!0)))}};function eg(e,t,n){return new $h(e,t,n)}function tg(e,t){let n=t.__key,r=e.offset,i=`element`;if(R(t)){i=`text`;let e=t.getTextContentSize();r>e&&(r=e)}else if(!I(t)){let e=t.getNextSibling();if(R(e))n=e.__key,r=0,i=`text`;else{let e=t.getParent();e&&(n=e.__key,r=t.getIndexWithinParent()+1)}}e.set(n,r,i)}function ng(e,t){if(I(t)){let n=t.getLastDescendant();I(n)||R(n)?tg(e,n):tg(e,t)}else tg(e,t)}function rg(e,t,n,r){let i=e.getNode(),a=i.getChildAtIndex(e.offset),o=Tu();if(o.setFormat(n),o.setStyle(r),Zu(a))a.splice(0,0,[o]);else if(a!==null){let e=U(i)?z().append(o):o;a.insertBefore(e)}else if(U(i)){let e=i.getLastChild();I(e)&&!e.isInline()&&e.isEmpty()?e.append(o):i.append(z().append(o))}else i.append(o);e.is(t)&&t.set(o.__key,0,`text`),e.set(o.__key,0,`text`)}function ig(e,t,n){let r=e.format,i=e.style;if(!e.isCollapsed()){let a=(e.focus.isBefore(e.anchor)?e.focus:e.anchor).getNode();if(R(a)&&(r=a.getFormat(),i=a.getStyle()),e.removeText(),e.format=r,e.style=i,t===``&&!n)return;if(Ed()===null)return e.anchor.type===`element`&&rg(e.anchor,e.focus,r,i),void ag(e,t,r,i)}e.anchor.type===`element`&&rg(e.anchor,e.focus,r,i);let a=e.anchor.getNode();R(a)||M(398);let o=e.anchor.offset,s=a.getParentOrThrow(),c=a.getTextContentSize();if(gd(a)||o===0&&(!a.canInsertTextBefore()||!s.canInsertTextBefore()&&!a.__prev)||o===c&&(!a.canInsertTextAfter()||!s.canInsertTextAfter()&&!a.__next)){if(a.isSegmented()&&o!==0&&o!==c){if(Ed()!==null)a.setMode(`normal`).setFormat(r).setStyle(i),K()._inputState.composedSegmentedKey=a.getKey();else{let t=Tu(a.getTextContent());t.setFormat(r),t.setStyle(i);let n=J()===e;a.replace(t),e.setTextNodeRange(t,o,t,o),n&&J()!==e&&Id(e)}(t!==``||n)&&ig(e,t,n);return}if(t===``&&!n)return;if(o===0||o===c){let c=o===0,l=c?`previous`:`next`,u=Y(a,l).getNodeAtCaret(),d;R(u)&&(c?u.canInsertTextAfter():u.canInsertTextBefore())&&!gd(u)?d=u:(d=Tu().setFormat(r).setStyle(i),Y((c?s.canInsertTextBefore():s.canInsertTextAfter())?a:s,l).insert(d));let f=c?void 0:0;d.select(f,f),ig(e,t,n);return}let l=Tu(t);l.setFormat(r),l.setStyle(i),a.replace(l),l.select();return}if(t===``&&!n)return;let l=s.isInline()&&o===0&&!a.__prev,u=s.isInline()&&o===c&&!a.__next,d=a.getFormat()!==r||a.getStyle()!==i;if(l||u||d){if(a.getTextContent()!==``||l||u)return void ag(e,t,r,i);a.setFormat(r),a.setStyle(i)}a.spliceText(o,0,t,!0),a.isComposing()&&e.anchor.type===`text`&&e.anchor.set(e.anchor.key,e.anchor.offset-t.length,e.anchor.type)}function ag(e,t,n,r){let i=e.anchor.getNode();R(i)||M(398);let a=e.anchor.offset,o=Tu(t).setFormat(n).setStyle(r),s=i.getParentOrThrow(),c=a===0,l=c||a===i.getTextContentSize();if(l&&s.isInline()&&!(c?i.__prev:i.__next))Y(s,c?`previous`:`next`).insert(o);else{let e=l?i:i.splitText(a)[0];c?e.insertBefore(o,!1):e.insertAfter(o,!1)}i.getTextContent()===``&&i.isAttached()&&i.remove(),o.selectEnd(),o.isComposing()&&e.anchor.type===`text`&&e.anchor.set(e.anchor.key,e.anchor.offset-t.length,e.anchor.type)}var og=class e{_nodes;_cachedNodes;dirty;constructor(e){this._cachedNodes=null,this._nodes=e,this.dirty=!1}getCachedNodes(){return this._cachedNodes}setCachedNodes(e){this._cachedNodes=e}is(e){if(!lg(e))return!1;let t=this._nodes,n=e._nodes;return t.size===n.size&&Array.from(t).every(e=>n.has(e))}isCollapsed(){return!1}isBackward(){return!1}getStartEndPoints(){return null}add(e){this.dirty=!0,this._nodes.add(e),this._cachedNodes=null}delete(e){this.dirty=!0,this._nodes.delete(e),this._cachedNodes=null}clear(){this.dirty=!0,this._nodes.clear(),this._cachedNodes=null}has(e){return this._nodes.has(e)}clone(){return new e(new Set(this._nodes))}extract(){return this.getNodes()}insertRawText(e){}insertText(){}insertNodes(e){let t=this.getNodes().filter(e=>p_(e)===null),n=t.length;if(n===0)return;let r=t[n-1],i;if(R(r))i=r.select();else{let e=r.getIndexWithinParent()+1;i=r.getParentOrThrow().select(e,e)}i.insertNodes(e);for(let e=0;e<n;e++)t[e].remove()}getNodes(){let e=this._cachedNodes;if(e!==null)return e;let t=this._nodes,n=[];for(let e of t){let t=B(e);t!==null&&n.push(t)}return Mm()||(this._cachedNodes=n),n}getTextContent(){let e=this.getNodes(),t=``;for(let n=0;n<e.length;n++)t+=e[n].getTextContent();return t}deleteNodes(){let e=this.getNodes().filter(e=>p_(e)===null);if((J()||zg())===this&&e[0]){let t=Y(e[0],`next`);ku(rv(t,t))}for(let t of e)t.remove();sg()}};function sg(){let e=V();if(e.getChildrenSize()===0&&__(J())===null){let t=z();e.append(t),t.select()}}function q(e){return e instanceof cg}var cg=class e{format;style;anchor;focus;_cachedNodes;_cachedIsBackward;dirty;constructor(e,t,n,r){this.anchor=e,this.focus=t,e._selection=this,t._selection=this,this._cachedNodes=null,this._cachedIsBackward=null,this.format=n,this.style=r,this.dirty=!1}getCachedNodes(){return this._cachedNodes}setCachedNodes(e){this._cachedNodes=e}is(e){return!!q(e)&&this.anchor.is(e.anchor)&&this.focus.is(e.focus)&&this.format===e.format&&this.style===e.style}isCollapsed(){return this.anchor.is(this.focus)}getNodes(){let e=this._cachedNodes;if(e!==null)return e;let t=function(e){let t=[],[n,r]=e.getTextSlices();n&&t.push(n.caret.origin);let i=new Set,a=0;for(let n of e)if(V_(n)){let{origin:e}=n;t.length===0?i.add(e):(a++,t.push(e))}else{let{origin:e}=n;I(e)&&a!==0?a--:t.push(e)}if(r&&t.push(r.caret.origin),B_(e.focus)&&I(e.focus.origin)&&e.focus.getNodeAtCaret()===null)for(let n=J_(e.focus.origin,`previous`);V_(n)&&i.has(n.origin)&&!n.origin.isEmpty()&&n.origin.is(t[t.length-1]);n=X_(n))i.delete(n.origin),t.pop();for(;t.length>1;){let e=t[t.length-1];if(!I(e)||a>0||e.isEmpty()||i.has(e))break;t.pop()}if(t.length===0&&e.isCollapsed()){let n=Lu(e.anchor),r=Lu(e.anchor.getFlipped()),i=e=>z_(e)?e.origin:e.getNodeAtCaret(),a=i(n)||i(r)||(e.anchor.getNodeAtCaret()?n.origin:r.origin);t.push(a)}return t}(zu(ju(this),`next`));return Mm()||(this._cachedNodes=t),t}setTextNodeRange(e,t,n,r){return this.anchor.set(e.__key,t,`text`),this.focus.set(n.__key,r,`text`),this}getTextContent(){if(this.isCollapsed())return``;let e=this.getNodes(),t=ju(this).getTextSlices(),n=``,r=!0;for(let i=0;i<e.length;i++){let a=e[i];if(I(a)&&!a.isInline()){r||(n+=`
9
+ `);let e=``;for(let t of y_(a)){let n=b_(a,t);n!==null&&(e+=n.getTextContent())}e===``?r=!a.isEmpty():(n+=e,r=!1)}else if(r=!1,R(a)){let e=Uu(t,a);n+=e?e.getTextContent():a.getTextContent()}else(L(a)||lm(a))&&(n+=a.getTextContent())}return n}applyDOMRange(e){let t=K(),n=t.getEditorState()._selection,r=Ag(e.startContainer,e.startOffset,e.endContainer,e.endOffset,t,n);if(r===null)return;let[i,a,o]=r;this.anchor.set(i.key,i.offset,i.type,!0),this.focus.set(a.key,a.offset,a.type,!0),o&&(this.dirty=!0),Al(this)}clone(){let t=this.anchor,n=this.focus;return new e(eg(t.key,t.offset,t.type),eg(n.key,n.offset,n.type),this.format,this.style)}toggleFormat(e){this.format=bd(this.format,e,null),this.dirty=!0}setFormat(e){this.format=e,this.dirty=!0}setStyle(e){this.style=e,this.dirty=!0}hasFormat(e){let t=Ba[e];return(this.format&t)!==0}insertRawText(e){this.insertNodes(Yg(e))}insertText(e){ig(this,e,!1)}removeText(){let e=J()===this,t=this.anchor.key;Au(this,Fu(ju(this))),this.isCollapsed()&&Rg(this,t),e&&J()!==this&&Id(this)}formatText(e,t=null){pg(this,e,t)}insertNodes(e){if(e.length===0)return;this.isCollapsed()||this.removeText();let t=this.anchor.getNode();if(this.anchor.type===`element`&&I(t)&&t.isShadowRoot()&&p_(t)!==null){let n=t.getFirstChild()??t.append(z()).getFirstChild();if(n!==null&&!I(n)){let e=z();n.insertBefore(e),n=e}if(n!==null){n.selectStart();let t=J();return q(t)||M(369),t.insertNodes(e)}}if(this.anchor.type===`element`&&U(t)){let n=e_(e),r=n.getLastDescendant();t.splice(this.anchor.offset,0,n.getChildren()),r!==null&&r.selectEnd();return}let n=this.isBackward()?this.focus:this.anchor,r=n.getNode(),i=G(r,qf),a=e[e.length-1];if(I(i)&&`__language`in i){if(`__language`in e[0])this.insertText(e[0].getTextContent());else{let[,t]=Zg(this);i.splice(t,0,e),a.selectEnd()}return}if(!e.some(e=>(I(e)||L(e))&&!e.isInline())){I(i)||M(211,r.constructor.name,r.getType());let[t,n]=Zg(this,!0);(I(t)?t:i).splice(n,0,e),a.selectEnd();return}if(i===null){let t=e_(e),n=t.getLastDescendant(),r=Du(this.anchor,`next`);for(let e of t.getChildren())r=qu(e,r);n!==null&&n.selectEnd();return}if(I(i)&&(p_(i)!==null||!i.isParentRequired()&&!U(i.getParentOrThrow()))){let[,t]=Zg(this),n=Xg(e);i.splice(t,0,n);let r=n[n.length-1];r===void 0?i.select(t,t):r.selectEnd();return}let o=e_(e),s=o.getLastDescendant(),c=o.getChildren(),l=function(e){let t=function(e){let t=e.getNode();if(e.offset>0)return e.type===`element`&&I(t)?t.getChildAtIndex(e.offset-1):null;for(let e=t;e!==null&&!qf(e)&&!U(e);e=e.getParent()){let t=e.getPreviousSibling();if(t!==null)return t}return null}(e);return lm(t)&&lm(t.getPreviousSibling())}(n),u=I(i)&&i.isEmpty()?null:this.insertParagraph();u&&!i.isAttached()&&(r=this.anchor.getNode(),i=G(r,qf));let d=c[c.length-1],f=c[0];var p=f;l||!I(p)||!qf(p)||p.isEmpty()||!I(i)||i.isEmpty()&&!i.canMergeWhenEmpty()||(I(i)||M(211,r.constructor.name,r.getType()),i.append(...f.getChildren()),f=c[1]),f&&(i===null&&M(212,r.constructor.name,r.getType()),function(e,t){let n=t.getParentOrThrow().getLastChild(),r=t,i=[t];for(;r!==n;)r.getNextSibling()||M(140),r=r.getNextSibling(),i.push(r);let a=e;for(let e of i)a=a.insertAfter(e)}(i,f));let m=G(s,qf),h=s.selectEnd();u&&(I(m)&&(u.canMergeWhenEmpty()||qf(d))?(m.append(...u.getChildren()),u.remove()):u.isEmpty()&&u.remove()),I(i)&&i.isEmpty()&&i.remove();let g=I(i)?i.getLastChild():null;lm(g)&&m!==i&&g.remove();let _=Lu(Du(h.anchor,`next`));Ou(h.anchor,_),Ou(h.focus,_)}insertParagraph(){this.isCollapsed()||this.removeText();let e=this.anchor.getNode();if(this.anchor.type===`element`&&U(e)){let t=z();return e.splice(this.anchor.offset,0,[t]),t.select(),t}let[,t]=Zg(this),n=G(this.anchor.getNode(),qf);if(n!==null&&p_(n)!==null)return null;I(n)||M(213);let r=n.getChildAtIndex(t),i=r?[r,...r.getNextSiblings()]:[],a=n.insertNewAfter(this,!1);return a?(a.append(...i),a.selectStart(),a):null}insertLineBreak(e){let t=cm();if(this.insertNodes([t]),e){let e=t.getParentOrThrow(),n=t.getIndexWithinParent();e.select(n,n)}}extract(){let e=this.getNodes();if(this.isCollapsed())return[...e];let t=this.isBackward(),n=ju(this).getTextSlices(),r=[];for(let t of e){let e=Uu(n,t),i=e?Wu(e,this):t;i!==null&&r.push(i)}if(e.length===1&&r.length===1&&R(r[0])){let e=r[0],[n,i]=t?[this.focus,this.anchor]:[this.anchor,this.focus];n.set(e.getKey(),0,`text`),i.set(e.getKey(),e.getTextContentSize(),`text`)}return r}modify(e,t,n){if(t_(this,e,t,n))return;let r=e===`move`,i=K(),a=Cf(pf(i));if(!a)return;let o=i._blockCursorElement,s=i._rootElement,c=this.focus.getNode();s===null||o===null||!I(c)||c.isInline()||c.canBeEmpty()||Sf(o,i,s);let l=rf(i,this.focus.key),u=l;if(this.focus.type===`text`&&(u=R(c)?Qf(c,l,i):null),this.dirty){let e=rf(i,this.anchor.key),t=e;if(this.anchor.type===`text`){let n=this.anchor.getNode();t=R(n)?Qf(n,e,i):null}t&&u&&Wg(a,t,this.anchor.offset,u,this.focus.offset)}if(n===`character`&&R(c)&&c.isUnmergeable()&&(t?this.focus.offset===0:this.focus.offset===c.getTextContentSize())){let e=Y(c,t?`previous`:`next`).getNodeAtCaret();if(R(e)){if(!r){let n=e.getTextContentSize();t?this.focus.set(e.__key,n-1,`text`):this.focus.set(e.__key,1,`text`),this.dirty=!0;return}{let n=i.getElementByKey(e.getKey()),r=n?Qf(e,n,i):null;if(r){let e=t?r.length:0;Wg(a,r,e,r,e)}}}}if(gg(a,e,t?`backward`:`forward`,n,s),a.rangeCount>0){let e=jf(a,i._rootElement),n=e||a.getRangeAt(0),o=this.anchor.getNode(),s=iu(o)?o:hf(o);this.applyDOMRange(n),this.dirty=!0,r||(_g(this,t,s),(e?a.direction!==`backward`:a.anchorNode===n.startContainer&&a.anchorOffset===n.startOffset)||hg(this))}n===`lineboundary`&&t_(this,e,t,n,`decorators`)}forwardDeletion(e,t,n){if(!n&&(e.type===`element`&&I(t)&&e.offset===t.getChildrenSize()||e.type===`text`&&e.offset===t.getTextContentSize())){let e=t.getParent(),n=t.getNextSibling()||(e===null?null:e.getNextSibling());if(I(n)&&n.isShadowRoot())return!0}return!1}deleteCharacter(e){let t=this.isCollapsed();if(this.isCollapsed()){let t=this.anchor,n=t.getNode();if(this.forwardDeletion(t,n,e)){let e=I(n)?n.getNextSibling():null;if(!(I(n)&&n.isEmpty()&&I(e)&&e.isShadowRoot()))return}let r=Du(t,e?`previous`:`next`),i=tv(r);if(i.getTextSlices().every(e=>e===null||e.distance===0)){if(t.type===`element`){let e=r.getNodeAtCaret();if(I(e)&&xf(e)){let t=e.getParent();e.remove();let n=Fd(t,e);n!==null&&n.selectStart();return}}let e={type:`initial`};for(let t of i.iterNodeCarets(`shadowRoot`))if(V_(t)){if(!t.origin.isInline()){if(t.origin.isShadowRoot()){if(e.type===`merge-block`)break;if(I(i.anchor.origin)&&i.anchor.origin.isEmpty()){let e=Lu(t);Au(this,rv(e,e)),i.anchor.origin.remove()}return}e.type!==`merge-next-block`&&e.type!==`merge-block`||(e={block:e.block,caret:t,type:`merge-block`})}}else{if(e.type===`merge-block`)break;if(B_(t)){if(I(t.origin)){if(t.origin.isInline()){if(!t.origin.isParentOf(i.anchor.origin))break}else e={block:t.origin,type:`merge-next-block`};continue}if(L(t.origin)){if(!t.origin.isIsolated()){if(e.type===`merge-next-block`&&(t.origin.isKeyboardSelectable()||!t.origin.isInline())&&I(i.anchor.origin)&&i.anchor.origin.isEmpty()){i.anchor.origin.remove();let e=Pg();e.add(t.origin.getKey()),Id(e)}else{let e=t.origin,n=e.getParent();e.remove();let r=Fd(n,e);r!==null&&r.selectStart()}}return}if(lm(t.origin))return void t.origin.remove();break}}if(e.type===`merge-block`){let{caret:t,block:n}=e;return y_(n).length>0?void 0:t.origin.isEmpty()&&!n.isEmpty()&&t.origin.getParent()===n.getParent()?void t.origin.remove(!0):(Au(this,rv(!t.origin.isEmpty()&&n.isEmpty()?Mu(Y(n,t.direction)):i.anchor,t)),this.removeText())}for(let e=t.getNode();e!==null;){if(p_(e)!==null)return;if(I(e)&&e.isShadowRoot())break;e=e.getParent()}}let a=this.focus;if(vg(this,e,`character`),this.isCollapsed()){if(e&&t.offset===0&&function(e,t){for(let n=t;n;n=n.getParent()){if(I(n)){if(n.collapseAtStart(e))return!0;if(U(n))break}if(n.getPreviousSibling())break}return!1}(this,t.getNode()))return}else{let r=a.type===`text`?a.getNode():null;if(n=t.type===`text`?t.getNode():null,r!==null&&r.isSegmented()){let t=a.offset,i=r.getTextContentSize();if(r.is(n)||e&&t!==i||!e&&t!==0)return void Sg(r,e,t)}else if(n!==null&&n.isSegmented()){let i=t.offset,a=n.getTextContentSize();if(n.is(r)||e&&i!==0||!e&&i!==a)return void Sg(n,e,i)}(function(e,t){let n=e.anchor,r=e.focus,i=n.getNode();if(i===r.getNode()&&n.type===`text`&&r.type===`text`){let e=n.offset,o=r.offset,s=e<o,c=s?e:o,l=s?o:e,u=l-1;c!==u&&!zd(a=i.getTextContent().slice(c,l))&&!xg(a)&&(t?r.set(r.key,u,r.type):n.set(n.key,u,n.type))}var a})(this,e)}}t||mg(this),this.removeText(),e&&!t&&this.isCollapsed()&&this.anchor.type===`element`&&this.anchor.offset===0&&sg()}deleteLine(e){ug(this,e,`lineboundary`)}deleteWord(e){ug(this,e,`word`)}isBackward(){let e=this._cachedIsBackward;if(e!==null)return e;let t=this.focus.isBefore(this.anchor);return Mm()||(this._cachedIsBackward=t),t}getStartEndPoints(){return[this.anchor,this.focus]}};function lg(e){return e instanceof og}function ug(e,t,n){let r=e.isCollapsed(),{anchor:i,focus:a}=e,o=!1;if(r){if(n===`word`&&e.forwardDeletion(i,i.getNode(),t))return;o=vg(e,t,n),n===`lineboundary`&&function(e){for(let t of ju(e).iterNodeCarets(`shadowRoot`))if(B_(t)&&lm(t.origin))return void Ou(e.focus,Mu(t))}(e)}n!==`lineboundary`||e.isCollapsed()||G(i.getNode(),qf)===G(a.getNode(),qf)||a.set(i.key,i.offset,i.type),e.isCollapsed()?o||e.deleteCharacter(t):(r||mg(e),e.removeText())}function dg(e,t){if(lg(e)){for(let n of e.getNodes())hu(n)&&n.setFormat(t(n.getFormat()));return}let n=e.isCollapsed()?[]:e.getNodes(),r=n.length?ju(e).getTextSlices():[],i,a,o,s=!1,c=0;for(let l of n)if(R(l)){i&&a&&(i.set(a.__key,0,`text`),i=void 0);let n=Uu(r,l);if(!s&&n&&n.distance===0){let t=e.isBackward()?e.focus:e.anchor;t.type===`text`&&t.key===l.__key&&(i=t)}if(s=!0,n&&n.distance===0)continue;let u=t(l.getFormat()),d=i?l.getTextContentSize():0,f=n&&!gd(l)?Wu(n,e):l;f!==null&&(f.setFormat(u),o===void 0&&(o=u,a=f,i&&f.getTextContentSize()!==d&&(i.set(f.__key,0,`text`),i=void 0)),c=u)}else I(l)?l.setTextFormat(t(l.getTextFormat())):hu(l)&&l.setFormat(t(l.getFormat()));s?o!==void 0&&(e.format=o|c):(e.setFormat(t(e.format)),Td(null))}function fg(e,t){let n=[];for(let[e,r]of Object.entries(t))typeof r==`boolean`&&n.push([e,r]);n.length!==0&&dg(e,e=>{for(let[t,r]of n)e=bd(e,t,r?Ba[t]:0);return e})}function pg(e,t,n=null){let r=n===null&&q(e)?bd(e.format,t,null):n;dg(e,e=>bd(e,t,r))}function mg(e){let t=V();!t.isEmpty()&&Ju(t,e)&&(e.anchor.set(t.getKey(),0,`element`),e.focus.set(t.getKey(),t.getChildrenSize(),`element`))}function hg(e){let t=e.focus,n=e.anchor,r=n.key,i=n.offset,a=n.type;n.set(t.key,t.offset,t.type,!0),t.set(r,i,a,!0)}function gg(e,t,n,r,i){let a=r===`character`?Nf(e,i):null,o=a&&a.focusNode,s=a?a.focusOffset:0;if(e.modify(t,n,r),a===null||!function(e,t,n){return e!==null&&e.nodeType===3&&(n===`backward`?t>0:n===`forward`&&t<e.length)}(o,s,n))return;let c=Nf(e,i);c.focusNode===o&&c.focusOffset===s&&e.modify(t,n,r)}function _g(e,t,n){let r=e.getNodes(),i=r.filter(e=>df(e,n));if(i.length===0||i.length===r.length)return!1;let a=t?i[0]:i[i.length-1],o=I(a)?a:a.getParentOrThrow();return t?o.selectStart():o.selectEnd(),!0}function vg(e,t,n){if(t_(e,`extend`,t,n))return!1;let r=K(),i=Cf(pf(r));if(!i||typeof i.modify!=`function`)return!1;let a=r._blockCursorElement,o=r._rootElement,s=e.anchor,c=e.focus.getNode();o===null||a===null||!I(c)||c.isInline()||c.canBeEmpty()||Sf(a,r,o);let l=e=>{let t=e.getNode(),n=r.getElementByKey(e.key);return n!==null&&e.type===`text`&&R(t)?Qf(t,n,r):n},u=s.getNode(),d=l(s);if(d===null)return!1;let f=s.offset,p=e.isCollapsed(),m=e.focus,h=p?d:l(m);if(h===null)return!1;let g=m.offset;if(Wg(i,h,g,h,g),gg(i,`move`,t?`backward`:`forward`,n,o),i.rangeCount===0)return!1;let _=jf(i,o)||i.getRangeAt(0),v=_.startContainer,y=_.startOffset;if(n===`lineboundary`&&_d(v)&&pd(v)===r){let e=Rd(v);if(L(e)&&e.isInline()&&!e.isIsolated()){let n=r.getElementByKey(e.getKey());n!==null&&n.contains(v)&&(v=n,y=t?0:n.childNodes.length)}}if(p&&n===`character`&&s.type===`text`&&R(u)&&u.isUnmergeable()&&f===(t?0:u.getTextContentSize())){let n=Y(u,t?`previous`:`next`).getNodeAtCaret();if(R(n)){let r=t?n.getTextContentSize()-1:1;return e.focus.set(n.__key,r,`text`),e.dirty=!0,!1}}if(p&&n===`character`&&s.type===`text`){let n=t?0:u.getTextContentSize(),r=v===d?y:f===n?-1:n;if(r>=0)return r!==f&&(e.focus.set(s.key,r,`text`),e.dirty=!0),!1}let b=r._slotsUsed&&jd(v),x=b?g_(u):null,S=b?g_(b):null;if(b&&!Dg(S,x)&&yg(e.focus,u,x,S,`deletion`,()=>!t))return!0;let[C,w,T,E]=t?[v,y,d,f]:[d,f,v,y],D=iu(u)?u:hf(u);return e.applyDOMRange({collapsed:!1,endContainer:T,endOffset:E,startContainer:C,startOffset:w}),e.dirty=!0,!_g(e,t,D)&&t&&hg(e),!1}function yg(e,t,n,r,i,a){let o=r&&function(e,t){for(let n=m_(e);n!==null;){let e=g_(n);if(Dg(e,t))return e!==null||n.isAttached()?n:null;n=e&&m_(e)}return null}(r,n);if(o===null&&n===null)return!1;let s=a(),c=o&&o.getParent(),l,u;if(o===null||c===null||t!==null&&(o.is(t)||o.isParentOf(t))){let t=o||n;if(!I(t))return t!==null&&function(e,t,n){I(t)?e.set(t.getKey(),n?t.getChildrenSize():0,`element`):e.set(t.getKey(),n?t.getTextContentSize():0,`text`)}(e,t,s),!0;l=t,u=s?t.getChildrenSize():0}else l=c,u=o.getIndexWithinParent()+ +(s===(i===`selection`));return i===`deletion`?function(e,t,n,r){for(;;){let i=t.getChildAtIndex(r?n:n-1);if(R(i))return void e.set(i.getKey(),r?0:i.getTextContentSize(),`text`);if(!I(i)||U(i))break;t=i,n=r?0:i.getChildrenSize()}e.set(t.getKey(),n,`element`)}(e,l,u,!s):e.set(l.getKey(),u,`element`),!0}function bg(){try{let e=RegExp(`\\p{Emoji}`,`u`),t=e.test.bind(e);if(t(`❤️`)&&t(`#️⃣`)&&t(`👍`))return t}catch{}return()=>!1}var xg=bg();function Sg(e,t,n){let r=e,i=r.getTextContent().split(/(?=\s)/g),a=i.length,o=0,s=0;for(let e=0;e<a;e++){let r=e===a-1;if(s=o,o+=i[e].length,t&&o===n||o>n||r){i.splice(e,1),r&&(s=void 0);break}}let c=i.join(``).trim();c===``?r.remove():(r.setTextContent(c),r.select(s,s))}function Cg(e,t,n,r){let i,a=t,o=!1;if(W(e)){let s=!1,c=e.childNodes,l=c.length,u=r._blockCursorElement;a===l&&l>0&&(s=!0,a=l-1),Ad(e,r)!==void 0||up(e,r)||(o=!0);let d=c[a],f=!1;if(d===u)d=c[a+1],f=!0;else if(u!==null){let n=u.parentNode;e===n&&t>Array.prototype.indexOf.call(n.children,u)&&a--}if(i=Rd(d),R(i))a=K_(i,s?`next`:`previous`);else{let c=Rd(e);if(c===null)return null;if(I(c)){let o=r.getElementByKey(c.getKey());o===null&&M(214);let l=Xf(c,o,r);[c,a]=l.resolveChildIndex(c,o,e,t),I(c)||M(215),s&&a>=c.getChildrenSize()&&(a=Math.max(0,c.getChildrenSize()-1));let u=c.getChildAtIndex(a);if(I(u)&&function(e,t,n){let r=e.getParent();return n===null||r===null||!r.canBeEmpty()||r!==n.getNode()}(u,0,n)){let e=s?u.getLastDescendant():u.getFirstDescendant();e===null?c=u:(u=e,c=I(u)?u:u.getParentOrThrow()),a=0}R(u)?(i=u,c=null,a=K_(u,s?`next`:`previous`)):u!==c&&s&&!f&&(I(c)||M(216),a=Math.min(c.getChildrenSize(),a+1))}else{let n=m_(c),i=n===null?c:n,o=i.getIndexWithinParent(),s=r.getElementByKey(c.getKey()),l=`after`;if(s!==null&&Rd(e)===c){let n=Xf(c,s,r);n.element===s?t===0&&L(c)&&(l=`before`):l=n.resolveLeafPosition(s,e,t)}a=l===`before`?o:o+1,c=i.getParentOrThrow()}if(I(c))return[eg(c.__key,a,`element`),o]}}else i=Rd(e);return R(i)?[eg(i.__key,K_(i,a,`clamp`),`text`),o]:null}function wg(e,t,n){let r=e.getNode();if(Dd(r))return;let i=e.offset===0;if(!i&&e.offset!==r.getTextContent().length)return;let a=i?`previous`:`next`,o=Y(r,a).getNodeAtCaret();if(i===t||!I(o)||!o.isInline()||i&&n){if(i&&!t)R(o)&&!r.isUnmergeable()&&e.set(o.__key,o.getTextContent().length,`text`);else if(o===null&&(n||!i&&t)){let t=r.getParent();if(I(t)&&t.isInline()&&(i||!t.canInsertTextAfter()&&t.getTextContentSize()>1)){let n=Y(t,a).getNodeAtCaret();R(n)&&e.set(n.__key,i?n.getTextContent().length:0,`text`)}}}else e.set(o.__key,i?o.getChildrenSize():0,`element`)}function Tg(e){let t=B(e.key);return t===null?null:g_(t)}function Eg(e,t,n){let r=Tg(e),i=Tg(t);return!Dg(r,i)&&yg(t,B(e.key),r,i,`selection`,n)}function Dg(e,t){return e===null?t===null:e.is(t)}function Og(e){let t=Eg(e.anchor,e.focus,()=>function(e,t){let n=function(e,t){let n=new Map;for(let t=null,r=e;r!==null;t=r,r=ov(r))n.set(r.getKey(),t);for(let e=null,r=t;r!==null;e=r,r=ov(r)){let t=n.get(r.getKey());if(t===void 0)continue;let i=r.getLatest();return t===null?e===null?{commonAncestor:i,type:`same`}:{b:e,commonAncestor:i,type:`ancestor`}:e===null?{a:t,commonAncestor:i,type:`descendant`}:{a:t,b:e,commonAncestor:i,type:`branch`}}return null}(e.origin,t.origin);if(n===null)return null;switch(n.type){case`same`:return sv(e,t);case`ancestor`:return e.type===`child`&&p_(n.b)===null?-1:1;case`descendant`:return t.type===`child`&&p_(n.a)===null?1:-1;case`branch`:{let e=p_(n.a)&&n.a.getKey(),t=p_(n.b)&&n.b.getKey();if(e&&t){for(let r of v_(n.commonAncestor).values())if(r===e||r===t)return r===e?-1:1}return e?-1:t?1:n.a.isBefore(n.b)?-1:1}}}(Du(e.anchor,`next`),Du(e.focus,`next`))!==1);return t&&(e.dirty=!0),t}function kg(e,t){let n=t;for(;n!==null&&n.parentNode!==e;)n=n.parentNode;let r=0;for(let e=n&&n.previousSibling;e;e=e.previousSibling)r++;return r}function Ag(e,t,n,r,i,a){if(e===null||n===null||!dd(i,e,n))return null;let o=Cg(e,t,q(a)?a.anchor:null,i);if(o===null)return null;let s=Cg(n,r,q(a)?a.focus:null,i);if(s===null)return null;let[c,l]=o,[u,d]=s;if(c.type===`element`&&u.type===`element`){let t=Rd(e),r=Rd(n);if(L(t)&&L(r))return null}let f=i._slotsUsed&&Eg(c,u,()=>function(e,t,n,r){if(e===n)return r>=t;let i=e.compareDocumentPosition(n);return i&Node.DOCUMENT_POSITION_CONTAINED_BY?kg(e,n)>=t:i&Node.DOCUMENT_POSITION_CONTAINS?r>kg(n,e):(i&Node.DOCUMENT_POSITION_FOLLOWING)!==0}(e,t,n,r));return function(e,t){if(e.type===`text`&&t.type===`text`){let n=e.isBefore(t),r=e.is(t);wg(e,n,r),wg(t,!n,r),r&&t.set(e.key,e.offset,e.type)}}(c,u),[c,u,l||d||f]}function jg(e){return I(e)&&!e.isInline()}function Mg(e,t,n,r,i,a){let o=Fm(),s=new cg(eg(e,t,i),eg(n,r,a),0,``);return s.dirty=!0,o._selection=s,s}function Ng(){return new cg(eg(`root`,0,`element`),eg(`root`,0,`element`),0,``)}function Pg(){return new og(new Set)}function Fg(e,t){return Lg(null,e,t,null)}var Ig=new Set([` `,`ArrowDown`,`ArrowLeft`,`ArrowRight`,`ArrowUp`,`Backspace`,`Delete`,`End`,`Enter`,`Home`,`Tab`]);function Lg(e,t,n,r){let i=n._window;if(i===null)return null;let a=r||i.event,o=a?a.type:void 0,s=o===`selectionchange`,c=o===`keydown`&&a,l=c&&zf(c),u=c&&(c.ctrlKey||c.metaKey||Ig.has(c.key))&&Vf(l)&&pd(l)===n,d=!bs&&(s||u||o===`beforeinput`||o===`compositionstart`||o===`compositionend`||o===`click`&&a&&a.detail===3||o===`drop`||o===void 0),f,p,m,h;if(q(e)&&!d)return e.clone();{if(t===null)return null;let r=Nf(t,n._rootElement);if(f=r.anchorNode,p=r.focusNode,m=r.anchorOffset,h=r.focusOffset,(s||u||o===void 0)&&q(e)&&!dd(n,f,p))return e.clone()}let g=Ag(f,m,p,h,n,e);if(g===null)return null;let[_,v,y]=g,b=q(e)?e:null,x=new cg(_,v,b?b.format:0,b?b.style:``);return b&&Rg(x,b.anchor.key),x.dirty=y,x}function Rg(e,t){let n=e.anchor;if(n.key===t)return;let r=n.getNode(),i=0,a=``;R(r)?(i=r.getFormat(),a=r.getStyle()):I(r)&&(i=r.getTextFormat(),a=r.getTextStyle()),e.format===i&&e.style===a||(e.format=i,e.style=a,e.dirty=!0)}function J(){return Fm()._selection}function zg(){return K()._editorState._selection}function Bg(e,t){let n=t.__key;return e.anchor.key===n||e.focus.key===n}function Vg(e,t,n,r=1){if(Bg(e,t))for(let i of[e.anchor,e.focus]){i.key===t.__key&&(n<=i.offset&&r>0||n<i.offset&&r<0)&&i.set(t.__key,Math.max(0,i.offset+r),`element`);let e=i.getNode();if(I(e)){let t=e.getChildrenSize(),n=i.offset>=t,r=e.getChildAtIndex(n?t-1:i.offset);R(r)&&i.set(r.__key,n?r.getTextContentSize():0,`text`)}}}function Hg(e,t,n,r,i){let a=r||i;if(R(a)||I(a)){let t=R(a);e.set(a.__key,r===null?0:t?a.getTextContentSize():a.getChildrenSize(),t?`text`:`element`)}else{let r=t.getIndexWithinParent();e.set(n.__key,r===-1?n.getChildrenSize():r,`element`)}}function Ug(e,t,n,r,i){e.type===`text`?e.set(n,e.offset+(t?0:i),`text`):e.offset>r.getIndexWithinParent()&&e.set(e.key,e.offset-1,`element`)}function Wg(e,t,n,r,i){try{e.setBaseAndExtent(t,n,r,i)}catch{}}function Gg(e,t,n){let r=rf(e,t.getKey());if(I(t)){let i=Xf(t,r,e);return[i.element,n+i.getFirstChildOffset()]}return[r,n]}function Kg(e,t,n,r,i,a){let o=a.getRootNode(),s=vd(o)||Tf(o)?Rf(o):null;if(i.has(`collaboration`)&&s!==a||s!==null&&ld(s,s))return;let c=Nf(r,a),l;if(!q(t))return void(e!==null&&dd(n,c.anchorNode,c.focusNode)&&r.removeAllRanges());let u=t.anchor,d=t.focus,f=u.getNode(),p=d.getNode(),[m,h]=Gg(n,f,u.offset),[g,_]=Gg(n,p,d.offset),v=t.format,y=t.style,b=t.isCollapsed(),x=m,S=g,C=!1;if(u.type===`text`?(x=R(f)?Qf(f,m,n):null,C=f.getFormat()!==v||f.getStyle()!==y):q(e)&&e.anchor.type===`text`&&(C=!0),d.type===`text`&&(S=R(p)?Qf(p,g,n):null),x===null||S===null)return;let w=b&&R(p)&&Dd(p)&&_d(S)&&S.nodeValue===La?La.length:_;if(b&&(e===null||C||q(e)&&(e.format!==v||e.style!==y))&&function(e,t,n,r,i,a){e._inputState.collapsedSelectionFormat={format:t,key:i,offset:r,style:n,timeStamp:a}}(n,v,y,u.offset,u.key,performance.now()),(r.type!==`Range`||!b)&&c.anchorOffset===h&&c.focusOffset===w&&c.anchorNode===x&&c.focusNode===S){if(s===null||!a.contains(s)){let e=s===null?null:pd(s);e!==null&&e!==n||i.has(`skip-selection-focus`)||a.focus({preventScroll:!0})}if(u.type!==`element`)return}if(Wg(r,x,h,S,w),Ta&&t.isCollapsed()&&a!==null&&!i.has(`skip-selection-focus`)){let e=Lf(a);if(e===null||!a.contains(e)){let e=Rf(a.ownerDocument),t=e===null?null:pd(e);t!==null&&t!==n||a.focus({preventScroll:!0})}}if(!i.has(`skip-scroll-into-view`)&&t.isCollapsed()&&a!==null&&a===Lf(a)){let e=q(t)&&t.anchor.type===`element`?function(e,t,n){let r=t.childNodes[n];if(!W(r))return r||null;let i=Ad(r,e),a=i===void 0?null:B(i);return a===null||I(a)?r:Xf(a,r,e).element}(n,x,h):(l===void 0&&(l=Mf(r,a)),l);if(e!==null){let t;if(_d(e)){let n=e.ownerDocument.createRange();n.selectNode(e),t=n.getBoundingClientRect()}else t=W(e)?e.getBoundingClientRect():function(e){let t=e.getBoundingClientRect(),{startContainer:n,startOffset:r}=e;if(!e.collapsed||t.width!==0||t.height!==0||!_d(n)||n.length===0)return t;let i=e.cloneRange();return r>0?i.setStart(n,r-1):i.setEnd(n,1),i.getBoundingClientRect()}(e);(function(e,t,n,r=null){let i=of(n),a=ff(i);if(i===null||a===null)return;let o=n.getBoundingClientRect();if(t.bottom<o.top)return;if(r!==null&&t.height>0){let{left:e,right:i}=t,o=W(r)?r:af(r);for(;o!==null&&n.contains(o);){let t=cf(a,o,e,i);e-=t,i-=t,o=o===n?null:af(o)}}let{top:s,bottom:c}=t,l=0,u=0,d=n;for(;d!==null;){let t=d===i.body;if(t){let t=a.visualViewport;if(t){let e=t.offsetTop;l=e,u=e+t.height}else l=0,u=pf(e).innerHeight;let n=a.getComputedStyle(i.documentElement),r=parseFloat(n.scrollPaddingTop),o=parseFloat(n.scrollPaddingBottom);isFinite(r)&&(l+=r),isFinite(o)&&(u-=o)}else{let e=d===n?o:d.getBoundingClientRect();l=e.top,u=e.bottom}let r=0;if(s<l?r=-(l-s):c>u&&(r=c-u),r!==0){if(t)a.scrollBy(0,r);else{let e=d.scrollTop;d.scrollTop+=r;let t=d.scrollTop-e;s-=t,c-=t}}if(t)break;d=af(d)}})(n,t,a,x)}}(function(e,t,n,r,i){let a=e._inputState;a.isSelectionChangeFromDOMUpdate=!0,a.selectionChangeFromDOMUpdatePoints=t!==void 0&&n!==void 0&&r!==void 0&&i!==void 0?{anchorNode:t,anchorOffset:n,focusNode:r,focusOffset:i}:null})(n,x,h,S,w)}function qg(e){let t=J()||zg();t===null&&(t=V().selectEnd()),t.insertNodes(e)}function Jg(e,t){for(let n of e.split(/(\r?\n|\t)/))n===`
10
+ `||n===`\r
11
+ `?t.linebreak():n===` `?t.tab():n!==``&&t.text(n)}function Yg(e){let t=[];return Jg(e,{linebreak:()=>t.push(cm()),tab:()=>t.push(ed()),text:e=>t.push(Tu(e))}),t}function Xg(e){let t=[];for(let n of e)lm(n)||(!I(n)&&!L(n)||n.isInline()?t.push(n):I(n)&&t.push(...Xg(n.getChildren())));return t}function Zg(e,t=!1){let n=e;e.isCollapsed()||n.removeText();let r=J();q(r)&&(n=r),q(n)||M(161);let i=n.anchor,a=i.getNode(),o=i.offset;for(;!qf(a)&&p_(a)===null;){let e=a;if([a,o]=Qg(a,o,t),e.is(a))break}return[a,o]}function Qg(e,t,n=!1){let r=e.getParent();if(!r){let e=z();return V().append(e),e.select(),[V(),0]}if(R(e)){let n=e.splitText(t);if(n.length===0)return[r,e.getIndexWithinParent()];let i=t===0?0:1;return[r,n[0].getIndexWithinParent()+i]}if(!I(e)||t===0)return[r,e.getIndexWithinParent()];let i=e.getChildAtIndex(t);if(i){let r=new cg(eg(e.__key,t,`element`),eg(e.__key,t,`element`),0,``),a=e.insertNewAfter(r);if(a)a.append(i,...i.getNextSiblings());else if(n)return[e,t]}return[r,e.getIndexWithinParent()+1]}function $g(e){return lm(e)||mf(e)||R(e)||e.isParentRequired()}function e_(e){let t=z(),n=null;for(let r=0;r<e.length;r++){let i=e[r];if($g(i)){if(n===null){n=i.createParentElementNode(),t.append(n);let a=e[r+1];if(lm(i)&&(a===void 0||!$g(a)))continue}n.append(i)}else t.append(i),n=null}return t}function t_(e,t,n,r,i=`decorators-and-blocks`){if(t===`move`&&r===`character`&&!e.isCollapsed()){let[t,r]=n===e.isBackward()?[e.focus,e.anchor]:[e.anchor,e.focus];return r.set(t.key,t.offset,t.type),!0}let a=Du(e.focus,n?`previous`:`next`),o=r===`lineboundary`,s=t===`move`,c=a,l=i===`decorators-and-blocks`,u=!1;if(!Ru(c)){for(let e of c){l=!1;let{origin:t}=e;if(L(t)){if(t.isIsolated()){u=!0;break}if(c=e,o&&t.isInline())continue}break}if(u)return!0;if(l)for(let e of tv(a).iterNodeCarets(t===`extend`?`shadowRoot`:`root`)){if(V_(e))e.origin.isInline()||(c=e);else{if(I(e.origin))continue;L(e.origin)&&!e.origin.isInline()&&(c=e)}break}}if(c===a)return!1;if(s&&!o&&L(c.origin)&&c.origin.isKeyboardSelectable()){let e=Pg();return e.add(c.origin.getKey()),Id(e),!0}return c=Lu(c),s&&Ou(e.anchor,c),Ou(e.focus,c),l||!o}function n_(e,t,n){let r=t===null?null:t.__key,i=n===null?null:n.__key;t===null?e.__first=i:t.__next=i,n===null?e.__last=r:n.__prev=r}function r_(e){let t=K();if(!t._recordNodeMoves)return;let n=t._editorState._nodeMap;if(n.has(e.__key)){let t=Fm(),r=t._movedNodes||=new WeakMap,i=r.get(n);i===void 0&&(i=new Set,r.set(n,i)),i.add(e.__key)}}function i_(e,t,n,r){let i=t.__key;n===null?e.__first=i:n.__next=i,r===null?e.__last=i:r.__prev=i,t.__prev=n===null?null:n.__key,t.__next=r===null?null:r.__key,t.__parent=e.__key}function a_(e){p_(e)!==null&&M(380,e.__key,String(p_(e)));let t=e.getParent();if(t!==null){let n=t.getWritable();r_(e);let r=e.getPreviousSibling(),i=e.getNextSibling();n_(n,r&&r.getWritable(),i&&i.getWritable()),e.__prev=null,e.__next=null,e.__parent=null,n.__size--}}function o_(e,t){let n=t&&e.getParent(),r=t&&n&&Bg(t,n)?e.getIndexWithinParent():-1,i=t&&n&&r!==-1?[t.anchor,t.focus].filter(e=>e.type===`element`&&e.key===n.__key&&e.offset===r+1):null;return t&&n&&r!==-1&&t.isBackward(),a_(e),t&&n&&r!==-1&&Vg(t,n,r,-1),t&&(t._cachedIsBackward=null),i}function s_(e,t,n,r){Nm();let i=t===`next`;yf(e,n);let a=e.getWritable(),o=n.getWritable();e.getParentOrThrow();let s=J(),c=r&&q(s)?s:null,l=o_(o,c),u=e.getParentOrThrow().getWritable(),d=c&&(i&&l!==null&&l.length>0||Bg(c,u))?e.getIndexWithinParent()+ +!!i:-1,f=i?e.getNextSibling():e.getPreviousSibling(),p=f&&f.getWritable();if(i_(u,o,i?a:p,i?p:a),u.__size++,c&&d!==-1&&(Vg(c,u,d),i&&l!==null))for(let e of l)e.set(u.__key,d+1,`element`);return n}function c_(e,t,n){Nm();let{origin:r,direction:i}=e,a=i===`next`,o=m_(r);if(o!==null)return a?o.selectNext(t,n):o.selectPrevious(t,n);let s=e.getNodeAtCaret(),c=r.getParentOrThrow();if(s===null)return a?c.select():c.select(0,0);if(I(s))return a?s.select(0,0):s.select();if(R(s))return s.select(t,n);let l=s.getIndexWithinParent()+ +!a;return c.select(l,l)}function l_(e,t){let n=[];for(let r=e;r!==null;r=t===`next`?r.getNextSibling():r.getPreviousSibling())n.push(r);return n}var u_=new Map;function d_(e){return I(e)||L(e)}function f_(e){return I(e)||L(e)}function p_(e){let t=e.getLatest();return f_(t)?t.__slotHost:null}function m_(e){let t=p_(e);if(t===null)return null;let n=B(t);return I(n)||L(n)||M(370),n}function h_(e){let t=m_(e);if(t===null)return null;let n=e.getLatest().__key;for(let[e,r]of v_(t))if(r===n)return e;return null}function g_(e){let t=e.getLatest();for(;t!==null;){if(p_(t)!==null)return t;t=t.getParent()}return null}function __(e){if(e===null)return null;let t=q(e)?e.anchor.getNode():e.getNodes()[0]??null;return t===null?null:g_(t)}function v_(e){let t=e.getLatest();return d_(t)&&t.__slots!==null?t.__slots:u_}function y_(e){return Array.from(v_(e).keys())}function b_(e,t){let n=v_(e).get(t);return n===void 0?null:B(n)}var x_=[`__proto__`,`constructor`,`prototype`],S_=Symbol(`slotMapOwner`);function C_(e){let t=e.__slots;return t!==null&&t[S_]===e||(t=new Map(t),t[S_]=e,e.__slots=t),t}var w_=new WeakMap,T_=[];function E_(e){for(let{ownNodeConfig:t}of Bp(e)){let e=t&&t.slots;if(e)return e}return T_}function D_(e){let t=``;for(let n of v_(e).values()){let e=B(n);e!==null&&(t+=e.getTextContent())}return t}function O_(e,t,n){let r=n.get(e),i=n.get(t);return r===void 0?i===void 0?e<t?-1:+(e>t):1:i===void 0?-1:r-i}function k_(e,t,n){t!==`__proto__`&&t!==`constructor`&&t!==`prototype`||M(373,t);let r=e.getLatest();if(r.__slots!==null&&r.__slots.get(t)===n.getLatest().__key)return r;(!I(n)&&!L(n)||n.isInline())&&M(374,n.__key);let i=e.getWritable(),a=C_(i),o=a.get(t);o!==void 0&&A_(o);let s=n.getWritable(),c=m_(s);if(c!==null){let e=h_(s);e!==null&&C_(c.getWritable()).delete(e),s.__slotHost=null}return a_(s),s.__slotHost=i.__key,a.set(t,s.__key),function(e){let t=e.__slots;if(t===null||t.size<2)return;let n=function(e){let t=w_.get(e);if(t===void 0){let n=E_(e),r=new Map;for(let t of n)x_.includes(t)&&M(371,e.name,t),r.has(t)&&M(372,e.name,t),r.set(t,r.size);t=r,w_.set(e,t)}return t}(e.constructor),r=null,i=!0;for(let e of t.keys()){if(r!==null&&O_(r,e,n)>0){i=!1;break}r=e}if(i)return;let a=Array.from(t).sort(([e],[t])=>O_(e,t,n));t.clear();for(let[e,n]of a)t.set(e,n)}(i),K()._slotsUsed=!0,Fm()._slotsUsed=!0,i}function A_(e){let t=B(e);if(t===null)return;let n=t.getWritable();f_(n)||M(377,e),n.__slotHost=null,n.remove()}var j_={next:`previous`,previous:`next`},M_=class{origin;constructor(e){this.origin=e}[Symbol.iterator](){return iv({hasNext:B_,initial:this.getAdjacentCaret(),map:e=>e,step:e=>e.getAdjacentCaret()})}getAdjacentCaret(){return Y(this.getNodeAtCaret(),this.direction)}getSiblingCaret(){return Y(this.origin,this.direction)}remove(){let e=this.getNodeAtCaret();return e&&e.remove(),this}replaceOrInsert(e,t){let n=this.getNodeAtCaret();return e.is(this.origin)||e.is(n)||(n===null?this.insert(e):n.replace(e,t)),this}splice(e,t,n=`next`){let r=n===this.direction?t:Array.from(t).reverse(),i=this,a=this.getParentAtCaret(),o=new Map;for(let t=i.getAdjacentCaret();t!==null&&o.size<e;t=t.getAdjacentCaret()){let e=t.origin.getWritable();o.set(e.getKey(),e)}for(let e of r){if(o.size>0){let t=i.getNodeAtCaret();if(t){if(o.delete(t.getKey()),o.delete(e.getKey()),!(t.is(e)||i.origin.is(e))){let n=e.getParent();n&&n.is(a)&&e.remove(),t.replace(e)}}else t===null&&M(263,Array.from(o).join(` `))}else i.insert(e);i=Y(e,this.direction)}for(let e of o.values())e.remove();return this}},N_=class e extends M_{type=`child`;getLatest(){let e=this.origin.getLatest();return e===this.origin?this:J_(e,this.direction)}getParentCaret(e=`root`){return Y(I_(this.getParentAtCaret(),e),this.direction)}getFlipped(){let e=F_(this.direction);return Y(this.getNodeAtCaret(),e)||J_(this.origin,e)}getParentAtCaret(){return this.origin}getChildCaret(){return this}isSameNodeCaret(t){return t instanceof e&&this.direction===t.direction&&this.origin.is(t.origin)}isSamePointCaret(e){return this.isSameNodeCaret(e)}},P_={root:iu,shadowRoot:U};function F_(e){return j_[e]}function I_(e,t=`root`){return e===null||P_[t](e)?null:p_(e)===null?e:null}var L_=class e extends M_{type=`sibling`;getLatest(){let e=this.origin.getLatest();return e===this.origin?this:Y(e,this.direction)}getSiblingCaret(){return this}getParentAtCaret(){return this.origin.getParent()}getChildCaret(){return I(this.origin)?J_(this.origin,this.direction):null}getParentCaret(e=`root`){return Y(I_(this.getParentAtCaret(),e),this.direction)}getFlipped(){let e=F_(this.direction);return Y(this.getNodeAtCaret(),e)||J_(this.origin.getParentOrThrow(),e)}isSamePointCaret(t){return t instanceof e&&this.direction===t.direction&&this.origin.is(t.origin)}isSameNodeCaret(t){return(t instanceof e||t instanceof R_)&&this.direction===t.direction&&this.origin.is(t.origin)}},R_=class e extends M_{type=`text`;offset;constructor(e,t){super(e),this.offset=t}getLatest(){let e=this.origin.getLatest();return e===this.origin?this:G_(e,this.direction,this.offset)}getParentAtCaret(){return this.origin.getParent()}getChildCaret(){return null}getParentCaret(e=`root`){return Y(I_(this.getParentAtCaret(),e),this.direction)}getFlipped(){return G_(this.origin,F_(this.direction),this.offset)}isSamePointCaret(t){return t instanceof e&&this.direction===t.direction&&this.origin.is(t.origin)&&this.offset===t.offset}isSameNodeCaret(t){return(t instanceof L_||t instanceof e)&&this.direction===t.direction&&this.origin.is(t.origin)}getSiblingCaret(){return Y(this.origin,this.direction)}};function z_(e){return e instanceof R_}function B_(e){return e instanceof L_}function V_(e){return e instanceof N_}var H_={next:class extends R_{direction=`next`;getNodeAtCaret(){return this.origin.getNextSibling()}insert(e){return this.origin.insertAfter(e),this}},previous:class extends R_{direction=`previous`;getNodeAtCaret(){return this.origin.getPreviousSibling()}insert(e){return this.origin.insertBefore(e),this}}},U_={next:class extends L_{direction=`next`;getNodeAtCaret(){return this.origin.getNextSibling()}insert(e){return this.origin.insertAfter(e),this}},previous:class extends L_{direction=`previous`;getNodeAtCaret(){return this.origin.getPreviousSibling()}insert(e){return this.origin.insertBefore(e),this}}},W_={next:class extends N_{direction=`next`;getNodeAtCaret(){return this.origin.getFirstChild()}insert(e){return this.origin.splice(0,0,[e]),this}},previous:class extends N_{direction=`previous`;getNodeAtCaret(){return this.origin.getLastChild()}insert(e){return this.origin.splice(this.origin.getChildrenSize(),0,[e]),this}}};function Y(e,t){return e?new U_[t](e):null}function G_(e,t,n){return e?new H_[t](e,K_(e,n)):null}function K_(e,t,n=`error`){let r=e.getTextContentSize(),i=t===`next`?r:t===`previous`?0:t;return(i<0||i>r)&&(n!==`clamp`&&_a(284,String(t),String(r),e.getKey()),i=i<0?0:r),i}function q_(e,t){return new Q_(e,t)}function J_(e,t){return I(e)?new W_[t](e):null}function Y_(e){return e&&e.getChildCaret()||e}function X_(e){return e&&Y_(e.getAdjacentCaret())}var Z_=class e{type=`node-caret-range`;direction;anchor;focus;constructor(e,t,n){this.anchor=e,this.focus=t,this.direction=n}getLatest(){let t=this.anchor.getLatest(),n=this.focus.getLatest();return t===this.anchor&&n===this.focus?this:new e(t,n,this.direction)}isCollapsed(){return this.anchor.isSamePointCaret(this.focus)}getTextSlices(){let e=this.anchor.getLatest(),t=this.focus.getLatest();return z_(e)&&z_(t)&&e.isSameNodeCaret(t)?[q_(e,t.offset-e.offset),null]:[z_(e)?$_(e,`anchor`):null,z_(t)?$_(t,`focus`):null]}iterNodeCarets(e=`root`){let t=z_(this.anchor)?this.anchor.getSiblingCaret():this.anchor.getLatest(),n=this.focus.getLatest(),r=z_(n),i=t=>t.isSameNodeCaret(n)?null:X_(t)||t.getParentCaret(e);return iv({hasNext:e=>e!==null&&!(r&&n.isSameNodeCaret(e)),initial:t.isSameNodeCaret(n)?null:i(t),map:e=>e,step:i})}[Symbol.iterator](){return this.iterNodeCarets(`root`)}},Q_=class{type=`slice`;caret;distance;constructor(e,t){this.caret=e,this.distance=t}getSliceIndices(){let{distance:e,caret:{offset:t}}=this,n=t+e;return n<t?[n,t]:[t,n]}getTextContent(){let[e,t]=this.getSliceIndices();return this.caret.origin.getTextContent().slice(e,t)}getTextContentSize(){return Math.abs(this.distance)}removeTextSlice(){let{caret:{origin:e,direction:t}}=this,[n,r]=this.getSliceIndices(),i=e.getTextContent();return G_(e.setTextContent(i.slice(0,n)+i.slice(r)),t,n)}};function $_(e,t){let{direction:n,origin:r}=e;return q_(e,K_(r,t===`focus`?F_(n):n)-e.offset)}function ev(e,t){return e.direction===t?e:e.getFlipped()}function tv(e){return rv(e,ev(J_(V(),F_(e.direction)),e.direction))}function nv(e){return rv(e,e)}function rv(e,t){return e.direction!==t.direction&&M(265),new Z_(e,t,e.direction)}function iv(e){let{initial:t,hasNext:n,step:r,map:i}=e,a=t;return{[Symbol.iterator](){return this},next(){if(!n(a))return{done:!0,value:void 0};let e={done:!1,value:i(a)};return a=r(a),e}}}function av(e,t){let n=dv(e.origin,t.origin);switch(n===null&&M(275,e.origin.getKey(),t.origin.getKey()),n.type){case`same`:return sv(e,t);case`ancestor`:return e.type===`child`?-1:1;case`descendant`:return t.type===`child`?1:-1;case`branch`:return cv(n)}}function ov(e){return e.getParent()||m_(e)}function sv(e,t){let n=e.type===`text`,r=t.type===`text`;return n&&r?function(e,t){return Math.sign(e-t)}(e.offset,t.offset):e.type===t.type?0:n?-1:r?1:e.type===`child`?-1:1}function cv(e){let{a:t,b:n}=e,r=t.__key,i=n.__key,a=t,o=n;for(;a&&o;a=a.getNextSibling(),o=o.getNextSibling()){if(a.__key===i)return-1;if(o.__key===r)return 1}return a===null?1:-1}function lv(e,t){return t.is(e)}function uv(e){return I(e)?[e.getLatest(),null]:[e.getParent(),e.getLatest()]}function dv(e,t){if(e.is(t))return{commonAncestor:e,type:`same`};let n=new Map;for(let[t,r]=uv(e);t;r=t,t=t.getParent())n.set(t,r);for(let[r,i]=uv(t);r;i=r,r=r.getParent()){let a=n.get(r);if(a!==void 0)return a===null?(lv(e,r)||M(276),{commonAncestor:r,type:`ancestor`}):i===null?(lv(t,r)||M(277),{commonAncestor:r,type:`descendant`}):((I(a)||lv(e,a))&&(I(i)||lv(t,i))&&r.is(a.getParent())&&r.is(i.getParent())||M(278),{a,b:i,commonAncestor:r,type:`branch`})}return null}function fv(e,t){if(!t||e===t)return e;for(let n in t)if(e[n]!==t[n])return{...e,...t};return e}function pv(...e){let t=[];for(let n of e)if(n&&typeof n==`string`)for(let[e]of n.matchAll(/\S+/g))t.push(e);return t}function mv(e,...t){let n=pv(...t);n.length>0&&e.classList.add(...n)}function hv(e,...t){let n=pv(...t);n.length>0&&e.classList.remove(...n)}var gv=`57X6y3wQZNzYjJB2L_10pxbackgroundhimselfUTF-8DEMOGRAPHICSVqvt4KW9`,_v=e=>crypto.getRandomValues(new Uint8Array(e)),vv=(e,t,n)=>{let r=256-256%e.length;if(r===256){let r=e.length-1;return(i=t)=>{if(!i)return``;let a=``;for(;;){let t=n(i),o=i|=0;for(;o--;)if(a+=e[t[o]&r],a.length>=i)return a}}}return(i=t)=>{if(!i)return``;let a=``,o=Math.ceil(409.6*i/r);for(;;){let t=n(o),s=o;for(;s--;)if(t[s]<r&&(a+=e[t[s]%e.length],a.length>=i))return a}}},yv=(e,t=21)=>vv(e,t|0,_v),bv=(e=21)=>{for(var t=``,n=crypto.getRandomValues(new Uint8Array(e|=0));e--;)t+=gv[n[e]&63];return t};function xv(){return V().getTextContent()}function Sv(e,t=!0){if(e)return!1;let n=xv();return t&&(n=n.trim()),n===``}function Cv(e){if(!Sv(e,!1))return!1;let t=V().getChildren(),n=t.length;if(n>1)return!1;for(let e=0;e<n;e++){let n=t[e];if(L(n))return!1;if(I(n)){if(!Zu(n)||n.__indent!==0)return!1;let e=n.getChildren(),t=e.length;for(let n=0;n<t;n++){let t=e[n];if(!R(t))return!1}}}return!0}function wv(e){return()=>Cv(e)}var Tv=ya?A.useLayoutEffect:A.useEffect;function Ev({editor:e,ariaActiveDescendant:t,ariaAutoComplete:n,ariaControls:r,ariaDescribedBy:i,ariaErrorMessage:a,ariaExpanded:o,ariaInvalid:s,ariaLabel:c,ariaLabelledBy:l,ariaMultiline:u,ariaOwns:d,ariaRequired:f,autoCapitalize:p,className:m,id:h,role:g,spellCheck:_=!0,style:v,tabIndex:y,"data-testid":b,...x},S){let[C,w]=(0,A.useState)(e.isEditable()),T=(0,A.useCallback)(t=>{t&&t.ownerDocument&&t.ownerDocument.defaultView?e.setRootElement(t):e.setRootElement(null)},[e]),E=(0,A.useMemo)(()=>function(...e){return t=>{for(let n of e)typeof n==`function`?n(t):n!=null&&(n.current=t)}}(S,T),[T,S]);Tv(()=>(w(e.isEditable()),e.registerEditableListener(e=>{w(e)})),[e]);let D={"aria-activedescendant":C?t:void 0,"aria-autocomplete":C?n:`none`,"aria-controls":C?r:void 0,"aria-describedby":i,...a==null?{}:{"aria-errormessage":a},"aria-expanded":g===`combobox`?o??!1:void 0,...s==null?{}:{"aria-invalid":s},"aria-label":c,"aria-labelledby":l,"aria-multiline":u,"aria-owns":C?d:void 0,"aria-readonly":!C||void 0,"aria-required":f,...x},ee=[D[`aria-label`],D[`aria-labelledby`],D.title].some(e=>typeof e==`string`&&e.trim()!==``),te=g===void 0?C||ee?`textbox`:void 0:g;return te??(D[`aria-activedescendant`]=void 0,D[`aria-autocomplete`]=void 0,D[`aria-expanded`]=void 0,D[`aria-multiline`]=void 0,D[`aria-placeholder`]=void 0,D[`aria-readonly`]=void 0,D[`aria-required`]=void 0),(0,j.jsx)(`div`,{autoCapitalize:p,className:m,contentEditable:C,"data-testid":b,id:h,ref:E,role:te,spellCheck:_,style:v,tabIndex:y??(C?void 0:-1),...D})}var Dv=(0,A.forwardRef)(Ev);function Ov(e){return e.read(`latest`,wv(e.isComposing()))}var kv=(0,A.forwardRef)(Av);function Av(e,t){let{placeholder:n,...r}=e,[i]=ha();return(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(Dv,{editor:i,...r,ref:t}),n!=null&&(0,j.jsx)(jv,{editor:i,content:n})]})}function jv({content:e,editor:t}){let n=function(e){let[t,n]=(0,A.useState)(()=>Ov(e));return Tv(()=>{function t(){let t=Ov(e);n(t)}return t(),th(e.registerUpdateListener(()=>{t()}),e.registerEditableListener(()=>{t()}))},[e]),t}(t),[r,i]=(0,A.useState)(t.isEditable());if(Tv(()=>(i(t.isEditable()),t.registerEditableListener(e=>{i(e)})),[t]),!n)return null;let a=null;return typeof e==`function`?a=e(r):e!==null&&(a=e),a===null?null:(0,j.jsx)(`div`,{"aria-hidden":!0,children:a})}var Mv=class extends A.Component{state={hasError:!1};static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(e,t){this.props.onError(e instanceof Error?e:Error(String(e),{cause:e}),t)}render(){return this.state.hasError?this.props.fallback:this.props.children}};function Nv({children:e,fallback:t,onError:n}){return(0,j.jsx)(Mv,{fallback:t===void 0?(0,j.jsx)(`div`,{style:{border:`1px solid #f00`,color:`#f00`,padding:`8px`},children:`An error was thrown.`}):t,onError:n,children:e})}var Pv=ya?A.useLayoutEffect:A.useEffect;function Fv(e){let[t]=ha(),n=(0,A.useMemo)(()=>e(t),[t,e]),[r,i]=(0,A.useState)(()=>n.initialValueFn()),a=(0,A.useRef)(r);return Pv(()=>{let{initialValueFn:e,subscribe:t}=n,r=e();return a.current!==r&&(a.current=r,i(r)),t(e=>{a.current=e,i(e)})},[n,e]),r}function Iv(e){return{initialValueFn:()=>e.isEditable(),subscribe:t=>e.registerEditableListener(t)}}function Lv(){return Fv(Iv)}function Rv(e){return(typeof e.nodes==`function`?e.nodes():e.nodes)||[]}var zv={tag:Zp};function Bv(){let e=V();e.isEmpty()&&e.append(z())}var Vv={config:{setOptions:zv,updateOptions:zv},init:({$initialEditorState:e=Bv})=>({$initialEditorState:e,initialized:!1}),afterRegistration(e,{updateOptions:t,setOptions:n},r){let i=r.getInitResult();if(!i.initialized){i.initialized=!0;let{$initialEditorState:r}=i;if(qp(r))e.setEditorState(r,n);else if(typeof r==`function`)e.update(()=>{r(e)},t);else if(r&&(typeof r==`string`||typeof r==`object`)){let t=e.parseEditorState(r);e.setEditorState(t,n)}}return()=>{}},name:`@lexical/extension/InitialState`,nodes:[ru,gu,om,$u,Yu]};function Hv(e,...t){throw function(e,...t){let n=new URL(`https://lexical.dev/docs/error`),r=new URLSearchParams;r.append(`code`,e);for(let e of t)r.append(`v`,e);return n.search=r.toString(),Error(`Minified Lexical error #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}(e,...t)}function Uv(){let e;try{e=`0.53.0+prod.esm`}catch{}return e??`"<unknown>+source"`}var Wv=Uv(),Gv=new Set([`__proto__`,`constructor`,`prototype`]);function Kv(e,t){if(e&&t&&!Array.isArray(t)&&typeof e==`object`&&typeof t==`object`){let n=e,r=t;for(let e in r)!Gv.has(e)&&Object.prototype.hasOwnProperty.call(r,e)&&(n[e]=Kv(n[e],r[e]));return e}return t}function qv(e){return e.id===0}function Jv(e){return e.id===2}var Yv=new Set,Xv=class{builder;configs;_dependency;_peerNameSet;extension;state;_signal;constructor(e,t){this.builder=e,this.extension=t,this.configs=new Set,this.state={id:0}}mergeConfigs(){let e=this.extension.config||{},t=this.extension.mergeConfig?this.extension.mergeConfig.bind(this.extension):fv;for(let n of this.configs)e=t(e,n);return e}init(e){let t=this.state;Jv(t)||Hv(306,String(t.id));let n={getDependency:this.getInitDependency.bind(this),getDirectDependentNames:this.getDirectDependentNames.bind(this),getPeer:this.getInitPeer.bind(this),getPeerNameSet:this.getPeerNameSet.bind(this)},r={...n,getDependency:this.getDependency.bind(this),getInitResult:this.getInitResult.bind(this),getPeer:this.getPeer.bind(this)},i=function(e,t,n){return Object.assign(e,{config:t,id:3,registerState:n})}(t,this.mergeConfigs(),n),a;this.state=i,this.extension.init&&(a=this.extension.init(e,i.config,n)),this.state=function(e,t,n){return Object.assign(e,{id:4,initResult:t,registerState:n})}(i,a,r)}build(e){let t=this.state,n;t.id!==4&&Hv(307,String(t.id),`5`),this.extension.build&&(n=this.extension.build(e,t.config,t.registerState));let r={...t.registerState,getOutput:()=>n,getSignal:this.getSignal.bind(this)};this.state=function(e,t,n){return Object.assign(e,{id:5,output:t,registerState:n})}(t,n,r)}register(e,t){this._signal=t;let n=this.state;n.id!==5&&Hv(308,String(n.id),`5`);let r=this.extension.register&&this.extension.register(e,n.config,n.registerState);return this.state=function(e){return Object.assign(e,{id:6})}(n),()=>{let e=this.state;e.id!==7&&Hv(309,String(n.id),`7`),this.state=function(e){return Object.assign(e,{id:5})}(e),r&&r()}}afterRegistration(e){let t=this.state,n;return t.id!==6&&Hv(310,String(t.id),`6`),this.extension.afterRegistration&&(n=this.extension.afterRegistration(e,t.config,t.registerState)),this.state=function(e){return Object.assign(e,{id:7})}(t),n}getSignal(){return this._signal===void 0&&Hv(311),this._signal}getInitResult(){this.extension.init===void 0&&Hv(312,this.extension.name);let e=this.state;return function(e){return e.id>=4}(e)||Hv(313,String(e.id),`4`),e.initResult}getInitPeer(e){let t=this.builder.extensionNameMap.get(e);return t?t.getExtensionInitDependency():void 0}getExtensionInitDependency(){let e=this.state;return function(e){return e.id>=3}(e)||Hv(314,String(e.id),`3`),{config:e.config}}getPeer(e){let t=this.builder.extensionNameMap.get(e);return t?t.getExtensionDependency():void 0}getInitDependency(e){let t=this.builder.getExtensionRep(e);return t===void 0&&Hv(315,this.extension.name,e.name),t.getExtensionInitDependency()}getDependency(e){let t=this.builder.getExtensionRep(e);return t===void 0&&Hv(315,this.extension.name,e.name),t.getExtensionDependency()}getState(){let e=this.state;return function(e){return e.id>=7}(e)||Hv(316,String(e.id),`7`),e}getDirectDependentNames(){return this.builder.incomingEdges.get(this.extension.name)||Yv}getPeerNameSet(){let e=this._peerNameSet;return e||(e=new Set((this.extension.peerDependencies||[]).map(([e])=>e)),this._peerNameSet=e),e}getExtensionDependency(){if(!this._dependency){let e=this.state;(function(e){return e.id>=5})(e)||Hv(317,this.extension.name),this._dependency={config:e.config,init:e.initResult,output:e.output}}return this._dependency}},Zv=Symbol.for(`@lexical/extension/LexicalBuilder`);function Qv(){}function $v(e){throw e}function ey(e){return Array.isArray(e)?e:[e]}var ty=Wv,ny=class e{roots;extensionNameMap;outgoingConfigEdges;incomingEdges;conflicts;_sortedExtensionReps;PACKAGE_VERSION;constructor(e){this.outgoingConfigEdges=new Map,this.incomingEdges=new Map,this.extensionNameMap=new Map,this.conflicts=new Map,this.PACKAGE_VERSION=ty,this.roots=e;for(let t of e)this.addExtension(t)}static fromExtensions(t){let n=[ey(Vv)];for(let e of t)n.push(ey(e));return new e(n)}static maybeFromEditor(t){let n=t[Zv];return n&&(n.PACKAGE_VERSION!==ty&&Hv(292,n.PACKAGE_VERSION,ty),n instanceof e||Hv(293)),n}static fromEditor(t){let n=e.maybeFromEditor(t);return n===void 0&&Hv(294),n}constructEditor(){let{$initialEditorState:e,onError:t,onWarn:n,...r}=this.buildCreateEditorArgs(),i=Object.assign(_m({...r,...t?{onError:e=>{t(e,i)}}:{},...n?{onWarn:e=>{n(e,i)}}:{}}),{[Zv]:this});for(let e of this.sortedExtensionReps())e.build(i);return i}buildEditor(){let e=Qv;function t(){try{e()}finally{e=Qv}}let n=Object.assign(this.constructEditor(),{dispose:t,[Symbol.dispose]:t});return e=th(this.registerEditor(n),()=>n.setRootElement(null)),n}hasExtensionByName(e){return this.extensionNameMap.has(e)}getExtensionRep(e){let t=this.extensionNameMap.get(e.name);if(t)return t.extension!==e&&Hv(295,e.name),t}addEdge(e,t,n){let r=this.outgoingConfigEdges.get(e);if(r){let e=r.get(t);e?e.push(...n):r.set(t,n)}else this.outgoingConfigEdges.set(e,new Map([[t,n]]));let i=this.incomingEdges.get(t);i?i.add(e):this.incomingEdges.set(t,new Set([e]))}addExtension(e){this._sortedExtensionReps!==void 0&&Hv(296);let[t]=ey(e);typeof t.name!=`string`&&Hv(297,typeof t.name);let n=this.extensionNameMap.get(t.name);if(n!==void 0&&n.extension!==t&&Hv(298,t.name),!n){n=new Xv(this,t),this.extensionNameMap.set(t.name,n);let e=this.conflicts.get(t.name);typeof e==`string`&&Hv(299,t.name,e);for(let e of t.conflictsWith||[])this.extensionNameMap.has(e)&&Hv(299,t.name,e),this.conflicts.set(e,t.name);for(let e of t.dependencies||[]){let n=ey(e);this.addEdge(t.name,n[0].name,n.slice(1)),this.addExtension(n)}for(let[e,n]of t.peerDependencies||[])this.addEdge(t.name,e,n?[n]:[])}}sortedExtensionReps(){if(this._sortedExtensionReps)return this._sortedExtensionReps;let e=[],t=(n,r)=>{let i=n.state;if(Jv(i))return;let a=n.extension.name;var o;qv(i)||Hv(300,a,r||`[unknown]`),qv(o=i)||Hv(304,String(o.id),`0`),i=Object.assign(o,{id:1}),n.state=i;let s=this.outgoingConfigEdges.get(a);if(s)for(let e of s.keys()){let n=this.extensionNameMap.get(e);n&&t(n,a)}i=function(e){return function(e){return e.id===1}(e)||Hv(305,String(e.id),`1`),Object.assign(e,{id:2})}(i),n.state=i,e.push(n)};for(let e of this.extensionNameMap.values())qv(e.state)&&t(e);for(let t of e)for(let[e,n]of this.outgoingConfigEdges.get(t.extension.name)||[])if(n.length>0){let t=this.extensionNameMap.get(e);if(t)for(let e of n)t.configs.add(e)}for(let[e,...t]of this.roots)if(t.length>0){let n=this.extensionNameMap.get(e.name);n===void 0&&Hv(301,e.name);for(let e of t)n.configs.add(e)}return this._sortedExtensionReps=e,this._sortedExtensionReps}registerEditor(e){let t=this.sortedExtensionReps(),n=new AbortController,r=[()=>n.abort()],i=n.signal;for(let n of t){let t=n.register(e,i);t&&r.push(t)}for(let n of t){let t=n.afterRegistration(e);t&&r.push(t)}return th(...r)}buildCreateEditorArgs(){let e={},t=new Set,n=new Map,r=new Map,i={},a={},o=this.sortedExtensionReps();for(let s of o){let{extension:o}=s;if(o.onError!==void 0&&(e.onError=o.onError),o.onWarn!==void 0&&(e.onWarn=o.onWarn),o.disableEvents!==void 0&&(e.disableEvents=o.disableEvents),o.parentEditor!==void 0&&(e.parentEditor=o.parentEditor),o.editable!==void 0&&(e.editable=o.editable),o.namespace!==void 0&&(e.namespace=o.namespace),o.$initialEditorState!==void 0&&(e.$initialEditorState=o.$initialEditorState),o.nodes)for(let e of Rv(o)){if(typeof e!=`function`){let t=n.get(e.replace);t&&Hv(302,o.name,e.replace.name,t.extension.name),n.set(e.replace,s)}t.add(e)}if(o.html){if(o.html.export)for(let[e,t]of o.html.export.entries())r.set(e,t);o.html.import&&Object.assign(i,o.html.import)}o.theme&&Kv(a,o.theme)}Object.keys(a).length>0&&(e.theme=a),t.size&&(e.nodes=Array.from(t));let s=Object.keys(i).length>0,c=r.size>0;(s||c)&&(e.html={},s&&(e.html.import=i),c&&(e.html.export=r));for(let t of o)t.init(e);return e.onError||=$v,e}},ry={name:`@lexical/react/ReactProvider`},iy=Symbol.for(`preact-signals`);function ay(){if(uy>1)uy--;else{var e,t=!1;for((function(){var e=py;for(py=void 0;e!==void 0;){var t=e.S;if(t.v===e.v)for(var n=t.t;n!==void 0;n=n.x)n.i===e.i&&(n.i=t.i);e=e.o}})();ly!==void 0;){var n=ly;for(ly=void 0,dy++;n!==void 0;){var r=n.u;if(n.u=void 0,n.f&=-3,!(8&n.f)&&vy(n))try{n.c()}catch(n){t||=(e=n,!0)}n=r}}if(dy=0,uy--,t)throw e}}var oy,sy=void 0;function cy(e){var t=sy,n=oy;sy=void 0,oy=void 0;try{return e()}finally{sy=t,oy=n}}var ly=void 0,uy=0,dy=0,fy=0,py=void 0,my=0;function hy(e){if(sy!==void 0){var t=e.n;if(t===void 0||t.t!==sy)return t={i:0,S:e,p:sy.s,n:void 0,t:sy,e:void 0,x:void 0,r:t},sy.s!==void 0&&(sy.s.n=t),sy.s=t,e.n=t,32&sy.f&&e.S(t),t;if(t.i===-1)return t.i=0,t.n!==void 0&&(t.n.p=t.p,t.p!==void 0&&(t.p.n=t.n),t.p=sy.s,t.n=void 0,sy.s.n=t,sy.s=t),t}}function gy(e,t){this.v=e,this.i=0,this.n=void 0,this.t=void 0,this.l=0,this.W=t?.watched,this.Z=t?.unwatched,this.name=t?.name}gy.prototype.brand=iy,gy.prototype.h=function(){return!0},gy.prototype.S=function(e){var t=this,n=this.t;n!==e&&e.e===void 0&&(e.x=n,this.t=e,n===void 0?cy(function(){var e;(e=t.W)==null||e.call(t)}):n.e=e)},gy.prototype.U=function(e){var t=this;if(this.t!==void 0){var n=e.e,r=e.x;n!==void 0&&(n.x=r,e.e=void 0),r!==void 0&&(r.e=n,e.x=void 0),e===this.t&&(this.t=r,r===void 0&&cy(function(){var e;(e=t.Z)==null||e.call(t)}))}},gy.prototype.subscribe=function(e){var t=this;return Ey(function(){var n=t.value;cy(function(){return e(n)})},{name:`sub`})},gy.prototype.valueOf=function(){return this.value},gy.prototype.toString=function(){return this.value+``},gy.prototype.toJSON=function(){return this.value},gy.prototype.peek=function(){var e=this;return cy(function(){return e.value})},Object.defineProperty(gy.prototype,"value",{get:function(){var e=hy(this);return e!==void 0&&(e.i=this.i),this.v},set:function(e){if(e!==this.v){if(dy>100)throw Error(`Cycle detected`);(function(e){uy!==0&&dy===0&&e.l!==fy&&(e.l=fy,py={S:e,v:e.v,i:e.i,o:py})})(this),this.v=e,this.i++,my++,uy++;try{for(var t=this.t;t!==void 0;t=t.x)t.t.N()}finally{ay()}}}});function _y(e,t){return new gy(e,t)}function vy(e){for(var t=e.s;t!==void 0;t=t.n)if(t.S.i!==t.i||!t.S.h()||t.S.i!==t.i)return!0;return!1}function yy(e){for(var t=e.s;t!==void 0;t=t.n){var n=t.S.n;if(n!==void 0&&(t.r=n),t.S.n=t,t.i=-1,t.n===void 0){e.s=t;break}}}function by(e){for(var t=e.s,n=void 0;t!==void 0;){var r=t.p;t.i===-1?(t.S.U(t),r!==void 0&&(r.n=t.n),t.n!==void 0&&(t.n.p=r)):n=t,t.S.n=t.r,t.r!==void 0&&(t.r=void 0),t=r}e.s=n}function xy(e,t){gy.call(this,void 0,t),this.x=e,this.s=void 0,this.g=my-1,this.f=4}xy.prototype=new gy,xy.prototype.h=function(){if(this.f&=-3,1&this.f)return!1;if((36&this.f)==32||(this.f&=-5,this.g===my))return!0;if(this.g=my,this.f|=1,this.i>0&&!vy(this))return this.f&=-2,!0;var e=sy;try{yy(this),sy=this;var t=this.x();(16&this.f||this.v!==t||this.i===0)&&(this.v=t,this.f&=-17,this.i++)}catch(e){this.v=e,this.f|=16,this.i++}return sy=e,by(this),this.f&=-2,!0},xy.prototype.S=function(e){if(this.t===void 0){this.f|=36;for(var t=this.s;t!==void 0;t=t.n)t.S.S(t)}gy.prototype.S.call(this,e)},xy.prototype.U=function(e){if(this.t!==void 0&&(gy.prototype.U.call(this,e),this.t===void 0)){this.f&=-33;for(var t=this.s;t!==void 0;t=t.n)t.S.U(t)}},xy.prototype.N=function(){if(!(2&this.f)){this.f|=6;for(var e=this.t;e!==void 0;e=e.x)e.t.N()}},Object.defineProperty(xy.prototype,"value",{get:function(){if(1&this.f)throw Error(`Cycle detected`);var e=hy(this);if(this.h(),e!==void 0&&(e.i=this.i),16&this.f)throw this.v;return this.v}});function Sy(e){var t=e.m;if(e.m=void 0,typeof t==`function`){uy++;var n=sy;sy=void 0;try{t()}catch(t){throw e.f&=-2,e.f|=8,Cy(e),t}finally{sy=n,ay()}}}function Cy(e){for(var t=e.s;t!==void 0;t=t.n)t.S.U(t);e.x=void 0,e.s=void 0,Sy(e)}function wy(e){if(sy!==this)throw Error(`Out-of-order effect`);by(this),sy=e,this.f&=-2,8&this.f&&Cy(this),ay()}function Ty(e,t){this.x=e,this.m=void 0,this.s=void 0,this.u=void 0,this.f=32,this.name=t?.name,oy&&oy.push(this)}Ty.prototype.c=function(){var e=this.S();try{if(8&this.f||this.x===void 0)return;var t=this.x();typeof t==`function`&&(this.m=t)}finally{e()}},Ty.prototype.S=function(){if(1&this.f)throw Error(`Cycle detected`);this.f|=1,this.f&=-9,Sy(this),yy(this),uy++;var e=sy;return sy=this,wy.bind(this,e)},Ty.prototype.N=function(){2&this.f||(this.f|=2,this.u=ly,ly=this)},Ty.prototype.d=function(){this.f|=8,1&this.f||Cy(this)},Ty.prototype.dispose=function(){this.d()};function Ey(e,t){var n=new Ty(e,t);try{n.c()}catch(e){throw n.d(),e}var r=n.d.bind(n);return r[Symbol.dispose]=r,r}function Dy(e,t={}){let n={};for(let r in e){let i=t[r];n[r]=_y(i===void 0?e[r]:i)}return n}function Oy(e,t){let n;return _y(e(),{unwatched(){n&&=(n(),void 0)},watched(){this.value=e(),n=t(this)}})}var ky={bold:`bold`,italic:`italic`,strikeThrough:`strikethrough`,subscript:`subscript`,superscript:`superscript`,underline:`underline`},Ay=Symbol.for(`@lexical/dragon/WindowState`);function jy(e,t,n){let r=function(e){let t=e[Ay];return t===void 0&&(t={dispose:()=>{},editors:new Map,installs:new Set},e[Ay]=t),t}(e);if(r.installs.size===0){let t=Fy.bind(e);e.addEventListener(`message`,t,!0),r.dispose=()=>{e.removeEventListener(`message`,t,!0)}}if(r.installs.add(t),n){let e=r.editors.get(n)||new Set;e.add(t),r.editors.set(n,e)}return My.bind(null,e,r,t,n)}function My(e,t,n,r){if(r){let e=t.editors.get(r);e&&e.delete(n)&&e.size===0&&t.editors.delete(r)}t.installs.delete(n)&&t.installs.size===0&&(t.dispose(),delete e[Ay])}function Ny(e){return e&&e.ownerDocument.defaultView}function Py(e){let t=Oy(()=>Ny(e.getRootElement()),t=>e.registerRootListener(e=>{t.value=Ny(e)}));return Ey(()=>{let n=t.value;if(n)return jy(n,Symbol(`@lexical/dragon/editorInstall`),e)})}function Fy(e){if(e.origin!==this.location.origin)return;let t=function(e){let t=e[Ay];if(t===void 0)return null;let n=md(Rf(e.document));return fd(n)&&t.editors.has(n)?n:null}(this);if(t===null)return;let n=e.data;if(typeof n==`string`){let r;try{r=JSON.parse(n)}catch{return}if(r&&r.protocol===`nuanria_messaging`&&r.type===`request`){let n=r.payload;if(n&&n.functionId===`makeChanges`){let r=n.args;if(Array.isArray(r)){let[n,i,a,o,s,c]=r;if(![n,i,o,s].every(Number.isFinite)||typeof a!=`string`&&a!==-1)return;t.update(()=>{let t=J();if(q(t)){let r=t.anchor,l=r.getNode(),u=0,d=0;if(R(l)&&n>=0&&i>=0&&(u=n,d=n+i,t.setTextNodeRange(l,u,l,d)),typeof a!=`string`||u===d&&a===``||(t.insertRawText(a),l=r.getNode()),R(l)){let e=l.getTextContentSize();u=Math.min(Math.max(o,0),e),d=o<0||s<0?u:Math.min(o+s,e),t.setTextNodeRange(l,u,l,d)}if(typeof c==`string`&&s>0&&!t.isCollapsed()){let e=ky[c];e!==void 0&&t.formatText(e)}e.stopImmediatePropagation()}})}}}}}function Iy(e,t){let n=ny.maybeFromEditor(e);if(!n)return;let r=n.extensionNameMap.get(t);return r?r.getExtensionDependency():void 0}function Ly(e,...t){throw function(e,...t){let n=new URL(`https://lexical.dev/docs/error`),r=new URLSearchParams;r.append(`code`,e);for(let e of t)r.append(`v`,e);return n.search=r.toString(),Error(`Minified Lexical error #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}(e,...t)}function Ry(e){let t=``;for(let n in e)n&&(t+=`${n}: ${e[n]};`);return t}function zy(e){let t=Jf().getElementByKey(e.getKey());if(t===null)return null;let n=t.ownerDocument.defaultView;return n===null?null:n.getComputedStyle(t)}function By(e){let t=iu(e)?e:e.getParent();return t&&zy(t)}function Vy(e){let t=By(e);return t!==null&&t.direction===`rtl`}function Hy(e,t,n=`self`){let r=e.getStartEndPoints();if(r!==null&&t.isSelected(e)&&!gd(t)){let[i,a]=e.isBackward()?[r[1],r[0]]:r,o=!q(e)||i.type!==`element`&&a.type!==`element`?void 0:Uu(ju(e).getTextSlices(),t),[s,c]=o?o.getSliceIndices():[t.__key===i.key?i.offset:0,t.__key===a.key?a.offset:void 0],l=t.__text.slice(s,c);l!==t.__text&&(n===`clone`&&(t=rp(t)),t.__text=l)}return t}function Uy(e,t){(q(e)?e.isCollapsed():R(e)||I(e))||Ly(280);let n=au(q(e)?e.style:R(e)?e.getStyle():e.getTextStyle()),r=Ry(Object.entries(t).reduce((t,[r,i])=>(typeof i==`function`?t[r]=i(n[r],e):i===null?delete t[r]:t[r]=i,t),{...n}));q(e)||R(e)?e.setStyle(r):e.setTextStyle(r)}function Wy(e,t){let n=new Set;if(q(e)&&e.isCollapsed()){Uy(e,t);let r=e.anchor.getNode();I(r)&&r.isEmpty()&&(n.add(r.getKey()),Uy(r,t))}Gy(e,e=>{Uy(e,t)});let r=e.getNodes();if(r.length>0)for(let e of r){if(!I(e)||!e.canBeEmpty()||e.getChildrenSize()!==0)continue;let r=e.getKey();n.has(r)||(n.add(r),Uy(e,t))}}function Gy(e,t){if(!e)return;let n=q(e)?ju(e).getTextSlices():[];for(let r of e.getNodes()){if(!R(r)||!r.canHaveFormat())continue;let i=Uu(n,r);(i?i.distance!==0:r.getTextContentSize()!==0)&&t(i&&!gd(r)?Wu(i,q(e)?e:null):r)}q(e)&&e.anchor.type===`text`&&e.focus.type===`text`&&e.anchor.key===e.focus.key&&Ky(e)}function Ky(e){if(e.isBackward()){let{anchor:t,focus:n}=e,{key:r,offset:i,type:a}=t;t.set(n.key,n.offset,n.type),n.set(r,i,a)}}function qy(e,t){let n=e.getFormatType(),r=e.getIndent();n!==t.getFormatType()&&t.setFormat(n),r!==t.getIndent()&&t.setIndent(r)}function Jy(e,t,n){let r=Du(e,n);if(Ru(r))return!1;for(;r;r=r.getParentCaret()){let e=r.getParentAtCaret();if(!e||r.getNodeAtCaret())return!1;if(t.is(e))return!0}return!1}function Yy(e,t,n=qy){if(!e)return;let r=e.getStartEndPoints(),i=!1,a=null,o=new Map;if(r){let[t,n]=r,s=G(t.getNode(),qf);a=G(n.getNode(),qf);let c=e.isBackward()?`previous`:`next`;i=I(a)&&!a.is(s)&&function(e,t,n){let r=e.getNode();return(!I(r)||!r.isEmpty())&&Jy(e,t,n)}(n,a,F_(c)),I(s)&&o.set(s.getKey(),s),I(a)&&!i&&o.set(a.getKey(),a)}for(let t of e.getNodes())if(I(t)&&qf(t)){if(i&&t.is(a))continue;o.set(t.getKey(),t)}else if(!r){let e=G(t,qf);I(e)&&o.set(e.getKey(),e)}for(let e of o.values()){if(m_(e)!==null)continue;let r=t();n(e,r),e.replace(r,!0)}}function Xy(e){let t=Zy(e);return t!==null&&t.writingMode===`vertical-rl`}function Zy(e){let t=e.anchor.getNode();return I(t)?zy(t):By(t)}function Qy(e,t){let n=Xy(e)?!t:t;eb(e)&&(n=!n);let r=Du(e.focus,n?`previous`:`next`);if(Ru(r))return!1;if(z_(r)&&!td(r.origin)&&r.origin.isUnmergeable()){let e=r.getNodeAtCaret();if(R(e)&&!td(e))return!0}for(let e of tv(r)){if(V_(e))return!e.origin.isInline();if(!I(e.origin)){if(L(e.origin))return!0;break}}return!1}function $y(e,t,n,r){e.modify(t?`extend`:`move`,n,r)}function eb(e){let t=Zy(e);return t!==null&&t.direction===`rtl`}function tb(e,t,n){let r=eb(e),i;i=Xy(e)||r?!n:n,$y(e,t,i,`character`)}function nb(e,t,n){let r=au(e.getStyle());return r!==null&&r[t]||n}function rb(e,t,n=``){let r=null,i=e.getNodes(),a,o;if(q(e)){if(e.isCollapsed()&&e.style!==``){let n=au(e.style);if(n!==null&&t in n)return n[t]}let{anchor:n,focus:r}=e,i=e.isBackward(),s=i?r.getNode():n.getNode(),c=i?n.getNode():r.getNode(),l=i?r.offset:n.offset,u=i?n.offset:r.offset;R(s)&&l===s.getTextContentSize()&&(a=s),u===0&&(o=c)}for(let e=0;e<i.length;e++){let s=i[e];if(R(s)&&!s.is(e===0?a:o)){let e=nb(s,t,n);if(r===null)r=e;else if(r!==e){r=``;break}}}return r===null?n:r}function ib(e,...t){throw function(e,...t){let n=new URL(`https://lexical.dev/docs/error`),r=new URLSearchParams;r.append(`code`,e);for(let e of t)r.append(`v`,e);return n.search=r.toString(),Error(`Minified Lexical error #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}(e,...t)}function ab(e,t){let n=e.ownerDocument,r=n.defaultView||window,i=r.getComputedStyle(e),a=i.position===`absolute`,o=t?/(auto|scroll|hidden)/:/(auto|scroll)/;if(i.position===`fixed`)return n.body;for(let t=e;t=af(t);)if(i=r.getComputedStyle(t),(!a||i.position!==`static`)&&o.test(i.overflow+i.overflowY+i.overflowX))return t;return n.body}function ob(e,t){return Array.from(sb(e,t))}function sb(e,t){return lb(`next`,e,t)}function cb(e,t){let n=Vu(Y(e,t));return n&&n[0]}function lb(e,t,n){let r=V(),i=t||r,a=I(i)?J_(i,e):Y(i,e),o=ub(i),s=n?X_(Y_(Y(n,e)))||cb(n,e):cb(i,e),c=o;return iv({hasNext:e=>e!==null,initial:a,map:e=>({depth:c,node:e.origin}),step:e=>{if(e.isSameNodeCaret(s))return null;V_(e)&&c++;let t=Vu(e);return!t||t[0].isSameNodeCaret(s)?null:(c+=t[1],t[0])}})}function ub(e){let t=-1;for(let n=e;n!==null;n=n.getParent()??m_(n))t++;return t}function db(e,t){let n=e;for(;n!=null;){if(n instanceof t)return n;n=n.getParent()}return null}function fb(e){let t=G(e,e=>I(e)&&!e.isInline());return I(t)||ib(4,e.__key),t}function pb(e){let t=J()||zg(),n;if(q(t))n=Du(t.focus,`next`);else{if(t!=null){let e=t.getNodes(),r=e[e.length-1];r&&(n=Y(r,`next`))}n||=J_(V(),`previous`).getFlipped().insert(z())}let r=qu(e,n,Ru(i=n)||Vu(z_(i)?i.getSiblingCaret():i,`shadowRoot`)!==null?{$shouldSplit:(e,t)=>t!==`last`}:void 0);var i;let a=X_(r);return ku(nv(V_(a)?Lu(a):r)),e.getLatest()}function mb(e,t){if(e==null)return!1;let n=Object.getPrototypeOf(e);return n!=null&&n.constructor!=null&&n.constructor.name===t.name}function hb(e){let t=null;if(mb(e,DragEvent)?t=e.dataTransfer:mb(e,ClipboardEvent)&&(t=e.clipboardData),t===null)return[!1,[],!1];let n=t.types,r=n.includes(`Files`),i=n.includes(`text/html`)||n.includes(`text/plain`);return[r,Array.from(t.files),i]}function gb(e){let t=J();if(!q(t))return!1;let n=new Set,r=t.getNodes();for(let t=0;t<r.length;t++){let i=r[t],a=i.getKey();if(n.has(a))continue;let o=G(i,e=>I(e)&&!e.isInline());if(o===null)continue;let s=o.getKey();o.canIndent()&&!n.has(s)&&(n.add(s),e(o))}return n.size>0}function _b(e,t){J_(e,`next`).insert(t)}var vb=!(Ta||!ya)&&void 0;function yb(e,t=!1){let n=1;if(function(){if(vb===void 0){let e=document.createElement(`div`);e.style.position=`absolute`,e.style.opacity=`0`,e.style.width=`100px`,e.style.left=`-1000px`,document.body.appendChild(e);let t=e.getBoundingClientRect();e.style.setProperty(`zoom`,`2`),vb=e.getBoundingClientRect().width===t.width,document.body.removeChild(e)}return vb}()||t){let t=e&&e.ownerDocument.defaultView||window;for(;e;)n*=Number(t.getComputedStyle(e).getPropertyValue(`zoom`)),e=af(e)}return n}function bb(e,t){return xb(e,t,null)}function xb(e,t,n){let r=!1;for(let i of Cb(e))t(i)?n!==null&&n(i):(r=!0,I(i)&&xb(i,t,n||(e=>i.insertAfter(e))),i.remove());return r}function Sb(e,t){let n=[],r=Array.from(e).reverse();for(let e=r.pop();e!==void 0;e=r.pop())if(t(e))n.push(e);else if(I(e))for(let t of Cb(e))r.push(t);return n}function Cb(e){return wb(J_(e,`previous`))}function wb(e){return iv({hasNext:B_,initial:e.getAdjacentCaret(),map:e=>e.origin.getLatest(),step:e=>e.getAdjacentCaret()})}function Tb(e,t){return Jy(e,t,`previous`)}function Eb(e,t){return Jy(e,t,`next`)}function Db(e){return Iy(Jf(),e)}function Ob(e,...t){throw function(e,...t){let n=new URL(`https://lexical.dev/docs/error`),r=new URLSearchParams;r.append(`code`,e);for(let e of t)r.append(`v`,e);return n.search=r.toString(),Error(`Minified Lexical error #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}(e,...t)}function kb(e){if(!vd(e))return;let t=e;if(t.querySelector(`style`)===null)return;let n=new Map;function r(e){let t=n.get(e);if(t===void 0){t=new Set;for(let n=0;n<e.style.length;n++)t.add(e.style[n]);n.set(e,t)}return t}try{for(let e of Array.from(t.styleSheets)){let n;try{n=e.cssRules}catch{continue}for(let e of Array.from(n)){if(!mb(e,CSSStyleRule))continue;let n;try{n=t.querySelectorAll(e.selectorText)}catch{continue}for(let t of Array.from(n)){if(!W(t))continue;let n=r(t);for(let r=0;r<e.style.length;r++){let i=e.style[r];n.has(i)||t.style.setProperty(i,e.style.getPropertyValue(i),e.style.getPropertyPriority(i))}}}}}catch{}}var Ab;function jb(e,t){let{key:n}=t;return e&&n in e?e[n]:t.defaultValue}function Mb(e){return Ab&&Ab.editor===e?Ab:void 0}function Nb(e,t){if(`cfg`in t){let{cfg:n,updater:r}=t;return[n,r(jb(e,n))]}return t}function Pb(e,t){let n=t;for(let r of e){let[e,i]=Nb(n,r),a=e.key;if(n===t&&jb(n,e)===i)continue;let o=n===t||n===void 0?Fb(t):n;o[a]=i,n=o}return n}function Fb(e){return Object.create(e||null)}function Ib(e,t){return[e,t]}function Lb(e,t,n,r=Jf()){let i=Ab,a=Mb(r);try{return Ab={...a,editor:r,[e]:t},n()}finally{Ab=i}}function Rb(e,t=()=>{}){return(n,r=Jf())=>i=>{let a=Mb(r),o=a&&a[e],s=Pb(n,o||t(r));return s&&s!==o?Lb(e,s,i,r):i()}}function zb(e,t,n,r){return Object.assign(lc(Symbol(t),{isEqual:r,parse:n}),{[e]:!0})}var Bb=`@lexical/html/DOM`,Vb=Symbol.for(`@lexical/html/DOMExportContext`);function Hb(e,t,n){return zb(Vb,e,t,n)}var Ub=Hb(`isExport`,Boolean);function Wb(e){let t=Iy(e,Bb);return t?t.output.defaults:void 0}function Gb(e){let t=Iy(e,Bb);return t?t.output.runtime:void 0}function Kb(e=Jf()){let t=Gb(e);return t?t.getSessionConfig():Yf(e)}var qb=Rb(Vb,Wb),Jb=new Set([`STYLE`,`SCRIPT`]);function Yb(e,t){kb(t);let n=vd(t)?t.body.childNodes:t.childNodes,r=[],i=[];for(let t of n)if(!Jb.has(t.nodeName)){let n=$b(t,e,i,!1);if(n!==null)for(let e of n)r.push(e)}return function(e){for(let t of e)t.getParent()&&t.getNextSibling()instanceof am&&t.insertAfter(cm());for(let t of e){let e=t.getParent();e&&e.splice(t.getIndexWithinParent(),1,t.getChildren())}}(i),r}function Xb(e,t=null,n=Jf()){return qb([Ib(Ub,!0)],n)(()=>{let r=V(),i=Kb(n),a=__(t),o=e.append.bind(e);for(let e of(I(a)?a:r).getChildren())Qb(n,e,o,t,i);return e})}function Zb(e,t=null){return(typeof document>`u`||typeof window>`u`&&global.window===void 0)&&Ob(338),Im(e),Xb(Af().createElement(`div`),t,e).innerHTML}function Qb(e,t,n,r=null,i=Yf(e)){let a=i.$shouldInclude(t,r,e),o=i.$shouldExclude(t,r,e),s=t;r!==null&&R(t)&&(s=Hy(r,t,`clone`));let{element:c,after:l,append:u,$getChildNodes:d}=i.$exportDOM(s,e);if(!c)return!1;let f=Af().createDocumentFragment(),p=d?d():I(s)?s.getChildren():[],m=a&&lg(r)&&I(t)?null:r,h=f.append.bind(f),g=null;for(let n of p){let o=Qb(e,n,h,m,i);o&&(g=n),!a&&o&&i.$extractWithChild(t,n,r,`html`,e)&&(a=!0)}if(a&&!o){if((W(c)||Hf(c))&&(u?u(f):c.append(f),function(e,t){let n=e.lastChild;if(lm(t)&&W(e)&&Kf(e)&&n!==null&&n.nodeName===`BR`){let t=Af().createElement(`br`);t.setAttribute(`data-lexical-managed-linebreak`,`true`),e.append(t)}}(c,g)),Hf(c)){if(l){let e=l.call(s,c);e&&c.replaceChildren(e)}n(c)}else if(n(c),l){let e=l.call(s,c);e&&c.replaceWith(e)}}else n(f);return a}function $b(e,t,n,r,i=new Map,a){let o=[];if(Jb.has(e.nodeName))return o;let s=null,c=function(e,t){let{nodeName:n}=e,r=t._htmlConversions.get(n.toLowerCase()),i=null;if(r!==void 0)for(let t of r){let n=t(e);n!==null&&(i===null||(i.priority||0)<=(n.priority||0))&&(i=n)}return i===null?null:i.conversion}(e,t),l=c?c(e):null,u=null;if(l!==null){u=l.after;let t=l.node;if(s=Array.isArray(t)?t[t.length-1]:t,s!==null){for(let[,e]of i)if(s=e(s,a),!s)break;s&&o.push(...Array.isArray(t)?t:[s])}l.forChild!=null&&i.set(e.nodeName,l.forChild)}let d=e.childNodes,f=[],p=(s==null||!U(s))&&(s!=null&&jg(s)||r);for(let e=0;e<d.length;e++)f.push(...$b(d[e],t,n,p,new Map(i),s));if(u!=null&&(f=u(f)),Kf(e)&&(f=function(e,t,n){let r=e.style.textAlign,i=[],a=[];for(let e=0;e<t.length;e++){let o=t[e];if(jg(o))r&&!o.getFormat()&&o.setFormat(r),i.push(o);else if(a.push(o),e===t.length-1||e<t.length-1&&jg(t[e+1])){let e=n();e.setFormat(r),e.append(...a),i.push(e),a=[]}}return i}(e,f,p?()=>{let e=new am;return n.push(e),e}:z)),s==null){if(f.length>0)for(let e of f)o.push(e);else Kf(e)&&function(e){return e.nextSibling!=null&&e.previousSibling!=null&&Wf(e.nextSibling)&&Wf(e.previousSibling)}(e)&&o.push(cm())}else I(s)&&s.append(...f);return o}function ex(e,t,n=null){let r=kf(n),i=n?Df(n):[],a=n!==null&&i.length>0;if(a&&typeof r.caretPositionFromPoint==`function`){let a=r.caretPositionFromPoint(e,t,{shadowRoots:i});if(a!==null&&function(e,t){for(let n=e;n!==null;){if(n===t)return!0;n=af(n)}return!1}(a.offsetNode,n))return{node:a.offsetNode,offset:a.offset}}if(a){let i=n.getRootNode();if(Tf(i)){let a=i.elementFromPoint(e,t);if(a!==null&&n.contains(a)){let n=function(e,t,n,r){let i=r.createRange(),a=e=>t<e.top?e.top-t:t>e.bottom?t-e.bottom:0,o=t=>e<t.left?t.left-e:e>t.right?e-t.right:0,s=r.createTreeWalker(n,NodeFilter.SHOW_TEXT),c=null,l=1/0,u=1/0;for(let e=s.nextNode();e;e=s.nextNode()){i.selectNodeContents(e);for(let t of i.getClientRects()){let n=a(t),r=o(t);(n<l||n===l&&r<u)&&(l=n,u=r,c=e)}}if(c===null)return null;let d=0,f=1/0,p=1/0;for(let t=0;t<=c.length;t++){i.setStart(c,t),i.collapse(!0);let n=i.getBoundingClientRect(),r=a(n),o=Math.abs(e-n.left);(r<f||r===f&&o<p)&&(f=r,p=o,d=t)}return{node:c,offset:d}}(e,t,a,r);if(n!==null)return n}}}if(typeof r.caretRangeFromPoint==`function`){let n=r.caretRangeFromPoint(e,t);return n===null?null:{node:n.startContainer,offset:n.startOffset}}if(typeof r.caretPositionFromPoint==`function`){let n=r.caretPositionFromPoint(e,t);return n===null?null:{node:n.offsetNode,offset:n.offset}}return null}function tx(e,...t){throw function(e,...t){let n=new URL(`https://lexical.dev/docs/error`),r=new URLSearchParams;r.append(`code`,e);for(let e of t)r.append(`v`,e);return n.search=r.toString(),Error(`Minified Lexical error #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}(e,...t)}var nx={"application/x-lexical-editor":0,"text/html":10,"text/plain":20,"text/uri-list":30};function rx(e){return window.trustedTypes&&window.trustedTypes.createPolicy?window.trustedTypes.createPolicy(`lexical`,{createHTML:e=>e}).createHTML(e):e}var ix=(e,t)=>{if(!q(t))return t.insertRawText(e),!0;t!==J()&&Id(t);let n=e=>{let t=J();q(t)&&e(t)};return Jg(e,{linebreak:()=>n(e=>e.insertParagraph()),tab:()=>n(e=>e.insertNodes([ed()])),text:e=>n(t=>t.insertText(e))}),!0},ax={"application/x-lexical-editor":[(e,t,n)=>{try{let n=Jf(),r=JSON.parse(e);if(r&&r.namespace===n._config.namespace&&Array.isArray(r.nodes))return vx(n,xx(r.nodes),t),!0}catch(e){console.error(e)}return n()}],"text/html":[(e,t,n)=>{try{let n=Jf();return vx(n,Yb(n,new DOMParser().parseFromString(rx(e),`text/html`)),t),!0}catch(e){return console.error(e),n()}}],"text/plain":[ix],"text/uri-list":[ix]};function ox(e,t,n,r){if(!e)return!1;let i=(t,n,a)=>!!e[t]&&e[t](n,a,(e=n,r=a)=>i(t-1,e,r),r);return i(e.length-1,t,n)}function sx(e,t,n){let r=t.getData(`text/plain`);for(let i of function(e){return Object.keys(e.$importMimeType).filter(t=>e.$importMimeType[t]!==void 0).sort((t,n)=>{let r=e.priority[t],i=e.priority[n];return r===void 0&&i===void 0?t<n?-1:+(t>n):r===void 0?1:i===void 0?-1:r-i})}(e)){let a=t.getData(i);if(a&&(i!==`text/html`||a!==r)&&ox(e.$importMimeType[i],a,n,t))return!0}return!1}var cx={$importMimeType:ax,$insertDataTransfer:(e,t)=>sx({$importMimeType:ax,priority:nx},e,t),priority:nx},lx={build:(e,t)=>({$importMimeType:t.$importMimeType,$insertDataTransfer:(e,n)=>sx(t,e,n),priority:t.priority}),config:{$importMimeType:ax,priority:nx},mergeConfig(e,t){let n=fv(e,t);if(t.$importMimeType){let r={...e.$importMimeType};for(let[e,n]of Object.entries(t.$importMimeType))if(n){let t=r[e];r[e]=t?[...t,...n]:n}n.$importMimeType=r}return t.priority&&(n.priority={...e.priority,...t.priority}),n},name:`@lexical/clipboard/Import`};function ux(e,t=J()){return t??tx(166),q(t)&&t.isCollapsed()||t.getNodes().length===0?``:Zb(e,t)}function dx(e,t=J()){return t??tx(166),q(t)&&t.isCollapsed()||t.getNodes().length===0?null:JSON.stringify(bx(e,t))}function fx(e,t,n){(function(){let e=Db(lx.name);return e?e.output:cx})().$insertDataTransfer(e,t)}var px=`application/x-lexical-drag`;function mx(e,t){let n={editorKey:t.getKey()};e.setData(px,JSON.stringify(n))}function hx(e){let t=e;if(z_(t)){if(t.offset===0)t=Mu(t.getSiblingCaret());else{if(t.offset!==t.origin.getTextContentSize())return t;t=t.getSiblingCaret()}}for(;;){let e=t.getParentAtCaret();if(e===null||!e.isInline()||e.isShadowRoot())return t;if(V_(t))t=Mu(Y(e,`next`));else{if(t.getNodeAtCaret()!==null)return t;t=Y(e,`next`)}}}function gx(e,t,n){let r=e.dataTransfer;if(r===null)return!1;let i=function(e){let t=e.getData(px);if(!t)return null;let n;try{n=JSON.parse(t)}catch{return null}return(r=n)!==null&&typeof r==`object`&&`editorKey`in r&&typeof r.editorKey==`string`?n:null;var r}(r);if(i===null)return!1;let a=function(e,t){let n=ex(e.clientX,e.clientY,t.getRootElement());if(n===null)return null;let r=jd(n.node);if(r===null)return null;if(R(r))return G_(r,`next`,n.offset);let i=r.getParent();if(I(r)){let e=t.getElementByKey(r.getKey());if(e===null)return null;let a=Xf(r,e,t);return n.node===a.element||i?Bu(...a.resolveChildIndex(r,e,n.node,n.offset),`next`):null}return i&&Bu(i,r.getIndexWithinParent()+1,`next`)}(e,t);if(a===null)return!1;let o=i.editorKey===t.getKey(),s=J();if(o){if(!q(s)||s.isCollapsed())return!1;if(function(e,t){let{anchor:n,focus:r}=zu(ju(t),`next`),i=hx(e);return av(hx(n),i)<=0&&av(i,hx(r))<=0}(a,s))return e.preventDefault(),!0}let c=Lu(a),l=z_(c)?Ku(c):c;if(l===null)return!1;let u=l.getFlipped();o&&q(s)&&s.removeText();let d=l.origin.isAttached()?l:u;if(d.origin.isAttached()||tx(438),n(r,ku(nv(d)),t),!o){let e=t.getRootElement(),n=e?e.ownerDocument:null,r=n?function(e,t){for(let n of Of(t)){let t=md(n);if(fd(t)&&t.getKey()===e&&W(n))return n}return null}(i.editorKey,n):null;r!==null&&r.dispatchEvent(new InputEvent(`beforeinput`,{bubbles:!0,cancelable:!0,inputType:`deleteByDrag`}))}return e.preventDefault(),!0}function _x(e,t){return gx(e,t,fx)}function vx(e,t,n){e.dispatchCommand(Za,{nodes:t,selection:n})||(n.insertNodes(t),function(e){if(q(e)&&e.isCollapsed()){let t=e.anchor,n=null,r=Du(t,`previous`);if(r){if(z_(r))n=r.origin;else{let e=rv(r,J_(V(),`next`).getFlipped());for(let t of e){if(R(t.origin)){n=t.origin;break}if(I(t.origin)&&!t.origin.isInline())break}}}if(n&&R(n)){let t=n.getFormat(),r=n.getStyle();e.format===t&&e.style===r||(e.format=t,e.style=r,e.dirty=!0)}}}(n))}function yx(e,t,n,r=[]){let i=t===null||n.isSelected(t),a=I(n)&&n.excludeFromCopy(`clone`),o=n;t!==null&&R(o)&&(o=Hy(t,o,`clone`));let s=us(o),c=I(o)?o.getChildren():[],l=s.children||[];R(o)&&o.getTextContentSize()===0&&(i=!1);let u=i&&lg(t)&&I(n)?null:t;for(let r=0;r<c.length;r++){let a=c[r],o=yx(e,u,a,l);!i&&I(n)&&o&&n.extractWithChild(a,t,`clone`)&&(i=!0)}if(i&&!a){let t=y_(o);if(t.length>0){let n={};for(let r of t){let t=b_(o,r);t===null&&tx(366,o.constructor.name,r);let i=[];yx(e,null,t,i),(i.length!==1||I(t)&&t.excludeFromCopy(`clone`))&&tx(435,r,o.constructor.name,String(i.length)),n[r]=i[0]}s.$slots=n}}if(i&&!a)r.push(s);else for(let e=0;e<l.length;e++)r.push(l[e]);return i}function bx(e,t){let n=[],r=V(),i=__(t),a=(I(i)?i:r).getChildren();for(let r=0;r<a.length;r++)yx(e,t,a[r],n);return{namespace:e._config.namespace,nodes:n}}function xx(e){let t=[];for(let n of e)t.push(Um(n));return t}var Sx=null;async function Cx(e,t,n){if(Sx!==null)return!1;if(t!==null)return new Promise((r,i)=>{e.update(()=>{r(wx(e,t,n))})});let r=e.getRootElement(),i=e._window||window,a=i.document,o=Cf(i);if(r===null||o===null)return!1;let s=a.createElement(`span`);s.style.position=`fixed`,s.style.top=`-1000px`,s.append(a.createTextNode(`#`)),r.append(s);let c=a.createRange();return c.setStart(s,0),c.setEnd(s,1),o.removeAllRanges(),o.addRange(c),new Promise((t,r)=>{let o=e.registerCommand(Lo,r=>(mb(r,ClipboardEvent)&&(o(),Sx!==null&&(i.clearTimeout(Sx),Sx=null),t(wx(e,r,n))),!0),4);Sx=i.setTimeout(()=>{o(),Sx=null,t(!1)},50),a.execCommand(`copy`),s.remove()})}function wx(e,t,n){if(n===void 0){let t=Cf(e._window),r=J();if(!r||r.isCollapsed()||!t)return!1;let i=Nf(t,e.getRootElement()),a=i.anchorNode,o=i.focusNode;if(a!==null&&o!==null&&!dd(e,a,o))return!1;n=Ex(r)}t.preventDefault();let r=t.clipboardData;return r!==null&&(Dx(r,n),!0)}var Tx=[[`text/html`,ux],[`application/x-lexical-editor`,dx]];function Ex(e=J()){return function(e,t){let n={"text/plain":``};for(let[r,i]of Object.entries(e))if(i){let e=Ax(i,t);e!==null&&(n[r]=e)}return n}(Ox(),e)}function Dx(e,t){for(let[n]of Tx)t[n]===void 0&&e.setData(n,``);for(let n in t){let r=t[n];r!==void 0&&e.setData(n,r)}}function Ox(e=Jf()){let t=Iy(e,jx.name);return t?t.output:kx}var kx={"application/x-lexical-editor":[(e,t)=>e?dx(Jf(),e):t()],"text/html":[(e,t)=>e?ux(Jf(),e):t()],"text/plain":[(e,t)=>e?e.getTextContent():t()]};function Ax(e,t){let n=r=>e[r]?e[r](t,n.bind(null,r-1)):null;return n(e.length-1)}var jx={build:(e,t,n)=>t.$exportMimeType,config:{$exportMimeType:kx},mergeConfig(e,t){let n=fv(e,t);if(t.$exportMimeType){let r={...e.$exportMimeType};for(let[e,n]of Object.entries(t.$exportMimeType))if(n){let t=r[e];r[e]=t?[...t,...n]:n}n.$exportMimeType=r}return n},name:`@lexical/clipboard/GetClipboardData`},Mx=/^-?(?:0|[1-9]\d*)(?:\.\d+)?(?:[eE][+-]?\d+)?$/;function Nx(e,t){if(typeof e==`number`)return Number.isFinite(e)?e:t;if(typeof e!=`string`||!Mx.test(e))return t;let n=Number(e);return Number.isFinite(n)?n:t}function Px(e,t,n,r,i){let a=Nx(e,t);return a>=n&&a<=r&&Number.isInteger(a)?a:t}function Fx(e,t){e.__tag=t.__tag}var Ix=e=>{let t=Ns(e,`format`),n=Ps(e,`format`),r=Is(e,`format`);return{exportJSON:function(e){let n=e.__textFormat,r=e.__textStyle,i=(n!==0||r!==``)&&e.shouldSerializeTextStyles();return{children:[],tag:e.__tag,direction:e.__dir,format:t[e.__format],indent:e.__indent,textFormat:n!==0&&i?n:void 0,textStyle:r!==``&&i?r:void 0,type:e.__type,version:1}},exportCompactJSON:function(e){let n=e.__textFormat,r=e.__textStyle,i=(n!==0||r!==``)&&e.shouldSerializeTextStyles(),a={type:e.__type,children:[]},o=e.__tag;o!==void 0&&o!==`h1`&&(a.tag=o);let s=e.__dir;s!=null&&(a.direction=s);let c=t[e.__format];c!==void 0&&c!==``&&(a.format=c);let l=e.__indent;return l!==void 0&&l!==0&&(a.indent=l),n!==void 0&&n!==0&&i&&(a.textFormat=n),r!==void 0&&r!==``&&i&&(a.textStyle=r),a},updateFromJSON:function(e,t){let i=t.direction;e.__dir=i===null||i===`ltr`||i===`rtl`?i:null;let a=t.format;e.__format=typeof a==`string`&&a in n?n[a]:r,e.__indent=Px(t.indent,0,0,1/0),e.__textFormat=Nx(t.textFormat,0);let o=t.textStyle;e.__textStyle=typeof o==`string`?o:``;let s=t.tag;return e.__tag=s===`h1`||s===`h2`||s===`h3`||s===`h4`||s===`h5`||s===`h6`?s:`h1`,e},afterCloneFrom:Fx}},Lx=e=>{let t=Ns(e,`format`),n=Ps(e,`format`),r=Is(e,`format`);return{exportJSON:function(e){let n=e.__textFormat,r=e.__textStyle,i=(n!==0||r!==``)&&e.shouldSerializeTextStyles();return{children:[],direction:e.__dir,format:t[e.__format],indent:e.__indent,textFormat:n!==0&&i?n:void 0,textStyle:r!==``&&i?r:void 0,type:e.__type,version:1}},exportCompactJSON:function(e){let n=e.__textFormat,r=e.__textStyle,i=(n!==0||r!==``)&&e.shouldSerializeTextStyles(),a={type:e.__type,children:[]},o=e.__dir;o!=null&&(a.direction=o);let s=t[e.__format];s!==void 0&&s!==``&&(a.format=s);let c=e.__indent;return c!==void 0&&c!==0&&(a.indent=c),n!==void 0&&n!==0&&i&&(a.textFormat=n),r!==void 0&&r!==``&&i&&(a.textStyle=r),a},updateFromJSON:function(e,t){let i=t.direction;e.__dir=i===null||i===`ltr`||i===`rtl`?i:null;let a=t.format;e.__format=typeof a==`string`&&a in n?n[a]:r,e.__indent=Px(t.indent,0,0,1/0),e.__textFormat=Nx(t.textFormat,0);let o=t.textStyle;return e.__textStyle=typeof o==`string`?o:``,e}}},Rx=N(`DRAG_DROP_PASTE_FILE`),zx=lc(`shadowRoot`,{parse:Zs()}),Bx=class extends $l{$config(){return this.config(`quote`,{children:`inline`,extends:$l,generated:Lx,importDOM:{blockquote:()=>({conversion:qx,priority:0})},stateConfigs:[{flat:!0,stateConfig:zx}]})}isShadowRoot(){return uc(this,zx)}setIsShadowRoot(e){return dc(this,zx,e)}createDOM(e){let t=Af().createElement(`blockquote`);return mv(t,e.theme.quote),t}updateDOM(e,t,n){return!1}exportDOM(e){let{element:t}=super.exportDOM(e);if(W(t)){this.isEmpty()&&t.append(Af().createElement(`br`));let e=this.getFormatType();e&&(t.style.textAlign=e);let n=this.getDirection();n&&(t.dir=n)}return{element:t}}static importJSON(e){return Vx().updateFromJSON(e)}insertNewAfter(e,t){let n=z();n.setTextFormat(e.format),n.setTextStyle(e.style);let r=this.getDirection();return n.setDirection(r),n.setFormat(this.getFormatType()),n.setStyle(this.getStyle()),this.insertAfter(n,t),n}collapseAtStart(){if(this.isShadowRoot()){for(let e of this.getChildren())this.insertBefore(e);return this.remove(),!0}let e=z();return this.getChildren().forEach(t=>e.append(t)),this.replace(e),!0}canMergeWhenEmpty(){return!0}};function Vx(e){let t=vf(new Bx);return e&&e.shadowRoot?t.setIsShadowRoot(!0):t}function Hx(e){return e instanceof Bx}var Ux=tc()({tag:ic(Qs([`h1`,`h2`,`h3`,`h4`,`h5`,`h6`]),{field:`__tag`})}),Wx=class extends $l{__tag;$config(){return this.config(`heading`,{children:`inline`,extends:$l,generated:Ix,importDOM:{h1:()=>({conversion:Kx,priority:0}),h2:()=>({conversion:Kx,priority:0}),h3:()=>({conversion:Kx,priority:0}),h4:()=>({conversion:Kx,priority:0}),h5:()=>({conversion:Kx,priority:0}),h6:()=>({conversion:Kx,priority:0}),p:e=>{let t=e.firstChild;return t!==null&&Gx(t)?{conversion:()=>({node:null}),priority:3}:null},span:e=>Gx(e)?{conversion:()=>({node:Jx(`h1`)}),priority:3}:null},json:Ux})}constructor(e=`h1`,t){super(t),this.__tag=e}getTag(){return this.getLatest().__tag}setTag(e){let t=this.getWritable();return t.__tag=e,t}createDOM(e){let t=this.__tag,n=Af().createElement(t),r=e.theme.heading;if(r!==void 0){let e=r[t];mv(n,e)}return n}updateDOM(e,t,n){return e.__tag!==this.__tag}exportDOM(e){let{element:t}=super.exportDOM(e);if(W(t)){this.isEmpty()&&t.append(Af().createElement(`br`));let e=this.getFormatType();e&&(t.style.textAlign=e);let n=this.getDirection();n&&(t.dir=n)}return{element:t}}insertNewAfter(e,t=!0){let n=!this.getLastDescendant()||e&&Eb(e.anchor,this),r=e&&Tb(e.anchor,this),i=n||!e?z():Jx(this.getTag()).setFormat(this.getFormatType()).setStyle(this.getStyle()),a=this.getDirection();if(i.setDirection(a),this.insertAfter(i,t),r&&!this.isEmpty()){let e=z();e.select(),this.replace(e,!0)}return i}collapseAtStart(){if(this.isEmpty()){let e=z();this.getChildren().forEach(t=>e.append(t)),this.replace(e)}return!0}extractWithChild(){return!0}};function Gx(e){return e.nodeName.toLowerCase()===`span`&&e.style.fontSize===`26pt`}function Kx(e){let t=e.nodeName.toLowerCase(),n=null;return t!==`h1`&&t!==`h2`&&t!==`h3`&&t!==`h4`&&t!==`h5`&&t!==`h6`||(n=Jx(t),ip(e,n),op(n,e),ap(n,e)),{node:n}}function qx(e){let t=Vx();return op(t,e),ip(e,t),ap(t,e),{node:t}}function Jx(e=`h1`){return vf(new Wx(e))}function Yx(e){return e instanceof Wx}function Xx(e){return L(jd(e))&&!(W(e)&&e.hasAttribute(`data-lexical-slot`))}function Zx(e){let t=e.focus;return t.key===`root`&&t.offset===V().getChildrenSize()}function Qx(e){let t=e.focus;return t.key===`root`&&t.offset===0}function $x(e,t){if(!e.isCollapsed())return!1;let n=t===`next`;if(!(n?Zx(e):Qx(e)))return!1;let r=e.focus.offset;return xf(V().getChildAtIndex(n?r-1:r))}function eS(e,t,n,r){let i=!1,a=null;if(e.isCollapsed()&&e.anchor.type===`text`){let t=e.anchor.getNode();if(R(t)){a=t;let r=e.anchor.offset,o=r===t.getTextContentSize()&&t.getNextSibling()===null,s=r===0&&t.getPreviousSibling()===null;i=n===`end`&&o||n===`start`&&s||n===`both`&&(o||s)}}let o=!1;for(let[n,s]of Object.entries(r)){if(s==null||!s[t])continue;let r=n;if(s.onlyAtBoundary){if(!(i&&a&&R(a)&&a.hasFormat(r)))continue;o=!0}e.hasFormat(r)&&e.toggleFormat(r)}o&&e.setStyle(``)}var tS={capitalize:{enter:!0,space:!0,tab:!0},lowercase:{enter:!0,space:!0,tab:!0},uppercase:{enter:!0,space:!0,tab:!0}};function nS(e,t){return function(e,t){if(!e.isCollapsed())return!1;let n=Du(e.focus,t),r=G(n.origin,gf);if(!r)return!1;let i=e.focus.getNode();if(!r.is(i)&&!df(i,r))return!1;let a=rv(n,Y(r,t));if(a.getTextSlices().some(e=>e&&e.getTextContentSize()>0))return!1;let o=rv(a.anchor.getSiblingCaret(),a.focus),s=o.anchor.origin;for(let e of o){if(!B_(e)||!e.origin.is(s.getParent()))return!1;s=e.origin}let c=r;for(let e of tv(Y(r,t))){if(!e.origin.is(c.getParent())){if(xf(e.origin)){let e=Y(c,t);return ku(rv(e,e)),!0}break}if(!gf(e.origin))break;c=e.origin}return!1}(e,t)||function(e,t){if(!e.isCollapsed()||e.anchor.type!==`element`)return!1;let n=Du(e.anchor,t).getNodeAtCaret();return!(!gf(n)||n.isInline()||(ku(nv(Lu(J_(n,t)))),0))}(e,t)}function rS(e){return L(e)&&!e.isInline()&&!e.isIsolated()&&e.isKeyboardSelectable()}function iS(e){let t=Pg();t.add(e),Id(t)}function aS(e,t){if(!e.isCollapsed())return!1;let n=e.focus,r=n.getNode(),i=t?`previous`:`next`,a=Du(n,i);if(n.type===`element`&&I(r)&&U(r)){let e=a.getNodeAtCaret();return!(e===null||!rS(e)||(iS(e.__key),0))}let o=G(I(r)?r:r.getParentOrThrow(),e=>I(e)&&!e.isInline()&&U(e.getParent()));if(o===null)return!1;let s=Y(o,i).getNodeAtCaret();if(s===null||!rS(s))return!1;if(o.getTextContentSize()===0)return iS(s.__key),!0;let c=Jf().getRootElement();if(c===null)return!1;let l=Cf(c.ownerDocument.defaultView);if(l===null||l.rangeCount===0)return!1;let u=l.anchorNode,d=l.anchorOffset,f=l.focusNode,p=l.focusOffset;l.modify(`move`,t?`backward`:`forward`,`line`);let m=l.anchorNode,h=l.anchorOffset;if(m===null)return oS(l,u,d,f,p),!1;let g=jd(m);return oS(l,u,d,f,p),g!==null&&(m===u&&h===d||!g.is(o)&&!df(g,o))&&(iS(s.__key),!0)}function oS(e,t,n,r,i){t!==null&&r!==null&&e.setBaseAndExtent(t,n,r,i)}function sS(e,t){if(!e.isCollapsed())return!1;let n=e.focus.getNode(),r=G(I(n)?n:n.getParentOrThrow(),e=>I(e)&&!e.isInline());if(r===null)return!1;let i=Jf(),a=i.getRootElement();if(a===null)return!1;let o=a.ownerDocument.defaultView;if(o===null)return!1;let s=!1;for(let e of r.getChildren())if(I(e)&&e.isInline()){let t=i.getElementByKey(e.getKey());if(t!==null){let e=o.getComputedStyle(t).display;if(e===`inline-grid`||e===`inline-flex`){s=!0;break}}}if(!s)return!1;let c=Y(r,t?`previous`:`next`).getNodeAtCaret();if(c===null||!I(c)){if(t){let e=r.getFirstDescendant();R(e)?e.select(0,0):r.select(0,0)}else{let e=r.getLastDescendant();if(R(e)){let t=e.getTextContentSize();e.select(t,t)}else{let e=r.getChildrenSize();r.select(e,e)}}return!0}let l=i.getElementByKey(c.getKey());if(l===null)return!1;let u=Cf(o);if(u===null||u.rangeCount===0)return!1;let d=u.getRangeAt(0).cloneRange();d.collapse(!0);let f=d.getBoundingClientRect(),p=l.getBoundingClientRect(),m=p.top+p.height/2;if(f.height>0){let t=ex(f.left,m,a);if(t!==null&&l.contains(t.node)){let n=a.ownerDocument.createRange();return n.setStart(t.node,t.offset),n.collapse(!0),e.applyDOMRange(n),e.dirty=!0,!0}}let h=t?c.getLastDescendant():c.getFirstDescendant();if(R(h)){let e=t?h.getTextContentSize():0;h.select(e,e)}else{let e=c.getChildrenSize();c.select(t?e:0,t?e:0)}return!0}function cS(e,t){let n=Y(e,t),r=n.getAdjacentCaret();r!==null&&I(r.origin)&&!r.origin.isInline()&&r.origin.isShadowRoot()?ku(nv(n)):t===`next`?e.selectNext(0,0):e.selectPrevious()}function lS(e,t){let n=e.getNodes().map(e=>Y(e,`next`)).sort(av),r=n[0],i=n[n.length-1];if(!r||!i)return!1;for(let e=0;e<n.length-1;e++)if(!n[e+1].origin.is(n[e].getNodeAtCaret()))return!1;return ku(zu(rv(Mu(r),i),t)),Qm(),!0}function uS(e,t,n){n.preventDefault(),n.stopPropagation();let r=e.getNodes();if(r.length===0)return!0;let i=r.map(e=>Y(e,`next`)).sort(av),a=(t?i[0]:i[i.length-1]).origin,o=G(a,e=>e!==a&&I(e)&&!e.isInline())??V(),s=t?0:o.getChildrenSize();return o.select(s,s),!0}function dS(e,t){return e.length>0&&!t}function fS(e,t=_y(tS),n=_y(dS)){return th(e.registerCommand(Qa,n=>{let r=J();if(lg(r)){let t=n.target;if(W(t))for(let n of r.getNodes()){let r=e.getElementByKey(n.getKey());if(r!==null&&r.contains(t))return!1}return r.clear(),!0}return q(r)&&eS(r,`click`,`both`,t.peek()),!1},0),e.registerCommand(ro,e=>{let t=J();return q(t)?(t.deleteCharacter(e),!0):!!lg(t)&&(t.deleteNodes(),!0)},0),e.registerCommand(lo,e=>{let t=J();return!!q(t)&&(t.deleteWord(e),!0)},0),e.registerCommand(uo,e=>{let t=J();return!!q(t)&&(t.deleteLine(e),!0)},0),e.registerCommand(oo,t=>{let n=J();if(typeof t==`string`)n!==null&&n.insertText(t);else{if(n===null)return!1;let r=t.dataTransfer;if(r!=null)fx(r,n,e);else if(q(n)){let e=t.data;return e&&n.insertText(e),!0}}return!0},0),e.registerCommand(co,()=>{let e=J();return!!q(e)&&(e.removeText(),!0)},0),e.registerCommand(fo,e=>{let t=J();return!(!q(t)&&!lg(t)||(pg(t,e),0))},0),e.registerCommand(po,e=>{let t=J();return!(!q(t)&&!lg(t)||(fg(t,e),0))},0),e.registerCommand(No,e=>{let t=J();if(!q(t)&&!lg(t))return!1;let n=t.getNodes();for(let t of n){let n=G(t,e=>I(e)&&!e.isInline());n!==null&&n.setFormat(e)}return!0},0),e.registerCommand(io,e=>{let t=J();return!!q(t)&&(t.insertLineBreak(e),!0)},0),e.registerCommand(ao,()=>{let e=J();return!!q(e)&&(e.insertParagraph(),!0)},0),e.registerCommand(ko,()=>{let e=ed(),t=J();return q(t)&&(e.setFormat(t.format),e.setStyle(t.style)),qg([e]),!0},0),e.registerCommand(Ao,()=>gb(e=>{let t=e.getIndent();e.setIndent(t+1)}),0),e.registerCommand(jo,()=>gb(e=>{let t=e.getIndent();t>0&&e.setIndent(Math.max(0,t-1))}),0),e.registerCommand(xo,e=>{let t=J();if(lg(t)){let n=t.getNodes();if(n.length>0){if(!e.shiftKey||!lS(t,`previous`))return e.preventDefault(),cS(n[0],`previous`),!0;t=J()}}return q(t)&&(Qx(t)||!e.shiftKey&&nS(t,`previous`)||!e.shiftKey&&aS(t,!0)||!e.shiftKey&&sS(t,!0))?(e.preventDefault(),!0):!1},0),e.registerCommand(So,e=>{let t=J();if(lg(t)){let n=t.getNodes();if(n.length>0){if(!e.shiftKey||!lS(t,`next`))return e.preventDefault(),cS(n[0],`next`),!0;t=J()}}return q(t)&&(Zx(t)||!e.shiftKey&&nS(t,`next`)||!e.shiftKey&&aS(t,!1)||!e.shiftKey&&sS(t,!1))?(e.preventDefault(),!0):!1},0),e.registerCommand(yo,e=>{let n=J();if(lg(n)){let t=n.getNodes();if(t.length>0){let r=Vy(t[0])?`next`:`previous`;if(!e.shiftKey||!lS(n,r))return e.preventDefault(),cS(t[0],r),!0;n=J()}}if(!q(n))return!1;let r=Vy(n.anchor.getNode())?`next`:`previous`;if($x(n,r)||!e.shiftKey&&nS(n,r))return e.preventDefault(),!0;if(e.shiftKey||eS(n,`arrow`,`start`,t.peek()),Qy(n,!0)){let t=e.shiftKey;return e.preventDefault(),tb(n,t,!0),!0}return!1},0),e.registerCommand(_o,e=>{let n=J();if(lg(n)){let t=n.getNodes();if(t.length>0){let r=Vy(t[0])?`previous`:`next`;if(!e.shiftKey||!lS(n,r))return e.preventDefault(),cS(t[0],r),!0;n=J()}}if(!q(n))return!1;let r=Vy(n.anchor.getNode())?`previous`:`next`;if($x(n,r)||!e.shiftKey&&nS(n,r))return e.preventDefault(),!0;if(e.shiftKey||eS(n,`arrow`,`end`,t.peek()),Qy(n,!1)){let t=e.shiftKey;return e.preventDefault(),tb(n,t,!1),!0}return!1},0),e.registerCommand(To,t=>{let n=J();if(!lg(n)&&Xx(t.target))return!1;if(q(n)){if(function(e){if(!e.isCollapsed())return!1;let{anchor:t}=e;if(t.offset!==0)return!1;let n=t.getNode();if(iu(n))return!1;let r=fb(n);return r.getIndent()>0&&(r.is(n)||n.is(r.getFirstDescendant()))}(n))return t.preventDefault(),e.dispatchCommand(jo);if(ka&&Da)return!1}else if(!lg(n))return!1;return t.preventDefault(),e.dispatchCommand(ro,!0)},0),e.registerCommand(Do,t=>{let n=J();return!(!lg(n)&&Xx(t.target))&&!(!q(n)&&!lg(n))&&(t.preventDefault(),e.dispatchCommand(ro,!1))},0),e.registerCommand(Co,n=>{let r=J();if(lg(r)){let e=r.getNodes();e.length===1&&L(e[0])&&!e[0].isInline()&&(r=e[0].selectNext())}if(!q(r))return!1;if(eS(r,`enter`,`both`,t.peek()),n!==null){if((ka||ja||Pa)&&Da)return!1;if(n.preventDefault(),n.shiftKey)return e.dispatchCommand(io,!1)}return e.dispatchCommand(ao)},0),e.registerCommand(Eo,()=>!!q(J())&&(e.blur(),!0),0),e.registerCommand(Mo,t=>{let[,n]=hb(t);if(n.length>0){let r=t.clientX,i=t.clientY,a=ex(r,i,e.getRootElement());if(a!==null){let{offset:e,node:t}=a,n=jd(t);if(n!==null){let t=Ng();if(R(n))t.anchor.set(n.getKey(),e,`text`),t.focus.set(n.getKey(),e,`text`);else{let e=n.getParentOrThrow().getKey(),r=n.getIndexWithinParent()+1;t.anchor.set(e,r,`element`),t.focus.set(e,r,`element`)}Id(Al(t))}}return!(!e.dispatchCommand(Rx,n)&&ka&&n.every(e=>e.type===`text/plain`)||(t.preventDefault(),0))}return _x(t,e)},0),e.registerCommand(Po,t=>{let[n]=hb(t),r=J();return!(n&&!q(r)||(q(r)&&!r.isCollapsed()&&t.dataTransfer!==null&&(Dx(t.dataTransfer,Ex(r)),mx(t.dataTransfer,e)),0))},0),e.registerCommand(Fo,t=>{let[n]=hb(t),r=J();if(n&&!q(r))return!1;let i=t.clientX,a=t.clientY,o=ex(i,a,e.getRootElement());return o!==null&&L(jd(o.node))&&t.preventDefault(),!0},0),e.registerCommand(zo,()=>{let e=J();return Yd(q(e)&&g_(e.anchor.getNode())!==null?e:null),!0},0),e.registerCommand(Lo,t=>!ud(t)&&(Cx(e,mb(t,ClipboardEvent)?t:null),!0),0),e.registerCommand(Ro,t=>!ud(t)&&(async function(e,t){t.update(()=>{let e=J();q(e)&&!e.isCollapsed()&&mg(e)},{discrete:!0,tag:`cut`}),await Cx(t,mb(e,ClipboardEvent)?e:null),t.update(()=>{let e=J();q(e)?e.removeText():lg(e)&&e.getNodes().forEach(e=>e.remove())},{tag:`cut`})}(t,e),!0),0),e.registerCommand(so,t=>{let[,r,i]=hb(t);return!(!n.peek()(r,i)||!e.dispatchCommand(Rx,r))||!ud(t)&&J()!==null&&(function(e,t){e.preventDefault(),t.update(()=>{let n=J(),r=mb(e,InputEvent)||mb(e,KeyboardEvent)?null:e.clipboardData;r!=null&&n!==null&&fx(r,n,t)},{tag:`paste`})}(t,e),!0)},0),e.registerCommand(wo,()=>{let e=J();return q(e)&&eS(e,`space`,`both`,t.peek()),!1},0),e.registerCommand(Oo,()=>{let e=J();return q(e)&&eS(e,`tab`,`both`,t.peek()),!1},0),e.registerCommand(vo,e=>{let t=J();if(lg(t))return uS(t,!1,e);if(!q(t))return!1;let{anchor:n}=t;if(n.type!==`element`||n.offset!==0)return!1;let r=n.getNode();if(!I(r))return!1;let i=r.getFirstChild();if(!L(i)||!i.isInline())return!1;let a=r.getKey(),o=r.selectEnd();return e.shiftKey&&o.anchor.set(a,0,`element`),e.preventDefault(),e.stopPropagation(),!0},0),e.registerCommand(bo,e=>{let t=J();if(lg(t))return uS(t,!0,e);if(!q(t))return!1;let{anchor:n,focus:r}=t,i=G(r.getNode(),e=>I(e)&&!e.isInline());if(i===null)return!1;let a=i.getFirstChild();if(!L(a)||!a.isInline()||G(n.getNode(),e=>I(e)&&!e.isInline())!==i)return!1;let o=i.getKey();return(r.type!==`element`||r.key!==o||r.offset!==0)&&(t.focus.set(o,0,`element`),e.shiftKey||t.anchor.set(o,0,`element`),e.preventDefault(),e.stopPropagation(),!0)},0))}function pS(e,...t){throw function(e,...t){let n=new URL(`https://lexical.dev/docs/error`),r=new URLSearchParams;r.append(`code`,e);for(let e of t)r.append(`v`,e);return n.search=r.toString(),Error(`Minified Lexical error #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}(e,...t)}function mS({editor:e,ErrorBoundary:t}){return function(e,t){let[n,r]=(0,A.useMemo)(()=>[t=>e.registerDecoratorListener(t),()=>e.getDecorators()],[e]),i=(0,A.useSyncExternalStore)(n,r,r),a=function(e){let[t,n]=(0,A.useMemo)(()=>[e.registerRootListener.bind(e),e.getRootElement.bind(e)],[e]);return(0,A.useSyncExternalStore)(t,n,n)}(e);return(0,A.useMemo)(()=>{let n=t=>e._onError(t),r=[];for(let a in i){let o=e.getElementByKey(a);if(o!==null){let e=(0,j.jsx)(t,{onError:n,children:(0,j.jsx)(A.Suspense,{fallback:null,children:i[a]})});r.push((0,ui.createPortal)(e,o,a))}}return r},[t,i,e,a])}(e,t)}function hS({editor:e,ErrorBoundary:t}){return function(e){let t=ny.maybeFromEditor(e);if(t&&t.hasExtensionByName(ry.name)){for(let e of[`@lexical/plain-text`,`@lexical/rich-text`])t.hasExtensionByName(e)&&pS(320,e);return!0}return!1}(e)?null:(0,j.jsx)(mS,{editor:e,ErrorBoundary:t})}var gS=ya?A.useLayoutEffect:A.useEffect;function _S(e){return e.read(`latest`,wv(e.isComposing()))}function vS({contentEditable:e,placeholder:t=null,ErrorBoundary:n}){let[r]=ha();return function(e){gS(()=>th(fS(e),Py(e)),[e])}(r),(0,j.jsxs)(j.Fragment,{children:[e,(0,j.jsx)(yS,{content:t}),(0,j.jsx)(hS,{editor:r,ErrorBoundary:n})]})}function yS({content:e}){let[t]=ha(),n=function(e){let[t,n]=(0,A.useState)(()=>_S(e));return gS(()=>{function t(){let t=_S(e);n(t)}return t(),th(e.registerUpdateListener(()=>{t()}),e.registerEditableListener(()=>{t()}))},[e]),t}(t),r=Lv();return n?typeof e==`function`?e(r):e:null}var bS=`system-ui, -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI Variable", "Segoe UI", "Microsoft YaHei UI", "Microsoft YaHei", Tahoma, Arial, sans-serif`,xS=/^-?(?:0|[1-9]\d*)(?:\.\d+)?(?:[eE][+-]?\d+)?$/;function SS(e,t){if(typeof e==`number`)return Number.isFinite(e)?e:t;if(typeof e!=`string`||!xS.test(e))return t;let n=Number(e);return Number.isFinite(n)?n:t}function CS(e,t,n,r,i){let a=SS(e,t);return a>=n&&a<=r&&Number.isInteger(a)?a:t}function wS(e,t){e.__rel=t.__rel,e.__target=t.__target,e.__title=t.__title,e.__url=t.__url}var TS=e=>{let t=Ns(e,`format`),n=Ps(e,`format`),r=Is(e,`format`);return{exportJSON:function(e){let n=e.__textFormat,r=e.__textStyle,i=(n!==0||r!==``)&&e.shouldSerializeTextStyles();return{children:[],rel:e.__rel,target:e.__target,title:e.__title,url:e.__url,direction:e.__dir,format:t[e.__format],indent:e.__indent,textFormat:n!==0&&i?n:void 0,textStyle:r!==``&&i?r:void 0,type:e.__type,version:1}},exportCompactJSON:function(e){let n=e.__textFormat,r=e.__textStyle,i=(n!==0||r!==``)&&e.shouldSerializeTextStyles(),a={type:e.__type,children:[]},o=e.__rel;o!=null&&(a.rel=o);let s=e.__target;s!=null&&(a.target=s);let c=e.__title;c!=null&&(a.title=c);let l=e.__url;l!==void 0&&l!==``&&(a.url=l);let u=e.__dir;u!=null&&(a.direction=u);let d=t[e.__format];d!==void 0&&d!==``&&(a.format=d);let f=e.__indent;return f!==void 0&&f!==0&&(a.indent=f),n!==void 0&&n!==0&&i&&(a.textFormat=n),r!==void 0&&r!==``&&i&&(a.textStyle=r),a},updateFromJSON:function(e,t){let i=t.direction;e.__dir=i===null||i===`ltr`||i===`rtl`?i:null;let a=t.format;e.__format=typeof a==`string`&&a in n?n[a]:r,e.__indent=CS(t.indent,0,0,1/0),e.__textFormat=SS(t.textFormat,0);let o=t.textStyle;e.__textStyle=typeof o==`string`?o:``;let s=t.rel;e.__rel=typeof s==`string`&&s!==``?s:null;let c=t.target;e.__target=typeof c==`string`&&c!==``?c:null;let l=t.title;e.__title=typeof l==`string`&&l!==``?l:null;let u=t.url;return e.__url=typeof u==`string`?u:``,e},afterCloneFrom:wS}};function ES(e,t){e.__isUnlinked=t.__isUnlinked}var DS=e=>{let t=Ns(e,`format`),n=Ps(e,`format`),r=Is(e,`format`);return{exportJSON:function(e){let n=e.__textFormat,r=e.__textStyle,i=(n!==0||r!==``)&&e.shouldSerializeTextStyles();return{children:[],isUnlinked:e.__isUnlinked,rel:e.__rel,target:e.__target,title:e.__title,url:e.__url,direction:e.__dir,format:t[e.__format],indent:e.__indent,textFormat:n!==0&&i?n:void 0,textStyle:r!==``&&i?r:void 0,type:e.__type,version:1}},exportCompactJSON:function(e){let n=e.__textFormat,r=e.__textStyle,i=(n!==0||r!==``)&&e.shouldSerializeTextStyles(),a={type:e.__type,children:[]},o=e.__isUnlinked;o!==void 0&&!1!==o&&(a.isUnlinked=o);let s=e.__rel;s!=null&&(a.rel=s);let c=e.__target;c!=null&&(a.target=c);let l=e.__title;l!=null&&(a.title=l);let u=e.__url;u!==void 0&&u!==``&&(a.url=u);let d=e.__dir;d!=null&&(a.direction=d);let f=t[e.__format];f!==void 0&&f!==``&&(a.format=f);let p=e.__indent;return p!==void 0&&p!==0&&(a.indent=p),n!==void 0&&n!==0&&i&&(a.textFormat=n),r!==void 0&&r!==``&&i&&(a.textStyle=r),a},updateFromJSON:function(e,t){let i=t.direction;e.__dir=i===null||i===`ltr`||i===`rtl`?i:null;let a=t.format;e.__format=typeof a==`string`&&a in n?n[a]:r,e.__indent=CS(t.indent,0,0,1/0),e.__textFormat=SS(t.textFormat,0);let o=t.textStyle;e.__textStyle=typeof o==`string`?o:``;let s=t.rel;e.__rel=typeof s==`string`&&s!==``?s:null;let c=t.target;e.__target=typeof c==`string`&&c!==``?c:null;let l=t.title;e.__title=typeof l==`string`&&l!==``?l:null;let u=t.url;e.__url=typeof u==`string`?u:``;let d=t.isUnlinked;return e.__isUnlinked=typeof d==`boolean`&&d,e},afterCloneFrom:ES}},OS=new Set([`http:`,`https:`,`mailto:`,`sms:`,`tel:`]),kS=tc()({rel:ic($s(Js(),{defaultAsNull:!0}),{field:`__rel`}),target:ic($s(Js(),{defaultAsNull:!0}),{field:`__target`}),title:ic($s(Js(),{defaultAsNull:!0}),{field:`__title`}),url:ic(Js(),{field:`__url`,getter:`getURL`,setter:`setURL`})}),AS=class extends $l{__url;__target;__rel;__title;$config(){return this.config(`link`,{children:`inline`,extends:$l,generated:TS,importDOM:{a:()=>({conversion:FS,priority:1})},inline:!0,json:kS,mergeAdjacent:{by:[`url`,`target`,`rel`,`title`]}})}constructor(e=``,t={},n){super(n);let{target:r=null,rel:i=null,title:a=null}=t;this.__url=e,this.__target=r,this.__rel=i,this.__title=a}createDOM(e){let t=Af().createElement(`a`);return this.updateLinkDOM(null,t,e),mv(t,e.theme.link),t}updateLinkDOM(e,t,n){if(Bf(t)){e&&e.__url===this.__url||(t.href=this.sanitizeUrl(this.__url));for(let n of[`target`,`rel`,`title`]){let r=`__${n}`,i=this[r];e&&e[r]===i||(i?t[n]=i:t.removeAttribute(n))}}}updateDOM(e,t,n){return this.updateLinkDOM(e,t,n),!1}sanitizeUrl(e){let t=e;e=KS(e);try{let t=new URL(KS(e));if(!OS.has(t.protocol))return`about:blank`}catch{let e=t.replace(/[\u0000-\u001F\u007F\s]/g,``).match(/^([a-z][a-z0-9+.-]*):/i);if(e!=null&&!OS.has(`${e[1].toLowerCase()}:`))return`about:blank`}return e}getURL(){return this.getLatest().__url}setURL(e){let t=this.getWritable();return t.__url=e,t}getTarget(){return this.getLatest().__target}setTarget(e){let t=this.getWritable();return t.__target=e,t}getRel(){return this.getLatest().__rel}setRel(e){let t=this.getWritable();return t.__rel=e,t}getTitle(){return this.getLatest().__title}setTitle(e){let t=this.getWritable();return t.__title=e,t}insertNewAfter(e,t=!0){let n=_f(this);return this.insertAfter(n,t),n}canInsertTextBefore(){return!1}canInsertTextAfter(){return!1}canBeEmpty(){return!1}isInline(){return!0}extractWithChild(e,t,n){if(!q(t))return!1;let r=t.anchor.getNode(),i=t.focus.getNode();return(this.is(r)||this.isParentOf(r))&&(this.is(i)||this.isParentOf(i))&&t.getTextContent().length>0}isEmailURI(){return this.getURL().startsWith(`mailto:`)}isWebSiteURI(){let e=this.getURL();return e.startsWith(`https://`)||e.startsWith(`http://`)}shouldMergeAdjacentLink(e){return this.getType()===e.getType()&&this.getURL()===e.getURL()&&this.getTarget()===e.getTarget()&&this.getRel()===e.getRel()&&this.getTitle()===e.getTitle()}};function jS(e){let t=Du(e,`next`);return[t,t.getFlipped()]}function MS(e,t){for(let n of t)if(n.origin.isAttached()){Ou(e,Lu(n));return}}function NS(e,t){let n=e.constructor;return t.constructor===n&&Kl(Jf())&&Gl(n).declaredBy.mergeAdjacent===n}function PS(e){let t=J(),n=null,r=null;function i(){q(t)&&(MS(t.anchor,n),MS(t.focus,r),Al(t))}q(t)&&(n=jS(t.anchor),r=jS(t.focus));let a=!1,o=!Kl(Jf());for(let t of o?J_(e,`next`):[]){let n=t.origin;if(I(n)&&!n.isInline()){let r=n.getChildren();if(r.length>0){let t=_f(e);t.append(...r),n.append(t),a=!0}qu(n,Mu(t),{$shouldSplit:()=>!1})}}function s(e,t,n){let[r,i]=e,a=e=>B_(e)&&e.origin.is(t);if(!a(r)&&!a(i))return e;let o=Lu(J_(n,`next`));return[o,o.getFlipped()]}if(e.isAttached()){let t=e.getPreviousSibling();if(LS(t)&&!NS(t,e)&&t.shouldMergeAdjacentLink(e))return n&&=s(n,t,e),r&&=s(r,t,e),t.append(...e.getChildren()),e.remove(),void i();let o=e.getNextSibling();LS(o)&&!NS(e,o)&&e.shouldMergeAdjacentLink(o)&&(n&&=s(n,e,o),r&&=s(r,e,o),e.append(...o.getChildren()),o.remove(),a=!0)}if(a){if(!e.canBeEmpty()&&e.isEmpty()){let t=e.getParent();e.remove(),t&&t.isEmpty()&&t.remove()}i()}}function FS(e){let t=null;if(Bf(e)){let n=e.textContent;(n!==null&&n!==``||e.children.length>0)&&(t=IS(e.getAttribute(`href`)||``,{rel:e.getAttribute(`rel`),target:e.getAttribute(`target`),title:e.getAttribute(`title`)}))}return{node:t}}function IS(e=``,t){return vf(new AS(e,t))}function LS(e){return e instanceof AS}var RS=tc()({isUnlinked:ic(Zs(),{field:`__isUnlinked`})}),zS=class extends AS{__isUnlinked;constructor(e=``,t={},n){super(e,t,n),this.__isUnlinked=t.isUnlinked!==void 0&&t.isUnlinked!==null&&t.isUnlinked}$config(){return this.config(`autolink`,{extends:AS,generated:DS,json:RS,mergeAdjacent:!1})}shouldMergeAdjacentLink(e){return!1}getIsUnlinked(){return this.getLatest().__isUnlinked}setIsUnlinked(e){let t=this.getWritable();return t.__isUnlinked=e,t}createDOM(e){return this.__isUnlinked?Af().createElement(`span`):super.createDOM(e)}updateDOM(e,t,n){return super.updateDOM(e,t,n)||e.__isUnlinked!==this.__isUnlinked}};function BS(e=``,t){return vf(new zS(e,t))}function VS(e){return e instanceof zS}var HS=N(`TOGGLE_LINK_COMMAND`);function US(e,t){if(e.type===`element`){let n=e.getNode();return I(n)||function(e,...t){throw function(e,...t){let n=new URL(`https://lexical.dev/docs/error`),r=new URLSearchParams;r.append(`code`,e);for(let e of t)r.append(`v`,e);return n.search=r.toString(),Error(`Minified Lexical error #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}(e,...t)}(252),n.getChildren()[e.offset+t]||null}return null}function WS(e,t={}){let n;if(e&&typeof e==`object`){let{url:r,...i}=e;n=r,t={...i,...t}}else n=e;let{target:r,title:i}=t,a=t.rel===void 0?`noreferrer`:t.rel,o=J();if(o===null||!q(o)&&!lg(o))return;if(lg(o)){let e=o.getNodes();if(e.length===0)return;e.forEach(e=>{if(n===null){let t=G(e,e=>!VS(e)&&LS(e));t&&(t.insertBefore(e),t.getChildren().length===0&&t.remove())}else{let t=G(e,e=>!VS(e)&&LS(e));if(t)t.setURL(n),r!==void 0&&t.setTarget(r),a!==void 0&&t.setRel(a),i!==void 0&&t.setTitle(i);else{let t=IS(n,{rel:a,target:r,title:i});e.insertBefore(t),t.append(e)}}});return}if(o.isCollapsed()&&n===null)for(let e of o.getNodes()){let t=G(e,e=>!VS(e)&&LS(e));t!==null&&(t.getParentOrThrow().splice(t.getIndexWithinParent(),0,t.getChildren()),t.remove());return}let s=o.extract();if(n===null){let e=new Set;s.forEach(t=>{let n=G(t,e=>!VS(e)&&LS(e));if(n!==null){let t=n.getKey();if(e.has(t))return;(function(e,t){let n=new Set(t.filter(t=>e.isParentOf(t)).map(e=>e.getKey())),r=e.getChildren(),i=r=>n.has(r.getKey())||I(r)&&t.some(t=>e.isParentOf(t)&&r.isParentOf(t)),a=r.filter(i);if(a.length===0&&r.length>0)return;if(a.length===r.length)return r.forEach(t=>e.insertBefore(t)),void e.remove();let o=r.findIndex(i),s=r.findLastIndex(i),c=o===0,l=s===r.length-1;if(c)a.forEach(t=>e.insertBefore(t));else if(l)for(let t=a.length-1;t>=0;t--)e.insertAfter(a[t]);else{for(let t=a.length-1;t>=0;t--)e.insertAfter(a[t]);let t=r.slice(s+1);if(t.length>0){let n=_f(e);a[a.length-1].insertAfter(n),t.forEach(e=>n.append(e))}}})(n,s),e.add(t)}});return}let c=new Set,l=e=>{c.has(e.getKey())||(c.add(e.getKey()),e.setURL(n),r!==void 0&&e.setTarget(r),a!==void 0&&e.setRel(a),i!==void 0&&e.setTitle(i))};if(s.length===1){let e=s[0],t=G(e,LS);if(t!==null)return l(t)}(function(e){let t=J();if(!q(t))return e();let n=Al(t),r=n.isBackward(),i=US(n.anchor,r?-1:0),a=US(n.focus,r?0:-1);if(e(),i||a){let e=J();if(q(e)){let t=e.clone();if(i){let e=i.getParent();e&&t.anchor.set(e.getKey(),i.getIndexWithinParent()+ +!!r,`element`)}if(a){let e=a.getParent();e&&t.focus.set(e.getKey(),a.getIndexWithinParent()+ +!r,`element`)}Id(Al(t))}}})(()=>{let e=null;for(let t of s){if(!t.isAttached())continue;let o=G(t,LS);if(o){l(o);continue}if(I(t)){if(!t.isInline())continue;if(LS(t)){if(!(VS(t)||e!==null&&e.getParentOrThrow().isParentOf(t))){l(t),e=t;continue}for(let e of t.getChildren())t.insertBefore(e);t.remove();continue}}let s=t.getPreviousSibling();LS(s)&&s.is(e)?s.append(t):(e=IS(n,{rel:a,target:r,title:i}),t.insertAfter(e),e.append(t))}})}var GS=/^\+?[0-9\s()-]{5,}$/;function KS(e){return e.match(/^[a-z][a-z0-9+.-]*:/i)||e.match(/^[/#.]/)?e:e.includes(`@`)?`mailto:${e}`:GS.test(e)?`tel:${e}`:`https://${e}`}function qS(e,t){return th(e.registerNodeTransform(AS,PS),e.registerCommand(HS,e=>{let n=t.validateUrl.peek(),r=t.attributes.peek();if(e===null)return WS(null),!0;if(typeof e==`string`)return!(n!==void 0&&!n(e)||(WS(e,r),0));{let{url:t,...i}=e;return!(n!==void 0&&!n(t)||(WS(t,{...r,...i}),0))}},0),Ey(()=>{let n=t.validateUrl.value;if(!n)return;let r=t.attributes.value;return e.registerCommand(so,t=>{let i=J();if(!q(i)||i.isCollapsed()||!mb(t,ClipboardEvent)||t.clipboardData===null)return!1;let a=t.clipboardData.getData(`text`);return!!n(a)&&!i.getNodes().some(e=>I(e)||R(e)&&!e.isSimpleText())&&(e.dispatchCommand(HS,{...r,url:a}),t.preventDefault(),!0)},1)}))}function JS(e,t=e=>e){return n=>{let r=e.exec(n);return r===null?null:{index:r.index,length:r[0].length,text:r[0],url:t(r[0])}}}function YS(e,t){for(let n=0;n<t.length;n++){let r=t[n](e);if(r)return r}return null}var XS=/[.,;\s]/;function ZS(e,t){return t.test(e)}function QS(e,t){return ZS(e[e.length-1],t)}function $S(e,t){return ZS(e[0],t)}function eC(e,t){let n=e.getPreviousSibling();return I(n)&&(n=n.getLastDescendant()),n===null||lm(n)||R(n)&&QS(n.getTextContent(),t)}function tC(e,t){let n=e.getNextSibling();return I(n)&&(n=n.getFirstDescendant()),n===null||lm(n)||R(n)&&$S(n.getTextContent(),t)}function nC(e,t,n,r,i){return!!(e>0?ZS(r[e-1],n):eC(i[0],n))&&(t<r.length?ZS(r[t],n):tC(i[i.length-1],n))}function rC(e,t,n){let r=[],i=[],a=[],o=0,s=0,c=[...e];for(;c.length>0;){let e=c[0],l=e.getTextContent().length,u=s;s+l<=t?(r.push(e),o+=l):u>=n?a.push(e):i.push(e),s+=l,c.shift()}return[o,r,i,a]}function iC(e,t,n,r){let i=BS(r.url,r.attributes);if(e.length===1){let a,o=e[0];t===0?[a,o]=o.splitText(n):[,a,o]=o.splitText(t,n);let s=Tu(r.text);return s.setFormat(a.getFormat()),s.setDetail(a.getDetail()),s.setStyle(a.getStyle()),i.append(s),a.replace(i),o}if(e.length>1){let r=e[0],a,o=r.getTextContent().length;t===0?a=r:[,a]=r.splitText(t);let s=[],c;for(let t=1;t<e.length;t++){let r=e[t],i=r.getTextContent().length,a=o;if(a<n){if(o+i<=n)s.push(r);else{let[e,t]=r.splitText(n-a);s.push(e),c=t}}o+=i}let l=J(),u=l?l.getNodes().find(R):void 0,d=Tu(a.getTextContent());return d.setFormat(a.getFormat()),d.setDetail(a.getDetail()),d.setStyle(a.getStyle()),i.append(d,...s),u&&u===a&&(q(l)?d.select(l.anchor.offset,l.focus.offset):lg(l)&&d.select(0,d.getTextContent().length)),a.replace(i),c}}function aC(e,t,n,r){let i=e.getChildren(),a=i.length;for(let t=0;t<a;t++){let r=i[t];if(!R(r)||!r.isSimpleText())return oC(e),void n(null,e.getURL())}let o=e.getTextContent(),s=YS(o,t);if(s===null||s.text!==o||!eC(e,r)||!tC(e,r))return oC(e),void n(null,e.getURL());let c=e.getURL();c!==s.url&&(e.setURL(s.url),n(s.url,c)),s.attributes&&(e.getRel()!==s.attributes.rel&&e.setRel(s.attributes.rel||null),e.getTarget()!==s.attributes.target&&e.setTarget(s.attributes.target||null),e.getTitle()!==s.attributes.title&&e.setTitle(s.attributes.title||null))}function oC(e){let t=e.getChildren();for(let n=t.length-1;n>=0;n--)e.insertAfter(t[n]);return e.remove(),t.map(e=>e.getLatest())}var sC={changeHandlers:[],excludeParents:[],matchers:[],separatorRegex:XS};function cC(e,t=sC){let{matchers:n,changeHandlers:r,excludeParents:i,separatorRegex:a=XS}=t,o=(e,t)=>{for(let n of r)n(e,t)};return th(e.registerNodeTransform(gu,e=>{let t=e.getParentOrThrow(),r=e.getPreviousSibling();VS(t)?aC(t,n,o,a):!LS(t)&&!i.some(e=>e(t))&&(e.isSimpleText()&&($S(e.getTextContent(),a)||!VS(r))&&(function(e,t,n,r){for(let t of e){let e=t.getParent();if(VS(e)&&!e.getIsUnlinked())return}let i=[...e],a=i.map(e=>e.getTextContent()).join(``),o,s=a,c=0;for(;(o=YS(s,t))&&o!==null;){let e=o.index,t=e+o.length;if(nC(c+e,c+t,r,a,i)){let[r,,a,l]=rC(i,c+e,c+t),u=!1;for(let e of a){let t=e.getParent();if(VS(t)&&!t.getIsUnlinked()){u=!0;break}}if(u){c+=t,s=s.substring(t);continue}let d=iC(a,c+e-r,c+t-r,o);i=d?[d,...l]:l,n(o.url,null),c=0}else c+=t;s=s.substring(t)}})(function(e){let t=[e],n=e.getNextSibling();for(;n!==null&&R(n)&&n.isSimpleText()&&(t.push(n),!/[\s]/.test(n.getTextContent()));)n=n.getNextSibling();return t}(e),n,o,a),(function(e,t,n,r){let i=e.getParent(),a=e.getPreviousSibling(),o=e.getNextSibling(),s=e.getTextContent();if(!VS(i)||i.getIsUnlinked()){if(VS(a)&&!a.getIsUnlinked()&&a.is(e.getPreviousSibling())&&e.getParent()===a.getParent()){if(!$S(s,r))return oC(a),void n(null,a.getURL());if(c=s,a.isEmailURI()?/^\.[a-zA-Z]{2,}/.test(c):/^\.[a-zA-Z0-9]{1,}/.test(c)){let i=a.getTextContent()+s,o=YS(i,t);o!==null&&o.text===i&&(a.append(e),aC(a,t,n,r),n(null,a.getURL()))}}var c;!VS(o)||o.getIsUnlinked()||QS(s,r)||o.is(e.getNextSibling())&&e.getParent()===o.getParent()&&(oC(o),n(null,o.getURL()))}})(e,n,o,a))}),e.registerCommand(HS,e=>{let t=J();return!(e!==null||!q(t))&&(t.extract().forEach(e=>{let t=e.getParent();VS(t)&&(t.setIsUnlinked(!t.getIsUnlinked()),t.markDirty())}),!1)},1))}function lC(e,...t){throw function(e,...t){let n=new URL(`https://lexical.dev/docs/error`),r=new URLSearchParams;r.append(`code`,e);for(let e of t)r.append(`v`,e);return n.search=r.toString(),Error(`Minified Lexical error #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}(e,...t)}function uC(e){let t=1,n=e.getParent();for(;n!=null;){if(Z(n)){let e=n.getParent();if(X(e)){t++,n=e.getParent();continue}lC(40)}return t}return t}function dC(e){let t=e.getParent();X(t)||lC(40);let n=t,r=t;for(;r!==null;)r=r.getParent(),X(r)&&(n=r);return n}function fC(e){let t=[],n=e.getChildren().filter(Z);for(let e=0;e<n.length;e++){let r=n[e],i=r.getFirstChild();X(i)?t=t.concat(fC(i)):t.push(r)}return t}function pC(e){return Z(e)&&X(e.getFirstChild())}function mC(e,t){return t.getValue()}function hC(e,t){return Z(e)&&(t.length===0||t.length===1&&e.is(t[0])&&e.getChildrenSize()===0)}function gC(e,t){return X(e)?_f(e).setListType(t):zC(t)}function _C(e){let t=J();if(t!==null){let n=t.getNodes();if(q(t)){let[r]=t.getStartEndPoints(),i=r.getNode(),a=i.getParent();if(U(i)){let e=i.getFirstChild();if(e)n=e.selectStart().getNodes();else{let e=z();i.append(e),n=e.select().getNodes()}}else if(hC(i,n)){if(U(a)){let t=zC(e);i.replace(t);let n=GC();I(i)&&(n.setFormat(i.getFormatType()),n.setIndent(i.getIndent())),t.append(n)}else if(Z(i)){let t=i.getParentOrThrow();if(m_(t)===null){let n=gC(t,e);vC(n,t.getChildren()),t.replace(n)}}return}}let r=new Set;for(let t=0;t<n.length;t++){let i=n[t];if(I(i)&&i.isEmpty()&&!Z(i)&&m_(i)===null&&!r.has(i.getKey())){yC(i,e);continue}let a=xd(i)?i.getParent():Z(i)&&i.isEmpty()?i:null;for(;a!=null;){let t=a.getKey();if(X(a)){if(!r.has(t)&&m_(a)===null){let n=gC(a,e);vC(n,a.getChildren()),a.replace(n),r.add(t)}break}{let n=a.getParent();if(U(n)&&!r.has(t)){r.add(t),yC(a,e);break}a=n}}}}}function vC(e,t){e.splice(e.getChildrenSize(),0,t)}function yC(e,t){if(X(e))return e;let n=e.getPreviousSibling(),r=e.getNextSibling(),i=GC(),a;if(vC(i,e.getChildren()),X(n)&&t===n.getListType())n.append(i),X(r)&&t===r.getListType()&&(vC(n,r.getChildren()),r.remove()),a=n;else if(X(r)&&t===r.getListType())r.getFirstChildOrThrow().insertBefore(i),a=r;else{let n=zC(t);n.append(i),e.replace(n),a=n}i.setFormat(e.getFormatType()),i.setIndent(e.getIndent());let o=J();return q(o)&&(a.getKey()===o.anchor.key&&o.anchor.set(i.getKey(),o.anchor.offset,`element`),a.getKey()===o.focus.key&&o.focus.set(i.getKey(),o.focus.offset,`element`)),e.remove(),a}function bC(e,t){xC(e,t,!1)}function xC(e,t,n){SC(e.getLastChild(),t.getFirstChild(),n);let r=t.getChildren();r.length>0&&e.append(...r),t.remove()}function SC(e,t,n=!1){if(e&&t&&pC(e)&&pC(t)&&(!n||e.getChildrenSize()===1&&t.getChildrenSize()===1)&&e.getFirstChild().getListType()===t.getFirstChild().getListType()){if(xC(e.getFirstChild(),t.getFirstChild(),n),!n)return void t.remove();$l.prototype.remove.call(t)}}function CC(){let e=J();if(q(e)){let t=new Set,n=e.getNodes(),r=e.anchor.getNode();if(hC(r,n))t.add(dC(r));else for(let e=0;e<n.length;e++){let r=n[e];if(xd(r)){let e=db(r,VC);e!=null&&t.add(dC(e))}}for(let n of t){if(m_(n)!==null)continue;let t=n,r=fC(n);for(let n of r){let r=z().setTextStyle(e.style).setTextFormat(e.format);r.setFormat(n.getFormatType()).setIndent(n.getIndent()).setDirection(n.getDirection()).setStyle(n.getStyle()),vC(r,n.getChildren()),t.insertAfter(r),t=r,n.__key===e.anchor.key&&Ou(e.anchor,Lu(Bu(r,e.anchor.offset,`next`))),n.__key===e.focus.key&&Ou(e.focus,Lu(Bu(r,e.focus.offset,`next`))),n.remove()}n.remove()}}}function wC(e){let t=e.getListType()!==`check`,n=e.getStart();for(let r of e.getChildren())Z(r)&&(r.getValue()!==n&&r.setValue(n),t&&r.getLatest().__checked!=null&&r.setChecked(void 0),X(r.getFirstChild())||n++)}function TC(e){let t=new Set;if(pC(e)||t.has(e.getKey()))return;let n=e.getParent(),r=e.getNextSibling(),i=e.getPreviousSibling();if(pC(r)&&pC(i)){let n=i.getFirstChild();if(X(n)){n.append(e);let i=r.getFirstChild();X(i)&&n.getListType()===i.getListType()&&(vC(n,i.getChildren()),r.remove(),t.add(r.getKey()))}}else if(pC(r)){let t=r.getFirstChild();if(X(t)){let n=t.getFirstChild();n!==null&&n.insertBefore(e)}}else if(pC(i)){let t=i.getFirstChild();X(t)&&t.append(e)}else if(X(n)){let t=_f(e),a=_f(n);t.append(a),a.append(e),i?i.insertAfter(t):r?r.insertBefore(t):n.append(t)}}function EC(e){if(pC(e))return;let t=e.getParent(),n=t?t.getParent():void 0;if(X(n?n.getParent():void 0)&&Z(n)&&X(t)){let r=t?t.getFirstChild():void 0,i=t?t.getLastChild():void 0;if(e.is(r))n.insertBefore(e),t.isEmpty()&&n.remove();else if(e.is(i))n.insertAfter(e),t.isEmpty()&&n.remove();else{let r=_f(e),i=_f(t);r.append(i),e.getPreviousSiblings().forEach(e=>i.append(e));let a=_f(e),o=_f(t);a.append(o),vC(o,e.getNextSiblings()),n.insertBefore(r),n.insertAfter(a),n.replace(e)}}}function DC(e=!1){let t=J();if(!q(t)||!t.isCollapsed())return!1;let n=t.anchor.getNode(),r=null;if(Z(n)&&n.getChildrenSize()===0)r=n;else if(R(n)){let e=n.getParent();Z(e)&&e.getChildren().every(e=>R(e)&&e.getTextContent().trim()===``)&&(r=e)}if(r===null)return!1;let i=dC(r),a=r.getParent();X(a)||lC(40);let o=a.getParent(),s;if(U(o))s=z(),i.insertAfter(s);else{if(!Z(o))return!1;s=_f(o),o.insertAfter(s)}s.setTextStyle(t.style).setTextFormat(t.format).select();let c=r.getNextSiblings();if(c.length>0){let t=e?mC(0,r):1,n=_f(a).setStart(t);if(Z(s)){let e=_f(s);e.append(n),s.insertAfter(e)}else s.insertAfter(n);n.append(...c)}return function(e){let t=e;for(;t.getNextSibling()==null&&t.getPreviousSibling()==null;){let e=t.getParent();if(e==null||!Z(e)&&!X(e))break;t=e}t.remove()}(r),!0}var OC=/^-?(?:0|[1-9]\d*)(?:\.\d+)?(?:[eE][+-]?\d+)?$/;function kC(e,t){if(typeof e==`number`)return Number.isFinite(e)?e:t;if(typeof e!=`string`||!OC.test(e))return t;let n=Number(e);return Number.isFinite(n)?n:t}function AC(e,t){e.__listType=t.__listType,e.__start=t.__start,e.__tag=t.__tag}var jC=e=>{let t=Ns(e,`format`),n=Ps(e,`format`),r=Is(e,`format`),i=Fs(e,`listType`,0);return{exportJSON:function(e){let n=e.__textFormat,r=e.__textStyle,i=(n!==0||r!==``)&&e.shouldSerializeTextStyles();return{children:[],listType:e.__listType,start:e.__start,tag:e.__tag,direction:e.__dir,format:t[e.__format],indent:e.__indent,textFormat:n!==0&&i?n:void 0,textStyle:r!==``&&i?r:void 0,type:e.__type,version:1}},exportCompactJSON:function(e){let n=e.__textFormat,r=e.__textStyle,i=(n!==0||r!==``)&&e.shouldSerializeTextStyles(),a={type:e.__type,children:[]},o=e.__listType;o!==void 0&&o!==`number`&&(a.listType=o);let s=e.__start;s!==void 0&&s!==1&&(a.start=s);let c=e.__dir;c!=null&&(a.direction=c);let l=t[e.__format];l!==void 0&&l!==``&&(a.format=l);let u=e.__indent;return u!==void 0&&u!==0&&(a.indent=u),n!==void 0&&n!==0&&i&&(a.textFormat=n),r!==void 0&&r!==``&&i&&(a.textStyle=r),a},updateFromJSON:function(e,t){let a=t.direction;e.__dir=a===null||a===`ltr`||a===`rtl`?a:null;let o=t.format;e.__format=typeof o==`string`&&o in n?n[o]:r,e.__indent=function(e){let t=kC(e,0);return t>=0&&t<=1/0&&Number.isInteger(t)?t:0}(t.indent),e.__textFormat=kC(t.textFormat,0);let s=t.textStyle;e.__textStyle=typeof s==`string`?s:``;let c=t.listType;return e.setListType(typeof c==`string`&&c in i?i[c]:c===`number`||c===`bullet`||c===`check`?c:`number`),e.__start=kC(t.start,1),e},afterCloneFrom:AC}};function MC(e,t){e.__checked=t.__checked,e.__value=t.__value}var NC=e=>{let t=Ns(e,`format`),n=Ps(e,`format`),r=Is(e,`format`);return{exportJSON:function(e){let n=e.__textFormat,r=e.__textStyle,i=(n!==0||r!==``)&&e.shouldSerializeTextStyles();return{children:[],checked:e.getChecked(),indent:e.getIndent(),value:e.__value,direction:e.__dir,format:t[e.__format],textFormat:n!==0&&i?n:void 0,textStyle:r!==``&&i?r:void 0,type:e.__type,version:1}},exportCompactJSON:function(e){let n=e.__textFormat,r=e.__textStyle,i=(n!==0||r!==``)&&e.shouldSerializeTextStyles(),a={type:e.__type,children:[]},o=e.getChecked();o!==void 0&&(a.checked=o);let s=e.getIndent();s!==void 0&&s!==0&&(a.indent=s);let c=e.__value;c!==void 0&&c!==1&&(a.value=c);let l=e.__dir;l!=null&&(a.direction=l);let u=t[e.__format];return u!==void 0&&u!==``&&(a.format=u),n!==void 0&&n!==0&&i&&(a.textFormat=n),r!==void 0&&r!==``&&i&&(a.textStyle=r),a},updateFromJSON:function(e,t){let i=t.direction;e.__dir=i===null||i===`ltr`||i===`rtl`?i:null;let a=t.format;e.__format=typeof a==`string`&&a in n?n[a]:r,e.setIndent(function(e){let t=kC(e,NaN);return Number.isFinite(t)&&Number.isInteger(t)?t<0?0:t>128?128:t:0}(t.indent)),e.__textFormat=kC(t.textFormat,0);let o=t.textStyle;e.__textStyle=typeof o==`string`?o:``;let s=t.checked;return e.__checked=s===void 0?void 0:typeof s==`boolean`&&s,e.__value=kC(t.value,1),e},afterCloneFrom:MC}},PC={ol:`number`,ul:`bullet`},FC=tc()({listType:ac(nc(Qs([`number`,`bullet`,`check`]),PC),{getter:{field:`__listType`}}),start:ic(Xs(1),{field:`__start`}),tag:ac(Qs([`ul`,`ol`]),{getter:{field:`__tag`},setter:null})}),IC=class extends $l{__tag;__start;__listType;$config(){return this.config(`list`,{$transform:e=>{(function(e){let t=e.constructor,n=e.getNextSibling();return n!==null&&n.constructor===t&&Kl(Jf())&&Gl(t).declaredBy.mergeAdjacent===t})(e)||function(e){let t=e.getNextSibling();X(t)&&e.getListType()===t.getListType()&&bC(e,t)}(e),wC(e)},children:[VC],extends:$l,generated:jC,importDOM:xl({ol:()=>({conversion:RC,priority:0}),ul:()=>({conversion:RC,priority:0})}),json:FC,mergeAdjacent:{by:[`listType`]}})}constructor(e=`number`,t=1,n){super(n);let r=PC[e]||e;this.__listType=r,this.__tag=r===`number`?`ol`:`ul`,this.__start=t}getTag(){return this.getLatest().__tag}setListType(e){let t=this.getWritable();return t.__listType=e,t.__tag=e===`number`?`ol`:`ul`,t}getListType(){return this.getLatest().__listType}getStart(){return this.getLatest().__start}setStart(e){let t=this.getWritable();return t.__start=e,t}createDOM(e,t){let n=this.__tag,r=Af().createElement(n);return this.__start!==1&&r.setAttribute(`start`,String(this.__start)),r.__lexicalListType=this.__listType,LC(r,e.theme,this),r}updateDOM(e,t,n){return e.__tag!==this.__tag||e.__listType!==this.__listType||(LC(t,n.theme,this),e.__start!==this.__start&&t.setAttribute(`start`,String(this.__start)),!1)}exportDOM(e){let t=this.createDOM(e._config,e);if(W(t)){this.__start!==1&&t.setAttribute(`start`,String(this.__start)),this.__listType===`check`&&t.setAttribute(`__lexicalListType`,`check`);let e=this.getDirection();e&&(t.dir=e)}return{element:t}}canBeEmpty(){return!1}INTERNAL_$afterStructureMerge(e,t){SC(e,t,!0)}INTERNAL_$afterStructureSplit(e,t){if(this.getListType()===`number`){let n=e.getStart();for(let e of t)Z(e)&&!X(e.getFirstChild())&&n++;this.setStart(n)}}canIndent(){return!1}splice(e,t,n){let r=n;for(let e=0;e<n.length;e++){let t=n[e];if(!Z(t)){r===n&&(r=[...n]);let i=this.createListItemNode();!I(t)||X(t)||t.isInline()?i.append(t):i.append(...t.getChildren()),r[e]=i}}return super.splice(e,t,r)}extractWithChild(e){return Z(e)}createListItemNode(){return GC()}};function LC(e,t,n){let r=[],i=[],a=t.list;if(a!==void 0){let e=a[`${n.__tag}Depth`]||[],t=uC(n)-1,o=t%e.length,s=e[o],c=a[n.__tag],l,u=a.nested,d=a.checklist;if(u!==void 0&&u.list&&(l=u.list),c!==void 0&&r.push(c),d!==void 0&&n.__listType===`check`&&r.push(d),s!==void 0){r.push(...pv(s));for(let t=0;t<e.length;t++)t!==o&&i.push(...pv(e[t]))}if(l!==void 0){let e=pv(l);t>1?r.push(...e):i.push(...e)}}i.length>0&&hv(e,...i),r.length>0&&mv(e,...r)}function RC(e){let t;if(function(e){return W(e)&&e.nodeName.toLowerCase()===`ol`}(e)){let n=e.start;t=zC(`number`,n)}else t=function(e){if(e.getAttribute(`__lexicallisttype`)===`check`||e.classList.contains(`contains-task-list`)||e.getAttribute(`data-is-checklist`)===`1`)return!0;for(let t of e.childNodes)if(W(t)&&t.hasAttribute(`aria-checked`))return!0;return!1}(e)?zC(`check`):zC(`bullet`);return ap(t,e),{after:e=>function(e,t){let n=t.createListItemNode.bind(t),r=[];for(let t=0;t<e.length;t++){let i=e[t];if(Z(i)){r.push(i);let e=i.getChildren();e.length>1&&e.forEach(e=>{X(e)&&r.push(n().append(e))})}else r.push(n().append(i))}return r}(e,t),node:t}}function zC(e=`number`,t=1){return vf(new IC(e,t))}function X(e){return e instanceof IC}var BC=tc()({checked:ac(ec(Zs()),{setter:{field:`__checked`}}),indent:ac(Xs(0,{clamp:!0,integer:!0,max:128,min:0}),{derived:!0}),value:ic(Xs(1),{derived:!0,field:`__value`})}),VC=class extends $l{__value;__checked;$config(){return this.config(`listitem`,{$transform:e=>{let t=e.getParent();if(X(t))t.getListType()!==`check`&&e.getChecked()!=null&&e.setChecked(void 0);else if(t){let n=e.createParentElementNode();X(n)||lC(340);let r=[e];for(let t of[`previous`,`next`]){r.reverse();for(let{origin:n}of Y(e,t)){if(!Z(n))break;r.push(n)}}let i=Kl(Jf()),a=i?function(e,t){let n=J();if(!q(n))return null;let r=e.getKey(),i=t[0].getIndexWithinParent(),a=[n.anchor,n.focus].filter(e=>e.type===`element`&&e.key===r).map(e=>({offset:e.offset,point:e}));return a.length===0?null:e=>{for(let{point:e,offset:n}of a)if(n<=i)e.set(r,n,`element`);else if(n<i+t.length){let r=t[n-i-1];e.set(r.getKey(),r.getChildrenSize(),`element`)}else e.set(r,n-t.length+1,`element`)}}(t,r):null;if(e.insertBefore(n),n.splice(0,0,r),a!==null&&a(n),i)for(let e=t;e!==null&&!U(e);e=e.getParent())e.markDirty();U(t)||i||(qu(n,Mu(Y(n,`next`)),{$shouldSplit:()=>!1,removeEmptyDestination:!0}),t.isEmpty()&&t.isAttached()&&t.remove())}},children:[`inline`,IC],extends:$l,generated:NC,importDOM:xl({li:()=>({conversion:HC,priority:0})}),json:BC})}constructor(e=1,t=void 0,n){super(n),this.__value=e===void 0?1:e,this.__checked=t}createDOM(e){let t=Af().createElement(`li`);return this.updateListItemDOM(null,t,e),t}updateListItemDOM(e,t,n){(function(e,t){let n=t.getParent();!X(n)||n.getListType()!==`check`||X(t.getFirstChild())?(e.removeAttribute(`role`),e.removeAttribute(`tabIndex`),e.removeAttribute(`aria-checked`)):(e.setAttribute(`role`,`checkbox`),e.setAttribute(`tabIndex`,`-1`),e.setAttribute(`aria-checked`,t.getChecked()?`true`:`false`))})(t,this),t.value=this.__value,function(e,t,n){let r=t.list;if(!r)return;let i=r.listitem,a=r.nested&&r.nested.listitem,o=n.getParent(),s=X(o)&&o.getListType()===`check`,c=n.getChecked(),l=n.getChildren().some(e=>X(e)),u=[];r.listitemChecked!==void 0&&u.push(r.listitemChecked),r.listitemUnchecked!==void 0&&u.push(r.listitemUnchecked),a!==void 0&&u.push(...pv(a)),u.length>0&&hv(e,...u);let d=[];if(i!==void 0&&d.push(...pv(i)),s){let e=c?r.listitemChecked:r.listitemUnchecked;e!==void 0&&d.push(e)}a!==void 0&&l&&d.push(...pv(a)),d.length>0&&mv(e,...d)}(t,n.theme,this);let r=e?e.__style:``,i=this.__style;r!==i&&su(t.style,i,r),function(e,t,n){let r=t.__textStyle,i=n?n.__textStyle:``;if(n!==null&&i===r)return;let a=au(r);for(let t in a)e.style.setProperty(`--listitem-marker-${t}`,a[t]);if(i!==``)for(let t in au(i))t in a||e.style.removeProperty(`--listitem-marker-${t}`)}(t,this,e)}updateDOM(e,t,n){let r=t;return this.updateListItemDOM(e,r,n),!1}exportDOM(e){let t=this.createDOM(e._config),n=this.getFormatType();n&&(t.style.textAlign=n);let r=this.getDirection();return r&&(t.dir=r),pC(this)?{after(e){if(W(e)){let t=e.previousElementSibling;if(W(t)&&t.nodeName===`LI`){for(;e.firstChild;)t.append(e.firstChild);e.remove()}}return e},element:t}:{element:t}}append(...e){for(let t=0;t<e.length;t++){let n=e[t];if(I(n)&&this.canMergeWith(n)){let e=n.getChildren();this.append(...e),n.remove()}else super.append(n)}return this}replace(e,t){if(Z(e))return super.replace(e);this.setIndent(0);let n=this.getParentOrThrow();if(!X(n))return e;if(n.__first===this.getKey())n.insertBefore(e);else if(n.__last===this.getKey())n.insertAfter(e);else{let t=_f(n),r=this.getNextSibling();for(;r;){let e=r;r=r.getNextSibling(),t.append(e)}n.insertAfter(e),e.insertAfter(t)}let r=this.__key,i=0;if(t&&(I(e)||lC(139),i=e.getChildrenSize(),e.splice(i,0,this.getChildren())),t&&I(e)){let t=J();if(q(t))for(let n of t.getStartEndPoints())n.key===r&&n.type===`element`&&n.set(e.getKey(),i+n.offset,`element`)}return this.remove(),n.getChildrenSize()===0&&n.remove(),e}insertAfter(e,t=!0){let n=this.getParentOrThrow();if(X(n)||lC(39),Z(e))return super.insertAfter(e,t);let r=this.getNextSiblings();if(n.insertAfter(e,t),r.length!==0){let i=_f(n),a=r[0];i.getListType()===`number`&&Z(a)&&i.setStart(mC(0,a)),r.forEach(e=>i.append(e)),e.insertAfter(i,t)}return e}remove(e){let t=this.getPreviousSibling(),n=this.getNextSibling();super.remove(e),t&&n&&pC(t)&&pC(n)&&t.getFirstChild().getListType()===n.getFirstChild().getListType()&&(bC(t.getFirstChild(),n.getFirstChild()),n.remove())}resetOnCopyNodeFrom(e){super.resetOnCopyNodeFrom(e),e.getChecked()&&this.setChecked(!1)}insertNewAfter(e,t=!0){let n=_f(this);return this.insertAfter(n,t),n}collapseAtStart(e){if(pC(this))return!1;let t=this.getParentOrThrow();if(Z(t.getParentOrThrow()))return EC(this),!0;let n=z().append(...this.getChildren()),r=this.getNextSiblings();if(r.length>0){let e=_f(t);e.append(...r),t.insertAfter(e)}return t.insertAfter(n),this.remove(),t.getChildrenSize()===0&&t.remove(),n.selectStart(),!0}getValue(){return this.getLatest().__value}setValue(e){let t=this.getWritable();return t.__value=e,t}getChecked(){let e=this.getLatest(),t,n=this.getParent();return X(n)&&(t=n.getListType()),t===`check`?!!e.__checked:void 0}setChecked(e){let t=this.getWritable();return t.__checked=e,t}toggleChecked(){let e=this.getWritable();return e.setChecked(!e.__checked)}getIndent(){let e=this.getParent();if(e===null||!this.isAttached())return this.getLatest().__indent;let t=e.getParentOrThrow(),n=0;for(;Z(t);)t=t.getParentOrThrow().getParentOrThrow(),n++;return n}setIndent(e){typeof e!=`number`&&lC(117),(e=Math.floor(e))>=0||lC(199);let t=e,n=this.getIndent();for(;n!==t;)n<t?(TC(this),n++):(EC(this),n--);return this}canInsertAfter(e){return Z(e)}canReplaceWith(e){return Z(e)}canMergeWith(e){return Z(e)||Zu(e)}extractWithChild(e,t){if(!q(t))return!1;let n=t.anchor.getNode(),r=t.focus.getNode();return this.isParentOf(n)&&this.isParentOf(r)&&this.getTextContent().length===t.getTextContent().length}isParentRequired(){return!0}createParentElementNode(){return zC(`bullet`)}canMergeWhenEmpty(){return!0}};function HC(e){if(e.classList.contains(`task-list-item`)){for(let t of e.children)if(t.tagName===`INPUT`)return UC(t)}if(e.classList.contains(`joplin-checkbox`)){for(let t of e.children)if(t.classList.contains(`checkbox-wrapper`)&&t.children.length>0&&t.children[0].tagName===`INPUT`)return UC(t.children[0])}let t=e.getAttribute(`aria-checked`),n=GC(t===`true`||t!==`false`&&void 0);return op(n,e),{after:WC.bind(null,n),node:ap(n,e)}}function UC(e){if(e.getAttribute(`type`)!==`checkbox`)return{node:null};let t=GC(e.hasAttribute(`checked`));return{after:WC.bind(null,t),node:t}}function WC(e,t){let n=t[0];return t.length===1&&Zu(n)&&!e.getFormatType()&&n.getFormatType()?(e.setFormat(n.getFormatType()),n.getChildren()):t}function GC(e){return vf(new VC(void 0,e))}function Z(e){return e instanceof VC}var KC=new Set([` `,`Alt`,`ArrowDown`,`ArrowLeft`,`ArrowUp`,`CapsLock`,`Control`,`Escape`,`Meta`,`Shift`]),qC=N(`INSERT_CHECK_LIST_COMMAND`);function JC(e,t){let n=t&&t.disableTakeFocusOnClick||!1,r=typeof n==`boolean`?()=>n:n.peek.bind(n),i=e=>{let t=e.target;if(!W(t))return!1;let n=t.__lexicalCheckListLastHandled;return n!==void 0&&e.timeStamp-n<500},a=`none`,o=e=>{a=function(e,t){let n=!1;return YC(e,()=>{n=!0,e.preventDefault(),t&&e.stopPropagation()}),n}(e,r())?`checkMark`:`content`},s=()=>{a===`content`&&ZC(e),a=`none`};return th(e.registerCommand(qC,()=>(_C(`check`),!0),1),e.registerCommand(So,t=>ew(t,e,!1),1),e.registerCommand(xo,t=>ew(t,e,!0),1),e.registerCommand(Eo,()=>$C(e)!=null&&(e.getRootElement()?.focus(),!0),1),e.registerCommand(wo,t=>{let n=$C(e);return!(n==null||!e.isEditable()||(e.update(()=>{let e=jd(n);Z(e)&&(t.preventDefault(),e.toggleChecked())}),0))},1),e.registerCommand(yo,t=>$C(e)===null?e.read(`latest`,()=>{let n=J();if(q(n)&&n.isCollapsed()){let{anchor:r}=n,i=r.type===`element`;if(i||r.offset===0){let n=r.getNode(),a=G(n,e=>I(e)&&!e.isInline());if(Z(a)){let r=a.getParent();if(X(r)&&r.getListType()===`check`&&(i||a.getFirstDescendant()===n)){let n=e.getElementByKey(a.__key);if(n!=null&&Lf(n)!==n)return n.focus(),t.preventDefault(),!0}}}}return!1}):(ZC(e),!1),1),e.registerRootListener(t=>{if(t!==null)return th(rh(t,{click:e=>{s(),(e=>{i(e)||XC(e,r())})(e)},pointerup:e=>{s(),(e=>{e.pointerType===`touch`&&(i(e)||((e=>{let t=e.target;W(t)&&(t.__lexicalCheckListLastHandled=e.timeStamp)})(e),XC(e,r())))})(e)}}),rh(t,{beforeinput:()=>ZC(e),focusin:()=>{Ta&&a===`content`&&ZC(e)},keydown:t=>{KC.has(t.key)||ZC(e)},mousedown:o,pointerdown:o},{capture:!0}),nh(t,`touchstart`,o,{capture:!0,passive:!1}))}))}function YC(e,t){let n=e.target;if(!W(n))return;let r=n.firstChild;if(W(r)&&(r.tagName===`UL`||r.tagName===`OL`))return;let i=n.parentNode;if(!i||i.__lexicalListType!==`check`)return;let a=null,o=null;if(`clientX`in e)a=e.clientX;else if(`touches`in e){let t=e.touches;t.length>0&&(a=t[0].clientX,o=`touch`)}if(a==null)return;let s=n.getBoundingClientRect(),c=a/yb(n),l=n.ownerDocument.defaultView,u=l?l.getComputedStyle(n,`::before`):{width:`0px`},d=parseFloat(u.width),f=o===`touch`||`pointerType`in e&&e.pointerType===`touch`?32:0;(n.dir===`rtl`?c<s.right+f&&c>s.right-d-f:c>s.left-f&&c<s.left+d+f)&&t()}function XC(e,t){YC(e,()=>{if(W(e.target)){let n=e.target,r=pd(n);r!=null&&r.isEditable()&&r.update(()=>{let e=jd(n);Z(e)&&(t?(lf(`skip-selection-focus`),lf(`skip-dom-selection`)):n.focus(),e.toggleChecked())})}})}function ZC(e){let t=e.getRootElement(),n=t?Lf(t):null;t!==null&&W(n)&&QC(n)&&t.focus({preventScroll:!0})}function QC(e){let t=e.parentNode;return e.tagName===`LI`&&t!=null&&t.__lexicalListType===`check`}function $C(e){let t=e.getRootElement(),n=t?Lf(t):null;return W(n)&&QC(n)?n:null}function ew(e,t,n){let r=$C(t);if(r!=null){let i=null;t.update(()=>{let a=jd(r);if(!Z(a))return;let o=function(e,t){let n=t?e.getPreviousSibling():e.getNextSibling(),r=e;for(;n==null&&Z(r);)r=r.getParentOrThrow().getParent(),r!=null&&(n=t?r.getPreviousSibling():r.getNextSibling());for(;Z(n);){let e=t?n.getLastChild():n.getFirstChild();if(!X(e))return n;n=t?e.getLastChild():e.getFirstChild()}return null}(a,n);o!=null&&(o.selectStart(),t.getElementByKey(o.__key)!=null&&(e.preventDefault(),i=o.__key))},{onUpdate:()=>{(i===null?null:t.getElementByKey(i))?.focus()}})}return!1}var tw=N(`UPDATE_LIST_START_COMMAND`),nw=N(`INSERT_UNORDERED_LIST_COMMAND`),rw=N(`INSERT_ORDERED_LIST_COMMAND`),iw=N(`REMOVE_LIST_COMMAND`);function aw(e,t){return th(e.registerCommand(rw,()=>(_C(`number`),!0),1),e.registerCommand(tw,e=>{let{listNodeKey:t,newStart:n}=e,r=B(t);return!!X(r)&&(r.getListType()===`number`&&(r.setStart(n),wC(r)),!0)},1),e.registerCommand(nw,()=>(_C(`bullet`),!0),1),e.registerCommand(iw,()=>(CC(),!0),1),e.registerCommand(ao,()=>DC(!(!t||!t.restoreNumbering)),1),e.registerCommand(To,e=>{let t=J();if(!q(t)||!t.isCollapsed())return!1;let{anchor:n}=t;if(n.offset!==0)return!1;let r=n.getNode();for(;!Z(r);){if(r.getPreviousSibling()!==null)return!1;let e=r.getParent();if(e===null)return!1;r=e}return!(!Z(r)||!r.collapseAtStart(t)||(e.preventDefault(),0))},-8),e.registerNodeTransform(VC,e=>{let t=e.getFirstChild();if(t){if(R(t)){let n=t.getStyle(),r=t.getFormat();e.getTextStyle()!==n&&e.setTextStyle(n),e.getTextFormat()!==r&&e.setTextFormat(r)}}else{let t=J();q(t)&&(t.style!==e.getTextStyle()||t.format!==e.getTextFormat())&&t.isCollapsed()&&e.is(t.anchor.getNode())&&e.setTextStyle(t.style).setTextFormat(t.format)}}),e.registerNodeTransform(gu,e=>{let t=e.getParent();if(Z(t)&&e.is(t.getFirstChild())){let n=e.getStyle(),r=e.getFormat();n===t.getTextStyle()&&r===t.getTextFormat()||t.setTextStyle(n).setTextFormat(r)}}))}function ow(e){let t=e=>{let t=e.getParent();if(X(e.getFirstChild())||!X(t))return;let n=G(e,e=>Z(e)&&X(e.getParent())&&Z(e.getPreviousSibling()));if(n===null&&e.getIndent()>0)e.setIndent(0);else if(Z(n)){let r=n.getPreviousSibling();if(Z(r)){let n=function(e){let t=e,n=t.getFirstChild();for(;X(n);){let e=n.getLastChild();if(!Z(e))break;t=e,n=t.getFirstChild()}return t}(r).getParent();if(X(n)){let r=uC(n);r+1<uC(t)&&e.setIndent(r)}}}};return e.registerNodeTransform(IC,e=>{let n=[e];for(;n.length>0;){let e=n.shift();if(X(e)){for(let r of e.getChildren())if(Z(r)){t(r);let e=r.getFirstChild();X(e)&&n.push(e)}}}})}function sw({validateUrl:e,attributes:t}){let[n]=ha();return(0,A.useEffect)(()=>{if(!n.hasNodes([AS]))throw Error(`LinkPlugin: LinkNode not registered on editor`)}),(0,A.useEffect)(()=>qS(n,Dy({attributes:t,validateUrl:e})),[n,e,t]),null}function cw({hasStrictIndent:e=!1,shouldPreserveNumbering:t=!1}){let[n]=ha();return(0,A.useEffect)(()=>{if(!n.hasNodes([IC,VC]))throw Error(`ListPlugin: ListNode and/or ListItemNode not registered on editor`)},[n]),(0,A.useEffect)(()=>th(aw(n,{restoreNumbering:t}),e?ow(n):()=>{}),[n,e,t]),function(e){(0,A.useEffect)(()=>aw(e),[e])}(n),null}var lw={color:{text:`var(--rc-text)`,textSecondary:`var(--rc-text-secondary)`,textTertiary:`var(--rc-text-tertiary)`,textQuaternary:`var(--rc-text-quaternary)`,bg:`var(--rc-bg)`,bgSecondary:`var(--rc-bg-secondary)`,bgTertiary:`var(--rc-bg-tertiary)`,bgElevated:`var(--rc-bg-elevated)`,fill:`var(--rc-fill)`,fillSecondary:`var(--rc-fill-secondary)`,fillTertiary:`var(--rc-fill-tertiary)`,fillQuaternary:`var(--rc-fill-quaternary)`,border:`var(--rc-border)`,borderSubtle:`var(--rc-border-subtle)`,ring:`var(--rc-ring)`,scrim:`var(--rc-scrim)`,accent:`var(--rc-accent)`,accentLight:`var(--rc-accent-light)`,link:`var(--rc-link)`,codeText:`var(--rc-code-text)`,codeBg:`var(--rc-code-bg)`,codeHeaderBg:`var(--rc-code-header-bg)`,hrBorder:`var(--rc-hr-border)`,quoteBorder:`var(--rc-quote-border)`,quoteBg:`var(--rc-quote-bg)`,alertInfo:`var(--rc-alert-info)`,alertWarning:`var(--rc-alert-warning)`,alertTip:`var(--rc-alert-tip)`,alertCaution:`var(--rc-alert-caution)`,alertImportant:`var(--rc-alert-important)`},spacing:{xs:`var(--rc-space-xs)`,sm:`var(--rc-space-sm)`,md:`var(--rc-space-md)`,lg:`var(--rc-space-lg)`,xl:`var(--rc-space-xl)`},flow:{paragraph:`var(--rc-flow-paragraph)`,list:`var(--rc-flow-list)`,block:`var(--rc-flow-block)`,heading:`var(--rc-flow-heading)`},typography:{fontFamily:`var(--rc-font-family)`,fontFamilySans:`var(--rc-font-family-sans)`,fontFamilySerif:`var(--rc-font-family-serif)`,fontFamilyKai:`var(--rc-font-family-kai)`,fontMono:`var(--rc-font-mono)`,fontSize2xs:`var(--rc-font-size-2xs)`,fontSizeXs:`var(--rc-font-size-xs)`,fontSizeSm:`var(--rc-font-size-sm)`,fontSizeMd:`var(--rc-font-size-md)`,fontSizeLg:`var(--rc-font-size-lg)`,fontSizeBase:`var(--rc-font-size-base)`,fontSizeSmall:`var(--rc-font-size-small)`,fontSizeCode:`var(--rc-font-size-code)`,fontSizeCaption:`var(--rc-font-size-caption)`,lineHeight:`var(--rc-line-height)`,lineHeightTight:`var(--rc-line-height-tight)`,lineHeightCompact:`var(--rc-line-height-compact)`,lineHeightCode:`var(--rc-line-height-code)`},borderRadius:{sm:`var(--rc-radius-sm)`,md:`var(--rc-radius-md)`,lg:`var(--rc-radius-lg)`},layout:{maxWidth:`var(--rc-max-width)`},boxShadow:{xs:`var(--rc-shadow-xs)`,topBar:`var(--rc-shadow-top-bar)`,modal:`var(--rc-shadow-modal)`,menu:`var(--rc-shadow-menu)`}},uw={fontFamilySans:`-apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", Roboto, Helvetica, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji"`,fontFamilySerif:`"Noto Serif CJK SC", "Source Han Serif SC", "Source Han Serif", "source-han-serif-sc", "Songti SC", STSong, "华文宋体", serif`,fontFamilyKai:`"楷体", KaiTi, STKaiti, "Kaiti SC", "LXGW WenKai", "霞鹜文楷", "Noto Serif CJK SC", serif`,fontMono:`"SF Mono", SFMono-Regular, ui-monospace, "DejaVu Sans Mono", Menlo, Consolas, "PingFang SC", "Noto Sans SC", monospace`},dw={fontFamilySans:uw.fontFamilySans,fontFamilySerif:uw.fontFamilySerif,fontFamilyKai:uw.fontFamilyKai,fontMono:uw.fontMono,fontSize2xs:`0.625em`,fontSizeXs:`0.75em`,fontSizeSm:`0.8125em`,fontSizeMd:`0.875em`,fontSizeLg:`1.25em`,fontSizeBase:`16px`,fontSizeSmall:`14px`,fontSizeCode:`0.8125em`,fontSizeCaption:`0.8125em`,lineHeight:`1.75`,lineHeightTight:`1.35`,lineHeightCompact:`1.6`,lineHeightCode:`1.7`},fw={paragraph:`1.25em`,list:`0.375em`,block:`2em`,heading:`2em`},pw={paragraph:`0.6em`,list:`0.25em`,block:`1em`,heading:`1em`};({...dw}),uw.fontFamilySans,{...fw},{...dw},uw.fontFamilySerif,{...dw},uw.fontFamilySans,{...pw},{...dw},uw.fontFamilySans;var mw=A.createContext({className:``,theme:`light`}),hw=A.createContext(null);hw.Provider;function gw(){return A.useContext(hw)??document.body}function _w({className:e,theme:t,children:n}){return(0,j.jsx)(mw.Provider,{value:A.useMemo(()=>({className:e,theme:t}),[e,t]),children:n})}function vw(){return A.useContext(mw)}function yw({children:e}){let{className:t,theme:n}=vw();return t?(0,j.jsx)(`div`,{suppressHydrationWarning:!0,className:t,"data-theme":n,style:{display:`contents`},children:e}):e}function bw(e){let{multiple:t=!1,defaultValue:n,value:r,onValueChange:i,autoComplete:a,...o}=e;return(0,j.jsx)(Fi,{...o,selectionMode:t?`multiple`:`single`,selectedValue:r,defaultSelectedValue:n,onSelectedValueChange:i,formAutoComplete:a})}var xw={letterSpacing:`normal`,wordSpacing:`normal`,fontFeatureSettings:`normal`,fontVariant:`normal`,fontStyle:`normal`,fontWeight:400,textTransform:`none`,textIndent:0,color:lw.color.text};({...xw}),lw.typography.fontFamilySans,{...xw},lw.typography.fontFamily,lw.typography.fontMono;var Sw={sm:`280px`,md:`320px`,lg:`400px`};`${lw.color.accent}${lw.color.accentLight}`,lw.color.textQuaternary,lw.color.textTertiary,lw.color.textSecondary,lw.color.text;function Cw(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function ww(e){var t=Cw(e,`string`);return typeof t==`symbol`?t:String(t)}function Tw(e,t,n){return t=ww(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Ew(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Dw(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?Ew(Object(n),!0).forEach(function(t){Tw(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ew(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Ow(e,t){var n={};for(var r in e)n[r]=t(e[r],r);return n}var kw=(e,t,n)=>{for(var r of Object.keys(e))if(e[r]!==(t[r]??n[r]))return!1;return!0},Aw=e=>{var t=t=>{var n=e.defaultClassName,r=Dw(Dw({},e.defaultVariants),t);for(var i in r){var a=r[i]??e.defaultVariants[i];if(a!=null){var o=a;typeof o==`boolean`&&(o=o===!0?`true`:`false`);var s=e.variantClassNames[i][o];s&&(n+=` `+s)}}for(var[c,l]of e.compoundVariants)kw(c,r,e.defaultVariants)&&(n+=` `+l);return n};return t.variants=()=>Object.keys(e.variantClassNames),t.classNames={get base(){return e.defaultClassName.split(` `)[0]},get variants(){return Ow(e.variantClassNames,e=>Ow(e,e=>e.split(` `)[0]))}},t},jw={1:`_73ej2i1`,2:`_73ej2i2`,3:`_73ej2i3`,4:`_73ej2i4`},Mw={actionBar:`re-ui-action-bar`,actionButton:`re-ui-action-btn`,actionButtonEnd:`re-ui-action-btn--end`,actionButtonDanger:`re-ui-action-btn--danger`,actionButtonIcon:`re-ui-action-btn--icon`},Nw=Aw({defaultClassName:`_73ej2i6`,variantClassNames:{variant:{ghost:`_73ej2i7`,solid:`_73ej2i8`,outline:`_73ej2i9`,accent:`_73ej2ia`},size:{sm:`_73ej2ib`,md:`_73ej2ic`,lg:`_73ej2id`},icon:{true:`_73ej2ie`,false:`_73ej2if`},end:{true:`_73ej2ig`,false:`_73ej2ih`},danger:{true:`_73ej2ii`,false:`_73ej2ij`},rounded:{true:`_73ej2ik`,false:`_73ej2il`}},defaultVariants:{variant:`ghost`,size:`sm`,icon:!1,end:!1,danger:!1,rounded:!1},compoundVariants:[[{icon:!0,size:`sm`},`_73ej2im`],[{icon:!0,size:`md`},`_73ej2in`],[{icon:!0,size:`lg`},`_73ej2io`],[{icon:!0,variant:`outline`},`_73ej2ip`],[{icon:!0,variant:`ghost`},`_73ej2iq`],[{rounded:!0,icon:!0},`_73ej2ir`],[{danger:!0,variant:`solid`},`_73ej2is`],[{danger:!0},`_73ej2it`]]});function Pw({variant:e,size:t,end:n=!1,danger:r=!1,icon:i=!1,rounded:a=!1,level:o,className:s,type:c=`button`,...l}){let u=[Mw.actionButton];n&&u.push(Mw.actionButtonEnd),r&&u.push(Mw.actionButtonDanger),i&&u.push(Mw.actionButtonIcon),o&&!i&&u.push(jw[o]);let d=Nw({variant:e,size:t,end:n,danger:r,icon:i,rounded:a});return(0,j.jsx)(`button`,{className:`${d} ${u.join(` `)}${s?` ${s}`:``}`,type:c,...l})}function Fw(e){let{level:t,...n}=e??{},r=t?` ${jw[t]}`:``;return`${Nw(n)} ${Mw.actionButton}${r}`}Aw({defaultClassName:`_15r7gwx5`,variantClassNames:{variant:{info:`_15r7gwx6`,success:`_15r7gwx7`,warning:`_15r7gwx8`,error:`_15r7gwx9`,neutral:`_15r7gwxa`}},defaultVariants:{variant:`info`},compoundVariants:[]});var Iw=`_1b25hgb0`,Lw=`_1b25hgb1`;(0,A.forwardRef)(function({maxRows:e=6,minRows:t=1,className:n,onInput:r,...i},a){let o=(0,A.useRef)(null);(0,A.useImperativeHandle)(a,()=>o.current);let s=(0,A.useCallback)(()=>{let t=o.current;if(!t)return;t.style.height=`auto`;let n=(Number.parseFloat(getComputedStyle(t).lineHeight)||21)*e+16,r=t.scrollHeight;r>n?(t.style.height=`${n}px`,t.classList.add(Lw)):(t.style.height=`${r}px`,t.classList.remove(Lw))},[e]);return(0,A.useEffect)(()=>{s()},[s,i.value]),(0,j.jsx)(`textarea`,{className:`${Iw}${n?` ${n}`:``}`,ref:o,rows:t,onInput:e=>{s(),r?.(e)},...i})}),Aw({defaultClassName:`_1vt0sm10`,variantClassNames:{variant:{neutral:`_1vt0sm11`,success:`_1vt0sm12`,error:`_1vt0sm13`,warning:`_1vt0sm14`,info:`_1vt0sm15`},size:{sm:`_1vt0sm16`,md:`_1vt0sm17`}},defaultVariants:{variant:`neutral`,size:`sm`},compoundVariants:[]});var Rw=`_10muorc0`,zw=`_10muorc2`,Bw=`_10muorc3`,Vw=`_10muorc4`,Hw=`_10muorc5`,Uw=`_10muorc6`,Ww=`_10muorc7`;function Gw(...e){return e.filter(Boolean).join(` `)}function Kw({label:e,description:t,checked:n,defaultChecked:r=!1,indeterminate:i=!1,onChange:a,disabled:o=!1,className:s}){let[c,l]=(0,A.useState)(r),u=n!==void 0,d=u?n:c,f=i||d;return(0,j.jsxs)(`button`,{"aria-checked":i?`mixed`:d,"aria-disabled":o,className:Gw(Rw,o&&`_10muorc1`,s),role:`checkbox`,type:`button`,onClick:()=>{if(o)return;let e=i?!0:!d;u||l(e),a?.(e)},children:[(0,j.jsxs)(`span`,{className:Gw(zw,f?Vw:Bw),children:[(0,j.jsx)(`svg`,{"aria-hidden":!0,className:Gw(Hw,d&&!i?Uw:Ww),fill:`none`,viewBox:`0 0 12 12`,children:(0,j.jsx)(`path`,{d:`M2.5 6.25L5 8.75L9.5 3.5`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.75`})}),(0,j.jsx)(`svg`,{"aria-hidden":!0,className:Gw(Hw,i?Uw:Ww),fill:`none`,viewBox:`0 0 12 12`,children:(0,j.jsx)(`path`,{d:`M3 6H9`,stroke:`currentColor`,strokeLinecap:`round`,strokeWidth:`1.75`})})]}),(e||t)&&(0,j.jsxs)(`span`,{className:`_10muorc8`,children:[e&&(0,j.jsx)(`span`,{className:Gw(`_10muorc9`,o&&`_10muorca`),children:e}),t&&(0,j.jsx)(`span`,{className:`_10muorcb`,children:t})]})]})}var qw={javascript:`#f7df1e`,js:`#f7df1e`,typescript:`#3178c6`,ts:`#3178c6`,jsx:`#61dafb`,tsx:`#61dafb`,html:`#e34f26`,css:`#1572b6`,scss:`#cc6699`,json:`#f59e0b`,markdown:`#737373`,md:`#737373`,bash:`#4eaa25`,sh:`#4eaa25`,shell:`#4eaa25`,zsh:`#4eaa25`,python:`#3776ab`,py:`#3776ab`,rust:`#dea584`,go:`#00add8`,java:`#b07219`,c:`#a8b9cc`,cpp:`#00599c`,"c++":`#00599c`,swift:`#fa7343`,kotlin:`#7f52ff`,yaml:`#cb171e`,yml:`#cb171e`,sql:`#e38c00`};function Jw(e){return e&&e.trim().toLowerCase()||`text`}var Yw={typescript:`TypeScript`,javascript:`JavaScript`,python:`Python`,shell:`Shell`,bash:`Shell`,sh:`Shell`,zsh:`Shell`,rust:`Rust`,go:`Go`,swift:`Swift`,kotlin:`Kotlin`,java:`Java`,cpp:`C++`,csharp:`C#`,ruby:`Ruby`,markdown:`Markdown`,vue:`Vue`,dart:`Dart`,lua:`Lua`,diff:`Diff`};function Xw(e){return e===`text`?`TEXT`:Yw[e]??e.toUpperCase()}var Zw=`_1gq8hf90`,Qw=`_1gq8hf95`,$w=`_1gq8hf96 _1gq8hf95`,eT=`_1gq8hf97`,tT=(0,j.jsx)(Qt,{size:14}),nT=(0,j.jsx)(d,{size:14}),rT=(0,j.jsx)(En,{size:14});function iT({children:e,chrome:t=`bar`,className:n,code:r,collapsible:i=!0,language:a,showCopyButton:o=!0,static:s=!1}){let c=Jw(a),l=!!a&&c!==`text`,u=t===`compact`?c:Xw(c),d=qw[c]||`#737373`,f=(0,A.useMemo)(()=>r.split(`
12
+ `).length,[r]),p=(0,A.useMemo)(()=>({"--rc-ln-digits":Math.max(2,String(f).length)}),[f]),[m,h]=(0,A.useState)(!1),g=(0,A.useRef)(void 0),[_,v]=(0,A.useState)(!0),[y,b]=(0,A.useState)(!1),x=(0,A.useRef)(null);(0,A.useEffect)(()=>{if(!i){b(!1);return}let e=x.current;if(!e)return;let t=requestAnimationFrame(()=>{let t=window.innerHeight/2;b(e.scrollHeight>=t)});return()=>cancelAnimationFrame(t)},[e,r,i]),(0,A.useEffect)(()=>()=>clearTimeout(g.current),[]);let S=(0,A.useCallback)(()=>{navigator.clipboard.writeText(r).then(()=>{h(!0),clearTimeout(g.current),g.current=setTimeout(()=>h(!1),2e3)}).catch(()=>{})},[r]),C=i&&y&&_,w=[eT,C&&`_1gq8hf98`].filter(Boolean).join(` `),T=l||o;return(0,j.jsxs)(`div`,{className:`${Zw}${n?` ${n}`:``}`,"data-chrome":t,style:p,children:[T&&(0,j.jsxs)(`div`,{className:`_1gq8hf91`,children:[(0,j.jsx)(`div`,{className:`_1gq8hf92`,children:l&&(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(`span`,{"aria-hidden":!0,className:`_1gq8hf93`,style:{backgroundColor:d}}),(0,j.jsx)(`span`,{children:u})]})}),o&&(0,j.jsxs)(`button`,{"aria-label":m?`Copied`:`Copy code`,className:`_1gq8hf94`,"data-copied":m||void 0,type:`button`,onClick:S,children:[m?nT:tT,(0,j.jsx)(`span`,{children:m?`Copied`:`Copy`})]})]}),(0,j.jsxs)(`div`,{className:s?$w:Qw,children:[(0,j.jsx)(`div`,{className:w,ref:x,children:e}),C&&(0,j.jsx)(`div`,{"aria-hidden":!0,className:`_1gq8hf99`})]}),C&&(0,j.jsxs)(`button`,{className:`_1gq8hf9a`,type:`button`,onClick:()=>v(!1),children:[(0,j.jsx)(`span`,{children:`Expand all · ${f} lines`}),rT]})]})}var aT={ini:`toml`,plaintext:`text`,properties:`toml`},oT=null;async function sT(){let[e,n,r]=await Promise.all([t(()=>import(`./default-Ckb1jcnl.js`),[],import.meta.url),t(()=>import(`./github-light-B4HDwToD.js`),[],import.meta.url),t(()=>import(`./github-dark-C895GGrm.js`),[],import.meta.url)]);return{core:e,dark:r.default,light:n.default}}function cT(){return oT??=sT().then(e=>e,e=>{throw oT=null,e}),oT}function lT(e,t,n,r){let{core:i,dark:a,light:o}=e,s=pT(n,i.isSupportedLanguage);return i.codeToTokens(t,{cssVariablePrefix:r,lang:s,themes:{light:o,dark:a}})}function uT(e){return e.replaceAll(`&`,`&amp;`).replaceAll(`<`,`&lt;`).replaceAll(`>`,`&gt;`)}function dT(e){if(e.htmlStyle)return Object.entries(e.htmlStyle).map(([e,t])=>`${e}:${t}`).join(`;`);let t=e.color?[`color:${e.color}`]:[],n=e.fontStyle??0;return n&1&&t.push(`font-style:italic`),n&2&&t.push(`font-weight:bold`),n&4&&t.push(`text-decoration:underline`),t.join(`;`)}function fT(e){let t=dT(e);return`<span${t?` style="${uT(t).replaceAll(`"`,`&quot;`)}"`:``}>${uT(e.content)}</span>`}function pT(e,t){let n=e?.trim().toLowerCase()||`text`,r=aT[n]??n;return t(r)?r:`text`}async function mT(e,t,n){let r=await cT(),{core:i,dark:a,light:o}=r,{tokens:s,fg:c,bg:l}=n?i.codeToTokens(e,{lang:pT(t,i.isSupportedLanguage),theme:n===`dark`?a:o}):lT(r,e,t);return`<pre class="${n?`highlights`:`highlights highlights-themes`}" style="background-color:${l};color:${c}"><code>${s.map(e=>`<span class="line">${e.map(fT).join(``)}</span>`).join(`
13
+ `)}</code></pre>`}var hT=[{id:`angular-html`,name:`Angular HTML`},{id:`angular-ts`,name:`Angular TypeScript`},{id:`asm`,name:`Assembly`},{id:`astro`,name:`Astro`},{id:`bat`,name:`Batch`},{id:`c`,name:`C`},{id:`c3`,name:`C3`},{id:`clojure`,name:`Clojure`},{id:`cmake`,name:`CMake`},{id:`cpp`,name:`C++`},{id:`csharp`,name:`C#`},{id:`css`,name:`CSS`},{id:`cuda`,name:`CUDA`},{id:`dart`,name:`Dart`},{id:`diff`,name:`Diff`},{id:`docker`,name:`Dockerfile`},{id:`elixir`,name:`Elixir`},{id:`elm`,name:`Elm`},{id:`erlang`,name:`Erlang`},{id:`fortran-fixed-form`,name:`Fortran (Fixed Form)`},{id:`fortran-free-form`,name:`Fortran (Free Form)`},{id:`fsharp`,name:`F#`},{id:`gdresource`,name:`GDResource`},{id:`gdscript`,name:`GDScript`},{id:`gdshader`,name:`GDShader`},{id:`gleam`,name:`Gleam`},{id:`glsl`,name:`GLSL`},{id:`go`,name:`Go`},{id:`graphql`,name:`GraphQL`},{id:`groovy`,name:`Groovy`},{id:`haskell`,name:`Haskell`},{id:`hlsl`,name:`HLSL`},{id:`html`,name:`HTML`},{id:`java`,name:`Java`},{id:`javascript`,name:`JavaScript`},{id:`json`,name:`JSON`},{id:`json5`,name:`JSON5`},{id:`jsonl`,name:`JSON Lines`},{id:`jsx`,name:`JSX`},{id:`julia`,name:`Julia`},{id:`kotlin`,name:`Kotlin`},{id:`latex`,name:`LaTeX`},{id:`less`,name:`Less`},{id:`lisp`,name:`Lisp`},{id:`lua`,name:`Lua`},{id:`make`,name:`Makefile`},{id:`markdown`,name:`Markdown`},{id:`matlab`,name:`MATLAB`},{id:`mdx`,name:`MDX`},{id:`nim`,name:`Nim`},{id:`nix`,name:`Nix`},{id:`objective-c`,name:`Objective-C`},{id:`ocaml`,name:`OCaml`},{id:`pascal`,name:`Pascal`},{id:`perl`,name:`Perl`},{id:`php`,name:`PHP`},{id:`powershell`,name:`PowerShell`},{id:`proto`,name:`Protocol Buffer`},{id:`python`,name:`Python`},{id:`r`,name:`R`},{id:`ruby`,name:`Ruby`},{id:`rust`,name:`Rust`},{id:`sass`,name:`Sass`},{id:`scala`,name:`Scala`},{id:`scss`,name:`SCSS`},{id:`shellscript`,name:`Shell`},{id:`solidity`,name:`Solidity`},{id:`sql`,name:`SQL`},{id:`svelte`,name:`Svelte`},{id:`swift`,name:`Swift`},{id:`terraform`,name:`Terraform`},{id:`toml`,name:`TOML`},{id:`tsrx`,name:`TSRX`},{id:`tsx`,name:`TSX`},{id:`typescript`,name:`TypeScript`},{id:`vue`,name:`Vue`},{id:`wasm`,name:`WebAssembly`},{id:`wgsl`,name:`WGSL`},{id:`xml`,name:`XML`},{id:`yaml`,name:`YAML`},{id:`zig`,name:`Zig`}];function gT({chrome:e,className:t,collapsible:n=!0,code:r,language:i,showCopyButton:a=!0,showLineNumbers:o=!1}){let s=Jw(i),[c,l]=(0,A.useState)(null);(0,A.useEffect)(()=>{let e=!1;return l(null),mT(r,s).then(t=>{e||l(t)}).catch(()=>{}),()=>{e=!0}},[r,s]);let u=(0,A.useMemo)(()=>r.split(`
14
+ `),[r]),d=[o&&`_1gq8hf9b`,o&&`_1gq8hf9c`].filter(Boolean).join(` `);return(0,j.jsx)(iT,{static:!0,chrome:e,className:t,code:r,collapsible:n,language:i,showCopyButton:a,children:c?(0,j.jsx)(`div`,{className:d,dangerouslySetInnerHTML:{__html:c}}):(0,j.jsx)(`pre`,{className:d,children:(0,j.jsx)(`code`,{children:u.map((e,t)=>(0,j.jsx)(`span`,{className:`line`,children:e},t))})})})}function _T(e){let t=(0,A.createContext)(void 0);return[({value:e,children:n})=>(0,j.jsx)(t.Provider,{value:e,children:n}),()=>{let n=(0,A.use)(t);if(n===void 0)throw Error(`useContext must be used within ${e??`a Provider`}`);return n}]}var vT=`f2q44l0`,yT={sm:`f2q44l4`,md:`f2q44l5`,lg:`f2q44l6`},bT=`f2q44l7`,xT=`f2q44l8`,ST=`f2q44la`,CT=`f2q44lc`,wT=`f2q44ld`,[TT,ET]=_T(`PopoverContext`);function DT(e){let[t,n]=(0,A.useState)(e?.defaultOpen??!1);(0,A.useEffect)(()=>{e.open!==void 0&&n(e.open)},[e.open]);let r=(t,r)=>{n(t),e.onOpenChange?.(t,r)};return(0,j.jsx)(TT,{value:{isOpen:t},children:(0,j.jsx)(Ht,{...e,onOpenChange:r})})}function OT(e){return(0,j.jsx)(zt,{...e})}function kT({children:e,...t}){return(0,j.jsx)(It,{...t,children:(0,j.jsx)(yw,{children:e})})}function AT(e){return(0,j.jsx)(Pt,{...e})}function jT({className:e,children:t,flush:n,size:r,...i}){let a=[vT];return r&&a.push(yT[r]),n&&a.push(bT),e&&a.push(e),(0,j.jsx)(Bt,{className:a.join(` `),...i,children:t})}function MT({align:e=`center`,side:t,sideOffset:n=8,className:r,children:i,...a}){return(0,j.jsx)(kT,{children:(0,j.jsx)(AT,{align:e,side:t,sideOffset:n,children:(0,j.jsx)(jT,{className:r,...a,children:i})})})}function NT({actions:e,className:t,icon:n,title:r}){return(0,j.jsxs)(`div`,{className:`${xT}${t?` ${t}`:``}`,children:[n&&(0,j.jsx)(`span`,{className:`f2q44l9`,children:n}),(0,j.jsx)(`span`,{className:ST,children:r}),e&&(0,j.jsx)(`span`,{className:`f2q44lb`,children:e})]})}function PT({children:e,className:t}){return(0,j.jsx)(`div`,{className:`${CT}${t?` ${t}`:``}`,children:e})}function FT({children:e,className:t,hint:n}){return(0,j.jsxs)(`div`,{className:`${wT}${t?` ${t}`:``}`,children:[n&&(0,j.jsx)(`span`,{className:`f2q44le`,children:n}),e]})}var IT={ctrl:`mod`,control:`mod`,cmd:`mod`,command:`mod`,meta:`mod`,mod:`mod`,option:`alt`,opt:`alt`,alt:`alt`,shift:`shift`,return:`enter`,enter:`enter`,esc:`escape`,escape:`escape`,backspace:`backspace`,del:`delete`,delete:`delete`,arrowup:`up`,up:`up`,arrowdown:`down`,down:`down`,arrowleft:`left`,left:`left`,arrowright:`right`,right:`right`,"⌘":`mod`,"⌃":`mod`,"⇧":`shift`,"⌥":`alt`,"↵":`enter`,"⏎":`enter`,"⌫":`backspace`,"⌦":`delete`,"↑":`up`,"↓":`down`,"←":`left`,"→":`right`},LT=/[←↑→↓↵⇧⌃⌘⌥⌦⌫⏎]/g;function RT(e){let t=e.trim().toLowerCase();return IT[t]??t}function zT(e){return(e.includes(`+`)?e.split(`+`):e.replaceAll(LT,e=>`+${e}+`).split(`+`)).filter(e=>e.trim()!==``).map(RT)}var BT={mod:{label:`⌘`,name:`Command`},shift:{label:`⇧`,name:`Shift`},alt:{label:`⌥`,name:`Option`}},VT={mod:{label:`Ctrl`,name:`Control`},shift:{label:`Shift`,name:`Shift`},alt:{label:`Alt`,name:`Alt`}},HT={enter:`Enter`,backspace:`Backspace`,delete:`Delete`,up:`Up`,down:`Down`,left:`Left`,right:`Right`},UT={escape:{label:`Esc`,name:`Escape`},tab:{label:`Tab`,name:`Tab`},space:{label:`Space`,name:`Space`}};function WT(e,t){let n=t===`mac`?BT:VT;if(n[e])return n[e];if(e in HT)return{icon:e,name:HT[e]};if(UT[e])return UT[e];let r=e.length===1?e.toUpperCase():e[0].toUpperCase()+e.slice(1);return{label:r,name:r}}function GT(e){if(!e)return`other`;let t=`${e.platform??``} ${e.userAgent??``}`;return/mac|iphone|ipad|ipod/i.test(t)?`mac`:`other`}var KT=`lhlko40`,qT=`lhlko41`,JT={sm:`lhlko42`,md:`lhlko43`},YT={default:`lhlko44`,muted:`lhlko45`,inverted:`lhlko46`},XT=`lhlko47`,ZT=`lhlko48`,QT=`lhlko49`,$T={enter:sn,backspace:gn,delete:gn,up:k,down:bn,left:ln,right:vn},eE=()=>()=>{},tE=()=>GT(typeof navigator>`u`?void 0:navigator),nE=()=>`other`;function rE(){return(0,A.useSyncExternalStore)(eE,tE,nE)}function iE({className:e,keys:t,platform:n,size:r=`md`,tone:i=`default`}){let a=rE(),o=n??a,s=(typeof t==`string`?zT(t):t).map(e=>WT(e,o)),c=r===`sm`?11:12,l=`${qT} ${JT[r]} ${YT[i]}`;return(0,j.jsxs)(`kbd`,{className:`${KT}${e?` ${e}`:``}`,children:[(0,j.jsx)(`span`,{className:QT,"data-slot":`kbd-label`,children:s.map(e=>e.name).join(` `)}),s.map((e,t)=>{let n=e.icon?$T[e.icon]:void 0;return(0,j.jsx)(`kbd`,{"aria-hidden":`true`,className:l,children:n?(0,j.jsx)(n,{className:e.icon===`delete`?`${XT} ${ZT}`:XT,size:c,strokeWidth:2}):e.label},`${e.name}-${t}`)})]})}var aE=`_1cspf2m0`,oE=`_1cspf2m1`;function sE(e){return(0,j.jsx)(Qr,{...e})}function cE(e){return(0,j.jsx)(Yt,{...e})}function lE(e){return(0,j.jsx)(Jt,{...e})}function uE({children:e,...t}){return(0,j.jsx)(Lt,{...t,children:(0,j.jsx)(yw,{children:e})})}function dE(e){return(0,j.jsx)(mn,{...e})}function fE({className:e,children:t,shortcut:n,...r}){return(0,j.jsxs)(Rt,{className:`${oE}${e?` ${e}`:``}`,...r,children:[t,n&&(0,j.jsx)(iE,{className:`_1cspf2m2`,keys:n,size:`sm`,tone:`inverted`})]})}function pE({side:e=`top`,sideOffset:t=6,align:n=`center`,className:r,children:i,...a}){return(0,j.jsx)(uE,{children:(0,j.jsx)(dE,{align:n,className:aE,side:e,sideOffset:t,children:(0,j.jsx)(fE,{className:r,...a,children:i})})})}var mE=ei,hE=(e,t,n)=>e<t?t:e>n?n:e,gE=e=>Math.round(hE(e,0,1)*255),_E=e=>e.toString(16).padStart(2,`0`);function vE(e,t,n){let r=(e%360+360)%360/60,i=hE(t,0,1),a=hE(n,0,1),o=a*i,s=o*(1-Math.abs(r%2-1)),c=a-o,l,u,d;return r<1?[l,u,d]=[o,s,0]:r<2?[l,u,d]=[s,o,0]:r<3?[l,u,d]=[0,o,s]:r<4?[l,u,d]=[0,s,o]:r<5?[l,u,d]=[s,0,o]:[l,u,d]=[o,0,s],{r:l+c,g:u+c,b:d+c}}function yE(e,t,n){let r=Math.max(e,t,n),i=r-Math.min(e,t,n),a=r,o=r===0?0:i/r,s=0;return i!==0&&(s=r===e?(t-n)/i%6:r===t?(n-e)/i+2:(e-t)/i+4,s*=60,s<0&&(s+=360)),{h:s,s:o,v:a}}function bE(e){let{r:t,g:n,b:r}=vE(e.h,e.s,e.v),i=`#${_E(gE(t))}${_E(gE(n))}${_E(gE(r))}`;return e.a<1?`${i}${_E(gE(e.a))}`:i}function xE(e){let t=e.trim().replace(/^#/,``);return!/^[\da-f]+$/i.test(t)||((t.length===3||t.length===4)&&(t=t.split(``).map(e=>e+e).join(``)),t.length!==6&&t.length!==8)?null:{r:Number.parseInt(t.slice(0,2),16)/255,g:Number.parseInt(t.slice(2,4),16)/255,b:Number.parseInt(t.slice(4,6),16)/255,a:t.length===8?Number.parseInt(t.slice(6,8),16)/255:1}}function SE(e){let t=xE(e);if(!t)return null;let{h:n,s:r,v:i}=yE(t.r,t.g,t.b);return{h:n,s:r,v:i,a:t.a}}function CE(e){return bE({h:e,s:1,v:1,a:1})}var wE=`_17r50hf0`,TE=`_17r50hf1`,EE=`_17r50hf2`,DE=`_17r50hf3`,OE=`_17r50hf4`,kE=`_17r50hf5`,AE=`_17r50hf6`,jE=`_17r50hf7`,ME=`_17r50hf8`,NE=`_17r50hf9`,PE=`_17r50hfa`,FE=`_17r50hfb`,IE=`_17r50hfc`,LE=`_17r50hfd`,RE=`_17r50hfe`,zE=`_17r50hff`,BE=`_17r50hfg`,VE=`_17r50hfh`,HE=`_17r50hfi`,UE=`_17r50hfj`,WE=`_17r50hfk`,GE=`_17r50hfl`,KE=`_17r50hfm`,qE=`_17r50hfn`,JE=`_17r50hfo`,YE=`_17r50hfp`,XE=`_17r50hfq`,ZE=`_17r50hfr`,QE=`_17r50hfs`,$E=`_17r50hft`,eD=`_17r50hfu`,tD=`_17r50hfx`,nD=`_17r50hfy`,rD=`_17r50hfz`,iD=`_17r50hf10`,aD={h:0,s:0,v:0,a:1};function oD(e){return!e||e===`inherit`||e===`currentColor`?aD:SE(e)??aD}function sD({initialColor:e,onApply:t,onCancel:n,onBack:r}){let[i,a]=(0,A.useState)(()=>oD(e)),[o,s]=(0,A.useState)(()=>bE(oD(e))),[c,l]=(0,A.useState)(!1),[u,d]=(0,A.useState)(!1),f=(0,A.useRef)(e),p=(0,A.useRef)(null),m=(0,A.useRef)(null),h=(0,A.useRef)(null);(0,A.useEffect)(()=>{d(typeof window<`u`&&`EyeDropper`in window)},[]),(0,A.useEffect)(()=>{document.activeElement?.tagName!==`INPUT`&&(s(bE(i)),l(!1))},[i]);let g=bE(i),_=(e,t)=>{let n=e===`sat`?p.current:e===`hue`?m.current:h.current;if(!n)return;let r=n.getBoundingClientRect(),i=hE((t.clientX-r.left)/r.width,0,1),o=hE((t.clientY-r.top)/r.height,0,1);a(t=>e===`sat`?{...t,s:i,v:1-o}:e===`hue`?{...t,h:i*360}:{...t,a:i})},v=e=>t=>{t.preventDefault(),t.currentTarget.setPointerCapture(t.pointerId),_(e,t)},y=e=>t=>{t.buttons!==0&&_(e,t)},b=e=>{s(e);let t=xE(e);if(!t){l(!0);return}l(!1);let{h:n,s:r,v:i}=yE(t.r,t.g,t.b);a({h:n,s:r,v:i,a:t.a})},x=()=>{c&&(s(g),l(!1))},S=async()=>{let e=window.EyeDropper;if(e)try{let t=xE((await new e().open()).sRGBHex);if(!t)return;let{h:n,s:r,v:i}=yE(t.r,t.g,t.b);a(e=>({h:n,s:r,v:i,a:e.a}))}catch{}},C=()=>t(g),w=CE(i.h),T=bE(i),E=f.current===`inherit`||!f.current?`transparent`:f.current;return(0,j.jsxs)(`div`,{className:VE,children:[(0,j.jsxs)(`button`,{"aria-label":`Back to presets`,className:HE,type:`button`,onClick:r,onMouseDown:e=>e.preventDefault(),children:[(0,j.jsx)(ln,{className:UE}),(0,j.jsx)(`span`,{children:`Back`})]}),(0,j.jsxs)(`div`,{className:WE,ref:p,style:{backgroundColor:w},onPointerDown:v(`sat`),onPointerMove:y(`sat`),children:[(0,j.jsx)(`div`,{className:GE}),(0,j.jsx)(`div`,{className:KE}),(0,j.jsx)(`div`,{className:qE,style:{left:`${i.s*100}%`,top:`${(1-i.v)*100}%`,backgroundColor:bE({...i,a:1})}})]}),(0,j.jsx)(`div`,{className:JE,ref:m,onPointerDown:v(`hue`),onPointerMove:y(`hue`),children:(0,j.jsx)(`div`,{className:ZE,style:{left:`${i.h/360*100}%`,backgroundColor:w}})}),(0,j.jsxs)(`div`,{className:YE,ref:h,onPointerDown:v(`alpha`),onPointerMove:y(`alpha`),children:[(0,j.jsx)(`div`,{className:XE,style:{background:`linear-gradient(to right, transparent, ${bE({...i,a:1})})`}}),(0,j.jsx)(`div`,{className:ZE,style:{left:`${i.a*100}%`,backgroundColor:g}})]}),(0,j.jsxs)(`div`,{className:QE,children:[(0,j.jsx)(`input`,{"aria-invalid":c||void 0,"aria-label":`Hex color`,className:`${$E}${c?` ${eD}`:``}`,spellCheck:!1,type:`text`,value:o,onBlur:x,onChange:e=>b(e.target.value)}),u&&(0,j.jsx)(`button`,{"aria-label":`Pick color from screen`,className:`_17r50hfv`,type:`button`,onClick:S,onMouseDown:e=>e.preventDefault(),children:(0,j.jsx)(tr,{className:`_17r50hfw`})}),(0,j.jsxs)(`div`,{"aria-hidden":!0,className:tD,children:[(0,j.jsx)(`div`,{className:nD,style:{backgroundColor:E}}),(0,j.jsx)(`div`,{className:nD,style:{backgroundColor:T}})]})]}),(0,j.jsxs)(`div`,{className:rD,children:[(0,j.jsx)(Pw,{className:iD,size:`md`,variant:`outline`,onClick:n,onMouseDown:e=>e.preventDefault(),children:`Cancel`}),(0,j.jsx)(Pw,{className:iD,size:`md`,variant:`solid`,onClick:C,onMouseDown:e=>e.preventDefault(),children:`Apply`})]})]})}var cD=Aw({defaultClassName:`_6d8tz20`,variantClassNames:{size:{sm:`_6d8tz21`,md:`_6d8tz22`},fullWidth:{true:`_6d8tz23`,false:`_6d8tz24`}},defaultVariants:{size:`sm`,fullWidth:!1},compoundVariants:[]}),lD=Aw({defaultClassName:`_6d8tz25`,variantClassNames:{ready:{true:`_6d8tz26`,false:`_6d8tz27`}},defaultVariants:{ready:!0},compoundVariants:[]}),uD=Aw({defaultClassName:`_6d8tz28`,variantClassNames:{size:{sm:`_6d8tz29`,md:`_6d8tz2a`},active:{true:`_6d8tz2b`,false:`_6d8tz2c`},disabled:{true:`_6d8tz2d`,false:`_6d8tz2e`},fullWidth:{true:`_6d8tz2f`,false:`_6d8tz2g`}},defaultVariants:{size:`sm`,active:!1,disabled:!1,fullWidth:!1},compoundVariants:[]});function dD({items:e,value:t,onChange:n,size:r=`sm`,fullWidth:i=!1,className:a}){let o=(0,A.useRef)(null),s=(0,A.useRef)(new Map),[c,l]=(0,A.useState)({left:0,width:0}),[u,d]=(0,A.useState)(!1),f=(0,A.useCallback)(()=>{let e=o.current,n=s.current.get(t);if(!e||!n)return;let r=e.getBoundingClientRect(),i=n.getBoundingClientRect();l({left:i.left-r.left,width:i.width}),d(!0)},[t]);return(0,A.useEffect)(()=>{f()},[f]),(0,A.useEffect)(()=>{let e=o.current;if(!e)return;let t=new ResizeObserver(()=>{f()});return t.observe(e),()=>t.disconnect()},[f]),(0,j.jsxs)(`div`,{"aria-orientation":`horizontal`,className:`${cD({size:r,fullWidth:i})} ${a||``}`.trim(),ref:o,role:`tablist`,onKeyDown:r=>{let i=e.filter(e=>!e.disabled),a=i.findIndex(e=>e.value===t),o=a;switch(r.key){case`ArrowRight`:case`ArrowDown`:r.preventDefault(),o=(a+1)%i.length;break;case`ArrowLeft`:case`ArrowUp`:r.preventDefault(),o=(a-1+i.length)%i.length;break;case`Home`:r.preventDefault(),o=0;break;case`End`:r.preventDefault(),o=i.length-1}if(o!==a){let e=i[o];n(e.value),s.current.get(e.value)?.focus()}},children:[(0,j.jsx)(`div`,{"aria-hidden":`true`,className:lD({ready:u}),style:{left:c.left,width:c.width}}),e.map(e=>{let a=e.value===t;return(0,j.jsx)(`button`,{"aria-selected":a,"data-active":a||void 0,disabled:e.disabled,role:`tab`,tabIndex:a?0:-1,type:`button`,className:uD({size:r,active:a,disabled:!!e.disabled,fullWidth:i}),ref:t=>{t?s.current.set(e.value,t):s.current.delete(e.value)},onClick:()=>n(e.value),children:e.label},e.value)})]})}var fD=`inherit`,pD=[[`Gray`,`#737373`],[`Red`,`#ef4444`],[`Orange`,`#f97316`],[`Amber`,`#f59e0b`],[`Green`,`#22c55e`],[`Teal`,`#14b8a6`],[`Blue`,`#3b82f6`],[`Indigo`,`#6366f1`],[`Purple`,`#a855f7`],[`Pink`,`#ec4899`]],mD=e=>`color-mix(in oklab, ${e} 75%, var(--rc-text, #171717))`,hD=e=>`color-mix(in oklab, ${e} 18%, transparent)`,gD={text:pD.map(([e,t])=>({name:e,value:mD(t)})),background:pD.map(([e,t])=>({name:e,value:hD(t)}))};function _D(e){return!e||e===`inherit`||e===`transparent`}function vD(e,t){return gD[e].find(e=>e.value===t)?.name??t}var yD=8,bD=[{label:`Text`,value:`text`},{label:`Background`,value:`background`}];function xD(e){let t=e.key===`ArrowRight`?1:e.key===`ArrowLeft`?-1:e.key===`ArrowDown`?yD:e.key===`ArrowUp`?-8:0;if(!t)return;let n=Array.from(e.currentTarget.querySelectorAll(`button`)),r=n.indexOf(document.activeElement);if(r===-1)return;let i=n[Math.max(0,Math.min(n.length-1,r+t))];e.preventDefault(),i?.focus()}function SD({current:e,onPick:t,preset:n,target:r}){let i=n.value===fD,a=i?_D(e):e===n.value;return(0,j.jsx)(`button`,{"aria-label":n.name,"aria-pressed":a,className:PE,title:n.name,type:`button`,onClick:()=>t(n.value),onMouseDown:e=>e.preventDefault(),children:i?(0,j.jsx)(`span`,{"data-default-swatch":!0,className:`${FE} ${IE}`}):r===`background`?(0,j.jsx)(`span`,{className:LE,style:{backgroundColor:n.value},children:`A`}):(0,j.jsx)(`span`,{className:FE,style:{backgroundColor:n.value}})})}function CD({current:e,onCustom:t,onPick:n,onTargetChange:r,recent:i,target:a}){let o=[{name:`Default`,value:fD},...gD[a]];return(0,j.jsxs)(`div`,{className:AE,children:[r&&(0,j.jsx)(dD,{fullWidth:!0,items:bD,value:a,onChange:r}),(0,j.jsxs)(`div`,{className:jE,children:[(0,j.jsx)(`div`,{className:ME,children:`Theme colors`}),(0,j.jsx)(`div`,{"aria-label":`Theme colors`,className:NE,role:`group`,onKeyDown:xD,children:o.map(t=>(0,j.jsx)(SD,{current:e,preset:t,target:a,onPick:n},t.value))})]}),i.length>0&&(0,j.jsxs)(`div`,{className:`_17r50hf7`,children:[(0,j.jsx)(`div`,{className:`_17r50hf8`,children:`Recent`}),(0,j.jsx)(`div`,{"aria-label":`Recent colors`,className:`_17r50hf9`,role:`group`,onKeyDown:xD,children:i.map(t=>(0,j.jsx)(SD,{current:e,preset:{name:vD(a,t),value:t},target:a,onPick:n},t))})]}),(0,j.jsx)(`div`,{className:RE,children:(0,j.jsxs)(`button`,{"aria-label":`Custom color`,className:zE,type:`button`,onClick:t,onMouseDown:e=>e.preventDefault(),children:[(0,j.jsx)(ar,{className:BE}),`Custom…`]})})]})}var wD=5,TD=`haklex:color-picker:recent`,ED={text:[],background:[]},DD=null,OD=new Set;function kD(e){return Array.isArray(e)?e.filter(e=>typeof e==`string`).slice(0,wD):[]}function AD(){if(DD)return DD;DD=ED;try{let e=localStorage.getItem(TD);if(e){let t=JSON.parse(e);DD={text:kD(t.text),background:kD(t.background)}}}catch{DD=ED}return DD}function jD(e){try{return localStorage.setItem(TD,JSON.stringify(e)),!0}catch{return!1}}function MD(e,t){let n=AD(),r=[t,...n[e].filter(e=>e!==t)].slice(0,wD);DD={...n,[e]:r},jD(DD);for(let e of OD)e()}function ND(e){return OD.add(e),()=>{OD.delete(e)}}var PD=()=>ED;function FD(e){return(0,A.useSyncExternalStore)(ND,AD,PD)[e]}function ID({currentColor:e,currentBackground:t,onSelect:n,onSelectBackground:r,className:i,tooltip:a}){let[o,s]=(0,A.useState)(!1),[c,l]=(0,A.useState)(`preset`),[u,d]=(0,A.useState)(`text`),f=FD(u),p=r?u:`text`,m=p===`text`?e:t??``,h=_D(e)?`currentColor`:e,g=_D(t)?void 0:t,_=e=>{s(e),e||l(`preset`)},v=e=>{e!==`inherit`&&MD(p,e),p===`background`?r?.(e):n(e),_(!1)},y=(0,j.jsx)(`button`,{"aria-label":`Text color`,"data-tooltip":a,type:`button`,onMouseDown:e=>e.preventDefault()}),b=(0,j.jsxs)(OT,{className:`${wE}${i?` ${i}`:``}`,render:y,children:[(0,j.jsxs)(`span`,{className:TE,children:[(0,j.jsx)(`span`,{className:EE,style:{color:h,backgroundColor:g},children:`A`}),(0,j.jsx)(`span`,{className:DE,style:{backgroundColor:h}})]}),(0,j.jsx)(En,{className:OE})]});return(0,j.jsxs)(DT,{open:o,onOpenChange:_,children:[a?(0,j.jsxs)(cE,{children:[(0,j.jsx)(lE,{render:b}),(0,j.jsx)(pE,{side:`bottom`,children:a})]}):b,(0,j.jsx)(MT,{className:kE,side:`bottom`,size:`md`,children:c===`preset`?(0,j.jsx)(CD,{current:m,recent:f,target:p,onCustom:()=>l(`picker`),onPick:v,onTargetChange:r?d:void 0}):(0,j.jsx)(sD,{initialColor:m,onApply:v,onBack:()=>l(`preset`),onCancel:()=>_(!1)})})]})}var LD=`_2buwsh1`,RD=`_2buwsh2`,zD=`_2buwsh3`;function BD(e){return(0,j.jsx)(bw,{...e})}function VD({className:e,...t}){return(0,j.jsx)(Ji,{className:e??`_2buwsh0`,...t})}function HD({children:e}){return(0,j.jsx)(ta,{children:(0,j.jsx)(yw,{children:e})})}function UD({align:e=`start`,alignOffset:t=0,side:n=`bottom`,sideOffset:r=4,className:i,positionMethod:a=`absolute`,children:o,...s}){return(0,j.jsx)(HD,{children:(0,j.jsx)(na,{align:e,alignOffset:t,positionMethod:a,side:n,sideOffset:r,style:{zIndex:50},children:(0,j.jsx)(ia,{className:`${LD}${i?` ${i}`:``}`,...s,children:o})})})}function WD(e){return(0,j.jsx)(Qi,{...e})}function GD({className:e,...t}){return(0,j.jsx)(ua,{className:`${RD}${e?` ${e}`:``}`,...t})}function KD({className:e,...t}){return(0,j.jsx)(da,{className:`${zD}${e?` ${e}`:``}`,...t})}var qD=`vwlngv0`,JD=`vwlngv1`,YD=`vwlngv5`,XD=`vwlngva`,ZD=`vwlngvb`,QD=`vwlngvc`,$D=`vwlngvd`,eO=`vwlngve`,tO=[],nO=0,rO=new Set;function iO(){for(let e of rO)e()}function aO(e){return rO.add(e),()=>{rO.delete(e)}}function oO(){return tO}function sO(e){let t=`dialog-${++nO}`;return tO=[...tO,{...e,id:t,open:!0}],iO(),()=>lO(t)}function cO(e){tO=tO.filter(t=>t.id!==e),iO()}function lO(e){let t=tO.find(t=>t.id===e);t&&t.open&&(tO=tO.map(t=>t.id===e?{...t,open:!1}:t),iO(),t.onClose?.())}async function uO(e){let t=tO.find(t=>t.id===e);t&&t.open&&(!t.confirmDismiss||await t.confirmDismiss())&&lO(e)}function dO(e){return e===void 0?{}:{"--rc-dialog-width":typeof e==`number`?`${e}px`:Sw[e]}}function fO(){for(let e=tO.length-1;e>=0;e--)if(tO[e].open){lO(tO[e].id);return}}function pO({cancelLabel:e=`Keep editing`,confirmLabel:t=`Discard`,description:n=`Your edits haven’t been saved.`,title:r=`Discard changes?`}={}){return new Promise(i=>{let a=!1,o=e=>{a||(a=!0,i(e))};sO({title:r,description:n,showCloseButton:!1,width:360,onClose:()=>o(!1),content:({dismiss:n})=>(0,j.jsxs)(`div`,{className:YD,children:[(0,j.jsx)(Pw,{size:`md`,variant:`outline`,onClick:()=>{o(!1),n()},children:e}),(0,j.jsx)(Pw,{autoFocus:!0,danger:!0,size:`md`,variant:`solid`,onClick:()=>{o(!0),n()},children:t})]})})})}var mO=2400,hO=[],gO=0,_O=new Map,vO=new Set;function yO(){for(let e of vO)e()}function bO(e){let t=_O.get(e.id);t&&clearTimeout(t),_O.delete(e.id),(e.tone!==`loading`||e.duration!==void 0)&&_O.set(e.id,setTimeout(()=>TO(e.id),e.duration??mO))}function xO(e){return vO.add(e),()=>{vO.delete(e)}}function SO(){return hO}function CO(e){let t={...e,id:`toast-${++gO}`};return hO=[...hO,t],bO(t),yO(),t.id}function wO(e,t){let n;hO=hO.map(r=>r.id===e?(n={...r,...t},n):r),n&&(bO(n),yO())}function TO(e){let t=_O.get(e);t&&clearTimeout(t),_O.delete(e),hO.some(t=>t.id===e)&&(hO=hO.filter(t=>t.id!==e),yO())}var EO=`xom7f32`,DO=`xom7f33`,OO=`xom7f34`,kO=`xom7f35`,AO=`xom7f36`,jO=`xom7f37`,MO=`xom7f38`,NO=[];function PO({tone:e}){return e===`loading`?(0,j.jsx)(Ce,{className:`${kO} ${AO}`}):e===`success`?(0,j.jsx)(kn,{className:`${kO} ${jO}`}):e===`error`?(0,j.jsx)(An,{className:`${kO} ${MO}`}):null}function FO(){let e=(0,A.useSyncExternalStore)(xO,SO,()=>NO);return typeof document>`u`?null:(0,ui.createPortal)((0,j.jsx)(yw,{children:(0,j.jsx)(`div`,{"aria-live":`polite`,className:EO,role:`status`,children:e.map(e=>(0,j.jsxs)(`div`,{className:DO,children:[(0,j.jsx)(PO,{tone:e.tone}),(0,j.jsx)(`span`,{className:OO,children:e.title}),e.action&&(0,j.jsx)(Pw,{size:`sm`,onClick:()=>{e.action?.onClick(),TO(e.id)},children:e.action.label})]},e.id))})}),document.body)}function IO(e){if(e.isContentEditable||e.classList.contains(`cm-editor`))return!0;let{overflowY:t}=getComputedStyle(e);return(t===`auto`||t===`scroll`)&&e.scrollHeight>e.clientHeight}function LO(e,t){for(let n=e;n&&n!==t;n=n.parentElement)if(n.scrollTop>0&&IO(n))return!0;return!1}var RO=({item:e,index:t})=>{let{id:n,open:r,title:i,description:a,content:o,className:s,portalClassName:c,theme:l=`light`,clickOutsideToDismiss:u=!0}=e,d=(0,A.useCallback)(()=>lO(n),[n]),f=(0,A.useCallback)(()=>uO(n),[n]);(0,A.useEffect)(()=>{if(!r){let e=setTimeout(()=>cO(n),200);return()=>clearTimeout(e)}},[r,n]),(0,A.useEffect)(()=>{let e=document.body.style.overflow;return document.body.style.overflow=`hidden`,()=>{document.body.style.overflow=e}},[]);let p=(0,A.useRef)(null),m=(0,A.useRef)(null),[h,g]=(0,A.useState)(0),[_,v]=(0,A.useState)(!1),y=(0,A.useCallback)(e=>{let t=e.touches[0],n=e.target;n.closest(`.vwlngvc, .vwlngvf`)===null&&LO(n,p.current)||(m.current={startY:t.clientY,startTime:Date.now(),currentY:t.clientY,isDragging:!1})},[]),b=(0,A.useCallback)(e=>{let t=m.current;if(!t)return;let n=e.touches[0],r=n.clientY-t.startY;r<0?t.isDragging&&=(g(0),v(!1),!1):(!t.isDragging&&r>5&&(t.isDragging=!0,v(!0)),t.isDragging&&(e.preventDefault(),t.currentY=n.clientY,g(r)))},[]),x=(0,A.useCallback)(()=>{let e=m.current;if(!e||!e.isDragging){m.current=null;return}let t=e.currentY-e.startY,n=Date.now()-e.startTime,r=t/Math.max(n,1)*1e3,i=(p.current?.offsetHeight??0)*.25;g(0),(t>i||r>500)&&f(),v(!1),m.current=null},[f]),S=50+t,C=p.current?.offsetHeight||1,w=_?Math.max(0,1-h/C):1;return(0,j.jsx)(_w,{className:c??``,theme:l,children:(0,j.jsxs)(yw,{children:[(0,j.jsx)(`div`,{className:XD,style:{zIndex:S,opacity:r?w:0,pointerEvents:r?`auto`:`none`},onClick:u?f:void 0}),(0,j.jsxs)(`div`,{className:`${ZD}${s?` ${s}`:``}`,"data-closed":r?void 0:``,"data-open":r?``:void 0,ref:p,style:{zIndex:S+1,transform:_?`translateY(${h}px)`:void 0,transition:_?`none`:`transform 300ms cubic-bezier(0.32, 0.72, 0, 1)`},onTouchEnd:x,onTouchMove:b,onTouchStart:y,children:[(0,j.jsx)(`div`,{className:QD,children:(0,j.jsx)(`div`,{className:$D})}),(i||a)&&(0,j.jsxs)(`div`,{className:`vwlngvf`,children:[i&&(0,j.jsx)(`div`,{className:`vwlngv6`,children:i}),a&&(0,j.jsx)(`div`,{className:`vwlngv7`,children:a})]}),(0,j.jsx)(`div`,{className:eO,children:(0,A.createElement)(o,{dismiss:d,requestDismiss:f})})]})]})})},zO=`(max-width: 640px)`;function BO(){return(0,A.useSyncExternalStore)(e=>{let t=window.matchMedia(zO);return t.addEventListener(`change`,e),()=>t.removeEventListener(`change`,e)},()=>window.matchMedia(zO).matches,()=>!1)}function VO(e,t){return e===!0||e===`auto`&&t}var HO=()=>(0,j.jsx)(Ge,{}),UO=({item:e,index:t})=>{let{id:n,open:r,title:i,description:a,content:o,className:s,portalClassName:c,theme:l=`light`,showCloseButton:u=!0,clickOutsideToDismiss:d=!0,width:f}=e,g=(0,A.useCallback)(()=>lO(n),[n]),_=(0,A.useCallback)(()=>uO(n),[n]);(0,A.useEffect)(()=>{if(!r){let e=setTimeout(()=>{cO(n)},150);return()=>clearTimeout(e)}},[r,n]);let v=50+t;return(0,j.jsx)(h,{disablePointerDismissal:!d,open:r,onOpenChange:e=>{e||_()},children:(0,j.jsx)(ve,{children:(0,j.jsx)(_w,{className:c??``,theme:l,children:(0,j.jsxs)(yw,{children:[(0,j.jsx)(D,{className:qD,style:{zIndex:v}}),(0,j.jsxs)(m,{suppressHydrationWarning:!0,className:`${JD}${s?` ${s}`:``}`,"data-theme":l,style:{zIndex:v+1,...dO(f)},children:[(i||a||u)&&(0,j.jsxs)(`div`,{className:`vwlngv3`,children:[(i||a)&&(0,j.jsxs)(`div`,{className:`vwlngv4`,children:[i&&(0,j.jsx)(p,{className:`vwlngv6`,children:i}),a&&(0,j.jsx)(E,{className:`vwlngv7`,children:a})]}),u&&(0,j.jsx)(w,{className:`vwlngv2`,children:(0,j.jsx)(HO,{})})]}),(0,A.createElement)(o,{dismiss:g,requestDismiss:_})]})]})})})})},WO=({children:e})=>{let t=(0,A.useSyncExternalStore)(aO,oO,oO),n=BO();return(0,j.jsxs)(j.Fragment,{children:[e,(0,j.jsx)(FO,{}),t.map((e,t)=>VO(e.sheet,n)?(0,j.jsx)(RO,{index:t,item:e},e.id):(0,j.jsx)(UO,{index:t,item:e},e.id))]})},GO=`oih0op0`,KO=`oih0op1`,qO=`oih0op2`,JO=`_1sxaacb3`,YO=`_1sxaacb4`,XO=`oih0op3`,ZO=`oih0op3`,QO=`oih0op4`,$O=`oih0op4`,ek=`oih0op5`,tk=`oih0op6`;function nk(e){return(0,j.jsx)(ye,{"data-slot":`dropdown-menu`,...e})}function rk(e){return(0,j.jsx)(sr,{"data-slot":`dropdown-menu-trigger`,...e})}function ik({children:e}){return(0,j.jsx)(se,{children:(0,j.jsx)(yw,{children:e})})}function ak({align:e=`start`,alignOffset:t=0,side:n=`bottom`,sideOffset:r=4,className:i,positionMethod:a=`absolute`,children:o,...s}){return(0,j.jsx)(ik,{children:(0,j.jsx)(ae,{align:e,alignOffset:t,className:KO,"data-slot":`dropdown-menu-positioner`,positionMethod:a,side:n,sideOffset:r,style:{zIndex:50},children:(0,j.jsx)(oe,{className:`${GO}${i?` ${i}`:``}`,"data-slot":`dropdown-menu-content`,...s,children:o})})})}function ok(e){return(0,j.jsx)(re,{"data-slot":`dropdown-menu-group`,...e})}function sk({className:e,...t}){return(0,j.jsx)(De,{className:`${YO}${e?` ${e}`:``}`,"data-slot":`dropdown-menu-label`,...t})}function ck({className:e,children:t,shortcut:n,variant:r=`default`,...i}){let a=[qO,r===`destructive`&&`_1sxaacb1`,e].filter(Boolean).join(` `);return(0,j.jsxs)(xe,{className:a,"data-slot":`dropdown-menu-item`,...i,children:[t,n&&(0,j.jsx)(iE,{className:`_1sxaacb2`,keys:n,size:`sm`,tone:`muted`})]})}function lk(e){return(0,j.jsx)(ge,{...e})}function uk({className:e,children:t,value:n,...r}){return(0,j.jsxs)(le,{className:`${qO} ${ek}${e?` ${e}`:``}`,"data-slot":`dropdown-menu-sub-trigger`,...r,children:[t,(0,j.jsxs)(`span`,{className:tk,children:[n,(0,j.jsx)(Dn,{})]})]})}function dk({className:e,...t}){return(0,j.jsx)(te,{className:`${JO}${e?` ${e}`:``}`,"data-slot":`dropdown-menu-separator`,...t})}function fk(e){return(0,j.jsx)(ii,{"data-slot":`dropdown-menu-radio-group`,...e})}function pk({className:e,children:t,...n}){return(0,j.jsxs)(ci,{className:`${qO} ${ZO}${e?` ${e}`:``}`,"data-slot":`dropdown-menu-radio-item`,...n,children:[t,(0,j.jsx)(li,{className:$O,"data-slot":`dropdown-menu-radio-item-indicator`,children:(0,j.jsx)(hk,{})})]})}function mk({className:e,children:t,...n}){return(0,j.jsxs)(o,{className:`${qO} ${XO}${e?` ${e}`:``}`,"data-slot":`dropdown-menu-checkbox-item`,...n,children:[t,(0,j.jsx)(x,{className:QO,"data-slot":`dropdown-menu-checkbox-item-indicator`,children:(0,j.jsx)(hk,{})})]})}function hk(){return(0,j.jsx)(d,{size:16})}function gk({editable:e,editor:t,readOnly:n}){let r=(0,A.useCallback)(e=>t.registerEditableListener(e),[t]),i=(0,A.useCallback)(()=>t.isEditable(),[t]),a=(0,A.useSyncExternalStore)(r,i,i);return(0,j.jsx)(j.Fragment,{children:a?e:n})}var _k=`_1i1no470`,vk=`_1i1no471`,yk=`_1i1no472`,bk=`_1i1no473`;function xk({children:e,className:t,error:n,hint:r,id:i,label:a}){return(0,j.jsxs)(`div`,{className:`${_k}${t?` ${t}`:``}`,children:[(0,j.jsx)(`label`,{className:vk,htmlFor:i,children:a}),e,n?(0,j.jsx)(`p`,{className:bk,id:`${i}-error`,role:`alert`,children:n}):r?(0,j.jsx)(`p`,{className:yk,id:`${i}-hint`,children:r}):null]})}var Sk=`_1q3gqvh0`,Ck=`_1q3gqvh1`,wk=`_1q3gqvh2`,Tk=`_1q3gqvh4`,Ek=`_1q3gqvh5`,Dk=`_1q3gqvh6`,Ok=`_1q3gqvh8`,kk=`_1q3gqvh9`,Ak=`_1q3gqvha`;function jk({children:e,className:t,onSave:n}){return(0,j.jsx)(`div`,{className:`${Sk}${t?` ${t}`:``}`,onKeyDown:e=>{n&&!e.defaultPrevented&&(e.metaKey||e.ctrlKey)&&(e.key===`s`||e.key===`Enter`)&&(e.preventDefault(),n())},children:e})}function Mk({actions:e,center:t,closeLabel:n=`Close`,icon:r,onClose:i,title:a}){return(0,j.jsxs)(`div`,{className:Ck,children:[(0,j.jsxs)(`div`,{className:wk,children:[r&&(0,j.jsx)(`span`,{className:`_1q3gqvh3`,children:r}),(0,j.jsx)(`span`,{className:Tk,children:a})]}),(0,j.jsx)(`div`,{className:Ek,children:t}),(0,j.jsxs)(`div`,{className:Dk,children:[e,i&&(0,j.jsxs)(j.Fragment,{children:[e&&(0,j.jsx)(`span`,{className:`_1q3gqvh7`}),(0,j.jsx)(Pw,{icon:!0,"aria-label":n,size:`md`,title:n,onClick:i,children:(0,j.jsx)(Ge,{})})]})]})]})}function Nk({children:e,className:t}){return(0,j.jsx)(`div`,{className:`${Ok}${t?` ${t}`:``}`,children:e})}function Pk({cancelLabel:e=`Cancel`,children:t,dirty:n,onCancel:r,onSave:i,saveDisabled:a,saveLabel:o=`Save`,status:s}){return(0,j.jsxs)(`div`,{className:kk,children:[(0,j.jsxs)(`div`,{className:Ak,children:[n&&(0,j.jsx)(`span`,{"aria-hidden":!0,className:`_1q3gqvhb`}),s]}),t,r&&(0,j.jsx)(Pw,{size:`md`,variant:`outline`,onClick:r,children:e}),i&&(0,j.jsxs)(Pw,{disabled:a,size:`md`,variant:`solid`,onClick:i,children:[o,(0,j.jsx)(iE,{keys:[`mod`,`s`],size:`sm`,tone:`inverted`})]})]})}var Fk=`_1dj5lvb0`,Ik=`_1dj5lvb1`,Lk=`_1dj5lvb2`,Rk=`_1dj5lvb3`,zk=`_1dj5lvb4`,Bk=`rich-quote`,Vk=`data-quote-attribution-slot`;function Hk(e){if(!e)return!1;let t=e.constructor;return typeof t.getType==`function`&&t.getType()===Bk}function Uk(){let e=[],t=n=>{if(Hk(n)&&e.push(n),`getChildren`in n&&typeof n.getChildren==`function`)for(let e of n.getChildren())t(e)};for(let e of V().getChildren())t(e);return e}function Wk(){let e=J();if(!q(e))return null;let t=e.anchor.getNode();for(;t;){if(Hk(t))return t.getKey();t=t.getParent()}return null}function Gk(e){if(!e)return null;for(let t of e.children)if(t.hasAttribute(Vk))return t;return null}var Kk=(e,t)=>e.length===t.length&&e.every((e,n)=>e.key===t[n].key&&e.attribution===t[n].attribution&&e.slot===t[n].slot);function qk(){let[e]=ha(),[t,n]=(0,A.useState)([]),[r,i]=(0,A.useState)(null),[a,o]=(0,A.useState)(()=>e.isEditable());return(0,A.useEffect)(()=>e.registerEditableListener(o),[e]),(0,A.useEffect)(()=>{let t=()=>{e.getEditorState().read(()=>{let t=[];for(let n of Uk()){let r=Gk(e.getElementByKey(n.getKey()));r&&t.push({key:n.getKey(),attribution:n.getAttribution()??``,slot:r})}n(e=>Kk(e,t)?e:t),i(Wk())})},r=e.registerRootListener(()=>queueMicrotask(t)),a=e.registerUpdateListener(t);return()=>{r(),a()}},[e]),(0,j.jsx)(j.Fragment,{children:t.map(t=>(0,ui.createPortal)((0,j.jsx)(Yk,{active:t.key===r,attribution:t.attribution,editable:a,editor:e,quoteKey:t.key,slot:t.slot}),t.slot,t.key))})}var Jk=e=>e.stopPropagation(),Yk=(0,A.memo)(function({active:e,attribution:t,editable:n,editor:r,quoteKey:i,slot:a}){let[o,s]=(0,A.useState)(t),[c,l]=(0,A.useState)(!1);(0,A.useEffect)(()=>{c||s(t)},[t,c]),(0,A.useLayoutEffect)(()=>{a.classList.add(Fk),a.toggleAttribute(`data-empty`,!t),a.toggleAttribute(`data-active`,e||c)},[e,t,c,a]),(0,A.useLayoutEffect)(()=>()=>{a.classList.remove(Fk),a.removeAttribute(`data-empty`),a.removeAttribute(`data-active`)},[a]);let u=(0,A.useCallback)(e=>{let n=e.trim()||null;n!==(t||null)&&r.update(()=>{let e=B(i);Hk(e)&&e.setAttribution(n)})},[t,r,i]),d=(0,A.useCallback)(e=>{e.stopPropagation(),e.key===`Enter`?(e.preventDefault(),u(o),e.currentTarget.blur(),r.focus()):e.key===`Escape`&&(e.preventDefault(),s(t),e.currentTarget.blur(),r.focus())},[t,u,r,o]);return n?(0,j.jsxs)(`label`,{className:Lk,children:[(0,j.jsx)(`span`,{"aria-hidden":!0,className:Rk,children:`—`}),(0,j.jsx)(`input`,{"aria-label":`Quote attribution`,className:zk,placeholder:`Author, Work`,type:`text`,value:o,onBeforeInput:Jk,onChange:e=>s(e.target.value),onClick:Jk,onCompositionEnd:Jk,onCompositionStart:Jk,onCompositionUpdate:Jk,onCopy:Jk,onCut:Jk,onDragStart:Jk,onDrop:Jk,onFocus:()=>l(!0),onInput:Jk,onKeyDown:d,onKeyUp:Jk,onMouseDown:Jk,onPaste:Jk,onPointerDown:Jk,onBlur:e=>{l(!1),u(e.currentTarget.value)}})]}):t?(0,j.jsxs)(`span`,{className:Ik,children:[`— `,t]}):null}),Xk=`p74a620`,Zk=`p74a621`,Qk=`p74a622`,$k=`p74a623`,eA=`p74a625`,tA=`p74a626`,nA=`p74a627`;function rA(e){return(0,j.jsx)(an,{...e})}function iA({children:e,className:t,...n}){return(0,j.jsxs)(un,{...n,className:`${Xk}${t?` ${t}`:``}`,children:[e,(0,j.jsx)(O,{className:Zk,children:(0,j.jsx)(En,{size:16})})]})}function aA(e){return(0,j.jsx)(pn,{...e})}function oA({children:e,className:t,align:n=`center`,alignItemWithTrigger:r=!0,side:i=`bottom`,sideOffset:a=4,...o}){return(0,j.jsx)(tn,{children:(0,j.jsx)(yw,{children:(0,j.jsx)(cn,{align:n,alignItemWithTrigger:r,className:Qk,side:i,sideOffset:a,children:(0,j.jsxs)(en,{...o,className:`${$k}${t?` ${t}`:``}`,children:[(0,j.jsx)(dn,{className:nA,children:(0,j.jsx)(Tn,{size:16})}),(0,j.jsx)(_n,{children:e}),(0,j.jsx)(hn,{className:nA,children:(0,j.jsx)(En,{size:16})})]})})})})}function sA({className:e,children:t,...n}){return(0,j.jsxs)(fn,{...n,className:`${eA}${e?` ${e}`:``}`,children:[(0,j.jsx)(on,{children:t}),(0,j.jsx)(Zt,{className:tA,children:(0,j.jsx)(d,{size:16})})]})}Aw({defaultClassName:`_131cfek1`,variantClassNames:{size:{sm:`_131cfek2`,md:`_131cfek3`,lg:`_131cfek4`}},defaultVariants:{size:`sm`},compoundVariants:[]}),Aw({defaultClassName:`_73cmpa2`,variantClassNames:{status:{idle:`_73cmpa3`,active:`_73cmpa4`,success:`_73cmpa5`,error:`_73cmpa6`,warning:`_73cmpa7`},size:{sm:`_73cmpa8`,md:`_73cmpa9`}},defaultVariants:{status:`idle`,size:`sm`},compoundVariants:[]}),Aw({defaultClassName:`_73cmpaa`,variantClassNames:{status:{idle:`_73cmpab`,active:`_73cmpac`,success:`_73cmpad`,error:`_73cmpae`,warning:`_73cmpaf`},size:{sm:`_73cmpag`,md:`_73cmpah`}},defaultVariants:{status:`idle`,size:`sm`},compoundVariants:[]});var cA=`i56btd0`,lA=`i56btd1`;function uA({invalid:e,mono:t,className:n,type:r=`text`,...i}){return(0,j.jsx)(`input`,{"aria-invalid":e||void 0,className:`${cA}${t?` ${lA}`:``}${n?` ${n}`:``}`,type:r,...i})}function dA({children:e,fallback:t,threshold:n=.5}){let r=(0,A.useRef)(null),[i,a]=(0,A.useState)(!1);return(0,A.useEffect)(()=>{if(i)return;let e=r.current;if(!e)return;let t=new IntersectionObserver(e=>{e.some(e=>e.isIntersecting)&&(a(!0),t.disconnect())},{threshold:n});return t.observe(e),()=>t.disconnect()},[i,n]),i?(0,j.jsx)(j.Fragment,{children:e}):(0,j.jsx)(`div`,{ref:r,children:t})}function fA(e,t,n){let r=(0,A.useRef)(e);r.current=e;let i=(0,A.useRef)(t?e:null),a=(0,A.useRef)(!1);return(0,A.useEffect)(()=>{i.current=t?r.current:null,a.current=!1},[t]),{apply:(0,A.useCallback)(e=>{n(e,a.current),a.current=!0},[n]),revert:(0,A.useCallback)(()=>{let e=i.current;e&&a.current&&n(e,!0),a.current=!1},[n])}}var pA=ya?A.useLayoutEffect:A.useEffect,mA={tag:Zp};function hA({initialConfig:e,children:t}){let n=(0,A.useMemo)(()=>{let{theme:t,namespace:n,nodes:r,onError:i,onWarn:a,editorState:o,html:s}=e,c=ma(null,t),l=_m({editable:e.editable,html:s,namespace:n,nodes:r,onError:e=>i(e,l),...a?{onWarn:e=>a(e,l)}:{},theme:t});return function(e,t){if(t!==null){if(t===void 0)e.update(()=>{let t=V();if(t.isEmpty()){let n=z();t.append(n);let r=e.getRootElement(),i=ya&&r!==null?Lf(r):null;(J()!==null||i!==null&&i===r)&&n.select()}},mA);else if(t!==null)switch(typeof t){case`string`:{let n=e.parseEditorState(t);e.setEditorState(n,mA);break}case`object`:e.setEditorState(t,mA);break;case`function`:e.update(()=>{V().isEmpty()&&t(e)},mA)}}}(l,o),[l,c]},[]);return pA(()=>{let t=e.editable,[r]=n;r.setEditable(t===void 0||t)},[]),(0,j.jsx)(pa.Provider,{value:n,children:t})}function gA(e){return JSON.stringify([e.exportJSON(),I(e)?e.getChildrenKeys():null])}function _A(e,t,n){let r=n(),i=0,a=r,o=0,s=null,c=new Set;return(l,u,d,f,p,m)=>{let h=n();if(m.has(`composition-start`)&&(a=r,o=i,s=l,c.clear()),s!==null){for(let e of f)c.add(e);for(let e of p.keys())c.add(e)}if(m.has(`historic`))return i=0,r=h,s=null,c.clear(),2;let g=m.has(im);g&&s&&(r=a,i=o,l=s);let _=m.has(`paste`)||m.has(`cut`)?0:function(e,t,n,r,i){if(e===null||n.size===0&&r.size===0&&!i)return 0;let a=t._selection,o=e._selection;if(i)return 1;if(!(q(a)&&q(o)&&o.isCollapsed()&&a.isCollapsed()))return 0;let s=function(e,t,n){let r=e._nodeMap,i=[];for(let e of t){let t=r.get(e);t!==void 0&&i.push(t)}for(let[e,t]of n){if(!t)continue;let n=r.get(e);n===void 0||iu(n)||i.push(n)}return i}(t,n,r);if(s.length===0)return 0;if(s.length>1){let n=t._nodeMap,r=n.get(a.anchor.key),i=n.get(o.anchor.key);return r&&i&&!e._nodeMap.has(r.__key)&&R(r)&&r.__text.length===1&&a.anchor.offset===1?2:0}let c=s[0],l=e._nodeMap.get(c.__key);if(!R(l)||!R(c)||l.__mode!==c.__mode)return 0;let u=l.__text,d=c.__text;if(u===d)return 0;let f=a.anchor,p=o.anchor;if(f.key!==p.key||f.type!==`text`)return 0;let m=f.offset,h=p.offset,g=d.length-u.length;return g===1&&h===m-1?2:g===-1&&h===m+1?3:g===-1&&h===m?4:0}(l,u,f,p,e.isComposing()),v=!1,y=(()=>{let n=d===null||d.editor===e,a=m.has(Xp),o=!a&&n&&m.has(`history-merge`);if(g&&s!==null&&n&&!a&&function(e,t,n){for(let r of e){let e=t._nodeMap.get(r),i=n._nodeMap.get(r);if(!(e===i||e&&i&&t.read(()=>gA(e))===n.read(()=>gA(i))))return!1}return!0}(c,s,u))return v=!0,0;if(o)return 0;if(_===1)return 2;if(l===null)return 1;let y=u._selection;if(!(f.size>0||p.size>0))return y===null?2:0;let b=typeof t==`number`?t:t.peek();return!1===a&&_!==0&&_===i&&h<r+b&&n||!a&&f.size===1&&function(e,t,n){let r=t._nodeMap.get(e),i=n._nodeMap.get(e),a=t._selection,o=n._selection;return!(q(a)&&q(o)&&a.anchor.type===`element`&&a.focus.type===`element`&&o.anchor.type===`text`&&o.focus.type===`text`||!R(r)||!R(i)||r.__parent!==i.__parent)&&JSON.stringify(t.read(()=>r.exportJSON()))===JSON.stringify(n.read(()=>i.exportJSON()))}(Array.from(f)[0],l,u)?0:1})();return g&&(s=null,c.clear()),v||(r=h,i=_),y}}function vA(e,t){if(t!==null&&t.editor===e.editor)return t;let{editor:n}=e,r=n.getEditorState();return r.isEmpty()?null:{editor:n,editorState:r}}function yA(e,t){e.undoStack=[],e.redoStack=[],e.current=null,t&&t(e)}function bA(e,t,n,r=Date.now,i,a=null){let o=_A(e,n,r),s=()=>{i&&i(t)};return s(),th(e.registerCommand(mo,()=>(function(e,t,n){let r=t.redoStack,i=t.undoStack;if(i.length!==0){let a=t.current,o=i.pop();if(o){let t=vA(o,a);t!==null&&(r.push(t),e.dispatchCommand(Ho,!0))}i.length===0&&e.dispatchCommand(Uo,!1),t.current=o||null,n&&n(t),o&&o.editor.setEditorState(o.editorState,{tag:`historic`})}}(e,t,i),!0),0),e.registerCommand(ho,()=>(function(e,t,n){let r=t.redoStack,i=t.undoStack;if(r.length!==0){let a=t.current,o=r.pop();if(o){let t=vA(o,a);t!==null&&(i.push(t),e.dispatchCommand(Uo,!0))}r.length===0&&e.dispatchCommand(Ho,!1),t.current=o||null,n&&n(t),o&&o.editor.setEditorState(o.editorState,{tag:`historic`})}}(e,t,i),!0),0),e.registerCommand(Bo,()=>(yA(t,i),!1),0),e.registerCommand(Vo,()=>(yA(t,i),e.dispatchCommand(Ho,!1),e.dispatchCommand(Uo,!1),!0),0),e.registerUpdateListener(({editorState:n,prevEditorState:r,dirtyLeaves:i,dirtyElements:c,tags:l})=>{let u=t.current,d=t.redoStack,f=t.undoStack,p=u===null?null:u.editorState;if(u!==null&&n===p)return;let m=o(r,n,u,i,c,l);if(m===1){d.length!==0&&(t.redoStack=[],e.dispatchCommand(Ho,!1));let n=function(e,t,n){return n===null?null:n.editor===e?{...n}:t.isEmpty()?null:{editor:e,editorState:t}}(e,r,u);if(n!==null){f.push(n);let t=typeof a==`number`||a===null?a:a.peek();t!==null&&f.length>t&&f.splice(0,f.length-t),e.dispatchCommand(Uo,!0)}}else if(m===2)return;t.current={editor:e,editorState:n},s()}))}function xA(){return{current:null,redoStack:[],undoStack:[]}}function SA({delay:e,externalHistoryState:t}){let[n]=ha();return function(e,t,n=1e3){let r=(0,A.useMemo)(()=>t||xA(),[t]);(0,A.useEffect)(()=>bA(e,r,n),[n,e,r])}(n,t,e),null}var{PI:CA}=Math,wA=CA+1e-4,TA=.5,EA=[1,1];function DA(e,t,n,r=e=>e){return e*r(.5-t*(.5-n))}var{min:OA}=Math;function kA(e,t,n){let r=OA(1,t/n);return OA(1,e+(OA(1,1-r)-e)*(r*.275))}function AA(e){return[-e[0],-e[1]]}function jA(e,t){return[e[0]+t[0],e[1]+t[1]]}function MA(e,t,n){return e[0]=t[0]+n[0],e[1]=t[1]+n[1],e}function NA(e,t){return[e[0]-t[0],e[1]-t[1]]}function PA(e,t,n){return e[0]=t[0]-n[0],e[1]=t[1]-n[1],e}function FA(e,t){return[e[0]*t,e[1]*t]}function IA(e,t,n){return e[0]=t[0]*n,e[1]=t[1]*n,e}function LA(e,t){return[e[0]/t,e[1]/t]}function RA(e){return[e[1],-e[0]]}function zA(e,t){let n=t[0];return e[0]=t[1],e[1]=-n,e}function BA(e,t){return e[0]*t[0]+e[1]*t[1]}function VA(e,t){return e[0]===t[0]&&e[1]===t[1]}function HA(e){return Math.hypot(e[0],e[1])}function UA(e,t){let n=e[0]-t[0],r=e[1]-t[1];return n*n+r*r}function WA(e){return LA(e,HA(e))}function GA(e,t){return Math.hypot(e[1]-t[1],e[0]-t[0])}function KA(e,t,n){let r=Math.sin(n),i=Math.cos(n),a=e[0]-t[0],o=e[1]-t[1],s=a*i-o*r,c=a*r+o*i;return[s+t[0],c+t[1]]}function qA(e,t,n,r){let i=Math.sin(r),a=Math.cos(r),o=t[0]-n[0],s=t[1]-n[1],c=o*a-s*i,l=o*i+s*a;return e[0]=c+n[0],e[1]=l+n[1],e}function JA(e,t,n){return jA(e,FA(NA(t,e),n))}function YA(e,t,n,r){let i=n[0]-t[0],a=n[1]-t[1];return e[0]=t[0]+i*r,e[1]=t[1]+a*r,e}function XA(e,t,n){return jA(e,FA(t,n))}var ZA=[0,0],QA=[0,0],$A=[0,0];function ej(e,t){let n=XA(e,WA(RA(NA(e,jA(e,[1,1])))),-t),r=[],i=1/13;for(let t=i;t<=1;t+=i)r.push(KA(n,e,wA*2*t));return r}function tj(e,t,n){let r=[],i=1/n;for(let n=i;n<=1;n+=i)r.push(KA(t,e,wA*n));return r}function nj(e,t,n){let r=NA(t,n),i=FA(r,.5),a=FA(r,.51);return[NA(e,i),NA(e,a),jA(e,a),jA(e,i)]}function rj(e,t,n,r){let i=[],a=XA(e,t,n),o=1/r;for(let t=o;t<1;t+=o)i.push(KA(a,e,wA*3*t));return i}function ij(e,t,n){return[jA(e,FA(t,n)),jA(e,FA(t,n*.99)),NA(e,FA(t,n*.99)),NA(e,FA(t,n))]}function aj(e,t,n){return e===!1||e===void 0?0:e===!0?Math.max(t,n):e}function oj(e,t,n){return e.slice(0,10).reduce((e,r)=>{let i=r.pressure;return t&&(i=kA(e,r.distance,n)),(e+i)/2},e[0].pressure)}function sj(e,t={}){let{size:n=16,smoothing:r=.5,thinning:i=.5,simulatePressure:a=!0,easing:o=e=>e,start:s={},end:c={},last:l=!1}=t,{cap:u=!0,easing:d=e=>e*(2-e)}=s,{cap:f=!0,easing:p=e=>--e*e*e+1}=c;if(e.length===0||n<=0)return[];let m=e[e.length-1].runningLength,h=aj(s.taper,n,m),g=aj(c.taper,n,m),_=(n*r)**2,v=[],y=[],b=oj(e,a,n),x=DA(n,i,e[e.length-1].pressure,o),S,C=e[0].vector,w=e[0].point,T=w,E=w,D=T,ee=!1;for(let t=0;t<e.length;t++){let{pressure:r}=e[t],{point:s,vector:c,distance:l,runningLength:u}=e[t],f=t===e.length-1;if(!f&&m-u<3)continue;i?(a&&(r=kA(b,l,n)),x=DA(n,i,r,o)):x=n/2,S===void 0&&(S=x);let te=u<h?d(u/h):1,ne=m-u<g?p((m-u)/g):1;x=Math.max(.01,x*Math.min(te,ne));let re=(f?e[t]:e[t+1]).vector,ie=f?1:BA(c,re),ae=BA(c,C)<0&&!ee,oe=ie!==null&&ie<0;if(ae||oe){zA(ZA,C),IA(ZA,ZA,x);for(let e=0;e<=1;e+=.07692307692307693)PA(QA,s,ZA),qA(QA,QA,s,wA*e),E=[QA[0],QA[1]],v.push(E),MA($A,s,ZA),qA($A,$A,s,wA*-e),D=[$A[0],$A[1]],y.push(D);w=E,T=D,oe&&(ee=!0)}else ee=!1,f?(zA(ZA,c),IA(ZA,ZA,x),v.push(NA(s,ZA)),y.push(jA(s,ZA))):(YA(ZA,re,c,ie),zA(ZA,ZA),IA(ZA,ZA,x),PA(QA,s,ZA),E=[QA[0],QA[1]],(t<=1||UA(w,E)>_)&&(v.push(E),w=E),MA($A,s,ZA),D=[$A[0],$A[1]],(t<=1||UA(T,D)>_)&&(y.push(D),T=D),b=r,C=c)}let te=[e[0].point[0],e[0].point[1]],ne=e.length>1?[e[e.length-1].point[0],e[e.length-1].point[1]]:jA(e[0].point,[1,1]),re=[],ie=[];if(e.length===1){if(!(h||g)||l)return ej(te,S||x)}else{h||g&&e.length===1||(u?re.push(...tj(te,y[0],13)):re.push(...nj(te,v[0],y[0])));let t=RA(AA(e[e.length-1].vector));g||h&&e.length===1?ie.push(ne):f?ie.push(...rj(ne,t,x,29)):ie.push(...ij(ne,t,x))}return v.concat(ie,y.reverse(),re)}var cj=[0,0];function lj(e){return e!=null&&e>=0}function uj(e,t={}){let{streamline:n=.5,size:r=16,last:i=!1}=t;if(e.length===0)return[];let a=.15+(1-n)*.85,o=Array.isArray(e[0])?e:e.map(({x:e,y:t,pressure:n=TA})=>[e,t,n]);if(o.length===2){let e=o[1];o=o.slice(0,-1);for(let t=1;t<5;t++)o.push(JA(o[0],e,t/4))}o.length===1&&(o=[...o,[...jA(o[0],EA),...o[0].slice(2)]]);let s=[{point:[o[0][0],o[0][1]],pressure:lj(o[0][2])?o[0][2]:.25,vector:[...EA],distance:0,runningLength:0}],c=!1,l=0,u=s[0],d=o.length-1;for(let e=1;e<o.length;e++){let t=i&&e===d?[o[e][0],o[e][1]]:JA(u.point,o[e],a);if(VA(u.point,t))continue;let n=GA(t,u.point);if(l+=n,e<d&&!c){if(l<r)continue;c=!0}PA(cj,u.point,t),u={point:t,pressure:lj(o[e][2])?o[e][2]:TA,vector:WA(cj),distance:n,runningLength:l},s.push(u)}return s[0].vector=s[1]?.vector||[0,0],s}function dj(e,t={}){return sj(uj(e,t),t)}function fj(e,t,n){if(e&&e.length){let[r,i]=t,a=Math.PI/180*n,o=Math.cos(a),s=Math.sin(a);for(let t of e){let[e,n]=t;t[0]=(e-r)*o-(n-i)*s+r,t[1]=(e-r)*s+(n-i)*o+i}}}function pj(e,t,n){let r=[];e.forEach(e=>r.push(...e)),fj(r,t,n)}function mj(e,t){return e[0]===t[0]&&e[1]===t[1]}function hj(e,t,n,r=1){let i=n,a=Math.max(t,.1),o=e[0]&&e[0][0]&&typeof e[0][0]==`number`?[e]:e,s=[0,0];if(i)for(let e of o)fj(e,s,i);let c=gj(o,a,r);if(i){for(let e of o)fj(e,s,-i);pj(c,s,-i)}return c}function gj(e,t,n){let r=[];for(let t of e){let e=[...t];mj(e[0],e[e.length-1])||e.push([e[0][0],e[0][1]]),e.length>2&&r.push(e)}let i=[];t=Math.max(t,.1);let a=[];for(let e of r)for(let t=0;t<e.length-1;t++){let n=e[t],r=e[t+1];if(n[1]!==r[1]){let e=Math.min(n[1],r[1]);a.push({ymin:e,ymax:Math.max(n[1],r[1]),x:e===n[1]?n[0]:r[0],islope:(r[0]-n[0])/(r[1]-n[1])})}}if(a.sort((e,t)=>e.ymin<t.ymin?-1:e.ymin>t.ymin?1:e.x<t.x?-1:e.x>t.x?1:e.ymax===t.ymax?0:(e.ymax-t.ymax)/Math.abs(e.ymax-t.ymax)),!a.length)return i;let o=[],s=a[0].ymin,c=0;for(;o.length||a.length;){if(a.length){let e=-1;for(let t=0;t<a.length&&!(a[t].ymin>s);t++)e=t;a.splice(0,e+1).forEach(e=>{o.push({s,edge:e})})}if(o=o.filter(e=>!(e.edge.ymax<=s)),o.sort((e,t)=>e.edge.x===t.edge.x?0:(e.edge.x-t.edge.x)/Math.abs(e.edge.x-t.edge.x)),(n!==1||c%t===0)&&o.length>1)for(let e=0;e<o.length;e+=2){let t=e+1;if(t>=o.length)break;let n=o[e].edge,r=o[t].edge;i.push([[Math.round(n.x),s],[Math.round(r.x),s]])}s+=n,o.forEach(e=>{e.edge.x=e.edge.x+n*e.edge.islope}),c++}return i}function _j(e,t){let n=t.hachureAngle+90,r=t.hachureGap;r<0&&(r=t.strokeWidth*4),r=Math.round(Math.max(r,.1));let i=1;return t.roughness>=1&&(t.randomizer?.next()||Math.random())>.7&&(i=r),hj(e,r,n,i||1)}var vj=class{constructor(e){this.helper=e}fillPolygons(e,t){return this._fillPolygons(e,t)}_fillPolygons(e,t){let n=_j(e,t);return{type:`fillSketch`,ops:this.renderLines(n,t)}}renderLines(e,t){let n=[];for(let r of e)n.push(...this.helper.doubleLineOps(r[0][0],r[0][1],r[1][0],r[1][1],t));return n}};function yj(e){let t=e[0],n=e[1];return Math.sqrt((t[0]-n[0])**2+(t[1]-n[1])**2)}var bj=class extends vj{fillPolygons(e,t){let n=t.hachureGap;n<0&&(n=t.strokeWidth*4),n=Math.max(n,.1);let r=_j(e,Object.assign({},t,{hachureGap:n})),i=Math.PI/180*t.hachureAngle,a=[],o=n*.5*Math.cos(i),s=n*.5*Math.sin(i);for(let[e,t]of r)yj([e,t])&&a.push([[e[0]-o,e[1]+s],[...t]],[[e[0]+o,e[1]-s],[...t]]);return{type:`fillSketch`,ops:this.renderLines(a,t)}}},xj=class extends vj{fillPolygons(e,t){let n=this._fillPolygons(e,t),r=Object.assign({},t,{hachureAngle:t.hachureAngle+90}),i=this._fillPolygons(e,r);return n.ops=n.ops.concat(i.ops),n}},Sj=class{constructor(e){this.helper=e}fillPolygons(e,t){t=Object.assign({},t,{hachureAngle:0});let n=_j(e,t);return this.dotsOnLines(n,t)}dotsOnLines(e,t){let n=[],r=t.hachureGap;r<0&&(r=t.strokeWidth*4),r=Math.max(r,.1);let i=t.fillWeight;i<0&&(i=t.strokeWidth/2);let a=r/4;for(let o of e){let e=yj(o),s=e/r,c=Math.ceil(s)-1,l=e-c*r,u=(o[0][0]+o[1][0])/2-r/4,d=Math.min(o[0][1],o[1][1]);for(let e=0;e<c;e++){let o=d+l+e*r,s=u-a+Math.random()*2*a,c=o-a+Math.random()*2*a,f=this.helper.ellipse(s,c,i,i,t);n.push(...f.ops)}}return{type:`fillSketch`,ops:n}}},Cj=class{constructor(e){this.helper=e}fillPolygons(e,t){let n=_j(e,t);return{type:`fillSketch`,ops:this.dashedLine(n,t)}}dashedLine(e,t){let n=t.dashOffset<0?t.hachureGap<0?t.strokeWidth*4:t.hachureGap:t.dashOffset,r=t.dashGap<0?t.hachureGap<0?t.strokeWidth*4:t.hachureGap:t.dashGap,i=[];return e.forEach(e=>{let a=yj(e),o=Math.floor(a/(n+r)),s=(a+r-o*(n+r))/2,c=e[0],l=e[1];c[0]>l[0]&&(c=e[1],l=e[0]);let u=Math.atan((l[1]-c[1])/(l[0]-c[0]));for(let e=0;e<o;e++){let a=e*(n+r),o=a+n,l=[c[0]+a*Math.cos(u)+s*Math.cos(u),c[1]+a*Math.sin(u)+s*Math.sin(u)],d=[c[0]+o*Math.cos(u)+s*Math.cos(u),c[1]+o*Math.sin(u)+s*Math.sin(u)];i.push(...this.helper.doubleLineOps(l[0],l[1],d[0],d[1],t))}}),i}},wj=class{constructor(e){this.helper=e}fillPolygons(e,t){let n=t.hachureGap<0?t.strokeWidth*4:t.hachureGap,r=t.zigzagOffset<0?n:t.zigzagOffset;t=Object.assign({},t,{hachureGap:n+r});let i=_j(e,t);return{type:`fillSketch`,ops:this.zigzagLines(i,r,t)}}zigzagLines(e,t,n){let r=[];return e.forEach(e=>{let i=yj(e),a=Math.round(i/(2*t)),o=e[0],s=e[1];o[0]>s[0]&&(o=e[1],s=e[0]);let c=Math.atan((s[1]-o[1])/(s[0]-o[0]));for(let e=0;e<a;e++){let i=e*2*t,a=(e+1)*2*t,s=Math.sqrt(2*t**2),l=[o[0]+i*Math.cos(c),o[1]+i*Math.sin(c)],u=[o[0]+a*Math.cos(c),o[1]+a*Math.sin(c)],d=[l[0]+s*Math.cos(c+Math.PI/4),l[1]+s*Math.sin(c+Math.PI/4)];r.push(...this.helper.doubleLineOps(l[0],l[1],d[0],d[1],n),...this.helper.doubleLineOps(d[0],d[1],u[0],u[1],n))}}),r}},Tj={};function Ej(e,t){let n=e.fillStyle||`hachure`;if(!Tj[n])switch(n){case`zigzag`:Tj[n]||(Tj[n]=new bj(t));break;case`cross-hatch`:Tj[n]||(Tj[n]=new xj(t));break;case`dots`:Tj[n]||(Tj[n]=new Sj(t));break;case`dashed`:Tj[n]||(Tj[n]=new Cj(t));break;case`zigzag-line`:Tj[n]||(Tj[n]=new wj(t));break;default:n=`hachure`,Tj[n]||(Tj[n]=new vj(t))}return Tj[n]}function Dj(){return Math.floor(Math.random()*2**31)}var Oj=class{constructor(e){this.seed=e}next(){return this.seed?(2**31-1&(this.seed=Math.imul(48271,this.seed)))/2**31:Math.random()}},kj=0,Aj=1,jj=2,Mj={A:7,a:7,C:6,c:6,H:1,h:1,L:2,l:2,M:2,m:2,Q:4,q:4,S:4,s:4,T:2,t:2,V:1,v:1,Z:0,z:0};function Nj(e){let t=[];for(;e!==``;)if(e.match(/^([ \t\r\n,]+)/))e=e.substr(RegExp.$1.length);else if(e.match(/^([aAcChHlLmMqQsStTvVzZ])/))t[t.length]={type:kj,text:RegExp.$1},e=e.substr(RegExp.$1.length);else if(e.match(/^(([-+]?[0-9]+(\.[0-9]*)?|[-+]?\.[0-9]+)([eE][-+]?[0-9]+)?)/))t[t.length]={type:Aj,text:`${parseFloat(RegExp.$1)}`},e=e.substr(RegExp.$1.length);else return[];return t[t.length]={type:jj,text:``},t}function Pj(e,t){return e.type===t}function Fj(e){let t=[],n=Nj(e),r=`BOD`,i=0,a=n[i];for(;!Pj(a,jj);){let o=0,s=[];if(r===`BOD`){if(a.text===`M`||a.text===`m`)i++,o=Mj[a.text],r=a.text;else return Fj(`M0,0`+e)}else Pj(a,Aj)?o=Mj[r]:(i++,o=Mj[a.text],r=a.text);if(i+o<n.length){for(let e=i;e<i+o;e++){let t=n[e];if(Pj(t,Aj))s[s.length]=+t.text;else throw Error(`Param not a number: `+r+`,`+t.text)}if(typeof Mj[r]==`number`){let e={key:r,data:s};t.push(e),i+=o,a=n[i],r===`M`&&(r=`L`),r===`m`&&(r=`l`)}else throw Error(`Bad segment: `+r)}else throw Error(`Path data ended short`)}return t}function Ij(e){let t=0,n=0,r=0,i=0,a=[];for(let{key:o,data:s}of e)switch(o){case`M`:a.push({key:`M`,data:[...s]}),[t,n]=s,[r,i]=s;break;case`m`:t+=s[0],n+=s[1],a.push({key:`M`,data:[t,n]}),r=t,i=n;break;case`L`:a.push({key:`L`,data:[...s]}),[t,n]=s;break;case`l`:t+=s[0],n+=s[1],a.push({key:`L`,data:[t,n]});break;case`C`:a.push({key:`C`,data:[...s]}),t=s[4],n=s[5];break;case`c`:{let e=s.map((e,r)=>r%2?e+n:e+t);a.push({key:`C`,data:e}),t=e[4],n=e[5];break}case`Q`:a.push({key:`Q`,data:[...s]}),t=s[2],n=s[3];break;case`q`:{let e=s.map((e,r)=>r%2?e+n:e+t);a.push({key:`Q`,data:e}),t=e[2],n=e[3];break}case`A`:a.push({key:`A`,data:[...s]}),t=s[5],n=s[6];break;case`a`:t+=s[5],n+=s[6],a.push({key:`A`,data:[s[0],s[1],s[2],s[3],s[4],t,n]});break;case`H`:a.push({key:`H`,data:[...s]}),t=s[0];break;case`h`:t+=s[0],a.push({key:`H`,data:[t]});break;case`V`:a.push({key:`V`,data:[...s]}),n=s[0];break;case`v`:n+=s[0],a.push({key:`V`,data:[n]});break;case`S`:a.push({key:`S`,data:[...s]}),t=s[2],n=s[3];break;case`s`:{let e=s.map((e,r)=>r%2?e+n:e+t);a.push({key:`S`,data:e}),t=e[2],n=e[3];break}case`T`:a.push({key:`T`,data:[...s]}),t=s[0],n=s[1];break;case`t`:t+=s[0],n+=s[1],a.push({key:`T`,data:[t,n]});break;case`Z`:case`z`:a.push({key:`Z`,data:[]}),t=r,n=i}return a}function Lj(e){let t=[],n=``,r=0,i=0,a=0,o=0,s=0,c=0;for(let{key:l,data:u}of e){switch(l){case`M`:t.push({key:`M`,data:[...u]}),[r,i]=u,[a,o]=u;break;case`C`:t.push({key:`C`,data:[...u]}),r=u[4],i=u[5],s=u[2],c=u[3];break;case`L`:t.push({key:`L`,data:[...u]}),[r,i]=u;break;case`H`:r=u[0],t.push({key:`L`,data:[r,i]});break;case`V`:i=u[0],t.push({key:`L`,data:[r,i]});break;case`S`:{let e=0,a=0;n===`C`||n===`S`?(e=r+(r-s),a=i+(i-c)):(e=r,a=i),t.push({key:`C`,data:[e,a,...u]}),s=u[0],c=u[1],r=u[2],i=u[3];break}case`T`:{let[e,a]=u,o=0,l=0;n===`Q`||n===`T`?(o=r+(r-s),l=i+(i-c)):(o=r,l=i);let d=r+2*(o-r)/3,f=i+2*(l-i)/3,p=e+2*(o-e)/3,m=a+2*(l-a)/3;t.push({key:`C`,data:[d,f,p,m,e,a]}),s=o,c=l,r=e,i=a;break}case`Q`:{let[e,n,a,o]=u,l=r+2*(e-r)/3,d=i+2*(n-i)/3,f=a+2*(e-a)/3,p=o+2*(n-o)/3;t.push({key:`C`,data:[l,d,f,p,a,o]}),s=e,c=n,r=a,i=o;break}case`A`:{let e=Math.abs(u[0]),n=Math.abs(u[1]),a=u[2],o=u[3],s=u[4],c=u[5],l=u[6];e===0||n===0?(t.push({key:`C`,data:[r,i,c,l,c,l]}),r=c,i=l):(r!==c||i!==l)&&(Bj(r,i,c,l,e,n,a,o,s).forEach(function(e){t.push({key:`C`,data:e})}),r=c,i=l);break}case`Z`:t.push({key:`Z`,data:[]}),r=a,i=o}n=l}return t}function Rj(e){return Math.PI*e/180}function zj(e,t,n){return[e*Math.cos(n)-t*Math.sin(n),e*Math.sin(n)+t*Math.cos(n)]}function Bj(e,t,n,r,i,a,o,s,c,l){let u=Rj(o),d=[],f=0,p=0,m=0,h=0;if(l)[f,p,m,h]=l;else{[e,t]=zj(e,t,-u),[n,r]=zj(n,r,-u);let o=(e-n)/2,l=(t-r)/2,d=o*o/(i*i)+l*l/(a*a);d>1&&(d=Math.sqrt(d),i=d*i,a=d*a);let g=s===c?-1:1,_=i*i,v=a*a,y=_*v-_*l*l-v*o*o,b=_*l*l+v*o*o,x=g*Math.sqrt(Math.abs(y/b));m=x*i*l/a+(e+n)/2,h=x*-a*o/i+(t+r)/2,f=Math.asin(parseFloat(((t-h)/a).toFixed(9))),p=Math.asin(parseFloat(((r-h)/a).toFixed(9))),e<m&&(f=Math.PI-f),n<m&&(p=Math.PI-p),f<0&&(f=Math.PI*2+f),p<0&&(p=Math.PI*2+p),c&&f>p&&(f-=Math.PI*2),!c&&p>f&&(p-=Math.PI*2)}let g=p-f;if(Math.abs(g)>Math.PI*120/180){let e=p,t=n,s=r;p=c&&p>f?f+Math.PI*120/180*1:f+Math.PI*120/180*-1,n=m+i*Math.cos(p),r=h+a*Math.sin(p),d=Bj(n,r,t,s,i,a,o,0,c,[p,e,m,h])}g=p-f;let _=Math.cos(f),v=Math.sin(f),y=Math.cos(p),b=Math.sin(p),x=Math.tan(g/4),S=4/3*i*x,C=4/3*a*x,w=[e,t],T=[e+S*v,t-C*_],E=[n+S*b,r-C*y],D=[n,r];if(T[0]=2*w[0]-T[0],T[1]=2*w[1]-T[1],l)return[T,E,D].concat(d);{d=[T,E,D].concat(d);let e=[];for(let t=0;t<d.length;t+=3){let n=zj(d[t][0],d[t][1],u),r=zj(d[t+1][0],d[t+1][1],u),i=zj(d[t+2][0],d[t+2][1],u);e.push([n[0],n[1],r[0],r[1],i[0],i[1]])}return e}}var Vj={randOffset:tM,randOffsetWithRange:nM,ellipse:qj,doubleLineOps:rM};function Hj(e,t,n,r,i){return{type:`path`,ops:sM(e,t,n,r,i)}}function Uj(e,t,n){let r=(e||[]).length;if(r>2){let i=[];for(let t=0;t<r-1;t++)i.push(...sM(e[t][0],e[t][1],e[t+1][0],e[t+1][1],n));return t&&i.push(...sM(e[r-1][0],e[r-1][1],e[0][0],e[0][1],n)),{type:`path`,ops:i}}return r===2?Hj(e[0][0],e[0][1],e[1][0],e[1][1],n):{type:`path`,ops:[]}}function Wj(e,t){return Uj(e,!0,t)}function Gj(e,t,n,r,i){return Wj([[e,t],[e+n,t],[e+n,t+r],[e,t+r]],i)}function Kj(e,t){if(e.length){let n=typeof e[0][0]==`number`?[e]:e,r=lM(n[0],1*(1+t.roughness*.2),t),i=t.disableMultiStroke?[]:lM(n[0],1.5*(1+t.roughness*.22),iM(t));for(let e=1;e<n.length;e++){let a=n[e];if(a.length){let e=lM(a,1*(1+t.roughness*.2),t),n=t.disableMultiStroke?[]:lM(a,1.5*(1+t.roughness*.22),iM(t));for(let t of e)t.op!==`move`&&r.push(t);for(let e of n)e.op!==`move`&&i.push(e)}}return{type:`path`,ops:r.concat(i)}}return{type:`path`,ops:[]}}function qj(e,t,n,r,i){return Yj(e,t,i,Jj(n,r,i)).opset}function Jj(e,t,n){let r=Math.sqrt(Math.PI*2*Math.sqrt(((e/2)**2+(t/2)**2)/2)),i=Math.ceil(Math.max(n.curveStepCount,n.curveStepCount/Math.sqrt(200)*r)),a=Math.PI*2/i,o=Math.abs(e/2),s=Math.abs(t/2),c=1-n.curveFitting;return o+=Q(o*c,n),s+=Q(s*c,n),{increment:a,rx:o,ry:s}}function Yj(e,t,n,r){let[i,a]=dM(r.increment,e,t,r.rx,r.ry,1,r.increment*oM(.1,oM(.4,1,n),n),n),o=uM(i,null,n);if(!n.disableMultiStroke&&n.roughness!==0){let[i]=dM(r.increment,e,t,r.rx,r.ry,1.5,0,n),a=uM(i,null,n);o=o.concat(a)}return{estimatedPoints:a,opset:{type:`path`,ops:o}}}function Xj(e,t,n,r,i,a,o,s,c){let l=e,u=t,d=Math.abs(n/2),f=Math.abs(r/2);d+=Q(d*.01,c),f+=Q(f*.01,c);let p=i,m=a;for(;p<0;)p+=Math.PI*2,m+=Math.PI*2;m-p>Math.PI*2&&(p=0,m=Math.PI*2);let h=Math.PI*2/c.curveStepCount,g=Math.min(h/2,(m-p)/2),_=fM(g,l,u,d,f,p,m,1,c);if(!c.disableMultiStroke){let e=fM(g,l,u,d,f,p,m,1.5,c);_.push(...e)}return o&&(s?_.push(...sM(l,u,l+d*Math.cos(p),u+f*Math.sin(p),c),...sM(l,u,l+d*Math.cos(m),u+f*Math.sin(m),c)):_.push({op:`lineTo`,data:[l,u]},{op:`lineTo`,data:[l+d*Math.cos(p),u+f*Math.sin(p)]})),{type:`path`,ops:_}}function Zj(e,t){let n=Lj(Ij(Fj(e))),r=[],i=[0,0],a=[0,0];for(let{key:e,data:o}of n)switch(e){case`M`:a=[o[0],o[1]],i=[o[0],o[1]];break;case`L`:r.push(...sM(a[0],a[1],o[0],o[1],t)),a=[o[0],o[1]];break;case`C`:{let[e,n,i,s,c,l]=o;r.push(...pM(e,n,i,s,c,l,a,t)),a=[c,l];break}case`Z`:r.push(...sM(a[0],a[1],i[0],i[1],t)),a=[i[0],i[1]]}return{type:`path`,ops:r}}function Qj(e,t){let n=[];for(let r of e)if(r.length){let e=t.maxRandomnessOffset||0,i=r.length;if(i>2){n.push({op:`move`,data:[r[0][0]+Q(e,t),r[0][1]+Q(e,t)]});for(let a=1;a<i;a++)n.push({op:`lineTo`,data:[r[a][0]+Q(e,t),r[a][1]+Q(e,t)]})}}return{type:`fillPath`,ops:n}}function $j(e,t){return Ej(t,Vj).fillPolygons(e,t)}function eM(e,t,n,r,i,a,o){let s=e,c=t,l=Math.abs(n/2),u=Math.abs(r/2);l+=Q(l*.01,o),u+=Q(u*.01,o);let d=i,f=a;for(;d<0;)d+=Math.PI*2,f+=Math.PI*2;f-d>Math.PI*2&&(d=0,f=Math.PI*2);let p=(f-d)/o.curveStepCount,m=[];for(let e=d;e<=f;e+=p)m.push([s+l*Math.cos(e),c+u*Math.sin(e)]);return m.push([s+l*Math.cos(f),c+u*Math.sin(f)]),m.push([s,c]),$j([m],o)}function tM(e,t){return Q(e,t)}function nM(e,t,n){return oM(e,t,n)}function rM(e,t,n,r,i){return sM(e,t,n,r,i,!0)}function iM(e){let t=Object.assign({},e);return t.randomizer=void 0,e.seed&&(t.seed=e.seed+1),t}function aM(e){return e.randomizer||=new Oj(e.seed||0),e.randomizer.next()}function oM(e,t,n,r=1){return n.roughness*r*(aM(n)*(t-e)+e)}function Q(e,t,n=1){return oM(-e,e,t,n)}function sM(e,t,n,r,i,a=!1){let o=a?i.disableMultiStrokeFill:i.disableMultiStroke,s=cM(e,t,n,r,i,!0,!1);if(o)return s;let c=cM(e,t,n,r,i,!0,!0);return s.concat(c)}function cM(e,t,n,r,i,a,o){let s=(e-n)**2+(t-r)**2,c=Math.sqrt(s),l=1;l=c<200?1:c>500?.4:-.0016668*c+1.233334;let u=i.maxRandomnessOffset||0;u*u*100>s&&(u=c/10);let d=u/2,f=.2+aM(i)*.2,p=i.bowing*i.maxRandomnessOffset*(r-t)/200,m=i.bowing*i.maxRandomnessOffset*(e-n)/200;p=Q(p,i,l),m=Q(m,i,l);let h=[],g=()=>Q(d,i,l),_=()=>Q(u,i,l),v=i.preserveVertices;return a&&(o?h.push({op:`move`,data:[e+(v?0:g()),t+(v?0:g())]}):h.push({op:`move`,data:[e+(v?0:Q(u,i,l)),t+(v?0:Q(u,i,l))]})),o?h.push({op:`bcurveTo`,data:[p+e+(n-e)*f+g(),m+t+(r-t)*f+g(),p+e+2*(n-e)*f+g(),m+t+2*(r-t)*f+g(),n+(v?0:g()),r+(v?0:g())]}):h.push({op:`bcurveTo`,data:[p+e+(n-e)*f+_(),m+t+(r-t)*f+_(),p+e+2*(n-e)*f+_(),m+t+2*(r-t)*f+_(),n+(v?0:_()),r+(v?0:_())]}),h}function lM(e,t,n){if(!e.length)return[];let r=[];r.push([e[0][0]+Q(t,n),e[0][1]+Q(t,n)]),r.push([e[0][0]+Q(t,n),e[0][1]+Q(t,n)]);for(let i=1;i<e.length;i++)r.push([e[i][0]+Q(t,n),e[i][1]+Q(t,n)]),i===e.length-1&&r.push([e[i][0]+Q(t,n),e[i][1]+Q(t,n)]);return uM(r,null,n)}function uM(e,t,n){let r=e.length,i=[];if(r>3){let a=[],o=1-n.curveTightness;i.push({op:`move`,data:[e[1][0],e[1][1]]});for(let t=1;t+2<r;t++){let n=e[t];a[0]=[n[0],n[1]],a[1]=[n[0]+(o*e[t+1][0]-o*e[t-1][0])/6,n[1]+(o*e[t+1][1]-o*e[t-1][1])/6],a[2]=[e[t+1][0]+(o*e[t][0]-o*e[t+2][0])/6,e[t+1][1]+(o*e[t][1]-o*e[t+2][1])/6],a[3]=[e[t+1][0],e[t+1][1]],i.push({op:`bcurveTo`,data:[a[1][0],a[1][1],a[2][0],a[2][1],a[3][0],a[3][1]]})}if(t&&t.length===2){let e=n.maxRandomnessOffset;i.push({op:`lineTo`,data:[t[0]+Q(e,n),t[1]+Q(e,n)]})}}else r===3?(i.push({op:`move`,data:[e[1][0],e[1][1]]}),i.push({op:`bcurveTo`,data:[e[1][0],e[1][1],e[2][0],e[2][1],e[2][0],e[2][1]]})):r===2&&i.push(...cM(e[0][0],e[0][1],e[1][0],e[1][1],n,!0,!0));return i}function dM(e,t,n,r,i,a,o,s){let c=s.roughness===0,l=[],u=[];if(c){e/=4,u.push([t+r*Math.cos(-e),n+i*Math.sin(-e)]);for(let a=0;a<=Math.PI*2;a+=e){let e=[t+r*Math.cos(a),n+i*Math.sin(a)];l.push(e),u.push(e)}u.push([t+r*Math.cos(0),n+i*Math.sin(0)]),u.push([t+r*Math.cos(e),n+i*Math.sin(e)])}else{let c=Q(.5,s)-Math.PI/2;u.push([Q(a,s)+t+.9*r*Math.cos(c-e),Q(a,s)+n+.9*i*Math.sin(c-e)]);let d=Math.PI*2+c-.01;for(let o=c;o<d;o+=e){let e=[Q(a,s)+t+r*Math.cos(o),Q(a,s)+n+i*Math.sin(o)];l.push(e),u.push(e)}u.push([Q(a,s)+t+r*Math.cos(c+Math.PI*2+o*.5),Q(a,s)+n+i*Math.sin(c+Math.PI*2+o*.5)]),u.push([Q(a,s)+t+.98*r*Math.cos(c+o),Q(a,s)+n+.98*i*Math.sin(c+o)]),u.push([Q(a,s)+t+.9*r*Math.cos(c+o*.5),Q(a,s)+n+.9*i*Math.sin(c+o*.5)])}return[u,l]}function fM(e,t,n,r,i,a,o,s,c){let l=a+Q(.1,c),u=[];u.push([Q(s,c)+t+.9*r*Math.cos(l-e),Q(s,c)+n+.9*i*Math.sin(l-e)]);for(let a=l;a<=o;a+=e)u.push([Q(s,c)+t+r*Math.cos(a),Q(s,c)+n+i*Math.sin(a)]);return u.push([t+r*Math.cos(o),n+i*Math.sin(o)]),u.push([t+r*Math.cos(o),n+i*Math.sin(o)]),uM(u,null,c)}function pM(e,t,n,r,i,a,o,s){let c=[],l=[s.maxRandomnessOffset||1,(s.maxRandomnessOffset||1)+.3],u=[0,0],d=s.disableMultiStroke?1:2,f=s.preserveVertices;for(let p=0;p<d;p++)p===0?c.push({op:`move`,data:[o[0],o[1]]}):c.push({op:`move`,data:[o[0]+(f?0:Q(l[0],s)),o[1]+(f?0:Q(l[0],s))]}),u=f?[i,a]:[i+Q(l[p],s),a+Q(l[p],s)],c.push({op:`bcurveTo`,data:[e+Q(l[p],s),t+Q(l[p],s),n+Q(l[p],s),r+Q(l[p],s),u[0],u[1]]});return c}function mM(e){return[...e]}function hM(e,t=0){let n=e.length;if(n<3)throw Error(`A curve must have at least three points.`);let r=[];if(n===3)r.push(mM(e[0]),mM(e[1]),mM(e[2]),mM(e[2]));else{let n=[];n.push(e[0],e[0]);for(let t=1;t<e.length;t++)n.push(e[t]),t===e.length-1&&n.push(e[t]);let i=[],a=1-t;r.push(mM(n[0]));for(let e=1;e+2<n.length;e++){let t=n[e];i[0]=[t[0],t[1]],i[1]=[t[0]+(a*n[e+1][0]-a*n[e-1][0])/6,t[1]+(a*n[e+1][1]-a*n[e-1][1])/6],i[2]=[n[e+1][0]+(a*n[e][0]-a*n[e+2][0])/6,n[e+1][1]+(a*n[e][1]-a*n[e+2][1])/6],i[3]=[n[e+1][0],n[e+1][1]],r.push(i[1],i[2],i[3])}}return r}function gM(e,t){return Math.sqrt(_M(e,t))}function _M(e,t){return(e[0]-t[0])**2+(e[1]-t[1])**2}function vM(e,t,n){let r=_M(t,n);if(r===0)return _M(e,t);let i=((e[0]-t[0])*(n[0]-t[0])+(e[1]-t[1])*(n[1]-t[1]))/r;return i=Math.max(0,Math.min(1,i)),_M(e,yM(t,n,i))}function yM(e,t,n){return[e[0]+(t[0]-e[0])*n,e[1]+(t[1]-e[1])*n]}function bM(e,t){let n=e[t+0],r=e[t+1],i=e[t+2],a=e[t+3],o=3*r[0]-2*n[0]-a[0];o*=o;let s=3*r[1]-2*n[1]-a[1];s*=s;let c=3*i[0]-2*a[0]-n[0];c*=c;let l=3*i[1]-2*a[1]-n[1];return l*=l,o<c&&(o=c),s<l&&(s=l),o+s}function xM(e,t,n,r){let i=r||[];if(bM(e,t)<n){let n=e[t+0];i.length?gM(i[i.length-1],n)>1&&i.push(n):i.push(n),i.push(e[t+3])}else{let r=.5,a=e[t+0],o=e[t+1],s=e[t+2],c=e[t+3],l=yM(a,o,r),u=yM(o,s,r),d=yM(s,c,r),f=yM(l,u,r),p=yM(u,d,r),m=yM(f,p,r);xM([a,l,f,m],0,n,i),xM([m,p,d,c],0,n,i)}return i}function SM(e,t){return CM(e,0,e.length,t)}function CM(e,t,n,r,i){let a=i||[],o=e[t],s=e[n-1],c=0,l=1;for(let r=t+1;r<n-1;++r){let t=vM(e[r],o,s);t>c&&(c=t,l=r)}return Math.sqrt(c)>r?(CM(e,t,l+1,r,a),CM(e,l,n,r,a)):(a.length||a.push(o),a.push(s)),a}function wM(e,t=.15,n){let r=[],i=(e.length-1)/3;for(let n=0;n<i;n++)xM(e,n*3,t,r);return n&&n>0?CM(r,0,r.length,n):r}function TM(e,t,n){let r=Lj(Ij(Fj(e))),i=[],a=[],o=[0,0],s=[],c=()=>{s.length>=4&&a.push(...wM(s,t)),s=[]},l=()=>{c(),a.length&&(i.push(a),a=[])};for(let{key:e,data:t}of r)switch(e){case`M`:l(),o=[t[0],t[1]],a.push(o);break;case`L`:c(),a.push([t[0],t[1]]);break;case`C`:if(!s.length){let e=a.length?a[a.length-1]:o;s.push([e[0],e[1]])}s.push([t[0],t[1]]),s.push([t[2],t[3]]),s.push([t[4],t[5]]);break;case`Z`:c(),a.push([o[0],o[1]])}if(l(),!n)return i;let u=[];for(let e of i){let t=SM(e,n);t.length&&u.push(t)}return u}var EM=`none`,DM=class{constructor(e){this.defaultOptions={maxRandomnessOffset:2,roughness:1,bowing:1,stroke:`#000`,strokeWidth:1,curveTightness:0,curveFitting:.95,curveStepCount:9,fillStyle:`hachure`,fillWeight:-1,hachureAngle:-41,hachureGap:-1,dashOffset:-1,dashGap:-1,zigzagOffset:-1,seed:0,disableMultiStroke:!1,disableMultiStrokeFill:!1,preserveVertices:!1,fillShapeRoughnessGain:.8},this.config=e||{},this.config.options&&(this.defaultOptions=this._o(this.config.options))}static newSeed(){return Dj()}_o(e){return e?Object.assign({},this.defaultOptions,e):this.defaultOptions}_d(e,t,n){return{shape:e,sets:t||[],options:n||this.defaultOptions}}line(e,t,n,r,i){let a=this._o(i);return this._d(`line`,[Hj(e,t,n,r,a)],a)}rectangle(e,t,n,r,i){let a=this._o(i),o=[],s=Gj(e,t,n,r,a);if(a.fill){let i=[[e,t],[e+n,t],[e+n,t+r],[e,t+r]];a.fillStyle===`solid`?o.push(Qj([i],a)):o.push($j([i],a))}return a.stroke!==EM&&o.push(s),this._d(`rectangle`,o,a)}ellipse(e,t,n,r,i){let a=this._o(i),o=[],s=Jj(n,r,a),c=Yj(e,t,a,s);if(a.fill){if(a.fillStyle===`solid`){let n=Yj(e,t,a,s).opset;n.type=`fillPath`,o.push(n)}else o.push($j([c.estimatedPoints],a))}return a.stroke!==EM&&o.push(c.opset),this._d(`ellipse`,o,a)}circle(e,t,n,r){let i=this.ellipse(e,t,n,n,r);return i.shape=`circle`,i}linearPath(e,t){let n=this._o(t);return this._d(`linearPath`,[Uj(e,!1,n)],n)}arc(e,t,n,r,i,a,o=!1,s){let c=this._o(s),l=[],u=Xj(e,t,n,r,i,a,o,!0,c);if(o&&c.fill){if(c.fillStyle===`solid`){let o=Object.assign({},c);o.disableMultiStroke=!0;let s=Xj(e,t,n,r,i,a,!0,!1,o);s.type=`fillPath`,l.push(s)}else l.push(eM(e,t,n,r,i,a,c))}return c.stroke!==EM&&l.push(u),this._d(`arc`,l,c)}curve(e,t){let n=this._o(t),r=[],i=Kj(e,n);if(n.fill&&n.fill!==EM){if(n.fillStyle===`solid`){let t=Kj(e,Object.assign(Object.assign({},n),{disableMultiStroke:!0,roughness:n.roughness?n.roughness+n.fillShapeRoughnessGain:0}));r.push({type:`fillPath`,ops:this._mergedShape(t.ops)})}else{let t=[],i=e;if(i.length){let e=typeof i[0][0]==`number`?[i]:i;for(let r of e)r.length<3?t.push(...r):r.length===3?t.push(...wM(hM([r[0],r[0],r[1],r[2]]),10,(1+n.roughness)/2)):t.push(...wM(hM(r),10,(1+n.roughness)/2))}t.length&&r.push($j([t],n))}}return n.stroke!==EM&&r.push(i),this._d(`curve`,r,n)}polygon(e,t){let n=this._o(t),r=[],i=Uj(e,!0,n);return n.fill&&(n.fillStyle===`solid`?r.push(Qj([e],n)):r.push($j([e],n))),n.stroke!==EM&&r.push(i),this._d(`polygon`,r,n)}path(e,t){let n=this._o(t),r=[];if(!e)return this._d(`path`,r,n);e=(e||``).replace(/\n/g,` `).replace(/(-\s)/g,`-`).replace(`/(ss)/g`,` `);let i=n.fill&&n.fill!==`transparent`&&n.fill!==EM,a=n.stroke!==EM,o=!!(n.simplification&&n.simplification<1),s=o?4-4*(n.simplification||1):(1+n.roughness)/2,c=TM(e,1,s),l=Zj(e,n);if(i){if(n.fillStyle===`solid`){if(c.length===1){let t=Zj(e,Object.assign(Object.assign({},n),{disableMultiStroke:!0,roughness:n.roughness?n.roughness+n.fillShapeRoughnessGain:0}));r.push({type:`fillPath`,ops:this._mergedShape(t.ops)})}else r.push(Qj(c,n))}else r.push($j(c,n))}return a&&(o?c.forEach(e=>{r.push(Uj(e,!1,n))}):r.push(l)),this._d(`path`,r,n)}opsToPath(e,t){let n=``;for(let r of e.ops){let e=typeof t==`number`&&t>=0?r.data.map(e=>+e.toFixed(t)):r.data;switch(r.op){case`move`:n+=`M${e[0]} ${e[1]} `;break;case`bcurveTo`:n+=`C${e[0]} ${e[1]}, ${e[2]} ${e[3]}, ${e[4]} ${e[5]} `;break;case`lineTo`:n+=`L${e[0]} ${e[1]} `}}return n.trim()}toPaths(e){let t=e.sets||[],n=e.options||this.defaultOptions,r=[];for(let e of t){let t=null;switch(e.type){case`path`:t={d:this.opsToPath(e),stroke:n.stroke,strokeWidth:n.strokeWidth,fill:EM};break;case`fillPath`:t={d:this.opsToPath(e),stroke:EM,strokeWidth:0,fill:n.fill||EM};break;case`fillSketch`:t=this.fillSketch(e,n)}t&&r.push(t)}return r}fillSketch(e,t){let n=t.fillWeight;return n<0&&(n=t.strokeWidth/2),{d:this.opsToPath(e),stroke:t.fill||EM,strokeWidth:n,fill:EM}}_mergedShape(e){return e.filter((e,t)=>t===0||e.op!==`move`)}};function OM([e,t],[n,r],i){if(!i)return[e,t];let a=Math.cos(i),o=Math.sin(i),s=e-n,c=t-r;return[n+s*a-c*o,r+s*o+c*a]}function kM([e,t],[n,r]){return Math.hypot(n-e,r-t)}function AM(e,t,n){let[r,i]=e,[a,o]=t,[s,c]=n,l=s-a,u=c-o,d=l*l+u*u;if(d===0)return kM(e,t);let f=Math.max(0,Math.min(1,((r-a)*l+(i-o)*u)/d));return kM(e,[a+f*l,o+f*u])}function jM(e){let t=1/0,n=1/0,r=-1/0,i=-1/0;for(let[a,o]of e)t=Math.min(t,a),n=Math.min(n,o),r=Math.max(r,a),i=Math.max(i,o);return[t,n,r,i]}function MM(e,t){return t[0]>=e[0]&&t[1]>=e[1]&&t[2]<=e[2]&&t[3]<=e[3]}function NM(e,t){return e[0]<=t[2]&&e[2]>=t[0]&&e[1]<=t[3]&&e[3]>=t[1]}function PM(e,t){return[Math.min(e[0],t[0]),Math.min(e[1],t[1]),Math.max(e[0],t[0]),Math.max(e[1],t[1])]}function FM(e){return typeof e.angle==`number`&&Number.isFinite(e.angle)?e.angle:0}function IM(e){return e.type===`line`||e.type===`arrow`||e.type===`freedraw`}function LM(e){return e.points&&e.points.length>0?e.points:[[0,0]]}function RM(e){if(IM(e)){let[t,n,r,i]=jM(LM(e));return[e.x+(t+r)/2,e.y+(n+i)/2]}return[e.x+e.width/2,e.y+e.height/2]}function zM(e){let t=RM(e);return LM(e).map(([n,r])=>OM([e.x+n,e.y+r],t,FM(e)))}function BM(e){if(IM(e))return zM(e);let t=RM(e),{x:n,y:r,width:i,height:a}=e;return[[n,r],[n+i,r],[n+i,r+a],[n,r+a]].map(n=>OM(n,t,FM(e)))}function VM(e){return jM(BM(e))}function HM(e){return e.length===0?[0,0,0,0]:jM(e.flatMap(e=>BM(e)))}function UM(e,t){let[n,r]=OM(t,RM(e),-FM(e));return[n-e.x,r-e.y]}var WM=e=>!!e.backgroundColor&&e.backgroundColor!==`transparent`;function GM(e,t,[n,r],i,a){return n>=-i&&n<=e+i&&r>=-i&&r<=t+i?a?!0:n<=i||n>=e-i||r<=i||r>=t-i:!1}function KM(e,t,[n,r],i,a){let o=e/2,s=t/2;if(o<=0||s<=0)return!1;let c=n-o,l=r-s,u=Math.sqrt(c*c/(o*o)+l*l/(s*s)),d=Math.abs(u-1)*Math.min(o,s);return a&&u<=1?!0:d<=i}function qM(e,t,n,r,i){let a=[e/2,0],o=[e,t/2],s=[e/2,t],c=[0,t/2];return i&&e>0&&t>0&&Math.abs(n[0]-e/2)/(e/2)+Math.abs(n[1]-t/2)/(t/2)<=1?!0:[[a,o],[o,s],[s,c],[c,a]].some(([e,t])=>AM(n,e,t)<=r)}function JM(e,t,n){if(e.length===1)return AM(t,e[0],e[0])<=n;for(let r=0;r<e.length-1;r++)if(AM(t,e[r],e[r+1])<=n)return!0;return!1}function YM(e,t,n){if(e.isDeleted)return!1;let r=n+(Number.isFinite(e.strokeWidth)?e.strokeWidth:0)/2;if(IM(e))return JM(zM(e),t,r);let i=UM(e,t),{width:a,height:o}=e;switch(e.type){case`rectangle`:case`embeddable`:case`iframe`:return GM(a,o,i,r,WM(e));case`ellipse`:return KM(a,o,i,r,WM(e));case`diamond`:return qM(a,o,i,r,WM(e));case`frame`:case`magicframe`:{let[e,t]=i;return e>=0&&e<=a&&t>=-20&&t<0||GM(a,o,i,r,!1)}default:return GM(a,o,i,r,!0)}}function XM(e,t){return e.filter(e=>!e.isDeleted&&MM(t,VM(e)))}var ZM=`"LXGW WenKai Screen", "LXGW WenKai", "Excalifont", "Virgil", "Comic Sans MS", "Segoe Print", "Bradley Hand", cursive`,QM=`Helvetica, "PingFang SC", "Microsoft YaHei", "Segoe UI Emoji", "Segoe UI Symbol", system-ui, sans-serif`,$M=`"Cascadia Code", "Cascadia", ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace`,eN=new Map;function tN(e,t){t?eN.set(e,t):eN.delete(e)}var nN=new Set([2,3,6,8,9]);function rN(e){return!nN.has(e)}function iN(e){let t=e===void 0?void 0:eN.get(e);if(t)return t;switch(e){case 2:case 6:case 9:return QM;case 3:case 8:return $M;default:return ZM}}var aN={strokeColor:`#1e1e1e`,backgroundColor:`transparent`,fillStyle:`hachure`,strokeWidth:2,strokeStyle:`solid`,roughness:1,opacity:100,roundness:`round`,shadow:!1,fontFamily:5,fontSize:20,textAlign:`left`,startArrowhead:null,endArrowhead:`arrow`,arrowType:`round`},oN=1.25,sN=`useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict`;function cN(e=21){let t=crypto.getRandomValues(new Uint8Array(e)),n=``;for(let e of t)n+=sN[e&63];return n}function lN(){return Math.floor(Math.random()*2**31)}var uN=`#1e1e1e`,dN=`#1971c2`,fN=`3px solid #c4c4c4`,pN={fontSize:16,fontWeight:400,lineHeight:1.5},mN={h1:{fontSize:26,fontWeight:600,lineHeight:1.3},h2:{fontSize:22,fontWeight:600,lineHeight:1.35},h3:{fontSize:18,fontWeight:600,lineHeight:1.4}};function hN(e){return e.type===`heading`?mN[e.tag??``]??{...pN,fontWeight:600}:pN}var gN={bold:1,italic:2,strikethrough:4,underline:8,code:16,highlight:128};function _N(e,t){return typeof e.format==`number`&&(e.format&t)!==0}var vN=new Set([`root`,`list`,`listitem`,`quote`]);function yN(e){return vN.has(e.type)}function bN(e){return e?e.type===`text`?e.text??``:typeof e.text==`string`&&!e.children?.length?e.text:e.type===`linebreak`?`
15
+ `:e.type===`tab`?` `:(e.children??[]).map(bN).join(``):``}function xN(e){let t=e?.root;return t&&Array.isArray(t.children)?t:{type:`root`,children:[]}}function SN(e){return{root:{type:`root`,children:e.map(e=>({type:`paragraph`,children:e?[{type:`text`,text:e}]:[]}))}}}var CN=new Set([`rectangle`,`diamond`,`ellipse`,`image`,`svg`,`richtext`]),wN=e=>CN.has(e),TN=e=>e.shadow===!0&&wN(e.type);function EN(e,t){return t.roundness===`sharp`?null:e===`line`||e===`arrow`?{type:2}:[`rectangle`,`diamond`,`embeddable`,`iframe`,`richtext`].includes(e)?{type:3}:null}function DN(e,t,n){return{id:cN(),type:e,x:0,y:0,width:0,height:0,angle:0,strokeColor:n.strokeColor,backgroundColor:n.backgroundColor,fillStyle:n.fillStyle,...n.shadow&&wN(e)?{shadow:!0}:null,strokeWidth:n.strokeWidth,strokeStyle:n.strokeStyle,roughness:n.roughness,opacity:n.opacity,groupIds:[],frameId:null,index:null,roundness:EN(e,n),seed:lN(),version:1,versionNonce:lN(),isDeleted:!1,boundElements:null,updated:Date.now(),link:null,locked:!1,...t}}function ON(e,t,n=aN){return DN(e,t,n)}function kN(e,t,n=aN){let r=e===`arrow`,i=r&&n.arrowType===`elbow`;return{...DN(e,{},r&&n.arrowType!==`round`?{...n,roundness:`sharp`}:n),points:[[0,0]],lastCommittedPoint:null,startBinding:null,endBinding:null,startArrowhead:r?n.startArrowhead:null,endArrowhead:r?n.endArrowhead:null,...r?{elbowed:i}:null,...t}}function AN(e,t=aN){return{...DN(`freedraw`,{},t),points:[],pressures:[],simulatePressure:!0,lastCommittedPoint:null,...e}}function jN(e,t=aN){return{...DN(`text`,{},{...t,roundness:`sharp`}),fontSize:t.fontSize,fontFamily:t.fontFamily,textAlign:t.textAlign,verticalAlign:`top`,containerId:null,originalText:e.text,autoResize:!0,lineHeight:oN,...e}}function MN(e,t=aN){return{...DN(`image`,{},{...t,roundness:`sharp`}),fileId:void 0,status:`pending`,scale:[1,1],crop:null,...e}}function NN(e,t=aN){return{...DN(`richtext`,{},{...t,roundness:`round`,shadow:!1}),strokeColor:`transparent`,backgroundColor:`#ffec99`,fillStyle:`solid`,roughness:0,strokeWidth:1,content:SN([``]),...e}}function PN(e,t=aN){return{...DN(`svg`,{},{...t,roundness:`sharp`,shadow:!1}),svg:``,...e}}function FN(e,t=aN){return{...DN(`frame`,{},{...t,roundness:`sharp`,backgroundColor:`transparent`}),name:null,...e}}var IN=/[\p{Script=Han}\p{Script=Hangul}\p{Script=Hiragana}\p{Script=Katakana}\u3000-\u303F\uFF01-\uFF60]/u;function LN(e,t){let n=HN(t),r=0;for(let t of e)r+=IN.test(t)?n:n*.6;return r}var RN;function zN(){return RN===void 0&&(RN=null,typeof OffscreenCanvas<`u`&&(RN=new OffscreenCanvas(1,1).getContext(`2d`)),!RN&&typeof document<`u`&&!/jsdom/i.test(navigator.userAgent)&&(RN=document.createElement(`canvas`).getContext(`2d`))),RN}var BN=(e,t)=>{let n=zN();return n?(n.font=t,n.measureText(e).width):LN(e,t)};function VN(e,t){return BN(e,t)}function HN(e){let t=/(\d+(?:\.\d+)?)px/.exec(e);return t?Number(t[1]):20}function UN({fontSize:e,fontFamily:t}){return`${e}px ${iN(t)}`}var WN={1:1.25,2:1.15,3:1.2,5:1.25,6:1.35,8:1.15,9:1.15};function GN(e){return WN[e]??1.25}function KN(e,t,n){let r=e.split(`
16
+ `);return{width:Math.max(0,...r.map(e=>VN(e,t))),height:r.length*HN(t)*n}}function qN(e){return IN.test(e)}var JN=`0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz`,YN=JN[0],XN=`A${YN.repeat(26)}`;function ZN(e,t){if(t!==null&&e>=t)throw Error(`${e} >= ${t}`);if(e.slice(-1)===YN||t&&t.slice(-1)===YN)throw Error(`trailing zero`);if(t){let n=0;for(;(e[n]||YN)===t[n];)n++;if(n>0)return t.slice(0,n)+ZN(e.slice(n),t.slice(n))}let n=e?JN.indexOf(e[0]):0,r=t===null?62:JN.indexOf(t[0]);return r-n>1?JN[Math.round(.5*(n+r))]:t&&t.length>1?t.slice(0,1):JN[n]+ZN(e.slice(1),null)}function QN(e){if(e>=`a`&&e<=`z`)return e.charCodeAt(0)-97+2;if(e>=`A`&&e<=`Z`)return 90-e.charCodeAt(0)+2;throw Error(`invalid order key head: ${e}`)}function $N(e){let t=QN(e[0]);if(t>e.length)throw Error(`invalid order key: ${e}`);return e.slice(0,t)}function eP(e){if(typeof e!=`string`||e.length===0)return!1;try{if(e===XN)return!1;let t=$N(e);return[...e].every(e=>JN.includes(e))?e.slice(t.length).slice(-1)!==YN:!1}catch{return!1}}function tP(e){if(!eP(e))throw Error(`invalid order key: ${e}`)}function nP(e){let[t,...n]=e.split(``),r=!0;for(let e=n.length-1;r&&e>=0;e--){let t=JN.indexOf(n[e])+1;t===62?n[e]=YN:(n[e]=JN[t],r=!1)}if(!r)return t+n.join(``);if(t===`Z`)return`a${YN}`;if(t===`z`)return null;let i=String.fromCharCode(t.charCodeAt(0)+1);return i>`a`?n.push(YN):n.pop(),i+n.join(``)}function rP(e){let[t,...n]=e.split(``),r=!0;for(let e=n.length-1;r&&e>=0;e--){let t=JN.indexOf(n[e])-1;t===-1?n[e]=JN.slice(-1):(n[e]=JN[t],r=!1)}if(!r)return t+n.join(``);if(t===`a`)return`Z${JN.slice(-1)}`;if(t===`A`)return null;let i=String.fromCharCode(t.charCodeAt(0)-1);return i<`Z`?n.push(JN.slice(-1)):n.pop(),i+n.join(``)}function iP(e,t){if(e!==null&&tP(e),t!==null&&tP(t),e!==null&&t!==null&&e>=t)throw Error(`${e} >= ${t}`);if(e===null){if(t===null)return`a${YN}`;let e=$N(t),n=t.slice(e.length);if(e===XN)return e+ZN(``,n);if(e<t)return e;let r=rP(e);if(r===null)throw Error(`cannot decrement any more`);return r}if(t===null){let t=$N(e),n=e.slice(t.length),r=nP(t);return r===null?t+ZN(n,null):r}let n=$N(e),r=e.slice(n.length),i=$N(t),a=t.slice(i.length);if(n===i)return n+ZN(r,a);let o=nP(n);if(o===null)throw Error(`cannot increment any more`);return o<t?o:n+ZN(r,null)}function aP(e,t,n){if(n<=0)return[];if(n===1)return[iP(e,t)];if(t===null){let r=iP(e,t),i=[r];for(let e=0;e<n-1;e++)r=iP(r,t),i.push(r);return i}if(e===null){let r=iP(e,t),i=[r];for(let t=0;t<n-1;t++)r=iP(e,r),i.push(r);return i.reverse()}let r=Math.floor(n/2),i=iP(e,t);return[...aP(e,i,r),i,...aP(i,t,n-r-1)]}function oP(e){let t=[],n=null;for(let r of e){let e=eP(r.index)&&(n===null||r.index>n);t.push(e),e&&(n=r.index)}if(t.every(Boolean))return[...e];let r=[...e],i=0;for(;i<r.length;){if(t[i]){i++;continue}let e=i;for(;i<r.length&&!t[i];)i++;let n=aP(e>0?r[e-1].index:null,i<r.length?r[i].index:null,i-e);for(let t=e;t<i;t++)r[t]={...r[t],index:n[t-e]}}return r}function $(e,t={}){return{...e,...t,version:(e.version??0)+1,versionNonce:lN(),updated:Date.now()}}var sP=`http://www.w3.org/2000/svg`,cP=/<svg\b[^>]*>/i;function lP(e){return typeof e==`string`&&/^\s*(?:<\?xml[^>]*>\s*)?(?:<!--[\s\S]*?-->\s*)*<svg[\s/>]/i.test(e)}function uP(e){let t=cP.exec(e);if(!t||/\sxmlns\s*=/.test(t[0]))return e;let n=t.index+4;return`${e.slice(0,n)} xmlns="${sP}"${e.slice(n)}`}function dP(e){return`data:image/svg+xml;charset=utf-8,${encodeURIComponent(uP(e))}`}function fP(e,t){let n=RegExp(`\\s${t}\\s*=\\s*["']([^"']*)["']`,`i`).exec(e);return n?n[1]:null}function pP(e){if(!e)return null;let t=/^\s*(\d+(?:\.\d+)?)\s*(?:px\s*)?$/i.exec(e);return t?Number(t[1]):null}function mP(e){let t=cP.exec(e)?.[0];if(!t)return null;let n=pP(fP(t,`width`)),r=pP(fP(t,`height`));if(n&&r)return{width:n,height:r};let i=fP(t,`viewBox`)?.trim().split(/[\s,]+/).map(Number);return i&&i.length===4&&i[2]>0&&i[3]>0?{width:i[2],height:i[3]}:null}var hP=120,gP=.7;function _P(e){let t=[],n=``;for(let r of e)r===` `||qN(r)?(n&&t.push(n),n=``,t.push(r)):n+=r;return n&&t.push(n),t}function vP(e,t,n){let r=[],i=``;for(let a of e)i&&VN(i+a,t)>n?(r.push(i),i=a):i+=a;return i&&r.push(i),r}function yP(e,t,n){let r=[],i=``,a=()=>{r.push(i.trimEnd()),i=``};for(let o of _P(e)){if(VN(i+o,t)<=n){i+=o;continue}if(o===` `){a();continue}if(i&&a(),VN(o,t)<=n){i=o;continue}let e=vP(o,t,n);for(let t of e.slice(0,-1))r.push(t);i=e.at(-1)??``}return(i||r.length===0)&&a(),r}function bP(e,t,n){return!Number.isFinite(n)||n<=0?e:e.split(`
17
+ `).flatMap(e=>yP(e,t,n)).join(`
18
+ `)}function xP(e){let t=0;for(let n=0;n<e.length-1;n++)t+=kM(e[n],e[n+1]);return t}function SP(e){if(!IM(e))return[e.x+e.width/2,e.y+e.height/2];let t=zM(e);if(t.length===1)return t[0];let n=xP(t)/2;for(let e=0;e<t.length-1;e++){let r=kM(t[e],t[e+1]);if(n<=r){let i=r===0?0:n/r;return[t[e][0]+(t[e+1][0]-t[e][0])*i,t[e][1]+(t[e+1][1]-t[e][1])*i]}n-=r}return t.at(-1)}function CP(e){if(IM(e)){let t=xP(zM(e));return Math.max(hP,t*gP)}return e.type===`ellipse`?Math.round(e.width/2*Math.SQRT2)-10:e.type===`diamond`?Math.round(e.width/2)-10:e.width-10}function wP(e){return e.type===`ellipse`?Math.round(e.height/2*Math.SQRT2)-10:e.type===`diamond`?Math.round(e.height/2)-10:e.height-10}function TP(e,t){return e.type===`ellipse`?Math.ceil((t+10)*2/Math.SQRT2):e.type===`diamond`?Math.ceil((t+10)*2):t+10}function EP(e,t){let n=UN(t),r=t.lineHeight??GN(t.fontFamily),i=t.originalText??t.text,a=bP(i,n,CP(e)),o=KN(a,n,r),s=e;!IM(e)&&o.height>wP(e)&&(s=$(e,{height:TP(e,o.height)}));let c=IM(s),[l,u]=c?SP(s):[s.x+s.width/2,s.y+s.height/2],d=c?`center`:t.textAlign??`center`,f=c?`middle`:t.verticalAlign??`middle`,p=c?o.width/2:CP(s)/2,m=c?o.height/2:wP(s)/2,h=d===`left`?l-p:d===`right`?l+p-o.width:l-o.width/2,g=f===`top`?u-m:f===`bottom`?u+m-o.height:u-o.height/2,_=c?0:FM(s),[v,y]=_?OM([h+o.width/2,g+o.height/2],[l,u],_):[h+o.width/2,g+o.height/2],b={...t,text:a,originalText:i,width:o.width,height:o.height,x:v-o.width/2,y:y-o.height/2,angle:_,textAlign:d,verticalAlign:f,containerId:s.id};return{container:s,text:b}}function DP(e,t){if(t)return EP(t,e).text;let n=UN(e),r=e.lineHeight??GN(e.fontFamily),i=e.originalText??e.text,a=e.autoResize===!1?bP(i,n,e.width):i,o=KN(a,n,r);return{...e,text:a,width:e.autoResize===!1?e.width:o.width,height:o.height}}function OP(e){"@babel/helpers - typeof";return OP=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},OP(e)}function kP(e,t){if(OP(e)!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(OP(r)!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function AP(e){var t=kP(e,`string`);return OP(t)==`symbol`?t:t+``}function jP(e,t,n){return(t=AP(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function MP(e){switch(e.type){case`line`:case`arrow`:return kN(e.type,{});case`freedraw`:return AN({});case`text`:return jN({text:e.text??``});case`image`:return MN({});case`svg`:return PN({});case`richtext`:return NN({});case`frame`:case`magicframe`:return{...FN({}),type:e.type};default:return ON(e.type??`rectangle`,{})}}var NP=new Set([`rectangle`,`image`,`embeddable`,`iframe`]);function PP(e){return e.strokeSharpness===`round`?{type:NP.has(e.type??``)?3:2}:null}function FP(e){let t={...MP(e)};for(let[n,r]of Object.entries(e))r!==void 0&&(t[n]=r);return`roundness`in e&&e.roundness!==void 0||(t.roundness=PP(e)),e.type===`text`&&t.originalText===void 0&&(t.originalText=e.text),e.type===`svg`&&typeof t.svg==`string`&&(t.svg=uP(t.svg)),e.type!==`line`&&e.type!==`arrow`||e.points||(t.points=[[0,0],[e.width??0,e.height??0]]),t}var IP=class extends Error{constructor(e){super(`Could not load ${e}`),jP(this,`font`,void 0),this.font=e,this.name=`FontLoadError`}},LP=e=>e.trim().replaceAll(/^["']|["']$/g,``),RP=new Set(ZM.split(`,`).slice(0,4).map(LP));function zP(e){let t=e.split(`,`).map(LP).filter(e=>RP.has(e));if(t.length===0)return!0;try{for(let e of document.fonts)if(t.includes(LP(e.family)))return!0}catch{return!1}return!1}async function BP(e,t){if(typeof document>`u`||!document.fonts?.load)return;let n=new Map;for(let t of e){if(t.type!==`text`||t.isDeleted)continue;let e=iN(t.fontFamily),r=`${t.fontSize}px ${e}`,i=n.get(r)??{chars:new Set,stack:e};for(let e of t.originalText??t.text)i.chars.add(e);n.set(r,i)}await Promise.all([...n].map(async([e,{chars:n,stack:r}])=>{let i=await document.fonts.load(e,[...n].join(``)).catch(()=>{if(t)throw new IP(e);return[]});if(t&&i.length===0&&!zP(r))throw new IP(e)}))}function VP(e,t){return e.text!==t.text||e.width!==t.width||e.height!==t.height||e.x!==t.x||e.y!==t.y}async function HP(e,t,n={}){let r=oP(e.map(e=>FP(e)));if(!n.refreshDimensions)return r;await BP(r,n.strictFonts??!1);let i=new Map(r.map(e=>[e.id,e]));return r.map(e=>{if(e.type!==`text`)return e;let t=DP(e,e.containerId?i.get(e.containerId):void 0);return VP(e,t)?$(e,t):e})}var UP=e=>{let{fontSize:t,fontWeight:n}=hN(e);return`${n===600?`bold `:``}${t}px ${QM}`};function WP(e,t){let{lineHeight:n}=hN(e),r=UP(e);return bP(bN(e),r,Math.max(1,t)).split(`
19
+ `).length*HN(r)*n}function GP(e){return e.type===`list`?20:e.type===`quote`?12:0}function KP(e){return(e.children??[]).some(e=>yN(e)||e.type===`paragraph`||e.type===`heading`)}function qP(e,t){let n=0;for(let r of e)yN(r)&&KP(r)?n+=qP(r.children??[],t-GP(r)):n+=WP(r,t-GP(r));return n}var JP=new WeakMap;function YP(e,t){let n=xN(e),r=JP.get(n),i=r?.get(t);if(i!==void 0)return i;let a=t-24,o=n.children??[],s=(o.length===0?WP({type:`paragraph`},a):qP(o,a))+24;return r?r.set(t,s):JP.set(n,new Map([[t,s]])),s}var XP={richtext:Object.keys(NN({})),svg:Object.keys(PN({}))};function ZP(e){let t=XP[e.type];if(!t||!t.some(t=>!(t in e)||e[t]===void 0)&&Number.isFinite(e.width)&&Number.isFinite(e.height))return e;let n=FP(e);return{...n,width:Number.isFinite(n.width)?n.width:0,height:Number.isFinite(n.height)?n.height:0}}function QP(e){let t=!1,n=e.map(e=>{let n=ZP(e);if(n!==e&&(t=!0),n.type!==`richtext`||n.isDeleted)return n;let r=YP(n.content,n.width);return r>n.height?(t=!0,{...n,height:r}):n});return t?n:e}var $P=(0,A.createContext)(null),eF=(0,A.createContext)(null),tF=(0,A.createContext)(!1),nF=(e,t)=>(e+t)/2;function rF(e){let t=e.length;if(t<4)return``;let n=e[0],r=e[1],i=e[2],a=`M${n[0].toFixed(2)},${n[1].toFixed(2)} Q${r[0].toFixed(2)},${r[1].toFixed(2)} ${nF(r[0],i[0]).toFixed(2)},${nF(r[1],i[1]).toFixed(2)} T`;for(let i=2,o=t-1;i<o;i++)n=e[i],r=e[i+1],a+=`${nF(n[0],r[0]).toFixed(2)},${nF(n[1],r[1]).toFixed(2)} `;return`${a}Z`}function iF(e){let t=e.pressures??[],n=e.simulatePressure??t.length===0;return rF(dj(e.points.map(([e,r],i)=>[e,r,n?.5:t[i]??.5]),{simulatePressure:n,size:e.strokeWidth*4.25,thinning:.6,smoothing:.5,streamline:.5,easing:e=>Math.sin(e*Math.PI/2),last:!0}))}var aF=/^(?:https?:|mailto:|#|\/)/i;function oF(e){let t={};for(let n of(e??``).split(`;`)){let[e,...r]=n.split(`:`),i=e?.trim().toLowerCase(),a=r.join(`:`).trim();a&&!/url\(|expression/i.test(a)&&(i===`color`&&(t.color=a),i===`background-color`&&(t.backgroundColor=a))}return t}function sF(e,t){let n=e.text??``,r=oF(e.style);return Object.keys(r).length>0&&(n=(0,j.jsx)(`span`,{style:r,children:n})),_N(e,gN.code)&&(n=(0,j.jsx)(`code`,{children:n})),_N(e,gN.highlight)&&(n=(0,j.jsx)(`mark`,{children:n})),_N(e,gN.underline)&&(n=(0,j.jsx)(`u`,{children:n})),_N(e,gN.strikethrough)&&(n=(0,j.jsx)(`s`,{children:n})),_N(e,gN.italic)&&(n=(0,j.jsx)(`em`,{children:n})),_N(e,gN.bold)&&(n=(0,j.jsx)(`strong`,{children:n})),(0,j.jsx)(`span`,{children:n},t)}function cF(e=[]){return e.map((e,t)=>{switch(e.type){case`text`:return sF(e,t);case`linebreak`:return(0,j.jsx)(`br`,{},t);case`tab`:return(0,j.jsx)(`span`,{children:` `},t);case`link`:case`autolink`:{let n=typeof e.url==`string`&&aF.test(e.url)?e.url:void 0;return(0,j.jsx)(`a`,{href:n,rel:`noopener noreferrer`,style:{color:dN},target:`_blank`,children:cF(e.children)},t)}default:return(0,j.jsx)(`span`,{children:bN(e)},t)}})}function lF(e){let{fontSize:t,fontWeight:n,lineHeight:r}=hN(e);return{fontSize:t,fontWeight:n,lineHeight:r,margin:0,minHeight:t*r}}var uF=new Set([`h1`,`h2`,`h3`,`h4`,`h5`,`h6`]);function dF(e,t){switch(e.type){case`paragraph`:return(0,j.jsx)(`p`,{style:lF(e),children:cF(e.children)},t);case`heading`:{let n=uF.has(e.tag??``)?e.tag:`h4`;return(0,j.jsx)(n,{style:lF(e),children:cF(e.children)},t)}case`quote`:return(0,j.jsx)(`blockquote`,{style:{...lF(e),paddingLeft:9,borderLeft:fN},children:cF(e.children)},t);case`list`:{let n=e.listType===`number`?`ol`:`ul`;return(0,j.jsx)(n,{style:{margin:0,paddingLeft:20},children:(e.children??[]).map((e,t)=>fF(e.type===`listitem`?e:{type:`listitem`,children:[e]},t))},t)}default:return(0,j.jsx)(`p`,{style:lF({type:`paragraph`}),children:bN(e)},t)}}function fF(e,t){let n=e.children??[],r=n.filter(e=>e.type===`list`),i=n.filter(e=>e.type!==`list`);return(0,j.jsxs)(`li`,{style:lF({type:`paragraph`}),children:[cF(i),r.map((e,t)=>dF(e,t))]},t)}var pF={color:uN,fontFamily:QM,overflowWrap:`break-word`,whiteSpace:`pre-wrap`},mF=({content:e})=>(0,j.jsx)(j.Fragment,{children:(xN(e).children??[]).map((e,t)=>dF(e,t))}),hF={xmlns:`http://www.w3.org/1999/xhtml`},gF=({el:e})=>(0,j.jsx)(`foreignObject`,{height:e.height,style:{overflow:`visible`},width:e.width,children:(0,j.jsx)(`div`,{"data-richtext-body":e.id,...hF,style:{...pF,boxSizing:`border-box`,width:e.width,minHeight:e.height,padding:12},children:(0,j.jsx)(mF,{content:e.content})})}),_F=.8,vF=6,yF=`#c4c4c4`;function bF(e){let t=(e.children??[]).find(e=>typeof e.style==`string`),n=/(?:^|;)\s*color\s*:\s*([^;]+)/i.exec(t?.style??``);return n?n[1].trim():uN}function xF(e,t,n,r,i){let{fontSize:a,fontWeight:o,lineHeight:s}=hN(e),c=UP(e),l=GP(e),u=bP(bN(e),c,Math.max(1,n-l)).split(`
20
+ `),d=HN(c)*s,f=r.y,p=f+(d-a)/2+a*_F,m=r.nodes.length;e.type===`quote`&&r.nodes.push((0,j.jsx)(`rect`,{fill:yF,height:u.length*d,width:3,x:t,y:f},`q${m}`)),i&&r.nodes.push((0,j.jsx)(`text`,{fill:uN,fontFamily:QM,fontSize:a,textAnchor:`end`,x:t-vF,y:p,children:i},`m${m}`)),r.nodes.push((0,j.jsx)(`text`,{fill:bF(e),fontFamily:QM,fontSize:a,fontWeight:o,style:{whiteSpace:`pre`},x:t+l,y:p,children:u.map((e,n)=>(0,j.jsx)(`tspan`,{dy:n===0?0:d,x:t+l,children:e||` `},n))},`t${m}`)),r.y+=u.length*d}function SF(e,t,n,r,i){e.forEach((e,a)=>{if(yN(e)&&KP(e)){let i=GP(e);SF(e.children??[],t+i,n-i,r,e.type===`list`?e:void 0)}else xF(e,t,n,r,i?i.listType===`number`?`${a+1}.`:`•`:void 0)})}var CF=({el:e})=>{let t={nodes:[],y:12};return SF(xN(e.content).children??[],12,e.width-24,t),(0,j.jsx)(`g`,{"data-richtext-body":e.id,children:t.nodes})},wF=null;function TF(){return wF||=new DM,wF}function EF(e,t){let n=DF(e.strokeStyle,e.strokeWidth),r={seed:e.seed||1,stroke:e.strokeColor,strokeWidth:e.strokeWidth,roughness:e.roughness,disableMultiStroke:e.strokeWidth<2,fill:e.backgroundColor===`transparent`?void 0:e.backgroundColor,fillStyle:e.fillStyle,fillWeight:e.strokeWidth/2,hachureGap:e.strokeWidth*4,preserveVertices:!1};return n&&(r.strokeLineDash=n),{...r,...t}}function DF(e,t){if(e!==`solid`){if(e===`dashed`)return[8,8+t];if(e===`dotted`)return[1.5,6+t]}}function OF(e,t){return TF().rectangle(0,0,e.width,e.height,EF(e,t))}function kF(e,t){return TF().ellipse(e.width/2,e.height/2,e.width,e.height,EF(e,t))}function AF(e,t){let n=e.width/2,r=e.height/2;return TF().polygon([[n,0],[e.width,r],[n,e.height],[0,r]],EF(e,t))}function jF(e,t){return TF().path(e,t)}function MF(e,t){return TF().linearPath(e,t)}function NF(e,t){return TF().curve(e,t)}function PF(e){let t=``;for(let{op:n,data:r}of e)switch(n){case`move`:t+=`M${r[0]} ${r[1]} `;break;case`lineTo`:t+=`L${r[0]} ${r[1]} `;break;case`bcurveTo`:t+=`C${r[0]} ${r[1]}, ${r[2]} ${r[3]}, ${r[4]} ${r[5]} `}return t.trim()}function FF(e){return e.sets.map(e=>({type:e.type,d:PF(e.ops)}))}function IF(e,t,n){let r=Math.max(0,Math.min(n,e/2,t/2));return[`M ${r} 0`,`L ${e-r} 0`,`Q ${e} 0 ${e} ${r}`,`L ${e} ${t-r}`,`Q ${e} ${t} ${e-r} ${t}`,`L ${r} ${t}`,`Q 0 ${t} 0 ${t-r}`,`L 0 ${r}`,`Q 0 0 ${r} 0`,`Z`].join(` `)}var LF=.25,RF=32;function zF(e){if(!e.roundness)return 0;if(e.roundness.type===3){let t=Math.min(e.width,e.height);return Math.min(t*LF,RF)}return e.roundness.value??0}var BF=({el:e})=>{let t=(0,A.use)($P);return lP(e.svg)?(0,j.jsx)(`image`,{filter:t?`url(#${t.filterId})`:void 0,height:e.height,href:dP(e.svg),preserveAspectRatio:`xMidYMid meet`,width:e.width}):(0,j.jsx)(`rect`,{fill:`none`,height:e.height,stroke:`#888`,strokeDasharray:`4 4`,strokeWidth:1,width:e.width})},VF=({el:e,files:t})=>{switch(e.type){case`rectangle`:return(0,j.jsx)(WF,{el:e});case`ellipse`:return(0,j.jsx)(GF,{el:e});case`diamond`:return(0,j.jsx)(KF,{el:e});case`line`:case`arrow`:return(0,j.jsx)(XF,{el:e});case`freedraw`:return(0,j.jsx)(ZF,{el:e});case`text`:return(0,j.jsx)($F,{el:e});case`image`:return(0,j.jsx)(tI,{el:e,files:t});case`svg`:return(0,j.jsx)(BF,{el:e});case`richtext`:return(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(WF,{el:e}),(0,j.jsx)(eI,{el:e})]});case`frame`:case`magicframe`:return(0,j.jsx)(rI,{el:e});case`embeddable`:case`iframe`:return(0,j.jsx)(iI,{el:e});default:return null}},HF=new Set([`curve`,`polygon`]),UF=({drawable:e,fillColor:t,strokeColor:n,strokeWidth:r})=>{let i=FF(e);return(0,j.jsx)(j.Fragment,{children:i.map((i,a)=>i.type===`path`?(0,j.jsx)(`path`,{d:i.d,fill:`none`,stroke:n,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:r},a):i.type===`fillPath`?(0,j.jsx)(`path`,{d:i.d,fill:t||`none`,fillRule:HF.has(e.shape)?`evenodd`:void 0,stroke:`none`},a):(0,j.jsx)(`path`,{d:i.d,fill:`none`,stroke:t||n,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:e.options.fillWeight??r/2},a))})},WF=({el:e})=>{let t=zF(e),n=EF(e),r=t>0?jF(IF(e.width,e.height,t),n):OF(e);return(0,j.jsx)(UF,{drawable:r,fillColor:e.backgroundColor===`transparent`?void 0:e.backgroundColor,strokeColor:e.strokeColor,strokeWidth:e.strokeWidth})},GF=({el:e})=>{let t=kF(e);return(0,j.jsx)(UF,{drawable:t,fillColor:e.backgroundColor===`transparent`?void 0:e.backgroundColor,strokeColor:e.strokeColor,strokeWidth:e.strokeWidth})},KF=({el:e})=>{let t=AF(e);return(0,j.jsx)(UF,{drawable:t,fillColor:e.backgroundColor===`transparent`?void 0:e.backgroundColor,strokeColor:e.strokeColor,strokeWidth:e.strokeWidth})},qF=18;function JF(e,t){if(e.length<2)return{x:0,y:0,angle:0};let n=t===`end`?e.length-1:0,r=t===`end`?e.length-2:1,[i,a]=e[n],[o,s]=e[r];return{x:i,y:a,angle:Math.atan2(a-s,i-o)}}var YF=({angle:e,color:t,shape:n,strokeWidth:r,x:i,y:a})=>{if(!n)return null;if(n===`arrow`||n===`triangle`||n===`triangle_outline`){let o=qF,s=e+Math.PI-Math.PI/7,c=e+Math.PI+Math.PI/7,l=i+Math.cos(s)*o,u=a+Math.sin(s)*o,d=i+Math.cos(c)*o,f=a+Math.sin(c)*o;return n===`arrow`?(0,j.jsxs)(`g`,{children:[(0,j.jsx)(`line`,{stroke:t,strokeLinecap:`round`,strokeWidth:r,x1:i,x2:l,y1:a,y2:u}),(0,j.jsx)(`line`,{stroke:t,strokeLinecap:`round`,strokeWidth:r,x1:i,x2:d,y1:a,y2:f})]}):(0,j.jsx)(`polygon`,{fill:n===`triangle`?t:`none`,points:`${i},${a} ${l},${u} ${d},${f}`,stroke:t,strokeLinejoin:`round`,strokeWidth:r})}if(n===`dot`||n===`circle`||n===`circle_outline`)return(0,j.jsx)(`circle`,{cx:i,cy:a,fill:n===`circle_outline`?`none`:t,r:qF/3,stroke:t,strokeWidth:r});if(n===`bar`){let n=qF/1.5,o=e+Math.PI/2;return(0,j.jsx)(`line`,{stroke:t,strokeLinecap:`round`,strokeWidth:r,x1:i+Math.cos(o)*n,x2:i-Math.cos(o)*n,y1:a+Math.sin(o)*n,y2:a-Math.sin(o)*n})}return null},XF=({el:e})=>{let t=e.points&&e.points.length>0?e.points:[[0,0],[e.width,e.height]],n=e.roundness?.type===2,r=EF(e,{fill:void 0,fillStyle:void 0}),i=n&&t.length>2?NF(t,r):MF(t,r),a=e.startArrowhead,o=e.type===`arrow`?e.endArrowhead??`arrow`:e.endArrowhead,s=a?JF(t,`start`):null,c=o?JF(t,`end`):null;return(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(UF,{drawable:i,strokeColor:e.strokeColor,strokeWidth:e.strokeWidth}),a&&s&&(0,j.jsx)(YF,{angle:s.angle+Math.PI,color:e.strokeColor,shape:a,strokeWidth:e.strokeWidth,x:s.x,y:s.y}),o&&c&&(0,j.jsx)(YF,{angle:c.angle,color:e.strokeColor,shape:o,strokeWidth:e.strokeWidth,x:c.x,y:c.y})]})},ZF=({el:e})=>{if(!e.points||e.points.length===0)return null;if(e.points.length===1){let[t,n]=e.points[0];return(0,j.jsx)(`circle`,{cx:t,cy:n,fill:e.strokeColor,r:e.strokeWidth})}return(0,j.jsx)(`path`,{d:iF(e),fill:e.strokeColor,stroke:`none`})},QF=1.25,$F=({el:e})=>{let t=e.lineHeight??QF,n=e.text.split(`
21
+ `),r=e.fontSize,i=(0,A.use)(eF),a=i&&rN(e.fontFamily)?i:iN(e.fontFamily),o=e.textAlign===`center`?`middle`:e.textAlign===`right`?`end`:`start`,s=e.textAlign===`center`?e.width/2:e.textAlign===`right`?e.width:0,c=r*t,l=r*.82;return(0,j.jsx)(`text`,{dominantBaseline:`alphabetic`,fill:e.strokeColor,fontFamily:a,fontSize:r,style:{whiteSpace:`pre`},textAnchor:o,x:s,y:l,children:n.map((e,t)=>(0,j.jsx)(`tspan`,{dy:t===0?0:c,x:s,children:e||` `},t))})},eI=({el:e})=>(0,A.use)(tF)?(0,j.jsx)(CF,{el:e}):(0,j.jsx)(gF,{el:e}),tI=({el:e,files:t})=>{let n=(0,A.use)($P),r=`rich-excalidraw-crop-${(0,A.useId)().replaceAll(/[^\w-]/g,``)}`,i=e.fileId&&t?t[e.fileId]:void 0;if(!i?.dataURL)return(0,j.jsx)(nI,{el:e,label:`Image`});let a=e.scale?.[0]??1,o=e.scale?.[1]??1,s=a!==1||o!==1?`translate(${a<0?e.width:0} ${o<0?e.height:0}) scale(${a} ${o})`:void 0,c=n?`url(#${n.filterId})`:void 0,l=e.crop;if(l&&l.width>0&&l.height>0){let t=e.width/l.width,n=e.height/l.height,a=l.naturalWidth??l.x+l.width,o=l.naturalHeight??l.y+l.height;return(0,j.jsxs)(`g`,{transform:s,children:[(0,j.jsx)(`clipPath`,{id:r,children:(0,j.jsx)(`rect`,{height:e.height,width:e.width})}),(0,j.jsx)(`image`,{clipPath:`url(#${r})`,filter:c,height:o*n,href:i.dataURL,preserveAspectRatio:`none`,width:a*t,x:-l.x*t,y:-l.y*n})]})}return(0,j.jsx)(`image`,{filter:c,height:e.height,href:i.dataURL,preserveAspectRatio:`none`,transform:s,width:e.width})},nI=({el:e,label:t})=>(0,j.jsxs)(`g`,{children:[(0,j.jsx)(`rect`,{fill:`none`,height:e.height,stroke:e.strokeColor||`#888`,strokeDasharray:`4 4`,strokeWidth:1,width:e.width}),(0,j.jsx)(`text`,{dominantBaseline:`middle`,fill:e.strokeColor||`#888`,fontFamily:iN(1),fontSize:Math.min(16,e.height/4),textAnchor:`middle`,x:e.width/2,y:e.height/2,children:t})]}),rI=({el:e})=>{let t=e.name||(e.type===`magicframe`?`Magic frame`:`Frame`);return(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(`rect`,{fill:`none`,height:e.height,rx:4,stroke:`#bbb`,strokeWidth:1.5,width:e.width}),(0,j.jsx)(`text`,{fill:`#999`,fontFamily:iN(2),fontSize:12,x:4,y:-4,children:t})]})},iI=({el:e})=>(0,j.jsx)(nI,{el:e,label:`Embed`}),aI=({dark:e,id:t})=>(0,j.jsx)(`filter`,{height:`160%`,id:t,width:`140%`,x:`-20%`,y:`-20%`,children:(0,j.jsx)(`feDropShadow`,{dx:`0`,dy:`3`,floodColor:e?`#fff`:`#000`,floodOpacity:`0.14`,stdDeviation:`4`})}),oI=32;function sI(e){let t=QP(e),n=1/0,r=1/0,i=-1/0,a=-1/0;for(let e of t)e.isDeleted||(n=Math.min(n,e.x),r=Math.min(r,e.y),i=Math.max(i,e.x+e.width),a=Math.max(a,e.y+e.height));return Number.isFinite(n)?{minX:n-oI,minY:r-oI,width:i-n+64,height:a-r+64}:{minX:0,minY:0,width:100,height:100}}var cI=`invert(93%) hue-rotate(180deg)`,lI=({id:e})=>(0,j.jsxs)(`filter`,{colorInterpolationFilters:`sRGB`,id:e,children:[(0,j.jsx)(`feColorMatrix`,{type:`hueRotate`,values:`180`}),(0,j.jsx)(`feColorMatrix`,{type:`matrix`,values:`-1.16279 0 0 0 1.081395 0 -1.16279 0 0 1.081395 0 0 -1.16279 0 1.081395 0 0 0 1 0`})]}),uI=e=>e.type===`frame`||e.type===`magicframe`,dI=4,fI=64;function pI(e){let t=new Map(e.filter(e=>e.type===`arrow`||e.type===`line`).map(e=>[e.id,e])),n=new Map;for(let r of e){if(r.type!==`text`||!r.containerId||!r.text?.trim())continue;let e=t.get(r.containerId);if(!e)continue;let i=e.points??[],a=[0,e.width,...i.map(([e])=>e)],o=[0,e.height,...i.map(([,e])=>e)],s=e.x+Math.min(...a)-fI,c=e.y+Math.min(...o)-fI;n.set(e.id,{area:[s,c,e.x+Math.max(...a)+fI-s,e.y+Math.max(...o)+fI-c],hole:[r.x-dI,r.y-dI,r.width+8,r.height+8]})}return n}var mI=(0,A.memo)(({dark:e=!1,elementProps:t,files:n,handFontOverride:r,hiddenIds:i,scene:a})=>{let o=QP(a.elements.filter(e=>!e.isDeleted)),s=(0,A.use)(eF),c=r??s,l=(0,A.useId)().replaceAll(/[^\w-]/g,``),u=`rich-excalidraw-counter-invert-${l}`,d=new Map(o.filter(uI).map(e=>[e.id,e])),f=new Set(o.map(e=>e.frameId).filter(e=>!!e&&d.has(e))),p=e=>`rich-excalidraw-frame-${l}-${e.replaceAll(/[^\w-]/g,``)}`,m=`rich-excalidraw-shadow-${l}`,h=o.some(TN),g=pI(o),_=e=>`rich-excalidraw-label-${l}-${e.replaceAll(/[^\w-]/g,``)}`,v=e||f.size>0||h||g.size>0;return(0,j.jsx)($P,{value:e?{filterId:u}:null,children:(0,j.jsxs)(eF,{value:c,children:[v&&(0,j.jsxs)(`defs`,{children:[e&&(0,j.jsx)(lI,{id:u}),h&&(0,j.jsx)(aI,{dark:e,id:m}),[...f].map(e=>{let t=d.get(e);return(0,j.jsx)(`clipPath`,{id:p(e),children:(0,j.jsx)(`rect`,{height:t.height,width:t.width,x:t.x,y:t.y})},e)}),[...g].map(([e,{area:t,hole:n}])=>(0,j.jsxs)(`mask`,{height:t[3],id:_(e),maskUnits:`userSpaceOnUse`,width:t[2],x:t[0],y:t[1],children:[(0,j.jsx)(`rect`,{fill:`#fff`,height:t[3],width:t[2],x:t[0],y:t[1]}),(0,j.jsx)(`rect`,{fill:`#000`,height:n[3],width:n[2],x:n[0],y:n[1]})]},e))]}),o.map(e=>{if(i?.has(e.id))return null;let r=(0,j.jsx)(gI,{el:e,extra:t?.(e),files:n},e.id),a=g.has(e.id)?(0,j.jsx)(`g`,{mask:`url(#${_(e.id)})`,children:r},e.id):r,o=TN(e)?(0,j.jsx)(`g`,{filter:`url(#${m})`,children:a},e.id):a;return e.frameId&&f.has(e.frameId)?(0,j.jsx)(`g`,{clipPath:`url(#${p(e.frameId)})`,children:o},e.id):o})]})})});mI.displayName=`SceneContent`;var hI=({className:e,files:t,handFontOverride:n,scene:r,style:i,theme:a=`light`})=>{let o=sI(r.elements.filter(e=>!e.isDeleted)),s=a===`dark`;return(0,j.jsx)(`svg`,{className:e,preserveAspectRatio:`xMidYMid meet`,role:`img`,viewBox:`${o.minX} ${o.minY} ${o.width} ${o.height}`,xmlns:`http://www.w3.org/2000/svg`,style:{width:`100%`,height:`100%`,display:`block`,...s?{filter:cI}:null,...i},children:(0,j.jsx)(mI,{dark:s,files:t??r.files,handFontOverride:n,scene:r})})},gI=({el:e,extra:t,files:n})=>{let r=FM(e)*180/Math.PI,[i,a]=RM(e),o=`translate(${e.x} ${e.y}) rotate(${r} ${i-e.x} ${a-e.y})`;return(0,j.jsx)(`g`,{"data-cx":i,"data-cy":a,"data-id":e.id,"data-type":e.type,opacity:e.opacity==null?1:e.opacity/100,transform:o,...t,children:(0,j.jsx)(VF,{el:e,files:n})})};function _I(e,t,{insets:n={},maxZoom:r=30,minZoom:i=.1,padding:a=0,zoomFactor:o=1}={}){let s=n.left??0,c=n.top??0,l=Math.max(1,t.width-s-(n.right??0)),u=Math.max(1,t.height-c-(n.bottom??0)),[d,f,p,m]=e,h=Math.max(1,p-d),g=Math.max(1,m-f),_=Math.min((l-a*2)/h,(u-a*2)/g)*o,v=Math.min(r,Math.max(i,_));return{zoom:v,scrollX:(s+l/2)/v-(d+h/2),scrollY:(c+u/2)/v-(f+g/2)}}var vI=`hfbknr0`,yI=`hfbknr1`,bI=`hfbknr2`,xI=`hfbknr3`,SI=`hfbknr4`,CI=`hfbknr5`,wI=({onExpand:e,onFit:t,onZoomIn:n,onZoomOut:r,scale:i})=>(0,j.jsxs)(`div`,{className:bI,children:[(0,j.jsx)(`button`,{"aria-label":`Zoom out`,className:xI,title:`Zoom out (⌘/Ctrl + scroll)`,type:`button`,onClick:r,children:(0,j.jsx)($n,{})}),(0,j.jsxs)(`span`,{className:SI,children:[Math.round(i*100),`%`]}),(0,j.jsx)(`button`,{"aria-label":`Zoom in`,className:xI,title:`Zoom in (⌘/Ctrl + scroll)`,type:`button`,onClick:n,children:(0,j.jsx)(Zn,{})}),(0,j.jsx)(`span`,{"aria-hidden":!0,className:CI}),(0,j.jsx)(`button`,{"aria-label":`Fit to content`,className:xI,title:`Fit to content (double-click)`,type:`button`,onClick:t,children:(0,j.jsx)(zr,{})}),e&&(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(`span`,{"aria-hidden":!0,className:`hfbknr5`}),(0,j.jsx)(`button`,{"aria-label":`Fullscreen`,className:`hfbknr3`,title:`Fullscreen`,type:`button`,onClick:t=>e(t.currentTarget),children:(0,j.jsx)(er,{})})]})]}),TI=.05,EI=e=>({s:e.zoom,tx:e.scrollX*e.zoom,ty:e.scrollY*e.zoom}),DI=e=>({scrollX:e.tx/e.s,scrollY:e.ty/e.s,zoom:e.s}),OI=280,kI=e=>!!e&&e.length===4&&e.every(e=>typeof e==`number`);function AI(e,{bounds:t,elements:n,setTransform:r,sizeRef:i,transformRef:a,userInteractedRef:o}){let s=(0,A.useRef)(void 0);(0,A.useEffect)(()=>()=>{s.current!==void 0&&cancelAnimationFrame(s.current)},[]),(0,A.useImperativeHandle)(e,()=>({getViewport:()=>({...DI(a.current),width:i.current.w,height:i.current.h}),focus:(e,c={})=>{let{w:l,h:u}=i.current,d=null;if(kI(e))d=e;else if(e){let t=new Set(e),r=n.filter(e=>t.has(e.id));r.length>0&&(d=HM(r))}else n.length>0&&(d=[t.minX,t.minY,t.minX+t.width,t.minY+t.height]);if(!d||!l||!u)return!1;let f=EI(_I(d,{width:l,height:u},{...c,minZoom:TI,maxZoom:Math.min(c.maxZoom??16,16)}));if(o.current=!0,s.current!==void 0&&cancelAnimationFrame(s.current),s.current=void 0,!c.animate||typeof requestAnimationFrame!=`function`)return r(f),!0;let p=a.current,m=performance.now(),h=c.duration??OI,g=e=>{let t=Math.min(1,(e-m)/h),n=1-(1-t)**3,i=(e,t)=>e+(t-e)*n;r({s:i(p.s,f.s),tx:i(p.tx,f.tx),ty:i(p.ty,f.ty)}),s.current=t<1?requestAnimationFrame(g):void 0};return s.current=requestAnimationFrame(g),!0}}),[t,n,r,i,a,o])}function jI({containerRef:e,mode:t,setTransform:n,transformRef:r,userInteractedRef:i,wheelPan:a,zoomAt:o}){let[s,c]=(0,A.useState)(!1);(0,A.useEffect)(()=>{let t=e.current;if(!t)return;let r=e=>{if(!e.ctrlKey&&!e.metaKey){if(!a)return;e.preventDefault(),i.current=!0;let t=e.shiftKey&&!e.deltaX?e.deltaY:e.deltaX,r=e.shiftKey&&!e.deltaX?0:e.deltaY;n(e=>({s:e.s,tx:e.tx-t,ty:e.ty-r}));return}e.preventDefault();let r=t.getBoundingClientRect();o(e.deltaY>0?.9:1.1,e.clientX-r.left,e.clientY-r.top)};return t.addEventListener(`wheel`,r,{passive:!1}),()=>t.removeEventListener(`wheel`,r)},[e,n,i,a,o]);let l=(0,A.useRef)(new Map),u=(0,A.useRef)(null),d=(0,A.useRef)(null),f=e=>t!==`inline`||e.pointerType!==`touch`,p=()=>{let t=[...l.current.values()],n=e.current;if(t.length<2||!n)return;let i=n.getBoundingClientRect();d.current={distance:Math.hypot(t[0].x-t[1].x,t[0].y-t[1].y)||1,origScale:r.current.s,origTx:r.current.tx,origTy:r.current.ty,midX:(t[0].x+t[1].x)/2-i.left,midY:(t[0].y+t[1].y)/2-i.top}},m=e=>{!f(e)||e.pointerType===`mouse`&&e.button!==0||e.target.closest(`button`)||(e.currentTarget.setPointerCapture(e.pointerId),l.current.set(e.pointerId,{x:e.clientX,y:e.clientY}),l.current.size===1?(u.current={startX:e.clientX,startY:e.clientY,origTx:r.current.tx,origTy:r.current.ty},c(!0)):l.current.size===2&&(u.current=null,p()))},h=e=>{if(!l.current.has(e.pointerId))return;l.current.set(e.pointerId,{x:e.clientX,y:e.clientY});let t=d.current;if(t&&l.current.size===2){i.current=!0;let e=[...l.current.values()],r=(Math.hypot(e[0].x-e[1].x,e[0].y-e[1].y)||1)/t.distance,a=Math.max(TI,Math.min(16,t.origScale*r)),o=a/t.origScale;n({s:a,tx:t.midX-(t.midX-t.origTx)*o,ty:t.midY-(t.midY-t.origTy)*o});return}let r=u.current;r&&l.current.size===1&&(i.current=!0,n(t=>({s:t.s,tx:r.origTx+e.clientX-r.startX,ty:r.origTy+e.clientY-r.startY})))},g=e=>{l.current.delete(e.pointerId)&&(l.current.size<2&&(d.current=null),l.current.size===0&&(u.current=null,c(!1)),e.currentTarget.hasPointerCapture(e.pointerId)&&e.currentTarget.releasePointerCapture(e.pointerId))};return{panning:s,onPointerCancel:g,onPointerDown:m,onPointerMove:h,onPointerUp:g}}var MI=1.2,NI=({controls:e=!0,handFontOverride:t,initialViewport:n,mode:r=`inline`,onExpand:i,onViewportChange:a,preserveView:o=!1,ref:s,scene:c,theme:l=`light`,wheelPan:u=!1})=>{let d=(0,A.useRef)(null),[f,p]=(0,A.useState)({w:0,h:0}),[m,h]=(0,A.useState)(()=>n?EI(n):{s:1,tx:0,ty:0}),g=(0,A.useRef)(m),_=(0,A.useRef)(f),v=(0,A.useRef)(!!n),y=(0,A.useRef)(!!n),b=(0,A.useRef)(a);b.current=a;let x=(0,A.useMemo)(()=>c.elements.filter(e=>!e.isDeleted),[c]),S=(0,A.useMemo)(()=>sI(x),[x]);(0,A.useEffect)(()=>{g.current=m,_.current=f,f.w&&f.h&&b.current?.({...DI(m),width:f.w,height:f.h})},[m,f]),AI(s,{bounds:S,elements:x,setTransform:h,sizeRef:_,transformRef:g,userInteractedRef:y}),(0,A.useLayoutEffect)(()=>{let e=d.current;if(!e)return;let t=e.getBoundingClientRect();p({w:t.width,h:t.height});let n=new ResizeObserver(e=>{let t=e[0].contentRect;p({w:t.width,h:t.height})});return n.observe(e),()=>n.disconnect()},[]);let C=(0,A.useCallback)(()=>{if(!f.w||!f.h)return{s:1,tx:0,ty:0};let e=S.width||1,t=S.height||1,n=Math.max(TI,Math.min(16,Math.min((f.w-64)/e,(f.h-64)/t)));return{s:n,tx:f.w/2-(S.minX+e/2)*n,ty:f.h/2-(S.minY+t/2)*n}},[f,S]),w=(0,A.useCallback)(()=>{h(C()),y.current=!1},[C]);(0,A.useLayoutEffect)(()=>{y.current||f.w&&f.h&&(h(C()),o&&(y.current=!0))},[f,C,o]),(0,A.useEffect)(()=>{v.current||o||(y.current=!1)},[c,o]);let T=(0,A.useCallback)((e,t,n)=>{let r=g.current,i=Math.max(TI,Math.min(16,r.s*e)),a=i/r.s;a!==1&&(y.current=!0,h({s:i,tx:t-(t-r.tx)*a,ty:n-(n-r.ty)*a}))},[]),E=jI({containerRef:d,mode:r,setTransform:h,transformRef:g,userInteractedRef:y,wheelPan:u,zoomAt:T}),D=e=>{e.target.closest(`button`)||w()},ee=e=>T(e,f.w/2,f.h/2),te=l===`dark`,ne=`Whiteboard, ${x.length} elements`;return(0,j.jsxs)(`div`,{className:vI,"data-color-scheme":l,"data-mode":r,"data-panning":E.panning,ref:d,onDoubleClick:D,onPointerCancel:E.onPointerCancel,onPointerDown:E.onPointerDown,onPointerMove:E.onPointerMove,onPointerUp:E.onPointerUp,children:[(0,j.jsx)(`svg`,{"aria-label":ne,className:yI,preserveAspectRatio:`xMinYMin meet`,role:`img`,style:te?{filter:cI}:void 0,viewBox:`0 0 ${f.w||1} ${f.h||1}`,xmlns:`http://www.w3.org/2000/svg`,children:(0,j.jsx)(`g`,{transform:`translate(${m.tx} ${m.ty}) scale(${m.s})`,children:(0,j.jsx)(mI,{dark:te,files:c.files,handFontOverride:t,scene:c})})}),e&&(0,j.jsx)(wI,{scale:m.s,onExpand:i,onFit:w,onZoomIn:()=>ee(MI),onZoomOut:()=>ee(1/MI)})]})};function PI(e){let t=[{head:null,followers:[]}];for(let n of e)eP(n.index)?t.push({head:n,followers:[]}):t.at(-1).followers.push(n);let[n,...r]=t;return r.sort((e,t)=>{let n=e.head.index,r=t.head.index;return n===r?e.head.id<t.head.id?-1:1:n<r?-1:1}),[...n.followers,...r.flatMap(e=>[e.head,...e.followers])]}var FI=(e,t)=>{let n=e.version??0,r=t.version??0;return r===n?(t.versionNonce??0)<(e.versionNonce??0):r>n},II=new Set([`version`,`versionNonce`,`updated`]),LI=e=>JSON.stringify(Object.entries(e).filter(([e])=>!II.has(e))),RI=(e,t)=>e===t||LI(e)===LI(t);function zI(e,t,n=new Set){let r=new Map(e.map(e=>[e.id,e])),i=new Map,a=[];for(let e of t){let t=r.get(e.id);t&&n.has(e.id)?a.push(e):(!t||FI(t,e))&&i.set(e.id,e)}let o=[...i.values()];return o.length===0?{elements:[...e],accepted:o,deferred:a}:{elements:PI([...e.map(e=>i.get(e.id)??e),...o.filter(e=>!r.has(e.id))]),accepted:o,deferred:a}}var BI=e=>e.trim().replace(/^(['"])(.*)\1$/,`$2`),VI=(e,t)=>{let n=RegExp(`(?:^|[;{\\s])${t}\\s*:\\s*([^;}]+)`,`i`).exec(e);return n?n[1].trim():void 0};function HI(e,t){for(let n of e.split(`,`)){let e=/^u\+([\da-f?]+)(?:-([\da-f]+))?$/i.exec(n.trim());if(!e)continue;let r=Number.parseInt(e[1].replaceAll(`?`,`0`),16),i=Number.parseInt(e[2]??e[1].replaceAll(`?`,`f`),16);for(let e of t)if(e>=r&&e<=i)return!0}return!1}function UI(e){return e.split(`,`).map(e=>BI(e).toLowerCase())}function WI(e,t,n){let r=new Set;for(let e of n.text)r.add(e.codePointAt(0));let i=[];for(let[,a]of e.matchAll(/@font-face\s*\{([^}]*)\}/gi)){let e=BI(VI(a,`font-family`)??``);if(!n.families.has(e.toLowerCase()))continue;let o=VI(a,`unicode-range`);if(o&&!HI(o,r))continue;let s=/url\(([^)]*)\)(?:\s*format\(([^)]*)\))?/i.exec(a);if(!s)continue;let c;try{c=new URL(BI(s[1]),t).href}catch{continue}i.push({family:e,format:s[2]===void 0?void 0:BI(s[2]),style:VI(a,`font-style`),unicodeRange:o,url:c,weight:VI(a,`font-weight`)})}return i}async function GI(e){if(e.startsWith(`data:`))return e;let t=await fetch(e);if(!t.ok)throw Error(`${t.status} ${e}`);let n=await t.blob();return new Promise((e,t)=>{let r=new FileReader;r.onload=()=>e(r.result),r.onerror=()=>t(r.error),r.readAsDataURL(n)})}var KI=4;async function qI(e,t,n,r=0){let i={baseHref:t,cssText:e};return r>=KI?[i]:[...(await Promise.all([...e.matchAll(/@import\s+(?:url\(([^)]*)\)|(["'][^"']*["']))/gi)].map(async e=>{try{let i=new URL(BI(e[1]??e[2]),t).href;return await qI(await n(i),i,n,r+1)}catch{return[]}}))).flat(),i]}async function JI(e){let t=await fetch(e);if(!t.ok)throw Error(`${t.status} ${e}`);return t.text()}async function YI(){return(await Promise.all([...document.styleSheets].map(async e=>{let t=e.href??document.baseURI,n;try{n=[...e.cssRules].map(e=>e.cssText).filter(e=>e.startsWith(`@font-face`)||e.startsWith(`@import`)).join(`
22
+ `)}catch{if(!e.href)return[];try{n=await JI(e.href)}catch{return[]}}return qI(n,t,JI)}))).flat()}async function XI(e){if(typeof document>`u`||e.families.size===0)return``;let t=(await YI()).flatMap(t=>WI(t.cssText,t.baseHref,e));return(await Promise.all(t.map(async e=>{try{let t=await GI(e.url);return[`@font-face{font-family:"${e.family}";src:url("${t}")${e.format?` format("${e.format}")`:``}`,e.weight&&`font-weight:${e.weight}`,e.style&&`font-style:${e.style}`,e.unicodeRange&&`unicode-range:${e.unicodeRange}`].filter(Boolean).join(`;`).concat(`}`)}catch{return``}}))).join(``)}var ZI=16,QI=100;function $I(e,t){let n=new Set,r=``;for(let i of e)if(i.type===`text`){let e=t&&rN(i.fontFamily)?t:iN(i.fontFamily);for(let t of UI(e))n.add(t);r+=i.text}else if(i.type===`richtext`){for(let e of UI(QM))n.add(e);r+=bN(i.content?.root)}return{families:n,text:r}}async function eL(e){if(!e)return e;let t=await Promise.all(Object.entries(e).map(async([e,t])=>{if(!/^https?:/i.test(t.dataURL))return[e,t];try{return[e,{...t,dataURL:await GI(t.dataURL)}]}catch{return[e,t]}}));return Object.fromEntries(t)}async function tL(e,t={}){let{background:n=`#ffffff`,embedFonts:r=!0,handFontOverride:i}=t,a=t.padding??ZI,o=QP(e.elements.filter(e=>!e.isDeleted)),[s,c,l,u]=o.length>0?HM(o):[0,0,QI,QI],d=s-a,f=c-a,p=l-s+a*2,m=u-c+a*2,[h,g]=await Promise.all([r?XI($I(o,i)):``,eL(e.files)]),_=document.createElement(`div`),v=(0,fa.createRoot)(_);(0,ui.flushSync)(()=>{v.render((0,j.jsxs)(`svg`,{height:m,viewBox:`${d} ${f} ${p} ${m}`,width:p,xmlns:`http://www.w3.org/2000/svg`,children:[h&&(0,j.jsx)(`style`,{children:h}),n&&(0,j.jsx)(`rect`,{"data-export-background":``,fill:n,height:m,width:p,x:d,y:f}),(0,j.jsx)(tF,{value:!0,children:(0,j.jsx)(mI,{files:g,handFontOverride:i,scene:{elements:o,files:g}})})]}))});let y=new XMLSerializer().serializeToString(_.firstElementChild);return v.unmount(),{height:m,svg:y,width:p}}var nL=8192;function rL(e,t,n,r){let i=Math.max(e,t)*n;return i>r?n*r/i:n}function iL(e){return new Promise((t,n)=>{let r=new Image;r.onload=()=>t(r),r.onerror=()=>n(Error(`whiteboard export: the svg could not be rasterized`)),r.src=e})}async function aL(e,t={}){let{maxSize:n=nL,mimeType:r=`image/png`,quality:i,scale:a=1,...o}=t,{height:s,svg:c,width:l}=await tL(e,o),u=rL(l,s,a,n),d=URL.createObjectURL(new Blob([c],{type:`image/svg+xml;charset=utf-8`}));try{let e=await iL(d),t=document.createElement(`canvas`);t.width=Math.max(1,Math.round(l*u)),t.height=Math.max(1,Math.round(s*u));let n=t.getContext(`2d`);if(!n)throw Error(`whiteboard export: no 2d canvas context`);return n.drawImage(e,0,0,t.width,t.height),await new Promise((e,n)=>{t.toBlob(t=>t?e(t):n(Error(`whiteboard export: empty image`)),r,i)})}finally{URL.revokeObjectURL(d)}}tN(2,bS);var oL=()=>typeof window>`u`||!window.matchMedia?null:window.matchMedia(`(prefers-color-scheme: dark)`);function sL(){let[e,t]=(0,A.useState)(()=>oL()?.matches??!1);return(0,A.useEffect)(()=>{let e=oL();if(!e)return;let n=()=>t(e.matches);return e.addEventListener(`change`,n),()=>e.removeEventListener(`change`,n)},[]),e}var cL=new Set([`rectangle`,`ellipse`,`diamond`,`arrow`]),lL=new WeakMap;function uL(e){return cL.has(e.type)}function dL(e){return e.boundElements?.find(e=>e.type===`text`)?.id??null}function fL(e,t){return e.getState().elements.find(e=>e.id===t)}function pL(e,t){let n=new Map(t.map(e=>[e.id,e]));e.updateTransient(({elements:e})=>({elements:e.map(e=>n.get(e.id)??e)}))}function mL(e,t){let n=e.getState();if(e.beginTransient(),lL.delete(e),t.containerId){let r=fL(e,t.containerId);if(!r)return;let i=dL(r);if(i&&fL(e,i)){e.setState({editingTextId:i,selectedIds:new Set([r.id])});return}let a=jN({text:``,containerId:r.id,textAlign:`center`,verticalAlign:`middle`},n.currentStyle),o=EP(r,a),s=$(o.container,{boundElements:[...r.boundElements??[],{id:a.id,type:`text`}]});e.updateTransient(({elements:e})=>({elements:[...e.map(e=>e.id===r.id?s:e),o.text]})),lL.set(e,a.id),e.setState({editingTextId:a.id,selectedIds:new Set([r.id])});return}if(t.elementId){e.setState({editingTextId:t.elementId,selectedIds:new Set([t.elementId])});return}let r=t.at??[0,0],i=n.currentStyle,a=i.fontSize*GN(i.fontFamily),o=jN({text:``,x:r[0],y:r[1]-a/2,height:a},i);e.updateTransient(({elements:e})=>({elements:[...e,o]})),lL.set(e,o.id),e.setState({editingTextId:o.id,selectedIds:new Set([o.id])})}function hL(e,t){let n=e.getState().editingTextId,r=n?fL(e,n):void 0;if(!r)return;let i={...r,text:t,originalText:t},a=r.containerId?fL(e,r.containerId):void 0;if(a){let t=EP(a,i);pL(e,[t.text,t.container])}else pL(e,[DP(i)])}function gL(e){let t=e.getState().editingTextId;if(!t)return;let n=fL(e,t),r=lL.get(e)===t;if(lL.delete(e),e.setState({editingTextId:null}),!n){e.endTransient(!1);return}let i=!(n.originalText??n.text).trim();if(i&&r)e.endTransient(!1);else{if(i){let t=n.containerId?fL(e,n.containerId):void 0,r=[$(n,{isDeleted:!0})];t&&r.push($(t,{boundElements:(t.boundElements??[]).filter(e=>e.id!==n.id)})),pL(e,r),e.setState({selectedIds:new Set})}else r||pL(e,[$(fL(e,t)??n)]);e.endTransient(!0)}}function _L(e,t){let n=new Map(e.map(e=>[e.id,e])),r=new Map;for(let e of t){let t=n.get(e),i=t?dL(t):null,a=i?n.get(i):void 0;if(!t||!a||a.isDeleted)continue;let o=EP(t,a);r.set(a.id,$(a,o.text)),o.container!==t&&r.set(t.id,o.container)}return r.size===0?[...e]:e.map(e=>r.get(e.id)??e)}function vL(e,t){let n=new Map(e.map(e=>[e.id,e])),r=new Set,i=t.map(e=>{r.add(e.id);let t=n.get(e.id);return!t||t===e?e:{...e,version:Math.max(t.version??0,e.version??0)+1,versionNonce:lN(),updated:Date.now()}});for(let t of e)r.has(t.id)||i.push(t.isDeleted?t:$(t,{isDeleted:!0}));return i}function yL(e=100){let t=[],n=[];return{push(r){t.push(r),t.length>e&&(t=t.slice(-e)),n=[]},undo(e){let r=t.pop();return r?(n.push(e),r):null},redo(e){let r=n.pop();return r?(t.push(e),r):null},rewrite(e){t=t.map(e),n=n.map(e)},canUndo:()=>t.length>0,canRedo:()=>n.length>0,clear(){t=[],n=[]}}}var bL=`#ffffff`;function xL(e,t){let n=new Map(e.map(e=>[e.id,e]));return oP(t.map(e=>n.get(e.id)===e?e:FP(e)))}function SL(e){let t=new Set;for(let n of e)!n.isDeleted&&n.type===`image`&&n.fileId&&t.add(n.fileId);return t}function CL(e,t={}){let{sync:n=!1}=t,r=e??{},i=r.appState,a=r.files??{},o=Array.isArray(r.elements)?r.elements:[],s=QP(n?PI(o):o),c=i?.viewBackgroundColor??bL,l=i?.gridSize??null,u={elements:s,files:a,canvasSize:{width:0,height:0},selectedIds:new Set,selectedPointIndex:null,selectionBox:null,suggestedBindingId:null,editingGroupId:null,editingFrameId:null,editingLinearId:null,editingRichTextId:null,editingTextId:null,erasingIds:new Set,tool:`selection`,toolLocked:!1,currentStyle:aN,viewport:{scrollX:0,scrollY:0,zoom:1},gridSize:l,viewBackgroundColor:c},d=new Set,f=yL(),p=null,m=()=>{for(let e of d)e()},h=new Map,g=e=>{let t=h.get(e.id);if(t){FI(t.remote,e)&&h.set(e.id,{...t,remote:e});return}let n=p?.elements.find(t=>t.id===e.id)??u.elements.find(t=>t.id===e.id);n&&h.set(e.id,{baseline:n,remote:e})},_=()=>{let e=new Set;for(let t of[u.editingTextId,u.editingRichTextId,u.editingLinearId])t&&e.add(t);if(u.editingTextId){let t=u.elements.find(e=>e.id===u.editingTextId)?.containerId;t&&e.add(t)}if(p){let t=new Map(p.elements.map(e=>[e.id,e]));for(let n of u.elements)t.get(n.id)!==n&&e.add(n.id)}return e},v=e=>{let t=zI(u.elements,e,_());for(let e of t.deferred)g(e);if(t.accepted.length===0)return null;let n=QP(oP(t.elements)),r=new Set(t.accepted.map(e=>e.id)),i=n.filter(e=>r.has(e.id)),a=new Map(i.map(e=>[e.id,e])),o=e=>{let t=new Set(e.elements.map(e=>e.id));return{...e,elements:[...e.elements.map(e=>a.get(e.id)??e),...i.filter(e=>!t.has(e.id))]}};f.rewrite(o),p&&=o(p);let s=new Set(n.filter(e=>!e.isDeleted).map(e=>e.id));return{elements:n,selectedIds:new Set([...u.selectedIds].filter(e=>s.has(e)))}},y=()=>{if(h.size===0)return;let e=_(),t=[...h].filter(([t])=>!e.has(t));if(t.length===0)return;let n=new Map(u.elements.map(e=>[e.id,e])),r=new Map,i=[];for(let[e,{baseline:a,remote:o}]of t){h.delete(e);let t=n.get(e);!t||RI(t,a)?i.push(o):FI(t,o)&&r.set(e,$({...t,version:o.version}))}r.size>0&&(u={...u,elements:u.elements.map(e=>r.get(e.id)??e)});let a=i.length>0?v(i):null;a&&(u={...u,...a})},b=e=>{u={...u,...e},y(),m()},x=()=>({elements:u.elements,files:u.files}),S=e=>{let t=x(),n=e(t);if(!n)return null;let r=n.elements?QP(xL(t.elements,n.elements)):t.elements,i=n.files??t.files;return r===t.elements&&i===t.files?null:{elements:r,files:i}},C=e=>{let t=n?vL(u.elements,e.elements):e.elements,r=new Set(t.filter(e=>!e.isDeleted).map(e=>e.id));b({elements:t,files:e.files,selectedIds:new Set([...u.selectedIds].filter(e=>r.has(e))),editingTextId:null,editingFrameId:null,editingLinearId:null,selectedPointIndex:null,suggestedBindingId:null})};return{getState:()=>u,subscribe(e){return d.add(e),()=>d.delete(e)},setState:b,commit(e){if(p){let t=S(e);t&&b(t);return}let t=x(),n=S(e);n&&(f.push(t),b(n))},applyRemote(e){let t=e.elements?v(e.elements)??{}:{};if(e.files&&Object.keys(e.files).length>0){let n=e.files,r=e=>({...e,files:{...e.files,...n}});f.rewrite(r),p&&=r(p),t.files={...u.files,...n}}Object.keys(t).length>0&&b(t)},amend(e){f.rewrite(e),p&&=e(p);let t=S(t=>e(t));t&&b(t)},beginTransient(){p??=x()},updateTransient(e){let t=S(e);t&&b(t)},endTransient(e){let t=p;if(p=null,!t)return;let r=t.elements===u.elements&&t.files===u.files;if(!e){r||C(t);return}if(r||(f.push(t),!n))return;let i=new Map(t.elements.map(e=>[e.id,e]));b({elements:u.elements.map(e=>i.get(e.id)===e?e:$(e))})},isTransient:()=>p!==null,undo(){let e=f.undo(x());e&&C(e)},redo(){let e=f.redo(x());e&&C(e)},canUndo:f.canUndo,canRedo:f.canRedo,isDirty:()=>u.elements!==s||u.files!==a||u.viewBackgroundColor!==c||u.gridSize!==l,getScene(){let e={...r,elements:u.elements.filter(e=>!e.isDeleted)},t={};u.viewBackgroundColor!==c&&(t.viewBackgroundColor=u.viewBackgroundColor),u.gridSize!==l&&(t.gridSize=u.gridSize),(i||Object.keys(t).length>0)&&(e.appState={...i,...t});let n=SL(u.elements),o={...a};for(let[e,t]of Object.entries(u.files))!(e in a)&&n.has(e)&&(o[e]=t);return(`files`in r||Object.keys(o).length>0)&&(e.files=o),e}}}function wL(e,t){return(0,A.useSyncExternalStore)(e.subscribe,()=>t(e.getState()),()=>t(e.getState()))}function TL(e){return wL(e,e=>e.canvasSize.width>0&&e.canvasSize.width<640)}var EL=`_14kbw0v0`,DL=`_14kbw0v1`,OL=`_14kbw0v3`,kL=`_14kbw0v5`,AL=`_14kbw0v6`,jL=`_14kbw0v7`,ML=`_14kbw0v8`,NL=`_14kbw0v9`,PL=`_14kbw0va`,FL=`_14kbw0vb`,IL=`_14kbw0vc`,LL=`_14kbw0vd`,RL=`_14kbw0ve`,zL=`_14kbw0vf`,BL=`_14kbw0vg`,VL=`_14kbw0vi`,HL=`_14kbw0vj`,UL=`_14kbw0vk`,WL=`_14kbw0vl`,GL=`_14kbw0vn`,KL=`_14kbw0vo`,qL=`_14kbw0vp`,JL=[{tool:`hand`,icon:qn,key:`H`,label:`Hand`},{tool:`selection`,icon:In,key:`V`,label:`Select`},{tool:`rectangle`,icon:rr,key:`R`,label:`Rectangle`},{tool:`diamond`,icon:hr,key:`D`,label:`Diamond`},{tool:`ellipse`,icon:Fn,key:`O`,label:`Ellipse`},{tool:`arrow`,icon:Fr,key:`A`,label:`Arrow`},{tool:`line`,icon:Nn,key:`L`,label:`Line`},{tool:`freedraw`,icon:Lr,key:`P`,label:`Draw`},{tool:`text`,icon:On,key:`T`,label:`Text`},{tool:`card`,icon:Bn,key:`N`,label:`Card`},{tool:`image`,icon:Xn,key:`I`,label:`Image`},{tool:`frame`,icon:Kn,key:`F`,label:`Frame`},{tool:`eraser`,icon:zn,key:`E`,label:`Eraser`}],YL=({className:e,onToolSelect:t,showKeys:n=!0,store:r,tools:i})=>{let a=wL(r,e=>e.tool),o=wL(r,e=>e.toolLocked),s=o?jn:Qn;return(0,j.jsxs)(`div`,{className:`${DL}${e?` ${e}`:``}`,role:`toolbar`,children:[(0,j.jsx)(Pw,{icon:!0,"aria-label":o?`Unlock tool`:`Keep tool active`,"aria-pressed":o,className:OL,size:`lg`,variant:`ghost`,onClick:()=>r.setState({toolLocked:!o}),children:(0,j.jsx)(s,{size:16})}),(0,j.jsx)(`span`,{className:kL}),JL.filter(e=>!i||i.has(e.tool)).map(({tool:e,icon:i,key:o,label:s})=>(0,j.jsxs)(Pw,{icon:!0,"aria-label":`${s} (${o})`,"aria-pressed":a===e,className:OL,"data-tool":e,size:`lg`,title:`${s} — ${o}`,variant:`ghost`,onClick:()=>{t?.(e)!==!1&&r.setState({tool:e,selectedIds:e===`selection`?r.getState().selectedIds:new Set})},children:[(0,j.jsx)(i,{size:16}),n&&(0,j.jsx)(`span`,{className:`_14kbw0v4`,children:o})]},e))]})};function XL(e,t){if(!e)return null;let n=t.get(e.elementId);return n?{...e,elementId:n}:null}function ZL(e,t){let n=new Map(e.map(e=>[e.id,cN()])),r=new Map,i=e=>(r.has(e)||r.set(e,cN()),r.get(e));return{clones:e.map(e=>{let r={...e,id:n.get(e.id),x:e.x+t[0],y:e.y+t[1],seed:lN(),version:1,versionNonce:lN(),updated:Date.now(),index:null,groupIds:(e.groupIds??[]).map(i),boundElements:e.boundElements?.filter(e=>n.has(e.id)).map(e=>({...e,id:n.get(e.id)}))??null};if(e.type===`text`&&(r.containerId=e.containerId?n.get(e.containerId)??null:null),e.type===`arrow`||e.type===`line`){let t=e;r.startBinding=XL(t.startBinding,n),r.endBinding=XL(t.endBinding,n)}return r.frameId=e.frameId?n.get(e.frameId)??null:null,r}),idMap:n}}function QL(e){return e.type===`frame`||e.type===`magicframe`}var $L=e=>e.type===`text`?e.containerId??null:null,eR=(e,t)=>MM(VM(e),VM(t)),tR=(e,t)=>NM(VM(e),VM(t));function nR(e,t){return(e.frameId??null)===t?e:$(e,{frameId:t})}function rR(e){let t=new Map(e.map(e=>[e.id,e]));return e.map(e=>{let n=$L(e),r=n?t.get(n):void 0;return r?nR(e,r.frameId??null):e})}function iR(e,t){let n=e.find(e=>e.id===t);return!n||n.isDeleted?[...e]:rR(e.map(e=>e.id===t||e.isDeleted||QL(e)||$L(e)||e.frameId&&e.frameId!==t?e:e.frameId===t?nR(e,tR(n,e)?t:null):nR(e,eR(n,e)?t:null)))}function aR(e,t){let n=e.filter(e=>QL(e)&&!e.isDeleted);return rR(e.map(e=>{if(!t.has(e.id)||e.isDeleted||QL(e)||$L(e)||e.frameId&&t.has(e.frameId))return e;let r=e.frameId?n.find(t=>t.id===e.frameId):void 0;return r&&tR(r,e)?e:nR(e,n.findLast(t=>eR(t,e))?.id??null)}))}function oR(e,t){let n=aR(e,t);for(let r of e)t.has(r.id)&&QL(r)&&(n=iR(n,r.id));return n}function sR(e,t){let n=new Set(t),r=new Set(e.filter(e=>t.has(e.id)&&QL(e)).map(e=>e.id));if(r.size===0)return n;for(let t of e)!t.isDeleted&&t.frameId&&r.has(t.frameId)&&n.add(t.id);return n}var cR=e=>!e.isDeleted;function lR(e){return!e.isDeleted&&!e.locked}function uR(e){return e.type===`text`?e.containerId??null:null}function dR(e,t){return e.filter(e=>cR(e)&&e.groupIds?.includes(t)).map(e=>e.id)}function fR(e,t){let n=t.groupIds??[];if(n.length===0)return[t.id];let r=e.editingGroupId,i=r?n.indexOf(r):-1;if(i===0)return[t.id];let a=i>0?n[i-1]:n.at(-1);return dR(e.elements,a)}function pR(e,t,n){let r=new Map(e.map(e=>[e.id,e]));for(let i=e.length-1;i>=0;i--){let a=e[i];if(!lR(a)||!YM(a,t,n))continue;let o=uR(a),s=o?r.get(o):void 0;return s&&lR(s)?s:a}return null}function mR(e,t,n){let r=pR(e.elements,t,n);return r?{hitId:r.id,ids:fR(e,r)}:null}function hR(e,t){let n=new Set(t);for(let r of e){let e=uR(r);e&&t.has(e)&&cR(r)&&n.add(r.id)}return n}function gR(e,t){let n=e.elements.filter(e=>lR(e)&&!uR(e)),r=new Set(XM(n,t).map(e=>e.id)),i=new Set;for(let t of r){let n=fR(e,e.elements.find(e=>e.id===t));if(n.every(e=>r.has(e)))for(let e of n)i.add(e)}return i}function _R(e){return e.elements.filter(t=>cR(t)&&e.selectedIds.has(t.id))}var vR=10;function yR(e){let t=e.getState();return hR(t.elements,t.selectedIds)}function bR(e,t){let n=yR(e);n.size!==0&&e.commit(({elements:e})=>{let r=t([...e],n);if(!r.every((t,n)=>t===e[n]))return{elements:r.map(e=>n.has(e.id)?$(e,{index:null}):e)}})}var xR=e=>bR(e,(e,t)=>[...e.filter(e=>!t.has(e.id)),...e.filter(e=>t.has(e.id))]),SR=e=>bR(e,(e,t)=>[...e.filter(e=>t.has(e.id)),...e.filter(e=>!t.has(e.id))]),CR=e=>bR(e,(e,t)=>{for(let n=e.length-2;n>=0;n--)t.has(e[n].id)&&!t.has(e[n+1].id)&&([e[n],e[n+1]]=[e[n+1],e[n]]);return e}),wR=e=>bR(e,(e,t)=>{for(let n=1;n<e.length;n++)t.has(e[n].id)&&!t.has(e[n-1].id)&&([e[n],e[n-1]]=[e[n-1],e[n]]);return e});function TR(e){let t=yR(e);if(_R(e.getState()).length<2)return;let n=cN();e.commit(({elements:e})=>({elements:e.map(e=>t.has(e.id)?$(e,{groupIds:[...e.groupIds??[],n]}):e)}))}function ER(e){let t=yR(e),n=new Set(_R(e.getState()).map(e=>e.groupIds?.at(-1)).filter(e=>!!e));n.size!==0&&(e.commit(({elements:e})=>({elements:e.map(e=>t.has(e.id)&&e.groupIds?.some(e=>n.has(e))?$(e,{groupIds:e.groupIds.filter(e=>!n.has(e))}):e)})),e.setState({editingGroupId:null}))}function DR(e){let t=e.getState(),n=yR(e);if(n.size===0)return;let{clones:r,idMap:i}=ZL(t.elements.filter(e=>n.has(e.id)&&!e.isDeleted),[vR,vR]);e.commit(({elements:e})=>({elements:oR([...e,...r],new Set(r.map(e=>e.id)))})),e.setState({selectedIds:new Set([...t.selectedIds].map(e=>i.get(e)).filter(e=>!!e))})}function OR(e,t){return e.map(e=>{if(t.has(e.id))return $(e,{isDeleted:!0});let n={};if(e.boundElements?.some(e=>t.has(e.id))&&(n.boundElements=e.boundElements.filter(e=>!t.has(e.id))),e.type===`arrow`||e.type===`line`){let r=e;r.startBinding&&t.has(r.startBinding.elementId)&&(n.startBinding=null),r.endBinding&&t.has(r.endBinding.elementId)&&(n.endBinding=null)}return e.frameId&&t.has(e.frameId)&&(n.frameId=null),Object.keys(n).length>0?$(e,n):e})}function kR(e){let t=yR(e);t.size!==0&&(e.commit(({elements:e})=>({elements:OR(e,t)})),e.setState({selectedIds:new Set,selectedPointIndex:null}))}function AR(e){let t=e.getState();e.setState({selectedIds:new Set(t.elements.filter(e=>!e.isDeleted&&!e.locked&&!(e.type===`text`&&e.containerId)).map(e=>e.id)),editingGroupId:null})}var jR=`excalidraw/clipboard`;function MR(e,t){let n={};for(let r of e)r.type===`image`&&r.fileId&&t[r.fileId]&&(n[r.fileId]=t[r.fileId]);return JSON.stringify({type:jR,elements:e,files:n})}function NR(e){let t=e.trim();if(!t)return null;if(t.startsWith(`{`))try{let e=JSON.parse(t);return(e.type===`excalidraw/clipboard`||e.type===`excalidraw`)&&Array.isArray(e.elements)?{elements:e.elements.filter(e=>!e.isDeleted),files:e.files??{}}:null}catch{return{text:e}}return{text:e}}var PR=200,FR=e=>new Promise((t,n)=>{let r=new Image;r.addEventListener(`load`,()=>t({width:r.naturalWidth,height:r.naturalHeight})),r.addEventListener(`error`,n),r.src=e});function IR(e,t,n=600){let r=Math.min(1,n/Math.max(e,t));return{width:Math.round(e*r),height:Math.round(t*r)}}function LR(e){return new Promise((t,n)=>{let r=new FileReader;r.addEventListener(`load`,()=>t(String(r.result))),r.addEventListener(`error`,()=>n(r.error)),r.readAsDataURL(e)})}async function RR(e,t,n,r={}){let i=await LR(t),a=await FR(i).catch(()=>null),{width:o,height:s}=IR(a?.width||PR,a?.height||PR),c=cN(),l=MN({x:n[0]-o/2,y:n[1]-s/2,width:o,height:s,fileId:c,status:`pending`},e.getState().currentStyle),u={id:c,mimeType:t.type||`image/png`,created:Date.now(),dataURL:i};e.commit(({elements:e,files:t})=>({elements:[...e,l],files:{...t,[c]:u}}));let{toolLocked:d,tool:f}=e.getState();e.setState({selectedIds:new Set([l.id]),tool:d?f:`selection`});let p=i;if(r.uploadFile)try{p=await r.uploadFile(t)}catch(e){r.onUploadError?.(e)}return e.amend(e=>{if(!e.elements.some(e=>e.id===l.id))return e;let t=e.files[c];return{elements:e.elements.map(e=>e.id===l.id?$(e,{status:`saved`}):e),files:t?{...e.files,[c]:{...t,dataURL:p}}:e.files}}),l.id}function zR(e){let t=e.getState(),n=hR(t.elements,t.selectedIds);return MR(t.elements.filter(e=>n.has(e.id)&&!e.isDeleted),t.files)}function BR(e){let t=zR(e);return kR(e),t}var VR=200;function HR(e,t,n){let r=t.trim(),i=mP(r)??{width:VR,height:VR},a=Math.min(1,600/Math.max(i.width,i.height)),o=i.width*a,s=i.height*a,c=PN({svg:r,width:o,height:s,x:n[0]-o/2,y:n[1]-s/2},e.getState().currentStyle);e.commit(({elements:e})=>({elements:oR([...e,c],new Set([c.id]))})),e.setState({selectedIds:new Set([c.id]),editingGroupId:null})}function UR(e,t,n){if(lP(t))return HR(e,t,n),!0;let r=NR(t);if(!r)return!1;let i=e.getState().currentStyle;if(`text`in r){let t=i.fontSize*GN(i.fontFamily),a=DP(jN({text:r.text,x:n[0],y:n[1]-t/2},i));return e.commit(({elements:e})=>({elements:[...e,a]})),e.setState({selectedIds:new Set([a.id])}),!0}if(r.elements.length===0)return!1;let[a,o,s,c]=HM(r.elements),l=[n[0]-(a+s)/2,n[1]-(o+c)/2],{clones:u}=ZL(r.elements,l);return e.commit(({elements:e,files:t})=>({elements:oR([...e,...u],new Set(u.map(e=>e.id))),files:{...t,...r.files}})),e.setState({selectedIds:new Set(u.filter(e=>!(e.type===`text`&&e.containerId)).map(e=>e.id)),editingGroupId:null}),!0}var WR=e=>`type`in e&&e.type===`separator`,GR={type:`separator`},KR=``;function qR(e){KR=e,typeof navigator<`u`&&navigator.clipboard&&navigator.clipboard.writeText(e).catch(()=>{})}async function JR(){try{return await navigator.clipboard.readText()||KR}catch{return KR}}function YR(e,t){let n=e.getState(),r=mR(n,t,6/n.viewport.zoom);r?r.ids.every(e=>n.selectedIds.has(e))||e.setState({selectedIds:new Set(r.ids)}):n.selectedIds.size>0&&e.setState({selectedIds:new Set})}function XR(e,t){let n=(t,n,r)=>({key:t,label:n,onSelect:()=>r(e)}),r=[];return t.length>1&&r.push(n(`group`,`Group`,TR)),t.some(e=>(e.groupIds?.length??0)>0)&&r.push(n(`ungroup`,`Ungroup`,ER)),[n(`copy`,`Copy`,e=>qR(zR(e))),n(`cut`,`Cut`,e=>qR(BR(e))),n(`duplicate`,`Duplicate`,DR),GR,n(`bring-forward`,`Bring forward`,CR),n(`send-backward`,`Send backward`,wR),n(`bring-to-front`,`Bring to front`,xR),n(`send-to-back`,`Send to back`,SR),...r.length>0?[GR,...r]:[],GR,{...n(`delete`,`Delete`,kR),danger:!0}]}function ZR(e,t){return[{key:`paste`,label:`Paste`,onSelect:()=>{JR().then(n=>{n&&UR(e,n,t)})}},{key:`select-all`,label:`Select all`,onSelect:()=>AR(e)}]}function QR(e,t,n){YR(e,t);let r=_R(e.getState()),i=r.length>0?XR(e,r):ZR(e,t),a=n?.({scenePoint:t,selected:r})??[];return a.length>0?[...i,GR,...a]:i}var $R=`_17gtqeu0`,ez=`_17gtqeu1`,tz=`_17gtqeu2`,nz=`var(--rc-accent)`,rz=.1;function iz(e){return Math.min(30,Math.max(rz,e))}function az([e,t],n){return[e/n.zoom-n.scrollX,t/n.zoom-n.scrollY]}function oz([e,t],n){return[(e+n.scrollX)*n.zoom,(t+n.scrollY)*n.zoom]}function sz(e,t,n){let r=iz(n),[i,a]=az(t,e);return{zoom:r,scrollX:t[0]/r-i,scrollY:t[1]/r-a}}function cz(e,t,n=48){let[r,i,a,o]=e,s=Math.max(1,a-r),c=Math.max(1,o-i),l=iz(Math.min(1,(t.width-n*2)/s,(t.height-n*2)/c));return{zoom:l,scrollX:t.width/2/l-(r+s/2),scrollY:t.height/2/l-(i+c/2)}}var lz=(e,t)=>[(e[0]+t[0])/2,(e[1]+t[1])/2];function uz(){let e=new Map,t=null,n=!1;return{down(r,i,a){if(e.set(r,i),t||n)return`ignored`;if(e.size<2)return`single`;let[o,s]=[...e.keys()].slice(-2),c=e.get(o),l=e.get(s);return t={ids:[o,s],distance:Math.max(Math.hypot(l[0]-c[0],l[1]-c[1]),1),zoom:a.zoom,anchor:az(lz(c,l),a)},`pinch`},move(n,r){if(!e.has(n)||(e.set(n,r),!t))return null;let i=e.get(t.ids[0]),a=e.get(t.ids[1]),o=iz(t.zoom*Math.hypot(a[0]-i[0],a[1]-i[1])/t.distance),[s,c]=lz(i,a);return{zoom:o,scrollX:s/o-t.anchor[0],scrollY:c/o-t.anchor[1]}},up(r){e.delete(r),t&&(t=null,n=!0),e.size===0&&(n=!1)},isActive:()=>t!==null||n}}var dz=`_1yp4ot60`,fz=`_1yp4ot61`,pz=`_1yp4ot62`,mz=`_1yp4ot63`,hz=`_1yp4ot64`,gz=`_1yp4ot65`,_z=`_1yp4ot66`,vz=`_1yp4ot67`,yz=`_1yp4ot68`,bz=`_1yp4ot69`,xz=`_1yp4ot6a`,Sz=`_1yp4ot6b`,Cz=`_1yp4ot6c`,wz=`_1yp4ot6d`,Tz=`_1yp4ot6e`,Ez=`_1yp4ot6f`,Dz=new Set([`rectangle`,`diamond`,`ellipse`,`image`,`svg`,`richtext`,`text`,`embeddable`,`iframe`]);function Oz(e){return e.isDeleted||!Dz.has(e.type)?!1:!(e.type===`text`&&e.containerId)}var kz=60,Az=[[1,0],[0,1],[-1,0],[0,-1]],jz=([e,t])=>Az.findIndex(n=>n[0]===e&&n[1]===t),Mz=(e,t)=>e[0]===t[0]&&e[1]===t[1];function Nz(e,t){let[n,r,i,a]=VM(e),o=(t[0]-(n+i)/2)/Math.max((i-n)/2,1e-9),s=(t[1]-(r+a)/2)/Math.max((a-r)/2,1e-9);return Math.abs(o)>=Math.abs(s)?o<0?[-1,0]:[1,0]:s<0?[0,-1]:[0,1]}function Pz(e,t){let n=t[0]-e[0],r=t[1]-e[1];return Math.abs(n)>=Math.abs(r)?n<0?[-1,0]:[1,0]:r<0?[0,-1]:[0,1]}var Fz=([e,t,n,r],i)=>[e-i,t-i,n+i,r+i],Iz=([e,t],[n,r,i,a])=>e>n&&e<i&&t>r&&t<a;function Lz(e,t,[n,r,i,a]){let o=Math.min(e[0],t[0]),s=Math.max(e[0],t[0]),c=Math.min(e[1],t[1]),l=Math.max(e[1],t[1]);return o===s?o>n&&o<i&&l>r&&c<a:c===l?c>r&&c<a&&s>n&&o<i:s>n&&o<i&&l>r&&c<a}function Rz(e,t,n){if(!n)return e;let[r,i,a,o]=Fz(VM(n),20);return t[0]>0?[Math.max(a,e[0]),e[1]]:t[0]<0?[Math.min(r,e[0]),e[1]]:t[1]>0?[e[0],Math.max(o,e[1])]:[e[0],Math.min(i,e[1])]}var zz=class{constructor(){jP(this,`items`,[]),jP(this,`seq`,0)}get size(){return this.items.length}push(e,t){let n={f:t,key:e,seq:this.seq++},{items:r}=this;r.push(n);let i=r.length-1;for(;i>0;){let e=i-1>>1;if(!this.less(r[i],r[e]))break;[r[i],r[e]]=[r[e],r[i]],i=e}}pop(){let{items:e}=this,t=e[0],n=e.pop();if(e.length>0){e[0]=n;let t=0;for(;;){let n=t*2+1,r=n+1,i=t;if(n<e.length&&this.less(e[n],e[i])&&(i=n),r<e.length&&this.less(e[r],e[i])&&(i=r),i===t)break;[e[t],e[i]]=[e[i],e[t]],t=i}}return t.key}less(e,t){return e.f<t.f||e.f===t.f&&e.seq<t.seq}},Bz=e=>[...new Set(e)].sort((e,t)=>e-t);function Vz(e,t,n,r,i){let a=Bz([e[0],t[0],(e[0]+t[0])/2,...i.flatMap(e=>[e[0],e[2]])]),o=Bz([e[1],t[1],(e[1]+t[1])/2,...i.flatMap(e=>[e[1],e[3]])]),s=a.length,c=e=>[a[e%s],o[Math.floor(e/s)]],l=([e,t])=>o.indexOf(t)*s+a.indexOf(e),u=n=>n!==e&&n!==t&&i.some(e=>Iz(n,e)),d=(e,t)=>i.some(n=>!Iz(e,n)&&!Iz(t,n)&&Lz(e,t,n)),f=l(e),p=l(t),m=new Map,h=new Map,g=new zz,_=e=>Math.abs(e[0]-t[0])+Math.abs(e[1]-t[1]),v=f*4+n;m.set(v,0),g.push(v,_(e));let y=null;for(;g.size>0;){let n=g.pop(),i=m.get(n);if(y&&i>=y.cost)break;let a=Math.floor(n/4),l=n%4,v=a===f?e:a===p?t:c(a);if(a===p){let e=i+(l===r?0:kz*1.5);(!y||e<y.cost)&&(y={cost:e,key:n});continue}let b=a%s,x=Math.floor(a/s);for(let e=0;e<4;e++){if((e+2)%4===l)continue;let r=b+Az[e][0],a=x+Az[e][1];if(r<0||a<0||r>=s||a>=o.length)continue;let f=a*s+r,y=f===p?t:c(f);if(u(y)||d(v,y))continue;let S=f*4+e,C=i+Math.abs(y[0]-v[0])+Math.abs(y[1]-v[1])+(e===l?0:kz);C>=(m.get(S)??1/0)||(m.set(S,C),h.set(S,n),g.push(S,C+_(y)))}}if(!y)return null;let b=[],x=y.key;for(;x!==void 0;){let n=Math.floor(x/4);b.push(n===f?e:n===p?t:c(n)),x=h.get(x)}return b.reverse()}function Hz(e,t=new Set){let n=[];for(let t of e)n.length>0&&Mz(n.at(-1),t)||n.push(t);for(let e=n.length-2;e>0;e--){let[r,i,a]=[n[e-1],n[e],n[e+1]];(r[0]===i[0]&&i[0]===a[0]||r[1]===i[1]&&i[1]===a[1])&&!t.has(`${i[0]},${i[1]}`)&&n.splice(e,1)}return n}function Uz(e,t,n){let r=n.startHeading??(n.startTarget?Nz(n.startTarget,t):Pz(e,t)),i=n.endHeading??(n.endTarget?Nz(n.endTarget,e):Pz(t,e)),a=Rz(e,r,n.startTarget),o=Rz(t,i,n.endTarget),s=[n.startTarget,n.endTarget].filter(e=>!!e).map(e=>VM(e)),c=[...n.obstacles,...s].map(e=>Fz(e,20)),l=Vz(a,o,jz(r),(jz(i)+2)%4,c);if(!l){let n=(a[0]+o[0])/2;return Hz([e,a,[n,a[1]],[n,o[1]],o,t])}return Hz([e,...l,t])}function Wz(e,t,n){let[r,i,a,o]=VM(e),s=(r+a)/2,c=(i+o)/2;return t[0]>0?[a+n,c]:t[0]<0?[r-n,c]:t[1]>0?[s,o+n]:[s,i-n]}var Gz=e=>{let[t,n,r,i]=VM(e);return[(t+r)/2,(n+i)/2]};function Kz(e,t){return e.filter(e=>e.id!==t&&Oz(e)).map(e=>VM(e))}function qz(e,t){let n=t?e.get(t):void 0;return n&&!n.isDeleted?n:null}function Jz(e,t){let n=new Map(t.map(e=>[e.id,e])),r=zM(e);if(r.length<2)return e;let i=qz(n,e.startBinding?.elementId),a=qz(n,e.endBinding?.elementId),o=[...e.fixedSegments??[]].sort((e,t)=>e.index-t.index).map(t=>({start:[e.x+t.start[0],e.y+t.start[1]],end:[e.x+t.end[0],e.y+t.end[1]]})).filter(e=>!Mz(e.start,e.end)),s=o[0]?.start??(a?Gz(a):r.at(-1)),c=o.at(-1)?.end??(i?Gz(i):r[0]),l=r[0],u;i&&(u=Nz(i,s),l=Wz(i,u,e.startBinding?.gap??4));let d=r.at(-1),f;a&&(f=Nz(a,c),d=Wz(a,f,e.endBinding?.gap??4));let p=Kz(t,e.id),m=[],h=l,g=u,_=i;for(let e of o){let t=Pz(e.start,e.end);m.push(...Uz(h,e.start,{obstacles:p,startTarget:_,startHeading:g,endHeading:[-t[0],-t[1]]})),h=e.end,g=t,_=null}m.push(...Uz(h,d,{obstacles:p,startTarget:_,startHeading:g,endTarget:a,endHeading:f}));let v=Hz(m,new Set(o.flatMap(e=>[e.start,e.end]).map(e=>`${e[0]},${e[1]}`))),[y,b]=v[0],x=v.map(([e,t])=>[e-y,t-b]);if(y===e.x&&b===e.y&&x.length===e.points.length&&x.every((t,n)=>Mz(t,e.points[n]))&&FM(e)===0)return e;let S=[];for(let e of o){let t=v.findIndex((t,n)=>n>0&&Mz(v[n-1],e.start)&&Mz(t,e.end));t>0&&S.push({index:t,start:[e.start[0]-y,e.start[1]-b],end:[e.end[0]-y,e.end[1]-b]})}let[C,w,T,E]=jM(x);return $(e,{x:y,y:b,angle:0,points:x,width:T-C,height:E-w,fixedSegments:e.fixedSegments?S:e.fixedSegments})}function Yz(e,t){let n=FM(e),r=RM(e),i=t.map(e=>OM(e,r,-n)),[a,o,s,c]=jM(i),l=[(a+s)/2,(o+c)/2],u=[l[0]-r[0],l[1]-r[1]],d=OM(u,[0,0],n),f=[d[0]-u[0],d[1]-u[1]],p=i.map(([e,t])=>[e+f[0],t+f[1]]),[m,h]=p[0],g=p.map(([e,t])=>[e-m,t-h]);return{...e,x:m,y:h,points:g,width:s-a,height:c-o}}function Xz(e,t,n){let r=zM(e);return r[t]=n,$(e,Yz(e,r))}var Zz=e=>e===`start`?`startBinding`:`endBinding`;function Qz(e,[t,n]){return OM([e.x+t,e.y+n],RM(e),FM(e))}function $z(e){let{width:t,height:n}=e,r=e.type===`diamond`?[[t/2,0],[t,n/2],[t/2,n],[0,n/2]]:[[0,0],[t,0],[t,n],[0,n]];return r.map((e,t)=>[e,r[(t+1)%r.length]])}function eB(e,t){let[n,r]=UM(e,t),{width:i,height:a}=e;if(e.type===`ellipse`){let e=i/2,t=a/2;if(e<=0||t<=0)return 1/0;let o=Math.hypot((n-e)/e,(r-t)/t);return o<=1?0:(o-1)*Math.min(e,t)}return e.type===`diamond`?i>0&&a>0&&Math.abs(n-i/2)/(i/2)+Math.abs(r-a/2)/(a/2)<=1?0:Math.min(...$z(e).map(([e,t])=>AM([n,r],e,t))):Math.hypot(Math.max(-n,0,n-i),Math.max(-r,0,r-a))}function tB(e,t,n,r=new Set){let i=15/n;for(let n=e.length-1;n>=0;n--){let a=e[n];if(!r.has(a.id)&&Oz(a)&&eB(a,t)<=i)return a}return null}function nB(e,t,n,r){let i=[r[0]-n[0],r[1]-n[1]],a=t[0]*i[1]-t[1]*i[0];if(Math.abs(a)<1e-12)return null;let o=n[0]-e[0],s=n[1]-e[1],c=(o*i[1]-s*i[0])/a,l=(o*t[1]-s*t[0])/a;return l>=0&&l<=1?c:null}function rB(e,t,n){if(e.type!==`ellipse`)return $z(e).map(([e,r])=>nB(t,n,e,r)).filter(e=>e!==null);let r=e.width/2,i=e.height/2;if(r<=0||i<=0)return[];let a=(t[0]-r)/r,o=(t[1]-i)/i,s=n[0]/r,c=n[1]/i,l=s*s+c*c,u=2*(a*s+o*c),d=a*a+o*o-1,f=u*u-4*l*d;if(f<0||l===0)return[];let p=Math.sqrt(f);return[(-u-p)/(2*l),(-u+p)/(2*l)]}function iB(e,[t,n]){let r=e.width/2,i=e.height/2;return e.type===`ellipse`?Math.hypot(r*t,i*n):e.type===`diamond`?Math.max(Math.abs(r*t),Math.abs(i*n)):Math.abs(r*t)+Math.abs(i*n)}function aB(e,t){let n=[e.width/2,e.height/2],r=UM(e,t),i=Math.hypot(n[0]-r[0],n[1]-r[1]);if(i<1e-9)return null;let a=[(n[0]-r[0])/i,(n[1]-r[1])/i],o=[-a[1],a[0]];return{c:n,o:r,u:a,n:o,len:i,half:iB(e,o)}}var oB=(e,t,n)=>Math.min(n,Math.max(t,e));function sB(e,t,n){let r=aB(e,t);if(!r||r.half===0)return 0;let i=UM(e,n),a=[i[0]-r.o[0],i[1]-r.o[1]],o=a[0]*r.u[0]+a[1]*r.u[1];return o<1e-9?0:oB(r.len/o*(a[0]*r.n[0]+a[1]*r.n[1])/r.half,-1,1)}function cB(e,t,n,r){let i=aB(e,r);if(!i)return RM(e);let a=oB(t,-1,1)*i.half,o=[i.c[0]+i.n[0]*a,i.c[1]+i.n[1]*a],s=Math.hypot(o[0]-i.o[0],o[1]-i.o[1]);if(s<1e-9)return Qz(e,o);let c=[(o[0]-i.o[0])/s,(o[1]-i.o[1])/s],l=rB(e,i.o,c).filter(e=>e>1e-9);if(l.length===0)return Qz(e,o);let u=Math.max(0,Math.min(...l)-n);return Qz(e,[i.o[0]+c[0]*u,i.o[1]+c[1]*u])}function lB(e,t,n,r){let i=e.boundElements??[];return i.some(e=>e.id===t)===r?e:$(e,{boundElements:r?[...i,{id:t,type:n}]:i.filter(e=>e.id!==t)})}function uB(e,t){let n=e.points.length-1;return t===`start`?[0,Math.min(1,n)]:[n,Math.max(0,n-1)]}function dB(e,t,n){let r=e.find(e=>e.id===t),i=r?.[Zz(n)];if(!r||!i)return[...e];let a=r[Zz(n===`start`?`end`:`start`)]?.elementId===i.elementId,o=$(r,{[Zz(n)]:null});return e.map(e=>e.id===t?o:e.id===i.elementId&&!a?lB(e,t,r.type,!1):e)}function fB(e,t,n,r){let i=dB(e,t,n),a=i.find(e=>e.id===t),o=i.find(e=>e.id===r);if(!a||!o||a.points.length<2)return i;let s=zM(a),[c,l]=uB(a,n),u=sB(o,s[l],s[c]),d={elementId:r,focus:u,gap:4},f={...Xz(a,c,cB(o,u,4,s[l])),[Zz(n)]:d};return i=i.map(e=>e.id===t?f:e.id===r?lB(e,t,a.type,!0):e),i}var pB=(e,t)=>typeof e==`number`&&Number.isFinite(e)?e:t;function mB(e,t,n){let r=t.fixedPoint;return Array.isArray(r)&&r.length===2&&r.every(Number.isFinite)?Qz(e,[r[0]*e.width,r[1]*e.height]):cB(e,pB(t.focus,0),pB(t.gap,4),n)}function hB(e,t,n){let r=zM(e),i=!1;for(let a of n){let n=e[Zz(a)],o=n&&t.get(n.elementId);if(!n||!o||o.isDeleted)continue;let[s,c]=uB(e,a),l=mB(o,n,r[c]);l.every(Number.isFinite)&&(r[s]=l,i=!0)}return i?$(e,Yz(e,r)):e}function gB(e,t){let n=new Map(e.map(e=>[e.id,e]));return e.map(r=>{if(t.has(r.id)||r.type!==`arrow`&&r.type!==`line`)return r;let i=r,a=[`start`,`end`].filter(e=>{let n=i[Zz(e)];return!!n&&t.has(n.elementId)});return a.length===0?r:i.elbowed?Jz(i,e):hB(i,n,a)})}function _B(e,t){let n=[...e];for(let r of e)if(!(!t.has(r.id)||r.type!==`arrow`&&r.type!==`line`))for(let e of[`start`,`end`]){let i=r[Zz(e)];i&&!t.has(i.elementId)&&(n=dB(n,r.id,e))}return n}function vB(e,t){let n=_B(e,t),r=gB(n,t),i=new Set(r.filter((e,t)=>e!==n[t]).map(e=>e.id));return i.size>0?_L(r,i):r}function yB(e,t){let n=new Set([t]);for(let r of e)r.type===`text`&&r.containerId===t&&n.add(r.id);return n}function bB(e,t,n,r){return tB(e,n,r,yB(e,t))}function xB(e,t,n,r){let i=[...e];for(let e of n){let n=i.find(e=>e.id===t);if(!n||n.type!==`arrow`)return i;let a=zM(n),o=e===`start`?a[0]:a.at(-1),s=bB(i,t,o,r);i=s?fB(i,t,e,s.id):dB(i,t,e)}return _L(SB(i,t),new Set([t]))}function SB(e,t){return e.map(n=>n.id===t&&n.elbowed?Jz(n,e):n)}function CB(e,t){let n=e.getState().elements.find(e=>e.id===t);!n||n.type!==`richtext`||n.isDeleted||n.locked||e.setState({editingRichTextId:t,selectedIds:new Set([t]),editingGroupId:null})}function wB(e){e.getState().editingRichTextId&&e.setState({editingRichTextId:null})}function TB(e,t,n){e.commit(({elements:e})=>({elements:vB(QP(e.map(e=>e.id===t&&e.type===`richtext`?$(e,{content:n}):e)),new Set([t]))}))}function EB(e,t){let[n]=QP([NN({x:t[0]-100,y:t[1]-60,width:200,height:120})]);return e.commit(({elements:e})=>({elements:[...e,n]})),e.setState({tool:`selection`}),CB(e,n.id),n.id}function DB(e,t){e.setState({tool:t,selectedIds:t===`selection`?e.getState().selectedIds:new Set})}function OB(e,t){let{gridSize:n}=e.getState();return n&&n>0&&!t.ctrlKey?n:null}var kB=(e,t)=>t?Math.round(e/t)*t:e,AB=([e,t],n)=>n?[kB(e,n),kB(t,n)]:[e,t];function jB(e,t){e.updateTransient(({elements:e})=>({elements:e.map(e=>e.id===t.id?t:e)}))}function MB(e,t){e.updateTransient(({elements:e})=>({elements:[...e,t]}))}function NB(e,t,n=!0){e.updateTransient(({elements:e})=>({elements:oR(e,new Set([t]))})),e.endTransient(!0);let r=e.getState();e.setState({selectedIds:n?new Set([t]):r.selectedIds,tool:r.toolLocked?r.tool:`selection`})}function PB(e){e.endTransient(!1)}function FB(e,t){return e.getState().elements.find(e=>e.id===t)}function IB(){let e=null,t=[0,0],n=[0,0];return{onPointerDown(r,i){let{store:a}=r;n=i.scene,t=AB(i.scene,OB(a,i));let o=NN({x:t[0],y:t[1],width:0,height:0});e=o.id,a.beginTransient(),MB(a,o),a.setState({selectedIds:new Set})},onPointerMove(n,r){if(!e)return;let i=FB(n.store,e);if(!i)return;let a=AB(r.scene,OB(n.store,r));jB(n.store,{...i,x:Math.min(t[0],a[0]),y:Math.min(t[1],a[1]),width:Math.abs(a[0]-t[0]),height:Math.abs(a[1]-t[1])})},onPointerUp(t,r){if(!e)return;let{store:i}=t,a=e;e=null;let o=FB(i,a);if(!o){PB(i);return}let s=i.getState().viewport.zoom;jB(i,QP([Math.hypot(r.scene[0]-n[0],r.scene[1]-n[1])*s<2?{...o,x:n[0]-100,y:n[1]-60,width:200,height:120}:o])[0]),NB(i,a),CB(i,a)},cancel(t){e&&(e=null,PB(t.store))}}}var LB=4;function RB(e,t,n){let r=e.store.getState(),i=6/r.viewport.zoom,a=new Set(r.erasingIds),o=Math.max(1,Math.ceil(Math.hypot(n[0]-t[0],n[1]-t[1])/LB)),s=r.elements.filter(e=>!a.has(e.id));for(let e=0;e<=o;e++){let r=pR(s,[t[0]+(n[0]-t[0])*e/o,t[1]+(n[1]-t[1])*e/o],i);r&&a.add(r.id)}a.size!==r.erasingIds.size&&e.store.setState({erasingIds:a})}function zB(){let e=null;return{onPointerDown(t,n){e=n.scene,t.store.setState({erasingIds:new Set,selectedIds:new Set}),RB(t,n.scene,n.scene)},onPointerMove(t,n){e&&=(RB(t,e,n.scene),n.scene)},onPointerUp(t){if(!e)return;e=null;let{store:n}=t,r=hR(n.getState().elements,n.getState().erasingIds);n.setState({erasingIds:new Set}),r.size!==0&&n.commit(({elements:e})=>({elements:OR(e,r)}))},cancel(t){e=null,t.store.setState({erasingIds:new Set})}}}function BB(){let e=null;return{onPointerDown(t,n){let{store:r}=t,i=n.pointerType===`pen`,a=AN({x:n.scene[0],y:n.scene[1],points:[[0,0]],pressures:i?[n.pressure]:[],simulatePressure:!i},r.getState().currentStyle);e=a.id,r.beginTransient(),MB(r,a),r.setState({selectedIds:new Set})},onPointerMove(t,n){if(!e)return;let r=FB(t.store,e);if(!r)return;let i=[...r.points,[n.scene[0]-r.x,n.scene[1]-r.y]],[a,o,s,c]=jM(i);jB(t.store,{...r,points:i,pressures:r.simulatePressure?r.pressures:[...r.pressures,n.pressure],width:s-a,height:c-o})},onPointerUp(t){e&&(e=null,t.store.endTransient(!0))},cancel(t){e&&(e=null,t.store.endTransient(!1))}}}function VB(){let e=null,t=null;return{onPointerDown(n,r){e=r.screen,t=n.store.getState().viewport},onPointerMove(n,r){e&&t&&n.store.setState({viewport:{...t,scrollX:t.scrollX+(r.screen[0]-e[0])/t.zoom,scrollY:t.scrollY+(r.screen[1]-e[1])/t.zoom}})},onPointerUp(){e=null,t=null}}}function HB(){return{onPointerDown(e,t){e.requestImage?.(t.scene)},onPointerMove(){},onPointerUp(){}}}var UB=Math.PI/12;function WB(e,t){let[n,r]=t[0],i=t.map(([e,t])=>[e-n,t-r]),[a,o,s,c]=jM(i);return{...e,x:n,y:r,points:i,width:s-a,height:c-o}}function GB(e,t){let n=t[0]-e[0],r=t[1]-e[1],i=Math.hypot(n,r),a=Math.round(Math.atan2(r,n)/UB)*UB;return[e[0]+Math.cos(a)*i,e[1]+Math.sin(a)*i]}function KB(e){return e.points.map(([t,n])=>[e.x+t,e.y+n])}function qB(e,t={}){let n=null,r=`idle`,i=[0,0],a=[0,0],o=!1,s=(t,n,r)=>{let{elements:i,viewport:a}=t.store.getState(),s=e===`arrow`&&!o?bB(i,n.id,r,a.zoom):null;t.store.setState({suggestedBindingId:s?.id??null})},c=(e,r)=>{let i=n?FB(e.store,n):void 0;if(!i)return;let c=AB(r.scene,OB(e.store,r)),l;if(i.elbowed){let{elements:t,viewport:n}=e.store.getState(),r=e=>o?null:bB(t,i.id,e,n.zoom);l=WB(i,Uz(a,c,{obstacles:Kz(t,i.id),startTarget:r(a),endTarget:r(c)}))}else{let e=KB(i),t=e.at(-2)??e[0];e[e.length-1]=r.shiftKey?GB(t,c):c,l=WB(i,e)}t.onPointMoved&&(l=t.onPointMoved(e,l,r)),jB(e.store,l),s(e,l,KB(l).at(-1))},l=(i,a,s)=>{let c=n?FB(i,n):void 0,l=n;if(n=null,r=`idle`,!c||!l)return;let u=KB(c);if(a&&c.elbowed&&(u.length=0),a&&u.pop(),u.length<2){PB(i);return}let d=WB(c,u);if(jB(i,d),e===`arrow`&&!o){let e=i.getState().viewport.zoom;i.updateTransient(({elements:t})=>({elements:xB(t,l,[`start`,`end`],e)}))}i.setState({suggestedBindingId:null}),NB(i,l),s&&t.onFinished?.(s,d)};return{onPointerDown(t,s){let{store:u}=t;if(i=s.screen,o=s.ctrlKey,r!==`multi`&&(a=AB(s.scene,OB(u,s))),r===`multi`&&n){let e=FB(u,n);if(e.elbowed){c(t,s),l(u,!1,t);return}let r=KB(e);jB(u,WB(e,[...r,r.at(-1)]));return}let d=kN(e,{x:a[0],y:a[1],points:[[0,0],[0,0]]},u.getState().currentStyle);n=d.id,r=`dragging`,u.beginTransient(),MB(u,d),u.setState({selectedIds:new Set})},onPointerMove(e,t){r!==`idle`&&(o=t.ctrlKey,c(e,t))},onPointerUp(e,t){r===`dragging`&&(o=t.ctrlKey,Math.hypot(t.screen[0]-i[0],t.screen[1]-i[1])<2?r=`multi`:l(e.store,!1,e))},onDoubleClick(e){r===`multi`&&l(e.store,!0,e)},onKeyDown(e,t){return r===`idle`?!1:t.key===`Enter`||t.key===`Escape`?(l(e.store,!0,e),!0):!1},cancel(e){n&&(r===`multi`?l(e.store,!0,e):(n=null,r=`idle`,e.store.setState({suggestedBindingId:null}),PB(e.store)))}}}function JB(e){return!!e&&(e.type===`line`||e.type===`arrow`)&&!e.locked}function YB(e,t,n){let r=zM(e);return r.splice(t+1,0,n),$(e,Yz(e,r))}function XB(e,t){if(e.points.length<=2)return e;let n=zM(e);return n.splice(t,1),$(e,Yz(e,n))}function ZB(e){let t=zM(e),n=[];for(let e=0;e<t.length-1;e++)n.push([(t[e][0]+t[e+1][0])/2,(t[e][1]+t[e+1][1])/2]);return n}function QB(e){let t=_R(e);return t.length===1&&JB(t[0])?t[0]:null}function $B(e){let t=zM(e),n=[];for(let e=1;e<t.length-2;e++)n.push({index:e,point:[(t[e][0]+t[e+1][0])/2,(t[e][1]+t[e+1][1])/2]});return n}function eV(e,t,n){let r=zM(e),i=+(r[t][1]===r[t+1][1]);r[t][i]=n[i],r[t+1][i]=n[i];let a=Yz(e,r),o=e=>[e[0]-a.x,e[1]-a.y],s=(e.fixedSegments??[]).filter(e=>e.index!==t+1);return $(e,{...a,fixedSegments:[...s,{index:t+1,start:o(r[t]),end:o(r[t+1])}].sort((e,t)=>e.index-t.index)})}function tV(e,t,n){let r=8/n,i=([e,n])=>Math.hypot(t[0]-e,t[1]-n)<=r,a=zM(e);for(let t=a.length-1;t>=0;t--)if((t===0||t===a.length-1||!e.elbowed)&&i(a[t]))return{kind:`point`,index:t};if(e.elbowed){for(let t of $B(e))if(i(t.point))return{kind:`segment`,index:t.index};return null}let o=ZB(e);for(let e=0;e<o.length;e++)if(i(o[e]))return{kind:`midpoint`,index:e};return null}function nV(e,t,n){let{store:r}=e,i=r.getState(),a=QB(i);if(!a)return null;let o=tV(a,t.scene,i.viewport.zoom);if(!o)return null;let s=a,c=o.kind===`point`?o.index:o.kind===`midpoint`?o.index+1:-1,l=c,u=!1,d=t.ctrlKey,f=t.screen,p=(e,t)=>a.type===`arrow`?e===0?`start`:e===t-1?`end`:null:null;return r.setState({selectedPointIndex:o.kind===`point`?o.index:null}),r.beginTransient(),{cancel(){r.setState({suggestedBindingId:null}),r.endTransient(!1),l=-1},move(t){if(!u&&Math.hypot(t.screen[0]-f[0],t.screen[1]-f[1])<2)return;u=!0;let i;i=o.kind===`segment`?eV(s,o.index,t.scene):o.kind===`midpoint`?Xz(YB(s,o.index,t.scene),c,t.scene):Xz(s,c,t.scene);let a=p(c,i.points.length);if(s.elbowed&&a){let e=a===`start`?`startBinding`:`endBinding`;i={...Jz({...i,[e]:null},r.getState().elements),[e]:s[e]},l=a===`start`?0:i.points.length-1}n&&(i=n(e,i,l,t)),r.updateTransient(({elements:e})=>({elements:_L(e.map(e=>e.id===i.id?i:e),new Set([i.id]))})),d=t.ctrlKey;let m=p(l,i.points.length),{elements:h,viewport:g}=r.getState(),_=m&&!d?bB(h,i.id,t.scene,g.zoom):null;r.setState({selectedPointIndex:l>=0?l:null,suggestedBindingId:_?.id??null})},end(){let e=r.getState().elements.find(e=>e.id===a.id),t=e&&u?p(l,e.points.length):null;if(t){let e=r.getState().viewport.zoom;r.updateTransient(({elements:n})=>({elements:d?dB(n,a.id,t):xB(n,a.id,[t],e)}))}r.setState({suggestedBindingId:null}),r.endTransient(u),l=-1}}}var rV=1,iV=Math.PI/12;function aV(e){if(IM(e)){let[t,n,r,i]=jM(e.points.length?e.points:[[0,0]]);return[e.x+t,e.y+n,e.x+r,e.y+i]}return[e.x,e.y,e.x+e.width,e.y+e.height]}function oV(e){if(e.length===1){let t=e[0];return{box:aV(t),angle:FM(t),center:RM(t)}}let t=HM(e);return{box:t,angle:0,center:[(t[0]+t[2])/2,(t[1]+t[3])/2]}}function sV(e,t,n=0){let r=8/t,[i,a,o,s]=[e[0]-r,e[1]-r,e[2]+r,e[3]+r],c=(e[0]+e[2])/2,l=(e[1]+e[3])/2,u={nw:[i,a],n:[c,a],ne:[o,a],e:[o,l],se:[o,s],s:[c,s],sw:[i,s],w:[i,l],rotation:[c,a-24/t]};if(!n)return u;let d={};for(let[e,t]of Object.entries(u))d[e]=OM(t,[c,l],n);return d}function cV(e,t,n){let r=8/n;for(let[n,[i,a]]of Object.entries(e))if(Math.hypot(t[0]-i,t[1]-a)<=r)return n;return null}function lV(e,t,n,r){let[i,a,o,s]=e,[c,l]=n;if(t.includes(`e`)&&(o+=c),t.includes(`w`)&&(i+=c),t.includes(`s`)&&(s+=l),t.includes(`n`)&&(a+=l),r.fromCenter&&(t.includes(`e`)&&(i-=c),t.includes(`w`)&&(o-=c),t.includes(`s`)&&(a-=l),t.includes(`n`)&&(s-=l)),r.keepRatio){let n=e[2]-e[0]||1,c=e[3]-e[1]||1,l=t.includes(`e`)||t.includes(`w`),u=t.includes(`n`)||t.includes(`s`),d=(o-i)/n,f=(s-a)/c,p=l&&u?Math.abs(d)>Math.abs(f)?d:f:l?d:f,m=n*p,h=c*p,g=(e[0]+e[2])/2,_=(e[1]+e[3])/2;if(r.fromCenter)return[g-m/2,_-h/2,g+m/2,_+h/2];let v=t.includes(`w`)?e[2]:t.includes(`e`)?e[0]:g-m/2,y=t.includes(`n`)?e[3]:t.includes(`s`)?e[1]:_-h/2,b=t.includes(`w`)?v-m:v,x=t.includes(`n`)?y-h:y;return[b,x,b+m,x+h]}return[Math.min(i,o),Math.min(a,s),Math.max(i,o),Math.max(a,s)]}function uV(e,t,n,r){let[i,a,o,s]=t.box,c=(n[2]-n[0])/(o-i||1),l=(n[3]-n[1])/(s-a||1),u=aV(e),d=r?n:[n[0]+(u[0]-i)*c,n[1]+(u[1]-a)*l,n[0]+(u[2]-i)*c,n[1]+(u[3]-a)*l],f=Math.max(rV,d[2]-d[0]),p=Math.max(rV,d[3]-d[1]),m=[(d[0]+d[2])/2,(d[1]+d[3])/2],h=r?OM(m,t.center,t.angle):m,g={width:f,height:p};if(IM(e)){let t=e.points.length?e.points:[[0,0]],[n,r]=jM(t);g.points=t.map(([e,t])=>[n+(e-n)*c,r+(t-r)*l]),g.x=h[0]-f/2-n,g.y=h[1]-p/2-r}else g.x=h[0]-f/2,g.y=h[1]-p/2;return e.type===`text`&&(g.fontSize=e.fontSize*Math.min(c,l)),$(e,g)}function dV(e,t,n,r,i){if(e.length===0||t===`rotation`)return[...e];let a=oV(e),o=OM([r[0]-n[0],r[1]-n[1]],[0,0],-a.angle),s=i.keepRatio||e.every(e=>e.type===`text`||e.type===`svg`),c=lV(a.box,t,o,{...i,keepRatio:s}),l=e.length===1;return QP(e.map(e=>uV(e,a,c,l)))}function fV(e){let t=Math.PI*2;return(e%t+t)%t}function pV(e,t,n,r){if(e.length===1){let t=e[0],i=fV(FM(t)+n);return r.snap&&(i=fV(Math.round(i/iV)*iV)),[$(t,{angle:i})]}let i=r.snap?Math.round(n/iV)*iV:n;return e.map(e=>{let n=RM(e),[r,a]=OM(n,t,i);return $(e,{x:e.x+r-n[0],y:e.y+a-n[1],angle:fV(FM(e)+i)})})}function mV(e,t,n,r){return e.map(e=>t.has(e.id)?$(e,{x:e.x+n,y:e.y+r}):e)}function hV(e){let t=_R(e).filter(e=>!(e.type===`text`&&e.containerId));if(t.length===0)return[];if(t.length===1){let[n]=t;if(n.locked||IM(n)&&n.type!==`freedraw`&&n.points.length<=2||n.type===`arrow`&&n.elbowed||e.editingLinearId===n.id)return[]}return t}function gV(e){let t=hV(e);if(t.length===0)return null;let n=oV(t);return sV(n.box,e.viewport.zoom,n.angle)}var _V=(e,t)=>Math.atan2(e[1]-t[1],e[0]-t[0]);function vV(e,t){let{store:n}=e,r=n.getState(),i=gV(r);if(!i)return null;let a=cV(i,t.scene,r.viewport.zoom);if(!a)return null;let o=hV(r),s=new Set(o.map(e=>e.id)),c=oV(o),l=t.scene,u=_V(l,c.center),d=!1;n.beginTransient();let f=e=>{let t=new Map(e.map(e=>[e.id,e]));n.updateTransient(({elements:e})=>({elements:oR(vB(_L(e.map(e=>s.has(e.id)?t.get(e.id):e),s),s),s)}))};return{move(e){if(d=!0,a===`rotation`){let t=_V(e.scene,c.center)-u;f(pV(o,c.center,t,{snap:e.shiftKey}))}else f(dV(o,a,l,AB(e.scene,OB(n,e)),{keepRatio:e.shiftKey,fromCenter:e.altKey}))},end(e){n.endTransient(e&&d)}}}function yV(e,t,n){return r=>r.map(r=>{let i=e.get(r.id);return i?$(i,{x:i.x+t,y:i.y+n}):r})}function bV(e={}){let t=`idle`,n=[0,0],r=!1,i=new Map,a=[0,0],o=new Set,s=null,c=null;return{onPointerDown(l,u){let{store:d}=l;if(c=nV(l,u,e.onPointMove),c){t=`point`;return}if(s=vV(l,u),s){t=`transform`;return}let f=d.getState(),p=mR(f,u.scene,6/f.viewport.zoom);if(n=u.scene,r=!1,!p){o=u.shiftKey?new Set(f.selectedIds):new Set,d.setState({selectedIds:o,editingGroupId:u.shiftKey?f.editingGroupId:null,selectedPointIndex:null}),t=`box`;return}let m=new Set(f.selectedIds);if(u.shiftKey){let e=p.ids.every(e=>m.has(e));for(let t of p.ids)e?m.delete(t):m.add(t)}else m.has(p.hitId)||(m=new Set(p.ids));if(d.setState({selectedIds:m,selectedPointIndex:null}),!m.has(p.hitId)){t=`idle`;return}let h=hR(f.elements,sR(f.elements,m));i=new Map(f.elements.filter(e=>h.has(e.id)).map(e=>[e.id,e]));let[g,_]=HM([...i.values()]);a=[g,_],t=`drag`,d.beginTransient()},onPointerMove(e,l){let{store:u}=e;if(t===`transform`){s?.move(l);return}if(t===`point`){c?.move(l);return}let d=l.scene[0]-n[0],f=l.scene[1]-n[1];if(t===`drag`){let e=u.getState().viewport.zoom;if(!r&&Math.hypot(d,f)*e<2)return;r=!0;let t=OB(u,l);t&&(d=kB(a[0]+d,t)-a[0],f=kB(a[1]+f,t)-a[1]);let n=yV(i,d,f),o=new Set(i.keys());u.updateTransient(({elements:e})=>({elements:oR(vB(n(e),o),o)}))}else if(t===`box`){let e=PM(n,l.scene),t=gR(u.getState(),e);u.setState({selectionBox:e,selectedIds:new Set([...o,...t])})}},onPointerUp(e){let{store:n}=e;t===`transform`&&s?.end(!0),t===`point`&&c?.end(),s=null,c=null,t===`drag`&&n.endTransient(r),t===`box`&&n.setState({selectionBox:null}),t=`idle`},cancel(e){let{store:n}=e;t===`transform`&&s?.end(!1),t===`point`&&c?.cancel(),t===`drag`&&n.endTransient(!1),t===`box`&&n.setState({selectionBox:null}),s=null,c=null,t=`idle`},onDoubleClick(e,t){let{store:n}=e,r=n.getState(),i=mR(r,t.scene,6/r.viewport.zoom);if(!i){n.setState({editingGroupId:null}),mL(n,{at:t.scene});return}let a=r.elements.find(e=>e.id===i.hitId);if(!a)return;if(a.type===`frame`||a.type===`magicframe`){n.setState({editingFrameId:a.id,selectedIds:new Set([a.id])});return}let o=a.groupIds??[],s=r.editingGroupId?o.indexOf(r.editingGroupId):o.length;if(o.length>0&&s>0){let e=o[s-1],t=s-1>0?o[s-2]:null,i=t?r.elements.filter(e=>e.groupIds?.includes(t)).map(e=>e.id):[a.id];n.setState({editingGroupId:e,selectedIds:new Set(i)})}else a.type===`richtext`?CB(n,a.id):a.type===`text`?mL(n,{elementId:a.id}):uL(a)&&mL(n,{containerId:a.id})}}}function xV(e,t,n,r){let i=t[0]-e[0],a=t[1]-e[1];if(n){let e=Math.max(Math.abs(i),Math.abs(a));i=Math.sign(i||1)*e,a=Math.sign(a||1)*e}return r?{x:e[0]-Math.abs(i),y:e[1]-Math.abs(a),width:Math.abs(i)*2,height:Math.abs(a)*2}:{x:Math.min(e[0],e[0]+i),y:Math.min(e[1],e[1]+a),width:Math.abs(i),height:Math.abs(a)}}function SV(e,t={}){let n=null,r=[0,0];return{onPointerDown(t,i){let{store:a}=t,o=a.getState().currentStyle;r=AB(i.scene,OB(a,i));let s={x:r[0],y:r[1],width:0,height:0},c=e===`frame`?FN(s,o):ON(e,s,o);n=c.id,a.beginTransient(),MB(a,c),a.setState({selectedIds:new Set})},onPointerMove(e,t){if(!n)return;let i=FB(e.store,n);if(!i)return;let a=AB(t.scene,OB(e.store,t));jB(e.store,{...i,...xV(r,a,t.shiftKey,t.altKey)})},onPointerUp(e){if(!n)return;let{store:r}=e,i=FB(r,n),a=r.getState().viewport.zoom,o=n;n=null,!i||Math.max(i.width,i.height)*a<2?PB(r):(NB(r,o),t.onCreated?.(e,i))},cancel(e){n&&(n=null,PB(e.store))}}}function CV(){let e=null;return{onPointerDown(t,n){e=n.scene},onPointerMove(){},onPointerUp(t){let n=e;if(e=null,!n)return;let{store:r}=t,i=r.getState(),a=pR(i.elements,n,6/i.viewport.zoom);i.toolLocked||r.setState({tool:`selection`}),a?.type===`text`?mL(r,{elementId:a.id}):a&&uL(a)&&a.type!==`arrow`?mL(r,{containerId:a.id}):mL(r,{at:n})},cancel(){e=null}}}function wV(){return{selection:bV(),hand:VB(),rectangle:SV(`rectangle`),diamond:SV(`diamond`),ellipse:SV(`ellipse`),frame:SV(`frame`),arrow:qB(`arrow`),line:qB(`line`),freedraw:BB(),eraser:zB(),text:CV(),card:IB(),image:HB()}}function TV(e,t){return e[t]??e.selection}var EV=16,DV=`data-whiteboard-chrome`;function OV(e){return e instanceof Element&&!!e.closest(`[data-whiteboard-chrome]`)}var kV=.01,AV=({children:e,context:t,handlers:n,onContextMenu:r,store:i,theme:a})=>{let o=(0,A.useRef)(null),s=(0,A.useRef)(null),c=(0,A.useRef)(!1),l=(0,A.useRef)(null),u=(0,A.useRef)(uz()),d=wL(i,e=>e.elements),f=wL(i,e=>e.files),p=wL(i,e=>e.viewport),m=wL(i,e=>e.editingTextId),h=wL(i,e=>e.editingRichTextId),g=wL(i,e=>e.erasingIds),_=wL(i,e=>e.tool),v=wL(i,e=>e.gridSize),y=(0,A.useRef)(_);(0,A.useEffect)(()=>{let e=y.current;if(y.current=_,e===_)return;let r=TV(n,e);r.cancel?.(t),s.current===r&&(s.current=null)},[t,n,_]);let b=(0,A.useMemo)(()=>({type:`excalidraw`,appState:{},elements:d,files:f}),[d,f]),x=(0,A.useMemo)(()=>m?new Set([m]):void 0,[m]),S=(0,A.useCallback)(e=>{if(e.id===h)return{className:Ez};if(g.has(e.id))return{opacity:.25};if(e.type===`image`&&e.status===`pending`)return{opacity:.5}},[g,h]),C=(0,A.useCallback)(e=>{let t=o.current.getBoundingClientRect(),n=[e.clientX-t.left,e.clientY-t.top];return{screen:n,scene:az(n,i.getState().viewport),shiftKey:!!e.shiftKey,altKey:!!e.altKey,ctrlKey:!!(e.ctrlKey||e.metaKey),pressure:e.pressure??.5,pointerType:e.pointerType??`mouse`,pointerId:e.pointerId??1}},[i]),w=e=>{if(e.button===2||OV(e.target))return;if(o.current?.focus({preventScroll:!0}),e.currentTarget.setPointerCapture?.(e.pointerId),e.pointerType===`touch`){let n=u.current.down(e.pointerId,C(e).screen,i.getState().viewport);if(n===`pinch`&&(s.current?.cancel?.(t),s.current=null),n!==`single`)return}let r=e.button===1||c.current?n.hand:TV(n,i.getState().tool);s.current=r,r.onPointerDown(t,C(e))},T=e=>{if(e.pointerType===`touch`){let t=u.current,n=t.move(e.pointerId,C(e).screen);if(n&&i.setState({viewport:n}),t.isActive())return}let r=s.current??TV(n,i.getState().tool),a=C(e);l.current=a.scene,r.onPointerMove(t,a)},E=e=>{if(e.pointerType===`touch`){let t=u.current,n=t.isActive();if(t.up(e.pointerId),n)return}let n=s.current;s.current=null,n?.onPointerUp(t,C(e))};(0,A.useEffect)(()=>{let e=o.current;if(!e)return;let n=t=>{if(OV(t.target))return;t.preventDefault();let n=i.getState().viewport,r=e.getBoundingClientRect(),a=[t.clientX-r.left,t.clientY-r.top];if(t.ctrlKey||t.metaKey){i.setState({viewport:sz(n,a,n.zoom*Math.exp(-t.deltaY*kV))});return}let o=t.shiftKey&&!t.deltaX?t.deltaY:t.deltaX,s=t.shiftKey&&!t.deltaX?0:t.deltaY;i.setState({viewport:{...n,scrollX:n.scrollX-o/n.zoom,scrollY:n.scrollY-s/n.zoom}})},r=e=>{e.key===` `&&!(e.target instanceof HTMLTextAreaElement)&&(c.current=e.type===`keydown`)},a=()=>{let t=e.getBoundingClientRect();i.setState({canvasSize:{width:t.width,height:t.height}})};a();let s=typeof ResizeObserver>`u`?null:new ResizeObserver(a);s?.observe(e);let u=()=>{if(l.current)return l.current;let{viewport:e,canvasSize:t}=i.getState();return az([t.width/2,t.height/2],e)},d=e=>{!e.clipboardData||i.getState().editingTextId||i.getState().editingRichTextId||i.getState().selectedIds.size===0||(e.preventDefault(),e.clipboardData.setData(`text/plain`,e.type===`cut`?BR(i):zR(i)))},f=e=>{let{editingRichTextId:n,editingTextId:r}=i.getState();if(!e.clipboardData||r||n)return;let a=[...e.clipboardData.files??[]].filter(e=>e.type.startsWith(`image/`));a.length>0&&t.onFiles?(e.preventDefault(),t.onFiles(a,u())):UR(i,e.clipboardData.getData(`text/plain`),u())&&e.preventDefault()};return e.addEventListener(`copy`,d),e.addEventListener(`cut`,d),e.addEventListener(`paste`,f),e.addEventListener(`wheel`,n,{passive:!1}),window.addEventListener(`keydown`,r),window.addEventListener(`keyup`,r),()=>{s?.disconnect(),e.removeEventListener(`copy`,d),e.removeEventListener(`cut`,d),e.removeEventListener(`paste`,f),e.removeEventListener(`wheel`,n),window.removeEventListener(`keydown`,r),window.removeEventListener(`keyup`,r)}},[t,i]);let D=(v??EV)*p.zoom,ee=a===`dark`;return(0,j.jsxs)(`div`,{"data-whiteboard-canvas":!0,className:ez,ref:o,tabIndex:0,style:{backgroundSize:`${D}px ${D}px`,backgroundPosition:`${p.scrollX*p.zoom}px ${p.scrollY*p.zoom}px`},onPointerCancel:E,onPointerDown:w,onPointerMove:T,onPointerUp:E,onContextMenu:e=>{OV(e.target)||r?.(C(e))&&e.preventDefault()},onDoubleClick:e=>{OV(e.target)||TV(n,i.getState().tool).onDoubleClick?.(t,C(e))},onDragOver:e=>{e.dataTransfer.types.includes(`Files`)&&e.preventDefault()},onDrop:e=>{let n=[...e.dataTransfer.files??[]].filter(e=>e.type.startsWith(`image/`));n.length!==0&&t.onFiles&&(e.preventDefault(),t.onFiles(n,C(e).scene))},children:[(0,j.jsx)(`svg`,{className:tz,style:ee?{filter:cI}:void 0,children:(0,j.jsx)(`g`,{transform:`scale(${p.zoom}) translate(${p.scrollX} ${p.scrollY})`,children:(0,j.jsx)(mI,{dark:ee,elementProps:S,files:f,hiddenIds:x,scene:b})})}),e]})},jV=8,MV=({at:e,items:t,onClose:n})=>{let r=(0,A.useRef)(null),[i,a]=(0,A.useState)(e);return(0,A.useLayoutEffect)(()=>{let t=r.current,n=t?.offsetParent;if(!t||!n)return;let i=n.getBoundingClientRect(),o=t.getBoundingClientRect();i.width&&i.height&&a([Math.max(jV,Math.min(e[0],i.width-o.width-jV)),Math.max(jV,Math.min(e[1],i.height-o.height-jV))])},[e]),(0,A.useEffect)(()=>{let e=r.current;e?.querySelector(`[role="menuitem"]:not([disabled])`)?.focus();let t=t=>{t.target instanceof Node&&e?.contains(t.target)||n()},i=e=>{e.key===`Escape`&&(e.stopPropagation(),e.preventDefault(),n())};return document.addEventListener(`pointerdown`,t,!0),document.addEventListener(`wheel`,t,!0),document.addEventListener(`keydown`,i,!0),window.addEventListener(`blur`,n),window.addEventListener(`resize`,n),()=>{document.removeEventListener(`pointerdown`,t,!0),document.removeEventListener(`wheel`,t,!0),document.removeEventListener(`keydown`,i,!0),window.removeEventListener(`blur`,n),window.removeEventListener(`resize`,n)}},[n]),(0,j.jsx)(`div`,{className:`${EL} ${AL}`,ref:r,role:`menu`,style:{left:i[0],top:i[1]},onContextMenu:e=>e.preventDefault(),onKeyDown:e=>{if(e.stopPropagation(),e.key!==`ArrowDown`&&e.key!==`ArrowUp`)return;e.preventDefault();let t=[...e.currentTarget.querySelectorAll(`[role="menuitem"]:not([disabled])`)];t.length!==0&&t[(t.indexOf(document.activeElement)+(e.key===`ArrowDown`?1:-1)+t.length)%t.length].focus()},[DV]:``,children:t.map((e,t)=>WR(e)?(0,j.jsx)(`div`,{className:ML,role:`separator`},`separator-${t}`):(0,j.jsx)(`button`,{className:jL,"data-danger":e.danger||void 0,disabled:e.disabled,role:`menuitem`,type:`button`,onClick:()=>{n(),e.onSelect()},children:e.label},e.key))})};function NV(e,t,n){let[r,i]=(0,A.useState)(null),a=(0,A.useRef)(t);a.current=t;let o=(0,A.useRef)(n);o.current=n;let s=(0,A.useCallback)(t=>{let{editingRichTextId:n,editingTextId:r}=e.getState();if(r||n)return!1;let s=QR(e,t.scene,a.current);return o.current?(o.current({items:s,scenePoint:t.scene,screenPoint:t.screen}),!0):(i({at:t.screen,items:s}),!0)},[e]),c=(0,A.useCallback)(()=>i(null),[]);return{open:s,menu:r?(0,j.jsx)(MV,{at:r.at,items:r.items,onClose:c}):null}}var PV=`gb4lm20`,FV=`gb4lm21`,IV=({frame:e,store:t})=>{let[n,r]=(0,A.useState)(e.name??``),i=(0,A.useRef)(null),a=wL(t,e=>e.viewport),[o,s]=oz([e.x,e.y-20],a);(0,A.useEffect)(()=>{i.current?.focus(),i.current?.select()},[]);let c=(0,A.useRef)(!1),l=r=>{if(c.current||(c.current=!0,t.setState({editingFrameId:null}),!r))return;let i=n.trim()||null;i!==(e.name??null)&&t.commit(({elements:t})=>({elements:t.map(t=>t.id===e.id?$(t,{name:i}):t)}))};return(0,j.jsx)(`input`,{"data-frame-name-editor":!0,className:FV,ref:i,value:n,[DV]:``,style:{left:o,top:s,height:20*a.zoom},onBlur:()=>l(!0),onChange:e=>r(e.currentTarget.value),onKeyDown:e=>{e.stopPropagation(),e.key===`Enter`&&l(!0),e.key===`Escape`&&l(!1)}})},LV=({store:e})=>{let t=wL(e,e=>e.editingFrameId?e.elements.find(t=>t.id===e.editingFrameId):void 0);return!t||t.isDeleted?null:(0,j.jsx)(IV,{frame:t,store:e},t.id)},RV=({store:e,tools:t})=>(0,j.jsx)(`div`,{"data-mobile-dock":!0,"data-whiteboard-chrome":!0,className:`${EL} ${HL}`,children:(0,j.jsx)(YL,{showKeys:!1,store:e,tools:t})}),zV=({store:e})=>{let t=wL(e,e=>e);if(t.selectionBox||t.editingTextId||t.tool!==`selection`)return null;let n=QB(t);if(!n)return null;let r=zM(n).map((e,n,r)=>({i:n,p:oz(e,t.viewport),end:n===0||n===r.length-1})).filter(({end:e})=>e||!n.elbowed),i=n.elbowed?[]:ZB(n).map(e=>oz(e,t.viewport)),a=n.elbowed?$B(n).map(e=>({...e,point:oz(e.point,t.viewport)})):[];return(0,j.jsxs)(`g`,{"data-linear-handles":!0,children:[i.map(([e,t],n)=>(0,j.jsx)(`circle`,{cx:e,cy:t,"data-midpoint":n,fill:nz,fillOpacity:.25,r:3.5},`m${n}`)),a.map(({index:e,point:[t,n]})=>(0,j.jsx)(`rect`,{"data-segment":e,fill:`#fff`,height:6,rx:3,stroke:nz,strokeWidth:1.5,width:12,x:t-6,y:n-3},`s${e}`)),r.map(({i:e,p:[n,r]})=>(0,j.jsx)(`circle`,{cx:n,cy:r,"data-point":e,fill:t.selectedPointIndex===e?nz:`#fff`,r:5,stroke:nz,strokeWidth:1.5},`p${e}`))]})},BV=4.5,VV=5,HV=({store:e})=>{let t=wL(e,e=>e);if(t.selectionBox||t.editingTextId)return null;let n=gV(t);return n?(0,j.jsx)(`g`,{"data-transform-handles":!0,children:Object.entries(n).map(([e,n])=>{let[r,i]=oz(n,t.viewport);return(0,j.jsx)(`circle`,{cx:r,cy:i,"data-handle":e,fill:`#fff`,r:e===`rotation`?VV:BV,stroke:nz,strokeWidth:1.5},e)})}):null};function UV(e){if(IM(e)){let[t,n,r,i]=HM([e]);return[[t,n],[r,n],[r,i],[t,i]]}return BM(e)}var WV=e=>e.map(([e,t])=>`${e},${t}`).join(` `),GV=({store:e})=>{let t=wL(e,e=>e),{viewport:n,selectionBox:r}=t,i=_R(t).filter(e=>!(e.type===`text`&&e.containerId)),a=t.suggestedBindingId?t.elements.find(e=>e.id===t.suggestedBindingId&&!e.isDeleted):void 0,o=r?[oz([r[0],r[1]],n),oz([r[2],r[3]],n)]:null;return(0,j.jsxs)(`svg`,{"data-whiteboard-overlay":!0,className:tz,children:[a&&(0,j.jsx)(`polygon`,{"data-binding-highlight":a.id,fill:`none`,opacity:.6,points:WV(UV(a).map(e=>oz(e,n))),stroke:`var(--rc-accent)`,strokeWidth:3}),i.length>1&&i.map(e=>(0,j.jsx)(`polygon`,{fill:`none`,opacity:.5,points:WV(UV(e).map(e=>oz(e,n))),stroke:`var(--rc-accent)`,strokeWidth:1},e.id)),i.length===1&&(0,j.jsx)(`polygon`,{"data-selection-frame":!0,fill:`none`,points:WV(UV(i[0]).map(e=>oz(e,n))),stroke:`var(--rc-accent)`,strokeWidth:1}),(0,j.jsx)(HV,{store:e}),(0,j.jsx)(zV,{store:e}),o&&(0,j.jsx)(`rect`,{"data-selection-box":!0,fill:`var(--rc-accent)`,fillOpacity:.08,height:o[1][1]-o[0][1],stroke:`var(--rc-accent)`,strokeWidth:1,width:o[1][0]-o[0][0],x:o[0][0],y:o[0][1]})]})},KV={direction:null,format:``,indent:0,version:1},qV=(e,t)=>({type:`text`,text:e,format:typeof t?.format==`number`?t.format:0,style:typeof t?.style==`string`?t.style:``,detail:0,mode:`normal`,version:1});function JV(e){switch(e.type){case`text`:return[qV(e.text??``,e)];case`linebreak`:case`tab`:return[{type:e.type,version:1}];case`link`:case`autolink`:return[{...KV,type:`link`,url:typeof e.url==`string`?e.url:``,rel:`noopener noreferrer`,target:`_blank`,title:null,children:(e.children??[]).flatMap(JV)}];default:{let t=bN(e);return t?[qV(t)]:[]}}}var YV=e=>({...KV,type:`paragraph`,textFormat:0,textStyle:``,children:e});function XV(e,t){let n=(e.children??[]).flatMap(e=>e.type===`list`?[ZV(e)]:JV(e));return{...KV,type:`listitem`,value:t+1,checked:void 0,children:n}}function ZV(e){let t=e.listType===`number`||e.listType===`check`?e.listType:`bullet`;return{...KV,type:`list`,listType:t,start:1,tag:t===`number`?`ol`:`ul`,children:(e.children??[]).map((e,t)=>XV(e.type===`listitem`?e:{type:`listitem`,children:[e]},t))}}function QV(e){switch(e.type){case`paragraph`:return YV((e.children??[]).flatMap(JV));case`heading`:{let t=/^h[1-6]$/.test(e.tag??``)?e.tag:`h3`;return{...KV,type:`heading`,tag:t,children:(e.children??[]).flatMap(JV)}}case`quote`:return{...KV,type:`quote`,children:(e.children??[]).flatMap(JV)};case`list`:return ZV(e);default:return YV(JV(e))}}function $V(e){let t=(xN(e).children??[]).map(QV);return{root:{...KV,type:`root`,children:t.length>0?t:[YV([])]}}}var eH=[`#1e1e1e`,`#868e96`,`#e03131`,`#2f9e44`,`#1971c2`,`#f08c00`],tH=[{format:`bold`,icon:Hn,label:`Bold`},{format:`italic`,icon:Wn,label:`Italic`},{format:`strikethrough`,icon:qr,label:`Strikethrough`},{format:`code`,icon:Ln,label:`Inline code`},{format:`highlight`,icon:Dr,label:`Highlight`}],nH={discrete:!0},rH=e=>e.preventDefault();function iH(){let e=J();return q(e)?e.anchor.getNode().getTopLevelElement():null}function aH(e){e.update(()=>{let e=J();if(!q(e))return;let t=Yx(iH());Yy(e,()=>t?z():Jx(`h3`))},nH)}function oH(e,t){e.getEditorState().read(()=>X(iH()))?e.dispatchCommand(iw,void 0):e.dispatchCommand(t?rw:nw,void 0)}function sH(e){return e.getEditorState().read(()=>{let e=J();return q(e)?e.getNodes().some(e=>LS(e)||LS(e.getParent())):!1})}function cH(e){let t=e.trim();return t?/^(?:https?:|mailto:)/i.test(t)?t:/^[a-z][\w+.-]*:/i.test(t)?null:`https://${t}`:null}var lH=({at:e,host:t})=>{let[n]=ha(),[r,i]=(0,A.useState)(!1),[a,o]=(0,A.useState)(!1);if((0,A.useEffect)(()=>n.registerUpdateListener(({editorState:e})=>{e.read(()=>{let e=J();i(q(e)&&!e.isCollapsed())})}),[n]),!t||!r&&!a)return null;let s=(e,t,n)=>(0,j.jsx)(Pw,{icon:!0,"aria-label":e,size:`sm`,title:e,variant:`ghost`,onClick:n,onMouseDown:rH,children:(0,j.jsx)(t,{size:15})},e);return(0,ui.createPortal)((0,j.jsx)(`div`,{"data-richtext-format-bar":!0,className:`${EL} ${GL}`,style:{left:e[0],top:e[1]},onPointerDown:e=>e.stopPropagation(),children:a?(0,j.jsx)(`input`,{autoFocus:!0,"aria-label":`Link URL`,className:qL,placeholder:`https://`,onBlur:()=>o(!1),onKeyDown:e=>{if(e.stopPropagation(),e.key===`Escape`&&o(!1),e.key!==`Enter`)return;let t=cH(e.currentTarget.value);o(!1),t&&n.dispatchCommand(HS,t),n.focus()}}):(0,j.jsxs)(j.Fragment,{children:[tH.map(({format:e,icon:t,label:r})=>s(r,t,()=>n.dispatchCommand(fo,e))),eH.map(e=>(0,j.jsx)(`button`,{"aria-label":`Text colour ${e}`,className:KL,"data-richtext-color":e,style:{background:e},type:`button`,onMouseDown:rH,onClick:()=>n.update(()=>{let t=J();q(t)&&Wy(t,{color:e})},nH)},e)),s(`Heading`,kr,()=>aH(n)),s(`Bulleted list`,Rn,()=>oH(n,!1)),s(`Numbered list`,jr,()=>oH(n,!0)),s(`Link`,Mn,()=>{sH(n)?n.dispatchCommand(HS,null):o(!0)})]})}),t)},uH={paragraph:pz,heading:{h1:mz,h2:hz,h3:gz,h4:_z,h5:_z,h6:_z},quote:vz,list:{ul:yz,ol:yz,listitem:bz,nested:{listitem:xz}},link:Tz,text:{underline:Sz,strikethrough:Cz,underlineStrikethrough:wz}},dH=440,fH=8,pH=(e,t,n)=>Math.min(Math.max(e,t),n);function mH(e,t,n){let r=Math.max(fH,n.width-dH-fH),i=Math.max(44,n.height-fH);return[pH(e,fH,r),pH(t-fH,44,i)]}var hH=[Wx,Bx,IC,VC,AS],gH=({onReady:e})=>{let[t]=ha();return(0,A.useEffect)(()=>{e(t),t.focus()},[t,e]),null},_H=({dark:e,el:t,store:n})=>{let r=wL(n,e=>e.viewport),i=wL(n,e=>e.canvasSize),a=(0,A.useRef)(null),[o,s]=(0,A.useState)(null),c=(0,A.useRef)(null),l=t.id,u=(0,A.useMemo)(()=>({namespace:`whiteboard-card`,nodes:hH,theme:uH,editorState:JSON.stringify($V(t.content)),onError:e=>{throw e}}),[l]);(0,A.useEffect)(()=>()=>{let e=a.current;if(!e)return;let t=JSON.stringify(e.getEditorState().toJSON());t!==c.current&&TB(n,l,JSON.parse(t))},[l,n]);let d=(0,A.useCallback)(e=>{a.current=e,c.current??=JSON.stringify(e.getEditorState().toJSON())},[]),[f,p]=oz([t.x,t.y],r),m=FM(t),h=m?` translate(${t.width/2}px, ${t.height/2}px) rotate(${m}rad) translate(${-t.width/2}px, ${-t.height/2}px)`:``;return(0,j.jsx)(`div`,{className:dz,"data-whiteboard-richtext-editor":l,ref:e=>s(e?.parentElement??null),style:{...pF,left:f,top:p,width:t.width,minHeight:t.height,padding:12,opacity:t.opacity/100,transform:`scale(${r.zoom})${h}`,filter:e?cI:void 0},onPointerDown:e=>e.stopPropagation(),onBlur:e=>{let t=e.relatedTarget;e.currentTarget.contains(t)||t?.closest(`[data-richtext-format-bar]`)||wB(n)},onKeyDown:e=>{e.stopPropagation(),e.key===`Escape`&&(e.preventDefault(),wB(n))},children:(0,j.jsxs)(hA,{initialConfig:u,children:[(0,j.jsx)(vS,{ErrorBoundary:Nv,contentEditable:(0,j.jsx)(kv,{className:fz})}),(0,j.jsx)(SA,{}),(0,j.jsx)(cw,{}),(0,j.jsx)(sw,{}),(0,j.jsx)(gH,{onReady:d}),(0,j.jsx)(lH,{at:mH(f,p,i),host:o})]})})},vH=({dark:e=!1,store:t})=>{let n=wL(t,e=>e.editingRichTextId?e.elements.find(t=>t.id===e.editingRichTextId&&t.type===`richtext`):void 0);return n?(0,j.jsx)(_H,{dark:e,el:n,store:t},n.id):null},yH={ArrowLeft:[-1,0],ArrowRight:[1,0],ArrowUp:[0,-1],ArrowDown:[0,1]},bH={v:`selection`,h:`hand`,r:`rectangle`,d:`diamond`,o:`ellipse`,a:`arrow`,l:`line`,p:`freedraw`,t:`text`,i:`image`,f:`frame`,e:`eraser`,n:`card`},xH=1.2;function SH(e,t){let{viewport:n,canvasSize:r}=e.getState(),i=[r.width/2,r.height/2];e.setState({viewport:sz(n,i,n.zoom*t)})}function CH(e){let{viewport:t,canvasSize:n}=e.getState();e.setState({viewport:sz(t,[n.width/2,n.height/2],1)})}function wH(e){let{elements:t,canvasSize:n}=e.getState(),r=t.filter(e=>!e.isDeleted);r.length!==0&&n.width!==0&&e.setState({viewport:cz(HM(r),n)})}function TH(e,t){let n=t.key.toLowerCase();return n===`z`?(t.shiftKey?e.redo():e.undo(),!0):n===`y`?(e.redo(),!0):n===`g`?(t.shiftKey?ER(e):TR(e),!0):n===`d`?(DR(e),!0):n===`a`?(AR(e),!0):t.key===`]`||t.key===`}`?(t.shiftKey?xR(e):CR(e),!0):t.key===`[`||t.key===`{`?(t.shiftKey?SR(e):wR(e),!0):t.key===`=`||t.key===`+`?(SH(e,xH),!0):t.key===`-`?(SH(e,1/xH),!0):t.key===`0`?(CH(e),!0):t.key===`'`&&(e.setState({gridSize:e.getState().gridSize?null:20}),!0)}function EH(e,t,n){let r=e.getState();if(r.editingTextId||r.editingRichTextId)return!1;if(t.ctrlKey||t.metaKey)return TH(e,t);let i=yH[t.key];if(i&&r.selectedIds.size>0){let n=t.shiftKey?10:1,a=hR(r.elements,sR(r.elements,r.selectedIds));return e.commit(({elements:e})=>({elements:oR(vB(mV(e,a,i[0]*n,i[1]*n),a),a)})),!0}if(t.key===`Delete`||t.key===`Backspace`){let t=QB(r);if(t&&r.selectedPointIndex!==null&&t.points.length>2){let n=r.selectedPointIndex;return e.commit(({elements:e})=>({elements:e.map(e=>e.id===t.id?XB(t,n):e)})),e.setState({selectedPointIndex:null}),!0}return kR(e),!0}if(t.key===`Escape`)return e.setState({selectedIds:new Set,editingGroupId:null,editingLinearId:null,selectedPointIndex:null,tool:r.toolLocked?r.tool:`selection`}),!0;if(t.key===`Enter`&&r.selectedIds.size===1){let[t]=r.selectedIds;if(r.elements.find(e=>e.id===t)?.type===`richtext`)return CB(e,t),!0}if(t.key===`!`||t.shiftKey&&t.key===`1`)return wH(e),!0;if(t.key.toLowerCase()===`q`)return e.setState({toolLocked:!r.toolLocked}),!0;let a=!t.altKey&&!t.shiftKey?bH[t.key.toLowerCase()]:void 0;return a&&n&&!n.has(a)?!1:a?(e.setState({tool:a,selectedIds:a===`selection`?r.selectedIds:new Set}),!0):!1}var DH=[`#1e1e1e`,`#e03131`,`#2f9e44`,`#1971c2`,`#f08c00`],OH=[`transparent`,`#ffc9c9`,`#b2f2bb`,`#a5d8ff`,`#ffec99`],kH=[{value:`hachure`,label:`Hachure`,icon:Vr},{value:`cross-hatch`,label:`Cross-hatch`,icon:Tr},{value:`solid`,label:`Solid`,icon:rr}],AH=[{value:1,label:`Thin`,icon:Nn},{value:2,label:`Bold`,icon:yr},{value:4,label:`Extra bold`,icon:Nr}],jH=[{value:`solid`,label:`Solid`,icon:Nn},{value:`dashed`,label:`Dashed`,icon:xr},{value:`dotted`,label:`Dotted`,icon:Pn}],MH=[{value:0,label:`Architect`,icon:Yn},{value:1,label:`Artist`,icon:Ur},{value:2,label:`Cartoonist`,icon:lr}],NH=[{value:`sharp`,label:`Sharp`,icon:rr},{value:`round`,label:`Round`,icon:Gr}],PH=[{value:!1,label:`None`},{value:!0,label:`Soft`}],FH=[{value:16,label:`S`},{value:20,label:`M`},{value:28,label:`L`},{value:36,label:`XL`}],IH=[{value:5,label:`Hand`},{value:2,label:`Sans`},{value:3,label:`Mono`}],LH=[{value:`left`,label:`Left`,icon:Gn},{value:`center`,label:`Center`,icon:Un},{value:`right`,label:`Right`,icon:Vn}],RH=[{value:null,label:`None`,icon:Nn},{value:`arrow`,label:`Arrow`,icon:Fr},{value:`triangle`,label:`Triangle`,icon:Vr},{value:`dot`,label:`Dot`,icon:_r},{value:`bar`,label:`Bar`,icon:Nr}],zH=[{value:`sharp`,label:`Sharp`,icon:Vr},{value:`round`,label:`Curved`,icon:Ur},{value:`elbow`,label:`Elbow`,icon:Zr}],BH=[`stroke`,`background`,`fillStyle`,`strokeWidth`,`strokeStyle`,`roughness`],VH=[`stroke`,`fontSize`,`fontFamily`,`textAlign`],HH=[`opacity`,`layers`,`actions`];function UH(e){let t=e.boundElements?.some(e=>e.type===`text`)?VH:[];switch(e.type){case`rectangle`:case`diamond`:return[...BH,`roundness`,`shadow`,...t];case`ellipse`:return[...BH,`shadow`,...t];case`arrow`:return[`stroke`,`strokeWidth`,`strokeStyle`,`roughness`,`arrowheads`,`arrowType`,...t];case`line`:return[`stroke`,`background`,`fillStyle`,`strokeWidth`,`strokeStyle`,`roughness`,`roundness`];case`freedraw`:return[`stroke`,`strokeWidth`];case`text`:return VH;case`richtext`:return[`stroke`,`background`,`strokeWidth`,`roundness`,`shadow`];case`image`:case`svg`:return[`shadow`];default:return[]}}function WH(e){if(e.length===0)return new Set;let t=new Set(UH(e[0]));for(let n of e.slice(1)){let e=new Set(UH(n));t=new Set([...t].filter(t=>e.has(t)))}for(let e of HH)t.add(e);return t}function GH(e,t){if(t===`roundness`)return e.roundness?`round`:`sharp`;if(t===`shadow`)return e.shadow===!0;if(t===`arrowType`){let t=e;return t.elbowed?`elbow`:t.roundness?`round`:`sharp`}return e[t]}function KH(e,t){if(e.length===0)return;let n=GH(e[0],t);return e.every(e=>GH(e,t)===n)?n:`mixed`}var qH=e=>e.type===`text`,JH=e=>e.type===`arrow`;function YH(e,t){let n={},r=new Set([...UH(e),...qH(e)?VH:[]]);if(t.strokeColor!==void 0&&r.has(`stroke`)&&(n.strokeColor=t.strokeColor),t.backgroundColor!==void 0&&r.has(`background`)&&(n.backgroundColor=t.backgroundColor),t.fillStyle!==void 0&&r.has(`fillStyle`)&&(n.fillStyle=t.fillStyle),t.strokeWidth!==void 0&&r.has(`strokeWidth`)&&(n.strokeWidth=t.strokeWidth),t.strokeStyle!==void 0&&r.has(`strokeStyle`)&&(n.strokeStyle=t.strokeStyle),t.roughness!==void 0&&r.has(`roughness`)&&(n.roughness=t.roughness),t.opacity!==void 0&&(n.opacity=t.opacity),t.shadow!==void 0&&r.has(`shadow`)&&(n.shadow=t.shadow),t.roundness!==void 0&&r.has(`roundness`)){let r=e.type===`line`?{type:2}:{type:3};n.roundness=t.roundness===`round`?r:null}if(qH(e)&&(t.fontSize!==void 0&&(n.fontSize=t.fontSize),t.fontFamily!==void 0&&(n.fontFamily=t.fontFamily),t.textAlign!==void 0&&!e.containerId&&(n.textAlign=t.textAlign)),JH(e)&&(t.startArrowhead!==void 0&&(n.startArrowhead=t.startArrowhead),t.endArrowhead!==void 0&&(n.endArrowhead=t.endArrowhead),t.arrowType!==void 0&&(n.elbowed=t.arrowType===`elbow`,n.roundness=t.arrowType===`round`?{type:2}:null,!n.elbowed&&e.fixedSegments&&(n.fixedSegments=null))),Object.keys(n).length===0)return e;let i=$(e,n);return qH(i)&&!i.containerId?DP(i):i}function XH(e,t){let n=e.getState();if(e.setState({currentStyle:{...n.currentStyle,...t}}),n.selectedIds.size===0)return;let r=hR(n.elements,n.selectedIds);e.commit(({elements:e})=>{let i=e.map(e=>r.has(e.id)?YH(e,t):e);return{elements:_L(i.map((t,n)=>t.type===`arrow`&&t.elbowed&&!e[n].elbowed?Jz(t,i):t),n.selectedIds)}})}function ZH(e){let t=_R(e).filter(e=>!(e.type===`text`&&e.containerId));if(t.length>0)return t;switch(e.tool){case`rectangle`:case`diamond`:case`ellipse`:return[ON(e.tool,{},e.currentStyle)];case`arrow`:case`line`:case`freedraw`:return e.tool===`freedraw`?[{...ON(`rectangle`,{}),type:`freedraw`}]:[kN(e.tool,{},e.currentStyle)];case`text`:return[jN({text:``},e.currentStyle)];default:return[]}}var QH=({children:e,label:t,name:n})=>(0,j.jsxs)(`div`,{className:PL,"data-style-row":n??``,children:[(0,j.jsx)(`span`,{className:FL,children:t}),e]});function $H({choices:e,current:t,onPick:n}){let r=e.map(e=>({value:String(e.value),label:e.icon?(0,j.jsx)(e.icon,{"aria-label":e.label,size:15}):e.label}));return(0,j.jsx)(dD,{fullWidth:!0,items:r,size:`sm`,value:String(t),onChange:t=>{let r=e.find(e=>String(e.value)===t);r&&n(r.value)}})}function eU(e){let t=wL(e,e=>e);if(t.editingTextId||t.selectionBox)return null;let n=ZH(t);if(n.length===0)return null;let r=WH(n),i=t.selectedIds.size>0,a=e=>KH(n,e),o=t=>XH(e,t),s=(e,t)=>(0,j.jsx)(`div`,{className:IL,children:t.map(t=>(0,j.jsx)(`button`,{"aria-label":t,"aria-pressed":a(e)===t,className:`${LL}${t===`transparent`?` ${RL}`:``}`,"data-swatch":`${e}:${t}`,style:t===`transparent`?void 0:{background:t},type:`button`,onClick:()=>o({[e]:t})},t))}),c=(t,n,r)=>(0,j.jsx)(Pw,{icon:!0,"aria-label":t,size:`sm`,title:t,variant:`ghost`,onClick:()=>r(e),children:n},t),l=n.some(e=>(e.groupIds??[]).length>0),u=(0,j.jsxs)(j.Fragment,{children:[r.has(`stroke`)&&(0,j.jsx)(QH,{label:`Stroke`,children:s(`strokeColor`,DH)}),r.has(`background`)&&(0,j.jsx)(QH,{label:`Background`,children:s(`backgroundColor`,OH)}),r.has(`fillStyle`)&&(0,j.jsx)(QH,{label:`Fill`,children:(0,j.jsx)($H,{choices:kH,current:a(`fillStyle`),onPick:e=>o({fillStyle:e})})}),r.has(`strokeWidth`)&&(0,j.jsx)(QH,{label:`Stroke width`,children:(0,j.jsx)($H,{choices:AH,current:a(`strokeWidth`),onPick:e=>o({strokeWidth:e})})}),r.has(`strokeStyle`)&&(0,j.jsx)(QH,{label:`Stroke style`,children:(0,j.jsx)($H,{choices:jH,current:a(`strokeStyle`),onPick:e=>o({strokeStyle:e})})}),r.has(`roughness`)&&(0,j.jsx)(QH,{label:`Sloppiness`,children:(0,j.jsx)($H,{choices:MH,current:a(`roughness`),onPick:e=>o({roughness:e})})}),r.has(`roundness`)&&(0,j.jsx)(QH,{label:`Edges`,children:(0,j.jsx)($H,{choices:NH,current:a(`roundness`),onPick:e=>o({roundness:e})})}),r.has(`shadow`)&&(0,j.jsx)(QH,{label:`Shadow`,name:`shadow`,children:(0,j.jsx)($H,{choices:PH,current:a(`shadow`),onPick:e=>o({shadow:e})})}),r.has(`arrowType`)&&(0,j.jsx)(QH,{label:`Arrow type`,children:(0,j.jsx)($H,{choices:zH,current:a(`arrowType`),onPick:e=>o({arrowType:e})})}),r.has(`arrowheads`)&&(0,j.jsxs)(QH,{label:`Arrowheads`,children:[(0,j.jsx)($H,{choices:RH,current:a(`startArrowhead`),onPick:e=>o({startArrowhead:e})}),(0,j.jsx)($H,{choices:RH,current:a(`endArrowhead`),onPick:e=>o({endArrowhead:e})})]}),r.has(`fontSize`)&&(0,j.jsx)(QH,{label:`Font size`,children:(0,j.jsx)($H,{choices:FH,current:a(`fontSize`),onPick:e=>o({fontSize:e})})}),r.has(`fontFamily`)&&(0,j.jsx)(QH,{label:`Font`,children:(0,j.jsx)($H,{choices:IH,current:a(`fontFamily`),onPick:e=>o({fontFamily:e})})}),r.has(`textAlign`)&&(0,j.jsx)(QH,{label:`Align`,children:(0,j.jsx)($H,{choices:LH,current:a(`textAlign`),onPick:e=>o({textAlign:e})})}),(0,j.jsx)(QH,{label:`Opacity`,children:(0,j.jsx)(`input`,{"aria-label":`Opacity`,className:zL,max:100,min:0,step:10,type:`range`,value:typeof a(`opacity`)==`number`?a(`opacity`):100,onChange:e=>o({opacity:Number(e.target.value)})})}),i&&(0,j.jsx)(QH,{label:`Layers`,children:(0,j.jsxs)(`div`,{className:`_14kbw0vc`,children:[c(`Send to back`,(0,j.jsx)(dr,{}),SR),c(`Send backward`,(0,j.jsx)(bn,{}),wR),c(`Bring forward`,(0,j.jsx)(k,{}),CR),c(`Bring to front`,(0,j.jsx)(pr,{}),xR)]})}),i&&(0,j.jsx)(QH,{label:`Actions`,children:(0,j.jsxs)(`div`,{className:`_14kbw0vc`,children:[c(`Duplicate`,(0,j.jsx)(Qt,{}),DR),n.length>1&&c(`Group`,(0,j.jsx)(Cr,{}),TR),l&&c(`Ungroup`,(0,j.jsx)(Yr,{}),ER),c(`Delete`,(0,j.jsx)(or,{}),kR)]})})]});return A.Children.toArray(u.props.children)}var tU=({store:e})=>{let t=eU(e);return t?(0,j.jsx)(`div`,{"data-style-panel":!0,"data-whiteboard-chrome":!0,className:`${EL} ${NL}`,children:t}):null},nU=({store:e})=>{let t=eU(e),n=wL(e,e=>e.selectedIds.size>0),[r,i]=(0,A.useState)(!1);if(!t||!n)return null;let a=r?t:t.slice(0,4);return(0,j.jsxs)(`div`,{"data-style-sheet":!0,"data-whiteboard-chrome":!0,className:UL,children:[(0,j.jsx)(`div`,{className:WL}),a,t.length>4&&(0,j.jsx)(`button`,{"data-style-more":!0,className:`_14kbw0vm`,type:`button`,onClick:()=>i(e=>!e),children:r?`Fewer options`:`More styles and actions`})]})},rU=24,iU=({dark:e=!1,store:t})=>{let n=wL(t,e=>e.editingTextId),r=wL(t,e=>e.editingTextId?e.elements.find(t=>t.id===e.editingTextId):void 0),i=wL(t,e=>e.viewport),a=(0,A.useRef)(null);(0,A.useEffect)(()=>{let e=a.current;e&&(e.focus({preventScroll:!0}),e.setSelectionRange(e.value.length,e.value.length))},[n]);let o=(0,A.use)(eF);if(!n||!r)return null;let[s,c]=oz([r.x,r.y],i),l=i.zoom,u=r.lineHeight??GN(r.fontFamily);return(0,j.jsx)(`textarea`,{"data-whiteboard-text-editor":!0,className:PV,ref:a,spellCheck:!1,value:r.originalText??r.text,wrap:r.containerId?`soft`:`off`,style:{left:s,top:c,width:Math.max(rU,r.width)*l,height:Math.max(r.height,r.fontSize*u)*l,fontSize:r.fontSize*l,lineHeight:u,fontFamily:o&&rN(r.fontFamily)?o:iN(r.fontFamily),color:r.strokeColor,textAlign:r.textAlign,opacity:r.opacity/100,transform:FM(r)?`rotate(${FM(r)}rad)`:void 0,filter:e?cI:void 0},onBlur:()=>gL(t),onChange:e=>hL(t,e.target.value),onPointerDown:e=>e.stopPropagation(),onKeyDown:e=>{e.stopPropagation(),(e.key===`Escape`||e.key===`Enter`&&(e.metaKey||e.ctrlKey))&&(e.preventDefault(),gL(t))}})},aU=({compact:e=!1,store:t})=>{let n=wL(t,e=>e.viewport.zoom);return wL(t,e=>e.elements),(0,j.jsxs)(`div`,{"data-whiteboard-chrome":!0,className:`${EL} ${BL}${e?` ${VL}`:``}`,children:[(0,j.jsx)(Pw,{icon:!0,"aria-label":`Undo`,disabled:!t.canUndo(),size:`sm`,variant:`ghost`,onClick:()=>t.undo(),children:(0,j.jsx)(nr,{})}),(0,j.jsx)(Pw,{icon:!0,"aria-label":`Redo`,disabled:!t.canRedo(),size:`sm`,variant:`ghost`,onClick:()=>t.redo(),children:(0,j.jsx)(Jn,{})}),!e&&(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(`span`,{className:`_14kbw0v5`}),(0,j.jsx)(Pw,{icon:!0,"aria-label":`Zoom out`,size:`sm`,variant:`ghost`,onClick:()=>SH(t,1/1.2),children:(0,j.jsx)(Nn,{})}),(0,j.jsxs)(`button`,{"aria-label":`Reset zoom`,className:`_14kbw0vh`,type:`button`,onClick:()=>CH(t),children:[Math.round(n*100),`%`]}),(0,j.jsx)(Pw,{icon:!0,"aria-label":`Zoom in`,size:`sm`,variant:`ghost`,onClick:()=>SH(t,1.2),children:(0,j.jsx)(ar,{})})]})]})},oU=20,sU=new Set([`ArrowLeft`,`ArrowRight`,`ArrowUp`,`ArrowDown`]);function cU(e){return e instanceof Element&&(e.matches(`input, textarea, select`)||e.isContentEditable)}var lU=({chrome:e={},contextMenuItems:t,handFontOverride:n,initialFit:r=!0,onContextMenu:i,store:a,theme:o,toolbar:s=`inline`,tools:c,uploadFile:l,onUploadError:u})=>{let d=(0,A.useMemo)(()=>c?new Set(c):void 0,[c]),f=(0,A.useMemo)(wV,[]),p=(0,A.useRef)(null),m=(0,A.useRef)(null),h=(0,A.useRef)({});h.current={uploadFile:l,onUploadError:u};let g=(0,A.useMemo)(()=>({store:a,onFiles:(e,t)=>{e.forEach((e,n)=>{let r=n*oU;RR(a,e,[t[0]+r,t[1]+r],h.current)})},requestImage:e=>{m.current=e,p.current?.click()}}),[a]),_=NV(a,t,i),v=wL(a,e=>e.tool),y=TL(a),b=wL(a,e=>e.canvasSize.width),x=(0,A.useRef)(!1);return(0,A.useEffect)(()=>{if(x.current||b<=0||(x.current=!0,!r))return;let{elements:e,canvasSize:t}=a.getState(),n=e.filter(e=>!e.isDeleted);n.length!==0&&a.setState({viewport:cz(HM(n),t)})},[b,r,a]),(0,A.useEffect)(()=>{if(v!==`image`)return;let{viewport:e,canvasSize:t,toolLocked:n}=a.getState();g.requestImage?.(az([t.width/2,t.height/2],e)),n||a.setState({tool:`selection`})},[g,a,v]),(0,j.jsx)(eF,{value:n??null,children:(0,j.jsxs)(`div`,{"data-whiteboard-editor":!0,className:$R,onKeyDown:e=>{cU(e.target)||(e.target instanceof Element&&e.target.hasAttribute(`data-whiteboard-canvas`)||!sU.has(e.key))&&(TV(f,a.getState().tool).onKeyDown?.(g,e.nativeEvent)||EH(a,e,d))&&e.preventDefault()},children:[s===`inline`&&e.toolbar!==!1&&!y&&(0,j.jsx)(`div`,{className:`_14kbw0v2`,children:(0,j.jsx)(YL,{store:a,tools:d})}),(0,j.jsxs)(AV,{context:g,handlers:f,store:a,theme:o,onContextMenu:e.contextMenu===!1?void 0:_.open,children:[(0,j.jsx)(GV,{store:a}),(0,j.jsx)(iU,{dark:o===`dark`,store:a}),(0,j.jsx)(vH,{dark:o===`dark`,store:a}),(0,j.jsx)(LV,{store:a}),e.stylePanel!==!1&&(y?(0,j.jsx)(nU,{store:a}):(0,j.jsx)(tU,{store:a})),e.zoom!==!1&&(0,j.jsx)(aU,{compact:y,store:a}),_.menu,y&&e.mobileDock!==!1&&(0,j.jsx)(RV,{store:a,tools:d})]}),(0,j.jsx)(`input`,{hidden:!0,multiple:!0,accept:`image/*`,ref:p,type:`file`,onChange:e=>{let t=[...e.currentTarget.files??[]];e.currentTarget.value=``,t.length>0&&m.current&&g.onFiles?.(t,m.current)}})]})})};export{fk as $,ec as $i,pc as $n,So as $r,rw as $t,QP as A,lf as Aa,y_ as Ai,bb as An,nm as Ar,sE as At,BD as B,ma as Ba,mo as Bi,Yy as Bn,Tu as Br,mT as Bt,eP as C,oo as Ca,lo as Ci,Jx as Cn,B_ as Cr,rA as Ct,mP as D,tc as Da,iu as Di,Yb as Dn,V_ as Dr,aA as Dt,FP as E,W as Ea,dv as Ei,Ex as En,Ro as Er,iA as Et,hA as F,cm as Fa,fo as Fi,ob as Fn,Qp as Fr,pO as Ft,WD as G,Cr as Ga,Cf as Gi,kv as Gn,Du as Gr,_w as Gt,KD as H,Lr as Ha,L as Hi,_y as Hn,Um as Hr,CO as Ht,Pw as I,Xh as Ia,Vp as Ii,Sb as In,Fg as Ir,mE as It,mk as J,Xp as Ji,Lu as Jn,lg as Jr,vw as Jt,WO as K,Uo as Ki,yv as Kn,Po as Kr,yw as Kt,Kw as L,zo as La,rc as Li,ab as Ln,Do as Lr,GT as Lt,oP as M,Oo as Ma,$l as Mi,pb as Mn,zg as Mr,lE as Mt,_I as N,ac as Na,hm as Ni,fb as Nn,R as Nr,dA as Nt,cN as O,uo as Oa,td as Oi,Zb as On,_f as Or,uA as Ot,SA as P,Ba as Pa,Vf as Pi,gb as Pn,Mo as Pr,hT as Pt,sk as Q,Lm as Qi,em as Qn,gu as Qr,nw as Qt,gT as R,ha as Ra,ho as Ri,Wy as Rn,tm as Rr,fO as Rt,HM as S,$s as Sa,us as Si,Rx as Sn,Is as Sr,dD as St,jN as T,Ta,wo as Ti,Cx as Tn,vf as Tr,sA as Tt,VD as U,jr as Ua,ao as Ui,Lv as Un,sp as Ur,wO as Ut,UD as V,qr as Va,zf as Vi,Iy as Vn,jo as Vr,sO as Vt,GD as W,Dr as Wa,eg as Wi,Nv as Wn,Ps as Wr,fA as Wt,ok as X,lc as Xi,Wo as Xn,Nf as Xr,cw as Xt,ak as Y,Ng as Yi,jd as Yn,tv as Yr,lw as Yt,ck as Z,To as Zi,nh as Zn,Y as Zr,sw as Zt,hI as _,kf as _a,Id as _i,vS as _n,Ou as _r,jT as _t,fB as a,Mm as aa,Ru as ai,zC as an,jg as ar,gk as at,$ as b,Qs as ba,sd as bi,Wx as bn,Mf as br,OT as bt,WH as c,Xs as ca,rh as ci,JS as cn,Co as cr,jk as ct,TL as d,z as da,Ho as di,IS as dn,No as dr,Mk as dt,ed as ea,Zp as ei,qC as en,Ao as er,pk as et,wL as f,ro as fa,Xa as fi,HS as fn,$p as fr,DT as ft,cI as g,_o as ga,Al as gi,bS as gn,Fs as gr,MT as gt,NI as h,$d as ha,Af as hi,zS as hn,im as hr,NT as ht,XH as i,yo as ia,J_ as ii,VC as in,B as ir,rk as it,HP as j,dc as ja,su as ji,mb as jn,ap as jr,cE as jt,DP as k,xo as ka,co as ki,_b as kn,Lo as kr,pE as kt,EB as l,Lf as la,X_ as li,cC as ln,Ns as lr,Nk as lt,aL as m,hv as ma,N as mi,VS as mn,ko as mr,FT as mt,lU as n,Jf as na,uc as ni,JC as nn,qg as nr,lk as nt,CL as o,av as oa,Tf as oi,IC as on,af as or,xk as ot,sL as p,_m as pa,q as pi,LS as pn,vd as pr,PT as pt,nk as q,th as qi,bv as qn,Qa as qr,gw as qt,YL as r,ic as ra,Eo as ri,X as rn,bf as rr,uk as rt,gL as s,I as sa,Go as si,GC as sn,pd as sr,iE as st,rz as t,so as ta,Pg as ti,Z as tn,lm as tr,dk as tt,DB as u,Zs as ua,Df as ui,AS as un,mf as ur,Pk as ut,mI as v,ya as va,G as vi,Bx as vn,Fo as vr,kT as vt,EP as w,Js as wa,Yp as wi,Yx as wn,U as wr,oA as wt,sI as x,Zu as xa,go as xi,Vx as xn,V as xr,qk as xt,jP as y,tu as ya,mv as yi,Hx as yn,Za as yr,AT as yt,ID as z,pa as za,b_ as zi,rb as zn,J as zr,Fw as zt};