pillardash-ui-react 0.1.84 → 0.1.87

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -23,13 +23,13 @@ var N={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24"
23
23
  *
24
24
  * This source code is licensed under the ISC license.
25
25
  * See the LICENSE file in the root directory of this source tree.
26
- */const S=o((({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:o="",children:s,iconNode:a,...l},c)=>i("svg",{ref:c,...N,width:t,height:t,stroke:e,strokeWidth:r?24*Number(n)/Number(t):n,className:k("lucide",o),...!s&&!C(l)&&{"aria-hidden":"true"},...l},[...a.map((([e,t])=>i(e,t))),...Array.isArray(s)?s:[s]]))),M=(e,t)=>{const n=o((({className:n,...r},o)=>{return i(S,{ref:o,iconNode:t,className:k(`lucide-${s=w(e),s.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}`,`lucide-${e}`,n),...r});var s}));return n.displayName=w(e),n},T=M("bold",[["path",{d:"M6 12h9a4 4 0 0 1 0 8H7a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1h7a4 4 0 0 1 0 8",key:"mg9rjx"}]]),O=M("check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]),E=M("chevron-down",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]),A=M("chevron-left",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]),D=M("circle-alert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]]),R=M("circle-check-big",[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]]),L=M("circle-x",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]]),I=M("code",[["path",{d:"m16 18 6-6-6-6",key:"eg8j8"}],["path",{d:"m8 6-6 6 6 6",key:"ppft3o"}]]),z=M("download",[["path",{d:"M12 15V3",key:"m9g1x1"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["path",{d:"m7 10 5 5 5-5",key:"brsn70"}]]),P=M("ellipsis-vertical",[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"12",cy:"5",r:"1",key:"gxeob9"}],["circle",{cx:"12",cy:"19",r:"1",key:"lyex9k"}]]),B=M("file-code",[["path",{d:"M10 12.5 8 15l2 2.5",key:"1tg20x"}],["path",{d:"m14 12.5 2 2.5-2 2.5",key:"yinavb"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7z",key:"1mlx9k"}]]),$=M("file-spreadsheet",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M8 13h2",key:"yr2amv"}],["path",{d:"M14 13h2",key:"un5t4a"}],["path",{d:"M8 17h2",key:"2yhykz"}],["path",{d:"M14 17h2",key:"10kma7"}]]),V=M("file-text",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]]),j=M("file",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}]]),F=M("heading-1",[["path",{d:"M4 12h8",key:"17cfdx"}],["path",{d:"M4 18V6",key:"1rz3zl"}],["path",{d:"M12 18V6",key:"zqpxq5"}],["path",{d:"m17 12 3-2v8",key:"1hhhft"}]]),H=M("heading-2",[["path",{d:"M4 12h8",key:"17cfdx"}],["path",{d:"M4 18V6",key:"1rz3zl"}],["path",{d:"M12 18V6",key:"zqpxq5"}],["path",{d:"M21 18h-4c0-4 4-3 4-6 0-1.5-2-2.5-4-1",key:"9jr5yi"}]]),_=M("heading-3",[["path",{d:"M4 12h8",key:"17cfdx"}],["path",{d:"M4 18V6",key:"1rz3zl"}],["path",{d:"M12 18V6",key:"zqpxq5"}],["path",{d:"M17.5 10.5c1.7-1 3.5 0 3.5 1.5a2 2 0 0 1-2 2",key:"68ncm8"}],["path",{d:"M17 17.5c2 1.5 4 .3 4-1.5a2 2 0 0 0-2-2",key:"1ejuhz"}]]),q=M("info",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]]),W=M("italic",[["line",{x1:"19",x2:"10",y1:"4",y2:"4",key:"15jd3p"}],["line",{x1:"14",x2:"5",y1:"20",y2:"20",key:"bu0au3"}],["line",{x1:"15",x2:"9",y1:"4",y2:"20",key:"uljnxc"}]]),K=M("link",[["path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71",key:"1cjeqo"}],["path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71",key:"19qd67"}]]),J=M("list-ordered",[["path",{d:"M10 12h11",key:"6m4ad9"}],["path",{d:"M10 18h11",key:"11hvi2"}],["path",{d:"M10 6h11",key:"c7qv1k"}],["path",{d:"M4 10h2",key:"16xx2s"}],["path",{d:"M4 6h1v4",key:"cnovpq"}],["path",{d:"M6 18H4c0-1 2-2 2-3s-1-1.5-2-1",key:"m9a95d"}]]),U=M("list",[["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M3 18h.01",key:"1tta3j"}],["path",{d:"M3 6h.01",key:"1rqtza"}],["path",{d:"M8 12h13",key:"1za7za"}],["path",{d:"M8 18h13",key:"1lx6n3"}],["path",{d:"M8 6h13",key:"ik3vkj"}]]),G=M("quote",[["path",{d:"M16 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z",key:"rib7q0"}],["path",{d:"M5 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z",key:"1ymkrd"}]]),Y=M("redo-2",[["path",{d:"m15 14 5-5-5-5",key:"12vg1m"}],["path",{d:"M20 9H9.5A5.5 5.5 0 0 0 4 14.5A5.5 5.5 0 0 0 9.5 20H13",key:"6uklza"}]]),X=M("separator-vertical",[["path",{d:"M12 3v18",key:"108xh3"}],["path",{d:"m16 16 4-4-4-4",key:"1js579"}],["path",{d:"m8 8-4 4 4 4",key:"1whems"}]]),Q=M("strikethrough",[["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"}]]),Z=M("triangle-alert",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]),ee=M("underline",[["path",{d:"M6 4v6a6 6 0 0 0 12 0V4",key:"9kb039"}],["line",{x1:"4",x2:"20",y1:"20",y2:"20",key:"nun2al"}]]),te=M("undo-2",[["path",{d:"M9 14 4 9l5-5",key:"102s5s"}],["path",{d:"M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5a5.5 5.5 0 0 1-5.5 5.5H11",key:"f3b9sd"}]]),ne=M("x",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);
26
+ */const S=o((({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:o="",children:s,iconNode:a,...l},c)=>i("svg",{ref:c,...N,width:t,height:t,stroke:e,strokeWidth:r?24*Number(n)/Number(t):n,className:k("lucide",o),...!s&&!C(l)&&{"aria-hidden":"true"},...l},[...a.map((([e,t])=>i(e,t))),...Array.isArray(s)?s:[s]]))),M=(e,t)=>{const n=o((({className:n,...r},o)=>{return i(S,{ref:o,iconNode:t,className:k(`lucide-${s=w(e),s.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}`,`lucide-${e}`,n),...r});var s}));return n.displayName=w(e),n},T=M("bold",[["path",{d:"M6 12h9a4 4 0 0 1 0 8H7a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1h7a4 4 0 0 1 0 8",key:"mg9rjx"}]]),O=M("check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]),E=M("chevron-down",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]),A=M("chevron-left",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]),D=M("circle-alert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]]),R=M("circle-check-big",[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]]),L=M("circle-x",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]]),I=M("code",[["path",{d:"m16 18 6-6-6-6",key:"eg8j8"}],["path",{d:"m8 6-6 6 6 6",key:"ppft3o"}]]),z=M("download",[["path",{d:"M12 15V3",key:"m9g1x1"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["path",{d:"m7 10 5 5 5-5",key:"brsn70"}]]),P=M("ellipsis-vertical",[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"12",cy:"5",r:"1",key:"gxeob9"}],["circle",{cx:"12",cy:"19",r:"1",key:"lyex9k"}]]),B=M("file-code",[["path",{d:"M10 12.5 8 15l2 2.5",key:"1tg20x"}],["path",{d:"m14 12.5 2 2.5-2 2.5",key:"yinavb"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7z",key:"1mlx9k"}]]),$=M("file-spreadsheet",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M8 13h2",key:"yr2amv"}],["path",{d:"M14 13h2",key:"un5t4a"}],["path",{d:"M8 17h2",key:"2yhykz"}],["path",{d:"M14 17h2",key:"10kma7"}]]),V=M("file-text",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]]),j=M("file",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}]]),F=M("heading-1",[["path",{d:"M4 12h8",key:"17cfdx"}],["path",{d:"M4 18V6",key:"1rz3zl"}],["path",{d:"M12 18V6",key:"zqpxq5"}],["path",{d:"m17 12 3-2v8",key:"1hhhft"}]]),H=M("heading-2",[["path",{d:"M4 12h8",key:"17cfdx"}],["path",{d:"M4 18V6",key:"1rz3zl"}],["path",{d:"M12 18V6",key:"zqpxq5"}],["path",{d:"M21 18h-4c0-4 4-3 4-6 0-1.5-2-2.5-4-1",key:"9jr5yi"}]]),_=M("heading-3",[["path",{d:"M4 12h8",key:"17cfdx"}],["path",{d:"M4 18V6",key:"1rz3zl"}],["path",{d:"M12 18V6",key:"zqpxq5"}],["path",{d:"M17.5 10.5c1.7-1 3.5 0 3.5 1.5a2 2 0 0 1-2 2",key:"68ncm8"}],["path",{d:"M17 17.5c2 1.5 4 .3 4-1.5a2 2 0 0 0-2-2",key:"1ejuhz"}]]),q=M("info",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]]),W=M("italic",[["line",{x1:"19",x2:"10",y1:"4",y2:"4",key:"15jd3p"}],["line",{x1:"14",x2:"5",y1:"20",y2:"20",key:"bu0au3"}],["line",{x1:"15",x2:"9",y1:"4",y2:"20",key:"uljnxc"}]]),K=M("link",[["path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71",key:"1cjeqo"}],["path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71",key:"19qd67"}]]),J=M("list-ordered",[["path",{d:"M10 12h11",key:"6m4ad9"}],["path",{d:"M10 18h11",key:"11hvi2"}],["path",{d:"M10 6h11",key:"c7qv1k"}],["path",{d:"M4 10h2",key:"16xx2s"}],["path",{d:"M4 6h1v4",key:"cnovpq"}],["path",{d:"M6 18H4c0-1 2-2 2-3s-1-1.5-2-1",key:"m9a95d"}]]),U=M("list",[["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M3 18h.01",key:"1tta3j"}],["path",{d:"M3 6h.01",key:"1rqtza"}],["path",{d:"M8 12h13",key:"1za7za"}],["path",{d:"M8 18h13",key:"1lx6n3"}],["path",{d:"M8 6h13",key:"ik3vkj"}]]),G=M("quote",[["path",{d:"M16 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z",key:"rib7q0"}],["path",{d:"M5 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z",key:"1ymkrd"}]]),Y=M("redo-2",[["path",{d:"m15 14 5-5-5-5",key:"12vg1m"}],["path",{d:"M20 9H9.5A5.5 5.5 0 0 0 4 14.5A5.5 5.5 0 0 0 9.5 20H13",key:"6uklza"}]]),X=M("separator-vertical",[["path",{d:"M12 3v18",key:"108xh3"}],["path",{d:"m16 16 4-4-4-4",key:"1js579"}],["path",{d:"m8 8-4 4 4 4",key:"1whems"}]]),Q=M("strikethrough",[["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"}]]),Z=M("triangle-alert",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]),ee=M("underline",[["path",{d:"M6 4v6a6 6 0 0 0 12 0V4",key:"9kb039"}],["line",{x1:"4",x2:"20",y1:"20",y2:"20",key:"nun2al"}]]),te=M("undo-2",[["path",{d:"M9 14 4 9l5-5",key:"102s5s"}],["path",{d:"M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5a5.5 5.5 0 0 1-5.5 5.5H11",key:"f3b9sd"}]]),ne=M("upload",[["path",{d:"M12 3v12",key:"1x0j5s"}],["path",{d:"m17 8-5-5-5 5",key:"7q97r8"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}]]),re=M("x",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);
27
27
  /**
28
28
  * @license lucide-react v0.511.0 - ISC
29
29
  *
30
30
  * This source code is licensed under the ISC license.
31
31
  * See the LICENSE file in the root directory of this source tree.
32
- */var re;function oe(){var n=s(!1),r=n[0],o=n[1],i=a(null),c=function(e){o(!1)};return l((function(){var e=function(e){i.current&&!i.current.contains(e.target)&&o(!1)};return document.addEventListener("mousedown",e),function(){document.removeEventListener("mousedown",e)}}),[]),t("div",{className:"relative inline-block",ref:i,children:[t("div",{className:"flex",children:[t("button",{className:"flex items-center rounded-l-md border border-gray-300 bg-white px-4 py-2 text-sm font-medium text-gray-700 hover:bg-gray-50 focus:outline-none",onClick:function(){return c(re.PDF)},children:[e(z,{className:"mr-2 h-4 w-4"}),"Export"]}),e("button",{className:"rounded-r-md border border-l-0 border-gray-300 bg-white px-2 py-2 text-sm font-medium text-gray-700 hover:bg-gray-50 focus:outline-none",onClick:function(){o(!r)},children:e(E,{className:"h-4 w-4"})})]}),r&&e("div",{className:"absolute right-0 z-10 mt-1 w-48 origin-top-right rounded-md bg-white shadow-lg ring-1 ring-black ring-opacity-5 focus:outline-none",children:t("div",{className:"py-1",children:[t("button",{onClick:function(){return c(re.PDF)},className:"flex w-full items-center px-4 py-2 text-left text-sm text-gray-700 hover:bg-gray-100",children:[e(V,{className:"mr-2 h-4 w-4"}),"PDF Document"]}),t("button",{onClick:function(){return c(re.CSV)},className:"flex w-full items-center px-4 py-2 text-left text-sm text-gray-700 hover:bg-gray-100",children:[e($,{className:"mr-2 h-4 w-4"}),"CSV Spreadsheet"]}),t("button",{onClick:function(){return c(re.EXCEL)},className:"flex w-full items-center px-4 py-2 text-left text-sm text-gray-700 hover:bg-gray-100",children:[e($,{className:"mr-2 h-4 w-4"}),"Excel Spreadsheet"]})]})})]})}!function(e){e[e.PDF=0]="PDF",e[e.CSV=1]="CSV",e[e.EXCEL=2]="EXCEL",e[e.JSON=3]="JSON"}(re||(re={}));var ie=function(t){var n=t.children,r=t.className,o=void 0===r?"":r,i=t.glass,s=void 0!==i&&i,a="".concat("\n w-full\n rounded-2xl\n shadow-xl\n transition-all\n duration-300\n ease-out\n hover:-translate-y-0.5\n p-5\n relative\n "," ").concat(s?"\n backdrop-blur-xl\n bg-white/20\n border\n border-white/30\n shadow-lg\n hover:shadow-xl\n hover:bg-white/30\n before:absolute\n before:inset-0\n before:rounded-2xl\n before:bg-gradient-to-br\n before:from-white/10\n before:to-transparent\n before:pointer-events-none\n ":"\n backdrop-blur-2xl\n bg-white\n border\n border-[#EEEEF0]\n shadow-black/0\n hover:shadow-2xl\n hover:shadow-black/10\n hover:bg-white/90\n before:absolute\n before:inset-0\n before:rounded-2xl\n before:bg-gradient-to-br\n before:from-white/10\n before:to-transparent\n before:pointer-events-none\n "," ").concat(o);return e("div",{className:a,children:n})};function se(n){var r=n.title,o=void 0===r?"No Record Found":r,i=n.onClick,s=n.btnText,a=n.description,l=void 0===a?"":a,c=n.className,d=void 0===c?"":c,h=n.icon;return e("div",{className:"my-2 flex min-h-[320px] w-full flex-col items-center justify-center rounded-lg bg-gray-50 p-8 text-center ".concat(d," "),"aria-live":"polite",children:t("div",{className:"max-w-md space-y-4",children:[h&&e("div",{className:"mx-auto h-16 w-16 text-gray-300",children:h}),e("h2",{className:"text-xl font-medium text-gray-900",children:o}),l&&e("p",{className:"text-gray-500",children:l}),s&&i&&e("div",{className:"mt-6",children:e(x,{onClick:i,size:"medium",children:s})})]})})}var ae=function(){return ae=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},ae.apply(this,arguments)};function le(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}return n}function ce(e,t,n){if(n||2===arguments.length)for(var r,o=0,i=t.length;o<i;o++)!r&&o in t||(r||(r=Array.prototype.slice.call(t,0,o)),r[o]=t[o]);return e.concat(r||Array.prototype.slice.call(t))}"function"==typeof SuppressedError&&SuppressedError;var de=function(n){var r=n.variant,o=void 0===r?"check":r,i=n.size,a=void 0===i?"sm":i,c=n.checked,d=void 0!==c&&c,h=n.disabled,u=void 0!==h&&h,p=n.onChange,f=n.label,m=n.labelPosition,g=void 0===m?"right":m,y=n.name,v=n.value,b=n.id,x=n.className,w=void 0===x?"":x,k=n.error,C=n.helperText,N=n.required,S=void 0!==N&&N,M=n.indeterminate,T=void 0!==M&&M,O=s(d),E=O[0],A=O[1],D=s(T),R=D[0],L=D[1];l((function(){A(d)}),[d]),l((function(){L(T)}),[T]);var I=function(){if(!u){var e=!E;A(e),L(!1),null==p||p(e)}},z={sm:{container:"h-4 w-4",toggle:"w-8 h-4",toggleCircle:"h-3 w-3",text:"text-sm"},md:{container:"h-5 w-5",toggle:"w-10 h-5",toggleCircle:"h-4 w-4",text:"text-base"},lg:{container:"h-6 w-6",toggle:"w-12 h-6",toggleCircle:"h-5 w-5",text:"text-lg"}},P=b||"checkbox-".concat(Math.random().toString(36).substr(2,9));return t("div",{className:"flex items-start gap-2 ".concat(w),children:[f&&"left"===g&&t("label",{htmlFor:P,className:"".concat(z[a].text," ").concat(u?"text-gray-400":k?"text-red-600":"text-gray-700"," cursor-pointer select-none"),children:[f,S&&e("span",{className:"text-red-500 ml-1",children:"*"})]}),t("div",{className:"flex flex-col",children:[t("div","toggle"===o?{className:"relative rounded-full transition-colors duration-200 ".concat(z[a].toggle," ").concat(E?"bg-primary":"bg-gray-300"," ").concat(u?"cursor-not-allowed opacity-50":"cursor-pointer","\n ").concat(k?"ring-2 ring-red-300":""),onClick:I,children:[e("div",{className:"absolute top-0.5 transform rounded-full bg-white shadow-sm transition-transform duration-200 ".concat(z[a].toggleCircle," ").concat(E?"translate-x-full":"translate-x-0.5")}),e("input",{type:"checkbox",id:P,name:y,value:v,checked:E,onChange:I,disabled:u,className:"sr-only",required:S})]}:{className:"relative",children:[e("input",{type:"dot"===o?"radio":"checkbox",id:P,name:y,value:v,checked:E,onChange:I,disabled:u,required:S,className:"sr-only"}),t("div",{className:"".concat(z[a].container," ").concat("check"===o?"rounded-md":"rounded-full"," flex items-center justify-center border-2 transition-all duration-200 ").concat(E||R?"border-primary bg-primary":k?"border-red-300 bg-red-50":"border-gray-300 bg-white hover:border-gray-400"," ").concat(u?"cursor-not-allowed opacity-50":"cursor-pointer","\n focus-within:ring-2 focus-within:ring-primary focus-within:ring-offset-2"),onClick:I,children:[E&&"check"===o&&e("svg",{className:"h-3 w-3 text-white",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:3,children:e("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 13l4 4L19 7"})}),R&&"check"===o&&e("div",{className:"h-0.5 w-2.5 bg-white rounded-full"}),E&&"dot"===o&&e("div",{className:"h-1.5 w-1.5 rounded-full bg-white"})]})]}),k&&t("p",{className:"mt-1 text-xs text-red-600 flex items-center",children:[e("svg",{className:"w-3 h-3 mr-1",fill:"currentColor",viewBox:"0 0 20 20",children:e("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7 4a1 1 0 11-2 0 1 1 0 012 0zm-1-9a1 1 0 00-1 1v4a1 1 0 102 0V6a1 1 0 00-1-1z",clipRule:"evenodd"})}),k]}),C&&!k&&e("p",{className:"mt-1 text-xs text-gray-500",children:C})]}),f&&"right"===g&&t("label",{htmlFor:P,className:"".concat(z[a].text," ").concat(u?"text-gray-400":k?"text-red-600":"text-gray-700"," cursor-pointer select-none"),children:[f,S&&e("span",{className:"text-red-500 ml-1",children:"*"})]})]})},he=function(n){var r=n.name,o=n.value,i=n.onChange,s=n.options,a=n.size,l=void 0===a?"md":a,c=n.className,d=void 0===c?"":c,h=n.error,u=n.helperText,p=n.required,f=void 0!==p&&p,m=n.label,g=n.direction,y=void 0===g?"vertical":g;return t("div",{className:"space-y-2 ".concat(d),children:[m&&t("label",{className:"block text-sm font-medium text-gray-700",children:[m,f&&e("span",{className:"text-red-500 ml-1",children:"*"})]}),e("div",{className:"flex ".concat("horizontal"===y?"flex-row gap-6":"flex-col gap-2"),children:s.map((function(t){return e(de,{variant:"dot",size:l,name:r,value:t.value,checked:o===t.value,onChange:function(){return e=t.value,void(null==i||i(e));var e},label:t.label,disabled:t.disabled,error:h,required:f},t.value)}))}),h&&t("p",{className:"text-xs text-red-600 flex items-center",children:[e("svg",{className:"w-3 h-3 mr-1",fill:"currentColor",viewBox:"0 0 20 20",children:e("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7 4a1 1 0 11-2 0 1 1 0 012 0zm-1-9a1 1 0 00-1 1v4a1 1 0 102 0V6a1 1 0 00-1-1z",clipRule:"evenodd"})}),h]}),u&&!h&&e("p",{className:"text-xs text-gray-500",children:u})]})};function ue(){var n=s("option1"),r=n[0],o=n[1],i=s({terms:!1,newsletter:!0,notifications:!1}),a=i[0],l=i[1];return e("div",{className:"min-h-screen bg-gray-50 p-8",children:e("div",{className:"mx-auto max-w-2xl space-y-8",children:t("div",{className:"rounded-lg bg-white p-6 shadow",children:[e("h2",{className:"mb-6 text-xl font-semibold",children:"CheckBox Component Demo"}),t("div",{className:"space-y-8",children:[t("div",{className:"space-y-4",children:[e("h3",{className:"font-medium",children:"Check Variant"}),t("div",{className:"flex flex-wrap items-center gap-6",children:[e(de,{variant:"check",size:"sm",label:"Small"}),e(de,{variant:"check",size:"md",checked:!0,label:"Medium"}),e(de,{variant:"check",size:"lg",label:"Large"}),e(de,{variant:"check",disabled:!0,label:"Disabled"}),e(de,{variant:"check",indeterminate:!0,label:"Indeterminate"})]})]}),t("div",{className:"space-y-4",children:[e("h3",{className:"font-medium",children:"Radio Group (Dot Variant)"}),e(he,{name:"demo-radio",value:r,onChange:o,label:"Choose an option",options:[{value:"option1",label:"Option 1"},{value:"option2",label:"Option 2"},{value:"option3",label:"Option 3"},{value:"option4",label:"Option 4 (Disabled)",disabled:!0}],helperText:"Select one option from the list"})]}),t("div",{className:"space-y-4",children:[e("h3",{className:"font-medium",children:"Toggle Variant"}),t("div",{className:"flex flex-wrap items-center gap-6",children:[e(de,{variant:"toggle",size:"sm",label:"Small"}),e(de,{variant:"toggle",size:"md",checked:!0,label:"Medium"}),e(de,{variant:"toggle",size:"lg",label:"Large"}),e(de,{variant:"toggle",disabled:!0,label:"Disabled"})]})]}),t("div",{className:"space-y-4 border-t pt-6",children:[e("h3",{className:"font-medium",children:"Sample Form"}),t("div",{className:"space-y-4",children:[e(de,{variant:"check",checked:a.terms,onChange:function(e){return l(ae(ae({},a),{terms:e}))},label:"I accept the terms and conditions",required:!0,error:a.terms?"":"Please accept terms to continue"}),e(de,{variant:"toggle",checked:a.newsletter,onChange:function(e){return l(ae(ae({},a),{newsletter:e}))},label:"Subscribe to newsletter",helperText:"Get updates about new features and releases"}),e(de,{variant:"check",checked:a.notifications,onChange:function(e){return l(ae(ae({},a),{notifications:e}))},label:"Enable push notifications"}),e("div",{className:"pt-4",children:e("button",{className:"rounded-md bg-primary px-4 py-2 text-white transition-colors hover:bg-primary/90 disabled:opacity-50",disabled:!a.terms,children:"Submit"})})]})]})]})]})})})}var pe=function(r){var o=r.label,i=r.description,a=r.helperText,l=r.error,c=r.success,d=r.disabled,h=void 0!==d&&d,u=r.required,p=void 0!==u&&u,f=r.accept,m=r.multiple,g=void 0!==m&&m,y=r.placeholder,v=r.showProgress,b=void 0===v||v,x=r.className,w=void 0===x?"":x,k=r.id,C=r.maxFileSize,N=r.onFileChange,S=r.direction,M=void 0===S?"col":S,T=s(null),O=T[0],E=T[1],A=s(0),L=A[0],I=A[1],z=s(!1),P=z[0],B=z[1],$=k||"file-upload-".concat(Math.random().toString(36).substr(2,9));return t("div",{className:"space-y-2 ".concat(w),children:[o&&t("label",{htmlFor:$,className:"block text-sm font-medium text-gray-700",children:[o,p&&e("span",{className:"text-red-500 ml-1",children:"*"})]}),i&&e("p",{className:"text-sm text-gray-600",children:i}),t("div",O?{className:"rounded-lg border p-4 ".concat(c?"border-green-300 bg-green-50":"border-gray-200"),children:[t("div",{className:"flex items-center justify-between",children:[t("div",{className:"flex items-center",children:[e("div",{className:"mr-3 rounded-lg bg-primary-100 p-2 w-12 h-12 flex items-center justify-center overflow-hidden",children:O.type.startsWith("image/")?e("img",{src:URL.createObjectURL(O),alt:"preview",width:48,height:48,className:"object-cover w-full h-full rounded"}):"application/pdf"===O.type?e("iframe",{src:URL.createObjectURL(O),title:"PDF icon preview",className:"w-full h-full rounded"}):e(j,{size:24,className:"text-primary-500"})}),t("div",{children:[e("p",{className:"text-sm font-medium",children:O.name}),e("p",{className:"text-xs text-gray-500",children:function(e){if(0===e)return"0 Bytes";var t=Math.floor(Math.log(e)/Math.log(1024));return parseFloat((e/Math.pow(1024,t)).toFixed(2))+" "+["Bytes","KB","MB","GB"][t]}(O.size)})]})]}),e("button",{onClick:function(){E(null),I(0),N(null)},className:"text-red-500 hover:text-red-700 disabled:opacity-50",disabled:h,children:e(ne,{size:16})})]}),b&&L<100&&t(n,{children:[e("div",{className:"h-2.5 w-full rounded-full bg-secondary-200",children:e("div",{className:"h-2.5 rounded-full bg-primary-800 transition-all duration-300",style:{width:"".concat(L,"%")}})}),t("p",{className:"mt-1 text-right text-xs text-gray-500",children:[L,"%"]})]}),b&&100===L&&t("div",{className:"flex items-center text-green-600 text-sm",children:[e(R,{size:16,className:"mr-1"}),"Upload complete"]})]}:{className:"\n flex flex-".concat(M," gap-2 rounded-lg border-2 border-dashed p-8 text-center items-center\n ").concat("row"===M?"justify-center":"","\n ").concat(P?"border-blue-400 bg-blue-50":"border-gray-300","\n ").concat(l?"border-red-300 bg-red-50":"","\n ").concat(c?"border-green-300 bg-green-50":"","\n ").concat(h?"opacity-50 cursor-not-allowed bg-gray-50":"cursor-pointer hover:border-gray-400","\n "),onDragOver:function(e){e.preventDefault(),h||B(!0)},onDragLeave:function(e){e.preventDefault(),B(!1)},onDrop:function(e){if(e.preventDefault(),B(!1),!h&&e.dataTransfer.files&&e.dataTransfer.files[0]){var t=e.dataTransfer.files[0];if(E(t),b){I(10);var n=setInterval((function(){I((function(e){return e>=100?(clearInterval(n),100):e+10}))}),300)}N(t)}},onClick:function(){var e;return!h&&(null===(e=document.getElementById($))||void 0===e?void 0:e.click())},children:[e("p",{className:"text-sm ".concat(h?"text-gray-400":"text-primary-700 hover:underline"),children:y||"Click to Upload"}),e("input",{id:$,type:"file",className:"hidden",onChange:function(e){if(e.target.files&&e.target.files[0]){var t=e.target.files[0];if(E(t),b){I(10);var n=setInterval((function(){I((function(e){return e>=100?(clearInterval(n),100):e+10}))}),300)}N(t)}},accept:f,multiple:g,disabled:h,required:p}),e("p",{className:"text-gray-900 text-sm",children:"or drag and drop"}),t("p",{className:"text-sm text-gray-500",children:["(Max. File size: ",C||"25"," MB)"]})]}),a&&!l&&!c&&e("p",{className:"text-sm text-gray-500",children:a}),l&&t("div",{className:"flex items-center text-red-600 text-sm",children:[e(D,{size:16,className:"mr-1"}),l]}),c&&t("div",{className:"flex items-center text-green-600 text-sm",children:[e(R,{size:16,className:"mr-1"}),c]})]})},fe=function(n){var r=n.id,o=n.label,i=n.value,s=n.size,a=void 0===s?"md":s,l=n.onChange,c=n.placeholder,d=n.error,h=n.required,u=void 0!==h&&h,p=n.helpText,f=n.type,m=void 0===f?"text":f,g=n.className,y=void 0===g?"":g,v=n.disabled,b=void 0!==v&&v,x=n.icon,w=n.iconPosition,k=void 0===w?"left":w,C=n.rightIcon,N=le(n,["id","label","value","size","onChange","placeholder","error","required","helpText","type","className","disabled","icon","iconPosition","rightIcon"]),S={id:r,value:i,onChange:function(e){l&&l(e)},placeholder:c,disabled:b,className:"w-full rounded-[12px] border ".concat({sm:"text-xs px-3 py-1.5 text-sm min-h-[32px]",md:"text-sm px-4 py-2 text-base min-h-[40px]",lg:"text-base px-4 py-3 text-lg min-h-[48px]"}[a]," ").concat(d?"border-red-500":"border-gray-200"," ").concat(b?"bg-gray-100 text-gray-500 placeholder-gray-300":"bg-gray-100 placeholder-gray-400 text-dark"," focus:outline-none focus:ring-1 focus:ring-primary ").concat(y," ").concat(x&&"left"===k?"pl-10":""," ").concat(x&&"right"===k?"pr-10":""),"aria-invalid":!!d,"aria-describedby":d?"".concat(r,"-error"):p?"".concat(r,"-help"):void 0};return t("div",{className:"mb-4",children:[o&&t("label",{htmlFor:r,className:"mb-1 block text-sm font-medium text-gray-600",children:[o,u&&e("span",{className:"ml-1 text-red-500",children:"*"})]}),t("div",{className:"relative",children:[x&&"left"===k&&e("div",{className:"pointer-events-none absolute inset-y-0 left-0 flex items-center pl-3",children:x}),"textarea"==m?e("textarea",ae({},S,{rows:4,className:"".concat(S.className," resize-none")},N)):e("input",ae({},S,{type:m},N)),x&&"right"===k&&e("div",{className:"pointer-events-none absolute inset-y-0 right-0 flex items-center pr-3",children:x}),C&&e("div",{className:"absolute right-3 top-1/2 -translate-y-1/2 cursor-pointer",children:C})]}),p&&!d&&e("p",{id:"".concat(r,"-help"),className:"mt-1 text-sm text-gray-500",children:p}),d&&e("p",{id:"".concat(r,"-error"),className:"mt-1 text-sm text-red-500",children:d})]})},me=function(n){var r=n.id,o=n.label,i=n.value,s=n.size,a=void 0===s?"md":s,l=n.onChange,c=n.placeholder,d=n.error,h=n.required,u=void 0!==h&&h,p=n.helpText,f=n.type,m=void 0===f?"text":f,g=n.className,y=void 0===g?"":g,v=n.disabled,b=void 0!==v&&v,x=n.icon,w=n.iconPosition,k=void 0===w?"left":w,C=n.rightIcon,N=n.prefixContent,S=n.prefixClassName,M=void 0===S?"":S;n.onPrefixChange;var T,O,E=le(n,["id","label","value","size","onChange","placeholder","error","required","helpText","type","className","disabled","icon","iconPosition","rightIcon","prefixContent","prefixClassName","onPrefixChange"]),A="\n flex-1 rounded-none rounded-r-[12px] border-l-0 ".concat({sm:"text-xs py-1.5 text-sm min-h-[32px]",md:"text-sm py-2 text-base min-h-[40px]",lg:"text-base py-3 text-lg min-h-[48px]"}[a]," \n ").concat(d?"border-red-500":"border-gray-200","\n ").concat(b?"bg-gray-100 text-gray-500 placeholder-gray-300":"bg-gray-100 placeholder-gray-400 text-dark","\n focus:outline-none\n ").concat((T="",O="",x&&"left"===k&&(T="pl-10"),x&&"right"===k&&(O="pr-10"),C&&(O="pr-10"),"".concat(T," ").concat(O)),"\n ").concat(y,"\n "),D="\n flex items-center rounded-l-[12px] border border-r-0 ".concat({sm:"px-1 text-xs",md:"px-2 text-sm",lg:"px-4 text-base"}[a],"\n ").concat(d?"border-red-500":"border-gray-200","\n ").concat(b?"bg-gray-50":"","\n ").concat(M,"\n "),R={id:r,value:i,onChange:function(e){l&&l(e)},placeholder:c,disabled:b,className:A,"aria-invalid":!!d,"aria-describedby":d?"".concat(r,"-error"):p?"".concat(r,"-help"):void 0};return t("div",{className:"mb-4",children:[o&&t("label",{htmlFor:r,className:"mb-1 block text-sm font-medium text-gray-600",children:[o,u&&e("span",{className:"ml-1 text-red-500",children:"*"})]}),e("div",{className:"relative",children:t("div",{className:"flex",children:[N&&e("div",{className:D,children:N}),t("div",{className:"relative ".concat(N?"flex-1":"w-full"),children:[x&&"left"===k&&e("div",{className:"pointer-events-none absolute inset-y-0 left-0 flex items-center pl-3 z-10",children:x}),e("input",ae({},R,{type:m,className:"".concat(R.className," ").concat(N?"w-full border px-3":"rounded-l-[12px] border-l")},E)),x&&"right"===k&&e("div",{className:"pointer-events-none absolute inset-y-0 right-0 flex items-center pr-3 z-10",children:x}),C&&e("div",{className:"absolute right-3 top-1/2 -translate-y-1/2 cursor-pointer z-10",children:C})]})]})}),p&&!d&&e("p",{id:"".concat(r,"-help"),className:"mt-1 text-sm text-gray-500",children:p}),d&&e("p",{id:"".concat(r,"-error"),className:"mt-1 text-sm text-red-500",children:d})]})},ge=function(r){var o=r.id,i=r.label,d=r.value,h=void 0===d?[]:d,u=r.size,p=void 0===u?"md":u,f=r.onChange,m=r.placeholder,g=void 0===m?"Type to search or add tags...":m,y=r.error,v=r.required,b=void 0!==v&&v,x=r.helpText,w=r.className,k=void 0===w?"":w,C=r.disabled,N=void 0!==C&&C,S=r.predefinedTags,M=void 0===S?[]:S,T=r.tagBackgroundColor,O=void 0===T?"bg-primary":T,E=r.tagTextColor,A=void 0===E?"text-white":E,D=r.maxTags,R=r.allowCustomTags,L=void 0===R||R;le(r,["id","label","value","size","onChange","placeholder","error","required","helpText","className","disabled","predefinedTags","tagBackgroundColor","tagTextColor","maxTags","allowCustomTags"]);var I=s(""),z=I[0],P=I[1],B=s(!1),$=B[0],V=B[1],j=a(null),F=a(null),H={sm:"text-xs px-2 py-0.5",md:"text-sm px-2 py-1",lg:"text-base px-3 py-1.5"},_=c((function(){return z?M.filter((function(e){return e.label.toLowerCase().includes(z.toLowerCase())&&!h.some((function(t){return t===e.value}))})):M.filter((function(e){return!h.some((function(t){return t===e.value}))}))}),[z,M,h]);l((function(){var e=function(e){F.current&&!F.current.contains(e.target)&&V(!1)};return document.addEventListener("mousedown",e),function(){return document.removeEventListener("mousedown",e)}}),[]);var q=function(e){if(e&&!(D&&h.length>=D)&&!h.find((function(t){return t.toLowerCase()===e.toLowerCase()}))){var t,n=M.find((function(t){return t.label.toLowerCase()===e.toLowerCase()||t.value.toLowerCase()===e.toLowerCase()}));if(n)t=n.value;else{if(!L)return;t=e}var r=ce(ce([],h,!0),[t],!1);null==f||f(r),P(""),V(!1)}},W=function(e){var t=h.filter((function(t){return t!==e}));null==f||f(t)};return t("div",{className:"mb-4",children:[i&&t("label",{htmlFor:o,className:"mb-1 block text-sm font-medium text-gray-600",children:[i,b&&e("span",{className:"ml-1 text-red-500",children:"*"})]}),t("div",{className:"relative",ref:F,children:[t("div",{className:"w-full rounded-[12px] border ".concat(y?"border-red-500":"border-gray-200"," ").concat(N?"bg-gray-100 text-gray-500":"bg-gray-100 text-dark"," focus-within:outline-none focus-within:ring-1 focus-within:ring-primary ").concat(k," ").concat({sm:"text-xs px-3 py-1.5 text-sm min-h-[32px]",md:"text-sm px-4 py-2 text-base min-h-[40px]",lg:"text-base px-4 py-3 text-lg min-h-[48px]"}[p]," flex flex-wrap items-center gap-1"),children:[h.map((function(n){return t("span",{className:"inline-flex items-center rounded-full ".concat(O," ").concat(A," ").concat(H[p]," font-medium"),children:[n,!N&&e("button",{type:"button",onClick:function(){return W(n)},className:"ml-1 inline-flex h-4 w-4 items-center justify-center rounded-full hover:bg-black hover:bg-opacity-20",children:e("svg",{className:"h-3 w-3",fill:"currentColor",viewBox:"0 0 20 20",children:e("path",{fillRule:"evenodd",d:"M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z",clipRule:"evenodd"})})})]},n)})),e("input",{ref:j,id:o,type:"text",value:z,onChange:function(e){var t=e.target.value;P(t),V(!0)},onKeyDown:function(e){"Enter"===e.key&&z.trim()?(e.preventDefault(),q(z.trim())):"Backspace"===e.key&&!z&&h.length>0?W(h[h.length-1]):"Escape"===e.key&&(V(!1),P(""))},onFocus:function(){V(!0)},placeholder:0===h.length?g:"",disabled:N||D&&h.length>=D,className:"flex-1 border-none bg-transparent outline-none placeholder-gray-400 min-w-[120px]","aria-invalid":!!y,"aria-describedby":y?"".concat(h,"-error"):x?"".concat(h,"-help"):void 0})]}),$&&!N&&(_.length>0||z&&L)&&t("div",{className:"absolute z-10 mt-1 w-full bg-white border border-gray-200 rounded-[12px] shadow-lg backdrop-blur-sm bg-white/95 max-h-60 overflow-auto p-4",children:[_.length>0&&e("div",{className:"flex flex-wrap gap-2 mb-3",children:_.map((function(t){return e("button",{type:"button",onClick:function(){return function(e){q(e.value)}(t)},className:"inline-flex items-center rounded-full bg-gray-200 text-gray-700 hover:bg-gray-300 transition-colors duration-200 ".concat(H[p]," font-medium"),children:t.label},t.value)}))}),z&&L&&!M.some((function(e){return e.label.toLowerCase()===z.toLowerCase()}))&&t(n,{children:[_.length>0&&e("div",{className:"border-t border-gray-100 pt-3 mb-2",children:e("span",{className:"text-xs text-gray-500 font-medium",children:"CREATE NEW TAG"})}),e("div",{className:"flex flex-wrap gap-2",children:t("button",{type:"button",onClick:function(){return q(z)},className:"inline-flex items-center rounded-full bg-blue-100 text-blue-700 hover:bg-blue-200 transition-colors duration-200 ".concat(H[p]," font-medium border border-blue-200"),children:[e("svg",{className:"w-3 h-3 mr-1",fill:"currentColor",viewBox:"0 0 20 20",children:e("path",{fillRule:"evenodd",d:"M10 3a1 1 0 011 1v5h5a1 1 0 110 2h-5v5a1 1 0 11-2 0v-5H4a1 1 0 110-2h5V4a1 1 0 011-1z",clipRule:"evenodd"})}),z]})})]}),0===_.length&&(!z||!L)&&e("div",{className:"text-center py-4 text-gray-500 text-sm",children:"No matching tags found"})]})]}),D&&t("div",{className:"mt-1 text-xs text-gray-500",children:[h.length,"/",D," tags"]}),x&&!y&&e("p",{id:"".concat(h,"-help"),className:"mt-1 text-sm text-gray-500",children:x}),y&&e("p",{id:"".concat(h,"-error"),className:"mt-1 text-sm text-red-500",children:y})]})},ye=function(){var n=s([]),r=n[0],o=n[1],i=s([]),a=i[0],l=i[1];return t("div",{className:"max-w-2xl mx-auto p-6 bg-gray-50 min-h-screen",children:[e("h1",{className:"text-2xl font-bold mb-8 text-gray-900",children:"TagInput Component Demo"}),t("div",{className:"space-y-8",children:[e(ge,{id:"skills",label:"Skills & Technologies",value:r,onChange:o,predefinedTags:[{label:"React",value:"react"},{label:"JavaScript",value:"javascript"},{label:"TypeScript",value:"typescript"},{label:"Node.js",value:"nodejs"},{label:"Python",value:"python"},{label:"CSS",value:"css"},{label:"HTML",value:"html"},{label:"Vue.js",value:"vuejs"},{label:"Angular",value:"angular"},{label:"Next.js",value:"nextjs"}],placeholder:"Search or add skills...",helpText:"Select from predefined options or add your own custom tags",size:"md"}),e(ge,{id:"custom-tags",label:"Project Categories (Custom Colors)",value:a,onChange:l,predefinedTags:[{label:"Web Development",value:"web"},{label:"Mobile App",value:"mobile"},{label:"AI/ML",value:"ai"},{label:"UI/UX Design",value:"design"}],placeholder:"Add project categories...",tagBackgroundColor:"bg-purple-500",tagTextColor:"text-white",maxTags:5,size:"lg",helpText:"Maximum 5 tags allowed with custom purple styling"}),t("div",{className:"mt-8 p-4 bg-white rounded-lg border",children:[e("h3",{className:"font-medium mb-2",children:"Selected Skills:"}),e("pre",{className:"text-sm bg-gray-100 p-2 rounded",children:JSON.stringify(r,null,2)})]}),t("div",{className:"p-4 bg-white rounded-lg border",children:[e("h3",{className:"font-medium mb-2",children:"Selected Categories:"}),e("pre",{className:"text-sm bg-gray-100 p-2 rounded",children:JSON.stringify(a,null,2)})]})]})]})},ve=function(n){var r=n.id,o=n.label,i=n.value,c=void 0===i?{}:i,d=n.size,h=void 0===d?"md":d,u=n.onChange,p=n.placeholder,f=n.error,m=n.required,g=void 0!==m&&m,y=n.helpText,v=n.className,b=void 0===v?"":v,x=n.disabled,w=void 0!==x&&x,k=n.mode,C=void 0===k?"date":k;n.minDate,n.maxDate,n.showWeekNumbers;var N=n.firstDayOfWeek,S=void 0===N?1:N;le(n,["id","label","value","size","onChange","placeholder","error","required","helpText","className","disabled","mode","minDate","maxDate","showWeekNumbers","firstDayOfWeek"]);var M=s(!1),T=M[0],O=M[1],E=s(new Date),A=E[0],D=E[1],R=s(c.startDate||null),L=R[0],I=R[1],z=s(c.endDate||null),P=z[0],B=z[1],$=s(c.time||"12:00 PM"),V=$[0],j=$[1],F=s(!1),H=F[0],_=F[1],q=s(A.getFullYear().toString()),W=q[0],K=q[1],J=s(!1),U=J[0],G=J[1],Y=a(null),X=a(null),Q=0===S?["Sun","Mon","Tue","Wed","Thu","Fri","Sat"]:["Mon","Tue","Wed","Thu","Fri","Sat","Sun"];l((function(){var e=function(e){Y.current&&!Y.current.contains(e.target)&&X.current&&!X.current.contains(e.target)&&O(!1)};return document.addEventListener("mousedown",e),function(){return document.removeEventListener("mousedown",e)}}),[]);var Z=function(e){return e.toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric"})},ee=function(e,t){var n=Z(e);return t?"".concat(n," ").concat(t):n},te=function(){if(!L&&!P)return"";switch(C){case"date":return L?Z(L):"";case"datetime":return L?ee(L,V):"";case"daterange":return L&&P?"".concat(Z(L)," - ").concat(Z(P)):L?Z(L):"";case"datetimerange":return L&&P?"".concat(ee(L,V)," - ").concat(ee(P,V)):L?ee(L,V):"";default:return""}},ne=function(e,t){return e.toDateString()===t.toDateString()},re=function(e){D(new Date(A.getFullYear(),A.getMonth()+e,1))},oe=function(e){D(new Date(A.getFullYear()+e,A.getMonth(),1))},ie=function(){var e=parseInt(W);!isNaN(e)&&e>=1900&&e<=2100?D(new Date(e,A.getMonth(),1)):K(A.getFullYear().toString()),_(!1)};return t("div",{className:"mb-4",children:[o&&t("label",{htmlFor:r,className:"mb-1 block text-sm font-medium text-gray-600",children:[o,g&&e("span",{className:"ml-1 text-red-500",children:"*"})]}),t("div",{className:"relative",children:[t("div",{ref:X,onClick:function(){return!w&&O(!T)},className:"w-full rounded-[12px] border ".concat(f?"border-red-500":"border-gray-200"," ").concat(w?"bg-gray-100 text-gray-500 cursor-not-allowed":"bg-gray-100 text-dark cursor-pointer hover:bg-gray-50"," focus:outline-none focus:ring-1 focus:ring-primary ").concat(b," ").concat({sm:"text-xs px-3 py-1.5 text-sm min-h-[32px]",md:"text-sm px-4 py-2 text-base min-h-[40px]",lg:"text-base px-4 py-3 text-lg min-h-[48px]"}[h]," flex items-center justify-between"),children:[e("span",{className:te()?"text-gray-900":"text-gray-400",children:te()||p||"Select date..."}),e("svg",{className:"w-5 h-5 text-gray-400 transition-transform ".concat(T?"rotate-180":""),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 7V3m8 4V3m-9 8h10M5 21h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v12a2 2 0 002 2z"})})]}),T&&!w&&t("div",{ref:Y,className:"absolute z-[1000] mt-1 bg-white border border-gray-200 rounded-[12px] shadow-lg backdrop-blur-sm bg-white/95 p-4 min-w-[320px]",children:[t("div",{className:"flex items-center justify-between mb-4",children:[e("div",{className:"flex items-center space-x-1",children:e("button",{type:"button",onClick:function(){return re(-1)},className:"p-1 hover:bg-gray-100 rounded-md transition-colors",children:e("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 19l-7-7 7-7"})})})}),t("div",{className:"flex items-center space-x-2",children:[e("span",{className:"font-medium text-gray-900",children:["January","February","March","April","May","June","July","August","September","October","November","December"][A.getMonth()]}),t("div",{className:"flex items-center space-x-1",children:[H?e("input",{type:"text",value:W,onChange:function(e){return K(e.target.value)},onBlur:ie,onKeyDown:function(e){"Enter"===e.key?ie():"Escape"===e.key&&(K(A.getFullYear().toString()),_(!1))},className:"w-16 text-center font-medium text-gray-900 bg-gray-50 border border-gray-200 rounded px-1 py-0.5 text-sm focus:outline-none focus:ring-1 focus:ring-primary-500",autoFocus:!0}):e("button",{type:"button",onClick:function(){_(!0),K(A.getFullYear().toString())},className:"font-medium text-gray-900 hover:text-primary-600 transition-colors px-1",children:A.getFullYear()}),t("div",{className:"flex flex-col",children:[e("button",{type:"button",onClick:function(){return oe(1)},className:"p-0.5 hover:bg-gray-100 rounded transition-colors",children:e("svg",{className:"w-3 h-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 15l7-7 7 7"})})}),e("button",{type:"button",onClick:function(){return oe(-1)},className:"p-0.5 hover:bg-gray-100 rounded transition-colors",children:e("svg",{className:"w-3 h-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})})]})]})]}),e("div",{className:"flex items-center space-x-1",children:e("button",{type:"button",onClick:function(){return re(1)},className:"p-1 hover:bg-gray-100 rounded-md transition-colors",children:e("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})})})})]}),e("div",{className:"grid grid-cols-7 gap-1 mb-2",children:Q.map((function(t){return e("div",{className:"text-center text-xs font-medium text-gray-500 py-2",children:t},t)}))}),e("div",{className:"grid grid-cols-7 gap-1 mb-4",children:function(){var e=A.getFullYear(),t=A.getMonth(),n=new Date(e,t,1),r=new Date(e,t+1,0).getDate(),o=n.getDay();1===S&&(o=0===o?6:o-1);for(var i=[],s=0;s<o;s++){var a=new Date(e,t,-(o-1-s));i.push({date:a,isCurrentMonth:!1})}for(s=1;s<=r;s++)i.push({date:new Date(e,t,s),isCurrentMonth:!0});var l=42-i.length;for(s=1;s<=l;s++)i.push({date:new Date(e,t+1,s),isCurrentMonth:!1});return i}().map((function(t,n){var r=t.date,o=t.isCurrentMonth,i=function(e){return!(!L||!ne(e,L))||!(!P||!ne(e,P))}(r),s=function(e){return!(!L||!P)&&e>=L&&e<=P}(r),a=ne(r,new Date),l=L&&ne(r,L),c=P&&ne(r,P);return e("button",{type:"button",onClick:function(){return function(e){if("daterange"===C||"datetimerange"===C){if(!L||L&&P||U)if(U){e<L?(I(e),B(L)):B(e),G(!1);var t=ae({startDate:L,endDate:e<L?L:e},"datetimerange"===C&&{time:V});null==u||u(t)}else I(e),B(null),G(!0)}else I(e),t=ae({startDate:e},"datetime"===C&&{time:V}),null==u||u(t),"date"===C&&O(!1)}(r)},className:"\n w-8 h-8 text-sm transition-all duration-200 relative flex items-center justify-center\n ".concat(o?"text-gray-900":"text-gray-300","\n ").concat(i?"bg-primary-500 text-white font-medium rounded-full":s?"bg-primary-100 text-primary-700 rounded-sm":"hover:bg-gray-100 rounded-md","\n ").concat(a&&!i?"ring-2 ring-primary-500 ring-opacity-30":"","\n ").concat(l||c?"rounded-full":"","\n "),children:r.getDate()},n)}))}),("datetime"===C||"datetimerange"===C)&&t("div",{className:"border-t border-gray-100 pt-4",children:[e("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"Time"}),e("select",{value:V,onChange:function(e){return function(e){j(e);var t=ae(ae({startDate:L},P&&{endDate:P}),{time:e});null==u||u(t)}(e.target.value)},className:"w-full px-3 py-2 border border-gray-200 rounded-md focus:outline-none focus:ring-1 focus:ring-primary-500 bg-white",children:function(){for(var e=[],t=1;t<=12;t++)for(var n=0;n<60;n+=15){var r=n.toString().padStart(2,"0");e.push("".concat(t,":").concat(r," AM")),e.push("".concat(t,":").concat(r," PM"))}return e}().map((function(t){return e("option",{value:t,children:t},t)}))})]}),t("div",{className:"flex justify-end space-x-2 mt-4 pt-4 border-t border-gray-100",children:[e("button",{type:"button",onClick:function(){O(!1),I(null),B(null),G(!1),null==u||u({})},className:"px-3 py-1.5 text-sm text-gray-600 hover:text-gray-800 transition-colors",children:"Clear"}),e("button",{type:"button",onClick:function(){return O(!1)},className:"px-4 py-1.5 text-sm bg-primary-500 text-white rounded-md hover:bg-primary-600 transition-colors",children:"Done"})]})]})]}),y&&!f&&e("p",{id:"".concat(r,"-help"),className:"mt-1 text-sm text-gray-500",children:y}),f&&e("p",{id:"".concat(r,"-error"),className:"mt-1 text-sm text-red-500",children:f})]})},be=function(){var n=s({}),r=n[0],o=n[1],i=s({}),a=i[0],l=i[1],c=s({}),d=c[0],h=c[1],u=s({}),p=u[0],f=u[1];return t("div",{className:"max-w-4xl mx-auto p-6 bg-gray-50 min-h-screen",children:[e("h1",{className:"text-3xl font-bold mb-8 text-gray-900",children:"DateTime Picker Component"}),t("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-8",children:[t("div",{className:"space-y-6",children:[e(ve,{id:"single-date",label:"Single Date",value:r,onChange:o,placeholder:"Select a date",mode:"date",helpText:"Choose any single date",size:"md"}),e(ve,{id:"datetime",label:"Date & Time",value:a,onChange:l,placeholder:"Select date and time",mode:"datetime",helpText:"Choose date with specific time",size:"md"})]}),t("div",{className:"space-y-6",children:[e(ve,{id:"date-range",label:"Date Range",value:d,onChange:h,placeholder:"Select date range",mode:"daterange",helpText:"Choose start and end dates",size:"md"}),e(ve,{id:"datetime-range",label:"Date & Time Range",value:p,onChange:f,placeholder:"Select date and time range",mode:"datetimerange",helpText:"Choose date range with time",size:"md"})]})]}),t("div",{className:"mt-12 grid grid-cols-1 md:grid-cols-2 gap-8",children:[t("div",{className:"space-y-4",children:[e("h3",{className:"text-lg font-semibold text-gray-800",children:"Single Date Value:"}),e("pre",{className:"bg-white p-4 rounded-lg border text-sm overflow-x-auto",children:JSON.stringify(r,null,2)}),e("h3",{className:"text-lg font-semibold text-gray-800",children:"DateTime Value:"}),e("pre",{className:"bg-white p-4 rounded-lg border text-sm overflow-x-auto",children:JSON.stringify(a,null,2)})]}),t("div",{className:"space-y-4",children:[e("h3",{className:"text-lg font-semibold text-gray-800",children:"Date Range Value:"}),e("pre",{className:"bg-white p-4 rounded-lg border text-sm overflow-x-auto",children:JSON.stringify(d,null,2)}),e("h3",{className:"text-lg font-semibold text-gray-800",children:"DateTime Range Value:"}),e("pre",{className:"bg-white p-4 rounded-lg border text-sm overflow-x-auto",children:JSON.stringify(p,null,2)})]})]})]})};function xe(n){var r=n.placeholder,o=void 0===r?"Search...":r,i=n.onSearch,a=n.className,l=void 0===a?"":a,c=s(""),d=c[0],h=c[1];return t("div",{className:"relative ".concat(l),children:[e("input",{type:"text",value:d,onChange:function(e){e.preventDefault(),h(e.target.value),i(d)},placeholder:o,className:"w-full rounded-lg border border-gray-200 bg-white py-2 pl-8 pr-4 text-sm focus:outline-none focus:ring-1 focus:ring-primary"}),t("svg",{className:"absolute left-2 top-1/2 -translate-y-1/2 transform text-gray-400",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e("circle",{cx:"11",cy:"11",r:"8"}),e("line",{x1:"21",y1:"21",x2:"16.65",y2:"16.65"})]})]})}function we(r){var o,i=r.options,c=r.placeholder,d=void 0===c?"Select an option":c,h=r.onChange,u=r.value,p=r.size,f=void 0===p?"md":p,m=r.className,g=void 0===m?"":m,y=r.name,v=r.id,b=r.disabled,x=void 0!==b&&b,w=r.label,k=r.required,C=r.error,N=r.helpText,S=r.fullWidth,M=void 0===S||S,T=r.searchable,O=void 0!==T&&T,A=r.multiple,D=void 0!==A&&A,R=r.maxSelected,L=r.showSelectedCount,I=void 0!==L&&L,z=r.closeOnSelect,P=void 0===z||z,B=s(!1),$=B[0],V=B[1],j=s(""),F=j[0],H=j[1],_=s((function(){if(!u)return[];if(D&&Array.isArray(u))return u.map((function(e){return i.find((function(t){return t.value===e}))})).filter(Boolean);if(!D&&"string"==typeof u){var e=i.find((function(e){return e.value===u}));return e?[e]:[]}return[]})),q=_[0],W=_[1],K=a(null),J=O?i.filter((function(e){return(e.label||e.value).toLowerCase().includes(F.toLowerCase())})):i;l((function(){var e=function(e){K.current&&!K.current.contains(e.target)&&(V(!1),H(""))};return document.addEventListener("mousedown",e),function(){document.removeEventListener("mousedown",e)}}),[]);return t("div",{ref:K,className:"".concat(M?"w-full":"w-fit"," mb-4"),children:[w&&t("label",{htmlFor:v,className:"mb-1 block text-sm font-medium text-gray-700",children:[w,k&&e("span",{className:"ml-1 text-red-500",children:"*"})]}),t("div",{className:"relative",children:[t("button",{type:"button",className:"flex items-center justify-between rounded-lg border ".concat(C?"border-red-500":"border-gray-200"," bg-gray-100 shadow-sm ").concat({sm:"text-xs px-3 py-1.5 text-sm min-h-[32px]",md:"text-sm px-4 py-2 text-base min-h-[40px]",lg:"text-base px-4 py-3 text-lg min-h-[48px]"}[f]," text-gray-700 hover:border-gray-300 focus:border-primary-500 focus:outline-none focus:ring-2 focus:ring-primary-500/20 ").concat(x?"cursor-not-allowed bg-gray-50 opacity-50":""," ").concat(g," ").concat(M?"w-full":""," transition-all duration-200"),onClick:function(){return!x&&V(!$)},disabled:x,id:v,"aria-haspopup":"listbox","aria-expanded":$,children:[e("div",{className:"flex-1 flex items-center gap-1 min-w-0",children:D&&q.length>0?t("div",{className:"flex flex-wrap gap-1 flex-1",children:[q.slice(0,3).map((function(n){return t("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 bg-primary-100 text-primary-800 text-sm rounded-md",children:[e("span",{className:"truncate max-w-[120px]",children:n.label||n.value}),e(ne,{className:"h-3 w-3 cursor-pointer hover:text-primary-900",onClick:function(e){return function(e,t){t.stopPropagation();var n=q.filter((function(t){return t.value!==e.value}));W(n);var r=D?n.map((function(e){return e.value})):"";h({target:{id:v||"",value:r}})}(n,e)}})]},n.value)})),q.length>3&&t("span",{className:"text-sm text-gray-500 px-1",children:["+",q.length-3," more"]})]}):e("span",{className:"truncate ".concat(0===q.length?"text-gray-400":"text-gray-700"),children:function(){var e,t,n,r;return 0===q.length?d:D?I&&q.length>2?"".concat(q.length," items selected"):q.length<=2?q.map((function(e){return e.label||e.value})).join(", "):"".concat((null===(n=q[0])||void 0===n?void 0:n.label)||(null===(r=q[0])||void 0===r?void 0:r.value)," +").concat(q.length-1," more"):(null===(e=q[0])||void 0===e?void 0:e.label)||(null===(t=q[0])||void 0===t?void 0:t.value)}()})}),e(E,{className:"ml-2 h-4 w-4 text-gray-400 transition-transform flex-shrink-0 ".concat($?"rotate-180 transform":"")})]}),$&&t("div",{className:"absolute z-50 mt-1 w-full rounded-lg border border-gray-200 bg-white shadow-lg",role:"listbox",children:[O&&e("div",{className:"sticky top-0 border-b border-gray-100 bg-white p-3",children:e("input",{type:"text",className:"w-full rounded-md border border-gray-200 px-3 py-2 text-sm focus:border-primary-500 focus:outline-none focus:ring-2 focus:ring-primary-500/20 transition-all duration-200",placeholder:"Search...",value:F,onChange:function(e){return H(e.target.value)},autoFocus:!0})}),e("div",{className:"max-h-60 overflow-auto py-1",children:J.length>0?t(n,{children:[D&&q.length>0&&t("div",{className:"px-3 py-2 text-xs text-gray-500 border-b border-gray-100",children:[q.length," selected",R&&" of ".concat(R," max")]}),J.map((function(n){var r=function(e){return q.some((function(t){return t.value===e.value}))}(n),o=n.disabled||R&&!r&&q.length>=R;return t("div",{className:"cursor-pointer px-3 py-2 flex items-center justify-between transition-colors duration-150 ".concat(r?"bg-primary-50 text-primary-700":"text-gray-700 hover:bg-gray-50"," ").concat(o?"cursor-not-allowed text-gray-400 hover:bg-white opacity-50":""),onClick:function(){return!o&&function(e){var t;if(!e.disabled){var n;if(D)if(q.some((function(t){return t.value===e.value})))n=q.filter((function(t){return t.value!==e.value}));else{if(R&&q.length>=R)return;n=ce(ce([],q,!0),[e],!1)}else n=[e];W(n);var r=D?n.map((function(e){return e.value})):(null===(t=n[0])||void 0===t?void 0:t.value)||"";h({target:{id:v||"",value:r}}),D&&!P||(V(!1),H(""))}}(n)},role:"option","aria-selected":r,"aria-disabled":o,children:[e("span",{className:"flex-1 text-sm font-medium",children:n.label||n.value}),D&&r&&e("div",{className:"w-4 h-4 bg-primary-500 rounded-sm flex items-center justify-center",children:e("svg",{className:"w-3 h-3 text-white",fill:"currentColor",viewBox:"0 0 20 20",children:e("path",{fillRule:"evenodd",d:"M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z",clipRule:"evenodd"})})})]},n.value)}))]}):e("div",{className:"px-3 py-2 text-gray-500 text-center",children:"No options found"})})]})]}),C&&e("p",{className:"mt-1 text-sm text-red-600",children:C}),N&&!C&&e("p",{className:"mt-1 text-sm text-gray-500",children:N}),y&&e(n,{children:D?q.map((function(t,n){return e("input",{type:"hidden",name:"".concat(y,"[]"),value:t.value},"".concat(t.value,"-").concat(n))})):e("input",{type:"hidden",name:y,value:(null===(o=q[0])||void 0===o?void 0:o.value)||""})})]})}function ke(e){this.content=e}function Ce(e,t,n){for(let r=0;;r++){if(r==e.childCount||r==t.childCount)return e.childCount==t.childCount?null:n;let o=e.child(r),i=t.child(r);if(o!=i){if(!o.sameMarkup(i))return n;if(o.isText&&o.text!=i.text){for(let e=0;o.text[e]==i.text[e];e++)n++;return n}if(o.content.size||i.content.size){let e=Ce(o.content,i.content,n+1);if(null!=e)return e}n+=o.nodeSize}else n+=o.nodeSize}}function Ne(e,t,n,r){for(let o=e.childCount,i=t.childCount;;){if(0==o||0==i)return o==i?null:{a:n,b:r};let s=e.child(--o),a=t.child(--i),l=s.nodeSize;if(s!=a){if(!s.sameMarkup(a))return{a:n,b:r};if(s.isText&&s.text!=a.text){let e=0,t=Math.min(s.text.length,a.text.length);for(;e<t&&s.text[s.text.length-e-1]==a.text[a.text.length-e-1];)e++,n--,r--;return{a:n,b:r}}if(s.content.size||a.content.size){let e=Ne(s.content,a.content,n-1,r-1);if(e)return e}n-=l,r-=l}else n-=l,r-=l}}ke.prototype={constructor:ke,find:function(e){for(var t=0;t<this.content.length;t+=2)if(this.content[t]===e)return t;return-1},get:function(e){var t=this.find(e);return-1==t?void 0:this.content[t+1]},update:function(e,t,n){var r=n&&n!=e?this.remove(n):this,o=r.find(e),i=r.content.slice();return-1==o?i.push(n||e,t):(i[o+1]=t,n&&(i[o]=n)),new ke(i)},remove:function(e){var t=this.find(e);if(-1==t)return this;var n=this.content.slice();return n.splice(t,2),new ke(n)},addToStart:function(e,t){return new ke([e,t].concat(this.remove(e).content))},addToEnd:function(e,t){var n=this.remove(e).content.slice();return n.push(e,t),new ke(n)},addBefore:function(e,t,n){var r=this.remove(t),o=r.content.slice(),i=r.find(e);return o.splice(-1==i?o.length:i,0,t,n),new ke(o)},forEach:function(e){for(var t=0;t<this.content.length;t+=2)e(this.content[t],this.content[t+1])},prepend:function(e){return(e=ke.from(e)).size?new ke(e.content.concat(this.subtract(e).content)):this},append:function(e){return(e=ke.from(e)).size?new ke(this.subtract(e).content.concat(e.content)):this},subtract:function(e){var t=this;e=ke.from(e);for(var n=0;n<e.content.length;n+=2)t=t.remove(e.content[n]);return t},toObject:function(){var e={};return this.forEach((function(t,n){e[t]=n})),e},get size(){return this.content.length>>1}},ke.from=function(e){if(e instanceof ke)return e;var t=[];if(e)for(var n in e)t.push(n,e[n]);return new ke(t)};class Se{constructor(e,t){if(this.content=e,this.size=t||0,null==t)for(let t=0;t<e.length;t++)this.size+=e[t].nodeSize}nodesBetween(e,t,n,r=0,o){for(let i=0,s=0;s<t;i++){let a=this.content[i],l=s+a.nodeSize;if(l>e&&!1!==n(a,r+s,o||null,i)&&a.content.size){let o=s+1;a.nodesBetween(Math.max(0,e-o),Math.min(a.content.size,t-o),n,r+o)}s=l}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,t,n,r){let o="",i=!0;return this.nodesBetween(e,t,((s,a)=>{let l=s.isText?s.text.slice(Math.max(e,a)-a,t-a):s.isLeaf?r?"function"==typeof r?r(s):r:s.type.spec.leafText?s.type.spec.leafText(s):"":"";s.isBlock&&(s.isLeaf&&l||s.isTextblock)&&n&&(i?i=!1:o+=n),o+=l}),0),o}append(e){if(!e.size)return this;if(!this.size)return e;let t=this.lastChild,n=e.firstChild,r=this.content.slice(),o=0;for(t.isText&&t.sameMarkup(n)&&(r[r.length-1]=t.withText(t.text+n.text),o=1);o<e.content.length;o++)r.push(e.content[o]);return new Se(r,this.size+e.size)}cut(e,t=this.size){if(0==e&&t==this.size)return this;let n=[],r=0;if(t>e)for(let o=0,i=0;i<t;o++){let s=this.content[o],a=i+s.nodeSize;a>e&&((i<e||a>t)&&(s=s.isText?s.cut(Math.max(0,e-i),Math.min(s.text.length,t-i)):s.cut(Math.max(0,e-i-1),Math.min(s.content.size,t-i-1))),n.push(s),r+=s.nodeSize),i=a}return new Se(n,r)}cutByIndex(e,t){return e==t?Se.empty:0==e&&t==this.content.length?this:new Se(this.content.slice(e,t))}replaceChild(e,t){let n=this.content[e];if(n==t)return this;let r=this.content.slice(),o=this.size+t.nodeSize-n.nodeSize;return r[e]=t,new Se(r,o)}addToStart(e){return new Se([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new Se(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let t=0;t<this.content.length;t++)if(!this.content[t].eq(e.content[t]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(e){let t=this.content[e];if(!t)throw new RangeError("Index "+e+" out of range for "+this);return t}maybeChild(e){return this.content[e]||null}forEach(e){for(let t=0,n=0;t<this.content.length;t++){let r=this.content[t];e(r,n,t),n+=r.nodeSize}}findDiffStart(e,t=0){return Ce(this,e,t)}findDiffEnd(e,t=this.size,n=e.size){return Ne(this,e,t,n)}findIndex(e){if(0==e)return Te(0,e);if(e==this.size)return Te(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let t=0,n=0;;t++){let r=n+this.child(t).nodeSize;if(r>=e)return r==e?Te(t+1,r):Te(t,n);n=r}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map((e=>e.toJSON())):null}static fromJSON(e,t){if(!t)return Se.empty;if(!Array.isArray(t))throw new RangeError("Invalid input for Fragment.fromJSON");return new Se(t.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return Se.empty;let t,n=0;for(let r=0;r<e.length;r++){let o=e[r];n+=o.nodeSize,r&&o.isText&&e[r-1].sameMarkup(o)?(t||(t=e.slice(0,r)),t[t.length-1]=o.withText(t[t.length-1].text+o.text)):t&&t.push(o)}return new Se(t||e,n)}static from(e){if(!e)return Se.empty;if(e instanceof Se)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new Se([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}Se.empty=new Se([],0);const Me={index:0,offset:0};function Te(e,t){return Me.index=e,Me.offset=t,Me}function Oe(e,t){if(e===t)return!0;if(!e||"object"!=typeof e||!t||"object"!=typeof t)return!1;let n=Array.isArray(e);if(Array.isArray(t)!=n)return!1;if(n){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(!Oe(e[n],t[n]))return!1}else{for(let n in e)if(!(n in t)||!Oe(e[n],t[n]))return!1;for(let n in t)if(!(n in e))return!1}return!0}let Ee=class e{constructor(e,t){this.type=e,this.attrs=t}addToSet(e){let t,n=!1;for(let r=0;r<e.length;r++){let o=e[r];if(this.eq(o))return e;if(this.type.excludes(o.type))t||(t=e.slice(0,r));else{if(o.type.excludes(this.type))return e;!n&&o.type.rank>this.type.rank&&(t||(t=e.slice(0,r)),t.push(this),n=!0),t&&t.push(o)}}return t||(t=e.slice()),n||t.push(this),t}removeFromSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return e.slice(0,t).concat(e.slice(t+1));return e}isInSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return!0;return!1}eq(e){return this==e||this.type==e.type&&Oe(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,t){if(!t)throw new RangeError("Invalid input for Mark.fromJSON");let n=e.marks[t.type];if(!n)throw new RangeError(`There is no mark type ${t.type} in this schema`);let r=n.create(t.attrs);return n.checkAttrs(r.attrs),r}static sameSet(e,t){if(e==t)return!0;if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(!e[n].eq(t[n]))return!1;return!0}static setFrom(t){if(!t||Array.isArray(t)&&0==t.length)return e.none;if(t instanceof e)return[t];let n=t.slice();return n.sort(((e,t)=>e.type.rank-t.type.rank)),n}};Ee.none=[];class Ae extends Error{}class De{constructor(e,t,n){this.content=e,this.openStart=t,this.openEnd=n}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,t){let n=Le(this.content,e+this.openStart,t);return n&&new De(n,this.openStart,this.openEnd)}removeBetween(e,t){return new De(Re(this.content,e+this.openStart,t+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(e,t){if(!t)return De.empty;let n=t.openStart||0,r=t.openEnd||0;if("number"!=typeof n||"number"!=typeof r)throw new RangeError("Invalid input for Slice.fromJSON");return new De(Se.fromJSON(e,t.content),n,r)}static maxOpen(e,t=!0){let n=0,r=0;for(let r=e.firstChild;r&&!r.isLeaf&&(t||!r.type.spec.isolating);r=r.firstChild)n++;for(let n=e.lastChild;n&&!n.isLeaf&&(t||!n.type.spec.isolating);n=n.lastChild)r++;return new De(e,n,r)}}function Re(e,t,n){let{index:r,offset:o}=e.findIndex(t),i=e.maybeChild(r),{index:s,offset:a}=e.findIndex(n);if(o==t||i.isText){if(a!=n&&!e.child(s).isText)throw new RangeError("Removing non-flat range");return e.cut(0,t).append(e.cut(n))}if(r!=s)throw new RangeError("Removing non-flat range");return e.replaceChild(r,i.copy(Re(i.content,t-o-1,n-o-1)))}function Le(e,t,n,r){let{index:o,offset:i}=e.findIndex(t),s=e.maybeChild(o);if(i==t||s.isText)return e.cut(0,t).append(n).append(e.cut(t));let a=Le(s.content,t-i-1,n);return a&&e.replaceChild(o,s.copy(a))}function Ie(e,t,n){if(n.openStart>e.depth)throw new Ae("Inserted content deeper than insertion position");if(e.depth-n.openStart!=t.depth-n.openEnd)throw new Ae("Inconsistent open depths");return ze(e,t,n,0)}function ze(e,t,n,r){let o=e.index(r),i=e.node(r);if(o==t.index(r)&&r<e.depth-n.openStart){let s=ze(e,t,n,r+1);return i.copy(i.content.replaceChild(o,s))}if(n.content.size){if(n.openStart||n.openEnd||e.depth!=r||t.depth!=r){let{start:o,end:s}=function(e,t){let n=t.depth-e.openStart,r=t.node(n).copy(e.content);for(let e=n-1;e>=0;e--)r=t.node(e).copy(Se.from(r));return{start:r.resolveNoCache(e.openStart+n),end:r.resolveNoCache(r.content.size-e.openEnd-n)}}(n,e);return je(i,Fe(e,o,s,t,r))}{let r=e.parent,o=r.content;return je(r,o.cut(0,e.parentOffset).append(n.content).append(o.cut(t.parentOffset)))}}return je(i,He(e,t,r))}function Pe(e,t){if(!t.type.compatibleContent(e.type))throw new Ae("Cannot join "+t.type.name+" onto "+e.type.name)}function Be(e,t,n){let r=e.node(n);return Pe(r,t.node(n)),r}function $e(e,t){let n=t.length-1;n>=0&&e.isText&&e.sameMarkup(t[n])?t[n]=e.withText(t[n].text+e.text):t.push(e)}function Ve(e,t,n,r){let o=(t||e).node(n),i=0,s=t?t.index(n):o.childCount;e&&(i=e.index(n),e.depth>n?i++:e.textOffset&&($e(e.nodeAfter,r),i++));for(let e=i;e<s;e++)$e(o.child(e),r);t&&t.depth==n&&t.textOffset&&$e(t.nodeBefore,r)}function je(e,t){return e.type.checkContent(t),e.copy(t)}function Fe(e,t,n,r,o){let i=e.depth>o&&Be(e,t,o+1),s=r.depth>o&&Be(n,r,o+1),a=[];return Ve(null,e,o,a),i&&s&&t.index(o)==n.index(o)?(Pe(i,s),$e(je(i,Fe(e,t,n,r,o+1)),a)):(i&&$e(je(i,He(e,t,o+1)),a),Ve(t,n,o,a),s&&$e(je(s,He(n,r,o+1)),a)),Ve(r,null,o,a),new Se(a)}function He(e,t,n){let r=[];if(Ve(null,e,n,r),e.depth>n){$e(je(Be(e,t,n+1),He(e,t,n+1)),r)}return Ve(t,null,n,r),new Se(r)}De.empty=new De(Se.empty,0,0);class _e{constructor(e,t,n){this.pos=e,this.path=t,this.parentOffset=n,this.depth=t.length/3-1}resolveDepth(e){return null==e?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[3*this.resolveDepth(e)]}index(e){return this.path[3*this.resolveDepth(e)+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e!=this.depth||this.textOffset?1:0)}start(e){return 0==(e=this.resolveDepth(e))?0:this.path[3*e-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(!(e=this.resolveDepth(e)))throw new RangeError("There is no position before the top-level node");return e==this.depth+1?this.pos:this.path[3*e-1]}after(e){if(!(e=this.resolveDepth(e)))throw new RangeError("There is no position after the top-level node");return e==this.depth+1?this.pos:this.path[3*e-1]+this.path[3*e].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,t=this.index(this.depth);if(t==e.childCount)return null;let n=this.pos-this.path[this.path.length-1],r=e.child(t);return n?e.child(t).cut(n):r}get nodeBefore(){let e=this.index(this.depth),t=this.pos-this.path[this.path.length-1];return t?this.parent.child(e).cut(0,t):0==e?null:this.parent.child(e-1)}posAtIndex(e,t){t=this.resolveDepth(t);let n=this.path[3*t],r=0==t?0:this.path[3*t-1]+1;for(let t=0;t<e;t++)r+=n.child(t).nodeSize;return r}marks(){let e=this.parent,t=this.index();if(0==e.content.size)return Ee.none;if(this.textOffset)return e.child(t).marks;let n=e.maybeChild(t-1),r=e.maybeChild(t);if(!n){let e=n;n=r,r=e}let o=n.marks;for(var i=0;i<o.length;i++)!1!==o[i].type.spec.inclusive||r&&o[i].isInSet(r.marks)||(o=o[i--].removeFromSet(o));return o}marksAcross(e){let t=this.parent.maybeChild(this.index());if(!t||!t.isInline)return null;let n=t.marks,r=e.parent.maybeChild(e.index());for(var o=0;o<n.length;o++)!1!==n[o].type.spec.inclusive||r&&n[o].isInSet(r.marks)||(n=n[o--].removeFromSet(n));return n}sharedDepth(e){for(let t=this.depth;t>0;t--)if(this.start(t)<=e&&this.end(t)>=e)return t;return 0}blockRange(e=this,t){if(e.pos<this.pos)return e.blockRange(this);for(let n=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);n>=0;n--)if(e.pos<=this.end(n)&&(!t||t(this.node(n))))return new Je(this,e,n);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos<this.pos?e:this}toString(){let e="";for(let t=1;t<=this.depth;t++)e+=(e?"/":"")+this.node(t).type.name+"_"+this.index(t-1);return e+":"+this.parentOffset}static resolve(e,t){if(!(t>=0&&t<=e.content.size))throw new RangeError("Position "+t+" out of range");let n=[],r=0,o=t;for(let t=e;;){let{index:e,offset:i}=t.content.findIndex(o),s=o-i;if(n.push(t,e,r+i),!s)break;if(t=t.child(e),t.isText)break;o=s-1,r+=i+1}return new _e(t,n,o)}static resolveCached(e,t){let n=Ke.get(e);if(n)for(let e=0;e<n.elts.length;e++){let r=n.elts[e];if(r.pos==t)return r}else Ke.set(e,n=new qe);let r=n.elts[n.i]=_e.resolve(e,t);return n.i=(n.i+1)%We,r}}class qe{constructor(){this.elts=[],this.i=0}}const We=12,Ke=new WeakMap;class Je{constructor(e,t,n){this.$from=e,this.$to=t,this.depth=n}get start(){return this.$from.before(this.depth+1)}get end(){return this.$to.after(this.depth+1)}get parent(){return this.$from.node(this.depth)}get startIndex(){return this.$from.index(this.depth)}get endIndex(){return this.$to.indexAfter(this.depth)}}const Ue=Object.create(null);class Ge{constructor(e,t,n,r=Ee.none){this.type=e,this.attrs=t,this.marks=r,this.content=n||Se.empty}get children(){return this.content.content}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(e){return this.content.child(e)}maybeChild(e){return this.content.maybeChild(e)}forEach(e){this.content.forEach(e)}nodesBetween(e,t,n,r=0){this.content.nodesBetween(e,t,n,r,this)}descendants(e){this.nodesBetween(0,this.content.size,e)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,"")}textBetween(e,t,n,r){return this.content.textBetween(e,t,n,r)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(e){return this==e||this.sameMarkup(e)&&this.content.eq(e.content)}sameMarkup(e){return this.hasMarkup(e.type,e.attrs,e.marks)}hasMarkup(e,t,n){return this.type==e&&Oe(this.attrs,t||e.defaultAttrs||Ue)&&Ee.sameSet(this.marks,n||Ee.none)}copy(e=null){return e==this.content?this:new Ge(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new Ge(this.type,this.attrs,this.content,e)}cut(e,t=this.content.size){return 0==e&&t==this.content.size?this:this.copy(this.content.cut(e,t))}slice(e,t=this.content.size,n=!1){if(e==t)return De.empty;let r=this.resolve(e),o=this.resolve(t),i=n?0:r.sharedDepth(t),s=r.start(i),a=r.node(i).content.cut(r.pos-s,o.pos-s);return new De(a,r.depth-i,o.depth-i)}replace(e,t,n){return Ie(this.resolve(e),this.resolve(t),n)}nodeAt(e){for(let t=this;;){let{index:n,offset:r}=t.content.findIndex(e);if(t=t.maybeChild(n),!t)return null;if(r==e||t.isText)return t;e-=r+1}}childAfter(e){let{index:t,offset:n}=this.content.findIndex(e);return{node:this.content.maybeChild(t),index:t,offset:n}}childBefore(e){if(0==e)return{node:null,index:0,offset:0};let{index:t,offset:n}=this.content.findIndex(e);if(n<e)return{node:this.content.child(t),index:t,offset:n};let r=this.content.child(t-1);return{node:r,index:t-1,offset:n-r.nodeSize}}resolve(e){return _e.resolveCached(this,e)}resolveNoCache(e){return _e.resolve(this,e)}rangeHasMark(e,t,n){let r=!1;return t>e&&this.nodesBetween(e,t,(e=>(n.isInSet(e.marks)&&(r=!0),!r))),r}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let e=this.type.name;return this.content.size&&(e+="("+this.content.toStringInner()+")"),Xe(this.marks,e)}contentMatchAt(e){let t=this.type.contentMatch.matchFragment(this.content,0,e);if(!t)throw new Error("Called contentMatchAt on a node with invalid content");return t}canReplace(e,t,n=Se.empty,r=0,o=n.childCount){let i=this.contentMatchAt(e).matchFragment(n,r,o),s=i&&i.matchFragment(this.content,t);if(!s||!s.validEnd)return!1;for(let e=r;e<o;e++)if(!this.type.allowsMarks(n.child(e).marks))return!1;return!0}canReplaceWith(e,t,n,r){if(r&&!this.type.allowsMarks(r))return!1;let o=this.contentMatchAt(e).matchType(n),i=o&&o.matchFragment(this.content,t);return!!i&&i.validEnd}canAppend(e){return e.content.size?this.canReplace(this.childCount,this.childCount,e.content):this.type.compatibleContent(e.type)}check(){this.type.checkContent(this.content),this.type.checkAttrs(this.attrs);let e=Ee.none;for(let t=0;t<this.marks.length;t++){let n=this.marks[t];n.type.checkAttrs(n.attrs),e=n.addToSet(e)}if(!Ee.sameSet(e,this.marks))throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map((e=>e.type.name))}`);this.content.forEach((e=>e.check()))}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map((e=>e.toJSON()))),e}static fromJSON(e,t){if(!t)throw new RangeError("Invalid input for Node.fromJSON");let n;if(t.marks){if(!Array.isArray(t.marks))throw new RangeError("Invalid mark data for Node.fromJSON");n=t.marks.map(e.markFromJSON)}if("text"==t.type){if("string"!=typeof t.text)throw new RangeError("Invalid text node in JSON");return e.text(t.text,n)}let r=Se.fromJSON(e,t.content),o=e.nodeType(t.type).create(t.attrs,r,n);return o.type.checkAttrs(o.attrs),o}}Ge.prototype.text=void 0;class Ye extends Ge{constructor(e,t,n,r){if(super(e,t,null,r),!n)throw new RangeError("Empty text nodes are not allowed");this.text=n}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):Xe(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,t){return this.text.slice(e,t)}get nodeSize(){return this.text.length}mark(e){return e==this.marks?this:new Ye(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new Ye(this.type,this.attrs,e,this.marks)}cut(e=0,t=this.text.length){return 0==e&&t==this.text.length?this:this.withText(this.text.slice(e,t))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}}function Xe(e,t){for(let n=e.length-1;n>=0;n--)t=e[n].type.name+"("+t+")";return t}class Qe{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,t){let n=new Ze(e,t);if(null==n.next)return Qe.empty;let r=et(n);n.next&&n.err("Unexpected trailing text");let o=function(e){let t=Object.create(null);return n(st(e,0));function n(r){let o=[];r.forEach((t=>{e[t].forEach((({term:t,to:n})=>{if(!t)return;let r;for(let e=0;e<o.length;e++)o[e][0]==t&&(r=o[e][1]);st(e,n).forEach((e=>{r||o.push([t,r=[]]),-1==r.indexOf(e)&&r.push(e)}))}))}));let i=t[r.join(",")]=new Qe(r.indexOf(e.length-1)>-1);for(let e=0;e<o.length;e++){let r=o[e][1].sort(it);i.next.push({type:o[e][0],next:t[r.join(",")]||n(r)})}return i}}(function(e){let t=[[]];return o(i(e,0),n()),t;function n(){return t.push([])-1}function r(e,n,r){let o={term:r,to:n};return t[e].push(o),o}function o(e,t){e.forEach((e=>e.to=t))}function i(e,t){if("choice"==e.type)return e.exprs.reduce(((e,n)=>e.concat(i(n,t))),[]);if("seq"!=e.type){if("star"==e.type){let s=n();return r(t,s),o(i(e.expr,s),s),[r(s)]}if("plus"==e.type){let s=n();return o(i(e.expr,t),s),o(i(e.expr,s),s),[r(s)]}if("opt"==e.type)return[r(t)].concat(i(e.expr,t));if("range"==e.type){let s=t;for(let t=0;t<e.min;t++){let t=n();o(i(e.expr,s),t),s=t}if(-1==e.max)o(i(e.expr,s),s);else for(let t=e.min;t<e.max;t++){let t=n();r(s,t),o(i(e.expr,s),t),s=t}return[r(s)]}if("name"==e.type)return[r(t,void 0,e.value)];throw new Error("Unknown expr type")}for(let r=0;;r++){let s=i(e.exprs[r],t);if(r==e.exprs.length-1)return s;o(s,t=n())}}}(r));return function(e,t){for(let n=0,r=[e];n<r.length;n++){let e=r[n],o=!e.validEnd,i=[];for(let t=0;t<e.next.length;t++){let{type:n,next:s}=e.next[t];i.push(n.name),!o||n.isText||n.hasRequiredAttrs()||(o=!1),-1==r.indexOf(s)&&r.push(s)}o&&t.err("Only non-generatable nodes ("+i.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}(o,n),o}matchType(e){for(let t=0;t<this.next.length;t++)if(this.next[t].type==e)return this.next[t].next;return null}matchFragment(e,t=0,n=e.childCount){let r=this;for(let o=t;r&&o<n;o++)r=r.matchType(e.child(o).type);return r}get inlineContent(){return 0!=this.next.length&&this.next[0].type.isInline}get defaultType(){for(let e=0;e<this.next.length;e++){let{type:t}=this.next[e];if(!t.isText&&!t.hasRequiredAttrs())return t}return null}compatible(e){for(let t=0;t<this.next.length;t++)for(let n=0;n<e.next.length;n++)if(this.next[t].type==e.next[n].type)return!0;return!1}fillBefore(e,t=!1,n=0){let r=[this];return function o(i,s){let a=i.matchFragment(e,n);if(a&&(!t||a.validEnd))return Se.from(s.map((e=>e.createAndFill())));for(let e=0;e<i.next.length;e++){let{type:t,next:n}=i.next[e];if(!t.isText&&!t.hasRequiredAttrs()&&-1==r.indexOf(n)){r.push(n);let e=o(n,s.concat(t));if(e)return e}}return null}(this,[])}findWrapping(e){for(let t=0;t<this.wrapCache.length;t+=2)if(this.wrapCache[t]==e)return this.wrapCache[t+1];let t=this.computeWrapping(e);return this.wrapCache.push(e,t),t}computeWrapping(e){let t=Object.create(null),n=[{match:this,type:null,via:null}];for(;n.length;){let r=n.shift(),o=r.match;if(o.matchType(e)){let e=[];for(let t=r;t.type;t=t.via)e.push(t.type);return e.reverse()}for(let e=0;e<o.next.length;e++){let{type:i,next:s}=o.next[e];i.isLeaf||i.hasRequiredAttrs()||i.name in t||r.type&&!s.validEnd||(n.push({match:i.contentMatch,type:i,via:r}),t[i.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw new RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];return function t(n){e.push(n);for(let r=0;r<n.next.length;r++)-1==e.indexOf(n.next[r].next)&&t(n.next[r].next)}(this),e.map(((t,n)=>{let r=n+(t.validEnd?"*":" ")+" ";for(let n=0;n<t.next.length;n++)r+=(n?", ":"")+t.next[n].type.name+"->"+e.indexOf(t.next[n].next);return r})).join("\n")}}Qe.empty=new Qe(!0);class Ze{constructor(e,t){this.string=e,this.nodeTypes=t,this.inline=null,this.pos=0,this.tokens=e.split(/\s*(?=\b|\W|$)/),""==this.tokens[this.tokens.length-1]&&this.tokens.pop(),""==this.tokens[0]&&this.tokens.shift()}get next(){return this.tokens[this.pos]}eat(e){return this.next==e&&(this.pos++||!0)}err(e){throw new SyntaxError(e+" (in content expression '"+this.string+"')")}}function et(e){let t=[];do{t.push(tt(e))}while(e.eat("|"));return 1==t.length?t[0]:{type:"choice",exprs:t}}function tt(e){let t=[];do{t.push(nt(e))}while(e.next&&")"!=e.next&&"|"!=e.next);return 1==t.length?t[0]:{type:"seq",exprs:t}}function nt(e){let t=function(e){if(e.eat("(")){let t=et(e);return e.eat(")")||e.err("Missing closing paren"),t}if(!/\W/.test(e.next)){let t=function(e,t){let n=e.nodeTypes,r=n[t];if(r)return[r];let o=[];for(let e in n){let r=n[e];r.isInGroup(t)&&o.push(r)}0==o.length&&e.err("No node type or group '"+t+"' found");return o}(e,e.next).map((t=>(null==e.inline?e.inline=t.isInline:e.inline!=t.isInline&&e.err("Mixing inline and block content"),{type:"name",value:t})));return e.pos++,1==t.length?t[0]:{type:"choice",exprs:t}}e.err("Unexpected token '"+e.next+"'")}(e);for(;;)if(e.eat("+"))t={type:"plus",expr:t};else if(e.eat("*"))t={type:"star",expr:t};else if(e.eat("?"))t={type:"opt",expr:t};else{if(!e.eat("{"))break;t=ot(e,t)}return t}function rt(e){/\D/.test(e.next)&&e.err("Expected number, got '"+e.next+"'");let t=Number(e.next);return e.pos++,t}function ot(e,t){let n=rt(e),r=n;return e.eat(",")&&(r="}"!=e.next?rt(e):-1),e.eat("}")||e.err("Unclosed braced range"),{type:"range",min:n,max:r,expr:t}}function it(e,t){return t-e}function st(e,t){let n=[];return function t(r){let o=e[r];if(1==o.length&&!o[0].term)return t(o[0].to);n.push(r);for(let e=0;e<o.length;e++){let{term:r,to:i}=o[e];r||-1!=n.indexOf(i)||t(i)}}(t),n.sort(it)}function at(e){let t=Object.create(null);for(let n in e){let r=e[n];if(!r.hasDefault)return null;t[n]=r.default}return t}function lt(e,t){let n=Object.create(null);for(let r in e){let o=t&&t[r];if(void 0===o){let t=e[r];if(!t.hasDefault)throw new RangeError("No value supplied for attribute "+r);o=t.default}n[r]=o}return n}function ct(e,t,n,r){for(let r in t)if(!(r in e))throw new RangeError(`Unsupported attribute ${r} for ${n} of type ${r}`);for(let n in e){let r=e[n];r.validate&&r.validate(t[n])}}function dt(e,t){let n=Object.create(null);if(t)for(let r in t)n[r]=new ut(e,r,t[r]);return n}let ht=class e{constructor(e,t,n){this.name=e,this.schema=t,this.spec=n,this.markSet=null,this.groups=n.group?n.group.split(" "):[],this.attrs=dt(e,n.attrs),this.defaultAttrs=at(this.attrs),this.contentMatch=null,this.inlineContent=null,this.isBlock=!(n.inline||"text"==e),this.isText="text"==e}get isInline(){return!this.isBlock}get isTextblock(){return this.isBlock&&this.inlineContent}get isLeaf(){return this.contentMatch==Qe.empty}get isAtom(){return this.isLeaf||!!this.spec.atom}isInGroup(e){return this.groups.indexOf(e)>-1}get whitespace(){return this.spec.whitespace||(this.spec.code?"pre":"normal")}hasRequiredAttrs(){for(let e in this.attrs)if(this.attrs[e].isRequired)return!0;return!1}compatibleContent(e){return this==e||this.contentMatch.compatible(e.contentMatch)}computeAttrs(e){return!e&&this.defaultAttrs?this.defaultAttrs:lt(this.attrs,e)}create(e=null,t,n){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new Ge(this,this.computeAttrs(e),Se.from(t),Ee.setFrom(n))}createChecked(e=null,t,n){return t=Se.from(t),this.checkContent(t),new Ge(this,this.computeAttrs(e),t,Ee.setFrom(n))}createAndFill(e=null,t,n){if(e=this.computeAttrs(e),(t=Se.from(t)).size){let e=this.contentMatch.fillBefore(t);if(!e)return null;t=e.append(t)}let r=this.contentMatch.matchFragment(t),o=r&&r.fillBefore(Se.empty,!0);return o?new Ge(this,e,t.append(o),Ee.setFrom(n)):null}validContent(e){let t=this.contentMatch.matchFragment(e);if(!t||!t.validEnd)return!1;for(let t=0;t<e.childCount;t++)if(!this.allowsMarks(e.child(t).marks))return!1;return!0}checkContent(e){if(!this.validContent(e))throw new RangeError(`Invalid content for node ${this.name}: ${e.toString().slice(0,50)}`)}checkAttrs(e){ct(this.attrs,e,"node",this.name)}allowsMarkType(e){return null==this.markSet||this.markSet.indexOf(e)>-1}allowsMarks(e){if(null==this.markSet)return!0;for(let t=0;t<e.length;t++)if(!this.allowsMarkType(e[t].type))return!1;return!0}allowedMarks(e){if(null==this.markSet)return e;let t;for(let n=0;n<e.length;n++)this.allowsMarkType(e[n].type)?t&&t.push(e[n]):t||(t=e.slice(0,n));return t?t.length?t:Ee.none:e}static compile(t,n){let r=Object.create(null);t.forEach(((t,o)=>r[t]=new e(t,n,o)));let o=n.spec.topNode||"doc";if(!r[o])throw new RangeError("Schema is missing its top node type ('"+o+"')");if(!r.text)throw new RangeError("Every schema needs a 'text' type");for(let e in r.text.attrs)throw new RangeError("The text node type should not have attributes");return r}};class ut{constructor(e,t,n){this.hasDefault=Object.prototype.hasOwnProperty.call(n,"default"),this.default=n.default,this.validate="string"==typeof n.validate?function(e,t,n){let r=n.split("|");return n=>{let o=null===n?"null":typeof n;if(r.indexOf(o)<0)throw new RangeError(`Expected value of type ${r} for attribute ${t} on type ${e}, got ${o}`)}}(e,t,n.validate):n.validate}get isRequired(){return!this.hasDefault}}class pt{constructor(e,t,n,r){this.name=e,this.rank=t,this.schema=n,this.spec=r,this.attrs=dt(e,r.attrs),this.excluded=null;let o=at(this.attrs);this.instance=o?new Ee(this,o):null}create(e=null){return!e&&this.instance?this.instance:new Ee(this,lt(this.attrs,e))}static compile(e,t){let n=Object.create(null),r=0;return e.forEach(((e,o)=>n[e]=new pt(e,r++,t,o))),n}removeFromSet(e){for(var t=0;t<e.length;t++)e[t].type==this&&(e=e.slice(0,t).concat(e.slice(t+1)),t--);return e}isInSet(e){for(let t=0;t<e.length;t++)if(e[t].type==this)return e[t]}checkAttrs(e){ct(this.attrs,e,"mark",this.name)}excludes(e){return this.excluded.indexOf(e)>-1}}class ft{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let t=this.spec={};for(let n in e)t[n]=e[n];t.nodes=ke.from(e.nodes),t.marks=ke.from(e.marks||{}),this.nodes=ht.compile(this.spec.nodes,this),this.marks=pt.compile(this.spec.marks,this);let n=Object.create(null);for(let e in this.nodes){if(e in this.marks)throw new RangeError(e+" can not be both a node and a mark");let t=this.nodes[e],r=t.spec.content||"",o=t.spec.marks;if(t.contentMatch=n[r]||(n[r]=Qe.parse(r,this.nodes)),t.inlineContent=t.contentMatch.inlineContent,t.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!t.isInline||!t.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=t}t.markSet="_"==o?null:o?mt(this,o.split(" ")):""!=o&&t.inlineContent?null:[]}for(let e in this.marks){let t=this.marks[e],n=t.spec.excludes;t.excluded=null==n?[t]:""==n?[]:mt(this,n.split(" "))}this.nodeFromJSON=e=>Ge.fromJSON(this,e),this.markFromJSON=e=>Ee.fromJSON(this,e),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(e,t=null,n,r){if("string"==typeof e)e=this.nodeType(e);else{if(!(e instanceof ht))throw new RangeError("Invalid node type: "+e);if(e.schema!=this)throw new RangeError("Node type from different schema used ("+e.name+")")}return e.createChecked(t,n,r)}text(e,t){let n=this.nodes.text;return new Ye(n,n.defaultAttrs,e,Ee.setFrom(t))}mark(e,t){return"string"==typeof e&&(e=this.marks[e]),e.create(t)}nodeType(e){let t=this.nodes[e];if(!t)throw new RangeError("Unknown node type: "+e);return t}}function mt(e,t){let n=[];for(let r=0;r<t.length;r++){let o=t[r],i=e.marks[o],s=i;if(i)n.push(i);else for(let t in e.marks){let r=e.marks[t];("_"==o||r.spec.group&&r.spec.group.split(" ").indexOf(o)>-1)&&n.push(s=r)}if(!s)throw new SyntaxError("Unknown mark type: '"+t[r]+"'")}return n}class gt{constructor(e,t){this.schema=e,this.rules=t,this.tags=[],this.styles=[];let n=this.matchedStyles=[];t.forEach((e=>{if(function(e){return null!=e.tag}(e))this.tags.push(e);else if(function(e){return null!=e.style}(e)){let t=/[^=]*/.exec(e.style)[0];n.indexOf(t)<0&&n.push(t),this.styles.push(e)}})),this.normalizeLists=!this.tags.some((t=>{if(!/^(ul|ol)\b/.test(t.tag)||!t.node)return!1;let n=e.nodes[t.node];return n.contentMatch.matchType(n)}))}parse(e,t={}){let n=new kt(this,t,!1);return n.addAll(e,Ee.none,t.from,t.to),n.finish()}parseSlice(e,t={}){let n=new kt(this,t,!0);return n.addAll(e,Ee.none,t.from,t.to),De.maxOpen(n.finish())}matchTag(e,t,n){for(let r=n?this.tags.indexOf(n)+1:0;r<this.tags.length;r++){let n=this.tags[r];if(Ct(e,n.tag)&&(void 0===n.namespace||e.namespaceURI==n.namespace)&&(!n.context||t.matchesContext(n.context))){if(n.getAttrs){let t=n.getAttrs(e);if(!1===t)continue;n.attrs=t||void 0}return n}}}matchStyle(e,t,n,r){for(let o=r?this.styles.indexOf(r)+1:0;o<this.styles.length;o++){let r=this.styles[o],i=r.style;if(!(0!=i.indexOf(e)||r.context&&!n.matchesContext(r.context)||i.length>e.length&&(61!=i.charCodeAt(e.length)||i.slice(e.length+1)!=t))){if(r.getAttrs){let e=r.getAttrs(t);if(!1===e)continue;r.attrs=e||void 0}return r}}}static schemaRules(e){let t=[];function n(e){let n=null==e.priority?50:e.priority,r=0;for(;r<t.length;r++){let e=t[r];if((null==e.priority?50:e.priority)<n)break}t.splice(r,0,e)}for(let t in e.marks){let r=e.marks[t].spec.parseDOM;r&&r.forEach((e=>{n(e=Nt(e)),e.mark||e.ignore||e.clearMark||(e.mark=t)}))}for(let t in e.nodes){let r=e.nodes[t].spec.parseDOM;r&&r.forEach((e=>{n(e=Nt(e)),e.node||e.ignore||e.mark||(e.node=t)}))}return t}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new gt(e,gt.schemaRules(e)))}}const yt={address:!0,article:!0,aside:!0,blockquote:!0,canvas:!0,dd:!0,div:!0,dl:!0,fieldset:!0,figcaption:!0,figure:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,li:!0,noscript:!0,ol:!0,output:!0,p:!0,pre:!0,section:!0,table:!0,tfoot:!0,ul:!0},vt={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},bt={ol:!0,ul:!0};function xt(e,t,n){return null!=t?(t?1:0)|("full"===t?2:0):e&&"pre"==e.whitespace?3:-5&n}class wt{constructor(e,t,n,r,o,i){this.type=e,this.attrs=t,this.marks=n,this.solid=r,this.options=i,this.content=[],this.activeMarks=Ee.none,this.match=o||(4&i?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let t=this.type.contentMatch.fillBefore(Se.from(e));if(!t){let t,n=this.type.contentMatch;return(t=n.findWrapping(e.type))?(this.match=n,t):null}this.match=this.type.contentMatch.matchFragment(t)}return this.match.findWrapping(e.type)}finish(e){if(!(1&this.options)){let e,t=this.content[this.content.length-1];if(t&&t.isText&&(e=/[ \t\r\n\u000c]+$/.exec(t.text))){let n=t;t.text.length==e[0].length?this.content.pop():this.content[this.content.length-1]=n.withText(n.text.slice(0,n.text.length-e[0].length))}}let t=Se.from(this.content);return!e&&this.match&&(t=t.append(this.match.fillBefore(Se.empty,!0))),this.type?this.type.create(this.attrs,t,this.marks):t}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!yt.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class kt{constructor(e,t,n){this.parser=e,this.options=t,this.isOpen=n,this.open=0,this.localPreserveWS=!1;let r,o=t.topNode,i=xt(null,t.preserveWhitespace,0)|(n?4:0);r=o?new wt(o.type,o.attrs,Ee.none,!0,t.topMatch||o.type.contentMatch,i):new wt(n?null:e.schema.topNodeType,null,Ee.none,!0,null,i),this.nodes=[r],this.find=t.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e,t){3==e.nodeType?this.addTextNode(e,t):1==e.nodeType&&this.addElement(e,t)}addTextNode(e,t){let n=e.nodeValue,r=this.top,o=2&r.options?"full":this.localPreserveWS||(1&r.options)>0;if("full"===o||r.inlineContext(e)||/[^ \t\r\n\u000c]/.test(n)){if(o)n="full"!==o?n.replace(/\r?\n|\r/g," "):n.replace(/\r\n?/g,"\n");else if(n=n.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(n)&&this.open==this.nodes.length-1){let t=r.content[r.content.length-1],o=e.previousSibling;(!t||o&&"BR"==o.nodeName||t.isText&&/[ \t\r\n\u000c]$/.test(t.text))&&(n=n.slice(1))}n&&this.insertNode(this.parser.schema.text(n),t,!/\S/.test(n)),this.findInText(e)}else this.findInside(e)}addElement(e,t,n){let r=this.localPreserveWS,o=this.top;("PRE"==e.tagName||/pre/.test(e.style&&e.style.whiteSpace))&&(this.localPreserveWS=!0);let i,s=e.nodeName.toLowerCase();bt.hasOwnProperty(s)&&this.parser.normalizeLists&&function(e){for(let t=e.firstChild,n=null;t;t=t.nextSibling){let e=1==t.nodeType?t.nodeName.toLowerCase():null;e&&bt.hasOwnProperty(e)&&n?(n.appendChild(t),t=n):"li"==e?n=t:e&&(n=null)}}(e);let a=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(i=this.parser.matchTag(e,this,n));e:if(a?a.ignore:vt.hasOwnProperty(s))this.findInside(e),this.ignoreFallback(e,t);else if(!a||a.skip||a.closeParent){a&&a.closeParent?this.open=Math.max(0,this.open-1):a&&a.skip.nodeType&&(e=a.skip);let n,r=this.needsBlock;if(yt.hasOwnProperty(s))o.content.length&&o.content[0].isInline&&this.open&&(this.open--,o=this.top),n=!0,o.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e,t);break e}let i=a&&a.skip?t:this.readStyles(e,t);i&&this.addAll(e,i),n&&this.sync(o),this.needsBlock=r}else{let n=this.readStyles(e,t);n&&this.addElementByRule(e,a,n,!1===a.consuming?i:void 0)}this.localPreserveWS=r}leafFallback(e,t){"BR"==e.nodeName&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode("\n"),t)}ignoreFallback(e,t){"BR"!=e.nodeName||this.top.type&&this.top.type.inlineContent||this.findPlace(this.parser.schema.text("-"),t,!0)}readStyles(e,t){let n=e.style;if(n&&n.length)for(let e=0;e<this.parser.matchedStyles.length;e++){let r=this.parser.matchedStyles[e],o=n.getPropertyValue(r);if(o)for(let e;;){let n=this.parser.matchStyle(r,o,this,e);if(!n)break;if(n.ignore)return null;if(t=n.clearMark?t.filter((e=>!n.clearMark(e))):t.concat(this.parser.schema.marks[n.mark].create(n.attrs)),!1!==n.consuming)break;e=n}}return t}addElementByRule(e,t,n,r){let o,i;if(t.node)if(i=this.parser.schema.nodes[t.node],i.isLeaf)this.insertNode(i.create(t.attrs),n,"BR"==e.nodeName)||this.leafFallback(e,n);else{let e=this.enter(i,t.attrs||null,n,t.preserveWhitespace);e&&(o=!0,n=e)}else{let e=this.parser.schema.marks[t.mark];n=n.concat(e.create(t.attrs))}let s=this.top;if(i&&i.isLeaf)this.findInside(e);else if(r)this.addElement(e,n,r);else if(t.getContent)this.findInside(e),t.getContent(e,this.parser.schema).forEach((e=>this.insertNode(e,n,!1)));else{let r=e;"string"==typeof t.contentElement?r=e.querySelector(t.contentElement):"function"==typeof t.contentElement?r=t.contentElement(e):t.contentElement&&(r=t.contentElement),this.findAround(e,r,!0),this.addAll(r,n),this.findAround(e,r,!1)}o&&this.sync(s)&&this.open--}addAll(e,t,n,r){let o=n||0;for(let i=n?e.childNodes[n]:e.firstChild,s=null==r?null:e.childNodes[r];i!=s;i=i.nextSibling,++o)this.findAtPoint(e,o),this.addDOM(i,t);this.findAtPoint(e,o)}findPlace(e,t,n){let r,o;for(let t=this.open,i=0;t>=0;t--){let s=this.nodes[t],a=s.findWrapping(e);if(a&&(!r||r.length>a.length+i)&&(r=a,o=s,!a.length))break;if(s.solid){if(n)break;i+=2}}if(!r)return null;this.sync(o);for(let e=0;e<r.length;e++)t=this.enterInner(r[e],null,t,!1);return t}insertNode(e,t,n){if(e.isInline&&this.needsBlock&&!this.top.type){let e=this.textblockFromContext();e&&(t=this.enterInner(e,null,t))}let r=this.findPlace(e,t,n);if(r){this.closeExtra();let t=this.top;t.match&&(t.match=t.match.matchType(e.type));let n=Ee.none;for(let o of r.concat(e.marks))(t.type?t.type.allowsMarkType(o.type):St(o.type,e.type))&&(n=o.addToSet(n));return t.content.push(e.mark(n)),!0}return!1}enter(e,t,n,r){let o=this.findPlace(e.create(t),n,!1);return o&&(o=this.enterInner(e,t,n,!0,r)),o}enterInner(e,t,n,r=!1,o){this.closeExtra();let i=this.top;i.match=i.match&&i.match.matchType(e);let s=xt(e,o,i.options);4&i.options&&0==i.content.length&&(s|=4);let a=Ee.none;return n=n.filter((t=>!(i.type?i.type.allowsMarkType(t.type):St(t.type,e))||(a=t.addToSet(a),!1))),this.nodes.push(new wt(e,t,a,r,null,s)),this.open++,n}closeExtra(e=!1){let t=this.nodes.length-1;if(t>this.open){for(;t>this.open;t--)this.nodes[t-1].content.push(this.nodes[t].finish(e));this.nodes.length=this.open+1}}finish(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(!(!this.isOpen&&!this.options.topOpen))}sync(e){for(let t=this.open;t>=0;t--){if(this.nodes[t]==e)return this.open=t,!0;this.localPreserveWS&&(this.nodes[t].options|=1)}return!1}get currentPos(){this.closeExtra();let e=0;for(let t=this.open;t>=0;t--){let n=this.nodes[t].content;for(let t=n.length-1;t>=0;t--)e+=n[t].nodeSize;t&&e++}return e}findAtPoint(e,t){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].node==e&&this.find[n].offset==t&&(this.find[n].pos=this.currentPos)}findInside(e){if(this.find)for(let t=0;t<this.find.length;t++)null==this.find[t].pos&&1==e.nodeType&&e.contains(this.find[t].node)&&(this.find[t].pos=this.currentPos)}findAround(e,t,n){if(e!=t&&this.find)for(let r=0;r<this.find.length;r++)if(null==this.find[r].pos&&1==e.nodeType&&e.contains(this.find[r].node)){t.compareDocumentPosition(this.find[r].node)&(n?2:4)&&(this.find[r].pos=this.currentPos)}}findInText(e){if(this.find)for(let t=0;t<this.find.length;t++)this.find[t].node==e&&(this.find[t].pos=this.currentPos-(e.nodeValue.length-this.find[t].offset))}matchesContext(e){if(e.indexOf("|")>-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let t=e.split("/"),n=this.options.context,r=!(this.isOpen||n&&n.parent.type!=this.nodes[0].type),o=-(n?n.depth+1:0)+(r?0:1),i=(e,s)=>{for(;e>=0;e--){let a=t[e];if(""==a){if(e==t.length-1||0==e)continue;for(;s>=o;s--)if(i(e-1,s))return!0;return!1}{let e=s>0||0==s&&r?this.nodes[s].type:n&&s>=o?n.node(s-o).type:null;if(!e||e.name!=a&&!e.isInGroup(a))return!1;s--}}return!0};return i(t.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let t=e.depth;t>=0;t--){let n=e.node(t).contentMatchAt(e.indexAfter(t)).defaultType;if(n&&n.isTextblock&&n.defaultAttrs)return n}for(let e in this.parser.schema.nodes){let t=this.parser.schema.nodes[e];if(t.isTextblock&&t.defaultAttrs)return t}}}function Ct(e,t){return(e.matches||e.msMatchesSelector||e.webkitMatchesSelector||e.mozMatchesSelector).call(e,t)}function Nt(e){let t={};for(let n in e)t[n]=e[n];return t}function St(e,t){let n=t.schema.nodes;for(let r in n){let o=n[r];if(!o.allowsMarkType(e))continue;let i=[],s=e=>{i.push(e);for(let n=0;n<e.edgeCount;n++){let{type:r,next:o}=e.edge(n);if(r==t)return!0;if(i.indexOf(o)<0&&s(o))return!0}};if(s(o.contentMatch))return!0}}class Mt{constructor(e,t){this.nodes=e,this.marks=t}serializeFragment(e,t={},n){n||(n=Ot(t).createDocumentFragment());let r=n,o=[];return e.forEach((e=>{if(o.length||e.marks.length){let n=0,i=0;for(;n<o.length&&i<e.marks.length;){let t=e.marks[i];if(this.marks[t.type.name]){if(!t.eq(o[n][0])||!1===t.type.spec.spanning)break;n++,i++}else i++}for(;n<o.length;)r=o.pop()[1];for(;i<e.marks.length;){let n=e.marks[i++],s=this.serializeMark(n,e.isInline,t);s&&(o.push([n,r]),r.appendChild(s.dom),r=s.contentDOM||s.dom)}}r.appendChild(this.serializeNodeInner(e,t))})),n}serializeNodeInner(e,t){let{dom:n,contentDOM:r}=Dt(Ot(t),this.nodes[e.type.name](e),null,e.attrs);if(r){if(e.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(e.content,t,r)}return n}serializeNode(e,t={}){let n=this.serializeNodeInner(e,t);for(let r=e.marks.length-1;r>=0;r--){let o=this.serializeMark(e.marks[r],e.isInline,t);o&&((o.contentDOM||o.dom).appendChild(n),n=o.dom)}return n}serializeMark(e,t,n={}){let r=this.marks[e.type.name];return r&&Dt(Ot(n),r(e,t),null,e.attrs)}static renderSpec(e,t,n=null,r){return Dt(e,t,n,r)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new Mt(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let t=Tt(e.nodes);return t.text||(t.text=e=>e.text),t}static marksFromSchema(e){return Tt(e.marks)}}function Tt(e){let t={};for(let n in e){let r=e[n].spec.toDOM;r&&(t[n]=r)}return t}function Ot(e){return e.document||window.document}const Et=new WeakMap;function At(e){let t=Et.get(e);return void 0===t&&Et.set(e,t=function(e){let t=null;function n(e){if(e&&"object"==typeof e)if(Array.isArray(e))if("string"==typeof e[0])t||(t=[]),t.push(e);else for(let t=0;t<e.length;t++)n(e[t]);else for(let t in e)n(e[t])}return n(e),t}(e)),t}function Dt(e,t,n,r){if("string"==typeof t)return{dom:e.createTextNode(t)};if(null!=t.nodeType)return{dom:t};if(t.dom&&null!=t.dom.nodeType)return t;let o,i=t[0];if("string"!=typeof i)throw new RangeError("Invalid array passed to renderSpec");if(r&&(o=At(r))&&o.indexOf(t)>-1)throw new RangeError("Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.");let s,a=i.indexOf(" ");a>0&&(n=i.slice(0,a),i=i.slice(a+1));let l=n?e.createElementNS(n,i):e.createElement(i),c=t[1],d=1;if(c&&"object"==typeof c&&null==c.nodeType&&!Array.isArray(c)){d=2;for(let e in c)if(null!=c[e]){let t=e.indexOf(" ");t>0?l.setAttributeNS(e.slice(0,t),e.slice(t+1),c[e]):"style"==e&&l.style?l.style.cssText=c[e]:l.setAttribute(e,c[e])}}for(let o=d;o<t.length;o++){let i=t[o];if(0===i){if(o<t.length-1||o>d)throw new RangeError("Content hole must be the only child of its parent node");return{dom:l,contentDOM:l}}{let{dom:t,contentDOM:o}=Dt(e,i,n,r);if(l.appendChild(t),o){if(s)throw new RangeError("Multiple content holes");s=o}}}return{dom:l,contentDOM:s}}const Rt=Math.pow(2,16);function Lt(e){return 65535&e}class It{constructor(e,t,n){this.pos=e,this.delInfo=t,this.recover=n}get deleted(){return(8&this.delInfo)>0}get deletedBefore(){return(5&this.delInfo)>0}get deletedAfter(){return(6&this.delInfo)>0}get deletedAcross(){return(4&this.delInfo)>0}}class zt{constructor(e,t=!1){if(this.ranges=e,this.inverted=t,!e.length&&zt.empty)return zt.empty}recover(e){let t=0,n=Lt(e);if(!this.inverted)for(let e=0;e<n;e++)t+=this.ranges[3*e+2]-this.ranges[3*e+1];return this.ranges[3*n]+t+function(e){return(e-(65535&e))/Rt}(e)}mapResult(e,t=1){return this._map(e,t,!1)}map(e,t=1){return this._map(e,t,!0)}_map(e,t,n){let r=0,o=this.inverted?2:1,i=this.inverted?1:2;for(let s=0;s<this.ranges.length;s+=3){let a=this.ranges[s]-(this.inverted?r:0);if(a>e)break;let l=this.ranges[s+o],c=this.ranges[s+i],d=a+l;if(e<=d){let o=a+r+((l?e==a?-1:e==d?1:t:t)<0?0:c);if(n)return o;let i=e==(t<0?a:d)?null:s/3+(e-a)*Rt,h=e==a?2:e==d?1:4;return(t<0?e!=a:e!=d)&&(h|=8),new It(o,h,i)}r+=c-l}return n?e+r:new It(e+r,0,null)}touches(e,t){let n=0,r=Lt(t),o=this.inverted?2:1,i=this.inverted?1:2;for(let t=0;t<this.ranges.length;t+=3){let s=this.ranges[t]-(this.inverted?n:0);if(s>e)break;let a=this.ranges[t+o];if(e<=s+a&&t==3*r)return!0;n+=this.ranges[t+i]-a}return!1}forEach(e){let t=this.inverted?2:1,n=this.inverted?1:2;for(let r=0,o=0;r<this.ranges.length;r+=3){let i=this.ranges[r],s=i-(this.inverted?o:0),a=i+(this.inverted?0:o),l=this.ranges[r+t],c=this.ranges[r+n];e(s,s+l,a,a+c),o+=c-l}}invert(){return new zt(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return 0==e?zt.empty:new zt(e<0?[0,-e,0]:[0,0,e])}}zt.empty=new zt([]);class Pt{constructor(e,t,n=0,r=(e?e.length:0)){this.mirror=t,this.from=n,this.to=r,this._maps=e||[],this.ownData=!(e||t)}get maps(){return this._maps}slice(e=0,t=this.maps.length){return new Pt(this._maps,this.mirror,e,t)}appendMap(e,t){this.ownData||(this._maps=this._maps.slice(),this.mirror=this.mirror&&this.mirror.slice(),this.ownData=!0),this.to=this._maps.push(e),null!=t&&this.setMirror(this._maps.length-1,t)}appendMapping(e){for(let t=0,n=this._maps.length;t<e._maps.length;t++){let r=e.getMirror(t);this.appendMap(e._maps[t],null!=r&&r<t?n+r:void 0)}}getMirror(e){if(this.mirror)for(let t=0;t<this.mirror.length;t++)if(this.mirror[t]==e)return this.mirror[t+(t%2?-1:1)]}setMirror(e,t){this.mirror||(this.mirror=[]),this.mirror.push(e,t)}appendMappingInverted(e){for(let t=e.maps.length-1,n=this._maps.length+e._maps.length;t>=0;t--){let r=e.getMirror(t);this.appendMap(e._maps[t].invert(),null!=r&&r>t?n-r-1:void 0)}}invert(){let e=new Pt;return e.appendMappingInverted(this),e}map(e,t=1){if(this.mirror)return this._map(e,t,!0);for(let n=this.from;n<this.to;n++)e=this._maps[n].map(e,t);return e}mapResult(e,t=1){return this._map(e,t,!1)}_map(e,t,n){let r=0;for(let n=this.from;n<this.to;n++){let o=this._maps[n].mapResult(e,t);if(null!=o.recover){let t=this.getMirror(n);if(null!=t&&t>n&&t<this.to){n=t,e=this._maps[t].recover(o.recover);continue}}r|=o.delInfo,e=o.pos}return n?e:new It(e,r,null)}}const Bt=Object.create(null);class $t{getMap(){return zt.empty}merge(e){return null}static fromJSON(e,t){if(!t||!t.stepType)throw new RangeError("Invalid input for Step.fromJSON");let n=Bt[t.stepType];if(!n)throw new RangeError(`No step type ${t.stepType} defined`);return n.fromJSON(e,t)}static jsonID(e,t){if(e in Bt)throw new RangeError("Duplicate use of step JSON ID "+e);return Bt[e]=t,t.prototype.jsonID=e,t}}class Vt{constructor(e,t){this.doc=e,this.failed=t}static ok(e){return new Vt(e,null)}static fail(e){return new Vt(null,e)}static fromReplace(e,t,n,r){try{return Vt.ok(e.replace(t,n,r))}catch(e){if(e instanceof Ae)return Vt.fail(e.message);throw e}}}function jt(e,t,n){let r=[];for(let o=0;o<e.childCount;o++){let i=e.child(o);i.content.size&&(i=i.copy(jt(i.content,t,i))),i.isInline&&(i=t(i,n,o)),r.push(i)}return Se.fromArray(r)}class Ft extends $t{constructor(e,t,n){super(),this.from=e,this.to=t,this.mark=n}apply(e){let t=e.slice(this.from,this.to),n=e.resolve(this.from),r=n.node(n.sharedDepth(this.to)),o=new De(jt(t.content,((e,t)=>e.isAtom&&t.type.allowsMarkType(this.mark.type)?e.mark(this.mark.addToSet(e.marks)):e),r),t.openStart,t.openEnd);return Vt.fromReplace(e,this.from,this.to,o)}invert(){return new Ht(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),n=e.mapResult(this.to,-1);return t.deleted&&n.deleted||t.pos>=n.pos?null:new Ft(t.pos,n.pos,this.mark)}merge(e){return e instanceof Ft&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Ft(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,t){if("number"!=typeof t.from||"number"!=typeof t.to)throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new Ft(t.from,t.to,e.markFromJSON(t.mark))}}$t.jsonID("addMark",Ft);class Ht extends $t{constructor(e,t,n){super(),this.from=e,this.to=t,this.mark=n}apply(e){let t=e.slice(this.from,this.to),n=new De(jt(t.content,(e=>e.mark(this.mark.removeFromSet(e.marks))),e),t.openStart,t.openEnd);return Vt.fromReplace(e,this.from,this.to,n)}invert(){return new Ft(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),n=e.mapResult(this.to,-1);return t.deleted&&n.deleted||t.pos>=n.pos?null:new Ht(t.pos,n.pos,this.mark)}merge(e){return e instanceof Ht&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Ht(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,t){if("number"!=typeof t.from||"number"!=typeof t.to)throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new Ht(t.from,t.to,e.markFromJSON(t.mark))}}$t.jsonID("removeMark",Ht);class _t extends $t{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return Vt.fail("No node at mark step's position");let n=t.type.create(t.attrs,null,this.mark.addToSet(t.marks));return Vt.fromReplace(e,this.pos,this.pos+1,new De(Se.from(n),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);if(t){let e=this.mark.addToSet(t.marks);if(e.length==t.marks.length){for(let n=0;n<t.marks.length;n++)if(!t.marks[n].isInSet(e))return new _t(this.pos,t.marks[n]);return new _t(this.pos,this.mark)}}return new qt(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new _t(t.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,t){if("number"!=typeof t.pos)throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new _t(t.pos,e.markFromJSON(t.mark))}}$t.jsonID("addNodeMark",_t);class qt extends $t{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return Vt.fail("No node at mark step's position");let n=t.type.create(t.attrs,null,this.mark.removeFromSet(t.marks));return Vt.fromReplace(e,this.pos,this.pos+1,new De(Se.from(n),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);return t&&this.mark.isInSet(t.marks)?new _t(this.pos,this.mark):this}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new qt(t.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,t){if("number"!=typeof t.pos)throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new qt(t.pos,e.markFromJSON(t.mark))}}$t.jsonID("removeNodeMark",qt);class Wt extends $t{constructor(e,t,n,r=!1){super(),this.from=e,this.to=t,this.slice=n,this.structure=r}apply(e){return this.structure&&Jt(e,this.from,this.to)?Vt.fail("Structure replace would overwrite content"):Vt.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new zt([this.from,this.to-this.from,this.slice.size])}invert(e){return new Wt(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let t=e.mapResult(this.from,1),n=e.mapResult(this.to,-1);return t.deletedAcross&&n.deletedAcross?null:new Wt(t.pos,Math.max(t.pos,n.pos),this.slice,this.structure)}merge(e){if(!(e instanceof Wt)||e.structure||this.structure)return null;if(this.from+this.slice.size!=e.from||this.slice.openEnd||e.slice.openStart){if(e.to!=this.from||this.slice.openStart||e.slice.openEnd)return null;{let t=this.slice.size+e.slice.size==0?De.empty:new De(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new Wt(e.from,this.to,t,this.structure)}}{let t=this.slice.size+e.slice.size==0?De.empty:new De(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new Wt(this.from,this.to+(e.to-e.from),t,this.structure)}}toJSON(){let e={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,t){if("number"!=typeof t.from||"number"!=typeof t.to)throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new Wt(t.from,t.to,De.fromJSON(e,t.slice),!!t.structure)}}$t.jsonID("replace",Wt);class Kt extends $t{constructor(e,t,n,r,o,i,s=!1){super(),this.from=e,this.to=t,this.gapFrom=n,this.gapTo=r,this.slice=o,this.insert=i,this.structure=s}apply(e){if(this.structure&&(Jt(e,this.from,this.gapFrom)||Jt(e,this.gapTo,this.to)))return Vt.fail("Structure gap-replace would overwrite content");let t=e.slice(this.gapFrom,this.gapTo);if(t.openStart||t.openEnd)return Vt.fail("Gap is not a flat range");let n=this.slice.insertAt(this.insert,t.content);return n?Vt.fromReplace(e,this.from,this.to,n):Vt.fail("Content does not fit in gap")}getMap(){return new zt([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(e){let t=this.gapTo-this.gapFrom;return new Kt(this.from,this.from+this.slice.size+t,this.from+this.insert,this.from+this.insert+t,e.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(e){let t=e.mapResult(this.from,1),n=e.mapResult(this.to,-1),r=this.from==this.gapFrom?t.pos:e.map(this.gapFrom,-1),o=this.to==this.gapTo?n.pos:e.map(this.gapTo,1);return t.deletedAcross&&n.deletedAcross||r<t.pos||o>n.pos?null:new Kt(t.pos,n.pos,r,o,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,t){if("number"!=typeof t.from||"number"!=typeof t.to||"number"!=typeof t.gapFrom||"number"!=typeof t.gapTo||"number"!=typeof t.insert)throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new Kt(t.from,t.to,t.gapFrom,t.gapTo,De.fromJSON(e,t.slice),t.insert,!!t.structure)}}function Jt(e,t,n){let r=e.resolve(t),o=n-t,i=r.depth;for(;o>0&&i>0&&r.indexAfter(i)==r.node(i).childCount;)i--,o--;if(o>0){let e=r.node(i).maybeChild(r.indexAfter(i));for(;o>0;){if(!e||e.isLeaf)return!0;e=e.firstChild,o--}}return!1}function Ut(e,t,n,r=n.contentMatch,o=!0){let i=e.doc.nodeAt(t),s=[],a=t+1;for(let t=0;t<i.childCount;t++){let l=i.child(t),c=a+l.nodeSize,d=r.matchType(l.type);if(d){r=d;for(let t=0;t<l.marks.length;t++)n.allowsMarkType(l.marks[t].type)||e.step(new Ht(a,c,l.marks[t]));if(o&&l.isText&&"pre"!=n.whitespace){let e,t,r=/\r?\n|\r/g;for(;e=r.exec(l.text);)t||(t=new De(Se.from(n.schema.text(" ",n.allowedMarks(l.marks))),0,0)),s.push(new Wt(a+e.index,a+e.index+e[0].length,t))}}else s.push(new Wt(a,c,De.empty));a=c}if(!r.validEnd){let t=r.fillBefore(Se.empty,!0);e.replace(a,a,new De(t,0,0))}for(let t=s.length-1;t>=0;t--)e.step(s[t])}function Gt(e,t,n){return(0==t||e.canReplace(t,e.childCount))&&(n==e.childCount||e.canReplace(0,n))}function Yt(e){let t=e.parent.content.cutByIndex(e.startIndex,e.endIndex);for(let n=e.depth;;--n){let r=e.$from.node(n),o=e.$from.index(n),i=e.$to.indexAfter(n);if(n<e.depth&&r.canReplace(o,i,t))return n;if(0==n||r.type.spec.isolating||!Gt(r,o,i))break}return null}function Xt(e,t,n=null,r=e){let o=function(e,t){let{parent:n,startIndex:r,endIndex:o}=e,i=n.contentMatchAt(r).findWrapping(t);if(!i)return null;let s=i.length?i[0]:t;return n.canReplaceWith(r,o,s)?i:null}(e,t),i=o&&function(e,t){let{parent:n,startIndex:r,endIndex:o}=e,i=n.child(r),s=t.contentMatch.findWrapping(i.type);if(!s)return null;let a=(s.length?s[s.length-1]:t).contentMatch;for(let e=r;a&&e<o;e++)a=a.matchType(n.child(e).type);return a&&a.validEnd?s:null}(r,t);return i?o.map(Qt).concat({type:t,attrs:n}).concat(i.map(Qt)):null}function Qt(e){return{type:e,attrs:null}}function Zt(e,t,n,r){t.forEach(((o,i)=>{if(o.isText){let s,a=/\r?\n|\r/g;for(;s=a.exec(o.text);){let o=e.mapping.slice(r).map(n+1+i+s.index);e.replaceWith(o,o+1,t.type.schema.linebreakReplacement.create())}}}))}function en(e,t,n,r){t.forEach(((o,i)=>{if(o.type==o.type.schema.linebreakReplacement){let o=e.mapping.slice(r).map(n+1+i);e.replaceWith(o,o+1,t.type.schema.text("\n"))}}))}function tn(e,t,n=1,r){let o=e.resolve(t),i=o.depth-n,s=r&&r[r.length-1]||o.parent;if(i<0||o.parent.type.spec.isolating||!o.parent.canReplace(o.index(),o.parent.childCount)||!s.type.validContent(o.parent.content.cutByIndex(o.index(),o.parent.childCount)))return!1;for(let e=o.depth-1,t=n-2;e>i;e--,t--){let n=o.node(e),i=o.index(e);if(n.type.spec.isolating)return!1;let s=n.content.cutByIndex(i,n.childCount),a=r&&r[t+1];a&&(s=s.replaceChild(0,a.type.create(a.attrs)));let l=r&&r[t]||n;if(!n.canReplace(i+1,n.childCount)||!l.type.validContent(s))return!1}let a=o.indexAfter(i),l=r&&r[0];return o.node(i).canReplaceWith(a,a,l?l.type:o.node(i+1).type)}function nn(e,t){let n=e.resolve(t),r=n.index();return rn(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(r,r+1)}function rn(e,t){return!(!e||!t||e.isLeaf||!function(e,t){t.content.size||e.type.compatibleContent(t.type);let n=e.contentMatchAt(e.childCount),{linebreakReplacement:r}=e.type.schema;for(let o=0;o<t.childCount;o++){let i=t.child(o),s=i.type==r?e.type.schema.nodes.text:i.type;if(n=n.matchType(s),!n)return!1;if(!e.type.allowsMarks(i.marks))return!1}return n.validEnd}(e,t))}function on(e,t,n=-1){let r=e.resolve(t);for(let e=r.depth;;e--){let o,i,s=r.index(e);if(e==r.depth?(o=r.nodeBefore,i=r.nodeAfter):n>0?(o=r.node(e+1),s++,i=r.node(e).maybeChild(s)):(o=r.node(e).maybeChild(s-1),i=r.node(e+1)),o&&!o.isTextblock&&rn(o,i)&&r.node(e).canReplace(s,s+1))return t;if(0==e)break;t=n<0?r.before(e):r.after(e)}}function sn(e,t,n){let r=e.resolve(t);if(!n.content.size)return t;let o=n.content;for(let e=0;e<n.openStart;e++)o=o.firstChild.content;for(let e=1;e<=(0==n.openStart&&n.size?2:1);e++)for(let t=r.depth;t>=0;t--){let n=t==r.depth?0:r.pos<=(r.start(t+1)+r.end(t+1))/2?-1:1,i=r.index(t)+(n>0?1:0),s=r.node(t),a=!1;if(1==e)a=s.canReplace(i,i,o);else{let e=s.contentMatchAt(i).findWrapping(o.firstChild.type);a=e&&s.canReplaceWith(i,i,e[0])}if(a)return 0==n?r.pos:n<0?r.before(t+1):r.after(t+1)}return null}function an(e,t,n=t,r=De.empty){if(t==n&&!r.size)return null;let o=e.resolve(t),i=e.resolve(n);return ln(o,i,r)?new Wt(t,n,r):new cn(o,i,r).fit()}function ln(e,t,n){return!n.openStart&&!n.openEnd&&e.start()==t.start()&&e.parent.canReplace(e.index(),t.index(),n.content)}$t.jsonID("replaceAround",Kt);class cn{constructor(e,t,n){this.$from=e,this.$to=t,this.unplaced=n,this.frontier=[],this.placed=Se.empty;for(let t=0;t<=e.depth;t++){let n=e.node(t);this.frontier.push({type:n.type,match:n.contentMatchAt(e.indexAfter(t))})}for(let t=e.depth;t>0;t--)this.placed=Se.from(e.node(t).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let e=this.findFittable();e?this.placeNodes(e):this.openMore()||this.dropNode()}let e=this.mustMoveInline(),t=this.placed.size-this.depth-this.$from.depth,n=this.$from,r=this.close(e<0?this.$to:n.doc.resolve(e));if(!r)return null;let o=this.placed,i=n.depth,s=r.depth;for(;i&&s&&1==o.childCount;)o=o.firstChild.content,i--,s--;let a=new De(o,i,s);return e>-1?new Kt(n.pos,e,this.$to.pos,this.$to.end(),a,t):a.size||n.pos!=this.$to.pos?new Wt(n.pos,r.pos,a):null}findFittable(){let e=this.unplaced.openStart;for(let t=this.unplaced.content,n=0,r=this.unplaced.openEnd;n<e;n++){let o=t.firstChild;if(t.childCount>1&&(r=0),o.type.spec.isolating&&r<=n){e=n;break}t=o.content}for(let t=1;t<=2;t++)for(let n=1==t?e:this.unplaced.openStart;n>=0;n--){let e,r=null;n?(r=un(this.unplaced.content,n-1).firstChild,e=r.content):e=this.unplaced.content;let o=e.firstChild;for(let e=this.depth;e>=0;e--){let i,{type:s,match:a}=this.frontier[e],l=null;if(1==t&&(o?a.matchType(o.type)||(l=a.fillBefore(Se.from(o),!1)):r&&s.compatibleContent(r.type)))return{sliceDepth:n,frontierDepth:e,parent:r,inject:l};if(2==t&&o&&(i=a.findWrapping(o.type)))return{sliceDepth:n,frontierDepth:e,parent:r,wrap:i};if(r&&a.matchType(r.type))break}}}openMore(){let{content:e,openStart:t,openEnd:n}=this.unplaced,r=un(e,t);return!(!r.childCount||r.firstChild.isLeaf)&&(this.unplaced=new De(e,t+1,Math.max(n,r.size+t>=e.size-n?t+1:0)),!0)}dropNode(){let{content:e,openStart:t,openEnd:n}=this.unplaced,r=un(e,t);if(r.childCount<=1&&t>0){let o=e.size-t<=t+r.size;this.unplaced=new De(dn(e,t-1,1),t-1,o?t-1:n)}else this.unplaced=new De(dn(e,t,1),t,n)}placeNodes({sliceDepth:e,frontierDepth:t,parent:n,inject:r,wrap:o}){for(;this.depth>t;)this.closeFrontierNode();if(o)for(let e=0;e<o.length;e++)this.openFrontierNode(o[e]);let i=this.unplaced,s=n?n.content:i.content,a=i.openStart-e,l=0,c=[],{match:d,type:h}=this.frontier[t];if(r){for(let e=0;e<r.childCount;e++)c.push(r.child(e));d=d.matchFragment(r)}let u=s.size+e-(i.content.size-i.openEnd);for(;l<s.childCount;){let e=s.child(l),t=d.matchType(e.type);if(!t)break;l++,(l>1||0==a||e.content.size)&&(d=t,c.push(pn(e.mark(h.allowedMarks(e.marks)),1==l?a:0,l==s.childCount?u:-1)))}let p=l==s.childCount;p||(u=-1),this.placed=hn(this.placed,t,Se.from(c)),this.frontier[t].match=d,p&&u<0&&n&&n.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let e=0,t=s;e<u;e++){let e=t.lastChild;this.frontier.push({type:e.type,match:e.contentMatchAt(e.childCount)}),t=e.content}this.unplaced=p?0==e?De.empty:new De(dn(i.content,e-1,1),e-1,u<0?i.openEnd:e-1):new De(dn(i.content,e,l),i.openStart,i.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let e,t=this.frontier[this.depth];if(!t.type.isTextblock||!fn(this.$to,this.$to.depth,t.type,t.match,!1)||this.$to.depth==this.depth&&(e=this.findCloseLevel(this.$to))&&e.depth==this.depth)return-1;let{depth:n}=this.$to,r=this.$to.after(n);for(;n>1&&r==this.$to.end(--n);)++r;return r}findCloseLevel(e){e:for(let t=Math.min(this.depth,e.depth);t>=0;t--){let{match:n,type:r}=this.frontier[t],o=t<e.depth&&e.end(t+1)==e.pos+(e.depth-(t+1)),i=fn(e,t,r,n,o);if(i){for(let n=t-1;n>=0;n--){let{match:t,type:r}=this.frontier[n],o=fn(e,n,r,t,!0);if(!o||o.childCount)continue e}return{depth:t,fit:i,move:o?e.doc.resolve(e.after(t+1)):e}}}}close(e){let t=this.findCloseLevel(e);if(!t)return null;for(;this.depth>t.depth;)this.closeFrontierNode();t.fit.childCount&&(this.placed=hn(this.placed,t.depth,t.fit)),e=t.move;for(let n=t.depth+1;n<=e.depth;n++){let t=e.node(n),r=t.type.contentMatch.fillBefore(t.content,!0,e.index(n));this.openFrontierNode(t.type,t.attrs,r)}return e}openFrontierNode(e,t=null,n){let r=this.frontier[this.depth];r.match=r.match.matchType(e),this.placed=hn(this.placed,this.depth,Se.from(e.create(t,n))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let e=this.frontier.pop().match.fillBefore(Se.empty,!0);e.childCount&&(this.placed=hn(this.placed,this.frontier.length,e))}}function dn(e,t,n){return 0==t?e.cutByIndex(n,e.childCount):e.replaceChild(0,e.firstChild.copy(dn(e.firstChild.content,t-1,n)))}function hn(e,t,n){return 0==t?e.append(n):e.replaceChild(e.childCount-1,e.lastChild.copy(hn(e.lastChild.content,t-1,n)))}function un(e,t){for(let n=0;n<t;n++)e=e.firstChild.content;return e}function pn(e,t,n){if(t<=0)return e;let r=e.content;return t>1&&(r=r.replaceChild(0,pn(r.firstChild,t-1,1==r.childCount?n-1:0))),t>0&&(r=e.type.contentMatch.fillBefore(r).append(r),n<=0&&(r=r.append(e.type.contentMatch.matchFragment(r).fillBefore(Se.empty,!0)))),e.copy(r)}function fn(e,t,n,r,o){let i=e.node(t),s=o?e.indexAfter(t):e.index(t);if(s==i.childCount&&!n.compatibleContent(i.type))return null;let a=r.fillBefore(i.content,!0,s);return a&&!function(e,t,n){for(let r=n;r<t.childCount;r++)if(!e.allowsMarks(t.child(r).marks))return!0;return!1}(n,i.content,s)?a:null}function mn(e,t,n,r,o){if(t<n){let o=e.firstChild;e=e.replaceChild(0,o.copy(mn(o.content,t+1,n,r,o)))}if(t>r){let t=o.contentMatchAt(0),n=t.fillBefore(e).append(e);e=n.append(t.matchFragment(n).fillBefore(Se.empty,!0))}return e}function gn(e,t){let n=[];for(let r=Math.min(e.depth,t.depth);r>=0;r--){let o=e.start(r);if(o<e.pos-(e.depth-r)||t.end(r)>t.pos+(t.depth-r)||e.node(r).type.spec.isolating||t.node(r).type.spec.isolating)break;(o==t.start(r)||r==e.depth&&r==t.depth&&e.parent.inlineContent&&t.parent.inlineContent&&r&&t.start(r-1)==o-1)&&n.push(r)}return n}class yn extends $t{constructor(e,t,n){super(),this.pos=e,this.attr=t,this.value=n}apply(e){let t=e.nodeAt(this.pos);if(!t)return Vt.fail("No node at attribute step's position");let n=Object.create(null);for(let e in t.attrs)n[e]=t.attrs[e];n[this.attr]=this.value;let r=t.type.create(n,null,t.marks);return Vt.fromReplace(e,this.pos,this.pos+1,new De(Se.from(r),0,t.isLeaf?0:1))}getMap(){return zt.empty}invert(e){return new yn(this.pos,this.attr,e.nodeAt(this.pos).attrs[this.attr])}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new yn(t.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(e,t){if("number"!=typeof t.pos||"string"!=typeof t.attr)throw new RangeError("Invalid input for AttrStep.fromJSON");return new yn(t.pos,t.attr,t.value)}}$t.jsonID("attr",yn);class vn extends $t{constructor(e,t){super(),this.attr=e,this.value=t}apply(e){let t=Object.create(null);for(let n in e.attrs)t[n]=e.attrs[n];t[this.attr]=this.value;let n=e.type.create(t,e.content,e.marks);return Vt.ok(n)}getMap(){return zt.empty}invert(e){return new vn(this.attr,e.attrs[this.attr])}map(e){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(e,t){if("string"!=typeof t.attr)throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new vn(t.attr,t.value)}}$t.jsonID("docAttr",vn);let bn=class extends Error{};bn=function e(t){let n=Error.call(this,t);return n.__proto__=e.prototype,n},(bn.prototype=Object.create(Error.prototype)).constructor=bn,bn.prototype.name="TransformError";class xn{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new Pt}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let t=this.maybeStep(e);if(t.failed)throw new bn(t.failed);return this}maybeStep(e){let t=e.apply(this.doc);return t.failed||this.addStep(e,t.doc),t}get docChanged(){return this.steps.length>0}addStep(e,t){this.docs.push(this.doc),this.steps.push(e),this.mapping.appendMap(e.getMap()),this.doc=t}replace(e,t=e,n=De.empty){let r=an(this.doc,e,t,n);return r&&this.step(r),this}replaceWith(e,t,n){return this.replace(e,t,new De(Se.from(n),0,0))}delete(e,t){return this.replace(e,t,De.empty)}insert(e,t){return this.replaceWith(e,e,t)}replaceRange(e,t,n){return function(e,t,n,r){if(!r.size)return e.deleteRange(t,n);let o=e.doc.resolve(t),i=e.doc.resolve(n);if(ln(o,i,r))return e.step(new Wt(t,n,r));let s=gn(o,e.doc.resolve(n));0==s[s.length-1]&&s.pop();let a=-(o.depth+1);s.unshift(a);for(let e=o.depth,t=o.pos-1;e>0;e--,t--){let n=o.node(e).type.spec;if(n.defining||n.definingAsContext||n.isolating)break;s.indexOf(e)>-1?a=e:o.before(e)==t&&s.splice(1,0,-e)}let l=s.indexOf(a),c=[],d=r.openStart;for(let e=r.content,t=0;;t++){let n=e.firstChild;if(c.push(n),t==r.openStart)break;e=n.content}for(let e=d-1;e>=0;e--){let t=c[e],n=(h=t.type).spec.defining||h.spec.definingForContent;if(n&&!t.sameMarkup(o.node(Math.abs(a)-1)))d=e;else if(n||!t.type.isTextblock)break}var h;for(let t=r.openStart;t>=0;t--){let a=(t+d+1)%(r.openStart+1),h=c[a];if(h)for(let t=0;t<s.length;t++){let c=s[(t+l)%s.length],d=!0;c<0&&(d=!1,c=-c);let u=o.node(c-1),p=o.index(c-1);if(u.canReplaceWith(p,p,h.type,h.marks))return e.replace(o.before(c),d?i.after(c):n,new De(mn(r.content,0,r.openStart,a),a,r.openEnd))}}let u=e.steps.length;for(let a=s.length-1;a>=0&&(e.replace(t,n,r),!(e.steps.length>u));a--){let e=s[a];e<0||(t=o.before(e),n=i.after(e))}}(this,e,t,n),this}replaceRangeWith(e,t,n){return function(e,t,n,r){if(!r.isInline&&t==n&&e.doc.resolve(t).parent.content.size){let o=function(e,t,n){let r=e.resolve(t);if(r.parent.canReplaceWith(r.index(),r.index(),n))return t;if(0==r.parentOffset)for(let e=r.depth-1;e>=0;e--){let t=r.index(e);if(r.node(e).canReplaceWith(t,t,n))return r.before(e+1);if(t>0)return null}if(r.parentOffset==r.parent.content.size)for(let e=r.depth-1;e>=0;e--){let t=r.indexAfter(e);if(r.node(e).canReplaceWith(t,t,n))return r.after(e+1);if(t<r.node(e).childCount)return null}return null}(e.doc,t,r.type);null!=o&&(t=n=o)}e.replaceRange(t,n,new De(Se.from(r),0,0))}(this,e,t,n),this}deleteRange(e,t){return function(e,t,n){let r=e.doc.resolve(t),o=e.doc.resolve(n),i=gn(r,o);for(let t=0;t<i.length;t++){let n=i[t],s=t==i.length-1;if(s&&0==n||r.node(n).type.contentMatch.validEnd)return e.delete(r.start(n),o.end(n));if(n>0&&(s||r.node(n-1).canReplace(r.index(n-1),o.indexAfter(n-1))))return e.delete(r.before(n),o.after(n))}for(let i=1;i<=r.depth&&i<=o.depth;i++)if(t-r.start(i)==r.depth-i&&n>r.end(i)&&o.end(i)-n!=o.depth-i&&r.start(i-1)==o.start(i-1)&&r.node(i-1).canReplace(r.index(i-1),o.index(i-1)))return e.delete(r.before(i),n);e.delete(t,n)}(this,e,t),this}lift(e,t){return function(e,t,n){let{$from:r,$to:o,depth:i}=t,s=r.before(i+1),a=o.after(i+1),l=s,c=a,d=Se.empty,h=0;for(let e=i,t=!1;e>n;e--)t||r.index(e)>0?(t=!0,d=Se.from(r.node(e).copy(d)),h++):l--;let u=Se.empty,p=0;for(let e=i,t=!1;e>n;e--)t||o.after(e+1)<o.end(e)?(t=!0,u=Se.from(o.node(e).copy(u)),p++):c++;e.step(new Kt(l,c,s,a,new De(d.append(u),h,p),d.size-h,!0))}(this,e,t),this}join(e,t=1){return function(e,t,n){let r=null,{linebreakReplacement:o}=e.doc.type.schema,i=e.doc.resolve(t-n),s=i.node().type;if(o&&s.inlineContent){let e="pre"==s.whitespace,t=!!s.contentMatch.matchType(o);e&&!t?r=!1:!e&&t&&(r=!0)}let a=e.steps.length;if(!1===r){let r=e.doc.resolve(t+n);en(e,r.node(),r.before(),a)}s.inlineContent&&Ut(e,t+n-1,s,i.node().contentMatchAt(i.index()),null==r);let l=e.mapping.slice(a),c=l.map(t-n);if(e.step(new Wt(c,l.map(t+n,-1),De.empty,!0)),!0===r){let t=e.doc.resolve(c);Zt(e,t.node(),t.before(),e.steps.length)}}(this,e,t),this}wrap(e,t){return function(e,t,n){let r=Se.empty;for(let e=n.length-1;e>=0;e--){if(r.size){let t=n[e].type.contentMatch.matchFragment(r);if(!t||!t.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}r=Se.from(n[e].type.create(n[e].attrs,r))}let o=t.start,i=t.end;e.step(new Kt(o,i,o,i,new De(r,0,0),n.length,!0))}(this,e,t),this}setBlockType(e,t=e,n,r=null){return function(e,t,n,r,o){if(!r.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let i=e.steps.length;e.doc.nodesBetween(t,n,((t,n)=>{let s="function"==typeof o?o(t):o;if(t.isTextblock&&!t.hasMarkup(r,s)&&function(e,t,n){let r=e.resolve(t),o=r.index();return r.parent.canReplaceWith(o,o+1,n)}(e.doc,e.mapping.slice(i).map(n),r)){let o=null;if(r.schema.linebreakReplacement){let e="pre"==r.whitespace,t=!!r.contentMatch.matchType(r.schema.linebreakReplacement);e&&!t?o=!1:!e&&t&&(o=!0)}!1===o&&en(e,t,n,i),Ut(e,e.mapping.slice(i).map(n,1),r,void 0,null===o);let a=e.mapping.slice(i),l=a.map(n,1),c=a.map(n+t.nodeSize,1);return e.step(new Kt(l,c,l+1,c-1,new De(Se.from(r.create(s,null,t.marks)),0,0),1,!0)),!0===o&&Zt(e,t,n,i),!1}}))}(this,e,t,n,r),this}setNodeMarkup(e,t,n=null,r){return function(e,t,n,r,o){let i=e.doc.nodeAt(t);if(!i)throw new RangeError("No node at given position");n||(n=i.type);let s=n.create(r,null,o||i.marks);if(i.isLeaf)return e.replaceWith(t,t+i.nodeSize,s);if(!n.validContent(i.content))throw new RangeError("Invalid content for node type "+n.name);e.step(new Kt(t,t+i.nodeSize,t+1,t+i.nodeSize-1,new De(Se.from(s),0,0),1,!0))}(this,e,t,n,r),this}setNodeAttribute(e,t,n){return this.step(new yn(e,t,n)),this}setDocAttribute(e,t){return this.step(new vn(e,t)),this}addNodeMark(e,t){return this.step(new _t(e,t)),this}removeNodeMark(e,t){let n=this.doc.nodeAt(e);if(!n)throw new RangeError("No node at position "+e);if(t instanceof Ee)t.isInSet(n.marks)&&this.step(new qt(e,t));else{let r,o=n.marks,i=[];for(;r=t.isInSet(o);)i.push(new qt(e,r)),o=r.removeFromSet(o);for(let e=i.length-1;e>=0;e--)this.step(i[e])}return this}split(e,t=1,n){return function(e,t,n=1,r){let o=e.doc.resolve(t),i=Se.empty,s=Se.empty;for(let e=o.depth,t=o.depth-n,a=n-1;e>t;e--,a--){i=Se.from(o.node(e).copy(i));let t=r&&r[a];s=Se.from(t?t.type.create(t.attrs,s):o.node(e).copy(s))}e.step(new Wt(t,t,new De(i.append(s),n,n),!0))}(this,e,t,n),this}addMark(e,t,n){return function(e,t,n,r){let o,i,s=[],a=[];e.doc.nodesBetween(t,n,((e,l,c)=>{if(!e.isInline)return;let d=e.marks;if(!r.isInSet(d)&&c.type.allowsMarkType(r.type)){let c=Math.max(l,t),h=Math.min(l+e.nodeSize,n),u=r.addToSet(d);for(let e=0;e<d.length;e++)d[e].isInSet(u)||(o&&o.to==c&&o.mark.eq(d[e])?o.to=h:s.push(o=new Ht(c,h,d[e])));i&&i.to==c?i.to=h:a.push(i=new Ft(c,h,r))}})),s.forEach((t=>e.step(t))),a.forEach((t=>e.step(t)))}(this,e,t,n),this}removeMark(e,t,n){return function(e,t,n,r){let o=[],i=0;e.doc.nodesBetween(t,n,((e,s)=>{if(!e.isInline)return;i++;let a=null;if(r instanceof pt){let t,n=e.marks;for(;t=r.isInSet(n);)(a||(a=[])).push(t),n=t.removeFromSet(n)}else r?r.isInSet(e.marks)&&(a=[r]):a=e.marks;if(a&&a.length){let r=Math.min(s+e.nodeSize,n);for(let e=0;e<a.length;e++){let n,l=a[e];for(let e=0;e<o.length;e++){let t=o[e];t.step==i-1&&l.eq(o[e].style)&&(n=t)}n?(n.to=r,n.step=i):o.push({style:l,from:Math.max(s,t),to:r,step:i})}}})),o.forEach((t=>e.step(new Ht(t.from,t.to,t.style))))}(this,e,t,n),this}clearIncompatible(e,t,n){return Ut(this,e,t,n),this}}const wn=Object.create(null);class kn{constructor(e,t,n){this.$anchor=e,this.$head=t,this.ranges=n||[new Cn(e.min(t),e.max(t))]}get anchor(){return this.$anchor.pos}get head(){return this.$head.pos}get from(){return this.$from.pos}get to(){return this.$to.pos}get $from(){return this.ranges[0].$from}get $to(){return this.ranges[0].$to}get empty(){let e=this.ranges;for(let t=0;t<e.length;t++)if(e[t].$from.pos!=e[t].$to.pos)return!1;return!0}content(){return this.$from.doc.slice(this.from,this.to,!0)}replace(e,t=De.empty){let n=t.content.lastChild,r=null;for(let e=0;e<t.openEnd;e++)r=n,n=n.lastChild;let o=e.steps.length,i=this.ranges;for(let s=0;s<i.length;s++){let{$from:a,$to:l}=i[s],c=e.mapping.slice(o);e.replaceRange(c.map(a.pos),c.map(l.pos),s?De.empty:t),0==s&&Ln(e,o,(n?n.isInline:r&&r.isTextblock)?-1:1)}}replaceWith(e,t){let n=e.steps.length,r=this.ranges;for(let o=0;o<r.length;o++){let{$from:i,$to:s}=r[o],a=e.mapping.slice(n),l=a.map(i.pos),c=a.map(s.pos);o?e.deleteRange(l,c):(e.replaceRangeWith(l,c,t),Ln(e,n,t.isInline?-1:1))}}static findFrom(e,t,n=!1){let r=e.parent.inlineContent?new Mn(e):Rn(e.node(0),e.parent,e.pos,e.index(),t,n);if(r)return r;for(let r=e.depth-1;r>=0;r--){let o=t<0?Rn(e.node(0),e.node(r),e.before(r+1),e.index(r),t,n):Rn(e.node(0),e.node(r),e.after(r+1),e.index(r)+1,t,n);if(o)return o}return null}static near(e,t=1){return this.findFrom(e,t)||this.findFrom(e,-t)||new An(e.node(0))}static atStart(e){return Rn(e,e,0,0,1)||new An(e)}static atEnd(e){return Rn(e,e,e.content.size,e.childCount,-1)||new An(e)}static fromJSON(e,t){if(!t||!t.type)throw new RangeError("Invalid input for Selection.fromJSON");let n=wn[t.type];if(!n)throw new RangeError(`No selection type ${t.type} defined`);return n.fromJSON(e,t)}static jsonID(e,t){if(e in wn)throw new RangeError("Duplicate use of selection JSON ID "+e);return wn[e]=t,t.prototype.jsonID=e,t}getBookmark(){return Mn.between(this.$anchor,this.$head).getBookmark()}}kn.prototype.visible=!0;class Cn{constructor(e,t){this.$from=e,this.$to=t}}let Nn=!1;function Sn(e){Nn||e.parent.inlineContent||(Nn=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+e.parent.type.name+")"))}class Mn extends kn{constructor(e,t=e){Sn(e),Sn(t),super(e,t)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(e,t){let n=e.resolve(t.map(this.head));if(!n.parent.inlineContent)return kn.near(n);let r=e.resolve(t.map(this.anchor));return new Mn(r.parent.inlineContent?r:n,n)}replace(e,t=De.empty){if(super.replace(e,t),t==De.empty){let t=this.$from.marksAcross(this.$to);t&&e.ensureMarks(t)}}eq(e){return e instanceof Mn&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new Tn(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(e,t){if("number"!=typeof t.anchor||"number"!=typeof t.head)throw new RangeError("Invalid input for TextSelection.fromJSON");return new Mn(e.resolve(t.anchor),e.resolve(t.head))}static create(e,t,n=t){let r=e.resolve(t);return new this(r,n==t?r:e.resolve(n))}static between(e,t,n){let r=e.pos-t.pos;if(n&&!r||(n=r>=0?1:-1),!t.parent.inlineContent){let e=kn.findFrom(t,n,!0)||kn.findFrom(t,-n,!0);if(!e)return kn.near(t,n);t=e.$head}return e.parent.inlineContent||(0==r||(e=(kn.findFrom(e,-n,!0)||kn.findFrom(e,n,!0)).$anchor).pos<t.pos!=r<0)&&(e=t),new Mn(e,t)}}kn.jsonID("text",Mn);class Tn{constructor(e,t){this.anchor=e,this.head=t}map(e){return new Tn(e.map(this.anchor),e.map(this.head))}resolve(e){return Mn.between(e.resolve(this.anchor),e.resolve(this.head))}}class On extends kn{constructor(e){let t=e.nodeAfter,n=e.node(0).resolve(e.pos+t.nodeSize);super(e,n),this.node=t}map(e,t){let{deleted:n,pos:r}=t.mapResult(this.anchor),o=e.resolve(r);return n?kn.near(o):new On(o)}content(){return new De(Se.from(this.node),0,0)}eq(e){return e instanceof On&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new En(this.anchor)}static fromJSON(e,t){if("number"!=typeof t.anchor)throw new RangeError("Invalid input for NodeSelection.fromJSON");return new On(e.resolve(t.anchor))}static create(e,t){return new On(e.resolve(t))}static isSelectable(e){return!e.isText&&!1!==e.type.spec.selectable}}On.prototype.visible=!1,kn.jsonID("node",On);class En{constructor(e){this.anchor=e}map(e){let{deleted:t,pos:n}=e.mapResult(this.anchor);return t?new Tn(n,n):new En(n)}resolve(e){let t=e.resolve(this.anchor),n=t.nodeAfter;return n&&On.isSelectable(n)?new On(t):kn.near(t)}}class An extends kn{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,t=De.empty){if(t==De.empty){e.delete(0,e.doc.content.size);let t=kn.atStart(e.doc);t.eq(e.selection)||e.setSelection(t)}else super.replace(e,t)}toJSON(){return{type:"all"}}static fromJSON(e){return new An(e)}map(e){return new An(e)}eq(e){return e instanceof An}getBookmark(){return Dn}}kn.jsonID("all",An);const Dn={map(){return this},resolve:e=>new An(e)};function Rn(e,t,n,r,o,i=!1){if(t.inlineContent)return Mn.create(e,n);for(let s=r-(o>0?0:1);o>0?s<t.childCount:s>=0;s+=o){let r=t.child(s);if(r.isAtom){if(!i&&On.isSelectable(r))return On.create(e,n-(o<0?r.nodeSize:0))}else{let t=Rn(e,r,n+o,o<0?r.childCount:0,o,i);if(t)return t}n+=r.nodeSize*o}return null}function Ln(e,t,n){let r=e.steps.length-1;if(r<t)return;let o,i=e.steps[r];(i instanceof Wt||i instanceof Kt)&&(e.mapping.maps[r].forEach(((e,t,n,r)=>{null==o&&(o=r)})),e.setSelection(kn.near(e.doc.resolve(o),n)))}class In extends xn{constructor(e){super(e.doc),this.curSelectionFor=0,this.updated=0,this.meta=Object.create(null),this.time=Date.now(),this.curSelection=e.selection,this.storedMarks=e.storedMarks}get selection(){return this.curSelectionFor<this.steps.length&&(this.curSelection=this.curSelection.map(this.doc,this.mapping.slice(this.curSelectionFor)),this.curSelectionFor=this.steps.length),this.curSelection}setSelection(e){if(e.$from.doc!=this.doc)throw new RangeError("Selection passed to setSelection must point at the current document");return this.curSelection=e,this.curSelectionFor=this.steps.length,this.updated=-3&this.updated|1,this.storedMarks=null,this}get selectionSet(){return(1&this.updated)>0}setStoredMarks(e){return this.storedMarks=e,this.updated|=2,this}ensureMarks(e){return Ee.sameSet(this.storedMarks||this.selection.$from.marks(),e)||this.setStoredMarks(e),this}addStoredMark(e){return this.ensureMarks(e.addToSet(this.storedMarks||this.selection.$head.marks()))}removeStoredMark(e){return this.ensureMarks(e.removeFromSet(this.storedMarks||this.selection.$head.marks()))}get storedMarksSet(){return(2&this.updated)>0}addStep(e,t){super.addStep(e,t),this.updated=-3&this.updated,this.storedMarks=null}setTime(e){return this.time=e,this}replaceSelection(e){return this.selection.replace(this,e),this}replaceSelectionWith(e,t=!0){let n=this.selection;return t&&(e=e.mark(this.storedMarks||(n.empty?n.$from.marks():n.$from.marksAcross(n.$to)||Ee.none))),n.replaceWith(this,e),this}deleteSelection(){return this.selection.replace(this),this}insertText(e,t,n){let r=this.doc.type.schema;if(null==t)return e?this.replaceSelectionWith(r.text(e),!0):this.deleteSelection();{if(null==n&&(n=t),n=null==n?t:n,!e)return this.deleteRange(t,n);let o=this.storedMarks;if(!o){let e=this.doc.resolve(t);o=n==t?e.marks():e.marksAcross(this.doc.resolve(n))}return this.replaceRangeWith(t,n,r.text(e,o)),this.selection.empty||this.setSelection(kn.near(this.selection.$to)),this}}setMeta(e,t){return this.meta["string"==typeof e?e:e.key]=t,this}getMeta(e){return this.meta["string"==typeof e?e:e.key]}get isGeneric(){for(let e in this.meta)return!1;return!0}scrollIntoView(){return this.updated|=4,this}get scrolledIntoView(){return(4&this.updated)>0}}function zn(e,t){return t&&e?e.bind(t):e}class Pn{constructor(e,t,n){this.name=e,this.init=zn(t.init,n),this.apply=zn(t.apply,n)}}const Bn=[new Pn("doc",{init:e=>e.doc||e.schema.topNodeType.createAndFill(),apply:e=>e.doc}),new Pn("selection",{init:(e,t)=>e.selection||kn.atStart(t.doc),apply:e=>e.selection}),new Pn("storedMarks",{init:e=>e.storedMarks||null,apply:(e,t,n,r)=>r.selection.$cursor?e.storedMarks:null}),new Pn("scrollToSelection",{init:()=>0,apply:(e,t)=>e.scrolledIntoView?t+1:t})];class $n{constructor(e,t){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=Bn.slice(),t&&t.forEach((e=>{if(this.pluginsByKey[e.key])throw new RangeError("Adding different instances of a keyed plugin ("+e.key+")");this.plugins.push(e),this.pluginsByKey[e.key]=e,e.spec.state&&this.fields.push(new Pn(e.key,e.spec.state,e))}))}}class Vn{constructor(e){this.config=e}get schema(){return this.config.schema}get plugins(){return this.config.plugins}apply(e){return this.applyTransaction(e).state}filterTransaction(e,t=-1){for(let n=0;n<this.config.plugins.length;n++)if(n!=t){let t=this.config.plugins[n];if(t.spec.filterTransaction&&!t.spec.filterTransaction.call(t,e,this))return!1}return!0}applyTransaction(e){if(!this.filterTransaction(e))return{state:this,transactions:[]};let t=[e],n=this.applyInner(e),r=null;for(;;){let o=!1;for(let i=0;i<this.config.plugins.length;i++){let s=this.config.plugins[i];if(s.spec.appendTransaction){let a=r?r[i].n:0,l=r?r[i].state:this,c=a<t.length&&s.spec.appendTransaction.call(s,a?t.slice(a):t,l,n);if(c&&n.filterTransaction(c,i)){if(c.setMeta("appendedTransaction",e),!r){r=[];for(let e=0;e<this.config.plugins.length;e++)r.push(e<i?{state:n,n:t.length}:{state:this,n:0})}t.push(c),n=n.applyInner(c),o=!0}r&&(r[i]={state:n,n:t.length})}}if(!o)return{state:n,transactions:t}}}applyInner(e){if(!e.before.eq(this.doc))throw new RangeError("Applying a mismatched transaction");let t=new Vn(this.config),n=this.config.fields;for(let r=0;r<n.length;r++){let o=n[r];t[o.name]=o.apply(e,this[o.name],this,t)}return t}get tr(){return new In(this)}static create(e){let t=new $n(e.doc?e.doc.type.schema:e.schema,e.plugins),n=new Vn(t);for(let r=0;r<t.fields.length;r++)n[t.fields[r].name]=t.fields[r].init(e,n);return n}reconfigure(e){let t=new $n(this.schema,e.plugins),n=t.fields,r=new Vn(t);for(let t=0;t<n.length;t++){let o=n[t].name;r[o]=this.hasOwnProperty(o)?this[o]:n[t].init(e,r)}return r}toJSON(e){let t={doc:this.doc.toJSON(),selection:this.selection.toJSON()};if(this.storedMarks&&(t.storedMarks=this.storedMarks.map((e=>e.toJSON()))),e&&"object"==typeof e)for(let n in e){if("doc"==n||"selection"==n)throw new RangeError("The JSON fields `doc` and `selection` are reserved");let r=e[n],o=r.spec.state;o&&o.toJSON&&(t[n]=o.toJSON.call(r,this[r.key]))}return t}static fromJSON(e,t,n){if(!t)throw new RangeError("Invalid input for EditorState.fromJSON");if(!e.schema)throw new RangeError("Required config field 'schema' missing");let r=new $n(e.schema,e.plugins),o=new Vn(r);return r.fields.forEach((r=>{if("doc"==r.name)o.doc=Ge.fromJSON(e.schema,t.doc);else if("selection"==r.name)o.selection=kn.fromJSON(o.doc,t.selection);else if("storedMarks"==r.name)t.storedMarks&&(o.storedMarks=t.storedMarks.map(e.schema.markFromJSON));else{if(n)for(let i in n){let s=n[i],a=s.spec.state;if(s.key==r.name&&a&&a.fromJSON&&Object.prototype.hasOwnProperty.call(t,i))return void(o[r.name]=a.fromJSON.call(s,e,t[i],o))}o[r.name]=r.init(e,o)}})),o}}function jn(e,t,n){for(let r in e){let o=e[r];o instanceof Function?o=o.bind(t):"handleDOMEvents"==r&&(o=jn(o,t,{})),n[r]=o}return n}class Fn{constructor(e){this.spec=e,this.props={},e.props&&jn(e.props,this,this.props),this.key=e.key?e.key.key:_n("plugin")}getState(e){return e[this.key]}}const Hn=Object.create(null);function _n(e){return e in Hn?e+"$"+ ++Hn[e]:(Hn[e]=0,e+"$")}class qn{constructor(e="key"){this.key=_n(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}const Wn=function(e){for(var t=0;;t++)if(!(e=e.previousSibling))return t},Kn=function(e){let t=e.assignedSlot||e.parentNode;return t&&11==t.nodeType?t.host:t};let Jn=null;const Un=function(e,t,n){let r=Jn||(Jn=document.createRange());return r.setEnd(e,null==n?e.nodeValue.length:n),r.setStart(e,t||0),r},Gn=function(e,t,n,r){return n&&(Xn(e,t,n,r,-1)||Xn(e,t,n,r,1))},Yn=/^(img|br|input|textarea|hr)$/i;function Xn(e,t,n,r,o){for(var i;;){if(e==n&&t==r)return!0;if(t==(o<0?0:Qn(e))){let n=e.parentNode;if(!n||1!=n.nodeType||Zn(e)||Yn.test(e.nodeName)||"false"==e.contentEditable)return!1;t=Wn(e)+(o<0?0:1),e=n}else{if(1!=e.nodeType)return!1;{let n=e.childNodes[t+(o<0?-1:0)];if(1==n.nodeType&&"false"==n.contentEditable){if(!(null===(i=n.pmViewDesc)||void 0===i?void 0:i.ignoreForSelection))return!1;t+=o}else e=n,t=o<0?Qn(e):0}}}}function Qn(e){return 3==e.nodeType?e.nodeValue.length:e.childNodes.length}function Zn(e){let t;for(let n=e;n&&!(t=n.pmViewDesc);n=n.parentNode);return t&&t.node&&t.node.isBlock&&(t.dom==e||t.contentDOM==e)}const er=function(e){return e.focusNode&&Gn(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset)};function tr(e,t){let n=document.createEvent("Event");return n.initEvent("keydown",!0,!0),n.keyCode=e,n.key=n.code=t,n}const nr="undefined"!=typeof navigator?navigator:null,rr="undefined"!=typeof document?document:null,or=nr&&nr.userAgent||"",ir=/Edge\/(\d+)/.exec(or),sr=/MSIE \d/.exec(or),ar=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(or),lr=!!(sr||ar||ir),cr=sr?document.documentMode:ar?+ar[1]:ir?+ir[1]:0,dr=!lr&&/gecko\/(\d+)/i.test(or);dr&&(/Firefox\/(\d+)/.exec(or)||[0,0])[1];const hr=!lr&&/Chrome\/(\d+)/.exec(or),ur=!!hr,pr=hr?+hr[1]:0,fr=!lr&&!!nr&&/Apple Computer/.test(nr.vendor),mr=fr&&(/Mobile\/\w+/.test(or)||!!nr&&nr.maxTouchPoints>2),gr=mr||!!nr&&/Mac/.test(nr.platform),yr=!!nr&&/Win/.test(nr.platform),vr=/Android \d/.test(or),br=!!rr&&"webkitFontSmoothing"in rr.documentElement.style,xr=br?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function wr(e){let t=e.defaultView&&e.defaultView.visualViewport;return t?{left:0,right:t.width,top:0,bottom:t.height}:{left:0,right:e.documentElement.clientWidth,top:0,bottom:e.documentElement.clientHeight}}function kr(e,t){return"number"==typeof e?e:e[t]}function Cr(e){let t=e.getBoundingClientRect(),n=t.width/e.offsetWidth||1,r=t.height/e.offsetHeight||1;return{left:t.left,right:t.left+e.clientWidth*n,top:t.top,bottom:t.top+e.clientHeight*r}}function Nr(e,t,n){let r=e.someProp("scrollThreshold")||0,o=e.someProp("scrollMargin")||5,i=e.dom.ownerDocument;for(let s=n||e.dom;s;){if(1!=s.nodeType){s=Kn(s);continue}let e=s,n=e==i.body,a=n?wr(i):Cr(e),l=0,c=0;if(t.top<a.top+kr(r,"top")?c=-(a.top-t.top+kr(o,"top")):t.bottom>a.bottom-kr(r,"bottom")&&(c=t.bottom-t.top>a.bottom-a.top?t.top+kr(o,"top")-a.top:t.bottom-a.bottom+kr(o,"bottom")),t.left<a.left+kr(r,"left")?l=-(a.left-t.left+kr(o,"left")):t.right>a.right-kr(r,"right")&&(l=t.right-a.right+kr(o,"right")),l||c)if(n)i.defaultView.scrollBy(l,c);else{let n=e.scrollLeft,r=e.scrollTop;c&&(e.scrollTop+=c),l&&(e.scrollLeft+=l);let o=e.scrollLeft-n,i=e.scrollTop-r;t={left:t.left-o,top:t.top-i,right:t.right-o,bottom:t.bottom-i}}let d=n?"fixed":getComputedStyle(s).position;if(/^(fixed|sticky)$/.test(d))break;s="absolute"==d?s.offsetParent:Kn(s)}}function Sr(e){let t=[],n=e.ownerDocument;for(let r=e;r&&(t.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),e!=n);r=Kn(r));return t}function Mr(e,t){for(let n=0;n<e.length;n++){let{dom:r,top:o,left:i}=e[n];r.scrollTop!=o+t&&(r.scrollTop=o+t),r.scrollLeft!=i&&(r.scrollLeft=i)}}let Tr=null;function Or(e,t){let n,r,o,i,s=2e8,a=0,l=t.top,c=t.top;for(let d=e.firstChild,h=0;d;d=d.nextSibling,h++){let e;if(1==d.nodeType)e=d.getClientRects();else{if(3!=d.nodeType)continue;e=Un(d).getClientRects()}for(let u=0;u<e.length;u++){let p=e[u];if(p.top<=l&&p.bottom>=c){l=Math.max(p.bottom,l),c=Math.min(p.top,c);let e=p.left>t.left?p.left-t.left:p.right<t.left?t.left-p.right:0;if(e<s){n=d,s=e,r=e&&3==n.nodeType?{left:p.right<t.left?p.right:p.left,top:t.top}:t,1==d.nodeType&&e&&(a=h+(t.left>=(p.left+p.right)/2?1:0));continue}}else p.top>t.top&&!o&&p.left<=t.left&&p.right>=t.left&&(o=d,i={left:Math.max(p.left,Math.min(p.right,t.left)),top:p.top});!n&&(t.left>=p.right&&t.top>=p.top||t.left>=p.left&&t.top>=p.bottom)&&(a=h+1)}}return!n&&o&&(n=o,r=i,s=0),n&&3==n.nodeType?function(e,t){let n=e.nodeValue.length,r=document.createRange();for(let o=0;o<n;o++){r.setEnd(e,o+1),r.setStart(e,o);let n=Lr(r,1);if(n.top!=n.bottom&&Er(t,n))return{node:e,offset:o+(t.left>=(n.left+n.right)/2?1:0)}}return{node:e,offset:0}}(n,r):!n||s&&1==n.nodeType?{node:e,offset:a}:Or(n,r)}function Er(e,t){return e.left>=t.left-1&&e.left<=t.right+1&&e.top>=t.top-1&&e.top<=t.bottom+1}function Ar(e,t,n){let r=e.childNodes.length;if(r&&n.top<n.bottom)for(let o=Math.max(0,Math.min(r-1,Math.floor(r*(t.top-n.top)/(n.bottom-n.top))-2)),i=o;;){let n=e.childNodes[i];if(1==n.nodeType){let e=n.getClientRects();for(let r=0;r<e.length;r++){let o=e[r];if(Er(t,o))return Ar(n,t,o)}}if((i=(i+1)%r)==o)break}return e}function Dr(e,t){let n,r=e.dom.ownerDocument,o=0,i=function(e,t,n){if(e.caretPositionFromPoint)try{let r=e.caretPositionFromPoint(t,n);if(r)return{node:r.offsetNode,offset:Math.min(Qn(r.offsetNode),r.offset)}}catch(e){}if(e.caretRangeFromPoint){let r=e.caretRangeFromPoint(t,n);if(r)return{node:r.startContainer,offset:Math.min(Qn(r.startContainer),r.startOffset)}}}(r,t.left,t.top);i&&({node:n,offset:o}=i);let s,a=(e.root.elementFromPoint?e.root:r).elementFromPoint(t.left,t.top);if(!a||!e.dom.contains(1!=a.nodeType?a.parentNode:a)){let n=e.dom.getBoundingClientRect();if(!Er(t,n))return null;if(a=Ar(e.dom,t,n),!a)return null}if(fr)for(let e=a;n&&e;e=Kn(e))e.draggable&&(n=void 0);if(a=function(e,t){let n=e.parentNode;return n&&/^li$/i.test(n.nodeName)&&t.left<e.getBoundingClientRect().left?n:e}(a,t),n){if(dr&&1==n.nodeType&&(o=Math.min(o,n.childNodes.length),o<n.childNodes.length)){let e,r=n.childNodes[o];"IMG"==r.nodeName&&(e=r.getBoundingClientRect()).right<=t.left&&e.bottom>t.top&&o++}let r;br&&o&&1==n.nodeType&&1==(r=n.childNodes[o-1]).nodeType&&"false"==r.contentEditable&&r.getBoundingClientRect().top>=t.top&&o--,n==e.dom&&o==n.childNodes.length-1&&1==n.lastChild.nodeType&&t.top>n.lastChild.getBoundingClientRect().bottom?s=e.state.doc.content.size:0!=o&&1==n.nodeType&&"BR"==n.childNodes[o-1].nodeName||(s=function(e,t,n,r){let o=-1;for(let n=t,i=!1;n!=e.dom;){let t,s=e.docView.nearestDesc(n,!0);if(!s)return null;if(1==s.dom.nodeType&&(s.node.isBlock&&s.parent||!s.contentDOM)&&((t=s.dom.getBoundingClientRect()).width||t.height)&&(s.node.isBlock&&s.parent&&!/^T(R|BODY|HEAD|FOOT)$/.test(s.dom.nodeName)&&(!i&&t.left>r.left||t.top>r.top?o=s.posBefore:(!i&&t.right<r.left||t.bottom<r.top)&&(o=s.posAfter),i=!0),!s.contentDOM&&o<0&&!s.node.isText))return(s.node.isBlock?r.top<(t.top+t.bottom)/2:r.left<(t.left+t.right)/2)?s.posBefore:s.posAfter;n=s.dom.parentNode}return o>-1?o:e.docView.posFromDOM(t,n,-1)}(e,n,o,t))}null==s&&(s=function(e,t,n){let{node:r,offset:o}=Or(t,n),i=-1;if(1==r.nodeType&&!r.firstChild){let e=r.getBoundingClientRect();i=e.left!=e.right&&n.left>(e.left+e.right)/2?1:-1}return e.docView.posFromDOM(r,o,i)}(e,a,t));let l=e.docView.nearestDesc(a,!0);return{pos:s,inside:l?l.posAtStart-l.border:-1}}function Rr(e){return e.top<e.bottom||e.left<e.right}function Lr(e,t){let n=e.getClientRects();if(n.length){let e=n[t<0?0:n.length-1];if(Rr(e))return e}return Array.prototype.find.call(n,Rr)||e.getBoundingClientRect()}const Ir=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function zr(e,t,n){let{node:r,offset:o,atom:i}=e.docView.domFromPos(t,n<0?-1:1),s=br||dr;if(3==r.nodeType){if(!s||!Ir.test(r.nodeValue)&&(n<0?o:o!=r.nodeValue.length)){let e=o,t=o,i=n<0?1:-1;return n<0&&!o?(t++,i=-1):n>=0&&o==r.nodeValue.length?(e--,i=1):n<0?e--:t++,Pr(Lr(Un(r,e,t),i),i<0)}{let e=Lr(Un(r,o,o),n);if(dr&&o&&/\s/.test(r.nodeValue[o-1])&&o<r.nodeValue.length){let t=Lr(Un(r,o-1,o-1),-1);if(t.top==e.top){let n=Lr(Un(r,o,o+1),-1);if(n.top!=e.top)return Pr(n,n.left<t.left)}}return e}}if(!e.state.doc.resolve(t-(i||0)).parent.inlineContent){if(null==i&&o&&(n<0||o==Qn(r))){let e=r.childNodes[o-1];if(1==e.nodeType)return Br(e.getBoundingClientRect(),!1)}if(null==i&&o<Qn(r)){let e=r.childNodes[o];if(1==e.nodeType)return Br(e.getBoundingClientRect(),!0)}return Br(r.getBoundingClientRect(),n>=0)}if(null==i&&o&&(n<0||o==Qn(r))){let e=r.childNodes[o-1],t=3==e.nodeType?Un(e,Qn(e)-(s?0:1)):1!=e.nodeType||"BR"==e.nodeName&&e.nextSibling?null:e;if(t)return Pr(Lr(t,1),!1)}if(null==i&&o<Qn(r)){let e=r.childNodes[o];for(;e.pmViewDesc&&e.pmViewDesc.ignoreForCoords;)e=e.nextSibling;let t=e?3==e.nodeType?Un(e,0,s?0:1):1==e.nodeType?e:null:null;if(t)return Pr(Lr(t,-1),!0)}return Pr(Lr(3==r.nodeType?Un(r):r,-n),n>=0)}function Pr(e,t){if(0==e.width)return e;let n=t?e.left:e.right;return{top:e.top,bottom:e.bottom,left:n,right:n}}function Br(e,t){if(0==e.height)return e;let n=t?e.top:e.bottom;return{top:n,bottom:n,left:e.left,right:e.right}}function $r(e,t,n){let r=e.state,o=e.root.activeElement;r!=t&&e.updateState(t),o!=e.dom&&e.focus();try{return n()}finally{r!=t&&e.updateState(r),o!=e.dom&&o&&o.focus()}}const Vr=/[\u0590-\u08ac]/;let jr=null,Fr=null,Hr=!1;function _r(e,t,n){return jr==t&&Fr==n?Hr:(jr=t,Fr=n,Hr="up"==n||"down"==n?function(e,t,n){let r=t.selection,o="up"==n?r.$from:r.$to;return $r(e,t,(()=>{let{node:t}=e.docView.domFromPos(o.pos,"up"==n?-1:1);for(;;){let n=e.docView.nearestDesc(t,!0);if(!n)break;if(n.node.isBlock){t=n.contentDOM||n.dom;break}t=n.dom.parentNode}let r=zr(e,o.pos,1);for(let e=t.firstChild;e;e=e.nextSibling){let t;if(1==e.nodeType)t=e.getClientRects();else{if(3!=e.nodeType)continue;t=Un(e,0,e.nodeValue.length).getClientRects()}for(let e=0;e<t.length;e++){let o=t[e];if(o.bottom>o.top+1&&("up"==n?r.top-o.top>2*(o.bottom-r.top):o.bottom-r.bottom>2*(r.bottom-o.top)))return!1}}return!0}))}(e,t,n):function(e,t,n){let{$head:r}=t.selection;if(!r.parent.isTextblock)return!1;let o=r.parentOffset,i=!o,s=o==r.parent.content.size,a=e.domSelection();return a?Vr.test(r.parent.textContent)&&a.modify?$r(e,t,(()=>{let{focusNode:t,focusOffset:o,anchorNode:i,anchorOffset:s}=e.domSelectionRange(),l=a.caretBidiLevel;a.modify("move",n,"character");let c=r.depth?e.docView.domAfterPos(r.before()):e.dom,{focusNode:d,focusOffset:h}=e.domSelectionRange(),u=d&&!c.contains(1==d.nodeType?d:d.parentNode)||t==d&&o==h;try{a.collapse(i,s),t&&(t!=i||o!=s)&&a.extend&&a.extend(t,o)}catch(e){}return null!=l&&(a.caretBidiLevel=l),u})):"left"==n||"backward"==n?i:s:r.pos==r.start()||r.pos==r.end()}(e,t,n))}class qr{constructor(e,t,n,r){this.parent=e,this.children=t,this.dom=n,this.contentDOM=r,this.dirty=0,n.pmViewDesc=this}matchesWidget(e){return!1}matchesMark(e){return!1}matchesNode(e,t,n){return!1}matchesHack(e){return!1}parseRule(){return null}stopEvent(e){return!1}get size(){let e=0;for(let t=0;t<this.children.length;t++)e+=this.children[t].size;return e}get border(){return 0}destroy(){this.parent=void 0,this.dom.pmViewDesc==this&&(this.dom.pmViewDesc=void 0);for(let e=0;e<this.children.length;e++)this.children[e].destroy()}posBeforeChild(e){for(let t=0,n=this.posAtStart;;t++){let r=this.children[t];if(r==e)return n;n+=r.size}}get posBefore(){return this.parent.posBeforeChild(this)}get posAtStart(){return this.parent?this.parent.posBeforeChild(this)+this.border:0}get posAfter(){return this.posBefore+this.size}get posAtEnd(){return this.posAtStart+this.size-2*this.border}localPosFromDOM(e,t,n){if(this.contentDOM&&this.contentDOM.contains(1==e.nodeType?e:e.parentNode)){if(n<0){let n,r;if(e==this.contentDOM)n=e.childNodes[t-1];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;n=e.previousSibling}for(;n&&(!(r=n.pmViewDesc)||r.parent!=this);)n=n.previousSibling;return n?this.posBeforeChild(r)+r.size:this.posAtStart}{let n,r;if(e==this.contentDOM)n=e.childNodes[t];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;n=e.nextSibling}for(;n&&(!(r=n.pmViewDesc)||r.parent!=this);)n=n.nextSibling;return n?this.posBeforeChild(r):this.posAtEnd}}let r;if(e==this.dom&&this.contentDOM)r=t>Wn(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))r=2&e.compareDocumentPosition(this.contentDOM);else if(this.dom.firstChild){if(0==t)for(let t=e;;t=t.parentNode){if(t==this.dom){r=!1;break}if(t.previousSibling)break}if(null==r&&t==e.childNodes.length)for(let t=e;;t=t.parentNode){if(t==this.dom){r=!0;break}if(t.nextSibling)break}}return(null==r?n>0:r)?this.posAtEnd:this.posAtStart}nearestDesc(e,t=!1){for(let n=!0,r=e;r;r=r.parentNode){let o,i=this.getDesc(r);if(i&&(!t||i.node)){if(!n||!(o=i.nodeDOM)||(1==o.nodeType?o.contains(1==e.nodeType?e:e.parentNode):o==e))return i;n=!1}}}getDesc(e){let t=e.pmViewDesc;for(let e=t;e;e=e.parent)if(e==this)return t}posFromDOM(e,t,n){for(let r=e;r;r=r.parentNode){let o=this.getDesc(r);if(o)return o.localPosFromDOM(e,t,n)}return-1}descAt(e){for(let t=0,n=0;t<this.children.length;t++){let r=this.children[t],o=n+r.size;if(n==e&&o!=n){for(;!r.border&&r.children.length;)for(let e=0;e<r.children.length;e++){let t=r.children[e];if(t.size){r=t;break}}return r}if(e<o)return r.descAt(e-n-r.border);n=o}}domFromPos(e,t){if(!this.contentDOM)return{node:this.dom,offset:0,atom:e+1};let n=0,r=0;for(let t=0;n<this.children.length;n++){let o=this.children[n],i=t+o.size;if(i>e||o instanceof Xr){r=e-t;break}t=i}if(r)return this.children[n].domFromPos(r-this.children[n].border,t);for(let e;n&&!(e=this.children[n-1]).size&&e instanceof Wr&&e.side>=0;n--);if(t<=0){let e,r=!0;for(;e=n?this.children[n-1]:null,e&&e.dom.parentNode!=this.contentDOM;n--,r=!1);return e&&t&&r&&!e.border&&!e.domAtom?e.domFromPos(e.size,t):{node:this.contentDOM,offset:e?Wn(e.dom)+1:0}}{let e,r=!0;for(;e=n<this.children.length?this.children[n]:null,e&&e.dom.parentNode!=this.contentDOM;n++,r=!1);return e&&r&&!e.border&&!e.domAtom?e.domFromPos(0,t):{node:this.contentDOM,offset:e?Wn(e.dom):this.contentDOM.childNodes.length}}}parseRange(e,t,n=0){if(0==this.children.length)return{node:this.contentDOM,from:e,to:t,fromOffset:0,toOffset:this.contentDOM.childNodes.length};let r=-1,o=-1;for(let i=n,s=0;;s++){let n=this.children[s],a=i+n.size;if(-1==r&&e<=a){let o=i+n.border;if(e>=o&&t<=a-n.border&&n.node&&n.contentDOM&&this.contentDOM.contains(n.contentDOM))return n.parseRange(e,t,o);e=i;for(let t=s;t>0;t--){let n=this.children[t-1];if(n.size&&n.dom.parentNode==this.contentDOM&&!n.emptyChildAt(1)){r=Wn(n.dom)+1;break}e-=n.size}-1==r&&(r=0)}if(r>-1&&(a>t||s==this.children.length-1)){t=a;for(let e=s+1;e<this.children.length;e++){let n=this.children[e];if(n.size&&n.dom.parentNode==this.contentDOM&&!n.emptyChildAt(-1)){o=Wn(n.dom);break}t+=n.size}-1==o&&(o=this.contentDOM.childNodes.length);break}i=a}return{node:this.contentDOM,from:e,to:t,fromOffset:r,toOffset:o}}emptyChildAt(e){if(this.border||!this.contentDOM||!this.children.length)return!1;let t=this.children[e<0?0:this.children.length-1];return 0==t.size||t.emptyChildAt(e)}domAfterPos(e){let{node:t,offset:n}=this.domFromPos(e,0);if(1!=t.nodeType||n==t.childNodes.length)throw new RangeError("No node after pos "+e);return t.childNodes[n]}setSelection(e,t,n,r=!1){let o=Math.min(e,t),i=Math.max(e,t);for(let s=0,a=0;s<this.children.length;s++){let l=this.children[s],c=a+l.size;if(o>a&&i<c)return l.setSelection(e-a-l.border,t-a-l.border,n,r);a=c}let s=this.domFromPos(e,e?-1:1),a=t==e?s:this.domFromPos(t,t?-1:1),l=n.root.getSelection(),c=n.domSelectionRange(),d=!1;if((dr||fr)&&e==t){let{node:e,offset:t}=s;if(3==e.nodeType){if(d=!(!t||"\n"!=e.nodeValue[t-1]),d&&t==e.nodeValue.length)for(let t,n=e;n;n=n.parentNode){if(t=n.nextSibling){"BR"==t.nodeName&&(s=a={node:t.parentNode,offset:Wn(t)+1});break}let e=n.pmViewDesc;if(e&&e.node&&e.node.isBlock)break}}else{let n=e.childNodes[t-1];d=n&&("BR"==n.nodeName||"false"==n.contentEditable)}}if(dr&&c.focusNode&&c.focusNode!=a.node&&1==c.focusNode.nodeType){let e=c.focusNode.childNodes[c.focusOffset];e&&"false"==e.contentEditable&&(r=!0)}if(!(r||d&&fr)&&Gn(s.node,s.offset,c.anchorNode,c.anchorOffset)&&Gn(a.node,a.offset,c.focusNode,c.focusOffset))return;let h=!1;if((l.extend||e==t)&&!d){l.collapse(s.node,s.offset);try{e!=t&&l.extend(a.node,a.offset),h=!0}catch(e){}}if(!h){if(e>t){let e=s;s=a,a=e}let n=document.createRange();n.setEnd(a.node,a.offset),n.setStart(s.node,s.offset),l.removeAllRanges(),l.addRange(n)}}ignoreMutation(e){return!this.contentDOM&&"selection"!=e.type}get contentLost(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}markDirty(e,t){for(let n=0,r=0;r<this.children.length;r++){let o=this.children[r],i=n+o.size;if(n==i?e<=i&&t>=n:e<i&&t>n){let r=n+o.border,s=i-o.border;if(e>=r&&t<=s)return this.dirty=e==n||t==i?2:1,void(e!=r||t!=s||!o.contentLost&&o.dom.parentNode==this.contentDOM?o.markDirty(e-r,t-r):o.dirty=3);o.dirty=o.dom!=o.contentDOM||o.dom.parentNode!=this.contentDOM||o.children.length?3:2}n=i}this.dirty=2}markParentsDirty(){let e=1;for(let t=this.parent;t;t=t.parent,e++){let n=1==e?2:1;t.dirty<n&&(t.dirty=n)}}get domAtom(){return!1}get ignoreForCoords(){return!1}get ignoreForSelection(){return!1}isText(e){return!1}}class Wr extends qr{constructor(e,t,n,r){let o,i=t.type.toDOM;if("function"==typeof i&&(i=i(n,(()=>o?o.parent?o.parent.posBeforeChild(o):void 0:r))),!t.type.spec.raw){if(1!=i.nodeType){let e=document.createElement("span");e.appendChild(i),i=e}i.contentEditable="false",i.classList.add("ProseMirror-widget")}super(e,[],i,null),this.widget=t,this.widget=t,o=this}matchesWidget(e){return 0==this.dirty&&e.type.eq(this.widget.type)}parseRule(){return{ignore:!0}}stopEvent(e){let t=this.widget.spec.stopEvent;return!!t&&t(e)}ignoreMutation(e){return"selection"!=e.type||this.widget.spec.ignoreSelection}destroy(){this.widget.type.destroy(this.dom),super.destroy()}get domAtom(){return!0}get ignoreForSelection(){return!!this.widget.type.spec.relaxedSide}get side(){return this.widget.type.side}}class Kr extends qr{constructor(e,t,n,r){super(e,[],t,null),this.textDOM=n,this.text=r}get size(){return this.text.length}localPosFromDOM(e,t){return e!=this.textDOM?this.posAtStart+(t?this.size:0):this.posAtStart+t}domFromPos(e){return{node:this.textDOM,offset:e}}ignoreMutation(e){return"characterData"===e.type&&e.target.nodeValue==e.oldValue}}class Jr extends qr{constructor(e,t,n,r,o){super(e,[],n,r),this.mark=t,this.spec=o}static create(e,t,n,r){let o=r.nodeViews[t.type.name],i=o&&o(t,r,n);return i&&i.dom||(i=Mt.renderSpec(document,t.type.spec.toDOM(t,n),null,t.attrs)),new Jr(e,t,i.dom,i.contentDOM||i.dom,i)}parseRule(){return 3&this.dirty||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return 3!=this.dirty&&this.mark.eq(e)}markDirty(e,t){if(super.markDirty(e,t),0!=this.dirty){let e=this.parent;for(;!e.node;)e=e.parent;e.dirty<this.dirty&&(e.dirty=this.dirty),this.dirty=0}}slice(e,t,n){let r=Jr.create(this.parent,this.mark,!0,n),o=this.children,i=this.size;t<i&&(o=ho(o,t,i,n)),e>0&&(o=ho(o,0,e,n));for(let e=0;e<o.length;e++)o[e].parent=r;return r.children=o,r}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}}class Ur extends qr{constructor(e,t,n,r,o,i,s,a,l){super(e,[],o,i),this.node=t,this.outerDeco=n,this.innerDeco=r,this.nodeDOM=s}static create(e,t,n,r,o,i){let s,a=o.nodeViews[t.type.name],l=a&&a(t,o,(()=>s?s.parent?s.parent.posBeforeChild(s):void 0:i),n,r),c=l&&l.dom,d=l&&l.contentDOM;if(t.isText)if(c){if(3!=c.nodeType)throw new RangeError("Text must be rendered as a DOM text node")}else c=document.createTextNode(t.text);else if(!c){let e=Mt.renderSpec(document,t.type.spec.toDOM(t),null,t.attrs);({dom:c,contentDOM:d}=e)}d||t.isText||"BR"==c.nodeName||(c.hasAttribute("contenteditable")||(c.contentEditable="false"),t.type.spec.draggable&&(c.draggable=!0));let h=c;return c=io(c,n,t),l?s=new Qr(e,t,n,r,c,d||null,h,l,o,i+1):t.isText?new Yr(e,t,n,r,c,h,o):new Ur(e,t,n,r,c,d||null,h,o,i+1)}parseRule(){if(this.node.type.spec.reparseInView)return null;let e={node:this.node.type.name,attrs:this.node.attrs};if("pre"==this.node.type.whitespace&&(e.preserveWhitespace="full"),this.contentDOM)if(this.contentLost){for(let t=this.children.length-1;t>=0;t--){let n=this.children[t];if(this.dom.contains(n.dom.parentNode)){e.contentElement=n.dom.parentNode;break}}e.contentElement||(e.getContent=()=>Se.empty)}else e.contentElement=this.contentDOM;else e.getContent=()=>this.node.content;return e}matchesNode(e,t,n){return 0==this.dirty&&e.eq(this.node)&&so(t,this.outerDeco)&&n.eq(this.innerDeco)}get size(){return this.node.nodeSize}get border(){return this.node.isLeaf?0:1}updateChildren(e,t){let n=this.node.inlineContent,r=t,o=e.composing?this.localCompositionInfo(e,t):null,i=o&&o.pos>-1?o:null,s=o&&o.pos<0,a=new lo(this,i&&i.node,e);!function(e,t,n,r){let o=t.locals(e),i=0;if(0==o.length){for(let n=0;n<e.childCount;n++){let s=e.child(n);r(s,o,t.forChild(i,s),n),i+=s.nodeSize}return}let s=0,a=[],l=null;for(let c=0;;){let d,h,u,p;for(;s<o.length&&o[s].to==i;){let e=o[s++];e.widget&&(d?(h||(h=[d])).push(e):d=e)}if(d)if(h){h.sort(co);for(let e=0;e<h.length;e++)n(h[e],c,!!l)}else n(d,c,!!l);if(l)p=-1,u=l,l=null;else{if(!(c<e.childCount))break;p=c,u=e.child(c++)}for(let e=0;e<a.length;e++)a[e].to<=i&&a.splice(e--,1);for(;s<o.length&&o[s].from<=i&&o[s].to>i;)a.push(o[s++]);let f=i+u.nodeSize;if(u.isText){let e=f;s<o.length&&o[s].from<e&&(e=o[s].from);for(let t=0;t<a.length;t++)a[t].to<e&&(e=a[t].to);e<f&&(l=u.cut(e-i),u=u.cut(0,e-i),f=e,p=-1)}else for(;s<o.length&&o[s].to<f;)s++;r(u,u.isInline&&!u.isLeaf?a.filter((e=>!e.inline)):a.slice(),t.forChild(i,u),p),i=f}}(this.node,this.innerDeco,((t,o,i)=>{t.spec.marks?a.syncToMarks(t.spec.marks,n,e):t.type.side>=0&&!i&&a.syncToMarks(o==this.node.childCount?Ee.none:this.node.child(o).marks,n,e),a.placeWidget(t,e,r)}),((t,i,l,c)=>{let d;a.syncToMarks(t.marks,n,e),a.findNodeMatch(t,i,l,c)||s&&e.state.selection.from>r&&e.state.selection.to<r+t.nodeSize&&(d=a.findIndexWithChild(o.node))>-1&&a.updateNodeAt(t,i,l,d,e)||a.updateNextNode(t,i,l,e,c,r)||a.addNode(t,i,l,e,r),r+=t.nodeSize})),a.syncToMarks([],n,e),this.node.isTextblock&&a.addTextblockHacks(),a.destroyRest(),(a.changed||2==this.dirty)&&(i&&this.protectLocalComposition(e,i),Zr(this.contentDOM,this.children,e),mr&&function(e){if("UL"==e.nodeName||"OL"==e.nodeName){let t=e.style.cssText;e.style.cssText=t+"; list-style: square !important",window.getComputedStyle(e).listStyle,e.style.cssText=t}}(this.dom))}localCompositionInfo(e,t){let{from:n,to:r}=e.state.selection;if(!(e.state.selection instanceof Mn)||n<t||r>t+this.node.content.size)return null;let o=e.input.compositionNode;if(!o||!this.dom.contains(o.parentNode))return null;if(this.node.inlineContent){let e=o.nodeValue,i=function(e,t,n,r){for(let o=0,i=0;o<e.childCount&&i<=r;){let s=e.child(o++),a=i;if(i+=s.nodeSize,!s.isText)continue;let l=s.text;for(;o<e.childCount;){let t=e.child(o++);if(i+=t.nodeSize,!t.isText)break;l+=t.text}if(i>=n){if(i>=r&&l.slice(r-t.length-a,r-a)==t)return r-t.length;let e=a<r?l.lastIndexOf(t,r-a-1):-1;if(e>=0&&e+t.length+a>=n)return a+e;if(n==r&&l.length>=r+t.length-a&&l.slice(r-a,r-a+t.length)==t)return r}}return-1}(this.node.content,e,n-t,r-t);return i<0?null:{node:o,pos:i,text:e}}return{node:o,pos:-1,text:""}}protectLocalComposition(e,{node:t,pos:n,text:r}){if(this.getDesc(t))return;let o=t;for(;o.parentNode!=this.contentDOM;o=o.parentNode){for(;o.previousSibling;)o.parentNode.removeChild(o.previousSibling);for(;o.nextSibling;)o.parentNode.removeChild(o.nextSibling);o.pmViewDesc&&(o.pmViewDesc=void 0)}let i=new Kr(this,o,t,r);e.input.compositionNodes.push(i),this.children=ho(this.children,n,n+r.length,e,i)}update(e,t,n,r){return!(3==this.dirty||!e.sameMarkup(this.node))&&(this.updateInner(e,t,n,r),!0)}updateInner(e,t,n,r){this.updateOuterDeco(t),this.node=e,this.innerDeco=n,this.contentDOM&&this.updateChildren(r,this.posAtStart),this.dirty=0}updateOuterDeco(e){if(so(e,this.outerDeco))return;let t=1!=this.nodeDOM.nodeType,n=this.dom;this.dom=ro(this.dom,this.nodeDOM,no(this.outerDeco,this.node,t),no(e,this.node,t)),this.dom!=n&&(n.pmViewDesc=void 0,this.dom.pmViewDesc=this),this.outerDeco=e}selectNode(){1==this.nodeDOM.nodeType&&this.nodeDOM.classList.add("ProseMirror-selectednode"),!this.contentDOM&&this.node.type.spec.draggable||(this.dom.draggable=!0)}deselectNode(){1==this.nodeDOM.nodeType&&(this.nodeDOM.classList.remove("ProseMirror-selectednode"),!this.contentDOM&&this.node.type.spec.draggable||this.dom.removeAttribute("draggable"))}get domAtom(){return this.node.isAtom}}function Gr(e,t,n,r,o){io(r,t,e);let i=new Ur(void 0,e,t,n,r,r,r,o,0);return i.contentDOM&&i.updateChildren(o,0),i}class Yr extends Ur{constructor(e,t,n,r,o,i,s){super(e,t,n,r,o,null,i,s,0)}parseRule(){let e=this.nodeDOM.parentNode;for(;e&&e!=this.dom&&!e.pmIsDeco;)e=e.parentNode;return{skip:e||!0}}update(e,t,n,r){return!(3==this.dirty||0!=this.dirty&&!this.inParent()||!e.sameMarkup(this.node))&&(this.updateOuterDeco(t),0==this.dirty&&e.text==this.node.text||e.text==this.nodeDOM.nodeValue||(this.nodeDOM.nodeValue=e.text,r.trackWrites==this.nodeDOM&&(r.trackWrites=null)),this.node=e,this.dirty=0,!0)}inParent(){let e=this.parent.contentDOM;for(let t=this.nodeDOM;t;t=t.parentNode)if(t==e)return!0;return!1}domFromPos(e){return{node:this.nodeDOM,offset:e}}localPosFromDOM(e,t,n){return e==this.nodeDOM?this.posAtStart+Math.min(t,this.node.text.length):super.localPosFromDOM(e,t,n)}ignoreMutation(e){return"characterData"!=e.type&&"selection"!=e.type}slice(e,t,n){let r=this.node.cut(e,t),o=document.createTextNode(r.text);return new Yr(this.parent,r,this.outerDeco,this.innerDeco,o,o,n)}markDirty(e,t){super.markDirty(e,t),this.dom==this.nodeDOM||0!=e&&t!=this.nodeDOM.nodeValue.length||(this.dirty=3)}get domAtom(){return!1}isText(e){return this.node.text==e}}class Xr extends qr{parseRule(){return{ignore:!0}}matchesHack(e){return 0==this.dirty&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return"IMG"==this.dom.nodeName}}class Qr extends Ur{constructor(e,t,n,r,o,i,s,a,l,c){super(e,t,n,r,o,i,s,l,c),this.spec=a}update(e,t,n,r){if(3==this.dirty)return!1;if(this.spec.update&&(this.node.type==e.type||this.spec.multiType)){let o=this.spec.update(e,t,n);return o&&this.updateInner(e,t,n,r),o}return!(!this.contentDOM&&!e.isLeaf)&&super.update(e,t,n,r)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(e,t,n,r){this.spec.setSelection?this.spec.setSelection(e,t,n.root):super.setSelection(e,t,n,r)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}stopEvent(e){return!!this.spec.stopEvent&&this.spec.stopEvent(e)}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}}function Zr(e,t,n){let r=e.firstChild,o=!1;for(let i=0;i<t.length;i++){let s=t[i],a=s.dom;if(a.parentNode==e){for(;a!=r;)r=ao(r),o=!0;r=r.nextSibling}else o=!0,e.insertBefore(a,r);if(s instanceof Jr){let t=r?r.previousSibling:e.lastChild;Zr(s.contentDOM,s.children,n),r=t?t.nextSibling:e.firstChild}}for(;r;)r=ao(r),o=!0;o&&n.trackWrites==e&&(n.trackWrites=null)}const eo=function(e){e&&(this.nodeName=e)};eo.prototype=Object.create(null);const to=[new eo];function no(e,t,n){if(0==e.length)return to;let r=n?to[0]:new eo,o=[r];for(let i=0;i<e.length;i++){let s=e[i].type.attrs;if(s){s.nodeName&&o.push(r=new eo(s.nodeName));for(let e in s){let i=s[e];null!=i&&(n&&1==o.length&&o.push(r=new eo(t.isInline?"span":"div")),"class"==e?r.class=(r.class?r.class+" ":"")+i:"style"==e?r.style=(r.style?r.style+";":"")+i:"nodeName"!=e&&(r[e]=i))}}}return o}function ro(e,t,n,r){if(n==to&&r==to)return t;let o=t;for(let t=0;t<r.length;t++){let i=r[t],s=n[t];if(t){let t;s&&s.nodeName==i.nodeName&&o!=e&&(t=o.parentNode)&&t.nodeName.toLowerCase()==i.nodeName||(t=document.createElement(i.nodeName),t.pmIsDeco=!0,t.appendChild(o),s=to[0]),o=t}oo(o,s||to[0],i)}return o}function oo(e,t,n){for(let r in t)"class"==r||"style"==r||"nodeName"==r||r in n||e.removeAttribute(r);for(let r in n)"class"!=r&&"style"!=r&&"nodeName"!=r&&n[r]!=t[r]&&e.setAttribute(r,n[r]);if(t.class!=n.class){let r=t.class?t.class.split(" ").filter(Boolean):[],o=n.class?n.class.split(" ").filter(Boolean):[];for(let t=0;t<r.length;t++)-1==o.indexOf(r[t])&&e.classList.remove(r[t]);for(let t=0;t<o.length;t++)-1==r.indexOf(o[t])&&e.classList.add(o[t]);0==e.classList.length&&e.removeAttribute("class")}if(t.style!=n.style){if(t.style){let n,r=/\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g;for(;n=r.exec(t.style);)e.style.removeProperty(n[1])}n.style&&(e.style.cssText+=n.style)}}function io(e,t,n){return ro(e,e,to,no(t,n,1!=e.nodeType))}function so(e,t){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(!e[n].type.eq(t[n].type))return!1;return!0}function ao(e){let t=e.nextSibling;return e.parentNode.removeChild(e),t}class lo{constructor(e,t,n){this.lock=t,this.view=n,this.index=0,this.stack=[],this.changed=!1,this.top=e,this.preMatch=function(e,t){let n=t,r=n.children.length,o=e.childCount,i=new Map,s=[];e:for(;o>0;){let a;for(;;)if(r){let e=n.children[r-1];if(!(e instanceof Jr)){a=e,r--;break}n=e,r=e.children.length}else{if(n==t)break e;r=n.parent.children.indexOf(n),n=n.parent}let l=a.node;if(l){if(l!=e.child(o-1))break;--o,i.set(a,o),s.push(a)}}return{index:o,matched:i,matches:s.reverse()}}(e.node.content,e)}destroyBetween(e,t){if(e!=t){for(let n=e;n<t;n++)this.top.children[n].destroy();this.top.children.splice(e,t-e),this.changed=!0}}destroyRest(){this.destroyBetween(this.index,this.top.children.length)}syncToMarks(e,t,n){let r=0,o=this.stack.length>>1,i=Math.min(o,e.length);for(;r<i&&(r==o-1?this.top:this.stack[r+1<<1]).matchesMark(e[r])&&!1!==e[r].type.spec.spanning;)r++;for(;r<o;)this.destroyRest(),this.top.dirty=0,this.index=this.stack.pop(),this.top=this.stack.pop(),o--;for(;o<e.length;){this.stack.push(this.top,this.index+1);let r=-1;for(let t=this.index;t<Math.min(this.index+3,this.top.children.length);t++){let n=this.top.children[t];if(n.matchesMark(e[o])&&!this.isLocked(n.dom)){r=t;break}}if(r>-1)r>this.index&&(this.changed=!0,this.destroyBetween(this.index,r)),this.top=this.top.children[this.index];else{let r=Jr.create(this.top,e[o],t,n);this.top.children.splice(this.index,0,r),this.top=r,this.changed=!0}this.index=0,o++}}findNodeMatch(e,t,n,r){let o,i=-1;if(r>=this.preMatch.index&&(o=this.preMatch.matches[r-this.preMatch.index]).parent==this.top&&o.matchesNode(e,t,n))i=this.top.children.indexOf(o,this.index);else for(let r=this.index,o=Math.min(this.top.children.length,r+5);r<o;r++){let o=this.top.children[r];if(o.matchesNode(e,t,n)&&!this.preMatch.matched.has(o)){i=r;break}}return!(i<0)&&(this.destroyBetween(this.index,i),this.index++,!0)}updateNodeAt(e,t,n,r,o){let i=this.top.children[r];return 3==i.dirty&&i.dom==i.contentDOM&&(i.dirty=2),!!i.update(e,t,n,o)&&(this.destroyBetween(this.index,r),this.index++,!0)}findIndexWithChild(e){for(;;){let t=e.parentNode;if(!t)return-1;if(t==this.top.contentDOM){let t=e.pmViewDesc;if(t)for(let e=this.index;e<this.top.children.length;e++)if(this.top.children[e]==t)return e;return-1}e=t}}updateNextNode(e,t,n,r,o,i){for(let s=this.index;s<this.top.children.length;s++){let a=this.top.children[s];if(a instanceof Ur){let l=this.preMatch.matched.get(a);if(null!=l&&l!=o)return!1;let c,d=a.dom,h=this.isLocked(d)&&!(e.isText&&a.node&&a.node.isText&&a.nodeDOM.nodeValue==e.text&&3!=a.dirty&&so(t,a.outerDeco));if(!h&&a.update(e,t,n,r))return this.destroyBetween(this.index,s),a.dom!=d&&(this.changed=!0),this.index++,!0;if(!h&&(c=this.recreateWrapper(a,e,t,n,r,i)))return this.destroyBetween(this.index,s),this.top.children[this.index]=c,c.contentDOM&&(c.dirty=2,c.updateChildren(r,i+1),c.dirty=0),this.changed=!0,this.index++,!0;break}}return!1}recreateWrapper(e,t,n,r,o,i){if(e.dirty||t.isAtom||!e.children.length||!e.node.content.eq(t.content)||!so(n,e.outerDeco)||!r.eq(e.innerDeco))return null;let s=Ur.create(this.top,t,n,r,o,i);if(s.contentDOM){s.children=e.children,e.children=[];for(let e of s.children)e.parent=s}return e.destroy(),s}addNode(e,t,n,r,o){let i=Ur.create(this.top,e,t,n,r,o);i.contentDOM&&i.updateChildren(r,o+1),this.top.children.splice(this.index++,0,i),this.changed=!0}placeWidget(e,t,n){let r=this.index<this.top.children.length?this.top.children[this.index]:null;if(!r||!r.matchesWidget(e)||e!=r.widget&&r.widget.type.toDOM.parentNode){let r=new Wr(this.top,e,t,n);this.top.children.splice(this.index++,0,r),this.changed=!0}else this.index++}addTextblockHacks(){let e=this.top.children[this.index-1],t=this.top;for(;e instanceof Jr;)t=e,e=t.children[t.children.length-1];(!e||!(e instanceof Yr)||/\n$/.test(e.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(e.node.text))&&((fr||ur)&&e&&"false"==e.dom.contentEditable&&this.addHackNode("IMG",t),this.addHackNode("BR",this.top))}addHackNode(e,t){if(t==this.top&&this.index<t.children.length&&t.children[this.index].matchesHack(e))this.index++;else{let n=document.createElement(e);"IMG"==e&&(n.className="ProseMirror-separator",n.alt=""),"BR"==e&&(n.className="ProseMirror-trailingBreak");let r=new Xr(this.top,[],n,null);t!=this.top?t.children.push(r):t.children.splice(this.index++,0,r),this.changed=!0}}isLocked(e){return this.lock&&(e==this.lock||1==e.nodeType&&e.contains(this.lock.parentNode))}}function co(e,t){return e.type.side-t.type.side}function ho(e,t,n,r,o){let i=[];for(let s=0,a=0;s<e.length;s++){let l=e[s],c=a,d=a+=l.size;c>=n||d<=t?i.push(l):(c<t&&i.push(l.slice(0,t-c,r)),o&&(i.push(o),o=void 0),d>n&&i.push(l.slice(n-c,l.size,r)))}return i}function uo(e,t=null){let n=e.domSelectionRange(),r=e.state.doc;if(!n.focusNode)return null;let o=e.docView.nearestDesc(n.focusNode),i=o&&0==o.size,s=e.docView.posFromDOM(n.focusNode,n.focusOffset,1);if(s<0)return null;let a,l,c=r.resolve(s);if(er(n)){for(a=s;o&&!o.node;)o=o.parent;let e=o.node;if(o&&e.isAtom&&On.isSelectable(e)&&o.parent&&(!e.isInline||!function(e,t,n){for(let r=0==t,o=t==Qn(e);r||o;){if(e==n)return!0;let t=Wn(e);if(!(e=e.parentNode))return!1;r=r&&0==t,o=o&&t==Qn(e)}}(n.focusNode,n.focusOffset,o.dom))){let e=o.posBefore;l=new On(s==e?c:r.resolve(e))}}else{if(n instanceof e.dom.ownerDocument.defaultView.Selection&&n.rangeCount>1){let t=s,o=s;for(let r=0;r<n.rangeCount;r++){let i=n.getRangeAt(r);t=Math.min(t,e.docView.posFromDOM(i.startContainer,i.startOffset,1)),o=Math.max(o,e.docView.posFromDOM(i.endContainer,i.endOffset,-1))}if(t<0)return null;[a,s]=o==e.state.selection.anchor?[o,t]:[t,o],c=r.resolve(s)}else a=e.docView.posFromDOM(n.anchorNode,n.anchorOffset,1);if(a<0)return null}let d=r.resolve(a);if(!l){l=wo(e,d,c,"pointer"==t||e.state.selection.head<c.pos&&!i?1:-1)}return l}function po(e){return e.editable?e.hasFocus():Co(e)&&document.activeElement&&document.activeElement.contains(e.dom)}function fo(e,t=!1){let n=e.state.selection;if(bo(e,n),po(e)){if(!t&&e.input.mouseDown&&e.input.mouseDown.allowDefault&&ur){let t=e.domSelectionRange(),n=e.domObserver.currentSelection;if(t.anchorNode&&n.anchorNode&&Gn(t.anchorNode,t.anchorOffset,n.anchorNode,n.anchorOffset))return e.input.mouseDown.delayedSelectionSync=!0,void e.domObserver.setCurSelection()}if(e.domObserver.disconnectSelection(),e.cursorWrapper)!function(e){let t=e.domSelection(),n=document.createRange();if(!t)return;let r=e.cursorWrapper.dom,o="IMG"==r.nodeName;o?n.setStart(r.parentNode,Wn(r)+1):n.setStart(r,0);n.collapse(!0),t.removeAllRanges(),t.addRange(n),!o&&!e.state.selection.visible&&lr&&cr<=11&&(r.disabled=!0,r.disabled=!1)}(e);else{let r,o,{anchor:i,head:s}=n;!mo||n instanceof Mn||(n.$from.parent.inlineContent||(r=go(e,n.from)),n.empty||n.$from.parent.inlineContent||(o=go(e,n.to))),e.docView.setSelection(i,s,e,t),mo&&(r&&vo(r),o&&vo(o)),n.visible?e.dom.classList.remove("ProseMirror-hideselection"):(e.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&function(e){let t=e.dom.ownerDocument;t.removeEventListener("selectionchange",e.input.hideSelectionGuard);let n=e.domSelectionRange(),r=n.anchorNode,o=n.anchorOffset;t.addEventListener("selectionchange",e.input.hideSelectionGuard=()=>{n.anchorNode==r&&n.anchorOffset==o||(t.removeEventListener("selectionchange",e.input.hideSelectionGuard),setTimeout((()=>{po(e)&&!e.state.selection.visible||e.dom.classList.remove("ProseMirror-hideselection")}),20))})}(e))}e.domObserver.setCurSelection(),e.domObserver.connectSelection()}}const mo=fr||ur&&pr<63;function go(e,t){let{node:n,offset:r}=e.docView.domFromPos(t,0),o=r<n.childNodes.length?n.childNodes[r]:null,i=r?n.childNodes[r-1]:null;if(fr&&o&&"false"==o.contentEditable)return yo(o);if(!(o&&"false"!=o.contentEditable||i&&"false"!=i.contentEditable)){if(o)return yo(o);if(i)return yo(i)}}function yo(e){return e.contentEditable="true",fr&&e.draggable&&(e.draggable=!1,e.wasDraggable=!0),e}function vo(e){e.contentEditable="false",e.wasDraggable&&(e.draggable=!0,e.wasDraggable=null)}function bo(e,t){if(t instanceof On){let n=e.docView.descAt(t.from);n!=e.lastSelectedViewDesc&&(xo(e),n&&n.selectNode(),e.lastSelectedViewDesc=n)}else xo(e)}function xo(e){e.lastSelectedViewDesc&&(e.lastSelectedViewDesc.parent&&e.lastSelectedViewDesc.deselectNode(),e.lastSelectedViewDesc=void 0)}function wo(e,t,n,r){return e.someProp("createSelectionBetween",(r=>r(e,t,n)))||Mn.between(t,n,r)}function ko(e){return!(e.editable&&!e.hasFocus())&&Co(e)}function Co(e){let t=e.domSelectionRange();if(!t.anchorNode)return!1;try{return e.dom.contains(3==t.anchorNode.nodeType?t.anchorNode.parentNode:t.anchorNode)&&(e.editable||e.dom.contains(3==t.focusNode.nodeType?t.focusNode.parentNode:t.focusNode))}catch(e){return!1}}function No(e,t){let{$anchor:n,$head:r}=e.selection,o=t>0?n.max(r):n.min(r),i=o.parent.inlineContent?o.depth?e.doc.resolve(t>0?o.after():o.before()):null:o;return i&&kn.findFrom(i,t)}function So(e,t){return e.dispatch(e.state.tr.setSelection(t).scrollIntoView()),!0}function Mo(e,t,n){let r=e.state.selection;if(!(r instanceof Mn)){if(r instanceof On&&r.node.isInline)return So(e,new Mn(t>0?r.$to:r.$from));{let n=No(e.state,t);return!!n&&So(e,n)}}if(n.indexOf("s")>-1){let{$head:n}=r,o=n.textOffset?null:t<0?n.nodeBefore:n.nodeAfter;if(!o||o.isText||!o.isLeaf)return!1;let i=e.state.doc.resolve(n.pos+o.nodeSize*(t<0?-1:1));return So(e,new Mn(r.$anchor,i))}if(!r.empty)return!1;if(e.endOfTextblock(t>0?"forward":"backward")){let n=No(e.state,t);return!!(n&&n instanceof On)&&So(e,n)}if(!(gr&&n.indexOf("m")>-1)){let n,o=r.$head,i=o.textOffset?null:t<0?o.nodeBefore:o.nodeAfter;if(!i||i.isText)return!1;let s=t<0?o.pos-i.nodeSize:o.pos;return!!(i.isAtom||(n=e.docView.descAt(s))&&!n.contentDOM)&&(On.isSelectable(i)?So(e,new On(t<0?e.state.doc.resolve(o.pos-i.nodeSize):o)):!!br&&So(e,new Mn(e.state.doc.resolve(t<0?s:s+i.nodeSize))))}}function To(e){return 3==e.nodeType?e.nodeValue.length:e.childNodes.length}function Oo(e,t){let n=e.pmViewDesc;return n&&0==n.size&&(t<0||e.nextSibling||"BR"!=e.nodeName)}function Eo(e,t){return t<0?function(e){let t=e.domSelectionRange(),n=t.focusNode,r=t.focusOffset;if(!n)return;let o,i,s=!1;dr&&1==n.nodeType&&r<To(n)&&Oo(n.childNodes[r],-1)&&(s=!0);for(;;)if(r>0){if(1!=n.nodeType)break;{let e=n.childNodes[r-1];if(Oo(e,-1))o=n,i=--r;else{if(3!=e.nodeType)break;n=e,r=n.nodeValue.length}}}else{if(Ao(n))break;{let t=n.previousSibling;for(;t&&Oo(t,-1);)o=n.parentNode,i=Wn(t),t=t.previousSibling;if(t)n=t,r=To(n);else{if(n=n.parentNode,n==e.dom)break;r=0}}}s?Do(e,n,r):o&&Do(e,o,i)}(e):function(e){let t=e.domSelectionRange(),n=t.focusNode,r=t.focusOffset;if(!n)return;let o,i,s=To(n);for(;;)if(r<s){if(1!=n.nodeType)break;if(!Oo(n.childNodes[r],1))break;o=n,i=++r}else{if(Ao(n))break;{let t=n.nextSibling;for(;t&&Oo(t,1);)o=t.parentNode,i=Wn(t)+1,t=t.nextSibling;if(t)n=t,r=0,s=To(n);else{if(n=n.parentNode,n==e.dom)break;r=s=0}}}o&&Do(e,o,i)}(e)}function Ao(e){let t=e.pmViewDesc;return t&&t.node&&t.node.isBlock}function Do(e,t,n){if(3!=t.nodeType){let e,r;(r=function(e,t){for(;e&&t==e.childNodes.length&&!Zn(e);)t=Wn(e)+1,e=e.parentNode;for(;e&&t<e.childNodes.length;){let n=e.childNodes[t];if(3==n.nodeType)return n;if(1==n.nodeType&&"false"==n.contentEditable)break;e=n,t=0}}(t,n))?(t=r,n=0):(e=function(e,t){for(;e&&!t&&!Zn(e);)t=Wn(e),e=e.parentNode;for(;e&&t;){let n=e.childNodes[t-1];if(3==n.nodeType)return n;if(1==n.nodeType&&"false"==n.contentEditable)break;t=(e=n).childNodes.length}}(t,n))&&(t=e,n=e.nodeValue.length)}let r=e.domSelection();if(!r)return;if(er(r)){let e=document.createRange();e.setEnd(t,n),e.setStart(t,n),r.removeAllRanges(),r.addRange(e)}else r.extend&&r.extend(t,n);e.domObserver.setCurSelection();let{state:o}=e;setTimeout((()=>{e.state==o&&fo(e)}),50)}function Ro(e,t){let n=e.state.doc.resolve(t);if(!ur&&!yr&&n.parent.inlineContent){let r=e.coordsAtPos(t);if(t>n.start()){let n=e.coordsAtPos(t-1),o=(n.top+n.bottom)/2;if(o>r.top&&o<r.bottom&&Math.abs(n.left-r.left)>1)return n.left<r.left?"ltr":"rtl"}if(t<n.end()){let n=e.coordsAtPos(t+1),o=(n.top+n.bottom)/2;if(o>r.top&&o<r.bottom&&Math.abs(n.left-r.left)>1)return n.left>r.left?"ltr":"rtl"}}return"rtl"==getComputedStyle(e.dom).direction?"rtl":"ltr"}function Lo(e,t,n){let r=e.state.selection;if(r instanceof Mn&&!r.empty||n.indexOf("s")>-1)return!1;if(gr&&n.indexOf("m")>-1)return!1;let{$from:o,$to:i}=r;if(!o.parent.inlineContent||e.endOfTextblock(t<0?"up":"down")){let n=No(e.state,t);if(n&&n instanceof On)return So(e,n)}if(!o.parent.inlineContent){let n=t<0?o:i,s=r instanceof An?kn.near(n,t):kn.findFrom(n,t);return!!s&&So(e,s)}return!1}function Io(e,t){if(!(e.state.selection instanceof Mn))return!0;let{$head:n,$anchor:r,empty:o}=e.state.selection;if(!n.sameParent(r))return!0;if(!o)return!1;if(e.endOfTextblock(t>0?"forward":"backward"))return!0;let i=!n.textOffset&&(t<0?n.nodeBefore:n.nodeAfter);if(i&&!i.isText){let r=e.state.tr;return t<0?r.delete(n.pos-i.nodeSize,n.pos):r.delete(n.pos,n.pos+i.nodeSize),e.dispatch(r),!0}return!1}function zo(e,t,n){e.domObserver.stop(),t.contentEditable=n,e.domObserver.start()}function Po(e,t){let n=t.keyCode,r=function(e){let t="";return e.ctrlKey&&(t+="c"),e.metaKey&&(t+="m"),e.altKey&&(t+="a"),e.shiftKey&&(t+="s"),t}(t);if(8==n||gr&&72==n&&"c"==r)return Io(e,-1)||Eo(e,-1);if(46==n&&!t.shiftKey||gr&&68==n&&"c"==r)return Io(e,1)||Eo(e,1);if(13==n||27==n)return!0;if(37==n||gr&&66==n&&"c"==r){let t=37==n?"ltr"==Ro(e,e.state.selection.from)?-1:1:-1;return Mo(e,t,r)||Eo(e,t)}if(39==n||gr&&70==n&&"c"==r){let t=39==n?"ltr"==Ro(e,e.state.selection.from)?1:-1:1;return Mo(e,t,r)||Eo(e,t)}return 38==n||gr&&80==n&&"c"==r?Lo(e,-1,r)||Eo(e,-1):40==n||gr&&78==n&&"c"==r?function(e){if(!fr||e.state.selection.$head.parentOffset>0)return!1;let{focusNode:t,focusOffset:n}=e.domSelectionRange();if(t&&1==t.nodeType&&0==n&&t.firstChild&&"false"==t.firstChild.contentEditable){let n=t.firstChild;zo(e,n,"true"),setTimeout((()=>zo(e,n,"false")),20)}return!1}(e)||Lo(e,1,r)||Eo(e,1):r==(gr?"m":"c")&&(66==n||73==n||89==n||90==n)}function Bo(e,t){e.someProp("transformCopied",(n=>{t=n(t,e)}));let n=[],{content:r,openStart:o,openEnd:i}=t;for(;o>1&&i>1&&1==r.childCount&&1==r.firstChild.childCount;){o--,i--;let e=r.firstChild;n.push(e.type.name,e.attrs!=e.type.defaultAttrs?e.attrs:null),r=e.content}let s=e.someProp("clipboardSerializer")||Mt.fromSchema(e.state.schema),a=Jo(),l=a.createElement("div");l.appendChild(s.serializeFragment(r,{document:a}));let c,d=l.firstChild,h=0;for(;d&&1==d.nodeType&&(c=Wo[d.nodeName.toLowerCase()]);){for(let e=c.length-1;e>=0;e--){let t=a.createElement(c[e]);for(;l.firstChild;)t.appendChild(l.firstChild);l.appendChild(t),h++}d=l.firstChild}return d&&1==d.nodeType&&d.setAttribute("data-pm-slice",`${o} ${i}${h?` -${h}`:""} ${JSON.stringify(n)}`),{dom:l,text:e.someProp("clipboardTextSerializer",(n=>n(t,e)))||t.content.textBetween(0,t.content.size,"\n\n"),slice:t}}function $o(e,t,n,r,o){let i,s,a=o.parent.type.spec.code;if(!n&&!t)return null;let l=t&&(r||a||!n);if(l){if(e.someProp("transformPastedText",(n=>{t=n(t,a||r,e)})),a)return t?new De(Se.from(e.state.schema.text(t.replace(/\r\n?/g,"\n"))),0,0):De.empty;let n=e.someProp("clipboardTextParser",(n=>n(t,o,r,e)));if(n)s=n;else{let n=o.marks(),{schema:r}=e.state,s=Mt.fromSchema(r);i=document.createElement("div"),t.split(/(?:\r\n?|\n)+/).forEach((e=>{let t=i.appendChild(document.createElement("p"));e&&t.appendChild(s.serializeNode(r.text(e,n)))}))}}else e.someProp("transformPastedHTML",(t=>{n=t(n,e)})),i=function(e){let t=/^(\s*<meta [^>]*>)*/.exec(e);t&&(e=e.slice(t[0].length));let n,r=Jo().createElement("div"),o=/<([a-z][^>\s]+)/i.exec(e);(n=o&&Wo[o[1].toLowerCase()])&&(e=n.map((e=>"<"+e+">")).join("")+e+n.map((e=>"</"+e+">")).reverse().join(""));if(r.innerHTML=function(e){let t=window.trustedTypes;if(!t)return e;Uo||(Uo=t.defaultPolicy||t.createPolicy("ProseMirrorClipboard",{createHTML:e=>e}));return Uo.createHTML(e)}(e),n)for(let e=0;e<n.length;e++)r=r.querySelector(n[e])||r;return r}(n),br&&function(e){let t=e.querySelectorAll(ur?"span:not([class]):not([style])":"span.Apple-converted-space");for(let n=0;n<t.length;n++){let r=t[n];1==r.childNodes.length&&" "==r.textContent&&r.parentNode&&r.parentNode.replaceChild(e.ownerDocument.createTextNode(" "),r)}}(i);let c=i&&i.querySelector("[data-pm-slice]"),d=c&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(c.getAttribute("data-pm-slice")||"");if(d&&d[3])for(let e=+d[3];e>0;e--){let e=i.firstChild;for(;e&&1!=e.nodeType;)e=e.nextSibling;if(!e)break;i=e}if(!s){let t=e.someProp("clipboardParser")||e.someProp("domParser")||gt.fromSchema(e.state.schema);s=t.parseSlice(i,{preserveWhitespace:!(!l&&!d),context:o,ruleFromNode:e=>"BR"!=e.nodeName||e.nextSibling||!e.parentNode||Vo.test(e.parentNode.nodeName)?null:{ignore:!0}})}if(d)s=function(e,t){if(!e.size)return e;let n,r=e.content.firstChild.type.schema;try{n=JSON.parse(t)}catch(t){return e}let{content:o,openStart:i,openEnd:s}=e;for(let e=n.length-2;e>=0;e-=2){let t=r.nodes[n[e]];if(!t||t.hasRequiredAttrs())break;o=Se.from(t.create(n[e+1],o)),i++,s++}return new De(o,i,s)}(qo(s,+d[1],+d[2]),d[4]);else if(s=De.maxOpen(function(e,t){if(e.childCount<2)return e;for(let n=t.depth;n>=0;n--){let r,o=t.node(n).contentMatchAt(t.index(n)),i=[];if(e.forEach((e=>{if(!i)return;let t,n=o.findWrapping(e.type);if(!n)return i=null;if(t=i.length&&r.length&&Fo(n,r,e,i[i.length-1],0))i[i.length-1]=t;else{i.length&&(i[i.length-1]=Ho(i[i.length-1],r.length));let t=jo(e,n);i.push(t),o=o.matchType(t.type),r=n}})),i)return Se.from(i)}return e}(s.content,o),!0),s.openStart||s.openEnd){let e=0,t=0;for(let t=s.content.firstChild;e<s.openStart&&!t.type.spec.isolating;e++,t=t.firstChild);for(let e=s.content.lastChild;t<s.openEnd&&!e.type.spec.isolating;t++,e=e.lastChild);s=qo(s,e,t)}return e.someProp("transformPasted",(t=>{s=t(s,e)})),s}const Vo=/^(a|abbr|acronym|b|cite|code|del|em|i|ins|kbd|label|output|q|ruby|s|samp|span|strong|sub|sup|time|u|tt|var)$/i;function jo(e,t,n=0){for(let r=t.length-1;r>=n;r--)e=t[r].create(null,Se.from(e));return e}function Fo(e,t,n,r,o){if(o<e.length&&o<t.length&&e[o]==t[o]){let i=Fo(e,t,n,r.lastChild,o+1);if(i)return r.copy(r.content.replaceChild(r.childCount-1,i));if(r.contentMatchAt(r.childCount).matchType(o==e.length-1?n.type:e[o+1]))return r.copy(r.content.append(Se.from(jo(n,e,o+1))))}}function Ho(e,t){if(0==t)return e;let n=e.content.replaceChild(e.childCount-1,Ho(e.lastChild,t-1)),r=e.contentMatchAt(e.childCount).fillBefore(Se.empty,!0);return e.copy(n.append(r))}function _o(e,t,n,r,o,i){let s=t<0?e.firstChild:e.lastChild,a=s.content;return e.childCount>1&&(i=0),o<r-1&&(a=_o(a,t,n,r,o+1,i)),o>=n&&(a=t<0?s.contentMatchAt(0).fillBefore(a,i<=o).append(a):a.append(s.contentMatchAt(s.childCount).fillBefore(Se.empty,!0))),e.replaceChild(t<0?0:e.childCount-1,s.copy(a))}function qo(e,t,n){return t<e.openStart&&(e=new De(_o(e.content,-1,t,e.openStart,0,e.openEnd),t,e.openEnd)),n<e.openEnd&&(e=new De(_o(e.content,1,n,e.openEnd,0,0),e.openStart,n)),e}const Wo={thead:["table"],tbody:["table"],tfoot:["table"],caption:["table"],colgroup:["table"],col:["table","colgroup"],tr:["table","tbody"],td:["table","tbody","tr"],th:["table","tbody","tr"]};let Ko=null;function Jo(){return Ko||(Ko=document.implementation.createHTMLDocument("title"))}let Uo=null;const Go={},Yo={},Xo={touchstart:!0,touchmove:!0};class Qo{constructor(){this.shiftKey=!1,this.mouseDown=null,this.lastKeyCode=null,this.lastKeyCodeTime=0,this.lastClick={time:0,x:0,y:0,type:"",button:0},this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastIOSEnter=0,this.lastIOSEnterFallbackTimeout=-1,this.lastFocus=0,this.lastTouch=0,this.lastChromeDelete=0,this.composing=!1,this.compositionNode=null,this.composingTimeout=-1,this.compositionNodes=[],this.compositionEndedAt=-2e8,this.compositionID=1,this.compositionPendingChanges=0,this.domChangeCount=0,this.eventHandlers=Object.create(null),this.hideSelectionGuard=null}}function Zo(e,t){e.input.lastSelectionOrigin=t,e.input.lastSelectionTime=Date.now()}function ei(e){e.someProp("handleDOMEvents",(t=>{for(let n in t)e.input.eventHandlers[n]||e.dom.addEventListener(n,e.input.eventHandlers[n]=t=>ti(e,t))}))}function ti(e,t){return e.someProp("handleDOMEvents",(n=>{let r=n[t.type];return!!r&&(r(e,t)||t.defaultPrevented)}))}function ni(e,t){if(!t.bubbles)return!0;if(t.defaultPrevented)return!1;for(let n=t.target;n!=e.dom;n=n.parentNode)if(!n||11==n.nodeType||n.pmViewDesc&&n.pmViewDesc.stopEvent(t))return!1;return!0}function ri(e){return{left:e.clientX,top:e.clientY}}function oi(e,t,n,r,o){if(-1==r)return!1;let i=e.state.doc.resolve(r);for(let r=i.depth+1;r>0;r--)if(e.someProp(t,(t=>r>i.depth?t(e,n,i.nodeAfter,i.before(r),o,!0):t(e,n,i.node(r),i.before(r),o,!1))))return!0;return!1}function ii(e,t,n){if(e.focused||e.focus(),e.state.selection.eq(t))return;let r=e.state.tr.setSelection(t);r.setMeta("pointer",!0),e.dispatch(r)}function si(e,t,n,r,o){return oi(e,"handleClickOn",t,n,r)||e.someProp("handleClick",(n=>n(e,t,r)))||(o?function(e,t){if(-1==t)return!1;let n,r,o=e.state.selection;o instanceof On&&(n=o.node);let i=e.state.doc.resolve(t);for(let e=i.depth+1;e>0;e--){let t=e>i.depth?i.nodeAfter:i.node(e);if(On.isSelectable(t)){r=n&&o.$from.depth>0&&e>=o.$from.depth&&i.before(o.$from.depth+1)==o.$from.pos?i.before(o.$from.depth):i.before(e);break}}return null!=r&&(ii(e,On.create(e.state.doc,r)),!0)}(e,n):function(e,t){if(-1==t)return!1;let n=e.state.doc.resolve(t),r=n.nodeAfter;return!!(r&&r.isAtom&&On.isSelectable(r))&&(ii(e,new On(n)),!0)}(e,n))}function ai(e,t,n,r){return oi(e,"handleDoubleClickOn",t,n,r)||e.someProp("handleDoubleClick",(n=>n(e,t,r)))}function li(e,t,n,r){return oi(e,"handleTripleClickOn",t,n,r)||e.someProp("handleTripleClick",(n=>n(e,t,r)))||function(e,t,n){if(0!=n.button)return!1;let r=e.state.doc;if(-1==t)return!!r.inlineContent&&(ii(e,Mn.create(r,0,r.content.size)),!0);let o=r.resolve(t);for(let t=o.depth+1;t>0;t--){let n=t>o.depth?o.nodeAfter:o.node(t),i=o.before(t);if(n.inlineContent)ii(e,Mn.create(r,i+1,i+1+n.content.size));else{if(!On.isSelectable(n))continue;ii(e,On.create(r,i))}return!0}}(e,n,r)}function ci(e){return yi(e)}Yo.keydown=(e,t)=>{let n=t;if(e.input.shiftKey=16==n.keyCode||n.shiftKey,!ui(e,n)&&(e.input.lastKeyCode=n.keyCode,e.input.lastKeyCodeTime=Date.now(),!vr||!ur||13!=n.keyCode))if(229!=n.keyCode&&e.domObserver.forceFlush(),!mr||13!=n.keyCode||n.ctrlKey||n.altKey||n.metaKey)e.someProp("handleKeyDown",(t=>t(e,n)))||Po(e,n)?n.preventDefault():Zo(e,"key");else{let t=Date.now();e.input.lastIOSEnter=t,e.input.lastIOSEnterFallbackTimeout=setTimeout((()=>{e.input.lastIOSEnter==t&&(e.someProp("handleKeyDown",(t=>t(e,tr(13,"Enter")))),e.input.lastIOSEnter=0)}),200)}},Yo.keyup=(e,t)=>{16==t.keyCode&&(e.input.shiftKey=!1)},Yo.keypress=(e,t)=>{let n=t;if(ui(e,n)||!n.charCode||n.ctrlKey&&!n.altKey||gr&&n.metaKey)return;if(e.someProp("handleKeyPress",(t=>t(e,n))))return void n.preventDefault();let r=e.state.selection;if(!(r instanceof Mn&&r.$from.sameParent(r.$to))){let t=String.fromCharCode(n.charCode),o=()=>e.state.tr.insertText(t).scrollIntoView();/[\r\n]/.test(t)||e.someProp("handleTextInput",(n=>n(e,r.$from.pos,r.$to.pos,t,o)))||e.dispatch(o()),n.preventDefault()}};const di=gr?"metaKey":"ctrlKey";Go.mousedown=(e,t)=>{let n=t;e.input.shiftKey=n.shiftKey;let r=ci(e),o=Date.now(),i="singleClick";o-e.input.lastClick.time<500&&function(e,t){let n=t.x-e.clientX,r=t.y-e.clientY;return n*n+r*r<100}(n,e.input.lastClick)&&!n[di]&&e.input.lastClick.button==n.button&&("singleClick"==e.input.lastClick.type?i="doubleClick":"doubleClick"==e.input.lastClick.type&&(i="tripleClick")),e.input.lastClick={time:o,x:n.clientX,y:n.clientY,type:i,button:n.button};let s=e.posAtCoords(ri(n));s&&("singleClick"==i?(e.input.mouseDown&&e.input.mouseDown.done(),e.input.mouseDown=new hi(e,s,n,!!r)):("doubleClick"==i?ai:li)(e,s.pos,s.inside,n)?n.preventDefault():Zo(e,"pointer"))};class hi{constructor(e,t,n,r){let o,i;if(this.view=e,this.pos=t,this.event=n,this.flushed=r,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=e.state.doc,this.selectNode=!!n[di],this.allowDefault=n.shiftKey,t.inside>-1)o=e.state.doc.nodeAt(t.inside),i=t.inside;else{let n=e.state.doc.resolve(t.pos);o=n.parent,i=n.depth?n.before():0}const s=r?null:n.target,a=s?e.docView.nearestDesc(s,!0):null;this.target=a&&1==a.dom.nodeType?a.dom:null;let{selection:l}=e.state;(0==n.button&&o.type.spec.draggable&&!1!==o.type.spec.selectable||l instanceof On&&l.from<=i&&l.to>i)&&(this.mightDrag={node:o,pos:i,addAttr:!(!this.target||this.target.draggable),setUneditable:!(!this.target||!dr||this.target.hasAttribute("contentEditable"))}),this.target&&this.mightDrag&&(this.mightDrag.addAttr||this.mightDrag.setUneditable)&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&(this.target.draggable=!0),this.mightDrag.setUneditable&&setTimeout((()=>{this.view.input.mouseDown==this&&this.target.setAttribute("contentEditable","false")}),20),this.view.domObserver.start()),e.root.addEventListener("mouseup",this.up=this.up.bind(this)),e.root.addEventListener("mousemove",this.move=this.move.bind(this)),Zo(e,"pointer")}done(){this.view.root.removeEventListener("mouseup",this.up),this.view.root.removeEventListener("mousemove",this.move),this.mightDrag&&this.target&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&this.target.removeAttribute("draggable"),this.mightDrag.setUneditable&&this.target.removeAttribute("contentEditable"),this.view.domObserver.start()),this.delayedSelectionSync&&setTimeout((()=>fo(this.view))),this.view.input.mouseDown=null}up(e){if(this.done(),!this.view.dom.contains(e.target))return;let t=this.pos;this.view.state.doc!=this.startDoc&&(t=this.view.posAtCoords(ri(e))),this.updateAllowDefault(e),this.allowDefault||!t?Zo(this.view,"pointer"):si(this.view,t.pos,t.inside,e,this.selectNode)?e.preventDefault():0==e.button&&(this.flushed||fr&&this.mightDrag&&!this.mightDrag.node.isAtom||ur&&!this.view.state.selection.visible&&Math.min(Math.abs(t.pos-this.view.state.selection.from),Math.abs(t.pos-this.view.state.selection.to))<=2)?(ii(this.view,kn.near(this.view.state.doc.resolve(t.pos))),e.preventDefault()):Zo(this.view,"pointer")}move(e){this.updateAllowDefault(e),Zo(this.view,"pointer"),0==e.buttons&&this.done()}updateAllowDefault(e){!this.allowDefault&&(Math.abs(this.event.x-e.clientX)>4||Math.abs(this.event.y-e.clientY)>4)&&(this.allowDefault=!0)}}function ui(e,t){return!!e.composing||!!(fr&&Math.abs(t.timeStamp-e.input.compositionEndedAt)<500)&&(e.input.compositionEndedAt=-2e8,!0)}Go.touchstart=e=>{e.input.lastTouch=Date.now(),ci(e),Zo(e,"pointer")},Go.touchmove=e=>{e.input.lastTouch=Date.now(),Zo(e,"pointer")},Go.contextmenu=e=>ci(e);const pi=vr?5e3:-1;function fi(e,t){clearTimeout(e.input.composingTimeout),t>-1&&(e.input.composingTimeout=setTimeout((()=>yi(e)),t))}function mi(e){for(e.composing&&(e.input.composing=!1,e.input.compositionEndedAt=function(){let e=document.createEvent("Event");return e.initEvent("event",!0,!0),e.timeStamp}());e.input.compositionNodes.length>0;)e.input.compositionNodes.pop().markParentsDirty()}function gi(e){let t=e.domSelectionRange();if(!t.focusNode)return null;let n=function(e,t){for(;;){if(3==e.nodeType&&t)return e;if(1==e.nodeType&&t>0){if("false"==e.contentEditable)return null;t=Qn(e=e.childNodes[t-1])}else{if(!e.parentNode||Zn(e))return null;t=Wn(e),e=e.parentNode}}}(t.focusNode,t.focusOffset),r=function(e,t){for(;;){if(3==e.nodeType&&t<e.nodeValue.length)return e;if(1==e.nodeType&&t<e.childNodes.length){if("false"==e.contentEditable)return null;e=e.childNodes[t],t=0}else{if(!e.parentNode||Zn(e))return null;t=Wn(e)+1,e=e.parentNode}}}(t.focusNode,t.focusOffset);if(n&&r&&n!=r){let t=r.pmViewDesc,o=e.domObserver.lastChangedTextNode;if(n==o||r==o)return o;if(!t||!t.isText(r.nodeValue))return r;if(e.input.compositionNode==r){let e=n.pmViewDesc;if(e&&e.isText(n.nodeValue))return r}}return n||r}function yi(e,t=!1){if(!(vr&&e.domObserver.flushingSoon>=0)){if(e.domObserver.forceFlush(),mi(e),t||e.docView&&e.docView.dirty){let n=uo(e),r=e.state.selection;return n&&!n.eq(r)?e.dispatch(e.state.tr.setSelection(n)):!e.markCursor&&!t||r.$from.node(r.$from.sharedDepth(r.to)).inlineContent?e.updateState(e.state):e.dispatch(e.state.tr.deleteSelection()),!0}return!1}}Yo.compositionstart=Yo.compositionupdate=e=>{if(!e.composing){e.domObserver.flush();let{state:t}=e,n=t.selection.$to;if(t.selection instanceof Mn&&(t.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some((e=>!1===e.type.spec.inclusive))))e.markCursor=e.state.storedMarks||n.marks(),yi(e,!0),e.markCursor=null;else if(yi(e,!t.selection.empty),dr&&t.selection.empty&&n.parentOffset&&!n.textOffset&&n.nodeBefore.marks.length){let t=e.domSelectionRange();for(let n=t.focusNode,r=t.focusOffset;n&&1==n.nodeType&&0!=r;){let t=r<0?n.lastChild:n.childNodes[r-1];if(!t)break;if(3==t.nodeType){let n=e.domSelection();n&&n.collapse(t,t.nodeValue.length);break}n=t,r=-1}}e.input.composing=!0}fi(e,pi)},Yo.compositionend=(e,t)=>{e.composing&&(e.input.composing=!1,e.input.compositionEndedAt=t.timeStamp,e.input.compositionPendingChanges=e.domObserver.pendingRecords().length?e.input.compositionID:0,e.input.compositionNode=null,e.input.compositionPendingChanges&&Promise.resolve().then((()=>e.domObserver.flush())),e.input.compositionID++,fi(e,20))};const vi=lr&&cr<15||mr&&xr<604;function bi(e,t,n,r,o){let i=$o(e,t,n,r,e.state.selection.$from);if(e.someProp("handlePaste",(t=>t(e,o,i||De.empty))))return!0;if(!i)return!1;let s=function(e){return 0==e.openStart&&0==e.openEnd&&1==e.content.childCount?e.content.firstChild:null}(i),a=s?e.state.tr.replaceSelectionWith(s,r):e.state.tr.replaceSelection(i);return e.dispatch(a.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function xi(e){let t=e.getData("text/plain")||e.getData("Text");if(t)return t;let n=e.getData("text/uri-list");return n?n.replace(/\r?\n/g," "):""}Go.copy=Yo.cut=(e,t)=>{let n=t,r=e.state.selection,o="cut"==n.type;if(r.empty)return;let i=vi?null:n.clipboardData,s=r.content(),{dom:a,text:l}=Bo(e,s);i?(n.preventDefault(),i.clearData(),i.setData("text/html",a.innerHTML),i.setData("text/plain",l)):function(e,t){if(!e.dom.parentNode)return;let n=e.dom.parentNode.appendChild(document.createElement("div"));n.appendChild(t),n.style.cssText="position: fixed; left: -10000px; top: 10px";let r=getSelection(),o=document.createRange();o.selectNodeContents(t),e.dom.blur(),r.removeAllRanges(),r.addRange(o),setTimeout((()=>{n.parentNode&&n.parentNode.removeChild(n),e.focus()}),50)}(e,a),o&&e.dispatch(e.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))},Yo.paste=(e,t)=>{let n=t;if(e.composing&&!vr)return;let r=vi?null:n.clipboardData,o=e.input.shiftKey&&45!=e.input.lastKeyCode;r&&bi(e,xi(r),r.getData("text/html"),o,n)?n.preventDefault():function(e,t){if(!e.dom.parentNode)return;let n=e.input.shiftKey||e.state.selection.$from.parent.type.spec.code,r=e.dom.parentNode.appendChild(document.createElement(n?"textarea":"div"));n||(r.contentEditable="true"),r.style.cssText="position: fixed; left: -10000px; top: 10px",r.focus();let o=e.input.shiftKey&&45!=e.input.lastKeyCode;setTimeout((()=>{e.focus(),r.parentNode&&r.parentNode.removeChild(r),n?bi(e,r.value,null,o,t):bi(e,r.textContent,r.innerHTML,o,t)}),50)}(e,n)};class wi{constructor(e,t,n){this.slice=e,this.move=t,this.node=n}}const ki=gr?"altKey":"ctrlKey";function Ci(e,t){let n=e.someProp("dragCopies",(e=>!e(t)));return null!=n?n:!t[ki]}Go.dragstart=(e,t)=>{let n=t,r=e.input.mouseDown;if(r&&r.done(),!n.dataTransfer)return;let o,i=e.state.selection,s=i.empty?null:e.posAtCoords(ri(n));if(s&&s.pos>=i.from&&s.pos<=(i instanceof On?i.to-1:i.to));else if(r&&r.mightDrag)o=On.create(e.state.doc,r.mightDrag.pos);else if(n.target&&1==n.target.nodeType){let t=e.docView.nearestDesc(n.target,!0);t&&t.node.type.spec.draggable&&t!=e.docView&&(o=On.create(e.state.doc,t.posBefore))}let a=(o||e.state.selection).content(),{dom:l,text:c,slice:d}=Bo(e,a);(!n.dataTransfer.files.length||!ur||pr>120)&&n.dataTransfer.clearData(),n.dataTransfer.setData(vi?"Text":"text/html",l.innerHTML),n.dataTransfer.effectAllowed="copyMove",vi||n.dataTransfer.setData("text/plain",c),e.dragging=new wi(d,Ci(e,n),o)},Go.dragend=e=>{let t=e.dragging;window.setTimeout((()=>{e.dragging==t&&(e.dragging=null)}),50)},Yo.dragover=Yo.dragenter=(e,t)=>t.preventDefault(),Yo.drop=(e,t)=>{let n=t,r=e.dragging;if(e.dragging=null,!n.dataTransfer)return;let o=e.posAtCoords(ri(n));if(!o)return;let i=e.state.doc.resolve(o.pos),s=r&&r.slice;s?e.someProp("transformPasted",(t=>{s=t(s,e)})):s=$o(e,xi(n.dataTransfer),vi?null:n.dataTransfer.getData("text/html"),!1,i);let a=!(!r||!Ci(e,n));if(e.someProp("handleDrop",(t=>t(e,n,s||De.empty,a))))return void n.preventDefault();if(!s)return;n.preventDefault();let l=s?sn(e.state.doc,i.pos,s):i.pos;null==l&&(l=i.pos);let c=e.state.tr;if(a){let{node:e}=r;e?e.replace(c):c.deleteSelection()}let d=c.mapping.map(l),h=0==s.openStart&&0==s.openEnd&&1==s.content.childCount,u=c.doc;if(h?c.replaceRangeWith(d,d,s.content.firstChild):c.replaceRange(d,d,s),c.doc.eq(u))return;let p=c.doc.resolve(d);if(h&&On.isSelectable(s.content.firstChild)&&p.nodeAfter&&p.nodeAfter.sameMarkup(s.content.firstChild))c.setSelection(new On(p));else{let t=c.mapping.map(l);c.mapping.maps[c.mapping.maps.length-1].forEach(((e,n,r,o)=>t=o)),c.setSelection(wo(e,p,c.doc.resolve(t)))}e.focus(),e.dispatch(c.setMeta("uiEvent","drop"))},Go.focus=e=>{e.input.lastFocus=Date.now(),e.focused||(e.domObserver.stop(),e.dom.classList.add("ProseMirror-focused"),e.domObserver.start(),e.focused=!0,setTimeout((()=>{e.docView&&e.hasFocus()&&!e.domObserver.currentSelection.eq(e.domSelectionRange())&&fo(e)}),20))},Go.blur=(e,t)=>{let n=t;e.focused&&(e.domObserver.stop(),e.dom.classList.remove("ProseMirror-focused"),e.domObserver.start(),n.relatedTarget&&e.dom.contains(n.relatedTarget)&&e.domObserver.currentSelection.clear(),e.focused=!1)},Go.beforeinput=(e,t)=>{if(ur&&vr&&"deleteContentBackward"==t.inputType){e.domObserver.flushSoon();let{domChangeCount:t}=e.input;setTimeout((()=>{if(e.input.domChangeCount!=t)return;if(e.dom.blur(),e.focus(),e.someProp("handleKeyDown",(t=>t(e,tr(8,"Backspace")))))return;let{$cursor:n}=e.state.selection;n&&n.pos>0&&e.dispatch(e.state.tr.delete(n.pos-1,n.pos).scrollIntoView())}),50)}};for(let e in Yo)Go[e]=Yo[e];function Ni(e,t){if(e==t)return!0;for(let n in e)if(e[n]!==t[n])return!1;for(let n in t)if(!(n in e))return!1;return!0}class Si{constructor(e,t){this.toDOM=e,this.spec=t||Ai,this.side=this.spec.side||0}map(e,t,n,r){let{pos:o,deleted:i}=e.mapResult(t.from+r,this.side<0?-1:1);return i?null:new Oi(o-n,o-n,this)}valid(){return!0}eq(e){return this==e||e instanceof Si&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&Ni(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class Mi{constructor(e,t){this.attrs=e,this.spec=t||Ai}map(e,t,n,r){let o=e.map(t.from+r,this.spec.inclusiveStart?-1:1)-n,i=e.map(t.to+r,this.spec.inclusiveEnd?1:-1)-n;return o>=i?null:new Oi(o,i,this)}valid(e,t){return t.from<t.to}eq(e){return this==e||e instanceof Mi&&Ni(this.attrs,e.attrs)&&Ni(this.spec,e.spec)}static is(e){return e.type instanceof Mi}destroy(){}}class Ti{constructor(e,t){this.attrs=e,this.spec=t||Ai}map(e,t,n,r){let o=e.mapResult(t.from+r,1);if(o.deleted)return null;let i=e.mapResult(t.to+r,-1);return i.deleted||i.pos<=o.pos?null:new Oi(o.pos-n,i.pos-n,this)}valid(e,t){let n,{index:r,offset:o}=e.content.findIndex(t.from);return o==t.from&&!(n=e.child(r)).isText&&o+n.nodeSize==t.to}eq(e){return this==e||e instanceof Ti&&Ni(this.attrs,e.attrs)&&Ni(this.spec,e.spec)}destroy(){}}class Oi{constructor(e,t,n){this.from=e,this.to=t,this.type=n}copy(e,t){return new Oi(e,t,this.type)}eq(e,t=0){return this.type.eq(e.type)&&this.from+t==e.from&&this.to+t==e.to}map(e,t,n){return this.type.map(e,this,t,n)}static widget(e,t,n){return new Oi(e,e,new Si(t,n))}static inline(e,t,n,r){return new Oi(e,t,new Mi(n,r))}static node(e,t,n,r){return new Oi(e,t,new Ti(n,r))}get spec(){return this.type.spec}get inline(){return this.type instanceof Mi}get widget(){return this.type instanceof Si}}const Ei=[],Ai={};class Di{constructor(e,t){this.local=e.length?e:Ei,this.children=t.length?t:Ei}static create(e,t){return t.length?Bi(t,e,0,Ai):Ri}find(e,t,n){let r=[];return this.findInner(null==e?0:e,null==t?1e9:t,r,0,n),r}findInner(e,t,n,r,o){for(let i=0;i<this.local.length;i++){let s=this.local[i];s.from<=t&&s.to>=e&&(!o||o(s.spec))&&n.push(s.copy(s.from+r,s.to+r))}for(let i=0;i<this.children.length;i+=3)if(this.children[i]<t&&this.children[i+1]>e){let s=this.children[i]+1;this.children[i+2].findInner(e-s,t-s,n,r+s,o)}}map(e,t,n){return this==Ri||0==e.maps.length?this:this.mapInner(e,t,0,0,n||Ai)}mapInner(e,t,n,r,o){let i;for(let s=0;s<this.local.length;s++){let a=this.local[s].map(e,n,r);a&&a.type.valid(t,a)?(i||(i=[])).push(a):o.onRemove&&o.onRemove(this.local[s].spec)}return this.children.length?function(e,t,n,r,o,i,s){let a=e.slice();for(let e=0,t=i;e<n.maps.length;e++){let r=0;n.maps[e].forEach(((e,n,o,i)=>{let s=i-o-(n-e);for(let o=0;o<a.length;o+=3){let i=a[o+1];if(i<0||e>i+t-r)continue;let l=a[o]+t-r;n>=l?a[o+1]=e<=l?-2:-1:e>=t&&s&&(a[o]+=s,a[o+1]+=s)}r+=s})),t=n.maps[e].map(t,-1)}let l=!1;for(let t=0;t<a.length;t+=3)if(a[t+1]<0){if(-2==a[t+1]){l=!0,a[t+1]=-1;continue}let c=n.map(e[t]+i),d=c-o;if(d<0||d>=r.content.size){l=!0;continue}let h=n.map(e[t+1]+i,-1)-o,{index:u,offset:p}=r.content.findIndex(d),f=r.maybeChild(u);if(f&&p==d&&p+f.nodeSize==h){let r=a[t+2].mapInner(n,f,c+1,e[t]+i+1,s);r!=Ri?(a[t]=d,a[t+1]=h,a[t+2]=r):(a[t+1]=-2,l=!0)}else l=!0}if(l){let l=function(e,t,n,r,o,i,s){function a(e,t){for(let i=0;i<e.local.length;i++){let a=e.local[i].map(r,o,t);a?n.push(a):s.onRemove&&s.onRemove(e.local[i].spec)}for(let n=0;n<e.children.length;n+=3)a(e.children[n+2],e.children[n]+t+1)}for(let n=0;n<e.length;n+=3)-1==e[n+1]&&a(e[n+2],t[n]+i+1);return n}(a,e,t,n,o,i,s),c=Bi(l,r,0,s);t=c.local;for(let e=0;e<a.length;e+=3)a[e+1]<0&&(a.splice(e,3),e-=3);for(let e=0,t=0;e<c.children.length;e+=3){let n=c.children[e];for(;t<a.length&&a[t]<n;)t+=3;a.splice(t,0,c.children[e],c.children[e+1],c.children[e+2])}}return new Di(t.sort($i),a)}(this.children,i||[],e,t,n,r,o):i?new Di(i.sort($i),Ei):Ri}add(e,t){return t.length?this==Ri?Di.create(e,t):this.addInner(e,t,0):this}addInner(e,t,n){let r,o=0;e.forEach(((e,i)=>{let s,a=i+n;if(s=zi(t,e,a)){for(r||(r=this.children.slice());o<r.length&&r[o]<i;)o+=3;r[o]==i?r[o+2]=r[o+2].addInner(e,s,a+1):r.splice(o,0,i,i+e.nodeSize,Bi(s,e,a+1,Ai)),o+=3}}));let i=Ii(o?Pi(t):t,-n);for(let t=0;t<i.length;t++)i[t].type.valid(e,i[t])||i.splice(t--,1);return new Di(i.length?this.local.concat(i).sort($i):this.local,r||this.children)}remove(e){return 0==e.length||this==Ri?this:this.removeInner(e,0)}removeInner(e,t){let n=this.children,r=this.local;for(let r=0;r<n.length;r+=3){let o,i=n[r]+t,s=n[r+1]+t;for(let t,n=0;n<e.length;n++)(t=e[n])&&t.from>i&&t.to<s&&(e[n]=null,(o||(o=[])).push(t));if(!o)continue;n==this.children&&(n=this.children.slice());let a=n[r+2].removeInner(o,i+1);a!=Ri?n[r+2]=a:(n.splice(r,3),r-=3)}if(r.length)for(let n,o=0;o<e.length;o++)if(n=e[o])for(let e=0;e<r.length;e++)r[e].eq(n,t)&&(r==this.local&&(r=this.local.slice()),r.splice(e--,1));return n==this.children&&r==this.local?this:r.length||n.length?new Di(r,n):Ri}forChild(e,t){if(this==Ri)return this;if(t.isLeaf)return Di.empty;let n,r;for(let t=0;t<this.children.length;t+=3)if(this.children[t]>=e){this.children[t]==e&&(n=this.children[t+2]);break}let o=e+1,i=o+t.content.size;for(let e=0;e<this.local.length;e++){let t=this.local[e];if(t.from<i&&t.to>o&&t.type instanceof Mi){let e=Math.max(o,t.from)-o,n=Math.min(i,t.to)-o;e<n&&(r||(r=[])).push(t.copy(e,n))}}if(r){let e=new Di(r.sort($i),Ei);return n?new Li([e,n]):e}return n||Ri}eq(e){if(this==e)return!0;if(!(e instanceof Di)||this.local.length!=e.local.length||this.children.length!=e.children.length)return!1;for(let t=0;t<this.local.length;t++)if(!this.local[t].eq(e.local[t]))return!1;for(let t=0;t<this.children.length;t+=3)if(this.children[t]!=e.children[t]||this.children[t+1]!=e.children[t+1]||!this.children[t+2].eq(e.children[t+2]))return!1;return!0}locals(e){return Vi(this.localsInner(e))}localsInner(e){if(this==Ri)return Ei;if(e.inlineContent||!this.local.some(Mi.is))return this.local;let t=[];for(let e=0;e<this.local.length;e++)this.local[e].type instanceof Mi||t.push(this.local[e]);return t}forEachSet(e){e(this)}}Di.empty=new Di([],[]),Di.removeOverlap=Vi;const Ri=Di.empty;class Li{constructor(e){this.members=e}map(e,t){const n=this.members.map((n=>n.map(e,t,Ai)));return Li.from(n)}forChild(e,t){if(t.isLeaf)return Di.empty;let n=[];for(let r=0;r<this.members.length;r++){let o=this.members[r].forChild(e,t);o!=Ri&&(o instanceof Li?n=n.concat(o.members):n.push(o))}return Li.from(n)}eq(e){if(!(e instanceof Li)||e.members.length!=this.members.length)return!1;for(let t=0;t<this.members.length;t++)if(!this.members[t].eq(e.members[t]))return!1;return!0}locals(e){let t,n=!0;for(let r=0;r<this.members.length;r++){let o=this.members[r].localsInner(e);if(o.length)if(t){n&&(t=t.slice(),n=!1);for(let e=0;e<o.length;e++)t.push(o[e])}else t=o}return t?Vi(n?t:t.sort($i)):Ei}static from(e){switch(e.length){case 0:return Ri;case 1:return e[0];default:return new Li(e.every((e=>e instanceof Di))?e:e.reduce(((e,t)=>e.concat(t instanceof Di?t:t.members)),[]))}}forEachSet(e){for(let t=0;t<this.members.length;t++)this.members[t].forEachSet(e)}}function Ii(e,t){if(!t||!e.length)return e;let n=[];for(let r=0;r<e.length;r++){let o=e[r];n.push(new Oi(o.from+t,o.to+t,o.type))}return n}function zi(e,t,n){if(t.isLeaf)return null;let r=n+t.nodeSize,o=null;for(let t,i=0;i<e.length;i++)(t=e[i])&&t.from>n&&t.to<r&&((o||(o=[])).push(t),e[i]=null);return o}function Pi(e){let t=[];for(let n=0;n<e.length;n++)null!=e[n]&&t.push(e[n]);return t}function Bi(e,t,n,r){let o=[],i=!1;t.forEach(((t,s)=>{let a=zi(e,t,s+n);if(a){i=!0;let e=Bi(a,t,n+s+1,r);e!=Ri&&o.push(s,s+t.nodeSize,e)}}));let s=Ii(i?Pi(e):e,-n).sort($i);for(let e=0;e<s.length;e++)s[e].type.valid(t,s[e])||(r.onRemove&&r.onRemove(s[e].spec),s.splice(e--,1));return s.length||o.length?new Di(s,o):Ri}function $i(e,t){return e.from-t.from||e.to-t.to}function Vi(e){let t=e;for(let n=0;n<t.length-1;n++){let r=t[n];if(r.from!=r.to)for(let o=n+1;o<t.length;o++){let i=t[o];if(i.from!=r.from){i.from<r.to&&(t==e&&(t=e.slice()),t[n]=r.copy(r.from,i.from),ji(t,o,r.copy(i.from,r.to)));break}i.to!=r.to&&(t==e&&(t=e.slice()),t[o]=i.copy(i.from,r.to),ji(t,o+1,i.copy(r.to,i.to)))}}return t}function ji(e,t,n){for(;t<e.length&&$i(n,e[t])>0;)t++;e.splice(t,0,n)}function Fi(e){let t=[];return e.someProp("decorations",(n=>{let r=n(e.state);r&&r!=Ri&&t.push(r)})),e.cursorWrapper&&t.push(Di.create(e.state.doc,[e.cursorWrapper.deco])),Li.from(t)}const Hi={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},_i=lr&&cr<=11;class qi{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}set(e){this.anchorNode=e.anchorNode,this.anchorOffset=e.anchorOffset,this.focusNode=e.focusNode,this.focusOffset=e.focusOffset}clear(){this.anchorNode=this.focusNode=null}eq(e){return e.anchorNode==this.anchorNode&&e.anchorOffset==this.anchorOffset&&e.focusNode==this.focusNode&&e.focusOffset==this.focusOffset}}class Wi{constructor(e,t){this.view=e,this.handleDOMChange=t,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new qi,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.lastChangedTextNode=null,this.observer=window.MutationObserver&&new window.MutationObserver((e=>{for(let t=0;t<e.length;t++)this.queue.push(e[t]);lr&&cr<=11&&e.some((e=>"childList"==e.type&&e.removedNodes.length||"characterData"==e.type&&e.oldValue.length>e.target.nodeValue.length))?this.flushSoon():this.flush()})),_i&&(this.onCharData=e=>{this.queue.push({target:e.target,type:"characterData",oldValue:e.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this)}flushSoon(){this.flushingSoon<0&&(this.flushingSoon=window.setTimeout((()=>{this.flushingSoon=-1,this.flush()}),20))}forceFlush(){this.flushingSoon>-1&&(window.clearTimeout(this.flushingSoon),this.flushingSoon=-1,this.flush())}start(){this.observer&&(this.observer.takeRecords(),this.observer.observe(this.view.dom,Hi)),this.onCharData&&this.view.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.connectSelection()}stop(){if(this.observer){let e=this.observer.takeRecords();if(e.length){for(let t=0;t<e.length;t++)this.queue.push(e[t]);window.setTimeout((()=>this.flush()),20)}this.observer.disconnect()}this.onCharData&&this.view.dom.removeEventListener("DOMCharacterDataModified",this.onCharData),this.disconnectSelection()}connectSelection(){this.view.dom.ownerDocument.addEventListener("selectionchange",this.onSelectionChange)}disconnectSelection(){this.view.dom.ownerDocument.removeEventListener("selectionchange",this.onSelectionChange)}suppressSelectionUpdates(){this.suppressingSelectionUpdates=!0,setTimeout((()=>this.suppressingSelectionUpdates=!1),50)}onSelectionChange(){if(ko(this.view)){if(this.suppressingSelectionUpdates)return fo(this.view);if(lr&&cr<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&Gn(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset))return this.flushSoon()}this.flush()}}setCurSelection(){this.currentSelection.set(this.view.domSelectionRange())}ignoreSelectionChange(e){if(!e.focusNode)return!0;let t,n=new Set;for(let t=e.focusNode;t;t=Kn(t))n.add(t);for(let r=e.anchorNode;r;r=Kn(r))if(n.has(r)){t=r;break}let r=t&&this.view.docView.nearestDesc(t);return r&&r.ignoreMutation({type:"selection",target:3==t.nodeType?t.parentNode:t})?(this.setCurSelection(),!0):void 0}pendingRecords(){if(this.observer)for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}flush(){let{view:e}=this;if(!e.docView||this.flushingSoon>-1)return;let t=this.pendingRecords();t.length&&(this.queue=[]);let n=e.domSelectionRange(),r=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(n)&&ko(e)&&!this.ignoreSelectionChange(n),o=-1,i=-1,s=!1,a=[];if(e.editable)for(let e=0;e<t.length;e++){let n=this.registerMutation(t[e],a);n&&(o=o<0?n.from:Math.min(n.from,o),i=i<0?n.to:Math.max(n.to,i),n.typeOver&&(s=!0))}if(dr&&a.length){let t=a.filter((e=>"BR"==e.nodeName));if(2==t.length){let[e,n]=t;e.parentNode&&e.parentNode.parentNode==n.parentNode?n.remove():e.remove()}else{let{focusNode:n}=this.currentSelection;for(let r of t){let t=r.parentNode;!t||"LI"!=t.nodeName||n&&Gi(e,n)==t||r.remove()}}}let l=null;o<0&&r&&e.input.lastFocus>Date.now()-200&&Math.max(e.input.lastTouch,e.input.lastClick.time)<Date.now()-300&&er(n)&&(l=uo(e))&&l.eq(kn.near(e.state.doc.resolve(0),1))?(e.input.lastFocus=0,fo(e),this.currentSelection.set(n),e.scrollToSelection()):(o>-1||r)&&(o>-1&&(e.docView.markDirty(o,i),function(e){if(Ki.has(e))return;if(Ki.set(e,null),-1!==["normal","nowrap","pre-line"].indexOf(getComputedStyle(e.dom).whiteSpace)){if(e.requiresGeckoHackNode=dr,Ji)return;console.warn("ProseMirror expects the CSS white-space property to be set, preferably to 'pre-wrap'. It is recommended to load style/prosemirror.css from the prosemirror-view package."),Ji=!0}}(e)),this.handleDOMChange(o,i,s,a),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(n)||fo(e),this.currentSelection.set(n))}registerMutation(e,t){if(t.indexOf(e.target)>-1)return null;let n=this.view.docView.nearestDesc(e.target);if("attributes"==e.type&&(n==this.view.docView||"contenteditable"==e.attributeName||"style"==e.attributeName&&!e.oldValue&&!e.target.getAttribute("style")))return null;if(!n||n.ignoreMutation(e))return null;if("childList"==e.type){for(let n=0;n<e.addedNodes.length;n++){let r=e.addedNodes[n];t.push(r),3==r.nodeType&&(this.lastChangedTextNode=r)}if(n.contentDOM&&n.contentDOM!=n.dom&&!n.contentDOM.contains(e.target))return{from:n.posBefore,to:n.posAfter};let r=e.previousSibling,o=e.nextSibling;if(lr&&cr<=11&&e.addedNodes.length)for(let t=0;t<e.addedNodes.length;t++){let{previousSibling:n,nextSibling:i}=e.addedNodes[t];(!n||Array.prototype.indexOf.call(e.addedNodes,n)<0)&&(r=n),(!i||Array.prototype.indexOf.call(e.addedNodes,i)<0)&&(o=i)}let i=r&&r.parentNode==e.target?Wn(r)+1:0,s=n.localPosFromDOM(e.target,i,-1),a=o&&o.parentNode==e.target?Wn(o):e.target.childNodes.length;return{from:s,to:n.localPosFromDOM(e.target,a,1)}}return"attributes"==e.type?{from:n.posAtStart-n.border,to:n.posAtEnd+n.border}:(this.lastChangedTextNode=e.target,{from:n.posAtStart,to:n.posAtEnd,typeOver:e.target.nodeValue==e.oldValue})}}let Ki=new WeakMap,Ji=!1;function Ui(e,t){let n=t.startContainer,r=t.startOffset,o=t.endContainer,i=t.endOffset,s=e.domAtPos(e.state.selection.anchor);return Gn(s.node,s.offset,o,i)&&([n,r,o,i]=[o,i,n,r]),{anchorNode:n,anchorOffset:r,focusNode:o,focusOffset:i}}function Gi(e,t){for(let n=t.parentNode;n&&n!=e.dom;n=n.parentNode){let t=e.docView.nearestDesc(n,!0);if(t&&t.node.isBlock)return n}return null}function Yi(e){let t=e.pmViewDesc;if(t)return t.parseRule();if("BR"==e.nodeName&&e.parentNode){if(fr&&/^(ul|ol)$/i.test(e.parentNode.nodeName)){let e=document.createElement("div");return e.appendChild(document.createElement("li")),{skip:e}}if(e.parentNode.lastChild==e||fr&&/^(tr|table)$/i.test(e.parentNode.nodeName))return{ignore:!0}}else if("IMG"==e.nodeName&&e.getAttribute("mark-placeholder"))return{ignore:!0};return null}const Xi=/^(a|abbr|acronym|b|bd[io]|big|br|button|cite|code|data(list)?|del|dfn|em|i|img|ins|kbd|label|map|mark|meter|output|q|ruby|s|samp|small|span|strong|su[bp]|time|u|tt|var)$/i;function Qi(e,t,n,r,o){let i=e.input.compositionPendingChanges||(e.composing?e.input.compositionID:0);if(e.input.compositionPendingChanges=0,t<0){let t=e.input.lastSelectionTime>Date.now()-50?e.input.lastSelectionOrigin:null,n=uo(e,t);if(n&&!e.state.selection.eq(n)){if(ur&&vr&&13===e.input.lastKeyCode&&Date.now()-100<e.input.lastKeyCodeTime&&e.someProp("handleKeyDown",(t=>t(e,tr(13,"Enter")))))return;let r=e.state.tr.setSelection(n);"pointer"==t?r.setMeta("pointer",!0):"key"==t&&r.scrollIntoView(),i&&r.setMeta("composition",i),e.dispatch(r)}return}let s=e.state.doc.resolve(t),a=s.sharedDepth(n);t=s.before(a+1),n=e.state.doc.resolve(n).after(a+1);let l,c,d=e.state.selection,h=function(e,t,n){let r,{node:o,fromOffset:i,toOffset:s,from:a,to:l}=e.docView.parseRange(t,n),c=e.domSelectionRange(),d=c.anchorNode;if(d&&e.dom.contains(1==d.nodeType?d:d.parentNode)&&(r=[{node:d,offset:c.anchorOffset}],er(c)||r.push({node:c.focusNode,offset:c.focusOffset})),ur&&8===e.input.lastKeyCode)for(let e=s;e>i;e--){let t=o.childNodes[e-1],n=t.pmViewDesc;if("BR"==t.nodeName&&!n){s=e;break}if(!n||n.size)break}let h=e.state.doc,u=e.someProp("domParser")||gt.fromSchema(e.state.schema),p=h.resolve(a),f=null,m=u.parse(o,{topNode:p.parent,topMatch:p.parent.contentMatchAt(p.index()),topOpen:!0,from:i,to:s,preserveWhitespace:"pre"!=p.parent.type.whitespace||"full",findPositions:r,ruleFromNode:Yi,context:p});if(r&&null!=r[0].pos){let e=r[0].pos,t=r[1]&&r[1].pos;null==t&&(t=e),f={anchor:e+a,head:t+a}}return{doc:m,sel:f,from:a,to:l}}(e,t,n),u=e.state.doc,p=u.slice(h.from,h.to);8===e.input.lastKeyCode&&Date.now()-100<e.input.lastKeyCodeTime?(l=e.state.selection.to,c="end"):(l=e.state.selection.from,c="start"),e.input.lastKeyCode=null;let f=function(e,t,n,r,o){let i=e.findDiffStart(t,n);if(null==i)return null;let{a:s,b:a}=e.findDiffEnd(t,n+e.size,n+t.size);if("end"==o){r-=s+Math.max(0,i-Math.min(s,a))-i}if(s<i&&e.size<t.size){let e=r<=i&&r>=s?i-r:0;i-=e,i&&i<t.size&&ts(t.textBetween(i-1,i+1))&&(i+=e?1:-1),a=i+(a-s),s=i}else if(a<i){let t=r<=i&&r>=a?i-r:0;i-=t,i&&i<e.size&&ts(e.textBetween(i-1,i+1))&&(i+=t?1:-1),s=i+(s-a),a=i}return{start:i,endA:s,endB:a}}(p.content,h.doc.content,h.from,l,c);if(f&&e.input.domChangeCount++,(mr&&e.input.lastIOSEnter>Date.now()-225||vr)&&o.some((e=>1==e.nodeType&&!Xi.test(e.nodeName)))&&(!f||f.endA>=f.endB)&&e.someProp("handleKeyDown",(t=>t(e,tr(13,"Enter")))))return void(e.input.lastIOSEnter=0);if(!f){if(!(r&&d instanceof Mn&&!d.empty&&d.$head.sameParent(d.$anchor))||e.composing||h.sel&&h.sel.anchor!=h.sel.head){if(h.sel){let t=Zi(e,e.state.doc,h.sel);if(t&&!t.eq(e.state.selection)){let n=e.state.tr.setSelection(t);i&&n.setMeta("composition",i),e.dispatch(n)}}return}f={start:d.from,endA:d.to,endB:d.to}}e.state.selection.from<e.state.selection.to&&f.start==f.endB&&e.state.selection instanceof Mn&&(f.start>e.state.selection.from&&f.start<=e.state.selection.from+2&&e.state.selection.from>=h.from?f.start=e.state.selection.from:f.endA<e.state.selection.to&&f.endA>=e.state.selection.to-2&&e.state.selection.to<=h.to&&(f.endB+=e.state.selection.to-f.endA,f.endA=e.state.selection.to)),lr&&cr<=11&&f.endB==f.start+1&&f.endA==f.start&&f.start>h.from&&"  "==h.doc.textBetween(f.start-h.from-1,f.start-h.from+1)&&(f.start--,f.endA--,f.endB--);let m,g=h.doc.resolveNoCache(f.start-h.from),y=h.doc.resolveNoCache(f.endB-h.from),v=u.resolve(f.start),b=g.sameParent(y)&&g.parent.inlineContent&&v.end()>=f.endA;if((mr&&e.input.lastIOSEnter>Date.now()-225&&(!b||o.some((e=>"DIV"==e.nodeName||"P"==e.nodeName)))||!b&&g.pos<h.doc.content.size&&(!g.sameParent(y)||!g.parent.inlineContent)&&!/\S/.test(h.doc.textBetween(g.pos,y.pos,"",""))&&(m=kn.findFrom(h.doc.resolve(g.pos+1),1,!0))&&m.head>g.pos)&&e.someProp("handleKeyDown",(t=>t(e,tr(13,"Enter")))))return void(e.input.lastIOSEnter=0);if(e.state.selection.anchor>f.start&&function(e,t,n,r,o){if(n-t<=o.pos-r.pos||es(r,!0,!1)<o.pos)return!1;let i=e.resolve(t);if(!r.parent.isTextblock){let e=i.nodeAfter;return null!=e&&n==t+e.nodeSize}if(i.parentOffset<i.parent.content.size||!i.parent.isTextblock)return!1;let s=e.resolve(es(i,!0,!0));return!(!s.parent.isTextblock||s.pos>n||es(s,!0,!1)<n)&&r.parent.content.cut(r.parentOffset).eq(s.parent.content)}(u,f.start,f.endA,g,y)&&e.someProp("handleKeyDown",(t=>t(e,tr(8,"Backspace")))))return void(vr&&ur&&e.domObserver.suppressSelectionUpdates());ur&&f.endB==f.start&&(e.input.lastChromeDelete=Date.now()),vr&&!b&&g.start()!=y.start()&&0==y.parentOffset&&g.depth==y.depth&&h.sel&&h.sel.anchor==h.sel.head&&h.sel.head==f.endA&&(f.endB-=2,y=h.doc.resolveNoCache(f.endB-h.from),setTimeout((()=>{e.someProp("handleKeyDown",(function(t){return t(e,tr(13,"Enter"))}))}),20));let x,w=f.start,k=f.endA,C=t=>{let n=t||e.state.tr.replace(w,k,h.doc.slice(f.start-h.from,f.endB-h.from));if(h.sel){let t=Zi(e,n.doc,h.sel);t&&!(ur&&e.composing&&t.empty&&(f.start!=f.endB||e.input.lastChromeDelete<Date.now()-100)&&(t.head==w||t.head==n.mapping.map(k)-1)||lr&&t.empty&&t.head==w)&&n.setSelection(t)}return i&&n.setMeta("composition",i),n.scrollIntoView()};if(b){if(g.pos==y.pos){lr&&cr<=11&&0==g.parentOffset&&(e.domObserver.suppressSelectionUpdates(),setTimeout((()=>fo(e)),20));let t=C(e.state.tr.delete(w,k)),n=u.resolve(f.start).marksAcross(u.resolve(f.endA));n&&t.ensureMarks(n),e.dispatch(t)}else if(f.endA==f.endB&&(x=function(e,t){let n,r,o,i=e.firstChild.marks,s=t.firstChild.marks,a=i,l=s;for(let e=0;e<s.length;e++)a=s[e].removeFromSet(a);for(let e=0;e<i.length;e++)l=i[e].removeFromSet(l);if(1==a.length&&0==l.length)r=a[0],n="add",o=e=>e.mark(r.addToSet(e.marks));else{if(0!=a.length||1!=l.length)return null;r=l[0],n="remove",o=e=>e.mark(r.removeFromSet(e.marks))}let c=[];for(let e=0;e<t.childCount;e++)c.push(o(t.child(e)));if(Se.from(c).eq(e))return{mark:r,type:n}}(g.parent.content.cut(g.parentOffset,y.parentOffset),v.parent.content.cut(v.parentOffset,f.endA-v.start())))){let t=C(e.state.tr);"add"==x.type?t.addMark(w,k,x.mark):t.removeMark(w,k,x.mark),e.dispatch(t)}else if(g.parent.child(g.index()).isText&&g.index()==y.index()-(y.textOffset?0:1)){let t=g.parent.textBetween(g.parentOffset,y.parentOffset),n=()=>C(e.state.tr.insertText(t,w,k));e.someProp("handleTextInput",(r=>r(e,w,k,t,n)))||e.dispatch(n())}}else e.dispatch(C())}function Zi(e,t,n){return Math.max(n.anchor,n.head)>t.content.size?null:wo(e,t.resolve(n.anchor),t.resolve(n.head))}function es(e,t,n){let r=e.depth,o=t?e.end():e.pos;for(;r>0&&(t||e.indexAfter(r)==e.node(r).childCount);)r--,o++,t=!1;if(n){let t=e.node(r).maybeChild(e.indexAfter(r));for(;t&&!t.isLeaf;)t=t.firstChild,o++}return o}function ts(e){if(2!=e.length)return!1;let t=e.charCodeAt(0),n=e.charCodeAt(1);return t>=56320&&t<=57343&&n>=55296&&n<=56319}class ns{constructor(e,t){this._root=null,this.focused=!1,this.trackWrites=null,this.mounted=!1,this.markCursor=null,this.cursorWrapper=null,this.lastSelectedViewDesc=void 0,this.input=new Qo,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=t,this.state=t.state,this.directPlugins=t.plugins||[],this.directPlugins.forEach(ls),this.dispatch=this.dispatch.bind(this),this.dom=e&&e.mount||document.createElement("div"),e&&(e.appendChild?e.appendChild(this.dom):"function"==typeof e?e(this.dom):e.mount&&(this.mounted=!0)),this.editable=ss(this),is(this),this.nodeViews=as(this),this.docView=Gr(this.state.doc,rs(this),Fi(this),this.dom,this),this.domObserver=new Wi(this,((e,t,n,r)=>Qi(this,e,t,n,r))),this.domObserver.start(),function(e){for(let t in Go){let n=Go[t];e.dom.addEventListener(t,e.input.eventHandlers[t]=t=>{!ni(e,t)||ti(e,t)||!e.editable&&t.type in Yo||n(e,t)},Xo[t]?{passive:!0}:void 0)}fr&&e.dom.addEventListener("input",(()=>null)),ei(e)}(this),this.updatePluginViews()}get composing(){return this.input.composing}get props(){if(this._props.state!=this.state){let e=this._props;this._props={};for(let t in e)this._props[t]=e[t];this._props.state=this.state}return this._props}update(e){e.handleDOMEvents!=this._props.handleDOMEvents&&ei(this);let t=this._props;this._props=e,e.plugins&&(e.plugins.forEach(ls),this.directPlugins=e.plugins),this.updateStateInner(e.state,t)}setProps(e){let t={};for(let e in this._props)t[e]=this._props[e];t.state=this.state;for(let n in e)t[n]=e[n];this.update(t)}updateState(e){this.updateStateInner(e,this._props)}updateStateInner(e,t){var n;let r=this.state,o=!1,i=!1;e.storedMarks&&this.composing&&(mi(this),i=!0),this.state=e;let s=r.plugins!=e.plugins||this._props.plugins!=t.plugins;if(s||this._props.plugins!=t.plugins||this._props.nodeViews!=t.nodeViews){let e=as(this);(function(e,t){let n=0,r=0;for(let r in e){if(e[r]!=t[r])return!0;n++}for(let e in t)r++;return n!=r})(e,this.nodeViews)&&(this.nodeViews=e,o=!0)}(s||t.handleDOMEvents!=this._props.handleDOMEvents)&&ei(this),this.editable=ss(this),is(this);let a=Fi(this),l=rs(this),c=r.plugins==e.plugins||r.doc.eq(e.doc)?e.scrollToSelection>r.scrollToSelection?"to selection":"preserve":"reset",d=o||!this.docView.matchesNode(e.doc,l,a);!d&&e.selection.eq(r.selection)||(i=!0);let h="preserve"==c&&i&&null==this.dom.style.overflowAnchor&&function(e){let t,n,r=e.dom.getBoundingClientRect(),o=Math.max(0,r.top);for(let i=(r.left+r.right)/2,s=o+1;s<Math.min(innerHeight,r.bottom);s+=5){let r=e.root.elementFromPoint(i,s);if(!r||r==e.dom||!e.dom.contains(r))continue;let a=r.getBoundingClientRect();if(a.top>=o-20){t=r,n=a.top;break}}return{refDOM:t,refTop:n,stack:Sr(e.dom)}}(this);if(i){this.domObserver.stop();let t=d&&(lr||ur)&&!this.composing&&!r.selection.empty&&!e.selection.empty&&function(e,t){let n=Math.min(e.$anchor.sharedDepth(e.head),t.$anchor.sharedDepth(t.head));return e.$anchor.start(n)!=t.$anchor.start(n)}(r.selection,e.selection);if(d){let n=ur?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=gi(this)),!o&&this.docView.update(e.doc,l,a,this)||(this.docView.updateOuterDeco(l),this.docView.destroy(),this.docView=Gr(e.doc,l,a,this.dom,this)),n&&!this.trackWrites&&(t=!0)}t||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&function(e){let t=e.docView.domFromPos(e.state.selection.anchor,0),n=e.domSelectionRange();return Gn(t.node,t.offset,n.anchorNode,n.anchorOffset)}(this))?fo(this,t):(bo(this,e.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(r),(null===(n=this.dragging)||void 0===n?void 0:n.node)&&!r.doc.eq(e.doc)&&this.updateDraggedNode(this.dragging,r),"reset"==c?this.dom.scrollTop=0:"to selection"==c?this.scrollToSelection():h&&function({refDOM:e,refTop:t,stack:n}){let r=e?e.getBoundingClientRect().top:0;Mr(n,0==r?0:r-t)}(h)}scrollToSelection(){let e=this.domSelectionRange().focusNode;if(e&&this.dom.contains(1==e.nodeType?e:e.parentNode))if(this.someProp("handleScrollToSelection",(e=>e(this))));else if(this.state.selection instanceof On){let t=this.docView.domAfterPos(this.state.selection.from);1==t.nodeType&&Nr(this,t.getBoundingClientRect(),e)}else Nr(this,this.coordsAtPos(this.state.selection.head,1),e);else;}destroyPluginViews(){let e;for(;e=this.pluginViews.pop();)e.destroy&&e.destroy()}updatePluginViews(e){if(e&&e.plugins==this.state.plugins&&this.directPlugins==this.prevDirectPlugins)for(let t=0;t<this.pluginViews.length;t++){let n=this.pluginViews[t];n.update&&n.update(this,e)}else{this.prevDirectPlugins=this.directPlugins,this.destroyPluginViews();for(let e=0;e<this.directPlugins.length;e++){let t=this.directPlugins[e];t.spec.view&&this.pluginViews.push(t.spec.view(this))}for(let e=0;e<this.state.plugins.length;e++){let t=this.state.plugins[e];t.spec.view&&this.pluginViews.push(t.spec.view(this))}}}updateDraggedNode(e,t){let n=e.node,r=-1;if(this.state.doc.nodeAt(n.from)==n.node)r=n.from;else{let e=n.from+(this.state.doc.content.size-t.doc.content.size);(e>0&&this.state.doc.nodeAt(e))==n.node&&(r=e)}this.dragging=new wi(e.slice,e.move,r<0?void 0:On.create(this.state.doc,r))}someProp(e,t){let n,r=this._props&&this._props[e];if(null!=r&&(n=t?t(r):r))return n;for(let r=0;r<this.directPlugins.length;r++){let o=this.directPlugins[r].props[e];if(null!=o&&(n=t?t(o):o))return n}let o=this.state.plugins;if(o)for(let r=0;r<o.length;r++){let i=o[r].props[e];if(null!=i&&(n=t?t(i):i))return n}}hasFocus(){if(lr){let e=this.root.activeElement;if(e==this.dom)return!0;if(!e||!this.dom.contains(e))return!1;for(;e&&this.dom!=e&&this.dom.contains(e);){if("false"==e.contentEditable)return!1;e=e.parentElement}return!0}return this.root.activeElement==this.dom}focus(){this.domObserver.stop(),this.editable&&function(e){if(e.setActive)return e.setActive();if(Tr)return e.focus(Tr);let t=Sr(e);e.focus(null==Tr?{get preventScroll(){return Tr={preventScroll:!0},!0}}:void 0),Tr||(Tr=!1,Mr(t,0))}(this.dom),fo(this),this.domObserver.start()}get root(){let e=this._root;if(null==e)for(let e=this.dom.parentNode;e;e=e.parentNode)if(9==e.nodeType||11==e.nodeType&&e.host)return e.getSelection||(Object.getPrototypeOf(e).getSelection=()=>e.ownerDocument.getSelection()),this._root=e;return e||document}updateRoot(){this._root=null}posAtCoords(e){return Dr(this,e)}coordsAtPos(e,t=1){return zr(this,e,t)}domAtPos(e,t=0){return this.docView.domFromPos(e,t)}nodeDOM(e){let t=this.docView.descAt(e);return t?t.nodeDOM:null}posAtDOM(e,t,n=-1){let r=this.docView.posFromDOM(e,t,n);if(null==r)throw new RangeError("DOM position not inside the editor");return r}endOfTextblock(e,t){return _r(this,t||this.state,e)}pasteHTML(e,t){return bi(this,"",e,!1,t||new ClipboardEvent("paste"))}pasteText(e,t){return bi(this,e,null,!0,t||new ClipboardEvent("paste"))}serializeForClipboard(e){return Bo(this,e)}destroy(){this.docView&&(!function(e){e.domObserver.stop();for(let t in e.input.eventHandlers)e.dom.removeEventListener(t,e.input.eventHandlers[t]);clearTimeout(e.input.composingTimeout),clearTimeout(e.input.lastIOSEnterFallbackTimeout)}(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],Fi(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,Jn=null)}get isDestroyed(){return null==this.docView}dispatchEvent(e){return function(e,t){ti(e,t)||!Go[t.type]||!e.editable&&t.type in Yo||Go[t.type](e,t)}(this,e)}domSelectionRange(){let e=this.domSelection();return e?fr&&11===this.root.nodeType&&function(e){let t=e.activeElement;for(;t&&t.shadowRoot;)t=t.shadowRoot.activeElement;return t}(this.dom.ownerDocument)==this.dom&&function(e,t){if(t.getComposedRanges){let n=t.getComposedRanges(e.root)[0];if(n)return Ui(e,n)}let n;function r(e){e.preventDefault(),e.stopImmediatePropagation(),n=e.getTargetRanges()[0]}return e.dom.addEventListener("beforeinput",r,!0),document.execCommand("indent"),e.dom.removeEventListener("beforeinput",r,!0),n?Ui(e,n):null}(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}function rs(e){let t=Object.create(null);return t.class="ProseMirror",t.contenteditable=String(e.editable),e.someProp("attributes",(n=>{if("function"==typeof n&&(n=n(e.state)),n)for(let e in n)"class"==e?t.class+=" "+n[e]:"style"==e?t.style=(t.style?t.style+";":"")+n[e]:t[e]||"contenteditable"==e||"nodeName"==e||(t[e]=String(n[e]))})),t.translate||(t.translate="no"),[Oi.node(0,e.state.doc.content.size,t)]}function is(e){if(e.markCursor){let t=document.createElement("img");t.className="ProseMirror-separator",t.setAttribute("mark-placeholder","true"),t.setAttribute("alt",""),e.cursorWrapper={dom:t,deco:Oi.widget(e.state.selection.from,t,{raw:!0,marks:e.markCursor})}}else e.cursorWrapper=null}function ss(e){return!e.someProp("editable",(t=>!1===t(e.state)))}function as(e){let t=Object.create(null);function n(e){for(let n in e)Object.prototype.hasOwnProperty.call(t,n)||(t[n]=e[n])}return e.someProp("nodeViews",n),e.someProp("markViews",n),t}function ls(e){if(e.spec.state||e.spec.filterTransaction||e.spec.appendTransaction)throw new RangeError("Plugins passed directly to the view must not have a state component")}ns.prototype.dispatch=function(e){let t=this._props.dispatchTransaction;t?t.call(this,e):this.updateState(this.state.apply(e))};for(var cs={8:"Backspace",9:"Tab",10:"Enter",12:"NumLock",13:"Enter",16:"Shift",17:"Control",18:"Alt",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",44:"PrintScreen",45:"Insert",46:"Delete",59:";",61:"=",91:"Meta",92:"Meta",106:"*",107:"+",108:",",109:"-",110:".",111:"/",144:"NumLock",145:"ScrollLock",160:"Shift",161:"Shift",162:"Control",163:"Control",164:"Alt",165:"Alt",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},ds={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},hs="undefined"!=typeof navigator&&/Mac/.test(navigator.platform),us="undefined"!=typeof navigator&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),ps=0;ps<10;ps++)cs[48+ps]=cs[96+ps]=String(ps);for(ps=1;ps<=24;ps++)cs[ps+111]="F"+ps;for(ps=65;ps<=90;ps++)cs[ps]=String.fromCharCode(ps+32),ds[ps]=String.fromCharCode(ps);for(var fs in cs)ds.hasOwnProperty(fs)||(ds[fs]=cs[fs]);const ms="undefined"!=typeof navigator&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),gs="undefined"!=typeof navigator&&/Win/.test(navigator.platform);function ys(e){let t,n,r,o,i=e.split(/-(?!$)/),s=i[i.length-1];"Space"==s&&(s=" ");for(let e=0;e<i.length-1;e++){let s=i[e];if(/^(cmd|meta|m)$/i.test(s))o=!0;else if(/^a(lt)?$/i.test(s))t=!0;else if(/^(c|ctrl|control)$/i.test(s))n=!0;else if(/^s(hift)?$/i.test(s))r=!0;else{if(!/^mod$/i.test(s))throw new Error("Unrecognized modifier name: "+s);ms?o=!0:n=!0}}return t&&(s="Alt-"+s),n&&(s="Ctrl-"+s),o&&(s="Meta-"+s),r&&(s="Shift-"+s),s}function vs(e,t,n=!0){return t.altKey&&(e="Alt-"+e),t.ctrlKey&&(e="Ctrl-"+e),t.metaKey&&(e="Meta-"+e),n&&t.shiftKey&&(e="Shift-"+e),e}function bs(e){let t=function(e){let t=Object.create(null);for(let n in e)t[ys(n)]=e[n];return t}(e);return function(e,n){let r,o=function(e){var t=!(hs&&e.metaKey&&e.shiftKey&&!e.ctrlKey&&!e.altKey||us&&e.shiftKey&&e.key&&1==e.key.length||"Unidentified"==e.key)&&e.key||(e.shiftKey?ds:cs)[e.keyCode]||e.key||"Unidentified";return"Esc"==t&&(t="Escape"),"Del"==t&&(t="Delete"),"Left"==t&&(t="ArrowLeft"),"Up"==t&&(t="ArrowUp"),"Right"==t&&(t="ArrowRight"),"Down"==t&&(t="ArrowDown"),t}(n),i=t[vs(o,n)];if(i&&i(e.state,e.dispatch,e))return!0;if(1==o.length&&" "!=o){if(n.shiftKey){let r=t[vs(o,n,!1)];if(r&&r(e.state,e.dispatch,e))return!0}if((n.altKey||n.metaKey||n.ctrlKey)&&!(gs&&n.ctrlKey&&n.altKey)&&(r=cs[n.keyCode])&&r!=o){let o=t[vs(r,n)];if(o&&o(e.state,e.dispatch,e))return!0}}return!1}}const xs=(e,t)=>!e.selection.empty&&(t&&t(e.tr.deleteSelection().scrollIntoView()),!0);function ws(e,t){let{$cursor:n}=e.selection;return!n||(t?!t.endOfTextblock("backward",e):n.parentOffset>0)?null:n}const ks=(e,t,n)=>{let r=ws(e,n);if(!r)return!1;let o=Ms(r);if(!o){let n=r.blockRange(),o=n&&Yt(n);return null!=o&&(t&&t(e.tr.lift(n,o).scrollIntoView()),!0)}let i=o.nodeBefore;if(Ps(e,o,t,-1))return!0;if(0==r.parent.content.size&&(Ns(i,"end")||On.isSelectable(i)))for(let n=r.depth;;n--){let s=an(e.doc,r.before(n),r.after(n),De.empty);if(s&&s.slice.size<s.to-s.from){if(t){let n=e.tr.step(s);n.setSelection(Ns(i,"end")?kn.findFrom(n.doc.resolve(n.mapping.map(o.pos,-1)),-1):On.create(n.doc,o.pos-i.nodeSize)),t(n.scrollIntoView())}return!0}if(1==n||r.node(n-1).childCount>1)break}return!(!i.isAtom||o.depth!=r.depth-1)&&(t&&t(e.tr.delete(o.pos-i.nodeSize,o.pos).scrollIntoView()),!0)};function Cs(e,t,n){let r=t.nodeBefore,o=t.pos-1;for(;!r.isTextblock;o--){if(r.type.spec.isolating)return!1;let e=r.lastChild;if(!e)return!1;r=e}let i=t.nodeAfter,s=t.pos+1;for(;!i.isTextblock;s++){if(i.type.spec.isolating)return!1;let e=i.firstChild;if(!e)return!1;i=e}let a=an(e.doc,o,s,De.empty);if(!a||a.from!=o||a instanceof Wt&&a.slice.size>=s-o)return!1;if(n){let t=e.tr.step(a);t.setSelection(Mn.create(t.doc,o)),n(t.scrollIntoView())}return!0}function Ns(e,t,n=!1){for(let r=e;r;r="start"==t?r.firstChild:r.lastChild){if(r.isTextblock)return!0;if(n&&1!=r.childCount)return!1}return!1}const Ss=(e,t,n)=>{let{$head:r,empty:o}=e.selection,i=r;if(!o)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("backward",e):r.parentOffset>0)return!1;i=Ms(r)}let s=i&&i.nodeBefore;return!(!s||!On.isSelectable(s))&&(t&&t(e.tr.setSelection(On.create(e.doc,i.pos-s.nodeSize)).scrollIntoView()),!0)};function Ms(e){if(!e.parent.type.spec.isolating)for(let t=e.depth-1;t>=0;t--){if(e.index(t)>0)return e.doc.resolve(e.before(t+1));if(e.node(t).type.spec.isolating)break}return null}function Ts(e,t){let{$cursor:n}=e.selection;return!n||(t?!t.endOfTextblock("forward",e):n.parentOffset<n.parent.content.size)?null:n}const Os=(e,t,n)=>{let r=Ts(e,n);if(!r)return!1;let o=As(r);if(!o)return!1;let i=o.nodeAfter;if(Ps(e,o,t,1))return!0;if(0==r.parent.content.size&&(Ns(i,"start")||On.isSelectable(i))){let n=an(e.doc,r.before(),r.after(),De.empty);if(n&&n.slice.size<n.to-n.from){if(t){let r=e.tr.step(n);r.setSelection(Ns(i,"start")?kn.findFrom(r.doc.resolve(r.mapping.map(o.pos)),1):On.create(r.doc,r.mapping.map(o.pos))),t(r.scrollIntoView())}return!0}}return!(!i.isAtom||o.depth!=r.depth-1)&&(t&&t(e.tr.delete(o.pos,o.pos+i.nodeSize).scrollIntoView()),!0)},Es=(e,t,n)=>{let{$head:r,empty:o}=e.selection,i=r;if(!o)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("forward",e):r.parentOffset<r.parent.content.size)return!1;i=As(r)}let s=i&&i.nodeAfter;return!(!s||!On.isSelectable(s))&&(t&&t(e.tr.setSelection(On.create(e.doc,i.pos)).scrollIntoView()),!0)};function As(e){if(!e.parent.type.spec.isolating)for(let t=e.depth-1;t>=0;t--){let n=e.node(t);if(e.index(t)+1<n.childCount)return e.doc.resolve(e.after(t+1));if(n.type.spec.isolating)break}return null}const Ds=(e,t)=>{let{$head:n,$anchor:r}=e.selection;return!(!n.parent.type.spec.code||!n.sameParent(r))&&(t&&t(e.tr.insertText("\n").scrollIntoView()),!0)};function Rs(e){for(let t=0;t<e.edgeCount;t++){let{type:n}=e.edge(t);if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}const Ls=(e,t)=>{let n=e.selection,{$from:r,$to:o}=n;if(n instanceof An||r.parent.inlineContent||o.parent.inlineContent)return!1;let i=Rs(o.parent.contentMatchAt(o.indexAfter()));if(!i||!i.isTextblock)return!1;if(t){let n=(!r.parentOffset&&o.index()<o.parent.childCount?r:o).pos,s=e.tr.insert(n,i.createAndFill());s.setSelection(Mn.create(s.doc,n+1)),t(s.scrollIntoView())}return!0},Is=(e,t)=>{let{$cursor:n}=e.selection;if(!n||n.parent.content.size)return!1;if(n.depth>1&&n.after()!=n.end(-1)){let r=n.before();if(tn(e.doc,r))return t&&t(e.tr.split(r).scrollIntoView()),!0}let r=n.blockRange(),o=r&&Yt(r);return null!=o&&(t&&t(e.tr.lift(r,o).scrollIntoView()),!0)};const zs=(e,t)=>{let{$from:n,$to:r}=e.selection;if(e.selection instanceof On&&e.selection.node.isBlock)return!(!n.parentOffset||!tn(e.doc,n.pos)||(t&&t(e.tr.split(n.pos).scrollIntoView()),0));if(!n.depth)return!1;let o,i,s=[],a=!1,l=!1;for(let e=n.depth;;e--){if(n.node(e).isBlock){a=n.end(e)==n.pos+(n.depth-e),l=n.start(e)==n.pos-(n.depth-e),i=Rs(n.node(e-1).contentMatchAt(n.indexAfter(e-1))),s.unshift(a&&i?{type:i}:null),o=e;break}if(1==e)return!1;s.unshift(null)}let c=e.tr;(e.selection instanceof Mn||e.selection instanceof An)&&c.deleteSelection();let d=c.mapping.map(n.pos),h=tn(c.doc,d,s.length,s);if(h||(s[0]=i?{type:i}:null,h=tn(c.doc,d,s.length,s)),!h)return!1;if(c.split(d,s.length,s),!a&&l&&n.node(o).type!=i){let e=c.mapping.map(n.before(o)),t=c.doc.resolve(e);i&&n.node(o-1).canReplaceWith(t.index(),t.index()+1,i)&&c.setNodeMarkup(c.mapping.map(n.before(o)),i)}return t&&t(c.scrollIntoView()),!0};function Ps(e,t,n,r){let o,i,s=t.nodeBefore,a=t.nodeAfter,l=s.type.spec.isolating||a.type.spec.isolating;if(!l&&function(e,t,n){let r=t.nodeBefore,o=t.nodeAfter,i=t.index();return!(!(r&&o&&r.type.compatibleContent(o.type))||(!r.content.size&&t.parent.canReplace(i-1,i)?(n&&n(e.tr.delete(t.pos-r.nodeSize,t.pos).scrollIntoView()),0):!t.parent.canReplace(i,i+1)||!o.isTextblock&&!nn(e.doc,t.pos)||(n&&n(e.tr.join(t.pos).scrollIntoView()),0)))}(e,t,n))return!0;let c=!l&&t.parent.canReplace(t.index(),t.index()+1);if(c&&(o=(i=s.contentMatchAt(s.childCount)).findWrapping(a.type))&&i.matchType(o[0]||a.type).validEnd){if(n){let r=t.pos+a.nodeSize,i=Se.empty;for(let e=o.length-1;e>=0;e--)i=Se.from(o[e].create(null,i));i=Se.from(s.copy(i));let l=e.tr.step(new Kt(t.pos-1,r,t.pos,r,new De(i,1,0),o.length,!0)),c=l.doc.resolve(r+2*o.length);c.nodeAfter&&c.nodeAfter.type==s.type&&nn(l.doc,c.pos)&&l.join(c.pos),n(l.scrollIntoView())}return!0}let d=a.type.spec.isolating||r>0&&l?null:kn.findFrom(t,1),h=d&&d.$from.blockRange(d.$to),u=h&&Yt(h);if(null!=u&&u>=t.depth)return n&&n(e.tr.lift(h,u).scrollIntoView()),!0;if(c&&Ns(a,"start",!0)&&Ns(s,"end")){let r=s,o=[];for(;o.push(r),!r.isTextblock;)r=r.lastChild;let i=a,l=1;for(;!i.isTextblock;i=i.firstChild)l++;if(r.canReplace(r.childCount,r.childCount,i.content)){if(n){let r=Se.empty;for(let e=o.length-1;e>=0;e--)r=Se.from(o[e].copy(r));n(e.tr.step(new Kt(t.pos-o.length,t.pos+a.nodeSize,t.pos+l,t.pos+a.nodeSize-l,new De(r,o.length,0),0,!0)).scrollIntoView())}return!0}}return!1}function Bs(e){return function(t,n){let r=t.selection,o=e<0?r.$from:r.$to,i=o.depth;for(;o.node(i).isInline;){if(!i)return!1;i--}return!!o.node(i).isTextblock&&(n&&n(t.tr.setSelection(Mn.create(t.doc,e<0?o.start(i):o.end(i)))),!0)}}const $s=Bs(-1),Vs=Bs(1);function js(e,t=null){return function(n,r){let o=!1;for(let r=0;r<n.selection.ranges.length&&!o;r++){let{$from:{pos:i},$to:{pos:s}}=n.selection.ranges[r];n.doc.nodesBetween(i,s,((r,i)=>{if(o)return!1;if(r.isTextblock&&!r.hasMarkup(e,t))if(r.type==e)o=!0;else{let t=n.doc.resolve(i),r=t.index();o=t.parent.canReplaceWith(r,r+1,e)}}))}if(!o)return!1;if(r){let o=n.tr;for(let r=0;r<n.selection.ranges.length;r++){let{$from:{pos:i},$to:{pos:s}}=n.selection.ranges[r];o.setBlockType(i,s,e,t)}r(o.scrollIntoView())}return!0}}function Fs(...e){return function(t,n,r){for(let o=0;o<e.length;o++)if(e[o](t,n,r))return!0;return!1}}function Hs(e,t=null){return function(n,r){let{$from:o,$to:i}=n.selection,s=o.blockRange(i);if(!s)return!1;let a=r?n.tr:null;return!!function(e,t,n,r=null){let o=!1,i=t,s=t.$from.doc;if(t.depth>=2&&t.$from.node(t.depth-1).type.compatibleContent(n)&&0==t.startIndex){if(0==t.$from.index(t.depth-1))return!1;let e=s.resolve(t.start-2);i=new Je(e,e,t.depth),t.endIndex<t.parent.childCount&&(t=new Je(t.$from,s.resolve(t.$to.end(t.depth)),t.depth)),o=!0}let a=Xt(i,n,r,t);if(!a)return!1;e&&function(e,t,n,r,o){let i=Se.empty;for(let e=n.length-1;e>=0;e--)i=Se.from(n[e].type.create(n[e].attrs,i));e.step(new Kt(t.start-(r?2:0),t.end,t.start,t.end,new De(i,0,0),n.length,!0));let s=0;for(let e=0;e<n.length;e++)n[e].type==o&&(s=e+1);let a=n.length-s,l=t.start+n.length-(r?2:0),c=t.parent;for(let n=t.startIndex,r=t.endIndex,o=!0;n<r;n++,o=!1)!o&&tn(e.doc,l,a)&&(e.split(l,a),l+=2*a),l+=c.child(n).nodeSize}(e,t,a,o,n);return!0}(a,s,e,t)&&(r&&r(a.scrollIntoView()),!0)}}function _s(e){return function(t,n){let{$from:r,$to:o}=t.selection,i=r.blockRange(o,(t=>t.childCount>0&&t.firstChild.type==e));return!!i&&(!n||(r.node(i.depth-1).type==e?function(e,t,n,r){let o=e.tr,i=r.end,s=r.$to.end(r.depth);i<s&&(o.step(new Kt(i-1,s,i,s,new De(Se.from(n.create(null,r.parent.copy())),1,0),1,!0)),r=new Je(o.doc.resolve(r.$from.pos),o.doc.resolve(s),r.depth));const a=Yt(r);if(null==a)return!1;o.lift(r,a);let l=o.doc.resolve(o.mapping.map(i,-1)-1);nn(o.doc,l.pos)&&l.nodeBefore.type==l.nodeAfter.type&&o.join(l.pos);return t(o.scrollIntoView()),!0}(t,n,e,i):function(e,t,n){let r=e.tr,o=n.parent;for(let e=n.end,t=n.endIndex-1,i=n.startIndex;t>i;t--)e-=o.child(t).nodeSize,r.delete(e-1,e+1);let i=r.doc.resolve(n.start),s=i.nodeAfter;if(r.mapping.map(n.end)!=n.start+i.nodeAfter.nodeSize)return!1;let a=0==n.startIndex,l=n.endIndex==o.childCount,c=i.node(-1),d=i.index(-1);if(!c.canReplace(d+(a?0:1),d+1,s.content.append(l?Se.empty:Se.from(o))))return!1;let h=i.pos,u=h+s.nodeSize;return r.step(new Kt(h-(a?1:0),u+(l?1:0),h+1,u-1,new De((a?Se.empty:Se.from(o.copy(Se.empty))).append(l?Se.empty:Se.from(o.copy(Se.empty))),a?0:1,l?0:1),a?0:1)),t(r.scrollIntoView()),!0}(t,n,i)))}}Fs(xs,ks,Ss),Fs(xs,Os,Es),Fs(Ds,Ls,Is,zs),"undefined"!=typeof navigator?/Mac|iP(hone|[oa]d)/.test(navigator.platform):"undefined"!=typeof os&&os.platform&&os.platform();var qs=Object.defineProperty,Ws=(e,t)=>{for(var n in t)qs(e,n,{get:t[n],enumerable:!0})};function Ks(e){const{state:t,transaction:n}=e;let{selection:r}=n,{doc:o}=n,{storedMarks:i}=n;return{...t,apply:t.apply.bind(t),applyTransaction:t.applyTransaction.bind(t),plugins:t.plugins,schema:t.schema,reconfigure:t.reconfigure.bind(t),toJSON:t.toJSON.bind(t),get storedMarks(){return i},get selection(){return r},get doc(){return o},get tr(){return r=n.selection,o=n.doc,i=n.storedMarks,n}}}var Js=class{constructor(e){this.editor=e.editor,this.rawCommands=this.editor.extensionManager.commands,this.customState=e.state}get hasCustomState(){return!!this.customState}get state(){return this.customState||this.editor.state}get commands(){const{rawCommands:e,editor:t,state:n}=this,{view:r}=t,{tr:o}=n,i=this.buildProps(o);return Object.fromEntries(Object.entries(e).map((([e,t])=>[e,(...e)=>{const n=t(...e)(i);return o.getMeta("preventDispatch")||this.hasCustomState||r.dispatch(o),n}])))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(e,t=!0){const{rawCommands:n,editor:r,state:o}=this,{view:i}=r,s=[],a=!!e,l=e||o.tr,c={...Object.fromEntries(Object.entries(n).map((([e,n])=>[e,(...e)=>{const r=this.buildProps(l,t),o=n(...e)(r);return s.push(o),c}]))),run:()=>(a||!t||l.getMeta("preventDispatch")||this.hasCustomState||i.dispatch(l),s.every((e=>!0===e)))};return c}createCan(e){const{rawCommands:t,state:n}=this,r=!1,o=e||n.tr,i=this.buildProps(o,r);return{...Object.fromEntries(Object.entries(t).map((([e,t])=>[e,(...e)=>t(...e)({...i,dispatch:void 0})]))),chain:()=>this.createChain(o,r)}}buildProps(e,t=!0){const{rawCommands:n,editor:r,state:o}=this,{view:i}=r,s={tr:e,editor:r,view:i,state:Ks({state:o,transaction:e}),dispatch:t?()=>{}:void 0,chain:()=>this.createChain(e,t),can:()=>this.createCan(e),get commands(){return Object.fromEntries(Object.entries(n).map((([e,t])=>[e,(...e)=>t(...e)(s)])))}};return s}},Us=class{constructor(){this.callbacks={}}on(e,t){return this.callbacks[e]||(this.callbacks[e]=[]),this.callbacks[e].push(t),this}emit(e,...t){const n=this.callbacks[e];return n&&n.forEach((e=>e.apply(this,t))),this}off(e,t){const n=this.callbacks[e];return n&&(t?this.callbacks[e]=n.filter((e=>e!==t)):delete this.callbacks[e]),this}once(e,t){const n=(...r)=>{this.off(e,n),t.apply(this,r)};return this.on(e,n)}removeAllListeners(){this.callbacks={}}};function Gs(e,t){const n=new xn(e);return t.forEach((e=>{e.steps.forEach((e=>{n.step(e)}))})),n}var Ys=e=>{const t=e.childNodes;for(let n=t.length-1;n>=0;n-=1){const r=t[n];3===r.nodeType&&r.nodeValue&&/^(\n\s\s|\n)$/.test(r.nodeValue)?e.removeChild(r):1===r.nodeType&&Ys(r)}return e};function Xs(e){if("undefined"==typeof window)throw new Error("[tiptap error]: there is no window object available, so this function cannot be used");const t=`<body>${e}</body>`,n=(new window.DOMParser).parseFromString(t,"text/html").body;return Ys(n)}function Qs(e,t,n){if(e instanceof Ge||e instanceof Se)return e;n={slice:!0,parseOptions:{},...n};const r="string"==typeof e;if("object"==typeof e&&null!==e)try{if(Array.isArray(e)&&e.length>0)return Se.fromArray(e.map((e=>t.nodeFromJSON(e))));const r=t.nodeFromJSON(e);return n.errorOnInvalidContent&&r.check(),r}catch(r){if(n.errorOnInvalidContent)throw new Error("[tiptap error]: Invalid JSON content",{cause:r});return console.warn("[tiptap warn]: Invalid content.","Passed value:",e,"Error:",r),Qs("",t,n)}if(r){if(n.errorOnInvalidContent){let r=!1,o="";const i=new ft({topNode:t.spec.topNode,marks:t.spec.marks,nodes:t.spec.nodes.append({__tiptap__private__unknown__catch__all__node:{content:"inline*",group:"block",parseDOM:[{tag:"*",getAttrs:e=>(r=!0,o="string"==typeof e?e:e.outerHTML,null)}]}})});if(n.slice?gt.fromSchema(i).parseSlice(Xs(e),n.parseOptions):gt.fromSchema(i).parse(Xs(e),n.parseOptions),n.errorOnInvalidContent&&r)throw new Error("[tiptap error]: Invalid HTML content",{cause:new Error(`Invalid element found: ${o}`)})}const r=gt.fromSchema(t);return n.slice?r.parseSlice(Xs(e),n.parseOptions).content:r.parse(Xs(e),n.parseOptions)}return Qs("",t,n)}function Zs(e,t,n={},r={}){return Qs(e,t,{slice:!1,parseOptions:n,errorOnInvalidContent:r.errorOnInvalidContent})}function ea(e){return t=>function(e,t){for(let n=e.depth;n>0;n-=1){const r=e.node(n);if(t(r))return{pos:n>0?e.before(n):0,start:e.start(n),depth:n,node:r}}}(t.$from,e)}function ta(e,t,n){if(void 0===e.config[t]&&e.parent)return ta(e.parent,t,n);if("function"==typeof e.config[t]){return e.config[t].bind({...n,parent:e.parent?ta(e.parent,t,n):null})}return e.config[t]}function na(e){return e.map((e=>{const t=ta(e,"addExtensions",{name:e.name,options:e.options,storage:e.storage});return t?[e,...na(t())]:e})).flat(10)}function ra(e,t){const n=Mt.fromSchema(t).serializeFragment(e),r=document.implementation.createHTMLDocument().createElement("div");return r.appendChild(n),r.innerHTML}function oa(e){return"function"==typeof e}function ia(e,t=void 0,...n){return oa(e)?t?e.bind(t)(...n):e(...n):e}function sa(e){return{baseExtensions:e.filter((e=>"extension"===e.type)),nodeExtensions:e.filter((e=>"node"===e.type)),markExtensions:e.filter((e=>"mark"===e.type))}}function aa(e){const t=[],{nodeExtensions:n,markExtensions:r}=sa(e),o=[...n,...r],i={default:null,validate:void 0,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1};return e.forEach((e=>{const n=ta(e,"addGlobalAttributes",{name:e.name,options:e.options,storage:e.storage,extensions:o});if(!n)return;n().forEach((e=>{e.types.forEach((n=>{Object.entries(e.attributes).forEach((([e,r])=>{t.push({type:n,name:e,attribute:{...i,...r}})}))}))}))})),o.forEach((e=>{const n={name:e.name,options:e.options,storage:e.storage},r=ta(e,"addAttributes",n);if(!r)return;const o=r();Object.entries(o).forEach((([n,r])=>{const o={...i,...r};"function"==typeof(null==o?void 0:o.default)&&(o.default=o.default()),(null==o?void 0:o.isRequired)&&void 0===(null==o?void 0:o.default)&&delete o.default,t.push({type:e.name,name:n,attribute:o})}))})),t}function la(...e){return e.filter((e=>!!e)).reduce(((e,t)=>{const n={...e};return Object.entries(t).forEach((([e,t])=>{if(n[e])if("class"===e){const r=t?String(t).split(" "):[],o=n[e]?n[e].split(" "):[],i=r.filter((e=>!o.includes(e)));n[e]=[...o,...i].join(" ")}else if("style"===e){const r=t?t.split(";").map((e=>e.trim())).filter(Boolean):[],o=n[e]?n[e].split(";").map((e=>e.trim())).filter(Boolean):[],i=new Map;o.forEach((e=>{const[t,n]=e.split(":").map((e=>e.trim()));i.set(t,n)})),r.forEach((e=>{const[t,n]=e.split(":").map((e=>e.trim()));i.set(t,n)})),n[e]=Array.from(i.entries()).map((([e,t])=>`${e}: ${t}`)).join("; ")}else n[e]=t;else n[e]=t})),n}),{})}function ca(e,t){return t.filter((t=>t.type===e.type.name)).filter((e=>e.attribute.rendered)).map((t=>t.attribute.renderHTML?t.attribute.renderHTML(e.attrs)||{}:{[t.name]:e.attrs[t.name]})).reduce(((e,t)=>la(e,t)),{})}function da(e,t){return"style"in e?e:{...e,getAttrs:n=>{const r=e.getAttrs?e.getAttrs(n):e.attrs;if(!1===r)return!1;const o=t.reduce(((e,t)=>{const r=t.attribute.parseHTML?t.attribute.parseHTML(n):function(e){return"string"!=typeof e?e:e.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(e):"true"===e||"false"!==e&&e}(n.getAttribute(t.name));return null==r?e:{...e,[t.name]:r}}),{});return{...r,...o}}}}function ha(e){return Object.fromEntries(Object.entries(e).filter((([e,t])=>("attrs"!==e||!function(e={}){return 0===Object.keys(e).length&&e.constructor===Object}(t))&&null!=t)))}function ua(e){return e.sort(((e,t)=>{const n=ta(e,"priority")||100,r=ta(t,"priority")||100;return n>r?-1:n<r?1:0}))}function pa(e){const t=ua(na(e)),n=function(e){const t=e.filter(((t,n)=>e.indexOf(t)!==n));return Array.from(new Set(t))}(t.map((e=>e.name)));return n.length&&console.warn(`[tiptap warn]: Duplicate extension names found: [${n.map((e=>`'${e}'`)).join(", ")}]. This can lead to issues.`),t}function fa(e,t,n){const{from:r,to:o}=t,{blockSeparator:i="\n\n",textSerializers:s={}}=n||{};let a="";return e.nodesBetween(r,o,((e,n,l,c)=>{var d;e.isBlock&&n>r&&(a+=i);const h=null==s?void 0:s[e.type.name];if(h)return l&&(a+=h({node:e,pos:n,parent:l,index:c,range:t})),!1;e.isText&&(a+=null==(d=null==e?void 0:e.text)?void 0:d.slice(Math.max(r,n)-n,o-n))})),a}function ma(e){return Object.fromEntries(Object.entries(e.nodes).filter((([,e])=>e.spec.toText)).map((([e,t])=>[e,t.spec.toText])))}function ga(e,t){if("string"==typeof e){if(!t.marks[e])throw Error(`There is no mark type named '${e}'. Maybe you forgot to add the extension?`);return t.marks[e]}return e}function ya(e,t){const n=ga(t,e.schema),{from:r,to:o,empty:i}=e.selection,s=[];i?(e.storedMarks&&s.push(...e.storedMarks),s.push(...e.selection.$head.marks())):e.doc.nodesBetween(r,o,(e=>{s.push(...e.marks)}));const a=s.find((e=>e.type.name===n.name));return a?{...a.attrs}:{}}function va(e,t){if("string"==typeof e){if(!t.nodes[e])throw Error(`There is no node type named '${e}'. Maybe you forgot to add the extension?`);return t.nodes[e]}return e}function ba(e,t){return t.nodes[e]?"node":t.marks[e]?"mark":null}function xa(e,t){const n=ba("string"==typeof t?t:t.name,e.schema);return"node"===n?function(e,t){const n=va(t,e.schema),{from:r,to:o}=e.selection,i=[];e.doc.nodesBetween(r,o,(e=>{i.push(e)}));const s=i.reverse().find((e=>e.type.name===n.name));return s?{...s.attrs}:{}}(e,t):"mark"===n?ya(e,t):{}}function wa(e){const t=function(e,t=JSON.stringify){const n={};return e.filter((e=>{const r=t(e);return!Object.prototype.hasOwnProperty.call(n,r)&&(n[r]=!0)}))}(e);return 1===t.length?t:t.filter(((e,n)=>{const r=t.filter(((e,t)=>t!==n));return!r.some((t=>e.oldRange.from>=t.oldRange.from&&e.oldRange.to<=t.oldRange.to&&e.newRange.from>=t.newRange.from&&e.newRange.to<=t.newRange.to))}))}function ka(e){const{mapping:t,steps:n}=e,r=[];return t.maps.forEach(((e,o)=>{const i=[];if(e.ranges.length)e.forEach(((e,t)=>{i.push({from:e,to:t})}));else{const{from:e,to:t}=n[o];if(void 0===e||void 0===t)return;i.push({from:e,to:t})}i.forEach((({from:e,to:n})=>{const i=t.slice(o).map(e,-1),s=t.slice(o).map(n),a=t.invert().map(i,-1),l=t.invert().map(s);r.push({oldRange:{from:a,to:l},newRange:{from:i,to:s}})}))})),wa(r)}function Ca(e){return"[object RegExp]"===Object.prototype.toString.call(e)}function Na(e,t,n={strict:!0}){const r=Object.keys(t);return!r.length||r.every((r=>n.strict?t[r]===e[r]:Ca(t[r])?t[r].test(e[r]):t[r]===e[r]))}function Sa(e,t,n={}){return e.find((e=>e.type===t&&Na(Object.fromEntries(Object.keys(n).map((t=>[t,e.attrs[t]]))),n)))}function Ma(e,t,n={}){return!!Sa(e,t,n)}function Ta(e,t,n){var r;if(!e||!t)return;let o=e.parent.childAfter(e.parentOffset);if(o.node&&o.node.marks.some((e=>e.type===t))||(o=e.parent.childBefore(e.parentOffset)),!o.node||!o.node.marks.some((e=>e.type===t)))return;n=n||(null==(r=o.node.marks[0])?void 0:r.attrs);if(!Sa([...o.node.marks],t,n))return;let i=o.index,s=e.start()+o.offset,a=i+1,l=s+o.node.nodeSize;for(;i>0&&Ma([...e.parent.child(i-1).marks],t,n);)i-=1,s-=e.parent.child(i).nodeSize;for(;a<e.parent.childCount&&Ma([...e.parent.child(a).marks],t,n);)l+=e.parent.child(a).nodeSize,a+=1;return{from:s,to:l}}function Oa(e,t,n){const r=[];return e===t?n.resolve(e).marks().forEach((t=>{const o=Ta(n.resolve(e),t.type);o&&r.push({mark:t,...o})})):n.nodesBetween(e,t,((e,t)=>{e&&void 0!==(null==e?void 0:e.nodeSize)&&r.push(...e.marks.map((n=>({from:t,to:t+e.nodeSize,mark:n}))))})),r}function Ea(e,t){return t.nodes[e]||t.marks[e]||null}function Aa(e,t,n){return Object.fromEntries(Object.entries(n).filter((([n])=>{const r=e.find((e=>e.type===t&&e.name===n));return!!r&&r.attribute.keepOnSplit})))}function Da(e,t,n={}){const{empty:r,ranges:o}=e.selection,i=t?ga(t,e.schema):null;if(r)return!!(e.storedMarks||e.selection.$from.marks()).filter((e=>!i||i.name===e.type.name)).find((e=>Na(e.attrs,n,{strict:!1})));let s=0;const a=[];if(o.forEach((({$from:t,$to:n})=>{const r=t.pos,o=n.pos;e.doc.nodesBetween(r,o,((e,t)=>{if(!e.isText&&!e.marks.length)return;const n=Math.max(r,t),i=Math.min(o,t+e.nodeSize);s+=i-n,a.push(...e.marks.map((e=>({mark:e,from:n,to:i}))))}))})),0===s)return!1;const l=a.filter((e=>!i||i.name===e.mark.type.name)).filter((e=>Na(e.mark.attrs,n,{strict:!1}))).reduce(((e,t)=>e+t.to-t.from),0),c=a.filter((e=>!i||e.mark.type!==i&&e.mark.type.excludes(i))).reduce(((e,t)=>e+t.to-t.from),0);return(l>0?l+c:l)>=s}function Ra(e,t,n={}){const{from:r,to:o,empty:i}=e.selection,s=t?va(t,e.schema):null,a=[];e.doc.nodesBetween(r,o,((e,t)=>{if(e.isText)return;const n=Math.max(r,t),i=Math.min(o,t+e.nodeSize);a.push({node:e,from:n,to:i})}));const l=o-r,c=a.filter((e=>!s||s.name===e.node.type.name)).filter((e=>Na(e.node.attrs,n,{strict:!1})));if(i)return!!c.length;return c.reduce(((e,t)=>e+t.to-t.from),0)>=l}function La(e,t){return Array.isArray(t)?t.some((t=>("string"==typeof t?t:t.name)===e.name)):t}function Ia(e,t){const{nodeExtensions:n}=sa(t),r=n.find((t=>t.name===e));if(!r)return!1;const o=ia(ta(r,"group",{name:r.name,options:r.options,storage:r.storage}));return"string"==typeof o&&o.split(" ").includes("list")}function za(e,{checkChildren:t=!0,ignoreWhitespace:n=!1}={}){var r;if(n){if("hardBreak"===e.type.name)return!0;if(e.isText)return/^\s*$/m.test(null!=(r=e.text)?r:"")}if(e.isText)return!e.text;if(e.isAtom||e.isLeaf)return!1;if(0===e.content.childCount)return!0;if(t){let r=!0;return e.content.forEach((e=>{!1!==r&&(za(e,{ignoreWhitespace:n,checkChildren:t})||(r=!1))})),r}return!1}function Pa(e){return e instanceof On}function Ba(e){return e instanceof Mn}function $a(e=0,t=0,n=0){return Math.min(Math.max(e,t),n)}function Va(e,t=null){if(!t)return null;const n=kn.atStart(e),r=kn.atEnd(e);if("start"===t||!0===t)return n;if("end"===t)return r;const o=n.from,i=r.to;return"all"===t?Mn.create(e,$a(0,o,i),$a(e.content.size,o,i)):Mn.create(e,$a(t,o,i),$a(t,o,i))}var ja=class{constructor(e){this.find=e.find,this.handler=e.handler}};function Fa(e){var t;const{editor:n,from:r,to:o,text:i,rules:s,plugin:a}=e,{view:l}=n;if(l.composing)return!1;const c=l.state.doc.resolve(r);if(c.parent.type.spec.code||(null==(t=c.nodeBefore||c.nodeAfter)?void 0:t.marks.find((e=>e.type.spec.code))))return!1;let d=!1;const h=((e,t=500)=>{let n="";const r=e.parentOffset;return e.parent.nodesBetween(Math.max(0,r-t),r,((e,t,o,i)=>{var s,a;const l=(null==(a=(s=e.type.spec).toText)?void 0:a.call(s,{node:e,pos:t,parent:o,index:i}))||e.textContent||"%leaf%";n+=e.isAtom&&!e.isText?l:l.slice(0,Math.max(0,r-t))})),n})(c)+i;return s.forEach((e=>{if(d)return;const t=((e,t)=>{if(Ca(t))return t.exec(e);const n=t(e);if(!n)return null;const r=[n.text];return r.index=n.index,r.input=e,r.data=n.data,n.replaceWith&&(n.text.includes(n.replaceWith)||console.warn('[tiptap warn]: "inputRuleMatch.replaceWith" must be part of "inputRuleMatch.text".'),r.push(n.replaceWith)),r})(h,e.find);if(!t)return;const s=l.state.tr,c=Ks({state:l.state,transaction:s}),u={from:r-(t[0].length-i.length),to:o},{commands:p,chain:f,can:m}=new Js({editor:n,state:c});null!==e.handler({state:c,range:u,match:t,commands:p,chain:f,can:m})&&s.steps.length&&(s.setMeta(a,{transform:s,from:r,to:o,text:i}),l.dispatch(s),d=!0)})),d}function Ha(e){const{editor:t,rules:n}=e,r=new Fn({state:{init:()=>null,apply(e,o,i){const s=e.getMeta(r);if(s)return s;const a=e.getMeta("applyInputRules");return!!a&&setTimeout((()=>{let{text:e}=a;"string"==typeof e||(e=ra(Se.from(e),i.schema));const{from:o}=a,s=o+e.length;Fa({editor:t,from:o,to:s,text:e,rules:n,plugin:r})})),e.selectionSet||e.docChanged?null:o}},props:{handleTextInput:(e,o,i,s)=>Fa({editor:t,from:o,to:i,text:s,rules:n,plugin:r}),handleDOMEvents:{compositionend:e=>(setTimeout((()=>{const{$cursor:o}=e.state.selection;o&&Fa({editor:t,from:o.pos,to:o.pos,text:"",rules:n,plugin:r})})),!1)},handleKeyDown(e,o){if("Enter"!==o.key)return!1;const{$cursor:i}=e.state.selection;return!!i&&Fa({editor:t,from:i.pos,to:i.pos,text:"\n",rules:n,plugin:r})}},isInputRules:!0});return r}function _a(e){return"Object"===function(e){return Object.prototype.toString.call(e).slice(8,-1)}(e)&&(e.constructor===Object&&Object.getPrototypeOf(e)===Object.prototype)}function qa(e,t){const n={...e};return _a(e)&&_a(t)&&Object.keys(t).forEach((r=>{_a(t[r])&&_a(e[r])?n[r]=qa(e[r],t[r]):n[r]=t[r]})),n}var Wa=class{constructor(e={}){this.type="extendable",this.parent=null,this.child=null,this.name="",this.config={name:this.name},this.config={...this.config,...e},this.name=this.config.name}get options(){return{...ia(ta(this,"addOptions",{name:this.name}))||{}}}get storage(){return{...ia(ta(this,"addStorage",{name:this.name,options:this.options}))||{}}}configure(e={}){const t=this.extend({...this.config,addOptions:()=>qa(this.options,e)});return t.name=this.name,t.parent=this.parent,t}extend(e={}){const t=new this.constructor({...this.config,...e});return t.parent=this,this.child=t,t.name="name"in e?e.name:t.parent.name,t}},Ka=class e extends Wa{constructor(){super(...arguments),this.type="mark"}static create(t={}){const n="function"==typeof t?t():t;return new e(n)}static handleExit({editor:e,mark:t}){const{tr:n}=e.state,r=e.state.selection.$from;if(r.pos===r.end()){const o=r.marks();if(!!!o.find((e=>(null==e?void 0:e.type.name)===t.name)))return!1;const i=o.find((e=>(null==e?void 0:e.type.name)===t.name));return i&&n.removeStoredMark(i),n.insertText(" ",r.pos),e.view.dispatch(n),!0}return!1}configure(e){return super.configure(e)}extend(e){const t="function"==typeof e?e():e;return super.extend(t)}};var Ja=class{constructor(e){this.find=e.find,this.handler=e.handler}};function Ua(e){const{editor:t,state:n,from:r,to:o,rule:i,pasteEvent:s,dropEvent:a}=e,{commands:l,chain:c,can:d}=new Js({editor:t,state:n}),h=[];n.doc.nodesBetween(r,o,((e,t)=>{if(!e.isTextblock||e.type.spec.code)return;const u=Math.max(r,t),p=Math.min(o,t+e.content.size),f=((e,t,n)=>{if(Ca(t))return[...e.matchAll(t)];const r=t(e,n);return r?r.map((t=>{const n=[t.text];return n.index=t.index,n.input=e,n.data=t.data,t.replaceWith&&(t.text.includes(t.replaceWith)||console.warn('[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".'),n.push(t.replaceWith)),n})):[]})(e.textBetween(u-t,p-t,void 0,""),i.find,s);f.forEach((e=>{if(void 0===e.index)return;const t=u+e.index+1,r=t+e[0].length,o={from:n.tr.mapping.map(t),to:n.tr.mapping.map(r)},p=i.handler({state:n,range:o,match:e,commands:l,chain:c,can:d,pasteEvent:s,dropEvent:a});h.push(p)}))}));return h.every((e=>null!==e))}var Ga=null;function Ya(e){const{editor:t,rules:n}=e;let r,o=null,i=!1,s=!1,a="undefined"!=typeof ClipboardEvent?new ClipboardEvent("paste"):null;try{r="undefined"!=typeof DragEvent?new DragEvent("drop"):null}catch{r=null}const l=({state:e,from:n,to:o,rule:i,pasteEvt:s})=>{const l=e.tr,c=Ks({state:e,transaction:l});if(Ua({editor:t,state:c,from:Math.max(n-1,0),to:o.b-1,rule:i,pasteEvent:s,dropEvent:r})&&l.steps.length){try{r="undefined"!=typeof DragEvent?new DragEvent("drop"):null}catch{r=null}return a="undefined"!=typeof ClipboardEvent?new ClipboardEvent("paste"):null,l}};return n.map((e=>new Fn({view(e){const n=n=>{var r;o=(null==(r=e.dom.parentElement)?void 0:r.contains(n.target))?e.dom.parentElement:null,o&&(Ga=t)},r=()=>{Ga&&(Ga=null)};return window.addEventListener("dragstart",n),window.addEventListener("dragend",r),{destroy(){window.removeEventListener("dragstart",n),window.removeEventListener("dragend",r)}}},props:{handleDOMEvents:{drop:(e,t)=>{if(s=o===e.dom.parentElement,r=t,!s){const e=Ga;(null==e?void 0:e.isEditable)&&setTimeout((()=>{const t=e.state.selection;t&&e.commands.deleteRange({from:t.from,to:t.to})}),10)}return!1},paste:(e,t)=>{var n;const r=null==(n=t.clipboardData)?void 0:n.getData("text/html");return a=t,i=!!(null==r?void 0:r.includes("data-pm-slice")),!1}}},appendTransaction:(t,n,r)=>{const o=t[0],c="paste"===o.getMeta("uiEvent")&&!i,d="drop"===o.getMeta("uiEvent")&&!s,h=o.getMeta("applyPasteRules"),u=!!h;if(!c&&!d&&!u)return;if(u){let{text:t}=h;"string"==typeof t||(t=ra(Se.from(t),r.schema));const{from:n}=h,o=n+t.length,i=(e=>{var t;const n=new ClipboardEvent("paste",{clipboardData:new DataTransfer});return null==(t=n.clipboardData)||t.setData("text/html",e),n})(t);return l({rule:e,state:r,from:n,to:{b:o},pasteEvt:i})}const p=n.doc.content.findDiffStart(r.doc.content),f=n.doc.content.findDiffEnd(r.doc.content);return"number"==typeof p&&f&&p!==f.b?l({rule:e,state:r,from:p,to:f,pasteEvt:a}):void 0}})))}var Xa=class{constructor(e,t){this.splittableMarks=[],this.editor=t,this.extensions=pa(e),this.schema=function(e,t){var n;const r=aa(e),{nodeExtensions:o,markExtensions:i}=sa(e),s=null==(n=o.find((e=>ta(e,"topNode"))))?void 0:n.name,a=Object.fromEntries(o.map((n=>{const o=r.filter((e=>e.type===n.name)),i={name:n.name,options:n.options,storage:n.storage,editor:t},s=ha({...e.reduce(((e,t)=>{const r=ta(t,"extendNodeSchema",i);return{...e,...r?r(n):{}}}),{}),content:ia(ta(n,"content",i)),marks:ia(ta(n,"marks",i)),group:ia(ta(n,"group",i)),inline:ia(ta(n,"inline",i)),atom:ia(ta(n,"atom",i)),selectable:ia(ta(n,"selectable",i)),draggable:ia(ta(n,"draggable",i)),code:ia(ta(n,"code",i)),whitespace:ia(ta(n,"whitespace",i)),linebreakReplacement:ia(ta(n,"linebreakReplacement",i)),defining:ia(ta(n,"defining",i)),isolating:ia(ta(n,"isolating",i)),attrs:Object.fromEntries(o.map((e=>{var t,n;return[e.name,{default:null==(t=null==e?void 0:e.attribute)?void 0:t.default,validate:null==(n=null==e?void 0:e.attribute)?void 0:n.validate}]})))}),a=ia(ta(n,"parseHTML",i));a&&(s.parseDOM=a.map((e=>da(e,o))));const l=ta(n,"renderHTML",i);l&&(s.toDOM=e=>l({node:e,HTMLAttributes:ca(e,o)}));const c=ta(n,"renderText",i);return c&&(s.toText=c),[n.name,s]}))),l=Object.fromEntries(i.map((n=>{const o=r.filter((e=>e.type===n.name)),i={name:n.name,options:n.options,storage:n.storage,editor:t},s=ha({...e.reduce(((e,t)=>{const r=ta(t,"extendMarkSchema",i);return{...e,...r?r(n):{}}}),{}),inclusive:ia(ta(n,"inclusive",i)),excludes:ia(ta(n,"excludes",i)),group:ia(ta(n,"group",i)),spanning:ia(ta(n,"spanning",i)),code:ia(ta(n,"code",i)),attrs:Object.fromEntries(o.map((e=>{var t,n;return[e.name,{default:null==(t=null==e?void 0:e.attribute)?void 0:t.default,validate:null==(n=null==e?void 0:e.attribute)?void 0:n.validate}]})))}),a=ia(ta(n,"parseHTML",i));a&&(s.parseDOM=a.map((e=>da(e,o))));const l=ta(n,"renderHTML",i);return l&&(s.toDOM=e=>l({mark:e,HTMLAttributes:ca(e,o)})),[n.name,s]})));return new ft({topNode:s,nodes:a,marks:l})}(this.extensions,t),this.setupExtensions()}get commands(){return this.extensions.reduce(((e,t)=>{const n=ta(t,"addCommands",{name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:this.editor,type:Ea(t.name,this.schema)});return n?{...e,...n()}:e}),{})}get plugins(){const{editor:e}=this,t=ua([...this.extensions].reverse()),n=[],r=[],o=t.map((t=>{const o={name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:e,type:Ea(t.name,this.schema)},i=[],s=ta(t,"addKeyboardShortcuts",o);let a={};if("mark"===t.type&&ta(t,"exitable",o)&&(a.ArrowRight=()=>Ka.handleExit({editor:e,mark:t})),s){const t=Object.fromEntries(Object.entries(s()).map((([t,n])=>[t,()=>n({editor:e})])));a={...a,...t}}const l=new Fn({props:{handleKeyDown:bs(a)}});i.push(l);const c=ta(t,"addInputRules",o);La(t,e.options.enableInputRules)&&c&&n.push(...c());const d=ta(t,"addPasteRules",o);La(t,e.options.enablePasteRules)&&d&&r.push(...d());const h=ta(t,"addProseMirrorPlugins",o);if(h){const e=h();i.push(...e)}return i})).flat();return[Ha({editor:e,rules:n}),...Ya({editor:e,rules:r}),...o]}get attributes(){return aa(this.extensions)}get nodeViews(){const{editor:e}=this,{nodeExtensions:t}=sa(this.extensions);return Object.fromEntries(t.filter((e=>!!ta(e,"addNodeView"))).map((t=>{const n=this.attributes.filter((e=>e.type===t.name)),r={name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:e,type:va(t.name,this.schema)},o=ta(t,"addNodeView",r);if(!o)return[];return[t.name,(r,i,s,a,l)=>{const c=ca(r,n);return o()({node:r,view:i,getPos:s,decorations:a,innerDecorations:l,editor:e,extension:t,HTMLAttributes:c})}]})))}get markViews(){const{editor:e}=this,{markExtensions:t}=sa(this.extensions);return Object.fromEntries(t.filter((e=>!!ta(e,"addMarkView"))).map((t=>{const n=this.attributes.filter((e=>e.type===t.name)),r={name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:e,type:ga(t.name,this.schema)},o=ta(t,"addMarkView",r);if(!o)return[];return[t.name,(r,i,s)=>{const a=ca(r,n);return o()({mark:r,view:i,inline:s,editor:e,extension:t,HTMLAttributes:a,updateAttributes:t=>{!function(e,t,n={}){const{state:r}=t,{doc:o,tr:i}=r,s=e;o.descendants(((t,r)=>{const o=i.mapping.map(r),a=i.mapping.map(r)+t.nodeSize;let l=null;if(t.marks.forEach((e=>{if(e!==s)return!1;l=e})),!l)return;let c=!1;if(Object.keys(n).forEach((e=>{n[e]!==l.attrs[e]&&(c=!0)})),c){const t=e.type.create({...e.attrs,...n});i.removeMark(o,a,e.type),i.addMark(o,a,t)}})),i.docChanged&&t.view.dispatch(i)}(r,e,t)}})}]})))}setupExtensions(){const e=this.extensions;this.editor.extensionStorage=Object.fromEntries(e.map((e=>[e.name,e.storage]))),e.forEach((e=>{var t;const n={name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:this.editor,type:Ea(e.name,this.schema)};if("mark"===e.type){(null==(t=ia(ta(e,"keepOnSplit",n)))||t)&&this.splittableMarks.push(e.name)}const r=ta(e,"onBeforeCreate",n),o=ta(e,"onCreate",n),i=ta(e,"onUpdate",n),s=ta(e,"onSelectionUpdate",n),a=ta(e,"onTransaction",n),l=ta(e,"onFocus",n),c=ta(e,"onBlur",n),d=ta(e,"onDestroy",n);r&&this.editor.on("beforeCreate",r),o&&this.editor.on("create",o),i&&this.editor.on("update",i),s&&this.editor.on("selectionUpdate",s),a&&this.editor.on("transaction",a),l&&this.editor.on("focus",l),c&&this.editor.on("blur",c),d&&this.editor.on("destroy",d)}))}};Xa.resolve=pa,Xa.sort=ua,Xa.flatten=na;Ws({},{ClipboardTextSerializer:()=>Za,Commands:()=>hc,Delete:()=>uc,Drop:()=>pc,Editable:()=>fc,FocusEvents:()=>gc,Keymap:()=>yc,Paste:()=>vc,Tabindex:()=>bc,focusEventsPluginKey:()=>mc});var Qa=class e extends Wa{constructor(){super(...arguments),this.type="extension"}static create(t={}){const n="function"==typeof t?t():t;return new e(n)}configure(e){return super.configure(e)}extend(e){const t="function"==typeof e?e():e;return super.extend(t)}},Za=Qa.create({name:"clipboardTextSerializer",addOptions:()=>({blockSeparator:void 0}),addProseMirrorPlugins(){return[new Fn({key:new qn("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{const{editor:e}=this,{state:t,schema:n}=e,{doc:r,selection:o}=t,{ranges:i}=o,s=Math.min(...i.map((e=>e.$from.pos))),a=Math.max(...i.map((e=>e.$to.pos))),l=ma(n);return fa(r,{from:s,to:a},{...void 0!==this.options.blockSeparator?{blockSeparator:this.options.blockSeparator}:{},textSerializers:l})}}})]}}),el={};Ws(el,{blur:()=>tl,clearContent:()=>nl,clearNodes:()=>rl,command:()=>ol,createParagraphNear:()=>il,cut:()=>sl,deleteCurrentNode:()=>al,deleteNode:()=>ll,deleteRange:()=>cl,deleteSelection:()=>dl,enter:()=>hl,exitCode:()=>ul,extendMarkRange:()=>pl,first:()=>fl,focus:()=>gl,forEach:()=>yl,insertContent:()=>vl,insertContentAt:()=>bl,joinBackward:()=>kl,joinDown:()=>wl,joinForward:()=>Cl,joinItemBackward:()=>Nl,joinItemForward:()=>Sl,joinTextblockBackward:()=>Ml,joinTextblockForward:()=>Tl,joinUp:()=>xl,keyboardShortcut:()=>El,lift:()=>Al,liftEmptyBlock:()=>Dl,liftListItem:()=>Rl,newlineInCode:()=>Ll,resetAttributes:()=>zl,scrollIntoView:()=>Pl,selectAll:()=>Bl,selectNodeBackward:()=>$l,selectNodeForward:()=>Vl,selectParentNode:()=>jl,selectTextblockEnd:()=>Fl,selectTextblockStart:()=>Hl,setContent:()=>_l,setMark:()=>ql,setMeta:()=>Wl,setNode:()=>Kl,setNodeSelection:()=>Jl,setTextSelection:()=>Ul,sinkListItem:()=>Gl,splitBlock:()=>Xl,splitListItem:()=>Ql,toggleList:()=>tc,toggleMark:()=>nc,toggleNode:()=>rc,toggleWrap:()=>oc,undoInputRule:()=>ic,unsetAllMarks:()=>sc,unsetMark:()=>ac,updateAttributes:()=>lc,wrapIn:()=>cc,wrapInList:()=>dc});var tl=()=>({editor:e,view:t})=>(requestAnimationFrame((()=>{var n;e.isDestroyed||(t.dom.blur(),null==(n=null==window?void 0:window.getSelection())||n.removeAllRanges())})),!0),nl=(e=!0)=>({commands:t})=>t.setContent("",{emitUpdate:e}),rl=()=>({state:e,tr:t,dispatch:n})=>{const{selection:r}=t,{ranges:o}=r;return!n||(o.forEach((({$from:n,$to:r})=>{e.doc.nodesBetween(n.pos,r.pos,((e,n)=>{if(e.type.isText)return;const{doc:r,mapping:o}=t,i=r.resolve(o.map(n)),s=r.resolve(o.map(n+e.nodeSize)),a=i.blockRange(s);if(!a)return;const l=Yt(a);if(e.type.isTextblock){const{defaultType:e}=i.parent.contentMatchAt(i.index());t.setNodeMarkup(a.start,e)}(l||0===l)&&t.lift(a,l)}))})),!0)},ol=e=>t=>e(t),il=()=>({state:e,dispatch:t})=>Ls(e,t),sl=(e,t)=>({editor:n,tr:r})=>{const{state:o}=n,i=o.doc.slice(e.from,e.to);r.deleteRange(e.from,e.to);const s=r.mapping.map(t);return r.insert(s,i.content),r.setSelection(new Mn(r.doc.resolve(Math.max(s-1,0)))),!0},al=()=>({tr:e,dispatch:t})=>{const{selection:n}=e,r=n.$anchor.node();if(r.content.size>0)return!1;const o=e.selection.$anchor;for(let n=o.depth;n>0;n-=1){if(o.node(n).type===r.type){if(t){const t=o.before(n),r=o.after(n);e.delete(t,r).scrollIntoView()}return!0}}return!1},ll=e=>({tr:t,state:n,dispatch:r})=>{const o=va(e,n.schema),i=t.selection.$anchor;for(let e=i.depth;e>0;e-=1){if(i.node(e).type===o){if(r){const n=i.before(e),r=i.after(e);t.delete(n,r).scrollIntoView()}return!0}}return!1},cl=e=>({tr:t,dispatch:n})=>{const{from:r,to:o}=e;return n&&t.delete(r,o),!0},dl=()=>({state:e,dispatch:t})=>xs(e,t),hl=()=>({commands:e})=>e.keyboardShortcut("Enter"),ul=()=>({state:e,dispatch:t})=>((e,t)=>{let{$head:n,$anchor:r}=e.selection;if(!n.parent.type.spec.code||!n.sameParent(r))return!1;let o=n.node(-1),i=n.indexAfter(-1),s=Rs(o.contentMatchAt(i));if(!s||!o.canReplaceWith(i,i,s))return!1;if(t){let r=n.after(),o=e.tr.replaceWith(r,r,s.createAndFill());o.setSelection(kn.near(o.doc.resolve(r),1)),t(o.scrollIntoView())}return!0})(e,t),pl=(e,t={})=>({tr:n,state:r,dispatch:o})=>{const i=ga(e,r.schema),{doc:s,selection:a}=n,{$from:l,from:c,to:d}=a;if(o){const e=Ta(l,i,t);if(e&&e.from<=c&&e.to>=d){const t=Mn.create(s,e.from,e.to);n.setSelection(t)}}return!0},fl=e=>t=>{const n="function"==typeof e?e(t):e;for(let e=0;e<n.length;e+=1)if(n[e](t))return!0;return!1};function ml(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}var gl=(e=null,t={})=>({editor:n,view:r,tr:o,dispatch:i})=>{t={scrollIntoView:!0,...t};const s=()=>{(ml()||"Android"===navigator.platform||/android/i.test(navigator.userAgent))&&r.dom.focus(),requestAnimationFrame((()=>{n.isDestroyed||(r.focus(),(null==t?void 0:t.scrollIntoView)&&n.commands.scrollIntoView())}))};if(r.hasFocus()&&null===e||!1===e)return!0;if(i&&null===e&&!Ba(n.state.selection))return s(),!0;const a=Va(o.doc,e)||n.state.selection,l=n.state.selection.eq(a);return i&&(l||o.setSelection(a),l&&o.storedMarks&&o.setStoredMarks(o.storedMarks),s()),!0},yl=(e,t)=>n=>e.every(((e,r)=>t(e,{...n,index:r}))),vl=(e,t)=>({tr:n,commands:r})=>r.insertContentAt({from:n.selection.from,to:n.selection.to},e,t),bl=(e,t,n)=>({tr:r,dispatch:o,editor:i})=>{var s;if(o){let o;n={parseOptions:i.options.parseOptions,updateSelection:!0,applyInputRules:!1,applyPasteRules:!1,...n};const{selection:a}=i.state,l=e=>{i.emit("contentError",{editor:i,error:e,disableCollaboration:()=>{"collaboration"in i.storage&&"object"==typeof i.storage.collaboration&&i.storage.collaboration&&(i.storage.collaboration.isDisabled=!0)}})},c={preserveWhitespace:"full",...n.parseOptions};if(!n.errorOnInvalidContent&&!i.options.enableContentCheck&&i.options.emitContentError)try{Qs(t,i.schema,{parseOptions:c,errorOnInvalidContent:!0})}catch(e){l(e)}try{o=Qs(t,i.schema,{parseOptions:c,errorOnInvalidContent:null!=(s=n.errorOnInvalidContent)?s:i.options.enableContentCheck})}catch(e){return l(e),!1}let{from:d,to:h}="number"==typeof e?{from:e,to:e}:{from:e.from,to:e.to},u=!0,p=!0;if(("type"in o?[o]:o).forEach((e=>{e.check(),u=!!u&&(e.isText&&0===e.marks.length),p=!!p&&e.isBlock})),d===h&&p){const{parent:e}=r.doc.resolve(d);e.isTextblock&&!e.type.spec.code&&!e.childCount&&(d-=1,h+=1)}let f;if(u){if(Array.isArray(t))f=t.map((e=>e.text||"")).join("");else if(t instanceof Se){let e="";t.forEach((t=>{t.text&&(e+=t.text)})),f=e}else f="object"==typeof t&&t&&t.text?t.text:t;r.insertText(f,d,h)}else{f=o;const e=0===a.$from.parentOffset,t=a.$from.node().isText||a.$from.node().isTextblock,n=a.$from.node().content.size>0;e&&t&&n&&(d=Math.max(0,d-1)),r.replaceWith(d,h,f)}n.updateSelection&&function(e,t,n){const r=e.steps.length-1;if(r<t)return;const o=e.steps[r];if(!(o instanceof Wt||o instanceof Kt))return;const i=e.mapping.maps[r];let s=0;i.forEach(((e,t,n,r)=>{0===s&&(s=r)})),e.setSelection(kn.near(e.doc.resolve(s),n))}(r,r.steps.length-1,-1),n.applyInputRules&&r.setMeta("applyInputRules",{from:d,text:f}),n.applyPasteRules&&r.setMeta("applyPasteRules",{from:d,text:f})}return!0},xl=()=>({state:e,dispatch:t})=>((e,t)=>{let n,r=e.selection,o=r instanceof On;if(o){if(r.node.isTextblock||!nn(e.doc,r.from))return!1;n=r.from}else if(n=on(e.doc,r.from,-1),null==n)return!1;if(t){let r=e.tr.join(n);o&&r.setSelection(On.create(r.doc,n-e.doc.resolve(n).nodeBefore.nodeSize)),t(r.scrollIntoView())}return!0})(e,t),wl=()=>({state:e,dispatch:t})=>((e,t)=>{let n,r=e.selection;if(r instanceof On){if(r.node.isTextblock||!nn(e.doc,r.to))return!1;n=r.to}else if(n=on(e.doc,r.to,1),null==n)return!1;return t&&t(e.tr.join(n).scrollIntoView()),!0})(e,t),kl=()=>({state:e,dispatch:t})=>ks(e,t),Cl=()=>({state:e,dispatch:t})=>Os(e,t),Nl=()=>({state:e,dispatch:t,tr:n})=>{try{const r=on(e.doc,e.selection.$from.pos,-1);return null!=r&&(n.join(r,2),t&&t(n),!0)}catch{return!1}},Sl=()=>({state:e,dispatch:t,tr:n})=>{try{const r=on(e.doc,e.selection.$from.pos,1);return null!=r&&(n.join(r,2),t&&t(n),!0)}catch{return!1}},Ml=()=>({state:e,dispatch:t})=>((e,t,n)=>{let r=ws(e,n);if(!r)return!1;let o=Ms(r);return!!o&&Cs(e,o,t)})(e,t),Tl=()=>({state:e,dispatch:t})=>((e,t,n)=>{let r=Ts(e,n);if(!r)return!1;let o=As(r);return!!o&&Cs(e,o,t)})(e,t);function Ol(){return"undefined"!=typeof navigator&&/Mac/.test(navigator.platform)}var El=e=>({editor:t,view:n,tr:r,dispatch:o})=>{const i=function(e){const t=e.split(/-(?!$)/);let n,r,o,i,s=t[t.length-1];"Space"===s&&(s=" ");for(let e=0;e<t.length-1;e+=1){const s=t[e];if(/^(cmd|meta|m)$/i.test(s))i=!0;else if(/^a(lt)?$/i.test(s))n=!0;else if(/^(c|ctrl|control)$/i.test(s))r=!0;else if(/^s(hift)?$/i.test(s))o=!0;else{if(!/^mod$/i.test(s))throw new Error(`Unrecognized modifier name: ${s}`);ml()||Ol()?i=!0:r=!0}}return n&&(s=`Alt-${s}`),r&&(s=`Ctrl-${s}`),i&&(s=`Meta-${s}`),o&&(s=`Shift-${s}`),s}(e).split(/-(?!$)/),s=i.find((e=>!["Alt","Ctrl","Meta","Shift"].includes(e))),a=new KeyboardEvent("keydown",{key:"Space"===s?" ":s,altKey:i.includes("Alt"),ctrlKey:i.includes("Ctrl"),metaKey:i.includes("Meta"),shiftKey:i.includes("Shift"),bubbles:!0,cancelable:!0}),l=t.captureTransaction((()=>{n.someProp("handleKeyDown",(e=>e(n,a)))}));return null==l||l.steps.forEach((e=>{const t=e.map(r.mapping);t&&o&&r.maybeStep(t)})),!0},Al=(e,t={})=>({state:n,dispatch:r})=>!!Ra(n,va(e,n.schema),t)&&((e,t)=>{let{$from:n,$to:r}=e.selection,o=n.blockRange(r),i=o&&Yt(o);return null!=i&&(t&&t(e.tr.lift(o,i).scrollIntoView()),!0)})(n,r),Dl=()=>({state:e,dispatch:t})=>Is(e,t),Rl=e=>({state:t,dispatch:n})=>_s(va(e,t.schema))(t,n),Ll=()=>({state:e,dispatch:t})=>Ds(e,t);function Il(e,t){const n="string"==typeof t?[t]:t;return Object.keys(e).reduce(((t,r)=>(n.includes(r)||(t[r]=e[r]),t)),{})}var zl=(e,t)=>({tr:n,state:r,dispatch:o})=>{let i=null,s=null;const a=ba("string"==typeof e?e:e.name,r.schema);return!!a&&("node"===a&&(i=va(e,r.schema)),"mark"===a&&(s=ga(e,r.schema)),o&&n.selection.ranges.forEach((e=>{r.doc.nodesBetween(e.$from.pos,e.$to.pos,((e,r)=>{i&&i===e.type&&n.setNodeMarkup(r,void 0,Il(e.attrs,t)),s&&e.marks.length&&e.marks.forEach((o=>{s===o.type&&n.addMark(r,r+e.nodeSize,s.create(Il(o.attrs,t)))}))}))})),!0)},Pl=()=>({tr:e,dispatch:t})=>(t&&e.scrollIntoView(),!0),Bl=()=>({tr:e,dispatch:t})=>{if(t){const t=new An(e.doc);e.setSelection(t)}return!0},$l=()=>({state:e,dispatch:t})=>Ss(e,t),Vl=()=>({state:e,dispatch:t})=>Es(e,t),jl=()=>({state:e,dispatch:t})=>((e,t)=>{let n,{$from:r,to:o}=e.selection,i=r.sharedDepth(o);return 0!=i&&(n=r.before(i),t&&t(e.tr.setSelection(On.create(e.doc,n))),!0)})(e,t),Fl=()=>({state:e,dispatch:t})=>Vs(e,t),Hl=()=>({state:e,dispatch:t})=>$s(e,t),_l=(e,{errorOnInvalidContent:t,emitUpdate:n=!0,parseOptions:r={}}={})=>({editor:o,tr:i,dispatch:s,commands:a})=>{const{doc:l}=i;if("full"!==r.preserveWhitespace){const a=Zs(e,o.schema,r,{errorOnInvalidContent:null!=t?t:o.options.enableContentCheck});return s&&i.replaceWith(0,l.content.size,a).setMeta("preventUpdate",!n),!0}return s&&i.setMeta("preventUpdate",!n),a.insertContentAt({from:0,to:l.content.size},e,{parseOptions:r,errorOnInvalidContent:null!=t?t:o.options.enableContentCheck})};var ql=(e,t={})=>({tr:n,state:r,dispatch:o})=>{const{selection:i}=n,{empty:s,ranges:a}=i,l=ga(e,r.schema);if(o)if(s){const e=ya(r,l);n.addStoredMark(l.create({...e,...t}))}else a.forEach((e=>{const o=e.$from.pos,i=e.$to.pos;r.doc.nodesBetween(o,i,((e,r)=>{const s=Math.max(r,o),a=Math.min(r+e.nodeSize,i);e.marks.find((e=>e.type===l))?e.marks.forEach((e=>{l===e.type&&n.addMark(s,a,l.create({...e.attrs,...t}))})):n.addMark(s,a,l.create(t))}))}));return function(e,t,n){var r;const{selection:o}=t;let i=null;if(Ba(o)&&(i=o.$cursor),i){const t=null!=(r=e.storedMarks)?r:i.marks();return!!n.isInSet(t)||!t.some((e=>e.type.excludes(n)))}const{ranges:s}=o;return s.some((({$from:t,$to:r})=>{let o=0===t.depth&&e.doc.inlineContent&&e.doc.type.allowsMarkType(n);return e.doc.nodesBetween(t.pos,r.pos,((e,t,r)=>{if(o)return!1;if(e.isInline){const t=!r||r.type.allowsMarkType(n),i=!!n.isInSet(e.marks)||!e.marks.some((e=>e.type.excludes(n)));o=t&&i}return!o})),o}))}(r,n,l)},Wl=(e,t)=>({tr:n})=>(n.setMeta(e,t),!0),Kl=(e,t={})=>({state:n,dispatch:r,chain:o})=>{const i=va(e,n.schema);let s;return n.selection.$anchor.sameParent(n.selection.$head)&&(s=n.selection.$anchor.parent.attrs),i.isTextblock?o().command((({commands:e})=>!!js(i,{...s,...t})(n)||e.clearNodes())).command((({state:e})=>js(i,{...s,...t})(e,r))).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},Jl=e=>({tr:t,dispatch:n})=>{if(n){const{doc:n}=t,r=$a(e,0,n.content.size),o=On.create(n,r);t.setSelection(o)}return!0},Ul=e=>({tr:t,dispatch:n})=>{if(n){const{doc:n}=t,{from:r,to:o}="number"==typeof e?{from:e,to:e}:e,i=Mn.atStart(n).from,s=Mn.atEnd(n).to,a=$a(r,i,s),l=$a(o,i,s),c=Mn.create(n,a,l);t.setSelection(c)}return!0},Gl=e=>({state:t,dispatch:n})=>{const r=va(e,t.schema);return(o=r,function(e,t){let{$from:n,$to:r}=e.selection,i=n.blockRange(r,(e=>e.childCount>0&&e.firstChild.type==o));if(!i)return!1;let s=i.startIndex;if(0==s)return!1;let a=i.parent,l=a.child(s-1);if(l.type!=o)return!1;if(t){let n=l.lastChild&&l.lastChild.type==a.type,r=Se.from(n?o.create():null),s=new De(Se.from(o.create(null,Se.from(a.type.create(null,r)))),n?3:1,0),c=i.start,d=i.end;t(e.tr.step(new Kt(c-(n?3:1),d,c,d,s,1,!0)).scrollIntoView())}return!0})(t,n);var o};function Yl(e,t){const n=e.storedMarks||e.selection.$to.parentOffset&&e.selection.$from.marks();if(n){const r=n.filter((e=>null==t?void 0:t.includes(e.type.name)));e.tr.ensureMarks(r)}}var Xl=({keepMarks:e=!0}={})=>({tr:t,state:n,dispatch:r,editor:o})=>{const{selection:i,doc:s}=t,{$from:a,$to:l}=i,c=Aa(o.extensionManager.attributes,a.node().type.name,a.node().attrs);if(i instanceof On&&i.node.isBlock)return!(!a.parentOffset||!tn(s,a.pos))&&(r&&(e&&Yl(n,o.extensionManager.splittableMarks),t.split(a.pos).scrollIntoView()),!0);if(!a.parent.isBlock)return!1;const d=l.parentOffset===l.parent.content.size,h=0===a.depth?void 0:function(e){for(let t=0;t<e.edgeCount;t+=1){const{type:n}=e.edge(t);if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}(a.node(-1).contentMatchAt(a.indexAfter(-1)));let u=d&&h?[{type:h,attrs:c}]:void 0,p=tn(t.doc,t.mapping.map(a.pos),1,u);if(u||p||!tn(t.doc,t.mapping.map(a.pos),1,h?[{type:h}]:void 0)||(p=!0,u=h?[{type:h,attrs:c}]:void 0),r){if(p&&(i instanceof Mn&&t.deleteSelection(),t.split(t.mapping.map(a.pos),1,u),h&&!d&&!a.parentOffset&&a.parent.type!==h)){const e=t.mapping.map(a.before()),n=t.doc.resolve(e);a.node(-1).canReplaceWith(n.index(),n.index()+1,h)&&t.setNodeMarkup(t.mapping.map(a.before()),h)}e&&Yl(n,o.extensionManager.splittableMarks),t.scrollIntoView()}return p},Ql=(e,t={})=>({tr:n,state:r,dispatch:o,editor:i})=>{var s;const a=va(e,r.schema),{$from:l,$to:c}=r.selection,d=r.selection.node;if(d&&d.isBlock||l.depth<2||!l.sameParent(c))return!1;const h=l.node(-1);if(h.type!==a)return!1;const u=i.extensionManager.attributes;if(0===l.parent.content.size&&l.node(-1).childCount===l.indexAfter(-1)){if(2===l.depth||l.node(-3).type!==a||l.index(-2)!==l.node(-2).childCount-1)return!1;if(o){let e=Se.empty;const r=l.index(-1)?1:l.index(-2)?2:3;for(let t=l.depth-r;t>=l.depth-3;t-=1)e=Se.from(l.node(t).copy(e));const o=l.indexAfter(-1)<l.node(-2).childCount?1:l.indexAfter(-2)<l.node(-3).childCount?2:3,i={...Aa(u,l.node().type.name,l.node().attrs),...t},c=(null==(s=a.contentMatch.defaultType)?void 0:s.createAndFill(i))||void 0;e=e.append(Se.from(a.createAndFill(null,c)||void 0));const d=l.before(l.depth-(r-1));n.replace(d,l.after(-o),new De(e,4-r,0));let h=-1;n.doc.nodesBetween(d,n.doc.content.size,((e,t)=>{if(h>-1)return!1;e.isTextblock&&0===e.content.size&&(h=t+1)})),h>-1&&n.setSelection(Mn.near(n.doc.resolve(h))),n.scrollIntoView()}return!0}const p=c.pos===l.end()?h.contentMatchAt(0).defaultType:null,f={...Aa(u,h.type.name,h.attrs),...t},m={...Aa(u,l.node().type.name,l.node().attrs),...t};n.delete(l.pos,c.pos);const g=p?[{type:a,attrs:f},{type:p,attrs:m}]:[{type:a,attrs:f}];if(!tn(n.doc,l.pos,2))return!1;if(o){const{selection:e,storedMarks:t}=r,{splittableMarks:s}=i.extensionManager,a=t||e.$to.parentOffset&&e.$from.marks();if(n.split(l.pos,2,g).scrollIntoView(),!a||!o)return!0;const c=a.filter((e=>s.includes(e.type.name)));n.ensureMarks(c)}return!0},Zl=(e,t)=>{const n=ea((e=>e.type===t))(e.selection);if(!n)return!0;const r=e.doc.resolve(Math.max(0,n.pos-1)).before(n.depth);if(void 0===r)return!0;const o=e.doc.nodeAt(r);return n.node.type!==(null==o?void 0:o.type)||!nn(e.doc,n.pos)||(e.join(n.pos),!0)},ec=(e,t)=>{const n=ea((e=>e.type===t))(e.selection);if(!n)return!0;const r=e.doc.resolve(n.start).after(n.depth);if(void 0===r)return!0;const o=e.doc.nodeAt(r);return n.node.type!==(null==o?void 0:o.type)||!nn(e.doc,r)||(e.join(r),!0)},tc=(e,t,n,r={})=>({editor:o,tr:i,state:s,dispatch:a,chain:l,commands:c,can:d})=>{const{extensions:h,splittableMarks:u}=o.extensionManager,p=va(e,s.schema),f=va(t,s.schema),{selection:m,storedMarks:g}=s,{$from:y,$to:v}=m,b=y.blockRange(v),x=g||m.$to.parentOffset&&m.$from.marks();if(!b)return!1;const w=ea((e=>Ia(e.type.name,h)))(m);if(b.depth>=1&&w&&b.depth-w.depth<=1){if(w.node.type===p)return c.liftListItem(f);if(Ia(w.node.type.name,h)&&p.validContent(w.node.content)&&a)return l().command((()=>(i.setNodeMarkup(w.pos,p),!0))).command((()=>Zl(i,p))).command((()=>ec(i,p))).run()}return n&&x&&a?l().command((()=>{const e=d().wrapInList(p,r),t=x.filter((e=>u.includes(e.type.name)));return i.ensureMarks(t),!!e||c.clearNodes()})).wrapInList(p,r).command((()=>Zl(i,p))).command((()=>ec(i,p))).run():l().command((()=>!!d().wrapInList(p,r)||c.clearNodes())).wrapInList(p,r).command((()=>Zl(i,p))).command((()=>ec(i,p))).run()},nc=(e,t={},n={})=>({state:r,commands:o})=>{const{extendEmptyMarkRange:i=!1}=n,s=ga(e,r.schema);return Da(r,s,t)?o.unsetMark(s,{extendEmptyMarkRange:i}):o.setMark(s,t)},rc=(e,t,n={})=>({state:r,commands:o})=>{const i=va(e,r.schema),s=va(t,r.schema),a=Ra(r,i,n);let l;return r.selection.$anchor.sameParent(r.selection.$head)&&(l=r.selection.$anchor.parent.attrs),a?o.setNode(s,l):o.setNode(i,{...l,...n})},oc=(e,t={})=>({state:n,commands:r})=>{const o=va(e,n.schema);return Ra(n,o,t)?r.lift(o):r.wrapIn(o,t)},ic=()=>({state:e,dispatch:t})=>{const n=e.plugins;for(let r=0;r<n.length;r+=1){const o=n[r];let i;if(o.spec.isInputRules&&(i=o.getState(e))){if(t){const t=e.tr,n=i.transform;for(let e=n.steps.length-1;e>=0;e-=1)t.step(n.steps[e].invert(n.docs[e]));if(i.text){const n=t.doc.resolve(i.from).marks();t.replaceWith(i.from,i.to,e.schema.text(i.text,n))}else t.delete(i.from,i.to)}return!0}}return!1},sc=()=>({tr:e,dispatch:t})=>{const{selection:n}=e,{empty:r,ranges:o}=n;return r||t&&o.forEach((t=>{e.removeMark(t.$from.pos,t.$to.pos)})),!0},ac=(e,t={})=>({tr:n,state:r,dispatch:o})=>{var i;const{extendEmptyMarkRange:s=!1}=t,{selection:a}=n,l=ga(e,r.schema),{$from:c,empty:d,ranges:h}=a;if(!o)return!0;if(d&&s){let{from:e,to:t}=a;const r=null==(i=c.marks().find((e=>e.type===l)))?void 0:i.attrs,o=Ta(c,l,r);o&&(e=o.from,t=o.to),n.removeMark(e,t,l)}else h.forEach((e=>{n.removeMark(e.$from.pos,e.$to.pos,l)}));return n.removeStoredMark(l),!0},lc=(e,t={})=>({tr:n,state:r,dispatch:o})=>{let i=null,s=null;const a=ba("string"==typeof e?e:e.name,r.schema);return!!a&&("node"===a&&(i=va(e,r.schema)),"mark"===a&&(s=ga(e,r.schema)),o&&n.selection.ranges.forEach((e=>{const o=e.$from.pos,a=e.$to.pos;let l,c,d,h;n.selection.empty?r.doc.nodesBetween(o,a,((e,t)=>{i&&i===e.type&&(d=Math.max(t,o),h=Math.min(t+e.nodeSize,a),l=t,c=e)})):r.doc.nodesBetween(o,a,((e,r)=>{r<o&&i&&i===e.type&&(d=Math.max(r,o),h=Math.min(r+e.nodeSize,a),l=r,c=e),r>=o&&r<=a&&(i&&i===e.type&&n.setNodeMarkup(r,void 0,{...e.attrs,...t}),s&&e.marks.length&&e.marks.forEach((i=>{if(s===i.type){const l=Math.max(r,o),c=Math.min(r+e.nodeSize,a);n.addMark(l,c,s.create({...i.attrs,...t}))}})))})),c&&(void 0!==l&&n.setNodeMarkup(l,void 0,{...c.attrs,...t}),s&&c.marks.length&&c.marks.forEach((e=>{s===e.type&&n.addMark(d,h,s.create({...e.attrs,...t}))})))})),!0)},cc=(e,t={})=>({state:n,dispatch:r})=>function(e,t=null){return function(n,r){let{$from:o,$to:i}=n.selection,s=o.blockRange(i),a=s&&Xt(s,e,t);return!!a&&(r&&r(n.tr.wrap(s,a).scrollIntoView()),!0)}}(va(e,n.schema),t)(n,r),dc=(e,t={})=>({state:n,dispatch:r})=>Hs(va(e,n.schema),t)(n,r),hc=Qa.create({name:"commands",addCommands:()=>({...el})}),uc=Qa.create({name:"delete",onUpdate({transaction:e,appendedTransactions:t}){var n,r,o;const i=()=>{var n,r,o,i;if(null!=(i=null==(o=null==(r=null==(n=this.editor.options.coreExtensionOptions)?void 0:n.delete)?void 0:r.filterTransaction)?void 0:o.call(r,e))?i:e.getMeta("y-sync$"))return;const s=Gs(e.before,[e,...t]);ka(s).forEach((t=>{s.mapping.mapResult(t.oldRange.from).deletedAfter&&s.mapping.mapResult(t.oldRange.to).deletedBefore&&s.before.nodesBetween(t.oldRange.from,t.oldRange.to,((n,r)=>{const o=r+n.nodeSize-2,i=t.oldRange.from<=r&&o<=t.oldRange.to;this.editor.emit("delete",{type:"node",node:n,from:r,to:o,newFrom:s.mapping.map(r),newTo:s.mapping.map(o),deletedRange:t.oldRange,newRange:t.newRange,partial:!i,editor:this.editor,transaction:e,combinedTransform:s})}))}));const a=s.mapping;s.steps.forEach(((t,n)=>{var r,o;if(t instanceof Ht){const i=a.slice(n).map(t.from,-1),l=a.slice(n).map(t.to),c=a.invert().map(i,-1),d=a.invert().map(l),h=null==(r=s.doc.nodeAt(i-1))?void 0:r.marks.some((e=>e.eq(t.mark))),u=null==(o=s.doc.nodeAt(l))?void 0:o.marks.some((e=>e.eq(t.mark)));this.editor.emit("delete",{type:"mark",mark:t.mark,from:t.from,to:t.to,deletedRange:{from:c,to:d},newRange:{from:i,to:l},partial:Boolean(u||h),editor:this.editor,transaction:e,combinedTransform:s})}}))};null==(o=null==(r=null==(n=this.editor.options.coreExtensionOptions)?void 0:n.delete)?void 0:r.async)||o?setTimeout(i,0):i()}}),pc=Qa.create({name:"drop",addProseMirrorPlugins(){return[new Fn({key:new qn("tiptapDrop"),props:{handleDrop:(e,t,n,r)=>{this.editor.emit("drop",{editor:this.editor,event:t,slice:n,moved:r})}}})]}}),fc=Qa.create({name:"editable",addProseMirrorPlugins(){return[new Fn({key:new qn("editable"),props:{editable:()=>this.editor.options.editable}})]}}),mc=new qn("focusEvents"),gc=Qa.create({name:"focusEvents",addProseMirrorPlugins(){const{editor:e}=this;return[new Fn({key:mc,props:{handleDOMEvents:{focus:(t,n)=>{e.isFocused=!0;const r=e.state.tr.setMeta("focus",{event:n}).setMeta("addToHistory",!1);return t.dispatch(r),!1},blur:(t,n)=>{e.isFocused=!1;const r=e.state.tr.setMeta("blur",{event:n}).setMeta("addToHistory",!1);return t.dispatch(r),!1}}}})]}}),yc=Qa.create({name:"keymap",addKeyboardShortcuts(){const e=()=>this.editor.commands.first((({commands:e})=>[()=>e.undoInputRule(),()=>e.command((({tr:t})=>{const{selection:n,doc:r}=t,{empty:o,$anchor:i}=n,{pos:s,parent:a}=i,l=i.parent.isTextblock&&s>0?t.doc.resolve(s-1):i,c=l.parent.type.spec.isolating,d=i.pos-i.parentOffset,h=c&&1===l.parent.childCount?d===i.pos:kn.atStart(r).from===s;return!(!o||!a.type.isTextblock||a.textContent.length||!h||h&&"paragraph"===i.parent.type.name)&&e.clearNodes()})),()=>e.deleteSelection(),()=>e.joinBackward(),()=>e.selectNodeBackward()])),t=()=>this.editor.commands.first((({commands:e})=>[()=>e.deleteSelection(),()=>e.deleteCurrentNode(),()=>e.joinForward(),()=>e.selectNodeForward()])),n={Enter:()=>this.editor.commands.first((({commands:e})=>[()=>e.newlineInCode(),()=>e.createParagraphNear(),()=>e.liftEmptyBlock(),()=>e.splitBlock()])),"Mod-Enter":()=>this.editor.commands.exitCode(),Backspace:e,"Mod-Backspace":e,"Shift-Backspace":e,Delete:t,"Mod-Delete":t,"Mod-a":()=>this.editor.commands.selectAll()},r={...n},o={...n,"Ctrl-h":e,"Alt-Backspace":e,"Ctrl-d":t,"Ctrl-Alt-Backspace":t,"Alt-Delete":t,"Alt-d":t,"Ctrl-a":()=>this.editor.commands.selectTextblockStart(),"Ctrl-e":()=>this.editor.commands.selectTextblockEnd()};return ml()||Ol()?o:r},addProseMirrorPlugins(){return[new Fn({key:new qn("clearDocument"),appendTransaction:(e,t,n)=>{if(e.some((e=>e.getMeta("composition"))))return;const r=e.some((e=>e.docChanged))&&!t.doc.eq(n.doc),o=e.some((e=>e.getMeta("preventClearDocument")));if(!r||o)return;const{empty:i,from:s,to:a}=t.selection,l=kn.atStart(t.doc).from,c=kn.atEnd(t.doc).to;if(i||!(s===l&&a===c))return;if(!za(n.doc))return;const d=n.tr,h=Ks({state:n,transaction:d}),{commands:u}=new Js({editor:this.editor,state:h});return u.clearNodes(),d.steps.length?d:void 0}})]}}),vc=Qa.create({name:"paste",addProseMirrorPlugins(){return[new Fn({key:new qn("tiptapPaste"),props:{handlePaste:(e,t,n)=>{this.editor.emit("paste",{editor:this.editor,event:t,slice:n})}}})]}}),bc=Qa.create({name:"tabindex",addProseMirrorPlugins(){return[new Fn({key:new qn("tabindex"),props:{attributes:()=>this.editor.isEditable?{tabindex:"0"}:{}}})]}}),xc=class e{constructor(e,t,n=!1,r=null){this.currentNode=null,this.actualDepth=null,this.isBlock=n,this.resolvedPos=e,this.editor=t,this.currentNode=r}get name(){return this.node.type.name}get node(){return this.currentNode||this.resolvedPos.node()}get element(){return this.editor.view.domAtPos(this.pos).node}get depth(){var e;return null!=(e=this.actualDepth)?e:this.resolvedPos.depth}get pos(){return this.resolvedPos.pos}get content(){return this.node.content}set content(e){let t=this.from,n=this.to;if(this.isBlock){if(0===this.content.size)return void console.error(`You can’t set content on a block node. Tried to set content on ${this.name} at ${this.pos}`);t=this.from+1,n=this.to-1}this.editor.commands.insertContentAt({from:t,to:n},e)}get attributes(){return this.node.attrs}get textContent(){return this.node.textContent}get size(){return this.node.nodeSize}get from(){return this.isBlock?this.pos:this.resolvedPos.start(this.resolvedPos.depth)}get range(){return{from:this.from,to:this.to}}get to(){return this.isBlock?this.pos+this.size:this.resolvedPos.end(this.resolvedPos.depth)+(this.node.isText?0:1)}get parent(){if(0===this.depth)return null;const t=this.resolvedPos.start(this.resolvedPos.depth-1),n=this.resolvedPos.doc.resolve(t);return new e(n,this.editor)}get before(){let t=this.resolvedPos.doc.resolve(this.from-(this.isBlock?1:2));return t.depth!==this.depth&&(t=this.resolvedPos.doc.resolve(this.from-3)),new e(t,this.editor)}get after(){let t=this.resolvedPos.doc.resolve(this.to+(this.isBlock?2:1));return t.depth!==this.depth&&(t=this.resolvedPos.doc.resolve(this.to+3)),new e(t,this.editor)}get children(){const t=[];return this.node.content.forEach(((n,r)=>{const o=n.isBlock&&!n.isTextblock,i=n.isAtom&&!n.isText,s=this.pos+r+(i?0:1);if(s<0||s>this.resolvedPos.doc.nodeSize-2)return;const a=this.resolvedPos.doc.resolve(s);if(!o&&a.depth<=this.depth)return;const l=new e(a,this.editor,o,o?n:null);o&&(l.actualDepth=this.depth+1),t.push(new e(a,this.editor,o,o?n:null))})),t}get firstChild(){return this.children[0]||null}get lastChild(){const e=this.children;return e[e.length-1]||null}closest(e,t={}){let n=null,r=this.parent;for(;r&&!n;){if(r.node.type.name===e)if(Object.keys(t).length>0){const e=r.node.attrs,n=Object.keys(t);for(let r=0;r<n.length;r+=1){const o=n[r];if(e[o]!==t[o])break}}else n=r;r=r.parent}return n}querySelector(e,t={}){return this.querySelectorAll(e,t,!0)[0]||null}querySelectorAll(e,t={},n=!1){let r=[];if(!this.children||0===this.children.length)return r;const o=Object.keys(t);return this.children.forEach((i=>{if(!(n&&r.length>0)){if(i.node.type.name===e){o.every((e=>t[e]===i.node.attrs[e]))&&r.push(i)}n&&r.length>0||(r=r.concat(i.querySelectorAll(e,t,n)))}})),r}setAttribute(e){const{tr:t}=this.editor.state;t.setNodeMarkup(this.from,void 0,{...this.node.attrs,...e}),this.editor.view.dispatch(t)}};var wc=class extends Us{constructor(e={}){super(),this.css=null,this.editorView=null,this.isFocused=!1,this.isInitialized=!1,this.extensionStorage={},this.instanceId=Math.random().toString(36).slice(2,9),this.options={element:"undefined"!=typeof document?document.createElement("div"):null,content:"",injectCSS:!0,injectNonce:void 0,extensions:[],autofocus:!1,editable:!0,editorProps:{},parseOptions:{},coreExtensionOptions:{},enableInputRules:!0,enablePasteRules:!0,enableCoreExtensions:!0,enableContentCheck:!1,emitContentError:!1,onBeforeCreate:()=>null,onCreate:()=>null,onUpdate:()=>null,onSelectionUpdate:()=>null,onTransaction:()=>null,onFocus:()=>null,onBlur:()=>null,onDestroy:()=>null,onContentError:({error:e})=>{throw e},onPaste:()=>null,onDrop:()=>null,onDelete:()=>null},this.isCapturingTransaction=!1,this.capturedTransaction=null,this.setOptions(e),this.createExtensionManager(),this.createCommandManager(),this.createSchema(),this.on("beforeCreate",this.options.onBeforeCreate),this.emit("beforeCreate",{editor:this}),this.on("contentError",this.options.onContentError),this.on("create",this.options.onCreate),this.on("update",this.options.onUpdate),this.on("selectionUpdate",this.options.onSelectionUpdate),this.on("transaction",this.options.onTransaction),this.on("focus",this.options.onFocus),this.on("blur",this.options.onBlur),this.on("destroy",this.options.onDestroy),this.on("drop",(({event:e,slice:t,moved:n})=>this.options.onDrop(e,t,n))),this.on("paste",(({event:e,slice:t})=>this.options.onPaste(e,t))),this.on("delete",this.options.onDelete);const t=this.createDoc(),n=Va(t,this.options.autofocus);this.editorState=Vn.create({doc:t,schema:this.schema,selection:n||void 0}),this.options.element&&this.mount(this.options.element)}mount(e){if("undefined"==typeof document)throw new Error("[tiptap error]: The editor cannot be mounted because there is no 'document' defined in this environment.");this.createView(e),window.setTimeout((()=>{this.isDestroyed||(this.commands.focus(this.options.autofocus),this.emit("create",{editor:this}),this.isInitialized=!0)}),0)}unmount(){var e;if(this.editorView){const e=this.editorView.dom;(null==e?void 0:e.editor)&&delete e.editor,this.editorView.destroy()}this.editorView=null,this.isInitialized=!1,null==(e=this.css)||e.remove(),this.css=null}get storage(){return this.extensionStorage}get commands(){return this.commandManager.commands}chain(){return this.commandManager.chain()}can(){return this.commandManager.can()}injectCSS(){this.options.injectCSS&&"undefined"!=typeof document&&(this.css=function(e,t){const n=document.querySelector("style[data-tiptap-style]");if(null!==n)return n;const r=document.createElement("style");return t&&r.setAttribute("nonce",t),r.setAttribute("data-tiptap-style",""),r.innerHTML=e,document.getElementsByTagName("head")[0].appendChild(r),r}('.ProseMirror {\n position: relative;\n}\n\n.ProseMirror {\n word-wrap: break-word;\n white-space: pre-wrap;\n white-space: break-spaces;\n -webkit-font-variant-ligatures: none;\n font-variant-ligatures: none;\n font-feature-settings: "liga" 0; /* the above doesn\'t seem to work in Edge */\n}\n\n.ProseMirror [contenteditable="false"] {\n white-space: normal;\n}\n\n.ProseMirror [contenteditable="false"] [contenteditable="true"] {\n white-space: pre-wrap;\n}\n\n.ProseMirror pre {\n white-space: pre-wrap;\n}\n\nimg.ProseMirror-separator {\n display: inline !important;\n border: none !important;\n margin: 0 !important;\n width: 0 !important;\n height: 0 !important;\n}\n\n.ProseMirror-gapcursor {\n display: none;\n pointer-events: none;\n position: absolute;\n margin: 0;\n}\n\n.ProseMirror-gapcursor:after {\n content: "";\n display: block;\n position: absolute;\n top: -2px;\n width: 20px;\n border-top: 1px solid black;\n animation: ProseMirror-cursor-blink 1.1s steps(2, start) infinite;\n}\n\n@keyframes ProseMirror-cursor-blink {\n to {\n visibility: hidden;\n }\n}\n\n.ProseMirror-hideselection *::selection {\n background: transparent;\n}\n\n.ProseMirror-hideselection *::-moz-selection {\n background: transparent;\n}\n\n.ProseMirror-hideselection * {\n caret-color: transparent;\n}\n\n.ProseMirror-focused .ProseMirror-gapcursor {\n display: block;\n}',this.options.injectNonce))}setOptions(e={}){this.options={...this.options,...e},this.editorView&&this.state&&!this.isDestroyed&&(this.options.editorProps&&this.view.setProps(this.options.editorProps),this.view.updateState(this.state))}setEditable(e,t=!0){this.setOptions({editable:e}),t&&this.emit("update",{editor:this,transaction:this.state.tr,appendedTransactions:[]})}get isEditable(){return this.options.editable&&this.view&&this.view.editable}get view(){return this.editorView?this.editorView:new Proxy({state:this.editorState,updateState:e=>{this.editorState=e},dispatch:e=>{this.editorState=this.state.apply(e)},composing:!1,dragging:null,editable:!0,isDestroyed:!1},{get:(e,t)=>{if("state"===t)return this.editorState;if(t in e)return Reflect.get(e,t);throw new Error(`[tiptap error]: The editor view is not available. Cannot access view['${t}']. The editor may not be mounted yet.`)}})}get state(){return this.editorView&&(this.editorState=this.view.state),this.editorState}registerPlugin(e,t){const n=oa(t)?t(e,[...this.state.plugins]):[...this.state.plugins,e],r=this.state.reconfigure({plugins:n});return this.view.updateState(r),r}unregisterPlugin(e){if(this.isDestroyed)return;const t=this.state.plugins;let n=t;if([].concat(e).forEach((e=>{const t="string"==typeof e?`${e}$`:e.key;n=n.filter((e=>!e.key.startsWith(t)))})),t.length===n.length)return;const r=this.state.reconfigure({plugins:n});return this.view.updateState(r),r}createExtensionManager(){var e,t;const n=[...this.options.enableCoreExtensions?[fc,Za.configure({blockSeparator:null==(t=null==(e=this.options.coreExtensionOptions)?void 0:e.clipboardTextSerializer)?void 0:t.blockSeparator}),hc,gc,yc,bc,pc,vc,uc].filter((e=>"object"!=typeof this.options.enableCoreExtensions||!1!==this.options.enableCoreExtensions[e.name])):[],...this.options.extensions].filter((e=>["extension","node","mark"].includes(null==e?void 0:e.type)));this.extensionManager=new Xa(n,this)}createCommandManager(){this.commandManager=new Js({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createDoc(){let e;try{e=Zs(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:this.options.enableContentCheck})}catch(t){if(!(t instanceof Error&&["[tiptap error]: Invalid JSON content","[tiptap error]: Invalid HTML content"].includes(t.message)))throw t;this.emit("contentError",{editor:this,error:t,disableCollaboration:()=>{"collaboration"in this.storage&&"object"==typeof this.storage.collaboration&&this.storage.collaboration&&(this.storage.collaboration.isDisabled=!0),this.options.extensions=this.options.extensions.filter((e=>"collaboration"!==e.name)),this.createExtensionManager()}}),e=Zs(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:!1})}return e}createView(e){var t;this.editorView=new ns(e,{...this.options.editorProps,attributes:{role:"textbox",...null==(t=this.options.editorProps)?void 0:t.attributes},dispatchTransaction:this.dispatchTransaction.bind(this),state:this.editorState});const n=this.state.reconfigure({plugins:this.extensionManager.plugins});this.view.updateState(n),this.createNodeViews(),this.prependClass(),this.injectCSS();this.view.dom.editor=this}createNodeViews(){this.view.isDestroyed||this.view.setProps({markViews:this.extensionManager.markViews,nodeViews:this.extensionManager.nodeViews})}prependClass(){this.view.dom.className=`tiptap ${this.view.dom.className}`}captureTransaction(e){this.isCapturingTransaction=!0,e(),this.isCapturingTransaction=!1;const t=this.capturedTransaction;return this.capturedTransaction=null,t}dispatchTransaction(e){if(this.view.isDestroyed)return;if(this.isCapturingTransaction)return this.capturedTransaction?void e.steps.forEach((e=>{var t;return null==(t=this.capturedTransaction)?void 0:t.step(e)})):void(this.capturedTransaction=e);const{state:t,transactions:n}=this.state.applyTransaction(e),r=!this.state.selection.eq(t.selection),o=n.includes(e),i=this.state;if(this.emit("beforeTransaction",{editor:this,transaction:e,nextState:t}),!o)return;this.view.updateState(t),this.emit("transaction",{editor:this,transaction:e,appendedTransactions:n.slice(1)}),r&&this.emit("selectionUpdate",{editor:this,transaction:e});const s=n.findLast((e=>e.getMeta("focus")||e.getMeta("blur"))),a=null==s?void 0:s.getMeta("focus"),l=null==s?void 0:s.getMeta("blur");a&&this.emit("focus",{editor:this,event:a.event,transaction:s}),l&&this.emit("blur",{editor:this,event:l.event,transaction:s}),e.getMeta("preventUpdate")||!n.some((e=>e.docChanged))||i.doc.eq(t.doc)||this.emit("update",{editor:this,transaction:e,appendedTransactions:n.slice(1)})}getAttributes(e){return xa(this.state,e)}isActive(e,t){const n="string"==typeof e?e:null,r="string"==typeof e?t:e;return function(e,t,n={}){if(!t)return Ra(e,null,n)||Da(e,null,n);const r=ba(t,e.schema);return"node"===r?Ra(e,t,n):"mark"===r&&Da(e,t,n)}(this.state,n,r)}getJSON(){return this.state.doc.toJSON()}getHTML(){return ra(this.state.doc.content,this.schema)}getText(e){const{blockSeparator:t="\n\n",textSerializers:n={}}=e||{};return function(e,t){return fa(e,{from:0,to:e.content.size},t)}(this.state.doc,{blockSeparator:t,textSerializers:{...ma(this.schema),...n}})}get isEmpty(){return za(this.state.doc)}destroy(){this.emit("destroy"),this.unmount(),this.removeAllListeners()}get isDestroyed(){var e,t;return null==(t=null==(e=this.editorView)?void 0:e.isDestroyed)||t}$node(e,t){var n;return(null==(n=this.$doc)?void 0:n.querySelector(e,t))||null}$nodes(e,t){var n;return(null==(n=this.$doc)?void 0:n.querySelectorAll(e,t))||null}$pos(e){const t=this.state.doc.resolve(e);return new xc(t,this)}get $doc(){return this.$pos(0)}};function kc(e){return new ja({find:e.find,handler:({state:t,range:n,match:r})=>{const o=ia(e.getAttributes,void 0,r);if(!1===o||null===o)return null;const{tr:i}=t,s=r[r.length-1],a=r[0];if(s){const r=a.search(/\S/),l=n.from+a.indexOf(s),c=l+s.length;if(Oa(n.from,n.to,t.doc).filter((t=>t.mark.type.excluded.find((n=>n===e.type&&n!==t.mark.type)))).filter((e=>e.to>l)).length)return null;c<n.to&&i.delete(c,n.to),l>n.from&&i.delete(n.from+r,l);const d=n.from+r+s.length;i.addMark(n.from+r,d,e.type.create(o||{})),i.removeStoredMark(e.type)}}})}function Cc(e){return new ja({find:e.find,handler:({state:t,range:n,match:r})=>{const o=t.doc.resolve(n.from),i=ia(e.getAttributes,void 0,r)||{};if(!o.node(-1).canReplaceWith(o.index(-1),o.indexAfter(-1),e.type))return null;t.tr.delete(n.from,n.to).setBlockType(n.from,n.from,e.type,i)}})}function Nc(e){return new ja({find:e.find,handler:({state:t,range:n,match:r,chain:o})=>{const i=ia(e.getAttributes,void 0,r)||{},s=t.tr.delete(n.from,n.to),a=s.doc.resolve(n.from).blockRange(),l=a&&Xt(a,e.type,i);if(!l)return null;if(s.wrap(a,l),e.keepMarks&&e.editor){const{selection:n,storedMarks:r}=t,{splittableMarks:o}=e.editor.extensionManager,i=r||n.$to.parentOffset&&n.$from.marks();if(i){const e=i.filter((e=>o.includes(e.type.name)));s.ensureMarks(e)}}if(e.keepAttributes){const t="bulletList"===e.type.name||"orderedList"===e.type.name?"listItem":"taskList";o().updateAttributes(t,i).run()}const c=s.doc.resolve(n.from-1).nodeBefore;c&&c.type===e.type&&nn(s.doc,n.from-1)&&(!e.joinPredicate||e.joinPredicate(r,c))&&s.join(n.from-1)}})}var Sc=class e extends Wa{constructor(){super(...arguments),this.type="node"}static create(t={}){const n="function"==typeof t?t():t;return new e(n)}configure(e){return super.configure(e)}extend(e){const t="function"==typeof e?e():e;return super.extend(t)}};function Mc(e){return new Ja({find:e.find,handler:({state:t,range:n,match:r,pasteEvent:o})=>{const i=ia(e.getAttributes,void 0,r,o);if(!1===i||null===i)return null;const{tr:s}=t,a=r[r.length-1],l=r[0];let c=n.to;if(a){const r=l.search(/\S/),o=n.from+l.indexOf(a),d=o+a.length;if(Oa(n.from,n.to,t.doc).filter((t=>t.mark.type.excluded.find((n=>n===e.type&&n!==t.mark.type)))).filter((e=>e.to>o)).length)return null;d<n.to&&s.delete(d,n.to),o>n.from&&s.delete(n.from+r,o),c=n.from+r+a.length,s.addMark(n.from+r,c,e.type.create(i||{})),s.removeStoredMark(e.type)}}})}var Tc=(e,t)=>{if("slot"===e)return 0;if(e instanceof Function)return e(t);const{children:n,...r}=null!=t?t:{};if("svg"===e)throw new Error("SVG elements are not supported in the JSX syntax, use the array syntax instead");return[e,r,n]},Oc=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,Ec=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,Ac=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,Dc=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,Rc=Ka.create({name:"bold",addOptions:()=>({HTMLAttributes:{}}),parseHTML(){return[{tag:"strong"},{tag:"b",getAttrs:e=>"normal"!==e.style.fontWeight&&null},{style:"font-weight=400",clearMark:e=>e.type.name===this.name},{style:"font-weight",getAttrs:e=>/^(bold(er)?|[5-9]\d{2,})$/.test(e)&&null}]},renderHTML({HTMLAttributes:e}){return Tc("strong",{...la(this.options.HTMLAttributes,e),children:Tc("slot",{})})},addCommands(){return{setBold:()=>({commands:e})=>e.setMark(this.name),toggleBold:()=>({commands:e})=>e.toggleMark(this.name),unsetBold:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-b":()=>this.editor.commands.toggleBold(),"Mod-B":()=>this.editor.commands.toggleBold()}},addInputRules(){return[kc({find:Oc,type:this.type}),kc({find:Ac,type:this.type})]},addPasteRules(){return[Mc({find:Ec,type:this.type}),Mc({find:Dc,type:this.type})]}}),Lc=Rc,Ic=Object.defineProperty,zc="textStyle",Pc=/^\s*([-+*])\s$/,Bc=Sc.create({name:"bulletList",addOptions:()=>({itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}),group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML:()=>[{tag:"ul"}],renderHTML({HTMLAttributes:e}){return["ul",la(this.options.HTMLAttributes,e),0]},addCommands(){return{toggleBulletList:()=>({commands:e,chain:t})=>this.options.keepAttributes?t().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes("listItem",this.editor.getAttributes(zc)).run():e.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let e=Nc({find:Pc,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(e=Nc({find:Pc,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(zc),editor:this.editor})),[e]}}),$c=Sc.create({name:"listItem",addOptions:()=>({HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}),content:"paragraph block*",defining:!0,parseHTML:()=>[{tag:"li"}],renderHTML({HTMLAttributes:e}){return["li",la(this.options.HTMLAttributes,e),0]},addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)}}});((e,t)=>{for(var n in t)Ic(e,n,{get:t[n],enumerable:!0})})({},{findListItemPos:()=>Vc,getNextListDepth:()=>jc,handleBackspace:()=>qc,handleDelete:()=>Jc,hasListBefore:()=>Fc,hasListItemAfter:()=>Uc,hasListItemBefore:()=>Hc,listItemHasSubList:()=>_c,nextListIsDeeper:()=>Wc,nextListIsHigher:()=>Kc});var Vc=(e,t)=>{const{$from:n}=t.selection,r=va(e,t.schema);let o=null,i=n.depth,s=n.pos,a=null;for(;i>0&&null===a;)o=n.node(i),o.type===r?a=i:(i-=1,s-=1);return null===a?null:{$pos:t.doc.resolve(s),depth:a}},jc=(e,t)=>{const n=Vc(e,t);if(!n)return!1;const[,r]=((e,t,n,r=20)=>{const o=e.doc.resolve(n);let i=r,s=null;for(;i>0&&null===s;){const e=o.node(i);(null==e?void 0:e.type.name)===t?s=e:i-=1}return[s,i]})(t,e,n.$pos.pos+4);return r},Fc=(e,t,n)=>{const{$anchor:r}=e.selection,o=Math.max(0,r.pos-2),i=e.doc.resolve(o).node();return!(!i||!n.includes(i.type.name))},Hc=(e,t)=>{var n;const{$anchor:r}=t.selection,o=t.doc.resolve(r.pos-2);return 0!==o.index()&&(null==(n=o.nodeBefore)?void 0:n.type.name)===e},_c=(e,t,n)=>{if(!n)return!1;const r=va(e,t.schema);let o=!1;return n.descendants((e=>{e.type===r&&(o=!0)})),o},qc=(e,t,n)=>{if(e.commands.undoInputRule())return!0;if(e.state.selection.from!==e.state.selection.to)return!1;if(!Ra(e.state,t)&&Fc(e.state,t,n)){const{$anchor:n}=e.state.selection,r=e.state.doc.resolve(n.before()-1),o=[];r.node().descendants(((e,n)=>{e.type.name===t&&o.push({node:e,pos:n})}));const i=o.at(-1);if(!i)return!1;const s=e.state.doc.resolve(r.start()+i.pos+1);return e.chain().cut({from:n.start()-1,to:n.end()+1},s.end()).joinForward().run()}if(!Ra(e.state,t))return!1;if(!(e=>{const{$from:t,$to:n}=e.selection;return!(t.parentOffset>0||t.pos!==n.pos)})(e.state))return!1;const r=Vc(t,e.state);if(!r)return!1;const o=e.state.doc.resolve(r.$pos.pos-2).node(r.depth),i=_c(t,e.state,o);return Hc(t,e.state)&&!i?e.commands.joinItemBackward():e.chain().liftListItem(t).run()},Wc=(e,t)=>{const n=jc(e,t),r=Vc(e,t);return!(!r||!n)&&n>r.depth},Kc=(e,t)=>{const n=jc(e,t),r=Vc(e,t);return!(!r||!n)&&n<r.depth},Jc=(e,t)=>{if(!Ra(e.state,t))return!1;if(!((e,t)=>{const{$from:n,$to:r,$anchor:o}=e.selection;if(t){const n=ea((e=>e.type.name===t))(e.selection);if(!n)return!1;const r=e.doc.resolve(n.pos+1);return o.pos+1===r.end()}return!(r.parentOffset<r.parent.nodeSize-2||n.pos!==r.pos)})(e.state,t))return!1;const{selection:n}=e.state,{$from:r,$to:o}=n;return!(!n.empty&&r.sameParent(o))&&(Wc(t,e.state)?e.chain().focus(e.state.selection.from+4).lift(t).joinBackward().run():Kc(t,e.state)?e.chain().joinForward().joinBackward().run():e.commands.joinItemForward())},Uc=(e,t)=>{var n;const{$anchor:r}=t.selection,o=t.doc.resolve(r.pos-r.parentOffset-2);return o.index()!==o.parent.childCount-1&&(null==(n=o.nodeAfter)?void 0:n.type.name)===e},Gc=Qa.create({name:"listKeymap",addOptions:()=>({listTypes:[{itemName:"listItem",wrapperNames:["bulletList","orderedList"]},{itemName:"taskItem",wrapperNames:["taskList"]}]}),addKeyboardShortcuts(){return{Delete:({editor:e})=>{let t=!1;return this.options.listTypes.forEach((({itemName:n})=>{void 0!==e.state.schema.nodes[n]&&Jc(e,n)&&(t=!0)})),t},"Mod-Delete":({editor:e})=>{let t=!1;return this.options.listTypes.forEach((({itemName:n})=>{void 0!==e.state.schema.nodes[n]&&Jc(e,n)&&(t=!0)})),t},Backspace:({editor:e})=>{let t=!1;return this.options.listTypes.forEach((({itemName:n,wrapperNames:r})=>{void 0!==e.state.schema.nodes[n]&&qc(e,n,r)&&(t=!0)})),t},"Mod-Backspace":({editor:e})=>{let t=!1;return this.options.listTypes.forEach((({itemName:n,wrapperNames:r})=>{void 0!==e.state.schema.nodes[n]&&qc(e,n,r)&&(t=!0)})),t}}}}),Yc="textStyle",Xc=/^(\d+)\.\s$/,Qc=Sc.create({name:"orderedList",addOptions:()=>({itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}),group:"block list",content(){return`${this.options.itemTypeName}+`},addAttributes:()=>({start:{default:1,parseHTML:e=>e.hasAttribute("start")?parseInt(e.getAttribute("start")||"",10):1},type:{default:null,parseHTML:e=>e.getAttribute("type")}}),parseHTML:()=>[{tag:"ol"}],renderHTML({HTMLAttributes:e}){const{start:t,...n}=e;return 1===t?["ol",la(this.options.HTMLAttributes,n),0]:["ol",la(this.options.HTMLAttributes,e),0]},addCommands(){return{toggleOrderedList:()=>({commands:e,chain:t})=>this.options.keepAttributes?t().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes("listItem",this.editor.getAttributes(Yc)).run():e.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let e=Nc({find:Xc,type:this.type,getAttributes:e=>({start:+e[1]}),joinPredicate:(e,t)=>t.childCount+t.attrs.start===+e[1]});return(this.options.keepMarks||this.options.keepAttributes)&&(e=Nc({find:Xc,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes(Yc)}),joinPredicate:(e,t)=>t.childCount+t.attrs.start===+e[1],editor:this.editor})),[e]}}),Zc=/^\s*(\[([( |x])?\])\s$/,ed=Sc.create({name:"taskItem",addOptions:()=>({nested:!1,HTMLAttributes:{},taskListTypeName:"taskList",a11y:void 0}),content(){return this.options.nested?"paragraph block*":"paragraph+"},defining:!0,addAttributes:()=>({checked:{default:!1,keepOnSplit:!1,parseHTML:e=>{const t=e.getAttribute("data-checked");return""===t||"true"===t},renderHTML:e=>({"data-checked":e.checked})}}),parseHTML(){return[{tag:`li[data-type="${this.name}"]`,priority:51}]},renderHTML({node:e,HTMLAttributes:t}){return["li",la(this.options.HTMLAttributes,t,{"data-type":this.name}),["label",["input",{type:"checkbox",checked:e.attrs.checked?"checked":null}],["span"]],["div",0]]},addKeyboardShortcuts(){const e={Enter:()=>this.editor.commands.splitListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)};return this.options.nested?{...e,Tab:()=>this.editor.commands.sinkListItem(this.name)}:e},addNodeView(){return({node:e,HTMLAttributes:t,getPos:n,editor:r})=>{const o=document.createElement("li"),i=document.createElement("label"),s=document.createElement("span"),a=document.createElement("input"),l=document.createElement("div"),c=()=>{var t,n;a.ariaLabel=(null==(n=null==(t=this.options.a11y)?void 0:t.checkboxLabel)?void 0:n.call(t,e,a.checked))||`Task item checkbox for ${e.textContent||"empty task item"}`};return c(),i.contentEditable="false",a.type="checkbox",a.addEventListener("mousedown",(e=>e.preventDefault())),a.addEventListener("change",(t=>{if(!r.isEditable&&!this.options.onReadOnlyChecked)return void(a.checked=!a.checked);const{checked:o}=t.target;r.isEditable&&"function"==typeof n&&r.chain().focus(void 0,{scrollIntoView:!1}).command((({tr:e})=>{const t=n();if("number"!=typeof t)return!1;const r=e.doc.nodeAt(t);return e.setNodeMarkup(t,void 0,{...null==r?void 0:r.attrs,checked:o}),!0})).run(),!r.isEditable&&this.options.onReadOnlyChecked&&(this.options.onReadOnlyChecked(e,o)||(a.checked=!a.checked))})),Object.entries(this.options.HTMLAttributes).forEach((([e,t])=>{o.setAttribute(e,t)})),o.dataset.checked=e.attrs.checked,a.checked=e.attrs.checked,i.append(a,s),o.append(i,l),Object.entries(t).forEach((([e,t])=>{o.setAttribute(e,t)})),{dom:o,contentDOM:l,update:e=>e.type===this.type&&(o.dataset.checked=e.attrs.checked,a.checked=e.attrs.checked,c(),!0)}}},addInputRules(){return[Nc({find:Zc,type:this.type,getAttributes:e=>({checked:"x"===e[e.length-1]})})]}}),td=Sc.create({name:"taskList",addOptions:()=>({itemTypeName:"taskItem",HTMLAttributes:{}}),group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:`ul[data-type="${this.name}"]`,priority:51}]},renderHTML({HTMLAttributes:e}){return["ul",la(this.options.HTMLAttributes,e,{"data-type":this.name}),0]},addCommands(){return{toggleTaskList:()=>({commands:e})=>e.toggleList(this.name,this.options.itemTypeName)}},addKeyboardShortcuts(){return{"Mod-Shift-9":()=>this.editor.commands.toggleTaskList()}}});Qa.create({name:"listKit",addExtensions(){const e=[];return!1!==this.options.bulletList&&e.push(Bc.configure(this.options.bulletList)),!1!==this.options.listItem&&e.push($c.configure(this.options.listItem)),!1!==this.options.listKeymap&&e.push(Gc.configure(this.options.listKeymap)),!1!==this.options.orderedList&&e.push(Qc.configure(this.options.orderedList)),!1!==this.options.taskItem&&e.push(ed.configure(this.options.taskItem)),!1!==this.options.taskList&&e.push(td.configure(this.options.taskList)),e}});var nd=Bc,rd=/(^|[^`])`([^`]+)`(?!`)/,od=/(^|[^`])`([^`]+)`(?!`)/g,id=Ka.create({name:"code",addOptions:()=>({HTMLAttributes:{}}),excludes:"_",code:!0,exitable:!0,parseHTML:()=>[{tag:"code"}],renderHTML({HTMLAttributes:e}){return["code",la(this.options.HTMLAttributes,e),0]},addCommands(){return{setCode:()=>({commands:e})=>e.setMark(this.name),toggleCode:()=>({commands:e})=>e.toggleMark(this.name),unsetCode:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-e":()=>this.editor.commands.toggleCode()}},addInputRules(){return[kc({find:rd,type:this.type})]},addPasteRules(){return[Mc({find:od,type:this.type})]}}),sd=id,ad=/^```([a-z]+)?[\s\n]$/,ld=/^~~~([a-z]+)?[\s\n]$/,cd=Sc.create({name:"codeBlock",addOptions:()=>({languageClassPrefix:"language-",exitOnTripleEnter:!0,exitOnArrowDown:!0,defaultLanguage:null,HTMLAttributes:{}}),content:"text*",marks:"",group:"block",code:!0,defining:!0,addAttributes(){return{language:{default:this.options.defaultLanguage,parseHTML:e=>{var t;const{languageClassPrefix:n}=this.options,r=[...(null==(t=e.firstElementChild)?void 0:t.classList)||[]].filter((e=>e.startsWith(n))).map((e=>e.replace(n,"")))[0];return r||null},rendered:!1}}},parseHTML:()=>[{tag:"pre",preserveWhitespace:"full"}],renderHTML({node:e,HTMLAttributes:t}){return["pre",la(this.options.HTMLAttributes,t),["code",{class:e.attrs.language?this.options.languageClassPrefix+e.attrs.language:null},0]]},addCommands(){return{setCodeBlock:e=>({commands:t})=>t.setNode(this.name,e),toggleCodeBlock:e=>({commands:t})=>t.toggleNode(this.name,"paragraph",e)}},addKeyboardShortcuts(){return{"Mod-Alt-c":()=>this.editor.commands.toggleCodeBlock(),Backspace:()=>{const{empty:e,$anchor:t}=this.editor.state.selection,n=1===t.pos;return!(!e||t.parent.type.name!==this.name)&&(!(!n&&t.parent.textContent.length)&&this.editor.commands.clearNodes())},Enter:({editor:e})=>{if(!this.options.exitOnTripleEnter)return!1;const{state:t}=e,{selection:n}=t,{$from:r,empty:o}=n;if(!o||r.parent.type!==this.type)return!1;const i=r.parentOffset===r.parent.nodeSize-2,s=r.parent.textContent.endsWith("\n\n");return!(!i||!s)&&e.chain().command((({tr:e})=>(e.delete(r.pos-2,r.pos),!0))).exitCode().run()},ArrowDown:({editor:e})=>{if(!this.options.exitOnArrowDown)return!1;const{state:t}=e,{selection:n,doc:r}=t,{$from:o,empty:i}=n;if(!i||o.parent.type!==this.type)return!1;if(!(o.parentOffset===o.parent.nodeSize-2))return!1;const s=o.after();if(void 0===s)return!1;return r.nodeAt(s)?e.commands.command((({tr:e})=>(e.setSelection(kn.near(r.resolve(s))),!0))):e.commands.exitCode()}}},addInputRules(){return[Cc({find:ad,type:this.type,getAttributes:e=>({language:e[1]})}),Cc({find:ld,type:this.type,getAttributes:e=>({language:e[1]})})]},addProseMirrorPlugins(){return[new Fn({key:new qn("codeBlockVSCodeHandler"),props:{handlePaste:(e,t)=>{if(!t.clipboardData)return!1;if(this.editor.isActive(this.type.name))return!1;const n=t.clipboardData.getData("text/plain"),r=t.clipboardData.getData("vscode-editor-data"),o=r?JSON.parse(r):void 0,i=null==o?void 0:o.mode;if(!n||!i)return!1;const{tr:s,schema:a}=e.state,l=a.text(n.replace(/\r\n?/g,"\n"));return s.replaceSelectionWith(this.type.create({language:i},l)),s.selection.$from.parent.type!==this.type&&s.setSelection(Mn.near(s.doc.resolve(Math.max(0,s.selection.from-2)))),s.setMeta("paste",!0),e.dispatch(s),!0}}})]}}),dd=cd,hd=Sc.create({name:"doc",topNode:!0,content:"block+"}),ud=hd,pd=Sc.create({name:"heading",addOptions:()=>({levels:[1,2,3,4,5,6],HTMLAttributes:{}}),content:"inline*",group:"block",defining:!0,addAttributes:()=>({level:{default:1,rendered:!1}}),parseHTML(){return this.options.levels.map((e=>({tag:`h${e}`,attrs:{level:e}})))},renderHTML({node:e,HTMLAttributes:t}){return[`h${this.options.levels.includes(e.attrs.level)?e.attrs.level:this.options.levels[0]}`,la(this.options.HTMLAttributes,t),0]},addCommands(){return{setHeading:e=>({commands:t})=>!!this.options.levels.includes(e.level)&&t.setNode(this.name,e),toggleHeading:e=>({commands:t})=>!!this.options.levels.includes(e.level)&&t.toggleNode(this.name,"paragraph",e)}},addKeyboardShortcuts(){return this.options.levels.reduce(((e,t)=>({...e,[`Mod-Alt-${t}`]:()=>this.editor.commands.toggleHeading({level:t})})),{})},addInputRules(){return this.options.levels.map((e=>Cc({find:new RegExp(`^(#{${Math.min(...this.options.levels)},${e}})\\s$`),type:this.type,getAttributes:{level:e}})))}}),fd=pd,md=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,gd=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,yd=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,vd=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,bd=Ka.create({name:"italic",addOptions:()=>({HTMLAttributes:{}}),parseHTML(){return[{tag:"em"},{tag:"i",getAttrs:e=>"normal"!==e.style.fontStyle&&null},{style:"font-style=normal",clearMark:e=>e.type.name===this.name},{style:"font-style=italic"}]},renderHTML({HTMLAttributes:e}){return["em",la(this.options.HTMLAttributes,e),0]},addCommands(){return{setItalic:()=>({commands:e})=>e.setMark(this.name),toggleItalic:()=>({commands:e})=>e.toggleMark(this.name),unsetItalic:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-i":()=>this.editor.commands.toggleItalic(),"Mod-I":()=>this.editor.commands.toggleItalic()}},addInputRules(){return[kc({find:md,type:this.type}),kc({find:yd,type:this.type})]},addPasteRules(){return[Mc({find:gd,type:this.type}),Mc({find:vd,type:this.type})]}}),xd=bd;const wd=(e,t)=>{for(const n in t)e[n]=t[n];return e},kd="numeric",Cd="ascii",Nd="alpha",Sd="asciinumeric",Md="alphanumeric",Td="domain",Od="emoji",Ed="scheme",Ad="slashscheme",Dd="whitespace";function Rd(e,t){return e in t||(t[e]=[]),t[e]}function Ld(e,t,n){t[kd]&&(t[Sd]=!0,t[Md]=!0),t[Cd]&&(t[Sd]=!0,t[Nd]=!0),t[Sd]&&(t[Md]=!0),t[Nd]&&(t[Md]=!0),t[Md]&&(t[Td]=!0),t[Od]&&(t[Td]=!0);for(const r in t){const t=Rd(r,n);t.indexOf(e)<0&&t.push(e)}}function Id(e=null){this.j={},this.jr=[],this.jd=null,this.t=e}Id.groups={},Id.prototype={accepts(){return!!this.t},go(e){const t=this,n=t.j[e];if(n)return n;for(let n=0;n<t.jr.length;n++){const r=t.jr[n][0],o=t.jr[n][1];if(o&&r.test(e))return o}return t.jd},has(e,t=!1){return t?e in this.j:!!this.go(e)},ta(e,t,n,r){for(let o=0;o<e.length;o++)this.tt(e[o],t,n,r)},tr(e,t,n,r){let o;return r=r||Id.groups,t&&t.j?o=t:(o=new Id(t),n&&r&&Ld(t,n,r)),this.jr.push([e,o]),o},ts(e,t,n,r){let o=this;const i=e.length;if(!i)return o;for(let t=0;t<i-1;t++)o=o.tt(e[t]);return o.tt(e[i-1],t,n,r)},tt(e,t,n,r){r=r||Id.groups;const o=this;if(t&&t.j)return o.j[e]=t,t;const i=t;let s,a=o.go(e);if(a?(s=new Id,wd(s.j,a.j),s.jr.push.apply(s.jr,a.jr),s.jd=a.jd,s.t=a.t):s=new Id,i){if(r)if(s.t&&"string"==typeof s.t){const e=wd(function(e,t){const n={};for(const r in t)t[r].indexOf(e)>=0&&(n[r]=!0);return n}(s.t,r),n);Ld(i,e,r)}else n&&Ld(i,n,r);s.t=i}return o.j[e]=s,s}};const zd=(e,t,n,r,o)=>e.ta(t,n,r,o),Pd=(e,t,n,r,o)=>e.tr(t,n,r,o),Bd=(e,t,n,r,o)=>e.ts(t,n,r,o),$d=(e,t,n,r,o)=>e.tt(t,n,r,o),Vd="WORD",jd="UWORD",Fd="ASCIINUMERICAL",Hd="ALPHANUMERICAL",_d="LOCALHOST",qd="TLD",Wd="UTLD",Kd="SCHEME",Jd="SLASH_SCHEME",Ud="NUM",Gd="WS",Yd="NL",Xd="OPENBRACE",Qd="CLOSEBRACE",Zd="OPENBRACKET",eh="CLOSEBRACKET",th="OPENPAREN",nh="CLOSEPAREN",rh="OPENANGLEBRACKET",oh="CLOSEANGLEBRACKET",ih="FULLWIDTHLEFTPAREN",sh="FULLWIDTHRIGHTPAREN",ah="LEFTCORNERBRACKET",lh="RIGHTCORNERBRACKET",ch="LEFTWHITECORNERBRACKET",dh="RIGHTWHITECORNERBRACKET",hh="FULLWIDTHLESSTHAN",uh="FULLWIDTHGREATERTHAN",ph="AMPERSAND",fh="APOSTROPHE",mh="ASTERISK",gh="AT",yh="BACKSLASH",vh="BACKTICK",bh="CARET",xh="COLON",wh="COMMA",kh="DOLLAR",Ch="DOT",Nh="EQUALS",Sh="EXCLAMATION",Mh="HYPHEN",Th="PERCENT",Oh="PIPE",Eh="PLUS",Ah="POUND",Dh="QUERY",Rh="QUOTE",Lh="FULLWIDTHMIDDLEDOT",Ih="SEMI",zh="SLASH",Ph="TILDE",Bh="UNDERSCORE",$h="EMOJI",Vh="SYM";var jh=Object.freeze({__proto__:null,ALPHANUMERICAL:Hd,AMPERSAND:ph,APOSTROPHE:fh,ASCIINUMERICAL:Fd,ASTERISK:mh,AT:gh,BACKSLASH:yh,BACKTICK:vh,CARET:bh,CLOSEANGLEBRACKET:oh,CLOSEBRACE:Qd,CLOSEBRACKET:eh,CLOSEPAREN:nh,COLON:xh,COMMA:wh,DOLLAR:kh,DOT:Ch,EMOJI:$h,EQUALS:Nh,EXCLAMATION:Sh,FULLWIDTHGREATERTHAN:uh,FULLWIDTHLEFTPAREN:ih,FULLWIDTHLESSTHAN:hh,FULLWIDTHMIDDLEDOT:Lh,FULLWIDTHRIGHTPAREN:sh,HYPHEN:Mh,LEFTCORNERBRACKET:ah,LEFTWHITECORNERBRACKET:ch,LOCALHOST:_d,NL:Yd,NUM:Ud,OPENANGLEBRACKET:rh,OPENBRACE:Xd,OPENBRACKET:Zd,OPENPAREN:th,PERCENT:Th,PIPE:Oh,PLUS:Eh,POUND:Ah,QUERY:Dh,QUOTE:Rh,RIGHTCORNERBRACKET:lh,RIGHTWHITECORNERBRACKET:dh,SCHEME:Kd,SEMI:Ih,SLASH:zh,SLASH_SCHEME:Jd,SYM:Vh,TILDE:Ph,TLD:qd,UNDERSCORE:Bh,UTLD:Wd,UWORD:jd,WORD:Vd,WS:Gd});const Fh=/[a-z]/,Hh=/\p{L}/u,_h=/\p{Emoji}/u,qh=/\d/,Wh=/\s/;let Kh=null,Jh=null;function Uh(e,t){const n=function(e){const t=[],n=e.length;let r=0;for(;r<n;){let o,i=e.charCodeAt(r),s=i<55296||i>56319||r+1===n||(o=e.charCodeAt(r+1))<56320||o>57343?e[r]:e.slice(r,r+2);t.push(s),r+=s.length}return t}(t.replace(/[A-Z]/g,(e=>e.toLowerCase()))),r=n.length,o=[];let i=0,s=0;for(;s<r;){let a=e,l=null,c=0,d=null,h=-1,u=-1;for(;s<r&&(l=a.go(n[s]));)a=l,a.accepts()?(h=0,u=0,d=a):h>=0&&(h+=n[s].length,u++),c+=n[s].length,i+=n[s].length,s++;i-=h,s-=u,c-=h,o.push({t:d.t,v:t.slice(i-c,i),s:i-c,e:i})}return o}function Gh(e,t,n,r,o){let i;const s=t.length;for(let n=0;n<s-1;n++){const s=t[n];e.j[s]?i=e.j[s]:(i=new Id(r),i.jr=o.slice(),e.j[s]=i),e=i}return i=new Id(n),i.jr=o.slice(),e.j[t[s-1]]=i,i}function Yh(e){const t=[],n=[];let r=0;for(;r<e.length;){let o=0;for(;"0123456789".indexOf(e[r+o])>=0;)o++;if(o>0){t.push(n.join(""));for(let t=parseInt(e.substring(r,r+o),10);t>0;t--)n.pop();r+=o}else n.push(e[r]),r++}return t}const Xh={defaultProtocol:"http",events:null,format:Zh,formatHref:Zh,nl2br:!1,tagName:"a",target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function Qh(e,t=null){let n=wd({},Xh);e&&(n=wd(n,e instanceof Qh?e.o:e));const r=n.ignoreTags,o=[];for(let e=0;e<r.length;e++)o.push(r[e].toUpperCase());this.o=n,t&&(this.defaultRender=t),this.ignoreTags=o}function Zh(e){return e}function eu(e,t){this.t="token",this.v=e,this.tk=t}function tu(e,t){class n extends eu{constructor(t,n){super(t,n),this.t=e}}for(const e in t)n.prototype[e]=t[e];return n.t=e,n}Qh.prototype={o:Xh,ignoreTags:[],defaultRender:e=>e,check(e){return this.get("validate",e.toString(),e)},get(e,t,n){const r=null!=t;let o=this.o[e];return o?("object"==typeof o?(o=n.t in o?o[n.t]:Xh[e],"function"==typeof o&&r&&(o=o(t,n))):"function"==typeof o&&r&&(o=o(t,n.t,n)),o):o},getObj(e,t,n){let r=this.o[e];return"function"==typeof r&&null!=t&&(r=r(t,n.t,n)),r},render(e){const t=e.render(this);return(this.get("render",null,e)||this.defaultRender)(t,e.t,e)}},eu.prototype={isLink:!1,toString(){return this.v},toHref(e){return this.toString()},toFormattedString(e){const t=this.toString(),n=e.get("truncate",t,this),r=e.get("format",t,this);return n&&r.length>n?r.substring(0,n)+"…":r},toFormattedHref(e){return e.get("formatHref",this.toHref(e.get("defaultProtocol")),this)},startIndex(){return this.tk[0].s},endIndex(){return this.tk[this.tk.length-1].e},toObject(e=Xh.defaultProtocol){return{type:this.t,value:this.toString(),isLink:this.isLink,href:this.toHref(e),start:this.startIndex(),end:this.endIndex()}},toFormattedObject(e){return{type:this.t,value:this.toFormattedString(e),isLink:this.isLink,href:this.toFormattedHref(e),start:this.startIndex(),end:this.endIndex()}},validate(e){return e.get("validate",this.toString(),this)},render(e){const t=this,n=this.toHref(e.get("defaultProtocol")),r=e.get("formatHref",n,this),o=e.get("tagName",n,t),i=this.toFormattedString(e),s={},a=e.get("className",n,t),l=e.get("target",n,t),c=e.get("rel",n,t),d=e.getObj("attributes",n,t),h=e.getObj("events",n,t);return s.href=r,a&&(s.class=a),l&&(s.target=l),c&&(s.rel=c),d&&wd(s,d),{tagName:o,attributes:s,content:i,eventListeners:h}}};const nu=tu("email",{isLink:!0,toHref(){return"mailto:"+this.toString()}}),ru=tu("text"),ou=tu("nl"),iu=tu("url",{isLink:!0,toHref(e=Xh.defaultProtocol){return this.hasProtocol()?this.v:`${e}://${this.v}`},hasProtocol(){const e=this.tk;return e.length>=2&&e[0].t!==_d&&e[1].t===xh}}),su=e=>new Id(e);function au(e,t,n){const r=n[0].s,o=n[n.length-1].e;return new e(t.slice(r,o),n)}const lu="undefined"!=typeof console&&console&&console.warn||(()=>{}),cu={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1};function du(e,t=!1){if(cu.initialized&&lu(`linkifyjs: already initialized - will not register custom scheme "${e}" until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.`),!/^[0-9a-z]+(-[0-9a-z]+)*$/.test(e))throw new Error('linkifyjs: incorrect scheme format.\n1. Must only contain digits, lowercase ASCII letters or "-"\n2. Cannot start or end with "-"\n3. "-" cannot repeat');cu.customSchemes.push([e,t])}function hu(){cu.scanner=function(e=[]){const t={};Id.groups=t;const n=new Id;null==Kh&&(Kh=Yh("aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dad1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3nlop4pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2o0dyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3nd0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rckmsd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0america6xi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0stone5umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp3ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5mögensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2olterskluwer11odside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2")),null==Jh&&(Jh=Yh("ελ1υ2бг1ел3дети4ею2католик6ом3мкд2он1сква6онлайн5рг3рус2ф2сайт3рб3укр3қаз3հայ3ישראל5קום3ابوظبي5رامكو5لاردن4بحرين5جزائر5سعودية6عليان5مغرب5مارات5یران5بارت2زار4يتك3ھارت5تونس4سودان3رية5شبكة4عراق2ب2مان4فلسطين6قطر3كاثوليك6وم3مصر2ليسيا5وريتانيا7قع4همراه5پاکستان7ڀارت4कॉम3नेट3भारत0म्3ोत5संगठन5বাংলা5ভারত2ৰত4ਭਾਰਤ4ભારત4ଭାରତ4இந்தியா6லங்கை6சிங்கப்பூர்11భారత్5ಭಾರತ4ഭാരതം5ලංකා4คอม3ไทย3ລາວ3გე2みんな3アマゾン4クラウド4グーグル4コム2ストア3セール3ファッション6ポイント4世界2中信1国1國1文网3亚马逊3企业2佛山2信息2健康2八卦2公司1益2台湾1灣2商城1店1标2嘉里0大酒店5在线2大拿2天主教3娱乐2家電2广东2微博2慈善2我爱你3手机2招聘2政务1府2新加坡2闻2时尚2書籍2机构2淡马锡3游戏2澳門2点看2移动2组织机构4网址1店1站1络2联通2谷歌2购物2通販2集团2電訊盈科4飞利浦3食品2餐厅2香格里拉3港2닷넷1컴2삼성2한국2")),$d(n,"'",fh),$d(n,"{",Xd),$d(n,"}",Qd),$d(n,"[",Zd),$d(n,"]",eh),$d(n,"(",th),$d(n,")",nh),$d(n,"<",rh),$d(n,">",oh),$d(n,"(",ih),$d(n,")",sh),$d(n,"「",ah),$d(n,"」",lh),$d(n,"『",ch),$d(n,"』",dh),$d(n,"<",hh),$d(n,">",uh),$d(n,"&",ph),$d(n,"*",mh),$d(n,"@",gh),$d(n,"`",vh),$d(n,"^",bh),$d(n,":",xh),$d(n,",",wh),$d(n,"$",kh),$d(n,".",Ch),$d(n,"=",Nh),$d(n,"!",Sh),$d(n,"-",Mh),$d(n,"%",Th),$d(n,"|",Oh),$d(n,"+",Eh),$d(n,"#",Ah),$d(n,"?",Dh),$d(n,'"',Rh),$d(n,"/",zh),$d(n,";",Ih),$d(n,"~",Ph),$d(n,"_",Bh),$d(n,"\\",yh),$d(n,"・",Lh);const r=Pd(n,qh,Ud,{[kd]:!0});Pd(r,qh,r);const o=Pd(r,Fh,Fd,{[Sd]:!0}),i=Pd(r,Hh,Hd,{[Md]:!0}),s=Pd(n,Fh,Vd,{[Cd]:!0});Pd(s,qh,o),Pd(s,Fh,s),Pd(o,qh,o),Pd(o,Fh,o);const a=Pd(n,Hh,jd,{[Nd]:!0});Pd(a,Fh),Pd(a,qh,i),Pd(a,Hh,a),Pd(i,qh,i),Pd(i,Fh),Pd(i,Hh,i);const l=$d(n,"\n",Yd,{[Dd]:!0}),c=$d(n,"\r",Gd,{[Dd]:!0}),d=Pd(n,Wh,Gd,{[Dd]:!0});$d(n,"",d),$d(c,"\n",l),$d(c,"",d),Pd(c,Wh,d),$d(d,"\r"),$d(d,"\n"),Pd(d,Wh,d),$d(d,"",d);const h=Pd(n,_h,$h,{[Od]:!0});$d(h,"#"),Pd(h,_h,h),$d(h,"️",h);const u=$d(h,"‍");$d(u,"#"),Pd(u,_h,h);const p=[[Fh,s],[qh,o]],f=[[Fh,null],[Hh,a],[qh,i]];for(let e=0;e<Kh.length;e++)Gh(n,Kh[e],qd,Vd,p);for(let e=0;e<Jh.length;e++)Gh(n,Jh[e],Wd,jd,f);Ld(qd,{tld:!0,ascii:!0},t),Ld(Wd,{utld:!0,alpha:!0},t),Gh(n,"file",Kd,Vd,p),Gh(n,"mailto",Kd,Vd,p),Gh(n,"http",Jd,Vd,p),Gh(n,"https",Jd,Vd,p),Gh(n,"ftp",Jd,Vd,p),Gh(n,"ftps",Jd,Vd,p),Ld(Kd,{scheme:!0,ascii:!0},t),Ld(Jd,{slashscheme:!0,ascii:!0},t),e=e.sort(((e,t)=>e[0]>t[0]?1:-1));for(let t=0;t<e.length;t++){const r=e[t][0],o=e[t][1]?{[Ed]:!0}:{[Ad]:!0};r.indexOf("-")>=0?o[Td]=!0:Fh.test(r)?qh.test(r)?o[Sd]=!0:o[Cd]=!0:o[kd]=!0,Bd(n,r,r,o)}return Bd(n,"localhost",_d,{ascii:!0}),n.jd=new Id(Vh),{start:n,tokens:wd({groups:t},jh)}}(cu.customSchemes);for(let e=0;e<cu.tokenQueue.length;e++)cu.tokenQueue[e][1]({scanner:cu.scanner});cu.parser=function({groups:e}){const t=e.domain.concat([ph,mh,gh,yh,vh,bh,kh,Nh,Mh,Ud,Th,Oh,Eh,Ah,zh,Vh,Ph,Bh]),n=[fh,xh,wh,Ch,Sh,Th,Dh,Rh,Ih,rh,oh,Xd,Qd,eh,Zd,th,nh,ih,sh,ah,lh,ch,dh,hh,uh],r=[ph,fh,mh,yh,vh,bh,kh,Nh,Mh,Xd,Qd,Th,Oh,Eh,Ah,Dh,zh,Vh,Ph,Bh],o=su(),i=$d(o,Ph);zd(i,r,i),zd(i,e.domain,i);const s=su(),a=su(),l=su();zd(o,e.domain,s),zd(o,e.scheme,a),zd(o,e.slashscheme,l),zd(s,r,i),zd(s,e.domain,s);const c=$d(s,gh);$d(i,gh,c),$d(a,gh,c),$d(l,gh,c);const d=$d(i,Ch);zd(d,r,i),zd(d,e.domain,i);const h=su();zd(c,e.domain,h),zd(h,e.domain,h);const u=$d(h,Ch);zd(u,e.domain,h);const p=su(nu);zd(u,e.tld,p),zd(u,e.utld,p),$d(c,_d,p);const f=$d(h,Mh);$d(f,Mh,f),zd(f,e.domain,h),zd(p,e.domain,h),$d(p,Ch,u),$d(p,Mh,f);const m=$d(p,xh);zd(m,e.numeric,nu);const g=$d(s,Mh),y=$d(s,Ch);$d(g,Mh,g),zd(g,e.domain,s),zd(y,r,i),zd(y,e.domain,s);const v=su(iu);zd(y,e.tld,v),zd(y,e.utld,v),zd(v,e.domain,s),zd(v,r,i),$d(v,Ch,y),$d(v,Mh,g),$d(v,gh,c);const b=$d(v,xh),x=su(iu);zd(b,e.numeric,x);const w=su(iu),k=su();zd(w,t,w),zd(w,n,k),zd(k,t,w),zd(k,n,k),$d(v,zh,w),$d(x,zh,w);const C=$d(a,xh),N=$d(l,xh),S=$d(N,zh),M=$d(S,zh);zd(a,e.domain,s),$d(a,Ch,y),$d(a,Mh,g),zd(l,e.domain,s),$d(l,Ch,y),$d(l,Mh,g),zd(C,e.domain,w),$d(C,zh,w),$d(C,Dh,w),zd(M,e.domain,w),zd(M,t,w),$d(M,zh,w);const T=[[Xd,Qd],[Zd,eh],[th,nh],[rh,oh],[ih,sh],[ah,lh],[ch,dh],[hh,uh]];for(let e=0;e<T.length;e++){const[r,o]=T[e],i=$d(w,r);$d(k,r,i),$d(i,o,w);const s=su(iu);zd(i,t,s);const a=su();zd(i,n),zd(s,t,s),zd(s,n,a),zd(a,t,s),zd(a,n,a),$d(s,o,w),$d(a,o,w)}return $d(o,_d,v),$d(o,Yd,ou),{start:o,tokens:jh}}(cu.scanner.tokens);for(let e=0;e<cu.pluginQueue.length;e++)cu.pluginQueue[e][1]({scanner:cu.scanner,parser:cu.parser});return cu.initialized=!0,cu}function uu(e){return cu.initialized||hu(),function(e,t,n){let r=n.length,o=0,i=[],s=[];for(;o<r;){let a=e,l=null,c=null,d=0,h=null,u=-1;for(;o<r&&!(l=a.go(n[o].t));)s.push(n[o++]);for(;o<r&&(c=l||a.go(n[o].t));)l=null,a=c,a.accepts()?(u=0,h=a):u>=0&&u++,o++,d++;if(u<0)o-=d,o<r&&(s.push(n[o]),o++);else{s.length>0&&(i.push(au(ru,t,s)),s=[]),o-=u,d-=u;const e=h.t,r=n.slice(o-d,o);i.push(au(e,t,r))}}return s.length>0&&i.push(au(ru,t,s)),i}(cu.parser.start,e,Uh(cu.scanner.start,e))}function pu(e,t=null,n=null){if(t&&"object"==typeof t){if(n)throw Error(`linkifyjs: Invalid link type ${t}; must be a string`);n=t,t=null}const r=new Qh(n),o=uu(e),i=[];for(let e=0;e<o.length;e++){const n=o[e];!n.isLink||t&&n.t!==t||!r.check(n)||i.push(n.toFormattedObject(r))}return i}uu.scan=Uh;var fu="[\0-   ᠎ -\u2029  ]",mu=new RegExp(fu),gu=new RegExp(`${fu}$`),yu=new RegExp(fu,"g");function vu(e,t){const n=["http","https","ftp","ftps","mailto","tel","callto","sms","cid","xmpp"];return t&&t.forEach((e=>{const t="string"==typeof e?e:e.scheme;t&&n.push(t)})),!e||e.replace(yu,"").match(new RegExp(`^(?:(?:${n.join("|")}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`,"i"))}var bu,xu=Ka.create({name:"link",priority:1e3,keepOnSplit:!1,exitable:!0,onCreate(){this.options.validate&&!this.options.shouldAutoLink&&(this.options.shouldAutoLink=this.options.validate,console.warn("The `validate` option is deprecated. Rename to the `shouldAutoLink` option instead.")),this.options.protocols.forEach((e=>{"string"!=typeof e?du(e.scheme,e.optionalSlashes):du(e)}))},onDestroy(){Id.groups={},cu.scanner=null,cu.parser=null,cu.tokenQueue=[],cu.pluginQueue=[],cu.customSchemes=[],cu.initialized=!1},inclusive(){return this.options.autolink},addOptions:()=>({openOnClick:!0,enableClickSelection:!1,linkOnPaste:!0,autolink:!0,protocols:[],defaultProtocol:"http",HTMLAttributes:{target:"_blank",rel:"noopener noreferrer nofollow",class:null},isAllowedUri:(e,t)=>!!vu(e,t.protocols),validate:e=>!!e,shouldAutoLink:e=>!!e}),addAttributes(){return{href:{default:null,parseHTML:e=>e.getAttribute("href")},target:{default:this.options.HTMLAttributes.target},rel:{default:this.options.HTMLAttributes.rel},class:{default:this.options.HTMLAttributes.class}}},parseHTML(){return[{tag:"a[href]",getAttrs:e=>{const t=e.getAttribute("href");return!(!t||!this.options.isAllowedUri(t,{defaultValidate:e=>!!vu(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol}))&&null}}]},renderHTML({HTMLAttributes:e}){return this.options.isAllowedUri(e.href,{defaultValidate:e=>!!vu(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?["a",la(this.options.HTMLAttributes,e),0]:["a",la(this.options.HTMLAttributes,{...e,href:""}),0]},addCommands(){return{setLink:e=>({chain:t})=>{const{href:n}=e;return!!this.options.isAllowedUri(n,{defaultValidate:e=>!!vu(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})&&t().setMark(this.name,e).setMeta("preventAutolink",!0).run()},toggleLink:e=>({chain:t})=>{const{href:n}=e||{};return!(n&&!this.options.isAllowedUri(n,{defaultValidate:e=>!!vu(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol}))&&t().toggleMark(this.name,e,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()},unsetLink:()=>({chain:e})=>e().unsetMark(this.name,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()}},addPasteRules(){return[Mc({find:e=>{const t=[];if(e){const{protocols:n,defaultProtocol:r}=this.options,o=pu(e).filter((e=>e.isLink&&this.options.isAllowedUri(e.value,{defaultValidate:e=>!!vu(e,n),protocols:n,defaultProtocol:r})));o.length&&o.forEach((e=>t.push({text:e.value,data:{href:e.href},index:e.start})))}return t},type:this.type,getAttributes:e=>{var t;return{href:null==(t=e.data)?void 0:t.href}}})]},addProseMirrorPlugins(){const e=[],{protocols:t,defaultProtocol:n}=this.options;var r;return this.options.autolink&&e.push((r={type:this.type,defaultProtocol:this.options.defaultProtocol,validate:e=>this.options.isAllowedUri(e,{defaultValidate:e=>!!vu(e,t),protocols:t,defaultProtocol:n}),shouldAutoLink:this.options.shouldAutoLink},new Fn({key:new qn("autolink"),appendTransaction:(e,t,n)=>{const o=e.some((e=>e.docChanged))&&!t.doc.eq(n.doc),i=e.some((e=>e.getMeta("preventAutolink")));if(!o||i)return;const{tr:s}=n;return ka(Gs(t.doc,[...e])).forEach((({newRange:e})=>{const t=function(e,t,n){const r=[];return e.nodesBetween(t.from,t.to,((e,t)=>{n(e)&&r.push({node:e,pos:t})})),r}(n.doc,e,(e=>e.isTextblock));let o,i;if(t.length>1)o=t[0],i=n.doc.textBetween(o.pos,o.pos+o.node.nodeSize,void 0," ");else if(t.length){const r=n.doc.textBetween(e.from,e.to," "," ");if(!gu.test(r))return;o=t[0],i=n.doc.textBetween(o.pos,e.to,void 0," ")}if(o&&i){const e=i.split(mu).filter(Boolean);if(e.length<=0)return!1;const t=e[e.length-1],l=o.pos+i.lastIndexOf(t);if(!t)return!1;const c=uu(t).map((e=>e.toObject(r.defaultProtocol)));if(!(1===(a=c).length?a[0].isLink:3===a.length&&a[1].isLink&&["()","[]"].includes(a[0].value+a[2].value)))return!1;c.filter((e=>e.isLink)).map((e=>({...e,from:l+e.start+1,to:l+e.end+1}))).filter((e=>!n.schema.marks.code||!n.doc.rangeHasMark(e.from,e.to,n.schema.marks.code))).filter((e=>r.validate(e.value))).filter((e=>r.shouldAutoLink(e.value))).forEach((e=>{Oa(e.from,e.to,n.doc).some((e=>e.mark.type===r.type))||s.addMark(e.from,e.to,r.type.create({href:e.href}))}))}var a})),s.steps.length?s:void 0}}))),!0===this.options.openOnClick&&e.push(function(e){return new Fn({key:new qn("handleClickLink"),props:{handleClick:(t,n,r)=>{var o,i;if(0!==r.button)return!1;if(!t.editable)return!1;let s=null;if(r.target instanceof HTMLAnchorElement)s=r.target;else{let e=r.target;const t=[];for(;"DIV"!==e.nodeName;)t.push(e),e=e.parentNode;s=t.find((e=>"A"===e.nodeName))}if(!s)return!1;const a=xa(t.state,e.type.name),l=null!=(o=null==s?void 0:s.href)?o:a.href,c=null!=(i=null==s?void 0:s.target)?i:a.target;return e.enableClickSelection&&e.editor.commands.extendMarkRange(e.type.name),!(!s||!l||(window.open(l,c),0))}}})}({type:this.type,editor:this.editor,enableClickSelection:this.options.enableClickSelection})),this.options.linkOnPaste&&e.push(function(e){return new Fn({key:new qn("handlePasteLink"),props:{handlePaste:(t,n,r)=>{const{state:o}=t,{selection:i}=o,{empty:s}=i;if(s)return!1;let a="";r.content.forEach((e=>{a+=e.textContent}));const l=pu(a,{defaultProtocol:e.defaultProtocol}).find((e=>e.isLink&&e.value===a));return!(!a||!l)&&e.editor.commands.setMark(e.type,{href:l.href})}}})}({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type})),e}}),wu=xu,ku=$c,Cu=Qc,Nu=Sc.create({name:"paragraph",priority:1e3,addOptions:()=>({HTMLAttributes:{}}),group:"block",content:"inline*",parseHTML:()=>[{tag:"p"}],renderHTML({HTMLAttributes:e}){return["p",la(this.options.HTMLAttributes,e),0]},addCommands(){return{setParagraph:()=>({commands:e})=>e.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),Su=Nu,Mu=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,Tu=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,Ou=Ka.create({name:"strike",addOptions:()=>({HTMLAttributes:{}}),parseHTML:()=>[{tag:"s"},{tag:"del"},{tag:"strike"},{style:"text-decoration",consuming:!1,getAttrs:e=>!!e.includes("line-through")&&{}}],renderHTML({HTMLAttributes:e}){return["s",la(this.options.HTMLAttributes,e),0]},addCommands(){return{setStrike:()=>({commands:e})=>e.setMark(this.name),toggleStrike:()=>({commands:e})=>e.toggleMark(this.name),unsetStrike:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-s":()=>this.editor.commands.toggleStrike()}},addInputRules(){return[kc({find:Mu,type:this.type})]},addPasteRules(){return[Mc({find:Tu,type:this.type})]}}),Eu=Ou,Au=Sc.create({name:"text",group:"inline"}),Du=Au,Ru=Ka.create({name:"underline",addOptions:()=>({HTMLAttributes:{}}),parseHTML:()=>[{tag:"u"},{style:"text-decoration",consuming:!1,getAttrs:e=>!!e.includes("underline")&&{}}],renderHTML({HTMLAttributes:e}){return["u",la(this.options.HTMLAttributes,e),0]},addCommands(){return{setUnderline:()=>({commands:e})=>e.setMark(this.name),toggleUnderline:()=>({commands:e})=>e.toggleMark(this.name),unsetUnderline:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-u":()=>this.editor.commands.toggleUnderline(),"Mod-U":()=>this.editor.commands.toggleUnderline()}}}),Lu=Ru,Iu={exports:{}},zu={};var Pu,Bu={};
32
+ */var oe;function ie(){var n=s(!1),r=n[0],o=n[1],i=a(null),c=function(e){o(!1)};return l((function(){var e=function(e){i.current&&!i.current.contains(e.target)&&o(!1)};return document.addEventListener("mousedown",e),function(){document.removeEventListener("mousedown",e)}}),[]),t("div",{className:"relative inline-block",ref:i,children:[t("div",{className:"flex",children:[t("button",{className:"flex items-center rounded-l-md border border-gray-300 bg-white px-4 py-2 text-sm font-medium text-gray-700 hover:bg-gray-50 focus:outline-none",onClick:function(){return c(oe.PDF)},children:[e(z,{className:"mr-2 h-4 w-4"}),"Export"]}),e("button",{className:"rounded-r-md border border-l-0 border-gray-300 bg-white px-2 py-2 text-sm font-medium text-gray-700 hover:bg-gray-50 focus:outline-none",onClick:function(){o(!r)},children:e(E,{className:"h-4 w-4"})})]}),r&&e("div",{className:"absolute right-0 z-10 mt-1 w-48 origin-top-right rounded-md bg-white shadow-lg ring-1 ring-black ring-opacity-5 focus:outline-none",children:t("div",{className:"py-1",children:[t("button",{onClick:function(){return c(oe.PDF)},className:"flex w-full items-center px-4 py-2 text-left text-sm text-gray-700 hover:bg-gray-100",children:[e(V,{className:"mr-2 h-4 w-4"}),"PDF Document"]}),t("button",{onClick:function(){return c(oe.CSV)},className:"flex w-full items-center px-4 py-2 text-left text-sm text-gray-700 hover:bg-gray-100",children:[e($,{className:"mr-2 h-4 w-4"}),"CSV Spreadsheet"]}),t("button",{onClick:function(){return c(oe.EXCEL)},className:"flex w-full items-center px-4 py-2 text-left text-sm text-gray-700 hover:bg-gray-100",children:[e($,{className:"mr-2 h-4 w-4"}),"Excel Spreadsheet"]})]})})]})}!function(e){e[e.PDF=0]="PDF",e[e.CSV=1]="CSV",e[e.EXCEL=2]="EXCEL",e[e.JSON=3]="JSON"}(oe||(oe={}));var se=function(t){var n=t.children,r=t.className,o=void 0===r?"":r,i=t.glass,s=void 0!==i&&i,a="".concat("\n w-full\n rounded-2xl\n shadow-xl\n transition-all\n duration-300\n ease-out\n hover:-translate-y-0.5\n p-5\n relative\n "," ").concat(s?"\n backdrop-blur-xl\n bg-white/20\n border\n border-white/30\n shadow-lg\n hover:shadow-xl\n hover:bg-white/30\n before:absolute\n before:inset-0\n before:rounded-2xl\n before:bg-gradient-to-br\n before:from-white/10\n before:to-transparent\n before:pointer-events-none\n ":"\n backdrop-blur-2xl\n bg-white\n border\n border-[#EEEEF0]\n shadow-black/0\n hover:shadow-2xl\n hover:shadow-black/10\n hover:bg-white/90\n before:absolute\n before:inset-0\n before:rounded-2xl\n before:bg-gradient-to-br\n before:from-white/10\n before:to-transparent\n before:pointer-events-none\n "," ").concat(o);return e("div",{className:a,children:n})};function ae(n){var r=n.title,o=void 0===r?"No Record Found":r,i=n.onClick,s=n.btnText,a=n.description,l=void 0===a?"":a,c=n.className,d=void 0===c?"":c,h=n.icon;return e("div",{className:"my-2 flex min-h-[320px] w-full flex-col items-center justify-center rounded-lg bg-gray-50 p-8 text-center ".concat(d," "),"aria-live":"polite",children:t("div",{className:"max-w-md space-y-4",children:[h&&e("div",{className:"mx-auto h-16 w-16 text-gray-300",children:h}),e("h2",{className:"text-xl font-medium text-gray-900",children:o}),l&&e("p",{className:"text-gray-500",children:l}),s&&i&&e("div",{className:"mt-6",children:e(x,{onClick:i,size:"medium",children:s})})]})})}var le=function(){return le=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},le.apply(this,arguments)};function ce(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}return n}function de(e,t,n){if(n||2===arguments.length)for(var r,o=0,i=t.length;o<i;o++)!r&&o in t||(r||(r=Array.prototype.slice.call(t,0,o)),r[o]=t[o]);return e.concat(r||Array.prototype.slice.call(t))}"function"==typeof SuppressedError&&SuppressedError;var he=function(n){var r=n.variant,o=void 0===r?"check":r,i=n.size,a=void 0===i?"sm":i,c=n.checked,d=void 0!==c&&c,h=n.disabled,u=void 0!==h&&h,p=n.onChange,f=n.label,m=n.labelPosition,g=void 0===m?"right":m,y=n.name,v=n.value,b=n.id,x=n.className,w=void 0===x?"":x,k=n.error,C=n.helperText,N=n.required,S=void 0!==N&&N,M=n.indeterminate,T=void 0!==M&&M,O=s(d),E=O[0],A=O[1],D=s(T),R=D[0],L=D[1];l((function(){A(d)}),[d]),l((function(){L(T)}),[T]);var I=function(){if(!u){var e=!E;A(e),L(!1),null==p||p(e)}},z={sm:{container:"h-4 w-4",toggle:"w-8 h-4",toggleCircle:"h-3 w-3",text:"text-sm"},md:{container:"h-5 w-5",toggle:"w-10 h-5",toggleCircle:"h-4 w-4",text:"text-base"},lg:{container:"h-6 w-6",toggle:"w-12 h-6",toggleCircle:"h-5 w-5",text:"text-lg"}},P=b||"checkbox-".concat(Math.random().toString(36).substr(2,9));return t("div",{className:"flex items-start gap-2 ".concat(w),children:[f&&"left"===g&&t("label",{htmlFor:P,className:"".concat(z[a].text," ").concat(u?"text-gray-400":k?"text-red-600":"text-gray-700"," cursor-pointer select-none"),children:[f,S&&e("span",{className:"text-red-500 ml-1",children:"*"})]}),t("div",{className:"flex flex-col",children:[t("div","toggle"===o?{className:"relative rounded-full transition-colors duration-200 ".concat(z[a].toggle," ").concat(E?"bg-primary":"bg-gray-300"," ").concat(u?"cursor-not-allowed opacity-50":"cursor-pointer","\n ").concat(k?"ring-2 ring-red-300":""),onClick:I,children:[e("div",{className:"absolute top-0.5 transform rounded-full bg-white shadow-sm transition-transform duration-200 ".concat(z[a].toggleCircle," ").concat(E?"translate-x-full":"translate-x-0.5")}),e("input",{type:"checkbox",id:P,name:y,value:v,checked:E,onChange:I,disabled:u,className:"sr-only",required:S})]}:{className:"relative",children:[e("input",{type:"dot"===o?"radio":"checkbox",id:P,name:y,value:v,checked:E,onChange:I,disabled:u,required:S,className:"sr-only"}),t("div",{className:"".concat(z[a].container," ").concat("check"===o?"rounded-md":"rounded-full"," flex items-center justify-center border-2 transition-all duration-200 ").concat(E||R?"border-primary bg-primary":k?"border-red-300 bg-red-50":"border-gray-300 bg-white hover:border-gray-400"," ").concat(u?"cursor-not-allowed opacity-50":"cursor-pointer","\n focus-within:ring-2 focus-within:ring-primary focus-within:ring-offset-2"),onClick:I,children:[E&&"check"===o&&e("svg",{className:"h-3 w-3 text-white",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:3,children:e("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 13l4 4L19 7"})}),R&&"check"===o&&e("div",{className:"h-0.5 w-2.5 bg-white rounded-full"}),E&&"dot"===o&&e("div",{className:"h-1.5 w-1.5 rounded-full bg-white"})]})]}),k&&t("p",{className:"mt-1 text-xs text-red-600 flex items-center",children:[e("svg",{className:"w-3 h-3 mr-1",fill:"currentColor",viewBox:"0 0 20 20",children:e("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7 4a1 1 0 11-2 0 1 1 0 012 0zm-1-9a1 1 0 00-1 1v4a1 1 0 102 0V6a1 1 0 00-1-1z",clipRule:"evenodd"})}),k]}),C&&!k&&e("p",{className:"mt-1 text-xs text-gray-500",children:C})]}),f&&"right"===g&&t("label",{htmlFor:P,className:"".concat(z[a].text," ").concat(u?"text-gray-400":k?"text-red-600":"text-gray-700"," cursor-pointer select-none"),children:[f,S&&e("span",{className:"text-red-500 ml-1",children:"*"})]})]})},ue=function(n){var r=n.name,o=n.value,i=n.onChange,s=n.options,a=n.size,l=void 0===a?"md":a,c=n.className,d=void 0===c?"":c,h=n.error,u=n.helperText,p=n.required,f=void 0!==p&&p,m=n.label,g=n.direction,y=void 0===g?"vertical":g;return t("div",{className:"space-y-2 ".concat(d),children:[m&&t("label",{className:"block text-sm font-medium text-gray-700",children:[m,f&&e("span",{className:"text-red-500 ml-1",children:"*"})]}),e("div",{className:"flex ".concat("horizontal"===y?"flex-row gap-6":"flex-col gap-2"),children:s.map((function(t){return e(he,{variant:"dot",size:l,name:r,value:t.value,checked:o===t.value,onChange:function(){return e=t.value,void(null==i||i(e));var e},label:t.label,disabled:t.disabled,error:h,required:f},t.value)}))}),h&&t("p",{className:"text-xs text-red-600 flex items-center",children:[e("svg",{className:"w-3 h-3 mr-1",fill:"currentColor",viewBox:"0 0 20 20",children:e("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7 4a1 1 0 11-2 0 1 1 0 012 0zm-1-9a1 1 0 00-1 1v4a1 1 0 102 0V6a1 1 0 00-1-1z",clipRule:"evenodd"})}),h]}),u&&!h&&e("p",{className:"text-xs text-gray-500",children:u})]})};function pe(){var n=s("option1"),r=n[0],o=n[1],i=s({terms:!1,newsletter:!0,notifications:!1}),a=i[0],l=i[1];return e("div",{className:"min-h-screen bg-gray-50 p-8",children:e("div",{className:"mx-auto max-w-2xl space-y-8",children:t("div",{className:"rounded-lg bg-white p-6 shadow",children:[e("h2",{className:"mb-6 text-xl font-semibold",children:"CheckBox Component Demo"}),t("div",{className:"space-y-8",children:[t("div",{className:"space-y-4",children:[e("h3",{className:"font-medium",children:"Check Variant"}),t("div",{className:"flex flex-wrap items-center gap-6",children:[e(he,{variant:"check",size:"sm",label:"Small"}),e(he,{variant:"check",size:"md",checked:!0,label:"Medium"}),e(he,{variant:"check",size:"lg",label:"Large"}),e(he,{variant:"check",disabled:!0,label:"Disabled"}),e(he,{variant:"check",indeterminate:!0,label:"Indeterminate"})]})]}),t("div",{className:"space-y-4",children:[e("h3",{className:"font-medium",children:"Radio Group (Dot Variant)"}),e(ue,{name:"demo-radio",value:r,onChange:o,label:"Choose an option",options:[{value:"option1",label:"Option 1"},{value:"option2",label:"Option 2"},{value:"option3",label:"Option 3"},{value:"option4",label:"Option 4 (Disabled)",disabled:!0}],helperText:"Select one option from the list"})]}),t("div",{className:"space-y-4",children:[e("h3",{className:"font-medium",children:"Toggle Variant"}),t("div",{className:"flex flex-wrap items-center gap-6",children:[e(he,{variant:"toggle",size:"sm",label:"Small"}),e(he,{variant:"toggle",size:"md",checked:!0,label:"Medium"}),e(he,{variant:"toggle",size:"lg",label:"Large"}),e(he,{variant:"toggle",disabled:!0,label:"Disabled"})]})]}),t("div",{className:"space-y-4 border-t pt-6",children:[e("h3",{className:"font-medium",children:"Sample Form"}),t("div",{className:"space-y-4",children:[e(he,{variant:"check",checked:a.terms,onChange:function(e){return l(le(le({},a),{terms:e}))},label:"I accept the terms and conditions",required:!0,error:a.terms?"":"Please accept terms to continue"}),e(he,{variant:"toggle",checked:a.newsletter,onChange:function(e){return l(le(le({},a),{newsletter:e}))},label:"Subscribe to newsletter",helperText:"Get updates about new features and releases"}),e(he,{variant:"check",checked:a.notifications,onChange:function(e){return l(le(le({},a),{notifications:e}))},label:"Enable push notifications"}),e("div",{className:"pt-4",children:e("button",{className:"rounded-md bg-primary px-4 py-2 text-white transition-colors hover:bg-primary/90 disabled:opacity-50",disabled:!a.terms,children:"Submit"})})]})]})]})]})})})}var fe=function(r){var o=r.label,i=r.description,a=r.helperText,l=r.error,c=r.success,d=r.disabled,h=void 0!==d&&d,u=r.required,p=void 0!==u&&u,f=r.accept,m=r.multiple,g=void 0!==m&&m,y=r.placeholder,v=r.showProgress,b=void 0===v||v,x=r.className,w=void 0===x?"":x,k=r.id,C=r.maxFileSize,N=r.onFileChange,S=r.direction,M=void 0===S?"col":S,T=s([]),O=T[0],E=T[1],A=s({}),L=A[0],I=A[1],z=s(!1),P=z[0],B=z[1],$=function(e){if(0===e)return"0 Bytes";var t=Math.floor(Math.log(e)/Math.log(1024));return parseFloat((e/Math.pow(1024,t)).toFixed(2))+" "+["Bytes","KB","MB","GB"][t]},V=k||"file-upload-".concat(Math.random().toString(36).substr(2,9));return t("div",{className:"space-y-2 ".concat(w),children:[o&&t("label",{htmlFor:V,className:"block text-sm font-medium text-gray-700",children:[o,p&&e("span",{className:"text-red-500 ml-1",children:"*"})]}),i&&e("p",{className:"text-sm text-gray-600",children:i}),t("div",{className:"\n flex flex-".concat(M," gap-2 rounded-lg border-2 border-dashed p-8 text-center items-center\n ").concat("row"===M?"justify-center":"","\n ").concat(P?"border-blue-400 bg-blue-50":"border-gray-300","\n ").concat(l?"border-red-300 bg-red-50":"","\n ").concat(c?"border-green-300 bg-green-50":"","\n ").concat(h?"opacity-50 cursor-not-allowed bg-gray-50":"cursor-pointer hover:border-gray-400","\n "),onDragOver:function(e){e.preventDefault(),h||B(!0)},onDragLeave:function(e){e.preventDefault(),B(!1)},onDrop:function(e){if(e.preventDefault(),B(!1),!h&&e.dataTransfer.files&&e.dataTransfer.files.length>0){var t=Array.from(e.dataTransfer.files),n=g?de(de([],O,!0),t,!0):[t[0]];E(n),b&&t.forEach((function(e){var t="".concat(e.name,"-").concat(e.size);I((function(e){var n;return le(le({},e),((n={})[t]=10,n))}));var n=setInterval((function(){I((function(e){var r,o=e[t]||0;return o>=100?(clearInterval(n),e):le(le({},e),((r={})[t]=Math.min(o+10,100),r))}))}),300)})),N(n)}},onClick:function(){var e;return!h&&(null===(e=document.getElementById(V))||void 0===e?void 0:e.click())},children:[e(ne,{size:24,className:"text-gray-400"}),t("div",{children:[e("p",{className:"text-sm font-medium ".concat(h?"text-gray-400":"text-blue-600 hover:underline"),children:y||"Click to Upload"}),e("p",{className:"text-gray-500 text-sm",children:"or drag and drop"}),t("p",{className:"text-sm text-gray-500",children:["(Max. File size: ",C||"25"," MB)"]}),g&&e("p",{className:"text-xs text-gray-400 mt-1",children:"Multiple files allowed"})]}),e("input",{id:V,type:"file",className:"hidden",onChange:function(e){if(e.target.files&&e.target.files.length>0){var t=Array.from(e.target.files),n=g?de(de([],O,!0),t,!0):[t[0]];E(n),b&&t.forEach((function(e){var t="".concat(e.name,"-").concat(e.size);I((function(e){var n;return le(le({},e),((n={})[t]=10,n))}));var n=setInterval((function(){I((function(e){var r,o=e[t]||0;return o>=100?(clearInterval(n),e):le(le({},e),((r={})[t]=Math.min(o+10,100),r))}))}),300)})),N(n)}},accept:f,multiple:g,disabled:h,required:p})]}),O.length>0&&t("div",{className:"space-y-2",children:[t("div",{className:"flex items-center justify-between",children:[t("h4",{className:"text-sm font-medium text-gray-700",children:["Uploaded Files (",O.length,")"]}),O.length>1&&e("button",{onClick:function(){E([]),I({}),N(null)},className:"text-xs text-red-500 hover:text-red-700",disabled:h,children:"Remove All"})]}),O.map((function(r,o){var i="".concat(r.name,"-").concat(r.size),s=L[i]||100;return t("div",{className:"rounded-lg border p-4 ".concat(c?"border-green-300 bg-green-50":"border-gray-200"),children:[t("div",{className:"flex items-center justify-between",children:[t("div",{className:"flex items-center",children:[e("div",{className:"mr-3 rounded-lg bg-blue-100 p-2 w-12 h-12 flex items-center justify-center overflow-hidden",children:r.type.startsWith("image/")?e("img",{src:URL.createObjectURL(r),alt:"preview",className:"object-cover w-full h-full rounded"}):"application/pdf"===r.type?e("div",{className:"text-red-600 text-xs font-bold",children:"PDF"}):e(j,{size:24,className:"text-blue-500"})}),t("div",{children:[e("p",{className:"text-sm font-medium",children:r.name}),e("p",{className:"text-xs text-gray-500",children:$(r.size)})]})]}),e("button",{onClick:function(){return function(e){var t=O.filter((function(t,n){return n!==e}));E(t),N(t.length>0?t:null)}(o)},className:"text-red-500 hover:text-red-700 disabled:opacity-50",disabled:h,children:e(re,{size:16})})]}),b&&s<100&&t(n,{children:[e("div",{className:"mt-2 h-2.5 w-full rounded-full bg-gray-200",children:e("div",{className:"h-2.5 rounded-full bg-blue-600 transition-all duration-300",style:{width:"".concat(s,"%")}})}),t("p",{className:"mt-1 text-right text-xs text-gray-500",children:[s,"%"]})]}),b&&100===s&&t("div",{className:"flex items-center text-green-600 text-sm mt-2",children:[e(R,{size:16,className:"mr-1"}),"Upload complete"]})]},i)}))]}),a&&!l&&!c&&e("p",{className:"text-sm text-gray-500",children:a}),l&&t("div",{className:"flex items-center text-red-600 text-sm",children:[e(D,{size:16,className:"mr-1"}),l]}),c&&t("div",{className:"flex items-center text-green-600 text-sm",children:[e(R,{size:16,className:"mr-1"}),c]})]})},me=function(n){var r=n.id,o=n.label,i=n.value,s=n.size,a=void 0===s?"md":s,l=n.onChange,c=n.placeholder,d=n.error,h=n.required,u=void 0!==h&&h,p=n.helpText,f=n.type,m=void 0===f?"text":f,g=n.className,y=void 0===g?"":g,v=n.disabled,b=void 0!==v&&v,x=n.icon,w=n.iconPosition,k=void 0===w?"left":w,C=n.rightIcon,N=n.block,S=ce(n,["id","label","value","size","onChange","placeholder","error","required","helpText","type","className","disabled","icon","iconPosition","rightIcon","block"]),M={id:r,value:i,onChange:function(e){l&&l(e)},placeholder:c,disabled:b,className:"w-full rounded-[12px] border ".concat({sm:"text-xs px-3 py-1.5 text-sm min-h-[32px]",md:"text-sm px-4 py-2 text-base min-h-[40px]",lg:"text-base px-4 py-3 text-lg min-h-[48px]"}[a]," ").concat(d?"border-red-500":"border-gray-200"," ").concat(b?"bg-gray-100 text-gray-500 placeholder-gray-300":"bg-gray-100 placeholder-gray-400 text-dark"," focus:outline-none focus:ring-1 focus:ring-primary ").concat(y," ").concat(x&&"left"===k?"pl-10":""," ").concat(x&&"right"===k?"pr-10":""),"aria-invalid":!!d,"aria-describedby":d?"".concat(r,"-error"):p?"".concat(r,"-help"):void 0};return t("div",{className:"mb-4 ".concat(N&&"w-full"),children:[o&&t("label",{htmlFor:r,className:"mb-1 block text-sm font-medium text-gray-600",children:[o,u&&e("span",{className:"ml-1 text-red-500",children:"*"})]}),t("div",{className:"relative",children:[x&&"left"===k&&e("div",{className:"pointer-events-none absolute inset-y-0 left-0 flex items-center pl-3",children:x}),"textarea"==m?e("textarea",le({},M,{rows:4,className:"".concat(M.className," resize-none")},S)):e("input",le({},M,{type:m},S)),x&&"right"===k&&e("div",{className:"pointer-events-none absolute inset-y-0 right-0 flex items-center pr-3",children:x}),C&&e("div",{className:"absolute right-3 top-1/2 -translate-y-1/2 cursor-pointer",children:C})]}),p&&!d&&e("p",{id:"".concat(r,"-help"),className:"mt-1 text-sm text-gray-500",children:p}),d&&e("p",{id:"".concat(r,"-error"),className:"mt-1 text-sm text-red-500",children:d})]})},ge=function(n){var r=n.id,o=n.label,i=n.value,s=n.size,a=void 0===s?"md":s,l=n.onChange,c=n.placeholder,d=n.error,h=n.required,u=void 0!==h&&h,p=n.helpText,f=n.type,m=void 0===f?"text":f,g=n.className,y=void 0===g?"":g,v=n.disabled,b=void 0!==v&&v,x=n.icon,w=n.iconPosition,k=void 0===w?"left":w,C=n.rightIcon,N=n.prefixContent,S=n.prefixClassName,M=void 0===S?"":S;n.onPrefixChange;var T,O,E=ce(n,["id","label","value","size","onChange","placeholder","error","required","helpText","type","className","disabled","icon","iconPosition","rightIcon","prefixContent","prefixClassName","onPrefixChange"]),A="\n flex-1 rounded-none rounded-r-[12px] border-l-0 ".concat({sm:"text-xs py-1.5 text-sm min-h-[32px]",md:"text-sm py-2 text-base min-h-[40px]",lg:"text-base py-3 text-lg min-h-[48px]"}[a]," \n ").concat(d?"border-red-500":"border-gray-200","\n ").concat(b?"bg-gray-100 text-gray-500 placeholder-gray-300":"bg-gray-100 placeholder-gray-400 text-dark","\n focus:outline-none\n ").concat((T="",O="",x&&"left"===k&&(T="pl-10"),x&&"right"===k&&(O="pr-10"),C&&(O="pr-10"),"".concat(T," ").concat(O)),"\n ").concat(y,"\n "),D="\n flex items-center rounded-l-[12px] border border-r-0 ".concat({sm:"px-1 text-xs",md:"px-2 text-sm",lg:"px-4 text-base"}[a],"\n ").concat(d?"border-red-500":"border-gray-200","\n ").concat(b?"bg-gray-50":"","\n ").concat(M,"\n "),R={id:r,value:i,onChange:function(e){l&&l(e)},placeholder:c,disabled:b,className:A,"aria-invalid":!!d,"aria-describedby":d?"".concat(r,"-error"):p?"".concat(r,"-help"):void 0};return t("div",{className:"mb-4",children:[o&&t("label",{htmlFor:r,className:"mb-1 block text-sm font-medium text-gray-600",children:[o,u&&e("span",{className:"ml-1 text-red-500",children:"*"})]}),e("div",{className:"relative",children:t("div",{className:"flex",children:[N&&e("div",{className:D,children:N}),t("div",{className:"relative ".concat(N?"flex-1":"w-full"),children:[x&&"left"===k&&e("div",{className:"pointer-events-none absolute inset-y-0 left-0 flex items-center pl-3 z-10",children:x}),e("input",le({},R,{type:m,className:"".concat(R.className," ").concat(N?"w-full border px-3":"rounded-l-[12px] border-l")},E)),x&&"right"===k&&e("div",{className:"pointer-events-none absolute inset-y-0 right-0 flex items-center pr-3 z-10",children:x}),C&&e("div",{className:"absolute right-3 top-1/2 -translate-y-1/2 cursor-pointer z-10",children:C})]})]})}),p&&!d&&e("p",{id:"".concat(r,"-help"),className:"mt-1 text-sm text-gray-500",children:p}),d&&e("p",{id:"".concat(r,"-error"),className:"mt-1 text-sm text-red-500",children:d})]})},ye=function(r){var o=r.id,i=r.label,d=r.value,h=void 0===d?[]:d,u=r.size,p=void 0===u?"md":u,f=r.onChange,m=r.placeholder,g=void 0===m?"Type to search or add tags...":m,y=r.error,v=r.required,b=void 0!==v&&v,x=r.helpText,w=r.className,k=void 0===w?"":w,C=r.disabled,N=void 0!==C&&C,S=r.predefinedTags,M=void 0===S?[]:S,T=r.tagBackgroundColor,O=void 0===T?"bg-primary":T,E=r.tagTextColor,A=void 0===E?"text-white":E,D=r.maxTags,R=r.allowCustomTags,L=void 0===R||R;ce(r,["id","label","value","size","onChange","placeholder","error","required","helpText","className","disabled","predefinedTags","tagBackgroundColor","tagTextColor","maxTags","allowCustomTags"]);var I=s(""),z=I[0],P=I[1],B=s(!1),$=B[0],V=B[1],j=a(null),F=a(null),H={sm:"text-xs px-2 py-0.5",md:"text-sm px-2 py-1",lg:"text-base px-3 py-1.5"},_=c((function(){return z?M.filter((function(e){return e.label.toLowerCase().includes(z.toLowerCase())&&!h.some((function(t){return t===e.value}))})):M.filter((function(e){return!h.some((function(t){return t===e.value}))}))}),[z,M,h]);l((function(){var e=function(e){F.current&&!F.current.contains(e.target)&&V(!1)};return document.addEventListener("mousedown",e),function(){return document.removeEventListener("mousedown",e)}}),[]);var q=function(e){if(e&&!(D&&h.length>=D)&&!h.find((function(t){return t.toLowerCase()===e.toLowerCase()}))){var t,n=M.find((function(t){return t.label.toLowerCase()===e.toLowerCase()||t.value.toLowerCase()===e.toLowerCase()}));if(n)t=n.value;else{if(!L)return;t=e}var r=de(de([],h,!0),[t],!1);null==f||f(r),P(""),V(!1)}},W=function(e){var t=h.filter((function(t){return t!==e}));null==f||f(t)};return t("div",{className:"mb-4",children:[i&&t("label",{htmlFor:o,className:"mb-1 block text-sm font-medium text-gray-600",children:[i,b&&e("span",{className:"ml-1 text-red-500",children:"*"})]}),t("div",{className:"relative",ref:F,children:[t("div",{className:"w-full rounded-[12px] border ".concat(y?"border-red-500":"border-gray-200"," ").concat(N?"bg-gray-100 text-gray-500":"bg-gray-100 text-dark"," focus-within:outline-none focus-within:ring-1 focus-within:ring-primary ").concat(k," ").concat({sm:"text-xs px-3 py-1.5 text-sm min-h-[32px]",md:"text-sm px-4 py-2 text-base min-h-[40px]",lg:"text-base px-4 py-3 text-lg min-h-[48px]"}[p]," flex flex-wrap items-center gap-1"),children:[h.map((function(n){return t("span",{className:"inline-flex items-center rounded-full ".concat(O," ").concat(A," ").concat(H[p]," font-medium"),children:[n,!N&&e("button",{type:"button",onClick:function(){return W(n)},className:"ml-1 inline-flex h-4 w-4 items-center justify-center rounded-full hover:bg-black hover:bg-opacity-20",children:e("svg",{className:"h-3 w-3",fill:"currentColor",viewBox:"0 0 20 20",children:e("path",{fillRule:"evenodd",d:"M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z",clipRule:"evenodd"})})})]},n)})),e("input",{ref:j,id:o,type:"text",value:z,onChange:function(e){var t=e.target.value;P(t),V(!0)},onKeyDown:function(e){"Enter"===e.key&&z.trim()?(e.preventDefault(),q(z.trim())):"Backspace"===e.key&&!z&&h.length>0?W(h[h.length-1]):"Escape"===e.key&&(V(!1),P(""))},onFocus:function(){V(!0)},placeholder:0===h.length?g:"",disabled:N||D&&h.length>=D,className:"flex-1 border-none bg-transparent outline-none placeholder-gray-400 min-w-[120px]","aria-invalid":!!y,"aria-describedby":y?"".concat(h,"-error"):x?"".concat(h,"-help"):void 0})]}),$&&!N&&(_.length>0||z&&L)&&t("div",{className:"absolute z-10 mt-1 w-full bg-white border border-gray-200 rounded-[12px] shadow-lg backdrop-blur-sm bg-white/95 max-h-60 overflow-auto p-4",children:[_.length>0&&e("div",{className:"flex flex-wrap gap-2 mb-3",children:_.map((function(t){return e("button",{type:"button",onClick:function(){return function(e){q(e.value)}(t)},className:"inline-flex items-center rounded-full bg-gray-200 text-gray-700 hover:bg-gray-300 transition-colors duration-200 ".concat(H[p]," font-medium"),children:t.label},t.value)}))}),z&&L&&!M.some((function(e){return e.label.toLowerCase()===z.toLowerCase()}))&&t(n,{children:[_.length>0&&e("div",{className:"border-t border-gray-100 pt-3 mb-2",children:e("span",{className:"text-xs text-gray-500 font-medium",children:"CREATE NEW TAG"})}),e("div",{className:"flex flex-wrap gap-2",children:t("button",{type:"button",onClick:function(){return q(z)},className:"inline-flex items-center rounded-full bg-blue-100 text-blue-700 hover:bg-blue-200 transition-colors duration-200 ".concat(H[p]," font-medium border border-blue-200"),children:[e("svg",{className:"w-3 h-3 mr-1",fill:"currentColor",viewBox:"0 0 20 20",children:e("path",{fillRule:"evenodd",d:"M10 3a1 1 0 011 1v5h5a1 1 0 110 2h-5v5a1 1 0 11-2 0v-5H4a1 1 0 110-2h5V4a1 1 0 011-1z",clipRule:"evenodd"})}),z]})})]}),0===_.length&&(!z||!L)&&e("div",{className:"text-center py-4 text-gray-500 text-sm",children:"No matching tags found"})]})]}),D&&t("div",{className:"mt-1 text-xs text-gray-500",children:[h.length,"/",D," tags"]}),x&&!y&&e("p",{id:"".concat(h,"-help"),className:"mt-1 text-sm text-gray-500",children:x}),y&&e("p",{id:"".concat(h,"-error"),className:"mt-1 text-sm text-red-500",children:y})]})},ve=function(){var n=s([]),r=n[0],o=n[1],i=s([]),a=i[0],l=i[1];return t("div",{className:"max-w-2xl mx-auto p-6 bg-gray-50 min-h-screen",children:[e("h1",{className:"text-2xl font-bold mb-8 text-gray-900",children:"TagInput Component Demo"}),t("div",{className:"space-y-8",children:[e(ye,{id:"skills",label:"Skills & Technologies",value:r,onChange:o,predefinedTags:[{label:"React",value:"react"},{label:"JavaScript",value:"javascript"},{label:"TypeScript",value:"typescript"},{label:"Node.js",value:"nodejs"},{label:"Python",value:"python"},{label:"CSS",value:"css"},{label:"HTML",value:"html"},{label:"Vue.js",value:"vuejs"},{label:"Angular",value:"angular"},{label:"Next.js",value:"nextjs"}],placeholder:"Search or add skills...",helpText:"Select from predefined options or add your own custom tags",size:"md"}),e(ye,{id:"custom-tags",label:"Project Categories (Custom Colors)",value:a,onChange:l,predefinedTags:[{label:"Web Development",value:"web"},{label:"Mobile App",value:"mobile"},{label:"AI/ML",value:"ai"},{label:"UI/UX Design",value:"design"}],placeholder:"Add project categories...",tagBackgroundColor:"bg-purple-500",tagTextColor:"text-white",maxTags:5,size:"lg",helpText:"Maximum 5 tags allowed with custom purple styling"}),t("div",{className:"mt-8 p-4 bg-white rounded-lg border",children:[e("h3",{className:"font-medium mb-2",children:"Selected Skills:"}),e("pre",{className:"text-sm bg-gray-100 p-2 rounded",children:JSON.stringify(r,null,2)})]}),t("div",{className:"p-4 bg-white rounded-lg border",children:[e("h3",{className:"font-medium mb-2",children:"Selected Categories:"}),e("pre",{className:"text-sm bg-gray-100 p-2 rounded",children:JSON.stringify(a,null,2)})]})]})]})},be=function(n){var r=n.id,o=n.label,i=n.value,c=void 0===i?{}:i,d=n.size,h=void 0===d?"md":d,u=n.onChange,p=n.placeholder,f=n.error,m=n.required,g=void 0!==m&&m,y=n.helpText,v=n.className,b=void 0===v?"":v,x=n.disabled,w=void 0!==x&&x,k=n.mode,C=void 0===k?"date":k;n.minDate,n.maxDate,n.showWeekNumbers;var N=n.firstDayOfWeek,S=void 0===N?1:N;ce(n,["id","label","value","size","onChange","placeholder","error","required","helpText","className","disabled","mode","minDate","maxDate","showWeekNumbers","firstDayOfWeek"]);var M=s(!1),T=M[0],O=M[1],E=s(new Date),A=E[0],D=E[1],R=s(c.startDate||null),L=R[0],I=R[1],z=s(c.endDate||null),P=z[0],B=z[1],$=s(c.time||"12:00 PM"),V=$[0],j=$[1],F=s(!1),H=F[0],_=F[1],q=s(A.getFullYear().toString()),W=q[0],K=q[1],J=s(!1),U=J[0],G=J[1],Y=a(null),X=a(null),Q=0===S?["Sun","Mon","Tue","Wed","Thu","Fri","Sat"]:["Mon","Tue","Wed","Thu","Fri","Sat","Sun"];l((function(){var e=function(e){Y.current&&!Y.current.contains(e.target)&&X.current&&!X.current.contains(e.target)&&O(!1)};return document.addEventListener("mousedown",e),function(){return document.removeEventListener("mousedown",e)}}),[]);var Z=function(e){return e.toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric"})},ee=function(e,t){var n=Z(e);return t?"".concat(n," ").concat(t):n},te=function(){if(!L&&!P)return"";switch(C){case"date":return L?Z(L):"";case"datetime":return L?ee(L,V):"";case"daterange":return L&&P?"".concat(Z(L)," - ").concat(Z(P)):L?Z(L):"";case"datetimerange":return L&&P?"".concat(ee(L,V)," - ").concat(ee(P,V)):L?ee(L,V):"";default:return""}},ne=function(e,t){return e.toDateString()===t.toDateString()},re=function(e){D(new Date(A.getFullYear(),A.getMonth()+e,1))},oe=function(e){D(new Date(A.getFullYear()+e,A.getMonth(),1))},ie=function(){var e=parseInt(W);!isNaN(e)&&e>=1900&&e<=2100?D(new Date(e,A.getMonth(),1)):K(A.getFullYear().toString()),_(!1)};return t("div",{className:"mb-4",children:[o&&t("label",{htmlFor:r,className:"mb-1 block text-sm font-medium text-gray-600",children:[o,g&&e("span",{className:"ml-1 text-red-500",children:"*"})]}),t("div",{className:"relative",children:[t("div",{ref:X,onClick:function(){return!w&&O(!T)},className:"w-full rounded-[12px] border ".concat(f?"border-red-500":"border-gray-200"," ").concat(w?"bg-gray-100 text-gray-500 cursor-not-allowed":"bg-gray-100 text-dark cursor-pointer hover:bg-gray-50"," focus:outline-none focus:ring-1 focus:ring-primary ").concat(b," ").concat({sm:"text-xs px-3 py-1.5 text-sm min-h-[32px]",md:"text-sm px-4 py-2 text-base min-h-[40px]",lg:"text-base px-4 py-3 text-lg min-h-[48px]"}[h]," flex items-center justify-between"),children:[e("span",{className:te()?"text-gray-900":"text-gray-400",children:te()||p||"Select date..."}),e("svg",{className:"w-5 h-5 text-gray-400 transition-transform ".concat(T?"rotate-180":""),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 7V3m8 4V3m-9 8h10M5 21h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v12a2 2 0 002 2z"})})]}),T&&!w&&t("div",{ref:Y,className:"absolute z-[1000] mt-1 bg-white border border-gray-200 rounded-[12px] shadow-lg backdrop-blur-sm bg-white/95 p-4 min-w-[320px]",children:[t("div",{className:"flex items-center justify-between mb-4",children:[e("div",{className:"flex items-center space-x-1",children:e("button",{type:"button",onClick:function(){return re(-1)},className:"p-1 hover:bg-gray-100 rounded-md transition-colors",children:e("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 19l-7-7 7-7"})})})}),t("div",{className:"flex items-center space-x-2",children:[e("span",{className:"font-medium text-gray-900",children:["January","February","March","April","May","June","July","August","September","October","November","December"][A.getMonth()]}),t("div",{className:"flex items-center space-x-1",children:[H?e("input",{type:"text",value:W,onChange:function(e){return K(e.target.value)},onBlur:ie,onKeyDown:function(e){"Enter"===e.key?ie():"Escape"===e.key&&(K(A.getFullYear().toString()),_(!1))},className:"w-16 text-center font-medium text-gray-900 bg-gray-50 border border-gray-200 rounded px-1 py-0.5 text-sm focus:outline-none focus:ring-1 focus:ring-primary-500",autoFocus:!0}):e("button",{type:"button",onClick:function(){_(!0),K(A.getFullYear().toString())},className:"font-medium text-gray-900 hover:text-primary-600 transition-colors px-1",children:A.getFullYear()}),t("div",{className:"flex flex-col",children:[e("button",{type:"button",onClick:function(){return oe(1)},className:"p-0.5 hover:bg-gray-100 rounded transition-colors",children:e("svg",{className:"w-3 h-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 15l7-7 7 7"})})}),e("button",{type:"button",onClick:function(){return oe(-1)},className:"p-0.5 hover:bg-gray-100 rounded transition-colors",children:e("svg",{className:"w-3 h-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})})]})]})]}),e("div",{className:"flex items-center space-x-1",children:e("button",{type:"button",onClick:function(){return re(1)},className:"p-1 hover:bg-gray-100 rounded-md transition-colors",children:e("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})})})})]}),e("div",{className:"grid grid-cols-7 gap-1 mb-2",children:Q.map((function(t){return e("div",{className:"text-center text-xs font-medium text-gray-500 py-2",children:t},t)}))}),e("div",{className:"grid grid-cols-7 gap-1 mb-4",children:function(){var e=A.getFullYear(),t=A.getMonth(),n=new Date(e,t,1),r=new Date(e,t+1,0).getDate(),o=n.getDay();1===S&&(o=0===o?6:o-1);for(var i=[],s=0;s<o;s++){var a=new Date(e,t,-(o-1-s));i.push({date:a,isCurrentMonth:!1})}for(s=1;s<=r;s++)i.push({date:new Date(e,t,s),isCurrentMonth:!0});var l=42-i.length;for(s=1;s<=l;s++)i.push({date:new Date(e,t+1,s),isCurrentMonth:!1});return i}().map((function(t,n){var r=t.date,o=t.isCurrentMonth,i=function(e){return!(!L||!ne(e,L))||!(!P||!ne(e,P))}(r),s=function(e){return!(!L||!P)&&e>=L&&e<=P}(r),a=ne(r,new Date),l=L&&ne(r,L),c=P&&ne(r,P);return e("button",{type:"button",onClick:function(){return function(e){if("daterange"===C||"datetimerange"===C){if(!L||L&&P||U)if(U){e<L?(I(e),B(L)):B(e),G(!1);var t=le({startDate:L,endDate:e<L?L:e},"datetimerange"===C&&{time:V});null==u||u(t)}else I(e),B(null),G(!0)}else I(e),t=le({startDate:e},"datetime"===C&&{time:V}),null==u||u(t),"date"===C&&O(!1)}(r)},className:"\n w-8 h-8 text-sm transition-all duration-200 relative flex items-center justify-center\n ".concat(o?"text-gray-900":"text-gray-300","\n ").concat(i?"bg-primary-500 text-white font-medium rounded-full":s?"bg-primary-100 text-primary-700 rounded-sm":"hover:bg-gray-100 rounded-md","\n ").concat(a&&!i?"ring-2 ring-primary-500 ring-opacity-30":"","\n ").concat(l||c?"rounded-full":"","\n "),children:r.getDate()},n)}))}),("datetime"===C||"datetimerange"===C)&&t("div",{className:"border-t border-gray-100 pt-4",children:[e("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"Time"}),e("select",{value:V,onChange:function(e){return function(e){j(e);var t=le(le({startDate:L},P&&{endDate:P}),{time:e});null==u||u(t)}(e.target.value)},className:"w-full px-3 py-2 border border-gray-200 rounded-md focus:outline-none focus:ring-1 focus:ring-primary-500 bg-white",children:function(){for(var e=[],t=1;t<=12;t++)for(var n=0;n<60;n+=15){var r=n.toString().padStart(2,"0");e.push("".concat(t,":").concat(r," AM")),e.push("".concat(t,":").concat(r," PM"))}return e}().map((function(t){return e("option",{value:t,children:t},t)}))})]}),t("div",{className:"flex justify-end space-x-2 mt-4 pt-4 border-t border-gray-100",children:[e("button",{type:"button",onClick:function(){O(!1),I(null),B(null),G(!1),null==u||u({})},className:"px-3 py-1.5 text-sm text-gray-600 hover:text-gray-800 transition-colors",children:"Clear"}),e("button",{type:"button",onClick:function(){return O(!1)},className:"px-4 py-1.5 text-sm bg-primary-500 text-white rounded-md hover:bg-primary-600 transition-colors",children:"Done"})]})]})]}),y&&!f&&e("p",{id:"".concat(r,"-help"),className:"mt-1 text-sm text-gray-500",children:y}),f&&e("p",{id:"".concat(r,"-error"),className:"mt-1 text-sm text-red-500",children:f})]})},xe=function(){var n=s({}),r=n[0],o=n[1],i=s({}),a=i[0],l=i[1],c=s({}),d=c[0],h=c[1],u=s({}),p=u[0],f=u[1];return t("div",{className:"max-w-4xl mx-auto p-6 bg-gray-50 min-h-screen",children:[e("h1",{className:"text-3xl font-bold mb-8 text-gray-900",children:"DateTime Picker Component"}),t("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-8",children:[t("div",{className:"space-y-6",children:[e(be,{id:"single-date",label:"Single Date",value:r,onChange:o,placeholder:"Select a date",mode:"date",helpText:"Choose any single date",size:"md"}),e(be,{id:"datetime",label:"Date & Time",value:a,onChange:l,placeholder:"Select date and time",mode:"datetime",helpText:"Choose date with specific time",size:"md"})]}),t("div",{className:"space-y-6",children:[e(be,{id:"date-range",label:"Date Range",value:d,onChange:h,placeholder:"Select date range",mode:"daterange",helpText:"Choose start and end dates",size:"md"}),e(be,{id:"datetime-range",label:"Date & Time Range",value:p,onChange:f,placeholder:"Select date and time range",mode:"datetimerange",helpText:"Choose date range with time",size:"md"})]})]}),t("div",{className:"mt-12 grid grid-cols-1 md:grid-cols-2 gap-8",children:[t("div",{className:"space-y-4",children:[e("h3",{className:"text-lg font-semibold text-gray-800",children:"Single Date Value:"}),e("pre",{className:"bg-white p-4 rounded-lg border text-sm overflow-x-auto",children:JSON.stringify(r,null,2)}),e("h3",{className:"text-lg font-semibold text-gray-800",children:"DateTime Value:"}),e("pre",{className:"bg-white p-4 rounded-lg border text-sm overflow-x-auto",children:JSON.stringify(a,null,2)})]}),t("div",{className:"space-y-4",children:[e("h3",{className:"text-lg font-semibold text-gray-800",children:"Date Range Value:"}),e("pre",{className:"bg-white p-4 rounded-lg border text-sm overflow-x-auto",children:JSON.stringify(d,null,2)}),e("h3",{className:"text-lg font-semibold text-gray-800",children:"DateTime Range Value:"}),e("pre",{className:"bg-white p-4 rounded-lg border text-sm overflow-x-auto",children:JSON.stringify(p,null,2)})]})]})]})};function we(n){var r=n.placeholder,o=void 0===r?"Search...":r,i=n.onSearch,a=n.className,l=void 0===a?"":a,c=s(""),d=c[0],h=c[1];return t("div",{className:"relative ".concat(l),children:[e("input",{type:"text",value:d,onChange:function(e){e.preventDefault(),h(e.target.value),i(d)},placeholder:o,className:"w-full rounded-lg border border-gray-200 bg-white py-2 pl-8 pr-4 text-sm focus:outline-none focus:ring-1 focus:ring-primary"}),t("svg",{className:"absolute left-2 top-1/2 -translate-y-1/2 transform text-gray-400",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e("circle",{cx:"11",cy:"11",r:"8"}),e("line",{x1:"21",y1:"21",x2:"16.65",y2:"16.65"})]})]})}function ke(r){var o,i=r.options,c=r.placeholder,d=void 0===c?"Select an option":c,h=r.onChange,u=r.value,p=r.size,f=void 0===p?"md":p,m=r.className,g=void 0===m?"":m,y=r.name,v=r.id,b=r.disabled,x=void 0!==b&&b,w=r.label,k=r.required,C=r.error,N=r.helpText,S=r.fullWidth,M=void 0===S||S,T=r.searchable,O=void 0!==T&&T,A=r.multiple,D=void 0!==A&&A,R=r.maxSelected,L=r.showSelectedCount,I=void 0!==L&&L,z=r.closeOnSelect,P=void 0===z||z,B=s(!1),$=B[0],V=B[1],j=s(""),F=j[0],H=j[1],_=s((function(){if(!u)return[];if(D&&Array.isArray(u))return u.map((function(e){return i.find((function(t){return t.value===e}))})).filter(Boolean);if(!D&&"string"==typeof u){var e=i.find((function(e){return e.value===u}));return e?[e]:[]}return[]})),q=_[0],W=_[1],K=a(null),J=O?i.filter((function(e){return(e.label||e.value).toLowerCase().includes(F.toLowerCase())})):i;l((function(){var e=function(e){K.current&&!K.current.contains(e.target)&&(V(!1),H(""))};return document.addEventListener("mousedown",e),function(){document.removeEventListener("mousedown",e)}}),[]);return t("div",{ref:K,className:"".concat(M?"w-full":"w-fit"," mb-4"),children:[w&&t("label",{htmlFor:v,className:"mb-1 block text-sm font-medium text-gray-700",children:[w,k&&e("span",{className:"ml-1 text-red-500",children:"*"})]}),t("div",{className:"relative",children:[t("button",{type:"button",className:"flex items-center justify-between rounded-lg border ".concat(C?"border-red-500":"border-gray-200"," bg-gray-100 shadow-sm ").concat({sm:"text-xs px-3 py-1.5 text-sm min-h-[32px]",md:"text-sm px-4 py-2 text-base min-h-[40px]",lg:"text-base px-4 py-3 text-lg min-h-[48px]"}[f]," text-gray-700 hover:border-gray-300 focus:border-primary-500 focus:outline-none focus:ring-2 focus:ring-primary-500/20 ").concat(x?"cursor-not-allowed bg-gray-50 opacity-50":""," ").concat(g," ").concat(M?"w-full":""," transition-all duration-200"),onClick:function(){return!x&&V(!$)},disabled:x,id:v,"aria-haspopup":"listbox","aria-expanded":$,children:[e("div",{className:"flex-1 flex items-center gap-1 min-w-0",children:D&&q.length>0?t("div",{className:"flex flex-wrap gap-1 flex-1",children:[q.slice(0,3).map((function(n){return t("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 bg-primary-100 text-primary-800 text-sm rounded-md",children:[e("span",{className:"truncate max-w-[120px]",children:n.label||n.value}),e(re,{className:"h-3 w-3 cursor-pointer hover:text-primary-900",onClick:function(e){return function(e,t){t.stopPropagation();var n=q.filter((function(t){return t.value!==e.value}));W(n);var r=D?n.map((function(e){return e.value})):"";h({target:{id:v||"",value:r}})}(n,e)}})]},n.value)})),q.length>3&&t("span",{className:"text-sm text-gray-500 px-1",children:["+",q.length-3," more"]})]}):e("span",{className:"truncate ".concat(0===q.length?"text-gray-400":"text-gray-700"),children:function(){var e,t,n,r;return 0===q.length?d:D?I&&q.length>2?"".concat(q.length," items selected"):q.length<=2?q.map((function(e){return e.label||e.value})).join(", "):"".concat((null===(n=q[0])||void 0===n?void 0:n.label)||(null===(r=q[0])||void 0===r?void 0:r.value)," +").concat(q.length-1," more"):(null===(e=q[0])||void 0===e?void 0:e.label)||(null===(t=q[0])||void 0===t?void 0:t.value)}()})}),e(E,{className:"ml-2 h-4 w-4 text-gray-400 transition-transform flex-shrink-0 ".concat($?"rotate-180 transform":"")})]}),$&&t("div",{className:"absolute z-50 mt-1 w-full rounded-lg border border-gray-200 bg-white shadow-lg",role:"listbox",children:[O&&e("div",{className:"sticky top-0 border-b border-gray-100 bg-white p-3",children:e("input",{type:"text",className:"w-full rounded-md border border-gray-200 px-3 py-2 text-sm focus:border-primary-500 focus:outline-none focus:ring-2 focus:ring-primary-500/20 transition-all duration-200",placeholder:"Search...",value:F,onChange:function(e){return H(e.target.value)},autoFocus:!0})}),e("div",{className:"max-h-60 overflow-auto py-1",children:J.length>0?t(n,{children:[D&&q.length>0&&t("div",{className:"px-3 py-2 text-xs text-gray-500 border-b border-gray-100",children:[q.length," selected",R&&" of ".concat(R," max")]}),J.map((function(n){var r=function(e){return q.some((function(t){return t.value===e.value}))}(n),o=n.disabled||R&&!r&&q.length>=R;return t("div",{className:"cursor-pointer px-3 py-2 flex items-center justify-between transition-colors duration-150 ".concat(r?"bg-primary-50 text-primary-700":"text-gray-700 hover:bg-gray-50"," ").concat(o?"cursor-not-allowed text-gray-400 hover:bg-white opacity-50":""),onClick:function(){return!o&&function(e){var t;if(!e.disabled){var n;if(D)if(q.some((function(t){return t.value===e.value})))n=q.filter((function(t){return t.value!==e.value}));else{if(R&&q.length>=R)return;n=de(de([],q,!0),[e],!1)}else n=[e];W(n);var r=D?n.map((function(e){return e.value})):(null===(t=n[0])||void 0===t?void 0:t.value)||"";h({target:{id:v||"",value:r}}),D&&!P||(V(!1),H(""))}}(n)},role:"option","aria-selected":r,"aria-disabled":o,children:[e("span",{className:"flex-1 text-sm font-medium",children:n.label||n.value}),D&&r&&e("div",{className:"w-4 h-4 bg-primary-500 rounded-sm flex items-center justify-center",children:e("svg",{className:"w-3 h-3 text-white",fill:"currentColor",viewBox:"0 0 20 20",children:e("path",{fillRule:"evenodd",d:"M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z",clipRule:"evenodd"})})})]},n.value)}))]}):e("div",{className:"px-3 py-2 text-gray-500 text-center",children:"No options found"})})]})]}),C&&e("p",{className:"mt-1 text-sm text-red-600",children:C}),N&&!C&&e("p",{className:"mt-1 text-sm text-gray-500",children:N}),y&&e(n,{children:D?q.map((function(t,n){return e("input",{type:"hidden",name:"".concat(y,"[]"),value:t.value},"".concat(t.value,"-").concat(n))})):e("input",{type:"hidden",name:y,value:(null===(o=q[0])||void 0===o?void 0:o.value)||""})})]})}function Ce(e){this.content=e}function Ne(e,t,n){for(let r=0;;r++){if(r==e.childCount||r==t.childCount)return e.childCount==t.childCount?null:n;let o=e.child(r),i=t.child(r);if(o!=i){if(!o.sameMarkup(i))return n;if(o.isText&&o.text!=i.text){for(let e=0;o.text[e]==i.text[e];e++)n++;return n}if(o.content.size||i.content.size){let e=Ne(o.content,i.content,n+1);if(null!=e)return e}n+=o.nodeSize}else n+=o.nodeSize}}function Se(e,t,n,r){for(let o=e.childCount,i=t.childCount;;){if(0==o||0==i)return o==i?null:{a:n,b:r};let s=e.child(--o),a=t.child(--i),l=s.nodeSize;if(s!=a){if(!s.sameMarkup(a))return{a:n,b:r};if(s.isText&&s.text!=a.text){let e=0,t=Math.min(s.text.length,a.text.length);for(;e<t&&s.text[s.text.length-e-1]==a.text[a.text.length-e-1];)e++,n--,r--;return{a:n,b:r}}if(s.content.size||a.content.size){let e=Se(s.content,a.content,n-1,r-1);if(e)return e}n-=l,r-=l}else n-=l,r-=l}}Ce.prototype={constructor:Ce,find:function(e){for(var t=0;t<this.content.length;t+=2)if(this.content[t]===e)return t;return-1},get:function(e){var t=this.find(e);return-1==t?void 0:this.content[t+1]},update:function(e,t,n){var r=n&&n!=e?this.remove(n):this,o=r.find(e),i=r.content.slice();return-1==o?i.push(n||e,t):(i[o+1]=t,n&&(i[o]=n)),new Ce(i)},remove:function(e){var t=this.find(e);if(-1==t)return this;var n=this.content.slice();return n.splice(t,2),new Ce(n)},addToStart:function(e,t){return new Ce([e,t].concat(this.remove(e).content))},addToEnd:function(e,t){var n=this.remove(e).content.slice();return n.push(e,t),new Ce(n)},addBefore:function(e,t,n){var r=this.remove(t),o=r.content.slice(),i=r.find(e);return o.splice(-1==i?o.length:i,0,t,n),new Ce(o)},forEach:function(e){for(var t=0;t<this.content.length;t+=2)e(this.content[t],this.content[t+1])},prepend:function(e){return(e=Ce.from(e)).size?new Ce(e.content.concat(this.subtract(e).content)):this},append:function(e){return(e=Ce.from(e)).size?new Ce(this.subtract(e).content.concat(e.content)):this},subtract:function(e){var t=this;e=Ce.from(e);for(var n=0;n<e.content.length;n+=2)t=t.remove(e.content[n]);return t},toObject:function(){var e={};return this.forEach((function(t,n){e[t]=n})),e},get size(){return this.content.length>>1}},Ce.from=function(e){if(e instanceof Ce)return e;var t=[];if(e)for(var n in e)t.push(n,e[n]);return new Ce(t)};class Me{constructor(e,t){if(this.content=e,this.size=t||0,null==t)for(let t=0;t<e.length;t++)this.size+=e[t].nodeSize}nodesBetween(e,t,n,r=0,o){for(let i=0,s=0;s<t;i++){let a=this.content[i],l=s+a.nodeSize;if(l>e&&!1!==n(a,r+s,o||null,i)&&a.content.size){let o=s+1;a.nodesBetween(Math.max(0,e-o),Math.min(a.content.size,t-o),n,r+o)}s=l}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,t,n,r){let o="",i=!0;return this.nodesBetween(e,t,((s,a)=>{let l=s.isText?s.text.slice(Math.max(e,a)-a,t-a):s.isLeaf?r?"function"==typeof r?r(s):r:s.type.spec.leafText?s.type.spec.leafText(s):"":"";s.isBlock&&(s.isLeaf&&l||s.isTextblock)&&n&&(i?i=!1:o+=n),o+=l}),0),o}append(e){if(!e.size)return this;if(!this.size)return e;let t=this.lastChild,n=e.firstChild,r=this.content.slice(),o=0;for(t.isText&&t.sameMarkup(n)&&(r[r.length-1]=t.withText(t.text+n.text),o=1);o<e.content.length;o++)r.push(e.content[o]);return new Me(r,this.size+e.size)}cut(e,t=this.size){if(0==e&&t==this.size)return this;let n=[],r=0;if(t>e)for(let o=0,i=0;i<t;o++){let s=this.content[o],a=i+s.nodeSize;a>e&&((i<e||a>t)&&(s=s.isText?s.cut(Math.max(0,e-i),Math.min(s.text.length,t-i)):s.cut(Math.max(0,e-i-1),Math.min(s.content.size,t-i-1))),n.push(s),r+=s.nodeSize),i=a}return new Me(n,r)}cutByIndex(e,t){return e==t?Me.empty:0==e&&t==this.content.length?this:new Me(this.content.slice(e,t))}replaceChild(e,t){let n=this.content[e];if(n==t)return this;let r=this.content.slice(),o=this.size+t.nodeSize-n.nodeSize;return r[e]=t,new Me(r,o)}addToStart(e){return new Me([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new Me(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let t=0;t<this.content.length;t++)if(!this.content[t].eq(e.content[t]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(e){let t=this.content[e];if(!t)throw new RangeError("Index "+e+" out of range for "+this);return t}maybeChild(e){return this.content[e]||null}forEach(e){for(let t=0,n=0;t<this.content.length;t++){let r=this.content[t];e(r,n,t),n+=r.nodeSize}}findDiffStart(e,t=0){return Ne(this,e,t)}findDiffEnd(e,t=this.size,n=e.size){return Se(this,e,t,n)}findIndex(e){if(0==e)return Oe(0,e);if(e==this.size)return Oe(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let t=0,n=0;;t++){let r=n+this.child(t).nodeSize;if(r>=e)return r==e?Oe(t+1,r):Oe(t,n);n=r}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map((e=>e.toJSON())):null}static fromJSON(e,t){if(!t)return Me.empty;if(!Array.isArray(t))throw new RangeError("Invalid input for Fragment.fromJSON");return new Me(t.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return Me.empty;let t,n=0;for(let r=0;r<e.length;r++){let o=e[r];n+=o.nodeSize,r&&o.isText&&e[r-1].sameMarkup(o)?(t||(t=e.slice(0,r)),t[t.length-1]=o.withText(t[t.length-1].text+o.text)):t&&t.push(o)}return new Me(t||e,n)}static from(e){if(!e)return Me.empty;if(e instanceof Me)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new Me([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}Me.empty=new Me([],0);const Te={index:0,offset:0};function Oe(e,t){return Te.index=e,Te.offset=t,Te}function Ee(e,t){if(e===t)return!0;if(!e||"object"!=typeof e||!t||"object"!=typeof t)return!1;let n=Array.isArray(e);if(Array.isArray(t)!=n)return!1;if(n){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(!Ee(e[n],t[n]))return!1}else{for(let n in e)if(!(n in t)||!Ee(e[n],t[n]))return!1;for(let n in t)if(!(n in e))return!1}return!0}let Ae=class e{constructor(e,t){this.type=e,this.attrs=t}addToSet(e){let t,n=!1;for(let r=0;r<e.length;r++){let o=e[r];if(this.eq(o))return e;if(this.type.excludes(o.type))t||(t=e.slice(0,r));else{if(o.type.excludes(this.type))return e;!n&&o.type.rank>this.type.rank&&(t||(t=e.slice(0,r)),t.push(this),n=!0),t&&t.push(o)}}return t||(t=e.slice()),n||t.push(this),t}removeFromSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return e.slice(0,t).concat(e.slice(t+1));return e}isInSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return!0;return!1}eq(e){return this==e||this.type==e.type&&Ee(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,t){if(!t)throw new RangeError("Invalid input for Mark.fromJSON");let n=e.marks[t.type];if(!n)throw new RangeError(`There is no mark type ${t.type} in this schema`);let r=n.create(t.attrs);return n.checkAttrs(r.attrs),r}static sameSet(e,t){if(e==t)return!0;if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(!e[n].eq(t[n]))return!1;return!0}static setFrom(t){if(!t||Array.isArray(t)&&0==t.length)return e.none;if(t instanceof e)return[t];let n=t.slice();return n.sort(((e,t)=>e.type.rank-t.type.rank)),n}};Ae.none=[];class De extends Error{}class Re{constructor(e,t,n){this.content=e,this.openStart=t,this.openEnd=n}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,t){let n=Ie(this.content,e+this.openStart,t);return n&&new Re(n,this.openStart,this.openEnd)}removeBetween(e,t){return new Re(Le(this.content,e+this.openStart,t+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(e,t){if(!t)return Re.empty;let n=t.openStart||0,r=t.openEnd||0;if("number"!=typeof n||"number"!=typeof r)throw new RangeError("Invalid input for Slice.fromJSON");return new Re(Me.fromJSON(e,t.content),n,r)}static maxOpen(e,t=!0){let n=0,r=0;for(let r=e.firstChild;r&&!r.isLeaf&&(t||!r.type.spec.isolating);r=r.firstChild)n++;for(let n=e.lastChild;n&&!n.isLeaf&&(t||!n.type.spec.isolating);n=n.lastChild)r++;return new Re(e,n,r)}}function Le(e,t,n){let{index:r,offset:o}=e.findIndex(t),i=e.maybeChild(r),{index:s,offset:a}=e.findIndex(n);if(o==t||i.isText){if(a!=n&&!e.child(s).isText)throw new RangeError("Removing non-flat range");return e.cut(0,t).append(e.cut(n))}if(r!=s)throw new RangeError("Removing non-flat range");return e.replaceChild(r,i.copy(Le(i.content,t-o-1,n-o-1)))}function Ie(e,t,n,r){let{index:o,offset:i}=e.findIndex(t),s=e.maybeChild(o);if(i==t||s.isText)return e.cut(0,t).append(n).append(e.cut(t));let a=Ie(s.content,t-i-1,n);return a&&e.replaceChild(o,s.copy(a))}function ze(e,t,n){if(n.openStart>e.depth)throw new De("Inserted content deeper than insertion position");if(e.depth-n.openStart!=t.depth-n.openEnd)throw new De("Inconsistent open depths");return Pe(e,t,n,0)}function Pe(e,t,n,r){let o=e.index(r),i=e.node(r);if(o==t.index(r)&&r<e.depth-n.openStart){let s=Pe(e,t,n,r+1);return i.copy(i.content.replaceChild(o,s))}if(n.content.size){if(n.openStart||n.openEnd||e.depth!=r||t.depth!=r){let{start:o,end:s}=function(e,t){let n=t.depth-e.openStart,r=t.node(n).copy(e.content);for(let e=n-1;e>=0;e--)r=t.node(e).copy(Me.from(r));return{start:r.resolveNoCache(e.openStart+n),end:r.resolveNoCache(r.content.size-e.openEnd-n)}}(n,e);return Fe(i,He(e,o,s,t,r))}{let r=e.parent,o=r.content;return Fe(r,o.cut(0,e.parentOffset).append(n.content).append(o.cut(t.parentOffset)))}}return Fe(i,_e(e,t,r))}function Be(e,t){if(!t.type.compatibleContent(e.type))throw new De("Cannot join "+t.type.name+" onto "+e.type.name)}function $e(e,t,n){let r=e.node(n);return Be(r,t.node(n)),r}function Ve(e,t){let n=t.length-1;n>=0&&e.isText&&e.sameMarkup(t[n])?t[n]=e.withText(t[n].text+e.text):t.push(e)}function je(e,t,n,r){let o=(t||e).node(n),i=0,s=t?t.index(n):o.childCount;e&&(i=e.index(n),e.depth>n?i++:e.textOffset&&(Ve(e.nodeAfter,r),i++));for(let e=i;e<s;e++)Ve(o.child(e),r);t&&t.depth==n&&t.textOffset&&Ve(t.nodeBefore,r)}function Fe(e,t){return e.type.checkContent(t),e.copy(t)}function He(e,t,n,r,o){let i=e.depth>o&&$e(e,t,o+1),s=r.depth>o&&$e(n,r,o+1),a=[];return je(null,e,o,a),i&&s&&t.index(o)==n.index(o)?(Be(i,s),Ve(Fe(i,He(e,t,n,r,o+1)),a)):(i&&Ve(Fe(i,_e(e,t,o+1)),a),je(t,n,o,a),s&&Ve(Fe(s,_e(n,r,o+1)),a)),je(r,null,o,a),new Me(a)}function _e(e,t,n){let r=[];if(je(null,e,n,r),e.depth>n){Ve(Fe($e(e,t,n+1),_e(e,t,n+1)),r)}return je(t,null,n,r),new Me(r)}Re.empty=new Re(Me.empty,0,0);class qe{constructor(e,t,n){this.pos=e,this.path=t,this.parentOffset=n,this.depth=t.length/3-1}resolveDepth(e){return null==e?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[3*this.resolveDepth(e)]}index(e){return this.path[3*this.resolveDepth(e)+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e!=this.depth||this.textOffset?1:0)}start(e){return 0==(e=this.resolveDepth(e))?0:this.path[3*e-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(!(e=this.resolveDepth(e)))throw new RangeError("There is no position before the top-level node");return e==this.depth+1?this.pos:this.path[3*e-1]}after(e){if(!(e=this.resolveDepth(e)))throw new RangeError("There is no position after the top-level node");return e==this.depth+1?this.pos:this.path[3*e-1]+this.path[3*e].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,t=this.index(this.depth);if(t==e.childCount)return null;let n=this.pos-this.path[this.path.length-1],r=e.child(t);return n?e.child(t).cut(n):r}get nodeBefore(){let e=this.index(this.depth),t=this.pos-this.path[this.path.length-1];return t?this.parent.child(e).cut(0,t):0==e?null:this.parent.child(e-1)}posAtIndex(e,t){t=this.resolveDepth(t);let n=this.path[3*t],r=0==t?0:this.path[3*t-1]+1;for(let t=0;t<e;t++)r+=n.child(t).nodeSize;return r}marks(){let e=this.parent,t=this.index();if(0==e.content.size)return Ae.none;if(this.textOffset)return e.child(t).marks;let n=e.maybeChild(t-1),r=e.maybeChild(t);if(!n){let e=n;n=r,r=e}let o=n.marks;for(var i=0;i<o.length;i++)!1!==o[i].type.spec.inclusive||r&&o[i].isInSet(r.marks)||(o=o[i--].removeFromSet(o));return o}marksAcross(e){let t=this.parent.maybeChild(this.index());if(!t||!t.isInline)return null;let n=t.marks,r=e.parent.maybeChild(e.index());for(var o=0;o<n.length;o++)!1!==n[o].type.spec.inclusive||r&&n[o].isInSet(r.marks)||(n=n[o--].removeFromSet(n));return n}sharedDepth(e){for(let t=this.depth;t>0;t--)if(this.start(t)<=e&&this.end(t)>=e)return t;return 0}blockRange(e=this,t){if(e.pos<this.pos)return e.blockRange(this);for(let n=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);n>=0;n--)if(e.pos<=this.end(n)&&(!t||t(this.node(n))))return new Ue(this,e,n);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos<this.pos?e:this}toString(){let e="";for(let t=1;t<=this.depth;t++)e+=(e?"/":"")+this.node(t).type.name+"_"+this.index(t-1);return e+":"+this.parentOffset}static resolve(e,t){if(!(t>=0&&t<=e.content.size))throw new RangeError("Position "+t+" out of range");let n=[],r=0,o=t;for(let t=e;;){let{index:e,offset:i}=t.content.findIndex(o),s=o-i;if(n.push(t,e,r+i),!s)break;if(t=t.child(e),t.isText)break;o=s-1,r+=i+1}return new qe(t,n,o)}static resolveCached(e,t){let n=Je.get(e);if(n)for(let e=0;e<n.elts.length;e++){let r=n.elts[e];if(r.pos==t)return r}else Je.set(e,n=new We);let r=n.elts[n.i]=qe.resolve(e,t);return n.i=(n.i+1)%Ke,r}}class We{constructor(){this.elts=[],this.i=0}}const Ke=12,Je=new WeakMap;class Ue{constructor(e,t,n){this.$from=e,this.$to=t,this.depth=n}get start(){return this.$from.before(this.depth+1)}get end(){return this.$to.after(this.depth+1)}get parent(){return this.$from.node(this.depth)}get startIndex(){return this.$from.index(this.depth)}get endIndex(){return this.$to.indexAfter(this.depth)}}const Ge=Object.create(null);class Ye{constructor(e,t,n,r=Ae.none){this.type=e,this.attrs=t,this.marks=r,this.content=n||Me.empty}get children(){return this.content.content}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(e){return this.content.child(e)}maybeChild(e){return this.content.maybeChild(e)}forEach(e){this.content.forEach(e)}nodesBetween(e,t,n,r=0){this.content.nodesBetween(e,t,n,r,this)}descendants(e){this.nodesBetween(0,this.content.size,e)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,"")}textBetween(e,t,n,r){return this.content.textBetween(e,t,n,r)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(e){return this==e||this.sameMarkup(e)&&this.content.eq(e.content)}sameMarkup(e){return this.hasMarkup(e.type,e.attrs,e.marks)}hasMarkup(e,t,n){return this.type==e&&Ee(this.attrs,t||e.defaultAttrs||Ge)&&Ae.sameSet(this.marks,n||Ae.none)}copy(e=null){return e==this.content?this:new Ye(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new Ye(this.type,this.attrs,this.content,e)}cut(e,t=this.content.size){return 0==e&&t==this.content.size?this:this.copy(this.content.cut(e,t))}slice(e,t=this.content.size,n=!1){if(e==t)return Re.empty;let r=this.resolve(e),o=this.resolve(t),i=n?0:r.sharedDepth(t),s=r.start(i),a=r.node(i).content.cut(r.pos-s,o.pos-s);return new Re(a,r.depth-i,o.depth-i)}replace(e,t,n){return ze(this.resolve(e),this.resolve(t),n)}nodeAt(e){for(let t=this;;){let{index:n,offset:r}=t.content.findIndex(e);if(t=t.maybeChild(n),!t)return null;if(r==e||t.isText)return t;e-=r+1}}childAfter(e){let{index:t,offset:n}=this.content.findIndex(e);return{node:this.content.maybeChild(t),index:t,offset:n}}childBefore(e){if(0==e)return{node:null,index:0,offset:0};let{index:t,offset:n}=this.content.findIndex(e);if(n<e)return{node:this.content.child(t),index:t,offset:n};let r=this.content.child(t-1);return{node:r,index:t-1,offset:n-r.nodeSize}}resolve(e){return qe.resolveCached(this,e)}resolveNoCache(e){return qe.resolve(this,e)}rangeHasMark(e,t,n){let r=!1;return t>e&&this.nodesBetween(e,t,(e=>(n.isInSet(e.marks)&&(r=!0),!r))),r}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let e=this.type.name;return this.content.size&&(e+="("+this.content.toStringInner()+")"),Qe(this.marks,e)}contentMatchAt(e){let t=this.type.contentMatch.matchFragment(this.content,0,e);if(!t)throw new Error("Called contentMatchAt on a node with invalid content");return t}canReplace(e,t,n=Me.empty,r=0,o=n.childCount){let i=this.contentMatchAt(e).matchFragment(n,r,o),s=i&&i.matchFragment(this.content,t);if(!s||!s.validEnd)return!1;for(let e=r;e<o;e++)if(!this.type.allowsMarks(n.child(e).marks))return!1;return!0}canReplaceWith(e,t,n,r){if(r&&!this.type.allowsMarks(r))return!1;let o=this.contentMatchAt(e).matchType(n),i=o&&o.matchFragment(this.content,t);return!!i&&i.validEnd}canAppend(e){return e.content.size?this.canReplace(this.childCount,this.childCount,e.content):this.type.compatibleContent(e.type)}check(){this.type.checkContent(this.content),this.type.checkAttrs(this.attrs);let e=Ae.none;for(let t=0;t<this.marks.length;t++){let n=this.marks[t];n.type.checkAttrs(n.attrs),e=n.addToSet(e)}if(!Ae.sameSet(e,this.marks))throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map((e=>e.type.name))}`);this.content.forEach((e=>e.check()))}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map((e=>e.toJSON()))),e}static fromJSON(e,t){if(!t)throw new RangeError("Invalid input for Node.fromJSON");let n;if(t.marks){if(!Array.isArray(t.marks))throw new RangeError("Invalid mark data for Node.fromJSON");n=t.marks.map(e.markFromJSON)}if("text"==t.type){if("string"!=typeof t.text)throw new RangeError("Invalid text node in JSON");return e.text(t.text,n)}let r=Me.fromJSON(e,t.content),o=e.nodeType(t.type).create(t.attrs,r,n);return o.type.checkAttrs(o.attrs),o}}Ye.prototype.text=void 0;class Xe extends Ye{constructor(e,t,n,r){if(super(e,t,null,r),!n)throw new RangeError("Empty text nodes are not allowed");this.text=n}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):Qe(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,t){return this.text.slice(e,t)}get nodeSize(){return this.text.length}mark(e){return e==this.marks?this:new Xe(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new Xe(this.type,this.attrs,e,this.marks)}cut(e=0,t=this.text.length){return 0==e&&t==this.text.length?this:this.withText(this.text.slice(e,t))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}}function Qe(e,t){for(let n=e.length-1;n>=0;n--)t=e[n].type.name+"("+t+")";return t}class Ze{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,t){let n=new et(e,t);if(null==n.next)return Ze.empty;let r=tt(n);n.next&&n.err("Unexpected trailing text");let o=function(e){let t=Object.create(null);return n(at(e,0));function n(r){let o=[];r.forEach((t=>{e[t].forEach((({term:t,to:n})=>{if(!t)return;let r;for(let e=0;e<o.length;e++)o[e][0]==t&&(r=o[e][1]);at(e,n).forEach((e=>{r||o.push([t,r=[]]),-1==r.indexOf(e)&&r.push(e)}))}))}));let i=t[r.join(",")]=new Ze(r.indexOf(e.length-1)>-1);for(let e=0;e<o.length;e++){let r=o[e][1].sort(st);i.next.push({type:o[e][0],next:t[r.join(",")]||n(r)})}return i}}(function(e){let t=[[]];return o(i(e,0),n()),t;function n(){return t.push([])-1}function r(e,n,r){let o={term:r,to:n};return t[e].push(o),o}function o(e,t){e.forEach((e=>e.to=t))}function i(e,t){if("choice"==e.type)return e.exprs.reduce(((e,n)=>e.concat(i(n,t))),[]);if("seq"!=e.type){if("star"==e.type){let s=n();return r(t,s),o(i(e.expr,s),s),[r(s)]}if("plus"==e.type){let s=n();return o(i(e.expr,t),s),o(i(e.expr,s),s),[r(s)]}if("opt"==e.type)return[r(t)].concat(i(e.expr,t));if("range"==e.type){let s=t;for(let t=0;t<e.min;t++){let t=n();o(i(e.expr,s),t),s=t}if(-1==e.max)o(i(e.expr,s),s);else for(let t=e.min;t<e.max;t++){let t=n();r(s,t),o(i(e.expr,s),t),s=t}return[r(s)]}if("name"==e.type)return[r(t,void 0,e.value)];throw new Error("Unknown expr type")}for(let r=0;;r++){let s=i(e.exprs[r],t);if(r==e.exprs.length-1)return s;o(s,t=n())}}}(r));return function(e,t){for(let n=0,r=[e];n<r.length;n++){let e=r[n],o=!e.validEnd,i=[];for(let t=0;t<e.next.length;t++){let{type:n,next:s}=e.next[t];i.push(n.name),!o||n.isText||n.hasRequiredAttrs()||(o=!1),-1==r.indexOf(s)&&r.push(s)}o&&t.err("Only non-generatable nodes ("+i.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}(o,n),o}matchType(e){for(let t=0;t<this.next.length;t++)if(this.next[t].type==e)return this.next[t].next;return null}matchFragment(e,t=0,n=e.childCount){let r=this;for(let o=t;r&&o<n;o++)r=r.matchType(e.child(o).type);return r}get inlineContent(){return 0!=this.next.length&&this.next[0].type.isInline}get defaultType(){for(let e=0;e<this.next.length;e++){let{type:t}=this.next[e];if(!t.isText&&!t.hasRequiredAttrs())return t}return null}compatible(e){for(let t=0;t<this.next.length;t++)for(let n=0;n<e.next.length;n++)if(this.next[t].type==e.next[n].type)return!0;return!1}fillBefore(e,t=!1,n=0){let r=[this];return function o(i,s){let a=i.matchFragment(e,n);if(a&&(!t||a.validEnd))return Me.from(s.map((e=>e.createAndFill())));for(let e=0;e<i.next.length;e++){let{type:t,next:n}=i.next[e];if(!t.isText&&!t.hasRequiredAttrs()&&-1==r.indexOf(n)){r.push(n);let e=o(n,s.concat(t));if(e)return e}}return null}(this,[])}findWrapping(e){for(let t=0;t<this.wrapCache.length;t+=2)if(this.wrapCache[t]==e)return this.wrapCache[t+1];let t=this.computeWrapping(e);return this.wrapCache.push(e,t),t}computeWrapping(e){let t=Object.create(null),n=[{match:this,type:null,via:null}];for(;n.length;){let r=n.shift(),o=r.match;if(o.matchType(e)){let e=[];for(let t=r;t.type;t=t.via)e.push(t.type);return e.reverse()}for(let e=0;e<o.next.length;e++){let{type:i,next:s}=o.next[e];i.isLeaf||i.hasRequiredAttrs()||i.name in t||r.type&&!s.validEnd||(n.push({match:i.contentMatch,type:i,via:r}),t[i.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw new RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];return function t(n){e.push(n);for(let r=0;r<n.next.length;r++)-1==e.indexOf(n.next[r].next)&&t(n.next[r].next)}(this),e.map(((t,n)=>{let r=n+(t.validEnd?"*":" ")+" ";for(let n=0;n<t.next.length;n++)r+=(n?", ":"")+t.next[n].type.name+"->"+e.indexOf(t.next[n].next);return r})).join("\n")}}Ze.empty=new Ze(!0);class et{constructor(e,t){this.string=e,this.nodeTypes=t,this.inline=null,this.pos=0,this.tokens=e.split(/\s*(?=\b|\W|$)/),""==this.tokens[this.tokens.length-1]&&this.tokens.pop(),""==this.tokens[0]&&this.tokens.shift()}get next(){return this.tokens[this.pos]}eat(e){return this.next==e&&(this.pos++||!0)}err(e){throw new SyntaxError(e+" (in content expression '"+this.string+"')")}}function tt(e){let t=[];do{t.push(nt(e))}while(e.eat("|"));return 1==t.length?t[0]:{type:"choice",exprs:t}}function nt(e){let t=[];do{t.push(rt(e))}while(e.next&&")"!=e.next&&"|"!=e.next);return 1==t.length?t[0]:{type:"seq",exprs:t}}function rt(e){let t=function(e){if(e.eat("(")){let t=tt(e);return e.eat(")")||e.err("Missing closing paren"),t}if(!/\W/.test(e.next)){let t=function(e,t){let n=e.nodeTypes,r=n[t];if(r)return[r];let o=[];for(let e in n){let r=n[e];r.isInGroup(t)&&o.push(r)}0==o.length&&e.err("No node type or group '"+t+"' found");return o}(e,e.next).map((t=>(null==e.inline?e.inline=t.isInline:e.inline!=t.isInline&&e.err("Mixing inline and block content"),{type:"name",value:t})));return e.pos++,1==t.length?t[0]:{type:"choice",exprs:t}}e.err("Unexpected token '"+e.next+"'")}(e);for(;;)if(e.eat("+"))t={type:"plus",expr:t};else if(e.eat("*"))t={type:"star",expr:t};else if(e.eat("?"))t={type:"opt",expr:t};else{if(!e.eat("{"))break;t=it(e,t)}return t}function ot(e){/\D/.test(e.next)&&e.err("Expected number, got '"+e.next+"'");let t=Number(e.next);return e.pos++,t}function it(e,t){let n=ot(e),r=n;return e.eat(",")&&(r="}"!=e.next?ot(e):-1),e.eat("}")||e.err("Unclosed braced range"),{type:"range",min:n,max:r,expr:t}}function st(e,t){return t-e}function at(e,t){let n=[];return function t(r){let o=e[r];if(1==o.length&&!o[0].term)return t(o[0].to);n.push(r);for(let e=0;e<o.length;e++){let{term:r,to:i}=o[e];r||-1!=n.indexOf(i)||t(i)}}(t),n.sort(st)}function lt(e){let t=Object.create(null);for(let n in e){let r=e[n];if(!r.hasDefault)return null;t[n]=r.default}return t}function ct(e,t){let n=Object.create(null);for(let r in e){let o=t&&t[r];if(void 0===o){let t=e[r];if(!t.hasDefault)throw new RangeError("No value supplied for attribute "+r);o=t.default}n[r]=o}return n}function dt(e,t,n,r){for(let r in t)if(!(r in e))throw new RangeError(`Unsupported attribute ${r} for ${n} of type ${r}`);for(let n in e){let r=e[n];r.validate&&r.validate(t[n])}}function ht(e,t){let n=Object.create(null);if(t)for(let r in t)n[r]=new pt(e,r,t[r]);return n}let ut=class e{constructor(e,t,n){this.name=e,this.schema=t,this.spec=n,this.markSet=null,this.groups=n.group?n.group.split(" "):[],this.attrs=ht(e,n.attrs),this.defaultAttrs=lt(this.attrs),this.contentMatch=null,this.inlineContent=null,this.isBlock=!(n.inline||"text"==e),this.isText="text"==e}get isInline(){return!this.isBlock}get isTextblock(){return this.isBlock&&this.inlineContent}get isLeaf(){return this.contentMatch==Ze.empty}get isAtom(){return this.isLeaf||!!this.spec.atom}isInGroup(e){return this.groups.indexOf(e)>-1}get whitespace(){return this.spec.whitespace||(this.spec.code?"pre":"normal")}hasRequiredAttrs(){for(let e in this.attrs)if(this.attrs[e].isRequired)return!0;return!1}compatibleContent(e){return this==e||this.contentMatch.compatible(e.contentMatch)}computeAttrs(e){return!e&&this.defaultAttrs?this.defaultAttrs:ct(this.attrs,e)}create(e=null,t,n){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new Ye(this,this.computeAttrs(e),Me.from(t),Ae.setFrom(n))}createChecked(e=null,t,n){return t=Me.from(t),this.checkContent(t),new Ye(this,this.computeAttrs(e),t,Ae.setFrom(n))}createAndFill(e=null,t,n){if(e=this.computeAttrs(e),(t=Me.from(t)).size){let e=this.contentMatch.fillBefore(t);if(!e)return null;t=e.append(t)}let r=this.contentMatch.matchFragment(t),o=r&&r.fillBefore(Me.empty,!0);return o?new Ye(this,e,t.append(o),Ae.setFrom(n)):null}validContent(e){let t=this.contentMatch.matchFragment(e);if(!t||!t.validEnd)return!1;for(let t=0;t<e.childCount;t++)if(!this.allowsMarks(e.child(t).marks))return!1;return!0}checkContent(e){if(!this.validContent(e))throw new RangeError(`Invalid content for node ${this.name}: ${e.toString().slice(0,50)}`)}checkAttrs(e){dt(this.attrs,e,"node",this.name)}allowsMarkType(e){return null==this.markSet||this.markSet.indexOf(e)>-1}allowsMarks(e){if(null==this.markSet)return!0;for(let t=0;t<e.length;t++)if(!this.allowsMarkType(e[t].type))return!1;return!0}allowedMarks(e){if(null==this.markSet)return e;let t;for(let n=0;n<e.length;n++)this.allowsMarkType(e[n].type)?t&&t.push(e[n]):t||(t=e.slice(0,n));return t?t.length?t:Ae.none:e}static compile(t,n){let r=Object.create(null);t.forEach(((t,o)=>r[t]=new e(t,n,o)));let o=n.spec.topNode||"doc";if(!r[o])throw new RangeError("Schema is missing its top node type ('"+o+"')");if(!r.text)throw new RangeError("Every schema needs a 'text' type");for(let e in r.text.attrs)throw new RangeError("The text node type should not have attributes");return r}};class pt{constructor(e,t,n){this.hasDefault=Object.prototype.hasOwnProperty.call(n,"default"),this.default=n.default,this.validate="string"==typeof n.validate?function(e,t,n){let r=n.split("|");return n=>{let o=null===n?"null":typeof n;if(r.indexOf(o)<0)throw new RangeError(`Expected value of type ${r} for attribute ${t} on type ${e}, got ${o}`)}}(e,t,n.validate):n.validate}get isRequired(){return!this.hasDefault}}class ft{constructor(e,t,n,r){this.name=e,this.rank=t,this.schema=n,this.spec=r,this.attrs=ht(e,r.attrs),this.excluded=null;let o=lt(this.attrs);this.instance=o?new Ae(this,o):null}create(e=null){return!e&&this.instance?this.instance:new Ae(this,ct(this.attrs,e))}static compile(e,t){let n=Object.create(null),r=0;return e.forEach(((e,o)=>n[e]=new ft(e,r++,t,o))),n}removeFromSet(e){for(var t=0;t<e.length;t++)e[t].type==this&&(e=e.slice(0,t).concat(e.slice(t+1)),t--);return e}isInSet(e){for(let t=0;t<e.length;t++)if(e[t].type==this)return e[t]}checkAttrs(e){dt(this.attrs,e,"mark",this.name)}excludes(e){return this.excluded.indexOf(e)>-1}}class mt{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let t=this.spec={};for(let n in e)t[n]=e[n];t.nodes=Ce.from(e.nodes),t.marks=Ce.from(e.marks||{}),this.nodes=ut.compile(this.spec.nodes,this),this.marks=ft.compile(this.spec.marks,this);let n=Object.create(null);for(let e in this.nodes){if(e in this.marks)throw new RangeError(e+" can not be both a node and a mark");let t=this.nodes[e],r=t.spec.content||"",o=t.spec.marks;if(t.contentMatch=n[r]||(n[r]=Ze.parse(r,this.nodes)),t.inlineContent=t.contentMatch.inlineContent,t.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!t.isInline||!t.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=t}t.markSet="_"==o?null:o?gt(this,o.split(" ")):""!=o&&t.inlineContent?null:[]}for(let e in this.marks){let t=this.marks[e],n=t.spec.excludes;t.excluded=null==n?[t]:""==n?[]:gt(this,n.split(" "))}this.nodeFromJSON=e=>Ye.fromJSON(this,e),this.markFromJSON=e=>Ae.fromJSON(this,e),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(e,t=null,n,r){if("string"==typeof e)e=this.nodeType(e);else{if(!(e instanceof ut))throw new RangeError("Invalid node type: "+e);if(e.schema!=this)throw new RangeError("Node type from different schema used ("+e.name+")")}return e.createChecked(t,n,r)}text(e,t){let n=this.nodes.text;return new Xe(n,n.defaultAttrs,e,Ae.setFrom(t))}mark(e,t){return"string"==typeof e&&(e=this.marks[e]),e.create(t)}nodeType(e){let t=this.nodes[e];if(!t)throw new RangeError("Unknown node type: "+e);return t}}function gt(e,t){let n=[];for(let r=0;r<t.length;r++){let o=t[r],i=e.marks[o],s=i;if(i)n.push(i);else for(let t in e.marks){let r=e.marks[t];("_"==o||r.spec.group&&r.spec.group.split(" ").indexOf(o)>-1)&&n.push(s=r)}if(!s)throw new SyntaxError("Unknown mark type: '"+t[r]+"'")}return n}class yt{constructor(e,t){this.schema=e,this.rules=t,this.tags=[],this.styles=[];let n=this.matchedStyles=[];t.forEach((e=>{if(function(e){return null!=e.tag}(e))this.tags.push(e);else if(function(e){return null!=e.style}(e)){let t=/[^=]*/.exec(e.style)[0];n.indexOf(t)<0&&n.push(t),this.styles.push(e)}})),this.normalizeLists=!this.tags.some((t=>{if(!/^(ul|ol)\b/.test(t.tag)||!t.node)return!1;let n=e.nodes[t.node];return n.contentMatch.matchType(n)}))}parse(e,t={}){let n=new Ct(this,t,!1);return n.addAll(e,Ae.none,t.from,t.to),n.finish()}parseSlice(e,t={}){let n=new Ct(this,t,!0);return n.addAll(e,Ae.none,t.from,t.to),Re.maxOpen(n.finish())}matchTag(e,t,n){for(let r=n?this.tags.indexOf(n)+1:0;r<this.tags.length;r++){let n=this.tags[r];if(Nt(e,n.tag)&&(void 0===n.namespace||e.namespaceURI==n.namespace)&&(!n.context||t.matchesContext(n.context))){if(n.getAttrs){let t=n.getAttrs(e);if(!1===t)continue;n.attrs=t||void 0}return n}}}matchStyle(e,t,n,r){for(let o=r?this.styles.indexOf(r)+1:0;o<this.styles.length;o++){let r=this.styles[o],i=r.style;if(!(0!=i.indexOf(e)||r.context&&!n.matchesContext(r.context)||i.length>e.length&&(61!=i.charCodeAt(e.length)||i.slice(e.length+1)!=t))){if(r.getAttrs){let e=r.getAttrs(t);if(!1===e)continue;r.attrs=e||void 0}return r}}}static schemaRules(e){let t=[];function n(e){let n=null==e.priority?50:e.priority,r=0;for(;r<t.length;r++){let e=t[r];if((null==e.priority?50:e.priority)<n)break}t.splice(r,0,e)}for(let t in e.marks){let r=e.marks[t].spec.parseDOM;r&&r.forEach((e=>{n(e=St(e)),e.mark||e.ignore||e.clearMark||(e.mark=t)}))}for(let t in e.nodes){let r=e.nodes[t].spec.parseDOM;r&&r.forEach((e=>{n(e=St(e)),e.node||e.ignore||e.mark||(e.node=t)}))}return t}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new yt(e,yt.schemaRules(e)))}}const vt={address:!0,article:!0,aside:!0,blockquote:!0,canvas:!0,dd:!0,div:!0,dl:!0,fieldset:!0,figcaption:!0,figure:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,li:!0,noscript:!0,ol:!0,output:!0,p:!0,pre:!0,section:!0,table:!0,tfoot:!0,ul:!0},bt={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},xt={ol:!0,ul:!0};function wt(e,t,n){return null!=t?(t?1:0)|("full"===t?2:0):e&&"pre"==e.whitespace?3:-5&n}class kt{constructor(e,t,n,r,o,i){this.type=e,this.attrs=t,this.marks=n,this.solid=r,this.options=i,this.content=[],this.activeMarks=Ae.none,this.match=o||(4&i?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let t=this.type.contentMatch.fillBefore(Me.from(e));if(!t){let t,n=this.type.contentMatch;return(t=n.findWrapping(e.type))?(this.match=n,t):null}this.match=this.type.contentMatch.matchFragment(t)}return this.match.findWrapping(e.type)}finish(e){if(!(1&this.options)){let e,t=this.content[this.content.length-1];if(t&&t.isText&&(e=/[ \t\r\n\u000c]+$/.exec(t.text))){let n=t;t.text.length==e[0].length?this.content.pop():this.content[this.content.length-1]=n.withText(n.text.slice(0,n.text.length-e[0].length))}}let t=Me.from(this.content);return!e&&this.match&&(t=t.append(this.match.fillBefore(Me.empty,!0))),this.type?this.type.create(this.attrs,t,this.marks):t}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!vt.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class Ct{constructor(e,t,n){this.parser=e,this.options=t,this.isOpen=n,this.open=0,this.localPreserveWS=!1;let r,o=t.topNode,i=wt(null,t.preserveWhitespace,0)|(n?4:0);r=o?new kt(o.type,o.attrs,Ae.none,!0,t.topMatch||o.type.contentMatch,i):new kt(n?null:e.schema.topNodeType,null,Ae.none,!0,null,i),this.nodes=[r],this.find=t.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e,t){3==e.nodeType?this.addTextNode(e,t):1==e.nodeType&&this.addElement(e,t)}addTextNode(e,t){let n=e.nodeValue,r=this.top,o=2&r.options?"full":this.localPreserveWS||(1&r.options)>0;if("full"===o||r.inlineContext(e)||/[^ \t\r\n\u000c]/.test(n)){if(o)n="full"!==o?n.replace(/\r?\n|\r/g," "):n.replace(/\r\n?/g,"\n");else if(n=n.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(n)&&this.open==this.nodes.length-1){let t=r.content[r.content.length-1],o=e.previousSibling;(!t||o&&"BR"==o.nodeName||t.isText&&/[ \t\r\n\u000c]$/.test(t.text))&&(n=n.slice(1))}n&&this.insertNode(this.parser.schema.text(n),t,!/\S/.test(n)),this.findInText(e)}else this.findInside(e)}addElement(e,t,n){let r=this.localPreserveWS,o=this.top;("PRE"==e.tagName||/pre/.test(e.style&&e.style.whiteSpace))&&(this.localPreserveWS=!0);let i,s=e.nodeName.toLowerCase();xt.hasOwnProperty(s)&&this.parser.normalizeLists&&function(e){for(let t=e.firstChild,n=null;t;t=t.nextSibling){let e=1==t.nodeType?t.nodeName.toLowerCase():null;e&&xt.hasOwnProperty(e)&&n?(n.appendChild(t),t=n):"li"==e?n=t:e&&(n=null)}}(e);let a=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(i=this.parser.matchTag(e,this,n));e:if(a?a.ignore:bt.hasOwnProperty(s))this.findInside(e),this.ignoreFallback(e,t);else if(!a||a.skip||a.closeParent){a&&a.closeParent?this.open=Math.max(0,this.open-1):a&&a.skip.nodeType&&(e=a.skip);let n,r=this.needsBlock;if(vt.hasOwnProperty(s))o.content.length&&o.content[0].isInline&&this.open&&(this.open--,o=this.top),n=!0,o.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e,t);break e}let i=a&&a.skip?t:this.readStyles(e,t);i&&this.addAll(e,i),n&&this.sync(o),this.needsBlock=r}else{let n=this.readStyles(e,t);n&&this.addElementByRule(e,a,n,!1===a.consuming?i:void 0)}this.localPreserveWS=r}leafFallback(e,t){"BR"==e.nodeName&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode("\n"),t)}ignoreFallback(e,t){"BR"!=e.nodeName||this.top.type&&this.top.type.inlineContent||this.findPlace(this.parser.schema.text("-"),t,!0)}readStyles(e,t){let n=e.style;if(n&&n.length)for(let e=0;e<this.parser.matchedStyles.length;e++){let r=this.parser.matchedStyles[e],o=n.getPropertyValue(r);if(o)for(let e;;){let n=this.parser.matchStyle(r,o,this,e);if(!n)break;if(n.ignore)return null;if(t=n.clearMark?t.filter((e=>!n.clearMark(e))):t.concat(this.parser.schema.marks[n.mark].create(n.attrs)),!1!==n.consuming)break;e=n}}return t}addElementByRule(e,t,n,r){let o,i;if(t.node)if(i=this.parser.schema.nodes[t.node],i.isLeaf)this.insertNode(i.create(t.attrs),n,"BR"==e.nodeName)||this.leafFallback(e,n);else{let e=this.enter(i,t.attrs||null,n,t.preserveWhitespace);e&&(o=!0,n=e)}else{let e=this.parser.schema.marks[t.mark];n=n.concat(e.create(t.attrs))}let s=this.top;if(i&&i.isLeaf)this.findInside(e);else if(r)this.addElement(e,n,r);else if(t.getContent)this.findInside(e),t.getContent(e,this.parser.schema).forEach((e=>this.insertNode(e,n,!1)));else{let r=e;"string"==typeof t.contentElement?r=e.querySelector(t.contentElement):"function"==typeof t.contentElement?r=t.contentElement(e):t.contentElement&&(r=t.contentElement),this.findAround(e,r,!0),this.addAll(r,n),this.findAround(e,r,!1)}o&&this.sync(s)&&this.open--}addAll(e,t,n,r){let o=n||0;for(let i=n?e.childNodes[n]:e.firstChild,s=null==r?null:e.childNodes[r];i!=s;i=i.nextSibling,++o)this.findAtPoint(e,o),this.addDOM(i,t);this.findAtPoint(e,o)}findPlace(e,t,n){let r,o;for(let t=this.open,i=0;t>=0;t--){let s=this.nodes[t],a=s.findWrapping(e);if(a&&(!r||r.length>a.length+i)&&(r=a,o=s,!a.length))break;if(s.solid){if(n)break;i+=2}}if(!r)return null;this.sync(o);for(let e=0;e<r.length;e++)t=this.enterInner(r[e],null,t,!1);return t}insertNode(e,t,n){if(e.isInline&&this.needsBlock&&!this.top.type){let e=this.textblockFromContext();e&&(t=this.enterInner(e,null,t))}let r=this.findPlace(e,t,n);if(r){this.closeExtra();let t=this.top;t.match&&(t.match=t.match.matchType(e.type));let n=Ae.none;for(let o of r.concat(e.marks))(t.type?t.type.allowsMarkType(o.type):Mt(o.type,e.type))&&(n=o.addToSet(n));return t.content.push(e.mark(n)),!0}return!1}enter(e,t,n,r){let o=this.findPlace(e.create(t),n,!1);return o&&(o=this.enterInner(e,t,n,!0,r)),o}enterInner(e,t,n,r=!1,o){this.closeExtra();let i=this.top;i.match=i.match&&i.match.matchType(e);let s=wt(e,o,i.options);4&i.options&&0==i.content.length&&(s|=4);let a=Ae.none;return n=n.filter((t=>!(i.type?i.type.allowsMarkType(t.type):Mt(t.type,e))||(a=t.addToSet(a),!1))),this.nodes.push(new kt(e,t,a,r,null,s)),this.open++,n}closeExtra(e=!1){let t=this.nodes.length-1;if(t>this.open){for(;t>this.open;t--)this.nodes[t-1].content.push(this.nodes[t].finish(e));this.nodes.length=this.open+1}}finish(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(!(!this.isOpen&&!this.options.topOpen))}sync(e){for(let t=this.open;t>=0;t--){if(this.nodes[t]==e)return this.open=t,!0;this.localPreserveWS&&(this.nodes[t].options|=1)}return!1}get currentPos(){this.closeExtra();let e=0;for(let t=this.open;t>=0;t--){let n=this.nodes[t].content;for(let t=n.length-1;t>=0;t--)e+=n[t].nodeSize;t&&e++}return e}findAtPoint(e,t){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].node==e&&this.find[n].offset==t&&(this.find[n].pos=this.currentPos)}findInside(e){if(this.find)for(let t=0;t<this.find.length;t++)null==this.find[t].pos&&1==e.nodeType&&e.contains(this.find[t].node)&&(this.find[t].pos=this.currentPos)}findAround(e,t,n){if(e!=t&&this.find)for(let r=0;r<this.find.length;r++)if(null==this.find[r].pos&&1==e.nodeType&&e.contains(this.find[r].node)){t.compareDocumentPosition(this.find[r].node)&(n?2:4)&&(this.find[r].pos=this.currentPos)}}findInText(e){if(this.find)for(let t=0;t<this.find.length;t++)this.find[t].node==e&&(this.find[t].pos=this.currentPos-(e.nodeValue.length-this.find[t].offset))}matchesContext(e){if(e.indexOf("|")>-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let t=e.split("/"),n=this.options.context,r=!(this.isOpen||n&&n.parent.type!=this.nodes[0].type),o=-(n?n.depth+1:0)+(r?0:1),i=(e,s)=>{for(;e>=0;e--){let a=t[e];if(""==a){if(e==t.length-1||0==e)continue;for(;s>=o;s--)if(i(e-1,s))return!0;return!1}{let e=s>0||0==s&&r?this.nodes[s].type:n&&s>=o?n.node(s-o).type:null;if(!e||e.name!=a&&!e.isInGroup(a))return!1;s--}}return!0};return i(t.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let t=e.depth;t>=0;t--){let n=e.node(t).contentMatchAt(e.indexAfter(t)).defaultType;if(n&&n.isTextblock&&n.defaultAttrs)return n}for(let e in this.parser.schema.nodes){let t=this.parser.schema.nodes[e];if(t.isTextblock&&t.defaultAttrs)return t}}}function Nt(e,t){return(e.matches||e.msMatchesSelector||e.webkitMatchesSelector||e.mozMatchesSelector).call(e,t)}function St(e){let t={};for(let n in e)t[n]=e[n];return t}function Mt(e,t){let n=t.schema.nodes;for(let r in n){let o=n[r];if(!o.allowsMarkType(e))continue;let i=[],s=e=>{i.push(e);for(let n=0;n<e.edgeCount;n++){let{type:r,next:o}=e.edge(n);if(r==t)return!0;if(i.indexOf(o)<0&&s(o))return!0}};if(s(o.contentMatch))return!0}}class Tt{constructor(e,t){this.nodes=e,this.marks=t}serializeFragment(e,t={},n){n||(n=Et(t).createDocumentFragment());let r=n,o=[];return e.forEach((e=>{if(o.length||e.marks.length){let n=0,i=0;for(;n<o.length&&i<e.marks.length;){let t=e.marks[i];if(this.marks[t.type.name]){if(!t.eq(o[n][0])||!1===t.type.spec.spanning)break;n++,i++}else i++}for(;n<o.length;)r=o.pop()[1];for(;i<e.marks.length;){let n=e.marks[i++],s=this.serializeMark(n,e.isInline,t);s&&(o.push([n,r]),r.appendChild(s.dom),r=s.contentDOM||s.dom)}}r.appendChild(this.serializeNodeInner(e,t))})),n}serializeNodeInner(e,t){let{dom:n,contentDOM:r}=Rt(Et(t),this.nodes[e.type.name](e),null,e.attrs);if(r){if(e.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(e.content,t,r)}return n}serializeNode(e,t={}){let n=this.serializeNodeInner(e,t);for(let r=e.marks.length-1;r>=0;r--){let o=this.serializeMark(e.marks[r],e.isInline,t);o&&((o.contentDOM||o.dom).appendChild(n),n=o.dom)}return n}serializeMark(e,t,n={}){let r=this.marks[e.type.name];return r&&Rt(Et(n),r(e,t),null,e.attrs)}static renderSpec(e,t,n=null,r){return Rt(e,t,n,r)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new Tt(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let t=Ot(e.nodes);return t.text||(t.text=e=>e.text),t}static marksFromSchema(e){return Ot(e.marks)}}function Ot(e){let t={};for(let n in e){let r=e[n].spec.toDOM;r&&(t[n]=r)}return t}function Et(e){return e.document||window.document}const At=new WeakMap;function Dt(e){let t=At.get(e);return void 0===t&&At.set(e,t=function(e){let t=null;function n(e){if(e&&"object"==typeof e)if(Array.isArray(e))if("string"==typeof e[0])t||(t=[]),t.push(e);else for(let t=0;t<e.length;t++)n(e[t]);else for(let t in e)n(e[t])}return n(e),t}(e)),t}function Rt(e,t,n,r){if("string"==typeof t)return{dom:e.createTextNode(t)};if(null!=t.nodeType)return{dom:t};if(t.dom&&null!=t.dom.nodeType)return t;let o,i=t[0];if("string"!=typeof i)throw new RangeError("Invalid array passed to renderSpec");if(r&&(o=Dt(r))&&o.indexOf(t)>-1)throw new RangeError("Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.");let s,a=i.indexOf(" ");a>0&&(n=i.slice(0,a),i=i.slice(a+1));let l=n?e.createElementNS(n,i):e.createElement(i),c=t[1],d=1;if(c&&"object"==typeof c&&null==c.nodeType&&!Array.isArray(c)){d=2;for(let e in c)if(null!=c[e]){let t=e.indexOf(" ");t>0?l.setAttributeNS(e.slice(0,t),e.slice(t+1),c[e]):"style"==e&&l.style?l.style.cssText=c[e]:l.setAttribute(e,c[e])}}for(let o=d;o<t.length;o++){let i=t[o];if(0===i){if(o<t.length-1||o>d)throw new RangeError("Content hole must be the only child of its parent node");return{dom:l,contentDOM:l}}{let{dom:t,contentDOM:o}=Rt(e,i,n,r);if(l.appendChild(t),o){if(s)throw new RangeError("Multiple content holes");s=o}}}return{dom:l,contentDOM:s}}const Lt=Math.pow(2,16);function It(e){return 65535&e}class zt{constructor(e,t,n){this.pos=e,this.delInfo=t,this.recover=n}get deleted(){return(8&this.delInfo)>0}get deletedBefore(){return(5&this.delInfo)>0}get deletedAfter(){return(6&this.delInfo)>0}get deletedAcross(){return(4&this.delInfo)>0}}class Pt{constructor(e,t=!1){if(this.ranges=e,this.inverted=t,!e.length&&Pt.empty)return Pt.empty}recover(e){let t=0,n=It(e);if(!this.inverted)for(let e=0;e<n;e++)t+=this.ranges[3*e+2]-this.ranges[3*e+1];return this.ranges[3*n]+t+function(e){return(e-(65535&e))/Lt}(e)}mapResult(e,t=1){return this._map(e,t,!1)}map(e,t=1){return this._map(e,t,!0)}_map(e,t,n){let r=0,o=this.inverted?2:1,i=this.inverted?1:2;for(let s=0;s<this.ranges.length;s+=3){let a=this.ranges[s]-(this.inverted?r:0);if(a>e)break;let l=this.ranges[s+o],c=this.ranges[s+i],d=a+l;if(e<=d){let o=a+r+((l?e==a?-1:e==d?1:t:t)<0?0:c);if(n)return o;let i=e==(t<0?a:d)?null:s/3+(e-a)*Lt,h=e==a?2:e==d?1:4;return(t<0?e!=a:e!=d)&&(h|=8),new zt(o,h,i)}r+=c-l}return n?e+r:new zt(e+r,0,null)}touches(e,t){let n=0,r=It(t),o=this.inverted?2:1,i=this.inverted?1:2;for(let t=0;t<this.ranges.length;t+=3){let s=this.ranges[t]-(this.inverted?n:0);if(s>e)break;let a=this.ranges[t+o];if(e<=s+a&&t==3*r)return!0;n+=this.ranges[t+i]-a}return!1}forEach(e){let t=this.inverted?2:1,n=this.inverted?1:2;for(let r=0,o=0;r<this.ranges.length;r+=3){let i=this.ranges[r],s=i-(this.inverted?o:0),a=i+(this.inverted?0:o),l=this.ranges[r+t],c=this.ranges[r+n];e(s,s+l,a,a+c),o+=c-l}}invert(){return new Pt(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return 0==e?Pt.empty:new Pt(e<0?[0,-e,0]:[0,0,e])}}Pt.empty=new Pt([]);class Bt{constructor(e,t,n=0,r=(e?e.length:0)){this.mirror=t,this.from=n,this.to=r,this._maps=e||[],this.ownData=!(e||t)}get maps(){return this._maps}slice(e=0,t=this.maps.length){return new Bt(this._maps,this.mirror,e,t)}appendMap(e,t){this.ownData||(this._maps=this._maps.slice(),this.mirror=this.mirror&&this.mirror.slice(),this.ownData=!0),this.to=this._maps.push(e),null!=t&&this.setMirror(this._maps.length-1,t)}appendMapping(e){for(let t=0,n=this._maps.length;t<e._maps.length;t++){let r=e.getMirror(t);this.appendMap(e._maps[t],null!=r&&r<t?n+r:void 0)}}getMirror(e){if(this.mirror)for(let t=0;t<this.mirror.length;t++)if(this.mirror[t]==e)return this.mirror[t+(t%2?-1:1)]}setMirror(e,t){this.mirror||(this.mirror=[]),this.mirror.push(e,t)}appendMappingInverted(e){for(let t=e.maps.length-1,n=this._maps.length+e._maps.length;t>=0;t--){let r=e.getMirror(t);this.appendMap(e._maps[t].invert(),null!=r&&r>t?n-r-1:void 0)}}invert(){let e=new Bt;return e.appendMappingInverted(this),e}map(e,t=1){if(this.mirror)return this._map(e,t,!0);for(let n=this.from;n<this.to;n++)e=this._maps[n].map(e,t);return e}mapResult(e,t=1){return this._map(e,t,!1)}_map(e,t,n){let r=0;for(let n=this.from;n<this.to;n++){let o=this._maps[n].mapResult(e,t);if(null!=o.recover){let t=this.getMirror(n);if(null!=t&&t>n&&t<this.to){n=t,e=this._maps[t].recover(o.recover);continue}}r|=o.delInfo,e=o.pos}return n?e:new zt(e,r,null)}}const $t=Object.create(null);class Vt{getMap(){return Pt.empty}merge(e){return null}static fromJSON(e,t){if(!t||!t.stepType)throw new RangeError("Invalid input for Step.fromJSON");let n=$t[t.stepType];if(!n)throw new RangeError(`No step type ${t.stepType} defined`);return n.fromJSON(e,t)}static jsonID(e,t){if(e in $t)throw new RangeError("Duplicate use of step JSON ID "+e);return $t[e]=t,t.prototype.jsonID=e,t}}class jt{constructor(e,t){this.doc=e,this.failed=t}static ok(e){return new jt(e,null)}static fail(e){return new jt(null,e)}static fromReplace(e,t,n,r){try{return jt.ok(e.replace(t,n,r))}catch(e){if(e instanceof De)return jt.fail(e.message);throw e}}}function Ft(e,t,n){let r=[];for(let o=0;o<e.childCount;o++){let i=e.child(o);i.content.size&&(i=i.copy(Ft(i.content,t,i))),i.isInline&&(i=t(i,n,o)),r.push(i)}return Me.fromArray(r)}class Ht extends Vt{constructor(e,t,n){super(),this.from=e,this.to=t,this.mark=n}apply(e){let t=e.slice(this.from,this.to),n=e.resolve(this.from),r=n.node(n.sharedDepth(this.to)),o=new Re(Ft(t.content,((e,t)=>e.isAtom&&t.type.allowsMarkType(this.mark.type)?e.mark(this.mark.addToSet(e.marks)):e),r),t.openStart,t.openEnd);return jt.fromReplace(e,this.from,this.to,o)}invert(){return new _t(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),n=e.mapResult(this.to,-1);return t.deleted&&n.deleted||t.pos>=n.pos?null:new Ht(t.pos,n.pos,this.mark)}merge(e){return e instanceof Ht&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Ht(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,t){if("number"!=typeof t.from||"number"!=typeof t.to)throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new Ht(t.from,t.to,e.markFromJSON(t.mark))}}Vt.jsonID("addMark",Ht);class _t extends Vt{constructor(e,t,n){super(),this.from=e,this.to=t,this.mark=n}apply(e){let t=e.slice(this.from,this.to),n=new Re(Ft(t.content,(e=>e.mark(this.mark.removeFromSet(e.marks))),e),t.openStart,t.openEnd);return jt.fromReplace(e,this.from,this.to,n)}invert(){return new Ht(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),n=e.mapResult(this.to,-1);return t.deleted&&n.deleted||t.pos>=n.pos?null:new _t(t.pos,n.pos,this.mark)}merge(e){return e instanceof _t&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new _t(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,t){if("number"!=typeof t.from||"number"!=typeof t.to)throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new _t(t.from,t.to,e.markFromJSON(t.mark))}}Vt.jsonID("removeMark",_t);class qt extends Vt{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return jt.fail("No node at mark step's position");let n=t.type.create(t.attrs,null,this.mark.addToSet(t.marks));return jt.fromReplace(e,this.pos,this.pos+1,new Re(Me.from(n),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);if(t){let e=this.mark.addToSet(t.marks);if(e.length==t.marks.length){for(let n=0;n<t.marks.length;n++)if(!t.marks[n].isInSet(e))return new qt(this.pos,t.marks[n]);return new qt(this.pos,this.mark)}}return new Wt(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new qt(t.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,t){if("number"!=typeof t.pos)throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new qt(t.pos,e.markFromJSON(t.mark))}}Vt.jsonID("addNodeMark",qt);class Wt extends Vt{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return jt.fail("No node at mark step's position");let n=t.type.create(t.attrs,null,this.mark.removeFromSet(t.marks));return jt.fromReplace(e,this.pos,this.pos+1,new Re(Me.from(n),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);return t&&this.mark.isInSet(t.marks)?new qt(this.pos,this.mark):this}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new Wt(t.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,t){if("number"!=typeof t.pos)throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new Wt(t.pos,e.markFromJSON(t.mark))}}Vt.jsonID("removeNodeMark",Wt);class Kt extends Vt{constructor(e,t,n,r=!1){super(),this.from=e,this.to=t,this.slice=n,this.structure=r}apply(e){return this.structure&&Ut(e,this.from,this.to)?jt.fail("Structure replace would overwrite content"):jt.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new Pt([this.from,this.to-this.from,this.slice.size])}invert(e){return new Kt(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let t=e.mapResult(this.from,1),n=e.mapResult(this.to,-1);return t.deletedAcross&&n.deletedAcross?null:new Kt(t.pos,Math.max(t.pos,n.pos),this.slice,this.structure)}merge(e){if(!(e instanceof Kt)||e.structure||this.structure)return null;if(this.from+this.slice.size!=e.from||this.slice.openEnd||e.slice.openStart){if(e.to!=this.from||this.slice.openStart||e.slice.openEnd)return null;{let t=this.slice.size+e.slice.size==0?Re.empty:new Re(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new Kt(e.from,this.to,t,this.structure)}}{let t=this.slice.size+e.slice.size==0?Re.empty:new Re(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new Kt(this.from,this.to+(e.to-e.from),t,this.structure)}}toJSON(){let e={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,t){if("number"!=typeof t.from||"number"!=typeof t.to)throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new Kt(t.from,t.to,Re.fromJSON(e,t.slice),!!t.structure)}}Vt.jsonID("replace",Kt);class Jt extends Vt{constructor(e,t,n,r,o,i,s=!1){super(),this.from=e,this.to=t,this.gapFrom=n,this.gapTo=r,this.slice=o,this.insert=i,this.structure=s}apply(e){if(this.structure&&(Ut(e,this.from,this.gapFrom)||Ut(e,this.gapTo,this.to)))return jt.fail("Structure gap-replace would overwrite content");let t=e.slice(this.gapFrom,this.gapTo);if(t.openStart||t.openEnd)return jt.fail("Gap is not a flat range");let n=this.slice.insertAt(this.insert,t.content);return n?jt.fromReplace(e,this.from,this.to,n):jt.fail("Content does not fit in gap")}getMap(){return new Pt([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(e){let t=this.gapTo-this.gapFrom;return new Jt(this.from,this.from+this.slice.size+t,this.from+this.insert,this.from+this.insert+t,e.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(e){let t=e.mapResult(this.from,1),n=e.mapResult(this.to,-1),r=this.from==this.gapFrom?t.pos:e.map(this.gapFrom,-1),o=this.to==this.gapTo?n.pos:e.map(this.gapTo,1);return t.deletedAcross&&n.deletedAcross||r<t.pos||o>n.pos?null:new Jt(t.pos,n.pos,r,o,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,t){if("number"!=typeof t.from||"number"!=typeof t.to||"number"!=typeof t.gapFrom||"number"!=typeof t.gapTo||"number"!=typeof t.insert)throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new Jt(t.from,t.to,t.gapFrom,t.gapTo,Re.fromJSON(e,t.slice),t.insert,!!t.structure)}}function Ut(e,t,n){let r=e.resolve(t),o=n-t,i=r.depth;for(;o>0&&i>0&&r.indexAfter(i)==r.node(i).childCount;)i--,o--;if(o>0){let e=r.node(i).maybeChild(r.indexAfter(i));for(;o>0;){if(!e||e.isLeaf)return!0;e=e.firstChild,o--}}return!1}function Gt(e,t,n,r=n.contentMatch,o=!0){let i=e.doc.nodeAt(t),s=[],a=t+1;for(let t=0;t<i.childCount;t++){let l=i.child(t),c=a+l.nodeSize,d=r.matchType(l.type);if(d){r=d;for(let t=0;t<l.marks.length;t++)n.allowsMarkType(l.marks[t].type)||e.step(new _t(a,c,l.marks[t]));if(o&&l.isText&&"pre"!=n.whitespace){let e,t,r=/\r?\n|\r/g;for(;e=r.exec(l.text);)t||(t=new Re(Me.from(n.schema.text(" ",n.allowedMarks(l.marks))),0,0)),s.push(new Kt(a+e.index,a+e.index+e[0].length,t))}}else s.push(new Kt(a,c,Re.empty));a=c}if(!r.validEnd){let t=r.fillBefore(Me.empty,!0);e.replace(a,a,new Re(t,0,0))}for(let t=s.length-1;t>=0;t--)e.step(s[t])}function Yt(e,t,n){return(0==t||e.canReplace(t,e.childCount))&&(n==e.childCount||e.canReplace(0,n))}function Xt(e){let t=e.parent.content.cutByIndex(e.startIndex,e.endIndex);for(let n=e.depth;;--n){let r=e.$from.node(n),o=e.$from.index(n),i=e.$to.indexAfter(n);if(n<e.depth&&r.canReplace(o,i,t))return n;if(0==n||r.type.spec.isolating||!Yt(r,o,i))break}return null}function Qt(e,t,n=null,r=e){let o=function(e,t){let{parent:n,startIndex:r,endIndex:o}=e,i=n.contentMatchAt(r).findWrapping(t);if(!i)return null;let s=i.length?i[0]:t;return n.canReplaceWith(r,o,s)?i:null}(e,t),i=o&&function(e,t){let{parent:n,startIndex:r,endIndex:o}=e,i=n.child(r),s=t.contentMatch.findWrapping(i.type);if(!s)return null;let a=(s.length?s[s.length-1]:t).contentMatch;for(let e=r;a&&e<o;e++)a=a.matchType(n.child(e).type);return a&&a.validEnd?s:null}(r,t);return i?o.map(Zt).concat({type:t,attrs:n}).concat(i.map(Zt)):null}function Zt(e){return{type:e,attrs:null}}function en(e,t,n,r){t.forEach(((o,i)=>{if(o.isText){let s,a=/\r?\n|\r/g;for(;s=a.exec(o.text);){let o=e.mapping.slice(r).map(n+1+i+s.index);e.replaceWith(o,o+1,t.type.schema.linebreakReplacement.create())}}}))}function tn(e,t,n,r){t.forEach(((o,i)=>{if(o.type==o.type.schema.linebreakReplacement){let o=e.mapping.slice(r).map(n+1+i);e.replaceWith(o,o+1,t.type.schema.text("\n"))}}))}function nn(e,t,n=1,r){let o=e.resolve(t),i=o.depth-n,s=r&&r[r.length-1]||o.parent;if(i<0||o.parent.type.spec.isolating||!o.parent.canReplace(o.index(),o.parent.childCount)||!s.type.validContent(o.parent.content.cutByIndex(o.index(),o.parent.childCount)))return!1;for(let e=o.depth-1,t=n-2;e>i;e--,t--){let n=o.node(e),i=o.index(e);if(n.type.spec.isolating)return!1;let s=n.content.cutByIndex(i,n.childCount),a=r&&r[t+1];a&&(s=s.replaceChild(0,a.type.create(a.attrs)));let l=r&&r[t]||n;if(!n.canReplace(i+1,n.childCount)||!l.type.validContent(s))return!1}let a=o.indexAfter(i),l=r&&r[0];return o.node(i).canReplaceWith(a,a,l?l.type:o.node(i+1).type)}function rn(e,t){let n=e.resolve(t),r=n.index();return on(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(r,r+1)}function on(e,t){return!(!e||!t||e.isLeaf||!function(e,t){t.content.size||e.type.compatibleContent(t.type);let n=e.contentMatchAt(e.childCount),{linebreakReplacement:r}=e.type.schema;for(let o=0;o<t.childCount;o++){let i=t.child(o),s=i.type==r?e.type.schema.nodes.text:i.type;if(n=n.matchType(s),!n)return!1;if(!e.type.allowsMarks(i.marks))return!1}return n.validEnd}(e,t))}function sn(e,t,n=-1){let r=e.resolve(t);for(let e=r.depth;;e--){let o,i,s=r.index(e);if(e==r.depth?(o=r.nodeBefore,i=r.nodeAfter):n>0?(o=r.node(e+1),s++,i=r.node(e).maybeChild(s)):(o=r.node(e).maybeChild(s-1),i=r.node(e+1)),o&&!o.isTextblock&&on(o,i)&&r.node(e).canReplace(s,s+1))return t;if(0==e)break;t=n<0?r.before(e):r.after(e)}}function an(e,t,n){let r=e.resolve(t);if(!n.content.size)return t;let o=n.content;for(let e=0;e<n.openStart;e++)o=o.firstChild.content;for(let e=1;e<=(0==n.openStart&&n.size?2:1);e++)for(let t=r.depth;t>=0;t--){let n=t==r.depth?0:r.pos<=(r.start(t+1)+r.end(t+1))/2?-1:1,i=r.index(t)+(n>0?1:0),s=r.node(t),a=!1;if(1==e)a=s.canReplace(i,i,o);else{let e=s.contentMatchAt(i).findWrapping(o.firstChild.type);a=e&&s.canReplaceWith(i,i,e[0])}if(a)return 0==n?r.pos:n<0?r.before(t+1):r.after(t+1)}return null}function ln(e,t,n=t,r=Re.empty){if(t==n&&!r.size)return null;let o=e.resolve(t),i=e.resolve(n);return cn(o,i,r)?new Kt(t,n,r):new dn(o,i,r).fit()}function cn(e,t,n){return!n.openStart&&!n.openEnd&&e.start()==t.start()&&e.parent.canReplace(e.index(),t.index(),n.content)}Vt.jsonID("replaceAround",Jt);class dn{constructor(e,t,n){this.$from=e,this.$to=t,this.unplaced=n,this.frontier=[],this.placed=Me.empty;for(let t=0;t<=e.depth;t++){let n=e.node(t);this.frontier.push({type:n.type,match:n.contentMatchAt(e.indexAfter(t))})}for(let t=e.depth;t>0;t--)this.placed=Me.from(e.node(t).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let e=this.findFittable();e?this.placeNodes(e):this.openMore()||this.dropNode()}let e=this.mustMoveInline(),t=this.placed.size-this.depth-this.$from.depth,n=this.$from,r=this.close(e<0?this.$to:n.doc.resolve(e));if(!r)return null;let o=this.placed,i=n.depth,s=r.depth;for(;i&&s&&1==o.childCount;)o=o.firstChild.content,i--,s--;let a=new Re(o,i,s);return e>-1?new Jt(n.pos,e,this.$to.pos,this.$to.end(),a,t):a.size||n.pos!=this.$to.pos?new Kt(n.pos,r.pos,a):null}findFittable(){let e=this.unplaced.openStart;for(let t=this.unplaced.content,n=0,r=this.unplaced.openEnd;n<e;n++){let o=t.firstChild;if(t.childCount>1&&(r=0),o.type.spec.isolating&&r<=n){e=n;break}t=o.content}for(let t=1;t<=2;t++)for(let n=1==t?e:this.unplaced.openStart;n>=0;n--){let e,r=null;n?(r=pn(this.unplaced.content,n-1).firstChild,e=r.content):e=this.unplaced.content;let o=e.firstChild;for(let e=this.depth;e>=0;e--){let i,{type:s,match:a}=this.frontier[e],l=null;if(1==t&&(o?a.matchType(o.type)||(l=a.fillBefore(Me.from(o),!1)):r&&s.compatibleContent(r.type)))return{sliceDepth:n,frontierDepth:e,parent:r,inject:l};if(2==t&&o&&(i=a.findWrapping(o.type)))return{sliceDepth:n,frontierDepth:e,parent:r,wrap:i};if(r&&a.matchType(r.type))break}}}openMore(){let{content:e,openStart:t,openEnd:n}=this.unplaced,r=pn(e,t);return!(!r.childCount||r.firstChild.isLeaf)&&(this.unplaced=new Re(e,t+1,Math.max(n,r.size+t>=e.size-n?t+1:0)),!0)}dropNode(){let{content:e,openStart:t,openEnd:n}=this.unplaced,r=pn(e,t);if(r.childCount<=1&&t>0){let o=e.size-t<=t+r.size;this.unplaced=new Re(hn(e,t-1,1),t-1,o?t-1:n)}else this.unplaced=new Re(hn(e,t,1),t,n)}placeNodes({sliceDepth:e,frontierDepth:t,parent:n,inject:r,wrap:o}){for(;this.depth>t;)this.closeFrontierNode();if(o)for(let e=0;e<o.length;e++)this.openFrontierNode(o[e]);let i=this.unplaced,s=n?n.content:i.content,a=i.openStart-e,l=0,c=[],{match:d,type:h}=this.frontier[t];if(r){for(let e=0;e<r.childCount;e++)c.push(r.child(e));d=d.matchFragment(r)}let u=s.size+e-(i.content.size-i.openEnd);for(;l<s.childCount;){let e=s.child(l),t=d.matchType(e.type);if(!t)break;l++,(l>1||0==a||e.content.size)&&(d=t,c.push(fn(e.mark(h.allowedMarks(e.marks)),1==l?a:0,l==s.childCount?u:-1)))}let p=l==s.childCount;p||(u=-1),this.placed=un(this.placed,t,Me.from(c)),this.frontier[t].match=d,p&&u<0&&n&&n.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let e=0,t=s;e<u;e++){let e=t.lastChild;this.frontier.push({type:e.type,match:e.contentMatchAt(e.childCount)}),t=e.content}this.unplaced=p?0==e?Re.empty:new Re(hn(i.content,e-1,1),e-1,u<0?i.openEnd:e-1):new Re(hn(i.content,e,l),i.openStart,i.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let e,t=this.frontier[this.depth];if(!t.type.isTextblock||!mn(this.$to,this.$to.depth,t.type,t.match,!1)||this.$to.depth==this.depth&&(e=this.findCloseLevel(this.$to))&&e.depth==this.depth)return-1;let{depth:n}=this.$to,r=this.$to.after(n);for(;n>1&&r==this.$to.end(--n);)++r;return r}findCloseLevel(e){e:for(let t=Math.min(this.depth,e.depth);t>=0;t--){let{match:n,type:r}=this.frontier[t],o=t<e.depth&&e.end(t+1)==e.pos+(e.depth-(t+1)),i=mn(e,t,r,n,o);if(i){for(let n=t-1;n>=0;n--){let{match:t,type:r}=this.frontier[n],o=mn(e,n,r,t,!0);if(!o||o.childCount)continue e}return{depth:t,fit:i,move:o?e.doc.resolve(e.after(t+1)):e}}}}close(e){let t=this.findCloseLevel(e);if(!t)return null;for(;this.depth>t.depth;)this.closeFrontierNode();t.fit.childCount&&(this.placed=un(this.placed,t.depth,t.fit)),e=t.move;for(let n=t.depth+1;n<=e.depth;n++){let t=e.node(n),r=t.type.contentMatch.fillBefore(t.content,!0,e.index(n));this.openFrontierNode(t.type,t.attrs,r)}return e}openFrontierNode(e,t=null,n){let r=this.frontier[this.depth];r.match=r.match.matchType(e),this.placed=un(this.placed,this.depth,Me.from(e.create(t,n))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let e=this.frontier.pop().match.fillBefore(Me.empty,!0);e.childCount&&(this.placed=un(this.placed,this.frontier.length,e))}}function hn(e,t,n){return 0==t?e.cutByIndex(n,e.childCount):e.replaceChild(0,e.firstChild.copy(hn(e.firstChild.content,t-1,n)))}function un(e,t,n){return 0==t?e.append(n):e.replaceChild(e.childCount-1,e.lastChild.copy(un(e.lastChild.content,t-1,n)))}function pn(e,t){for(let n=0;n<t;n++)e=e.firstChild.content;return e}function fn(e,t,n){if(t<=0)return e;let r=e.content;return t>1&&(r=r.replaceChild(0,fn(r.firstChild,t-1,1==r.childCount?n-1:0))),t>0&&(r=e.type.contentMatch.fillBefore(r).append(r),n<=0&&(r=r.append(e.type.contentMatch.matchFragment(r).fillBefore(Me.empty,!0)))),e.copy(r)}function mn(e,t,n,r,o){let i=e.node(t),s=o?e.indexAfter(t):e.index(t);if(s==i.childCount&&!n.compatibleContent(i.type))return null;let a=r.fillBefore(i.content,!0,s);return a&&!function(e,t,n){for(let r=n;r<t.childCount;r++)if(!e.allowsMarks(t.child(r).marks))return!0;return!1}(n,i.content,s)?a:null}function gn(e,t,n,r,o){if(t<n){let o=e.firstChild;e=e.replaceChild(0,o.copy(gn(o.content,t+1,n,r,o)))}if(t>r){let t=o.contentMatchAt(0),n=t.fillBefore(e).append(e);e=n.append(t.matchFragment(n).fillBefore(Me.empty,!0))}return e}function yn(e,t){let n=[];for(let r=Math.min(e.depth,t.depth);r>=0;r--){let o=e.start(r);if(o<e.pos-(e.depth-r)||t.end(r)>t.pos+(t.depth-r)||e.node(r).type.spec.isolating||t.node(r).type.spec.isolating)break;(o==t.start(r)||r==e.depth&&r==t.depth&&e.parent.inlineContent&&t.parent.inlineContent&&r&&t.start(r-1)==o-1)&&n.push(r)}return n}class vn extends Vt{constructor(e,t,n){super(),this.pos=e,this.attr=t,this.value=n}apply(e){let t=e.nodeAt(this.pos);if(!t)return jt.fail("No node at attribute step's position");let n=Object.create(null);for(let e in t.attrs)n[e]=t.attrs[e];n[this.attr]=this.value;let r=t.type.create(n,null,t.marks);return jt.fromReplace(e,this.pos,this.pos+1,new Re(Me.from(r),0,t.isLeaf?0:1))}getMap(){return Pt.empty}invert(e){return new vn(this.pos,this.attr,e.nodeAt(this.pos).attrs[this.attr])}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new vn(t.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(e,t){if("number"!=typeof t.pos||"string"!=typeof t.attr)throw new RangeError("Invalid input for AttrStep.fromJSON");return new vn(t.pos,t.attr,t.value)}}Vt.jsonID("attr",vn);class bn extends Vt{constructor(e,t){super(),this.attr=e,this.value=t}apply(e){let t=Object.create(null);for(let n in e.attrs)t[n]=e.attrs[n];t[this.attr]=this.value;let n=e.type.create(t,e.content,e.marks);return jt.ok(n)}getMap(){return Pt.empty}invert(e){return new bn(this.attr,e.attrs[this.attr])}map(e){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(e,t){if("string"!=typeof t.attr)throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new bn(t.attr,t.value)}}Vt.jsonID("docAttr",bn);let xn=class extends Error{};xn=function e(t){let n=Error.call(this,t);return n.__proto__=e.prototype,n},(xn.prototype=Object.create(Error.prototype)).constructor=xn,xn.prototype.name="TransformError";class wn{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new Bt}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let t=this.maybeStep(e);if(t.failed)throw new xn(t.failed);return this}maybeStep(e){let t=e.apply(this.doc);return t.failed||this.addStep(e,t.doc),t}get docChanged(){return this.steps.length>0}addStep(e,t){this.docs.push(this.doc),this.steps.push(e),this.mapping.appendMap(e.getMap()),this.doc=t}replace(e,t=e,n=Re.empty){let r=ln(this.doc,e,t,n);return r&&this.step(r),this}replaceWith(e,t,n){return this.replace(e,t,new Re(Me.from(n),0,0))}delete(e,t){return this.replace(e,t,Re.empty)}insert(e,t){return this.replaceWith(e,e,t)}replaceRange(e,t,n){return function(e,t,n,r){if(!r.size)return e.deleteRange(t,n);let o=e.doc.resolve(t),i=e.doc.resolve(n);if(cn(o,i,r))return e.step(new Kt(t,n,r));let s=yn(o,e.doc.resolve(n));0==s[s.length-1]&&s.pop();let a=-(o.depth+1);s.unshift(a);for(let e=o.depth,t=o.pos-1;e>0;e--,t--){let n=o.node(e).type.spec;if(n.defining||n.definingAsContext||n.isolating)break;s.indexOf(e)>-1?a=e:o.before(e)==t&&s.splice(1,0,-e)}let l=s.indexOf(a),c=[],d=r.openStart;for(let e=r.content,t=0;;t++){let n=e.firstChild;if(c.push(n),t==r.openStart)break;e=n.content}for(let e=d-1;e>=0;e--){let t=c[e],n=(h=t.type).spec.defining||h.spec.definingForContent;if(n&&!t.sameMarkup(o.node(Math.abs(a)-1)))d=e;else if(n||!t.type.isTextblock)break}var h;for(let t=r.openStart;t>=0;t--){let a=(t+d+1)%(r.openStart+1),h=c[a];if(h)for(let t=0;t<s.length;t++){let c=s[(t+l)%s.length],d=!0;c<0&&(d=!1,c=-c);let u=o.node(c-1),p=o.index(c-1);if(u.canReplaceWith(p,p,h.type,h.marks))return e.replace(o.before(c),d?i.after(c):n,new Re(gn(r.content,0,r.openStart,a),a,r.openEnd))}}let u=e.steps.length;for(let a=s.length-1;a>=0&&(e.replace(t,n,r),!(e.steps.length>u));a--){let e=s[a];e<0||(t=o.before(e),n=i.after(e))}}(this,e,t,n),this}replaceRangeWith(e,t,n){return function(e,t,n,r){if(!r.isInline&&t==n&&e.doc.resolve(t).parent.content.size){let o=function(e,t,n){let r=e.resolve(t);if(r.parent.canReplaceWith(r.index(),r.index(),n))return t;if(0==r.parentOffset)for(let e=r.depth-1;e>=0;e--){let t=r.index(e);if(r.node(e).canReplaceWith(t,t,n))return r.before(e+1);if(t>0)return null}if(r.parentOffset==r.parent.content.size)for(let e=r.depth-1;e>=0;e--){let t=r.indexAfter(e);if(r.node(e).canReplaceWith(t,t,n))return r.after(e+1);if(t<r.node(e).childCount)return null}return null}(e.doc,t,r.type);null!=o&&(t=n=o)}e.replaceRange(t,n,new Re(Me.from(r),0,0))}(this,e,t,n),this}deleteRange(e,t){return function(e,t,n){let r=e.doc.resolve(t),o=e.doc.resolve(n),i=yn(r,o);for(let t=0;t<i.length;t++){let n=i[t],s=t==i.length-1;if(s&&0==n||r.node(n).type.contentMatch.validEnd)return e.delete(r.start(n),o.end(n));if(n>0&&(s||r.node(n-1).canReplace(r.index(n-1),o.indexAfter(n-1))))return e.delete(r.before(n),o.after(n))}for(let i=1;i<=r.depth&&i<=o.depth;i++)if(t-r.start(i)==r.depth-i&&n>r.end(i)&&o.end(i)-n!=o.depth-i&&r.start(i-1)==o.start(i-1)&&r.node(i-1).canReplace(r.index(i-1),o.index(i-1)))return e.delete(r.before(i),n);e.delete(t,n)}(this,e,t),this}lift(e,t){return function(e,t,n){let{$from:r,$to:o,depth:i}=t,s=r.before(i+1),a=o.after(i+1),l=s,c=a,d=Me.empty,h=0;for(let e=i,t=!1;e>n;e--)t||r.index(e)>0?(t=!0,d=Me.from(r.node(e).copy(d)),h++):l--;let u=Me.empty,p=0;for(let e=i,t=!1;e>n;e--)t||o.after(e+1)<o.end(e)?(t=!0,u=Me.from(o.node(e).copy(u)),p++):c++;e.step(new Jt(l,c,s,a,new Re(d.append(u),h,p),d.size-h,!0))}(this,e,t),this}join(e,t=1){return function(e,t,n){let r=null,{linebreakReplacement:o}=e.doc.type.schema,i=e.doc.resolve(t-n),s=i.node().type;if(o&&s.inlineContent){let e="pre"==s.whitespace,t=!!s.contentMatch.matchType(o);e&&!t?r=!1:!e&&t&&(r=!0)}let a=e.steps.length;if(!1===r){let r=e.doc.resolve(t+n);tn(e,r.node(),r.before(),a)}s.inlineContent&&Gt(e,t+n-1,s,i.node().contentMatchAt(i.index()),null==r);let l=e.mapping.slice(a),c=l.map(t-n);if(e.step(new Kt(c,l.map(t+n,-1),Re.empty,!0)),!0===r){let t=e.doc.resolve(c);en(e,t.node(),t.before(),e.steps.length)}}(this,e,t),this}wrap(e,t){return function(e,t,n){let r=Me.empty;for(let e=n.length-1;e>=0;e--){if(r.size){let t=n[e].type.contentMatch.matchFragment(r);if(!t||!t.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}r=Me.from(n[e].type.create(n[e].attrs,r))}let o=t.start,i=t.end;e.step(new Jt(o,i,o,i,new Re(r,0,0),n.length,!0))}(this,e,t),this}setBlockType(e,t=e,n,r=null){return function(e,t,n,r,o){if(!r.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let i=e.steps.length;e.doc.nodesBetween(t,n,((t,n)=>{let s="function"==typeof o?o(t):o;if(t.isTextblock&&!t.hasMarkup(r,s)&&function(e,t,n){let r=e.resolve(t),o=r.index();return r.parent.canReplaceWith(o,o+1,n)}(e.doc,e.mapping.slice(i).map(n),r)){let o=null;if(r.schema.linebreakReplacement){let e="pre"==r.whitespace,t=!!r.contentMatch.matchType(r.schema.linebreakReplacement);e&&!t?o=!1:!e&&t&&(o=!0)}!1===o&&tn(e,t,n,i),Gt(e,e.mapping.slice(i).map(n,1),r,void 0,null===o);let a=e.mapping.slice(i),l=a.map(n,1),c=a.map(n+t.nodeSize,1);return e.step(new Jt(l,c,l+1,c-1,new Re(Me.from(r.create(s,null,t.marks)),0,0),1,!0)),!0===o&&en(e,t,n,i),!1}}))}(this,e,t,n,r),this}setNodeMarkup(e,t,n=null,r){return function(e,t,n,r,o){let i=e.doc.nodeAt(t);if(!i)throw new RangeError("No node at given position");n||(n=i.type);let s=n.create(r,null,o||i.marks);if(i.isLeaf)return e.replaceWith(t,t+i.nodeSize,s);if(!n.validContent(i.content))throw new RangeError("Invalid content for node type "+n.name);e.step(new Jt(t,t+i.nodeSize,t+1,t+i.nodeSize-1,new Re(Me.from(s),0,0),1,!0))}(this,e,t,n,r),this}setNodeAttribute(e,t,n){return this.step(new vn(e,t,n)),this}setDocAttribute(e,t){return this.step(new bn(e,t)),this}addNodeMark(e,t){return this.step(new qt(e,t)),this}removeNodeMark(e,t){let n=this.doc.nodeAt(e);if(!n)throw new RangeError("No node at position "+e);if(t instanceof Ae)t.isInSet(n.marks)&&this.step(new Wt(e,t));else{let r,o=n.marks,i=[];for(;r=t.isInSet(o);)i.push(new Wt(e,r)),o=r.removeFromSet(o);for(let e=i.length-1;e>=0;e--)this.step(i[e])}return this}split(e,t=1,n){return function(e,t,n=1,r){let o=e.doc.resolve(t),i=Me.empty,s=Me.empty;for(let e=o.depth,t=o.depth-n,a=n-1;e>t;e--,a--){i=Me.from(o.node(e).copy(i));let t=r&&r[a];s=Me.from(t?t.type.create(t.attrs,s):o.node(e).copy(s))}e.step(new Kt(t,t,new Re(i.append(s),n,n),!0))}(this,e,t,n),this}addMark(e,t,n){return function(e,t,n,r){let o,i,s=[],a=[];e.doc.nodesBetween(t,n,((e,l,c)=>{if(!e.isInline)return;let d=e.marks;if(!r.isInSet(d)&&c.type.allowsMarkType(r.type)){let c=Math.max(l,t),h=Math.min(l+e.nodeSize,n),u=r.addToSet(d);for(let e=0;e<d.length;e++)d[e].isInSet(u)||(o&&o.to==c&&o.mark.eq(d[e])?o.to=h:s.push(o=new _t(c,h,d[e])));i&&i.to==c?i.to=h:a.push(i=new Ht(c,h,r))}})),s.forEach((t=>e.step(t))),a.forEach((t=>e.step(t)))}(this,e,t,n),this}removeMark(e,t,n){return function(e,t,n,r){let o=[],i=0;e.doc.nodesBetween(t,n,((e,s)=>{if(!e.isInline)return;i++;let a=null;if(r instanceof ft){let t,n=e.marks;for(;t=r.isInSet(n);)(a||(a=[])).push(t),n=t.removeFromSet(n)}else r?r.isInSet(e.marks)&&(a=[r]):a=e.marks;if(a&&a.length){let r=Math.min(s+e.nodeSize,n);for(let e=0;e<a.length;e++){let n,l=a[e];for(let e=0;e<o.length;e++){let t=o[e];t.step==i-1&&l.eq(o[e].style)&&(n=t)}n?(n.to=r,n.step=i):o.push({style:l,from:Math.max(s,t),to:r,step:i})}}})),o.forEach((t=>e.step(new _t(t.from,t.to,t.style))))}(this,e,t,n),this}clearIncompatible(e,t,n){return Gt(this,e,t,n),this}}const kn=Object.create(null);class Cn{constructor(e,t,n){this.$anchor=e,this.$head=t,this.ranges=n||[new Nn(e.min(t),e.max(t))]}get anchor(){return this.$anchor.pos}get head(){return this.$head.pos}get from(){return this.$from.pos}get to(){return this.$to.pos}get $from(){return this.ranges[0].$from}get $to(){return this.ranges[0].$to}get empty(){let e=this.ranges;for(let t=0;t<e.length;t++)if(e[t].$from.pos!=e[t].$to.pos)return!1;return!0}content(){return this.$from.doc.slice(this.from,this.to,!0)}replace(e,t=Re.empty){let n=t.content.lastChild,r=null;for(let e=0;e<t.openEnd;e++)r=n,n=n.lastChild;let o=e.steps.length,i=this.ranges;for(let s=0;s<i.length;s++){let{$from:a,$to:l}=i[s],c=e.mapping.slice(o);e.replaceRange(c.map(a.pos),c.map(l.pos),s?Re.empty:t),0==s&&In(e,o,(n?n.isInline:r&&r.isTextblock)?-1:1)}}replaceWith(e,t){let n=e.steps.length,r=this.ranges;for(let o=0;o<r.length;o++){let{$from:i,$to:s}=r[o],a=e.mapping.slice(n),l=a.map(i.pos),c=a.map(s.pos);o?e.deleteRange(l,c):(e.replaceRangeWith(l,c,t),In(e,n,t.isInline?-1:1))}}static findFrom(e,t,n=!1){let r=e.parent.inlineContent?new Tn(e):Ln(e.node(0),e.parent,e.pos,e.index(),t,n);if(r)return r;for(let r=e.depth-1;r>=0;r--){let o=t<0?Ln(e.node(0),e.node(r),e.before(r+1),e.index(r),t,n):Ln(e.node(0),e.node(r),e.after(r+1),e.index(r)+1,t,n);if(o)return o}return null}static near(e,t=1){return this.findFrom(e,t)||this.findFrom(e,-t)||new Dn(e.node(0))}static atStart(e){return Ln(e,e,0,0,1)||new Dn(e)}static atEnd(e){return Ln(e,e,e.content.size,e.childCount,-1)||new Dn(e)}static fromJSON(e,t){if(!t||!t.type)throw new RangeError("Invalid input for Selection.fromJSON");let n=kn[t.type];if(!n)throw new RangeError(`No selection type ${t.type} defined`);return n.fromJSON(e,t)}static jsonID(e,t){if(e in kn)throw new RangeError("Duplicate use of selection JSON ID "+e);return kn[e]=t,t.prototype.jsonID=e,t}getBookmark(){return Tn.between(this.$anchor,this.$head).getBookmark()}}Cn.prototype.visible=!0;class Nn{constructor(e,t){this.$from=e,this.$to=t}}let Sn=!1;function Mn(e){Sn||e.parent.inlineContent||(Sn=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+e.parent.type.name+")"))}class Tn extends Cn{constructor(e,t=e){Mn(e),Mn(t),super(e,t)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(e,t){let n=e.resolve(t.map(this.head));if(!n.parent.inlineContent)return Cn.near(n);let r=e.resolve(t.map(this.anchor));return new Tn(r.parent.inlineContent?r:n,n)}replace(e,t=Re.empty){if(super.replace(e,t),t==Re.empty){let t=this.$from.marksAcross(this.$to);t&&e.ensureMarks(t)}}eq(e){return e instanceof Tn&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new On(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(e,t){if("number"!=typeof t.anchor||"number"!=typeof t.head)throw new RangeError("Invalid input for TextSelection.fromJSON");return new Tn(e.resolve(t.anchor),e.resolve(t.head))}static create(e,t,n=t){let r=e.resolve(t);return new this(r,n==t?r:e.resolve(n))}static between(e,t,n){let r=e.pos-t.pos;if(n&&!r||(n=r>=0?1:-1),!t.parent.inlineContent){let e=Cn.findFrom(t,n,!0)||Cn.findFrom(t,-n,!0);if(!e)return Cn.near(t,n);t=e.$head}return e.parent.inlineContent||(0==r||(e=(Cn.findFrom(e,-n,!0)||Cn.findFrom(e,n,!0)).$anchor).pos<t.pos!=r<0)&&(e=t),new Tn(e,t)}}Cn.jsonID("text",Tn);class On{constructor(e,t){this.anchor=e,this.head=t}map(e){return new On(e.map(this.anchor),e.map(this.head))}resolve(e){return Tn.between(e.resolve(this.anchor),e.resolve(this.head))}}class En extends Cn{constructor(e){let t=e.nodeAfter,n=e.node(0).resolve(e.pos+t.nodeSize);super(e,n),this.node=t}map(e,t){let{deleted:n,pos:r}=t.mapResult(this.anchor),o=e.resolve(r);return n?Cn.near(o):new En(o)}content(){return new Re(Me.from(this.node),0,0)}eq(e){return e instanceof En&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new An(this.anchor)}static fromJSON(e,t){if("number"!=typeof t.anchor)throw new RangeError("Invalid input for NodeSelection.fromJSON");return new En(e.resolve(t.anchor))}static create(e,t){return new En(e.resolve(t))}static isSelectable(e){return!e.isText&&!1!==e.type.spec.selectable}}En.prototype.visible=!1,Cn.jsonID("node",En);class An{constructor(e){this.anchor=e}map(e){let{deleted:t,pos:n}=e.mapResult(this.anchor);return t?new On(n,n):new An(n)}resolve(e){let t=e.resolve(this.anchor),n=t.nodeAfter;return n&&En.isSelectable(n)?new En(t):Cn.near(t)}}class Dn extends Cn{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,t=Re.empty){if(t==Re.empty){e.delete(0,e.doc.content.size);let t=Cn.atStart(e.doc);t.eq(e.selection)||e.setSelection(t)}else super.replace(e,t)}toJSON(){return{type:"all"}}static fromJSON(e){return new Dn(e)}map(e){return new Dn(e)}eq(e){return e instanceof Dn}getBookmark(){return Rn}}Cn.jsonID("all",Dn);const Rn={map(){return this},resolve:e=>new Dn(e)};function Ln(e,t,n,r,o,i=!1){if(t.inlineContent)return Tn.create(e,n);for(let s=r-(o>0?0:1);o>0?s<t.childCount:s>=0;s+=o){let r=t.child(s);if(r.isAtom){if(!i&&En.isSelectable(r))return En.create(e,n-(o<0?r.nodeSize:0))}else{let t=Ln(e,r,n+o,o<0?r.childCount:0,o,i);if(t)return t}n+=r.nodeSize*o}return null}function In(e,t,n){let r=e.steps.length-1;if(r<t)return;let o,i=e.steps[r];(i instanceof Kt||i instanceof Jt)&&(e.mapping.maps[r].forEach(((e,t,n,r)=>{null==o&&(o=r)})),e.setSelection(Cn.near(e.doc.resolve(o),n)))}class zn extends wn{constructor(e){super(e.doc),this.curSelectionFor=0,this.updated=0,this.meta=Object.create(null),this.time=Date.now(),this.curSelection=e.selection,this.storedMarks=e.storedMarks}get selection(){return this.curSelectionFor<this.steps.length&&(this.curSelection=this.curSelection.map(this.doc,this.mapping.slice(this.curSelectionFor)),this.curSelectionFor=this.steps.length),this.curSelection}setSelection(e){if(e.$from.doc!=this.doc)throw new RangeError("Selection passed to setSelection must point at the current document");return this.curSelection=e,this.curSelectionFor=this.steps.length,this.updated=-3&this.updated|1,this.storedMarks=null,this}get selectionSet(){return(1&this.updated)>0}setStoredMarks(e){return this.storedMarks=e,this.updated|=2,this}ensureMarks(e){return Ae.sameSet(this.storedMarks||this.selection.$from.marks(),e)||this.setStoredMarks(e),this}addStoredMark(e){return this.ensureMarks(e.addToSet(this.storedMarks||this.selection.$head.marks()))}removeStoredMark(e){return this.ensureMarks(e.removeFromSet(this.storedMarks||this.selection.$head.marks()))}get storedMarksSet(){return(2&this.updated)>0}addStep(e,t){super.addStep(e,t),this.updated=-3&this.updated,this.storedMarks=null}setTime(e){return this.time=e,this}replaceSelection(e){return this.selection.replace(this,e),this}replaceSelectionWith(e,t=!0){let n=this.selection;return t&&(e=e.mark(this.storedMarks||(n.empty?n.$from.marks():n.$from.marksAcross(n.$to)||Ae.none))),n.replaceWith(this,e),this}deleteSelection(){return this.selection.replace(this),this}insertText(e,t,n){let r=this.doc.type.schema;if(null==t)return e?this.replaceSelectionWith(r.text(e),!0):this.deleteSelection();{if(null==n&&(n=t),n=null==n?t:n,!e)return this.deleteRange(t,n);let o=this.storedMarks;if(!o){let e=this.doc.resolve(t);o=n==t?e.marks():e.marksAcross(this.doc.resolve(n))}return this.replaceRangeWith(t,n,r.text(e,o)),this.selection.empty||this.setSelection(Cn.near(this.selection.$to)),this}}setMeta(e,t){return this.meta["string"==typeof e?e:e.key]=t,this}getMeta(e){return this.meta["string"==typeof e?e:e.key]}get isGeneric(){for(let e in this.meta)return!1;return!0}scrollIntoView(){return this.updated|=4,this}get scrolledIntoView(){return(4&this.updated)>0}}function Pn(e,t){return t&&e?e.bind(t):e}class Bn{constructor(e,t,n){this.name=e,this.init=Pn(t.init,n),this.apply=Pn(t.apply,n)}}const $n=[new Bn("doc",{init:e=>e.doc||e.schema.topNodeType.createAndFill(),apply:e=>e.doc}),new Bn("selection",{init:(e,t)=>e.selection||Cn.atStart(t.doc),apply:e=>e.selection}),new Bn("storedMarks",{init:e=>e.storedMarks||null,apply:(e,t,n,r)=>r.selection.$cursor?e.storedMarks:null}),new Bn("scrollToSelection",{init:()=>0,apply:(e,t)=>e.scrolledIntoView?t+1:t})];class Vn{constructor(e,t){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=$n.slice(),t&&t.forEach((e=>{if(this.pluginsByKey[e.key])throw new RangeError("Adding different instances of a keyed plugin ("+e.key+")");this.plugins.push(e),this.pluginsByKey[e.key]=e,e.spec.state&&this.fields.push(new Bn(e.key,e.spec.state,e))}))}}class jn{constructor(e){this.config=e}get schema(){return this.config.schema}get plugins(){return this.config.plugins}apply(e){return this.applyTransaction(e).state}filterTransaction(e,t=-1){for(let n=0;n<this.config.plugins.length;n++)if(n!=t){let t=this.config.plugins[n];if(t.spec.filterTransaction&&!t.spec.filterTransaction.call(t,e,this))return!1}return!0}applyTransaction(e){if(!this.filterTransaction(e))return{state:this,transactions:[]};let t=[e],n=this.applyInner(e),r=null;for(;;){let o=!1;for(let i=0;i<this.config.plugins.length;i++){let s=this.config.plugins[i];if(s.spec.appendTransaction){let a=r?r[i].n:0,l=r?r[i].state:this,c=a<t.length&&s.spec.appendTransaction.call(s,a?t.slice(a):t,l,n);if(c&&n.filterTransaction(c,i)){if(c.setMeta("appendedTransaction",e),!r){r=[];for(let e=0;e<this.config.plugins.length;e++)r.push(e<i?{state:n,n:t.length}:{state:this,n:0})}t.push(c),n=n.applyInner(c),o=!0}r&&(r[i]={state:n,n:t.length})}}if(!o)return{state:n,transactions:t}}}applyInner(e){if(!e.before.eq(this.doc))throw new RangeError("Applying a mismatched transaction");let t=new jn(this.config),n=this.config.fields;for(let r=0;r<n.length;r++){let o=n[r];t[o.name]=o.apply(e,this[o.name],this,t)}return t}get tr(){return new zn(this)}static create(e){let t=new Vn(e.doc?e.doc.type.schema:e.schema,e.plugins),n=new jn(t);for(let r=0;r<t.fields.length;r++)n[t.fields[r].name]=t.fields[r].init(e,n);return n}reconfigure(e){let t=new Vn(this.schema,e.plugins),n=t.fields,r=new jn(t);for(let t=0;t<n.length;t++){let o=n[t].name;r[o]=this.hasOwnProperty(o)?this[o]:n[t].init(e,r)}return r}toJSON(e){let t={doc:this.doc.toJSON(),selection:this.selection.toJSON()};if(this.storedMarks&&(t.storedMarks=this.storedMarks.map((e=>e.toJSON()))),e&&"object"==typeof e)for(let n in e){if("doc"==n||"selection"==n)throw new RangeError("The JSON fields `doc` and `selection` are reserved");let r=e[n],o=r.spec.state;o&&o.toJSON&&(t[n]=o.toJSON.call(r,this[r.key]))}return t}static fromJSON(e,t,n){if(!t)throw new RangeError("Invalid input for EditorState.fromJSON");if(!e.schema)throw new RangeError("Required config field 'schema' missing");let r=new Vn(e.schema,e.plugins),o=new jn(r);return r.fields.forEach((r=>{if("doc"==r.name)o.doc=Ye.fromJSON(e.schema,t.doc);else if("selection"==r.name)o.selection=Cn.fromJSON(o.doc,t.selection);else if("storedMarks"==r.name)t.storedMarks&&(o.storedMarks=t.storedMarks.map(e.schema.markFromJSON));else{if(n)for(let i in n){let s=n[i],a=s.spec.state;if(s.key==r.name&&a&&a.fromJSON&&Object.prototype.hasOwnProperty.call(t,i))return void(o[r.name]=a.fromJSON.call(s,e,t[i],o))}o[r.name]=r.init(e,o)}})),o}}function Fn(e,t,n){for(let r in e){let o=e[r];o instanceof Function?o=o.bind(t):"handleDOMEvents"==r&&(o=Fn(o,t,{})),n[r]=o}return n}class Hn{constructor(e){this.spec=e,this.props={},e.props&&Fn(e.props,this,this.props),this.key=e.key?e.key.key:qn("plugin")}getState(e){return e[this.key]}}const _n=Object.create(null);function qn(e){return e in _n?e+"$"+ ++_n[e]:(_n[e]=0,e+"$")}class Wn{constructor(e="key"){this.key=qn(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}const Kn=function(e){for(var t=0;;t++)if(!(e=e.previousSibling))return t},Jn=function(e){let t=e.assignedSlot||e.parentNode;return t&&11==t.nodeType?t.host:t};let Un=null;const Gn=function(e,t,n){let r=Un||(Un=document.createRange());return r.setEnd(e,null==n?e.nodeValue.length:n),r.setStart(e,t||0),r},Yn=function(e,t,n,r){return n&&(Qn(e,t,n,r,-1)||Qn(e,t,n,r,1))},Xn=/^(img|br|input|textarea|hr)$/i;function Qn(e,t,n,r,o){for(var i;;){if(e==n&&t==r)return!0;if(t==(o<0?0:Zn(e))){let n=e.parentNode;if(!n||1!=n.nodeType||er(e)||Xn.test(e.nodeName)||"false"==e.contentEditable)return!1;t=Kn(e)+(o<0?0:1),e=n}else{if(1!=e.nodeType)return!1;{let n=e.childNodes[t+(o<0?-1:0)];if(1==n.nodeType&&"false"==n.contentEditable){if(!(null===(i=n.pmViewDesc)||void 0===i?void 0:i.ignoreForSelection))return!1;t+=o}else e=n,t=o<0?Zn(e):0}}}}function Zn(e){return 3==e.nodeType?e.nodeValue.length:e.childNodes.length}function er(e){let t;for(let n=e;n&&!(t=n.pmViewDesc);n=n.parentNode);return t&&t.node&&t.node.isBlock&&(t.dom==e||t.contentDOM==e)}const tr=function(e){return e.focusNode&&Yn(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset)};function nr(e,t){let n=document.createEvent("Event");return n.initEvent("keydown",!0,!0),n.keyCode=e,n.key=n.code=t,n}const rr="undefined"!=typeof navigator?navigator:null,or="undefined"!=typeof document?document:null,ir=rr&&rr.userAgent||"",sr=/Edge\/(\d+)/.exec(ir),ar=/MSIE \d/.exec(ir),lr=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(ir),cr=!!(ar||lr||sr),dr=ar?document.documentMode:lr?+lr[1]:sr?+sr[1]:0,hr=!cr&&/gecko\/(\d+)/i.test(ir);hr&&(/Firefox\/(\d+)/.exec(ir)||[0,0])[1];const ur=!cr&&/Chrome\/(\d+)/.exec(ir),pr=!!ur,fr=ur?+ur[1]:0,mr=!cr&&!!rr&&/Apple Computer/.test(rr.vendor),gr=mr&&(/Mobile\/\w+/.test(ir)||!!rr&&rr.maxTouchPoints>2),yr=gr||!!rr&&/Mac/.test(rr.platform),vr=!!rr&&/Win/.test(rr.platform),br=/Android \d/.test(ir),xr=!!or&&"webkitFontSmoothing"in or.documentElement.style,wr=xr?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function kr(e){let t=e.defaultView&&e.defaultView.visualViewport;return t?{left:0,right:t.width,top:0,bottom:t.height}:{left:0,right:e.documentElement.clientWidth,top:0,bottom:e.documentElement.clientHeight}}function Cr(e,t){return"number"==typeof e?e:e[t]}function Nr(e){let t=e.getBoundingClientRect(),n=t.width/e.offsetWidth||1,r=t.height/e.offsetHeight||1;return{left:t.left,right:t.left+e.clientWidth*n,top:t.top,bottom:t.top+e.clientHeight*r}}function Sr(e,t,n){let r=e.someProp("scrollThreshold")||0,o=e.someProp("scrollMargin")||5,i=e.dom.ownerDocument;for(let s=n||e.dom;s;){if(1!=s.nodeType){s=Jn(s);continue}let e=s,n=e==i.body,a=n?kr(i):Nr(e),l=0,c=0;if(t.top<a.top+Cr(r,"top")?c=-(a.top-t.top+Cr(o,"top")):t.bottom>a.bottom-Cr(r,"bottom")&&(c=t.bottom-t.top>a.bottom-a.top?t.top+Cr(o,"top")-a.top:t.bottom-a.bottom+Cr(o,"bottom")),t.left<a.left+Cr(r,"left")?l=-(a.left-t.left+Cr(o,"left")):t.right>a.right-Cr(r,"right")&&(l=t.right-a.right+Cr(o,"right")),l||c)if(n)i.defaultView.scrollBy(l,c);else{let n=e.scrollLeft,r=e.scrollTop;c&&(e.scrollTop+=c),l&&(e.scrollLeft+=l);let o=e.scrollLeft-n,i=e.scrollTop-r;t={left:t.left-o,top:t.top-i,right:t.right-o,bottom:t.bottom-i}}let d=n?"fixed":getComputedStyle(s).position;if(/^(fixed|sticky)$/.test(d))break;s="absolute"==d?s.offsetParent:Jn(s)}}function Mr(e){let t=[],n=e.ownerDocument;for(let r=e;r&&(t.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),e!=n);r=Jn(r));return t}function Tr(e,t){for(let n=0;n<e.length;n++){let{dom:r,top:o,left:i}=e[n];r.scrollTop!=o+t&&(r.scrollTop=o+t),r.scrollLeft!=i&&(r.scrollLeft=i)}}let Or=null;function Er(e,t){let n,r,o,i,s=2e8,a=0,l=t.top,c=t.top;for(let d=e.firstChild,h=0;d;d=d.nextSibling,h++){let e;if(1==d.nodeType)e=d.getClientRects();else{if(3!=d.nodeType)continue;e=Gn(d).getClientRects()}for(let u=0;u<e.length;u++){let p=e[u];if(p.top<=l&&p.bottom>=c){l=Math.max(p.bottom,l),c=Math.min(p.top,c);let e=p.left>t.left?p.left-t.left:p.right<t.left?t.left-p.right:0;if(e<s){n=d,s=e,r=e&&3==n.nodeType?{left:p.right<t.left?p.right:p.left,top:t.top}:t,1==d.nodeType&&e&&(a=h+(t.left>=(p.left+p.right)/2?1:0));continue}}else p.top>t.top&&!o&&p.left<=t.left&&p.right>=t.left&&(o=d,i={left:Math.max(p.left,Math.min(p.right,t.left)),top:p.top});!n&&(t.left>=p.right&&t.top>=p.top||t.left>=p.left&&t.top>=p.bottom)&&(a=h+1)}}return!n&&o&&(n=o,r=i,s=0),n&&3==n.nodeType?function(e,t){let n=e.nodeValue.length,r=document.createRange();for(let o=0;o<n;o++){r.setEnd(e,o+1),r.setStart(e,o);let n=Ir(r,1);if(n.top!=n.bottom&&Ar(t,n))return{node:e,offset:o+(t.left>=(n.left+n.right)/2?1:0)}}return{node:e,offset:0}}(n,r):!n||s&&1==n.nodeType?{node:e,offset:a}:Er(n,r)}function Ar(e,t){return e.left>=t.left-1&&e.left<=t.right+1&&e.top>=t.top-1&&e.top<=t.bottom+1}function Dr(e,t,n){let r=e.childNodes.length;if(r&&n.top<n.bottom)for(let o=Math.max(0,Math.min(r-1,Math.floor(r*(t.top-n.top)/(n.bottom-n.top))-2)),i=o;;){let n=e.childNodes[i];if(1==n.nodeType){let e=n.getClientRects();for(let r=0;r<e.length;r++){let o=e[r];if(Ar(t,o))return Dr(n,t,o)}}if((i=(i+1)%r)==o)break}return e}function Rr(e,t){let n,r=e.dom.ownerDocument,o=0,i=function(e,t,n){if(e.caretPositionFromPoint)try{let r=e.caretPositionFromPoint(t,n);if(r)return{node:r.offsetNode,offset:Math.min(Zn(r.offsetNode),r.offset)}}catch(e){}if(e.caretRangeFromPoint){let r=e.caretRangeFromPoint(t,n);if(r)return{node:r.startContainer,offset:Math.min(Zn(r.startContainer),r.startOffset)}}}(r,t.left,t.top);i&&({node:n,offset:o}=i);let s,a=(e.root.elementFromPoint?e.root:r).elementFromPoint(t.left,t.top);if(!a||!e.dom.contains(1!=a.nodeType?a.parentNode:a)){let n=e.dom.getBoundingClientRect();if(!Ar(t,n))return null;if(a=Dr(e.dom,t,n),!a)return null}if(mr)for(let e=a;n&&e;e=Jn(e))e.draggable&&(n=void 0);if(a=function(e,t){let n=e.parentNode;return n&&/^li$/i.test(n.nodeName)&&t.left<e.getBoundingClientRect().left?n:e}(a,t),n){if(hr&&1==n.nodeType&&(o=Math.min(o,n.childNodes.length),o<n.childNodes.length)){let e,r=n.childNodes[o];"IMG"==r.nodeName&&(e=r.getBoundingClientRect()).right<=t.left&&e.bottom>t.top&&o++}let r;xr&&o&&1==n.nodeType&&1==(r=n.childNodes[o-1]).nodeType&&"false"==r.contentEditable&&r.getBoundingClientRect().top>=t.top&&o--,n==e.dom&&o==n.childNodes.length-1&&1==n.lastChild.nodeType&&t.top>n.lastChild.getBoundingClientRect().bottom?s=e.state.doc.content.size:0!=o&&1==n.nodeType&&"BR"==n.childNodes[o-1].nodeName||(s=function(e,t,n,r){let o=-1;for(let n=t,i=!1;n!=e.dom;){let t,s=e.docView.nearestDesc(n,!0);if(!s)return null;if(1==s.dom.nodeType&&(s.node.isBlock&&s.parent||!s.contentDOM)&&((t=s.dom.getBoundingClientRect()).width||t.height)&&(s.node.isBlock&&s.parent&&!/^T(R|BODY|HEAD|FOOT)$/.test(s.dom.nodeName)&&(!i&&t.left>r.left||t.top>r.top?o=s.posBefore:(!i&&t.right<r.left||t.bottom<r.top)&&(o=s.posAfter),i=!0),!s.contentDOM&&o<0&&!s.node.isText))return(s.node.isBlock?r.top<(t.top+t.bottom)/2:r.left<(t.left+t.right)/2)?s.posBefore:s.posAfter;n=s.dom.parentNode}return o>-1?o:e.docView.posFromDOM(t,n,-1)}(e,n,o,t))}null==s&&(s=function(e,t,n){let{node:r,offset:o}=Er(t,n),i=-1;if(1==r.nodeType&&!r.firstChild){let e=r.getBoundingClientRect();i=e.left!=e.right&&n.left>(e.left+e.right)/2?1:-1}return e.docView.posFromDOM(r,o,i)}(e,a,t));let l=e.docView.nearestDesc(a,!0);return{pos:s,inside:l?l.posAtStart-l.border:-1}}function Lr(e){return e.top<e.bottom||e.left<e.right}function Ir(e,t){let n=e.getClientRects();if(n.length){let e=n[t<0?0:n.length-1];if(Lr(e))return e}return Array.prototype.find.call(n,Lr)||e.getBoundingClientRect()}const zr=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function Pr(e,t,n){let{node:r,offset:o,atom:i}=e.docView.domFromPos(t,n<0?-1:1),s=xr||hr;if(3==r.nodeType){if(!s||!zr.test(r.nodeValue)&&(n<0?o:o!=r.nodeValue.length)){let e=o,t=o,i=n<0?1:-1;return n<0&&!o?(t++,i=-1):n>=0&&o==r.nodeValue.length?(e--,i=1):n<0?e--:t++,Br(Ir(Gn(r,e,t),i),i<0)}{let e=Ir(Gn(r,o,o),n);if(hr&&o&&/\s/.test(r.nodeValue[o-1])&&o<r.nodeValue.length){let t=Ir(Gn(r,o-1,o-1),-1);if(t.top==e.top){let n=Ir(Gn(r,o,o+1),-1);if(n.top!=e.top)return Br(n,n.left<t.left)}}return e}}if(!e.state.doc.resolve(t-(i||0)).parent.inlineContent){if(null==i&&o&&(n<0||o==Zn(r))){let e=r.childNodes[o-1];if(1==e.nodeType)return $r(e.getBoundingClientRect(),!1)}if(null==i&&o<Zn(r)){let e=r.childNodes[o];if(1==e.nodeType)return $r(e.getBoundingClientRect(),!0)}return $r(r.getBoundingClientRect(),n>=0)}if(null==i&&o&&(n<0||o==Zn(r))){let e=r.childNodes[o-1],t=3==e.nodeType?Gn(e,Zn(e)-(s?0:1)):1!=e.nodeType||"BR"==e.nodeName&&e.nextSibling?null:e;if(t)return Br(Ir(t,1),!1)}if(null==i&&o<Zn(r)){let e=r.childNodes[o];for(;e.pmViewDesc&&e.pmViewDesc.ignoreForCoords;)e=e.nextSibling;let t=e?3==e.nodeType?Gn(e,0,s?0:1):1==e.nodeType?e:null:null;if(t)return Br(Ir(t,-1),!0)}return Br(Ir(3==r.nodeType?Gn(r):r,-n),n>=0)}function Br(e,t){if(0==e.width)return e;let n=t?e.left:e.right;return{top:e.top,bottom:e.bottom,left:n,right:n}}function $r(e,t){if(0==e.height)return e;let n=t?e.top:e.bottom;return{top:n,bottom:n,left:e.left,right:e.right}}function Vr(e,t,n){let r=e.state,o=e.root.activeElement;r!=t&&e.updateState(t),o!=e.dom&&e.focus();try{return n()}finally{r!=t&&e.updateState(r),o!=e.dom&&o&&o.focus()}}const jr=/[\u0590-\u08ac]/;let Fr=null,Hr=null,_r=!1;function qr(e,t,n){return Fr==t&&Hr==n?_r:(Fr=t,Hr=n,_r="up"==n||"down"==n?function(e,t,n){let r=t.selection,o="up"==n?r.$from:r.$to;return Vr(e,t,(()=>{let{node:t}=e.docView.domFromPos(o.pos,"up"==n?-1:1);for(;;){let n=e.docView.nearestDesc(t,!0);if(!n)break;if(n.node.isBlock){t=n.contentDOM||n.dom;break}t=n.dom.parentNode}let r=Pr(e,o.pos,1);for(let e=t.firstChild;e;e=e.nextSibling){let t;if(1==e.nodeType)t=e.getClientRects();else{if(3!=e.nodeType)continue;t=Gn(e,0,e.nodeValue.length).getClientRects()}for(let e=0;e<t.length;e++){let o=t[e];if(o.bottom>o.top+1&&("up"==n?r.top-o.top>2*(o.bottom-r.top):o.bottom-r.bottom>2*(r.bottom-o.top)))return!1}}return!0}))}(e,t,n):function(e,t,n){let{$head:r}=t.selection;if(!r.parent.isTextblock)return!1;let o=r.parentOffset,i=!o,s=o==r.parent.content.size,a=e.domSelection();return a?jr.test(r.parent.textContent)&&a.modify?Vr(e,t,(()=>{let{focusNode:t,focusOffset:o,anchorNode:i,anchorOffset:s}=e.domSelectionRange(),l=a.caretBidiLevel;a.modify("move",n,"character");let c=r.depth?e.docView.domAfterPos(r.before()):e.dom,{focusNode:d,focusOffset:h}=e.domSelectionRange(),u=d&&!c.contains(1==d.nodeType?d:d.parentNode)||t==d&&o==h;try{a.collapse(i,s),t&&(t!=i||o!=s)&&a.extend&&a.extend(t,o)}catch(e){}return null!=l&&(a.caretBidiLevel=l),u})):"left"==n||"backward"==n?i:s:r.pos==r.start()||r.pos==r.end()}(e,t,n))}class Wr{constructor(e,t,n,r){this.parent=e,this.children=t,this.dom=n,this.contentDOM=r,this.dirty=0,n.pmViewDesc=this}matchesWidget(e){return!1}matchesMark(e){return!1}matchesNode(e,t,n){return!1}matchesHack(e){return!1}parseRule(){return null}stopEvent(e){return!1}get size(){let e=0;for(let t=0;t<this.children.length;t++)e+=this.children[t].size;return e}get border(){return 0}destroy(){this.parent=void 0,this.dom.pmViewDesc==this&&(this.dom.pmViewDesc=void 0);for(let e=0;e<this.children.length;e++)this.children[e].destroy()}posBeforeChild(e){for(let t=0,n=this.posAtStart;;t++){let r=this.children[t];if(r==e)return n;n+=r.size}}get posBefore(){return this.parent.posBeforeChild(this)}get posAtStart(){return this.parent?this.parent.posBeforeChild(this)+this.border:0}get posAfter(){return this.posBefore+this.size}get posAtEnd(){return this.posAtStart+this.size-2*this.border}localPosFromDOM(e,t,n){if(this.contentDOM&&this.contentDOM.contains(1==e.nodeType?e:e.parentNode)){if(n<0){let n,r;if(e==this.contentDOM)n=e.childNodes[t-1];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;n=e.previousSibling}for(;n&&(!(r=n.pmViewDesc)||r.parent!=this);)n=n.previousSibling;return n?this.posBeforeChild(r)+r.size:this.posAtStart}{let n,r;if(e==this.contentDOM)n=e.childNodes[t];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;n=e.nextSibling}for(;n&&(!(r=n.pmViewDesc)||r.parent!=this);)n=n.nextSibling;return n?this.posBeforeChild(r):this.posAtEnd}}let r;if(e==this.dom&&this.contentDOM)r=t>Kn(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))r=2&e.compareDocumentPosition(this.contentDOM);else if(this.dom.firstChild){if(0==t)for(let t=e;;t=t.parentNode){if(t==this.dom){r=!1;break}if(t.previousSibling)break}if(null==r&&t==e.childNodes.length)for(let t=e;;t=t.parentNode){if(t==this.dom){r=!0;break}if(t.nextSibling)break}}return(null==r?n>0:r)?this.posAtEnd:this.posAtStart}nearestDesc(e,t=!1){for(let n=!0,r=e;r;r=r.parentNode){let o,i=this.getDesc(r);if(i&&(!t||i.node)){if(!n||!(o=i.nodeDOM)||(1==o.nodeType?o.contains(1==e.nodeType?e:e.parentNode):o==e))return i;n=!1}}}getDesc(e){let t=e.pmViewDesc;for(let e=t;e;e=e.parent)if(e==this)return t}posFromDOM(e,t,n){for(let r=e;r;r=r.parentNode){let o=this.getDesc(r);if(o)return o.localPosFromDOM(e,t,n)}return-1}descAt(e){for(let t=0,n=0;t<this.children.length;t++){let r=this.children[t],o=n+r.size;if(n==e&&o!=n){for(;!r.border&&r.children.length;)for(let e=0;e<r.children.length;e++){let t=r.children[e];if(t.size){r=t;break}}return r}if(e<o)return r.descAt(e-n-r.border);n=o}}domFromPos(e,t){if(!this.contentDOM)return{node:this.dom,offset:0,atom:e+1};let n=0,r=0;for(let t=0;n<this.children.length;n++){let o=this.children[n],i=t+o.size;if(i>e||o instanceof Qr){r=e-t;break}t=i}if(r)return this.children[n].domFromPos(r-this.children[n].border,t);for(let e;n&&!(e=this.children[n-1]).size&&e instanceof Kr&&e.side>=0;n--);if(t<=0){let e,r=!0;for(;e=n?this.children[n-1]:null,e&&e.dom.parentNode!=this.contentDOM;n--,r=!1);return e&&t&&r&&!e.border&&!e.domAtom?e.domFromPos(e.size,t):{node:this.contentDOM,offset:e?Kn(e.dom)+1:0}}{let e,r=!0;for(;e=n<this.children.length?this.children[n]:null,e&&e.dom.parentNode!=this.contentDOM;n++,r=!1);return e&&r&&!e.border&&!e.domAtom?e.domFromPos(0,t):{node:this.contentDOM,offset:e?Kn(e.dom):this.contentDOM.childNodes.length}}}parseRange(e,t,n=0){if(0==this.children.length)return{node:this.contentDOM,from:e,to:t,fromOffset:0,toOffset:this.contentDOM.childNodes.length};let r=-1,o=-1;for(let i=n,s=0;;s++){let n=this.children[s],a=i+n.size;if(-1==r&&e<=a){let o=i+n.border;if(e>=o&&t<=a-n.border&&n.node&&n.contentDOM&&this.contentDOM.contains(n.contentDOM))return n.parseRange(e,t,o);e=i;for(let t=s;t>0;t--){let n=this.children[t-1];if(n.size&&n.dom.parentNode==this.contentDOM&&!n.emptyChildAt(1)){r=Kn(n.dom)+1;break}e-=n.size}-1==r&&(r=0)}if(r>-1&&(a>t||s==this.children.length-1)){t=a;for(let e=s+1;e<this.children.length;e++){let n=this.children[e];if(n.size&&n.dom.parentNode==this.contentDOM&&!n.emptyChildAt(-1)){o=Kn(n.dom);break}t+=n.size}-1==o&&(o=this.contentDOM.childNodes.length);break}i=a}return{node:this.contentDOM,from:e,to:t,fromOffset:r,toOffset:o}}emptyChildAt(e){if(this.border||!this.contentDOM||!this.children.length)return!1;let t=this.children[e<0?0:this.children.length-1];return 0==t.size||t.emptyChildAt(e)}domAfterPos(e){let{node:t,offset:n}=this.domFromPos(e,0);if(1!=t.nodeType||n==t.childNodes.length)throw new RangeError("No node after pos "+e);return t.childNodes[n]}setSelection(e,t,n,r=!1){let o=Math.min(e,t),i=Math.max(e,t);for(let s=0,a=0;s<this.children.length;s++){let l=this.children[s],c=a+l.size;if(o>a&&i<c)return l.setSelection(e-a-l.border,t-a-l.border,n,r);a=c}let s=this.domFromPos(e,e?-1:1),a=t==e?s:this.domFromPos(t,t?-1:1),l=n.root.getSelection(),c=n.domSelectionRange(),d=!1;if((hr||mr)&&e==t){let{node:e,offset:t}=s;if(3==e.nodeType){if(d=!(!t||"\n"!=e.nodeValue[t-1]),d&&t==e.nodeValue.length)for(let t,n=e;n;n=n.parentNode){if(t=n.nextSibling){"BR"==t.nodeName&&(s=a={node:t.parentNode,offset:Kn(t)+1});break}let e=n.pmViewDesc;if(e&&e.node&&e.node.isBlock)break}}else{let n=e.childNodes[t-1];d=n&&("BR"==n.nodeName||"false"==n.contentEditable)}}if(hr&&c.focusNode&&c.focusNode!=a.node&&1==c.focusNode.nodeType){let e=c.focusNode.childNodes[c.focusOffset];e&&"false"==e.contentEditable&&(r=!0)}if(!(r||d&&mr)&&Yn(s.node,s.offset,c.anchorNode,c.anchorOffset)&&Yn(a.node,a.offset,c.focusNode,c.focusOffset))return;let h=!1;if((l.extend||e==t)&&!d){l.collapse(s.node,s.offset);try{e!=t&&l.extend(a.node,a.offset),h=!0}catch(e){}}if(!h){if(e>t){let e=s;s=a,a=e}let n=document.createRange();n.setEnd(a.node,a.offset),n.setStart(s.node,s.offset),l.removeAllRanges(),l.addRange(n)}}ignoreMutation(e){return!this.contentDOM&&"selection"!=e.type}get contentLost(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}markDirty(e,t){for(let n=0,r=0;r<this.children.length;r++){let o=this.children[r],i=n+o.size;if(n==i?e<=i&&t>=n:e<i&&t>n){let r=n+o.border,s=i-o.border;if(e>=r&&t<=s)return this.dirty=e==n||t==i?2:1,void(e!=r||t!=s||!o.contentLost&&o.dom.parentNode==this.contentDOM?o.markDirty(e-r,t-r):o.dirty=3);o.dirty=o.dom!=o.contentDOM||o.dom.parentNode!=this.contentDOM||o.children.length?3:2}n=i}this.dirty=2}markParentsDirty(){let e=1;for(let t=this.parent;t;t=t.parent,e++){let n=1==e?2:1;t.dirty<n&&(t.dirty=n)}}get domAtom(){return!1}get ignoreForCoords(){return!1}get ignoreForSelection(){return!1}isText(e){return!1}}class Kr extends Wr{constructor(e,t,n,r){let o,i=t.type.toDOM;if("function"==typeof i&&(i=i(n,(()=>o?o.parent?o.parent.posBeforeChild(o):void 0:r))),!t.type.spec.raw){if(1!=i.nodeType){let e=document.createElement("span");e.appendChild(i),i=e}i.contentEditable="false",i.classList.add("ProseMirror-widget")}super(e,[],i,null),this.widget=t,this.widget=t,o=this}matchesWidget(e){return 0==this.dirty&&e.type.eq(this.widget.type)}parseRule(){return{ignore:!0}}stopEvent(e){let t=this.widget.spec.stopEvent;return!!t&&t(e)}ignoreMutation(e){return"selection"!=e.type||this.widget.spec.ignoreSelection}destroy(){this.widget.type.destroy(this.dom),super.destroy()}get domAtom(){return!0}get ignoreForSelection(){return!!this.widget.type.spec.relaxedSide}get side(){return this.widget.type.side}}class Jr extends Wr{constructor(e,t,n,r){super(e,[],t,null),this.textDOM=n,this.text=r}get size(){return this.text.length}localPosFromDOM(e,t){return e!=this.textDOM?this.posAtStart+(t?this.size:0):this.posAtStart+t}domFromPos(e){return{node:this.textDOM,offset:e}}ignoreMutation(e){return"characterData"===e.type&&e.target.nodeValue==e.oldValue}}class Ur extends Wr{constructor(e,t,n,r,o){super(e,[],n,r),this.mark=t,this.spec=o}static create(e,t,n,r){let o=r.nodeViews[t.type.name],i=o&&o(t,r,n);return i&&i.dom||(i=Tt.renderSpec(document,t.type.spec.toDOM(t,n),null,t.attrs)),new Ur(e,t,i.dom,i.contentDOM||i.dom,i)}parseRule(){return 3&this.dirty||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return 3!=this.dirty&&this.mark.eq(e)}markDirty(e,t){if(super.markDirty(e,t),0!=this.dirty){let e=this.parent;for(;!e.node;)e=e.parent;e.dirty<this.dirty&&(e.dirty=this.dirty),this.dirty=0}}slice(e,t,n){let r=Ur.create(this.parent,this.mark,!0,n),o=this.children,i=this.size;t<i&&(o=uo(o,t,i,n)),e>0&&(o=uo(o,0,e,n));for(let e=0;e<o.length;e++)o[e].parent=r;return r.children=o,r}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}}class Gr extends Wr{constructor(e,t,n,r,o,i,s,a,l){super(e,[],o,i),this.node=t,this.outerDeco=n,this.innerDeco=r,this.nodeDOM=s}static create(e,t,n,r,o,i){let s,a=o.nodeViews[t.type.name],l=a&&a(t,o,(()=>s?s.parent?s.parent.posBeforeChild(s):void 0:i),n,r),c=l&&l.dom,d=l&&l.contentDOM;if(t.isText)if(c){if(3!=c.nodeType)throw new RangeError("Text must be rendered as a DOM text node")}else c=document.createTextNode(t.text);else if(!c){let e=Tt.renderSpec(document,t.type.spec.toDOM(t),null,t.attrs);({dom:c,contentDOM:d}=e)}d||t.isText||"BR"==c.nodeName||(c.hasAttribute("contenteditable")||(c.contentEditable="false"),t.type.spec.draggable&&(c.draggable=!0));let h=c;return c=so(c,n,t),l?s=new Zr(e,t,n,r,c,d||null,h,l,o,i+1):t.isText?new Xr(e,t,n,r,c,h,o):new Gr(e,t,n,r,c,d||null,h,o,i+1)}parseRule(){if(this.node.type.spec.reparseInView)return null;let e={node:this.node.type.name,attrs:this.node.attrs};if("pre"==this.node.type.whitespace&&(e.preserveWhitespace="full"),this.contentDOM)if(this.contentLost){for(let t=this.children.length-1;t>=0;t--){let n=this.children[t];if(this.dom.contains(n.dom.parentNode)){e.contentElement=n.dom.parentNode;break}}e.contentElement||(e.getContent=()=>Me.empty)}else e.contentElement=this.contentDOM;else e.getContent=()=>this.node.content;return e}matchesNode(e,t,n){return 0==this.dirty&&e.eq(this.node)&&ao(t,this.outerDeco)&&n.eq(this.innerDeco)}get size(){return this.node.nodeSize}get border(){return this.node.isLeaf?0:1}updateChildren(e,t){let n=this.node.inlineContent,r=t,o=e.composing?this.localCompositionInfo(e,t):null,i=o&&o.pos>-1?o:null,s=o&&o.pos<0,a=new co(this,i&&i.node,e);!function(e,t,n,r){let o=t.locals(e),i=0;if(0==o.length){for(let n=0;n<e.childCount;n++){let s=e.child(n);r(s,o,t.forChild(i,s),n),i+=s.nodeSize}return}let s=0,a=[],l=null;for(let c=0;;){let d,h,u,p;for(;s<o.length&&o[s].to==i;){let e=o[s++];e.widget&&(d?(h||(h=[d])).push(e):d=e)}if(d)if(h){h.sort(ho);for(let e=0;e<h.length;e++)n(h[e],c,!!l)}else n(d,c,!!l);if(l)p=-1,u=l,l=null;else{if(!(c<e.childCount))break;p=c,u=e.child(c++)}for(let e=0;e<a.length;e++)a[e].to<=i&&a.splice(e--,1);for(;s<o.length&&o[s].from<=i&&o[s].to>i;)a.push(o[s++]);let f=i+u.nodeSize;if(u.isText){let e=f;s<o.length&&o[s].from<e&&(e=o[s].from);for(let t=0;t<a.length;t++)a[t].to<e&&(e=a[t].to);e<f&&(l=u.cut(e-i),u=u.cut(0,e-i),f=e,p=-1)}else for(;s<o.length&&o[s].to<f;)s++;r(u,u.isInline&&!u.isLeaf?a.filter((e=>!e.inline)):a.slice(),t.forChild(i,u),p),i=f}}(this.node,this.innerDeco,((t,o,i)=>{t.spec.marks?a.syncToMarks(t.spec.marks,n,e):t.type.side>=0&&!i&&a.syncToMarks(o==this.node.childCount?Ae.none:this.node.child(o).marks,n,e),a.placeWidget(t,e,r)}),((t,i,l,c)=>{let d;a.syncToMarks(t.marks,n,e),a.findNodeMatch(t,i,l,c)||s&&e.state.selection.from>r&&e.state.selection.to<r+t.nodeSize&&(d=a.findIndexWithChild(o.node))>-1&&a.updateNodeAt(t,i,l,d,e)||a.updateNextNode(t,i,l,e,c,r)||a.addNode(t,i,l,e,r),r+=t.nodeSize})),a.syncToMarks([],n,e),this.node.isTextblock&&a.addTextblockHacks(),a.destroyRest(),(a.changed||2==this.dirty)&&(i&&this.protectLocalComposition(e,i),eo(this.contentDOM,this.children,e),gr&&function(e){if("UL"==e.nodeName||"OL"==e.nodeName){let t=e.style.cssText;e.style.cssText=t+"; list-style: square !important",window.getComputedStyle(e).listStyle,e.style.cssText=t}}(this.dom))}localCompositionInfo(e,t){let{from:n,to:r}=e.state.selection;if(!(e.state.selection instanceof Tn)||n<t||r>t+this.node.content.size)return null;let o=e.input.compositionNode;if(!o||!this.dom.contains(o.parentNode))return null;if(this.node.inlineContent){let e=o.nodeValue,i=function(e,t,n,r){for(let o=0,i=0;o<e.childCount&&i<=r;){let s=e.child(o++),a=i;if(i+=s.nodeSize,!s.isText)continue;let l=s.text;for(;o<e.childCount;){let t=e.child(o++);if(i+=t.nodeSize,!t.isText)break;l+=t.text}if(i>=n){if(i>=r&&l.slice(r-t.length-a,r-a)==t)return r-t.length;let e=a<r?l.lastIndexOf(t,r-a-1):-1;if(e>=0&&e+t.length+a>=n)return a+e;if(n==r&&l.length>=r+t.length-a&&l.slice(r-a,r-a+t.length)==t)return r}}return-1}(this.node.content,e,n-t,r-t);return i<0?null:{node:o,pos:i,text:e}}return{node:o,pos:-1,text:""}}protectLocalComposition(e,{node:t,pos:n,text:r}){if(this.getDesc(t))return;let o=t;for(;o.parentNode!=this.contentDOM;o=o.parentNode){for(;o.previousSibling;)o.parentNode.removeChild(o.previousSibling);for(;o.nextSibling;)o.parentNode.removeChild(o.nextSibling);o.pmViewDesc&&(o.pmViewDesc=void 0)}let i=new Jr(this,o,t,r);e.input.compositionNodes.push(i),this.children=uo(this.children,n,n+r.length,e,i)}update(e,t,n,r){return!(3==this.dirty||!e.sameMarkup(this.node))&&(this.updateInner(e,t,n,r),!0)}updateInner(e,t,n,r){this.updateOuterDeco(t),this.node=e,this.innerDeco=n,this.contentDOM&&this.updateChildren(r,this.posAtStart),this.dirty=0}updateOuterDeco(e){if(ao(e,this.outerDeco))return;let t=1!=this.nodeDOM.nodeType,n=this.dom;this.dom=oo(this.dom,this.nodeDOM,ro(this.outerDeco,this.node,t),ro(e,this.node,t)),this.dom!=n&&(n.pmViewDesc=void 0,this.dom.pmViewDesc=this),this.outerDeco=e}selectNode(){1==this.nodeDOM.nodeType&&this.nodeDOM.classList.add("ProseMirror-selectednode"),!this.contentDOM&&this.node.type.spec.draggable||(this.dom.draggable=!0)}deselectNode(){1==this.nodeDOM.nodeType&&(this.nodeDOM.classList.remove("ProseMirror-selectednode"),!this.contentDOM&&this.node.type.spec.draggable||this.dom.removeAttribute("draggable"))}get domAtom(){return this.node.isAtom}}function Yr(e,t,n,r,o){so(r,t,e);let i=new Gr(void 0,e,t,n,r,r,r,o,0);return i.contentDOM&&i.updateChildren(o,0),i}class Xr extends Gr{constructor(e,t,n,r,o,i,s){super(e,t,n,r,o,null,i,s,0)}parseRule(){let e=this.nodeDOM.parentNode;for(;e&&e!=this.dom&&!e.pmIsDeco;)e=e.parentNode;return{skip:e||!0}}update(e,t,n,r){return!(3==this.dirty||0!=this.dirty&&!this.inParent()||!e.sameMarkup(this.node))&&(this.updateOuterDeco(t),0==this.dirty&&e.text==this.node.text||e.text==this.nodeDOM.nodeValue||(this.nodeDOM.nodeValue=e.text,r.trackWrites==this.nodeDOM&&(r.trackWrites=null)),this.node=e,this.dirty=0,!0)}inParent(){let e=this.parent.contentDOM;for(let t=this.nodeDOM;t;t=t.parentNode)if(t==e)return!0;return!1}domFromPos(e){return{node:this.nodeDOM,offset:e}}localPosFromDOM(e,t,n){return e==this.nodeDOM?this.posAtStart+Math.min(t,this.node.text.length):super.localPosFromDOM(e,t,n)}ignoreMutation(e){return"characterData"!=e.type&&"selection"!=e.type}slice(e,t,n){let r=this.node.cut(e,t),o=document.createTextNode(r.text);return new Xr(this.parent,r,this.outerDeco,this.innerDeco,o,o,n)}markDirty(e,t){super.markDirty(e,t),this.dom==this.nodeDOM||0!=e&&t!=this.nodeDOM.nodeValue.length||(this.dirty=3)}get domAtom(){return!1}isText(e){return this.node.text==e}}class Qr extends Wr{parseRule(){return{ignore:!0}}matchesHack(e){return 0==this.dirty&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return"IMG"==this.dom.nodeName}}class Zr extends Gr{constructor(e,t,n,r,o,i,s,a,l,c){super(e,t,n,r,o,i,s,l,c),this.spec=a}update(e,t,n,r){if(3==this.dirty)return!1;if(this.spec.update&&(this.node.type==e.type||this.spec.multiType)){let o=this.spec.update(e,t,n);return o&&this.updateInner(e,t,n,r),o}return!(!this.contentDOM&&!e.isLeaf)&&super.update(e,t,n,r)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(e,t,n,r){this.spec.setSelection?this.spec.setSelection(e,t,n.root):super.setSelection(e,t,n,r)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}stopEvent(e){return!!this.spec.stopEvent&&this.spec.stopEvent(e)}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}}function eo(e,t,n){let r=e.firstChild,o=!1;for(let i=0;i<t.length;i++){let s=t[i],a=s.dom;if(a.parentNode==e){for(;a!=r;)r=lo(r),o=!0;r=r.nextSibling}else o=!0,e.insertBefore(a,r);if(s instanceof Ur){let t=r?r.previousSibling:e.lastChild;eo(s.contentDOM,s.children,n),r=t?t.nextSibling:e.firstChild}}for(;r;)r=lo(r),o=!0;o&&n.trackWrites==e&&(n.trackWrites=null)}const to=function(e){e&&(this.nodeName=e)};to.prototype=Object.create(null);const no=[new to];function ro(e,t,n){if(0==e.length)return no;let r=n?no[0]:new to,o=[r];for(let i=0;i<e.length;i++){let s=e[i].type.attrs;if(s){s.nodeName&&o.push(r=new to(s.nodeName));for(let e in s){let i=s[e];null!=i&&(n&&1==o.length&&o.push(r=new to(t.isInline?"span":"div")),"class"==e?r.class=(r.class?r.class+" ":"")+i:"style"==e?r.style=(r.style?r.style+";":"")+i:"nodeName"!=e&&(r[e]=i))}}}return o}function oo(e,t,n,r){if(n==no&&r==no)return t;let o=t;for(let t=0;t<r.length;t++){let i=r[t],s=n[t];if(t){let t;s&&s.nodeName==i.nodeName&&o!=e&&(t=o.parentNode)&&t.nodeName.toLowerCase()==i.nodeName||(t=document.createElement(i.nodeName),t.pmIsDeco=!0,t.appendChild(o),s=no[0]),o=t}io(o,s||no[0],i)}return o}function io(e,t,n){for(let r in t)"class"==r||"style"==r||"nodeName"==r||r in n||e.removeAttribute(r);for(let r in n)"class"!=r&&"style"!=r&&"nodeName"!=r&&n[r]!=t[r]&&e.setAttribute(r,n[r]);if(t.class!=n.class){let r=t.class?t.class.split(" ").filter(Boolean):[],o=n.class?n.class.split(" ").filter(Boolean):[];for(let t=0;t<r.length;t++)-1==o.indexOf(r[t])&&e.classList.remove(r[t]);for(let t=0;t<o.length;t++)-1==r.indexOf(o[t])&&e.classList.add(o[t]);0==e.classList.length&&e.removeAttribute("class")}if(t.style!=n.style){if(t.style){let n,r=/\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g;for(;n=r.exec(t.style);)e.style.removeProperty(n[1])}n.style&&(e.style.cssText+=n.style)}}function so(e,t,n){return oo(e,e,no,ro(t,n,1!=e.nodeType))}function ao(e,t){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(!e[n].type.eq(t[n].type))return!1;return!0}function lo(e){let t=e.nextSibling;return e.parentNode.removeChild(e),t}class co{constructor(e,t,n){this.lock=t,this.view=n,this.index=0,this.stack=[],this.changed=!1,this.top=e,this.preMatch=function(e,t){let n=t,r=n.children.length,o=e.childCount,i=new Map,s=[];e:for(;o>0;){let a;for(;;)if(r){let e=n.children[r-1];if(!(e instanceof Ur)){a=e,r--;break}n=e,r=e.children.length}else{if(n==t)break e;r=n.parent.children.indexOf(n),n=n.parent}let l=a.node;if(l){if(l!=e.child(o-1))break;--o,i.set(a,o),s.push(a)}}return{index:o,matched:i,matches:s.reverse()}}(e.node.content,e)}destroyBetween(e,t){if(e!=t){for(let n=e;n<t;n++)this.top.children[n].destroy();this.top.children.splice(e,t-e),this.changed=!0}}destroyRest(){this.destroyBetween(this.index,this.top.children.length)}syncToMarks(e,t,n){let r=0,o=this.stack.length>>1,i=Math.min(o,e.length);for(;r<i&&(r==o-1?this.top:this.stack[r+1<<1]).matchesMark(e[r])&&!1!==e[r].type.spec.spanning;)r++;for(;r<o;)this.destroyRest(),this.top.dirty=0,this.index=this.stack.pop(),this.top=this.stack.pop(),o--;for(;o<e.length;){this.stack.push(this.top,this.index+1);let r=-1;for(let t=this.index;t<Math.min(this.index+3,this.top.children.length);t++){let n=this.top.children[t];if(n.matchesMark(e[o])&&!this.isLocked(n.dom)){r=t;break}}if(r>-1)r>this.index&&(this.changed=!0,this.destroyBetween(this.index,r)),this.top=this.top.children[this.index];else{let r=Ur.create(this.top,e[o],t,n);this.top.children.splice(this.index,0,r),this.top=r,this.changed=!0}this.index=0,o++}}findNodeMatch(e,t,n,r){let o,i=-1;if(r>=this.preMatch.index&&(o=this.preMatch.matches[r-this.preMatch.index]).parent==this.top&&o.matchesNode(e,t,n))i=this.top.children.indexOf(o,this.index);else for(let r=this.index,o=Math.min(this.top.children.length,r+5);r<o;r++){let o=this.top.children[r];if(o.matchesNode(e,t,n)&&!this.preMatch.matched.has(o)){i=r;break}}return!(i<0)&&(this.destroyBetween(this.index,i),this.index++,!0)}updateNodeAt(e,t,n,r,o){let i=this.top.children[r];return 3==i.dirty&&i.dom==i.contentDOM&&(i.dirty=2),!!i.update(e,t,n,o)&&(this.destroyBetween(this.index,r),this.index++,!0)}findIndexWithChild(e){for(;;){let t=e.parentNode;if(!t)return-1;if(t==this.top.contentDOM){let t=e.pmViewDesc;if(t)for(let e=this.index;e<this.top.children.length;e++)if(this.top.children[e]==t)return e;return-1}e=t}}updateNextNode(e,t,n,r,o,i){for(let s=this.index;s<this.top.children.length;s++){let a=this.top.children[s];if(a instanceof Gr){let l=this.preMatch.matched.get(a);if(null!=l&&l!=o)return!1;let c,d=a.dom,h=this.isLocked(d)&&!(e.isText&&a.node&&a.node.isText&&a.nodeDOM.nodeValue==e.text&&3!=a.dirty&&ao(t,a.outerDeco));if(!h&&a.update(e,t,n,r))return this.destroyBetween(this.index,s),a.dom!=d&&(this.changed=!0),this.index++,!0;if(!h&&(c=this.recreateWrapper(a,e,t,n,r,i)))return this.destroyBetween(this.index,s),this.top.children[this.index]=c,c.contentDOM&&(c.dirty=2,c.updateChildren(r,i+1),c.dirty=0),this.changed=!0,this.index++,!0;break}}return!1}recreateWrapper(e,t,n,r,o,i){if(e.dirty||t.isAtom||!e.children.length||!e.node.content.eq(t.content)||!ao(n,e.outerDeco)||!r.eq(e.innerDeco))return null;let s=Gr.create(this.top,t,n,r,o,i);if(s.contentDOM){s.children=e.children,e.children=[];for(let e of s.children)e.parent=s}return e.destroy(),s}addNode(e,t,n,r,o){let i=Gr.create(this.top,e,t,n,r,o);i.contentDOM&&i.updateChildren(r,o+1),this.top.children.splice(this.index++,0,i),this.changed=!0}placeWidget(e,t,n){let r=this.index<this.top.children.length?this.top.children[this.index]:null;if(!r||!r.matchesWidget(e)||e!=r.widget&&r.widget.type.toDOM.parentNode){let r=new Kr(this.top,e,t,n);this.top.children.splice(this.index++,0,r),this.changed=!0}else this.index++}addTextblockHacks(){let e=this.top.children[this.index-1],t=this.top;for(;e instanceof Ur;)t=e,e=t.children[t.children.length-1];(!e||!(e instanceof Xr)||/\n$/.test(e.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(e.node.text))&&((mr||pr)&&e&&"false"==e.dom.contentEditable&&this.addHackNode("IMG",t),this.addHackNode("BR",this.top))}addHackNode(e,t){if(t==this.top&&this.index<t.children.length&&t.children[this.index].matchesHack(e))this.index++;else{let n=document.createElement(e);"IMG"==e&&(n.className="ProseMirror-separator",n.alt=""),"BR"==e&&(n.className="ProseMirror-trailingBreak");let r=new Qr(this.top,[],n,null);t!=this.top?t.children.push(r):t.children.splice(this.index++,0,r),this.changed=!0}}isLocked(e){return this.lock&&(e==this.lock||1==e.nodeType&&e.contains(this.lock.parentNode))}}function ho(e,t){return e.type.side-t.type.side}function uo(e,t,n,r,o){let i=[];for(let s=0,a=0;s<e.length;s++){let l=e[s],c=a,d=a+=l.size;c>=n||d<=t?i.push(l):(c<t&&i.push(l.slice(0,t-c,r)),o&&(i.push(o),o=void 0),d>n&&i.push(l.slice(n-c,l.size,r)))}return i}function po(e,t=null){let n=e.domSelectionRange(),r=e.state.doc;if(!n.focusNode)return null;let o=e.docView.nearestDesc(n.focusNode),i=o&&0==o.size,s=e.docView.posFromDOM(n.focusNode,n.focusOffset,1);if(s<0)return null;let a,l,c=r.resolve(s);if(tr(n)){for(a=s;o&&!o.node;)o=o.parent;let e=o.node;if(o&&e.isAtom&&En.isSelectable(e)&&o.parent&&(!e.isInline||!function(e,t,n){for(let r=0==t,o=t==Zn(e);r||o;){if(e==n)return!0;let t=Kn(e);if(!(e=e.parentNode))return!1;r=r&&0==t,o=o&&t==Zn(e)}}(n.focusNode,n.focusOffset,o.dom))){let e=o.posBefore;l=new En(s==e?c:r.resolve(e))}}else{if(n instanceof e.dom.ownerDocument.defaultView.Selection&&n.rangeCount>1){let t=s,o=s;for(let r=0;r<n.rangeCount;r++){let i=n.getRangeAt(r);t=Math.min(t,e.docView.posFromDOM(i.startContainer,i.startOffset,1)),o=Math.max(o,e.docView.posFromDOM(i.endContainer,i.endOffset,-1))}if(t<0)return null;[a,s]=o==e.state.selection.anchor?[o,t]:[t,o],c=r.resolve(s)}else a=e.docView.posFromDOM(n.anchorNode,n.anchorOffset,1);if(a<0)return null}let d=r.resolve(a);if(!l){l=ko(e,d,c,"pointer"==t||e.state.selection.head<c.pos&&!i?1:-1)}return l}function fo(e){return e.editable?e.hasFocus():No(e)&&document.activeElement&&document.activeElement.contains(e.dom)}function mo(e,t=!1){let n=e.state.selection;if(xo(e,n),fo(e)){if(!t&&e.input.mouseDown&&e.input.mouseDown.allowDefault&&pr){let t=e.domSelectionRange(),n=e.domObserver.currentSelection;if(t.anchorNode&&n.anchorNode&&Yn(t.anchorNode,t.anchorOffset,n.anchorNode,n.anchorOffset))return e.input.mouseDown.delayedSelectionSync=!0,void e.domObserver.setCurSelection()}if(e.domObserver.disconnectSelection(),e.cursorWrapper)!function(e){let t=e.domSelection(),n=document.createRange();if(!t)return;let r=e.cursorWrapper.dom,o="IMG"==r.nodeName;o?n.setStart(r.parentNode,Kn(r)+1):n.setStart(r,0);n.collapse(!0),t.removeAllRanges(),t.addRange(n),!o&&!e.state.selection.visible&&cr&&dr<=11&&(r.disabled=!0,r.disabled=!1)}(e);else{let r,o,{anchor:i,head:s}=n;!go||n instanceof Tn||(n.$from.parent.inlineContent||(r=yo(e,n.from)),n.empty||n.$from.parent.inlineContent||(o=yo(e,n.to))),e.docView.setSelection(i,s,e,t),go&&(r&&bo(r),o&&bo(o)),n.visible?e.dom.classList.remove("ProseMirror-hideselection"):(e.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&function(e){let t=e.dom.ownerDocument;t.removeEventListener("selectionchange",e.input.hideSelectionGuard);let n=e.domSelectionRange(),r=n.anchorNode,o=n.anchorOffset;t.addEventListener("selectionchange",e.input.hideSelectionGuard=()=>{n.anchorNode==r&&n.anchorOffset==o||(t.removeEventListener("selectionchange",e.input.hideSelectionGuard),setTimeout((()=>{fo(e)&&!e.state.selection.visible||e.dom.classList.remove("ProseMirror-hideselection")}),20))})}(e))}e.domObserver.setCurSelection(),e.domObserver.connectSelection()}}const go=mr||pr&&fr<63;function yo(e,t){let{node:n,offset:r}=e.docView.domFromPos(t,0),o=r<n.childNodes.length?n.childNodes[r]:null,i=r?n.childNodes[r-1]:null;if(mr&&o&&"false"==o.contentEditable)return vo(o);if(!(o&&"false"!=o.contentEditable||i&&"false"!=i.contentEditable)){if(o)return vo(o);if(i)return vo(i)}}function vo(e){return e.contentEditable="true",mr&&e.draggable&&(e.draggable=!1,e.wasDraggable=!0),e}function bo(e){e.contentEditable="false",e.wasDraggable&&(e.draggable=!0,e.wasDraggable=null)}function xo(e,t){if(t instanceof En){let n=e.docView.descAt(t.from);n!=e.lastSelectedViewDesc&&(wo(e),n&&n.selectNode(),e.lastSelectedViewDesc=n)}else wo(e)}function wo(e){e.lastSelectedViewDesc&&(e.lastSelectedViewDesc.parent&&e.lastSelectedViewDesc.deselectNode(),e.lastSelectedViewDesc=void 0)}function ko(e,t,n,r){return e.someProp("createSelectionBetween",(r=>r(e,t,n)))||Tn.between(t,n,r)}function Co(e){return!(e.editable&&!e.hasFocus())&&No(e)}function No(e){let t=e.domSelectionRange();if(!t.anchorNode)return!1;try{return e.dom.contains(3==t.anchorNode.nodeType?t.anchorNode.parentNode:t.anchorNode)&&(e.editable||e.dom.contains(3==t.focusNode.nodeType?t.focusNode.parentNode:t.focusNode))}catch(e){return!1}}function So(e,t){let{$anchor:n,$head:r}=e.selection,o=t>0?n.max(r):n.min(r),i=o.parent.inlineContent?o.depth?e.doc.resolve(t>0?o.after():o.before()):null:o;return i&&Cn.findFrom(i,t)}function Mo(e,t){return e.dispatch(e.state.tr.setSelection(t).scrollIntoView()),!0}function To(e,t,n){let r=e.state.selection;if(!(r instanceof Tn)){if(r instanceof En&&r.node.isInline)return Mo(e,new Tn(t>0?r.$to:r.$from));{let n=So(e.state,t);return!!n&&Mo(e,n)}}if(n.indexOf("s")>-1){let{$head:n}=r,o=n.textOffset?null:t<0?n.nodeBefore:n.nodeAfter;if(!o||o.isText||!o.isLeaf)return!1;let i=e.state.doc.resolve(n.pos+o.nodeSize*(t<0?-1:1));return Mo(e,new Tn(r.$anchor,i))}if(!r.empty)return!1;if(e.endOfTextblock(t>0?"forward":"backward")){let n=So(e.state,t);return!!(n&&n instanceof En)&&Mo(e,n)}if(!(yr&&n.indexOf("m")>-1)){let n,o=r.$head,i=o.textOffset?null:t<0?o.nodeBefore:o.nodeAfter;if(!i||i.isText)return!1;let s=t<0?o.pos-i.nodeSize:o.pos;return!!(i.isAtom||(n=e.docView.descAt(s))&&!n.contentDOM)&&(En.isSelectable(i)?Mo(e,new En(t<0?e.state.doc.resolve(o.pos-i.nodeSize):o)):!!xr&&Mo(e,new Tn(e.state.doc.resolve(t<0?s:s+i.nodeSize))))}}function Oo(e){return 3==e.nodeType?e.nodeValue.length:e.childNodes.length}function Eo(e,t){let n=e.pmViewDesc;return n&&0==n.size&&(t<0||e.nextSibling||"BR"!=e.nodeName)}function Ao(e,t){return t<0?function(e){let t=e.domSelectionRange(),n=t.focusNode,r=t.focusOffset;if(!n)return;let o,i,s=!1;hr&&1==n.nodeType&&r<Oo(n)&&Eo(n.childNodes[r],-1)&&(s=!0);for(;;)if(r>0){if(1!=n.nodeType)break;{let e=n.childNodes[r-1];if(Eo(e,-1))o=n,i=--r;else{if(3!=e.nodeType)break;n=e,r=n.nodeValue.length}}}else{if(Do(n))break;{let t=n.previousSibling;for(;t&&Eo(t,-1);)o=n.parentNode,i=Kn(t),t=t.previousSibling;if(t)n=t,r=Oo(n);else{if(n=n.parentNode,n==e.dom)break;r=0}}}s?Ro(e,n,r):o&&Ro(e,o,i)}(e):function(e){let t=e.domSelectionRange(),n=t.focusNode,r=t.focusOffset;if(!n)return;let o,i,s=Oo(n);for(;;)if(r<s){if(1!=n.nodeType)break;if(!Eo(n.childNodes[r],1))break;o=n,i=++r}else{if(Do(n))break;{let t=n.nextSibling;for(;t&&Eo(t,1);)o=t.parentNode,i=Kn(t)+1,t=t.nextSibling;if(t)n=t,r=0,s=Oo(n);else{if(n=n.parentNode,n==e.dom)break;r=s=0}}}o&&Ro(e,o,i)}(e)}function Do(e){let t=e.pmViewDesc;return t&&t.node&&t.node.isBlock}function Ro(e,t,n){if(3!=t.nodeType){let e,r;(r=function(e,t){for(;e&&t==e.childNodes.length&&!er(e);)t=Kn(e)+1,e=e.parentNode;for(;e&&t<e.childNodes.length;){let n=e.childNodes[t];if(3==n.nodeType)return n;if(1==n.nodeType&&"false"==n.contentEditable)break;e=n,t=0}}(t,n))?(t=r,n=0):(e=function(e,t){for(;e&&!t&&!er(e);)t=Kn(e),e=e.parentNode;for(;e&&t;){let n=e.childNodes[t-1];if(3==n.nodeType)return n;if(1==n.nodeType&&"false"==n.contentEditable)break;t=(e=n).childNodes.length}}(t,n))&&(t=e,n=e.nodeValue.length)}let r=e.domSelection();if(!r)return;if(tr(r)){let e=document.createRange();e.setEnd(t,n),e.setStart(t,n),r.removeAllRanges(),r.addRange(e)}else r.extend&&r.extend(t,n);e.domObserver.setCurSelection();let{state:o}=e;setTimeout((()=>{e.state==o&&mo(e)}),50)}function Lo(e,t){let n=e.state.doc.resolve(t);if(!pr&&!vr&&n.parent.inlineContent){let r=e.coordsAtPos(t);if(t>n.start()){let n=e.coordsAtPos(t-1),o=(n.top+n.bottom)/2;if(o>r.top&&o<r.bottom&&Math.abs(n.left-r.left)>1)return n.left<r.left?"ltr":"rtl"}if(t<n.end()){let n=e.coordsAtPos(t+1),o=(n.top+n.bottom)/2;if(o>r.top&&o<r.bottom&&Math.abs(n.left-r.left)>1)return n.left>r.left?"ltr":"rtl"}}return"rtl"==getComputedStyle(e.dom).direction?"rtl":"ltr"}function Io(e,t,n){let r=e.state.selection;if(r instanceof Tn&&!r.empty||n.indexOf("s")>-1)return!1;if(yr&&n.indexOf("m")>-1)return!1;let{$from:o,$to:i}=r;if(!o.parent.inlineContent||e.endOfTextblock(t<0?"up":"down")){let n=So(e.state,t);if(n&&n instanceof En)return Mo(e,n)}if(!o.parent.inlineContent){let n=t<0?o:i,s=r instanceof Dn?Cn.near(n,t):Cn.findFrom(n,t);return!!s&&Mo(e,s)}return!1}function zo(e,t){if(!(e.state.selection instanceof Tn))return!0;let{$head:n,$anchor:r,empty:o}=e.state.selection;if(!n.sameParent(r))return!0;if(!o)return!1;if(e.endOfTextblock(t>0?"forward":"backward"))return!0;let i=!n.textOffset&&(t<0?n.nodeBefore:n.nodeAfter);if(i&&!i.isText){let r=e.state.tr;return t<0?r.delete(n.pos-i.nodeSize,n.pos):r.delete(n.pos,n.pos+i.nodeSize),e.dispatch(r),!0}return!1}function Po(e,t,n){e.domObserver.stop(),t.contentEditable=n,e.domObserver.start()}function Bo(e,t){let n=t.keyCode,r=function(e){let t="";return e.ctrlKey&&(t+="c"),e.metaKey&&(t+="m"),e.altKey&&(t+="a"),e.shiftKey&&(t+="s"),t}(t);if(8==n||yr&&72==n&&"c"==r)return zo(e,-1)||Ao(e,-1);if(46==n&&!t.shiftKey||yr&&68==n&&"c"==r)return zo(e,1)||Ao(e,1);if(13==n||27==n)return!0;if(37==n||yr&&66==n&&"c"==r){let t=37==n?"ltr"==Lo(e,e.state.selection.from)?-1:1:-1;return To(e,t,r)||Ao(e,t)}if(39==n||yr&&70==n&&"c"==r){let t=39==n?"ltr"==Lo(e,e.state.selection.from)?1:-1:1;return To(e,t,r)||Ao(e,t)}return 38==n||yr&&80==n&&"c"==r?Io(e,-1,r)||Ao(e,-1):40==n||yr&&78==n&&"c"==r?function(e){if(!mr||e.state.selection.$head.parentOffset>0)return!1;let{focusNode:t,focusOffset:n}=e.domSelectionRange();if(t&&1==t.nodeType&&0==n&&t.firstChild&&"false"==t.firstChild.contentEditable){let n=t.firstChild;Po(e,n,"true"),setTimeout((()=>Po(e,n,"false")),20)}return!1}(e)||Io(e,1,r)||Ao(e,1):r==(yr?"m":"c")&&(66==n||73==n||89==n||90==n)}function $o(e,t){e.someProp("transformCopied",(n=>{t=n(t,e)}));let n=[],{content:r,openStart:o,openEnd:i}=t;for(;o>1&&i>1&&1==r.childCount&&1==r.firstChild.childCount;){o--,i--;let e=r.firstChild;n.push(e.type.name,e.attrs!=e.type.defaultAttrs?e.attrs:null),r=e.content}let s=e.someProp("clipboardSerializer")||Tt.fromSchema(e.state.schema),a=Uo(),l=a.createElement("div");l.appendChild(s.serializeFragment(r,{document:a}));let c,d=l.firstChild,h=0;for(;d&&1==d.nodeType&&(c=Ko[d.nodeName.toLowerCase()]);){for(let e=c.length-1;e>=0;e--){let t=a.createElement(c[e]);for(;l.firstChild;)t.appendChild(l.firstChild);l.appendChild(t),h++}d=l.firstChild}return d&&1==d.nodeType&&d.setAttribute("data-pm-slice",`${o} ${i}${h?` -${h}`:""} ${JSON.stringify(n)}`),{dom:l,text:e.someProp("clipboardTextSerializer",(n=>n(t,e)))||t.content.textBetween(0,t.content.size,"\n\n"),slice:t}}function Vo(e,t,n,r,o){let i,s,a=o.parent.type.spec.code;if(!n&&!t)return null;let l=t&&(r||a||!n);if(l){if(e.someProp("transformPastedText",(n=>{t=n(t,a||r,e)})),a)return t?new Re(Me.from(e.state.schema.text(t.replace(/\r\n?/g,"\n"))),0,0):Re.empty;let n=e.someProp("clipboardTextParser",(n=>n(t,o,r,e)));if(n)s=n;else{let n=o.marks(),{schema:r}=e.state,s=Tt.fromSchema(r);i=document.createElement("div"),t.split(/(?:\r\n?|\n)+/).forEach((e=>{let t=i.appendChild(document.createElement("p"));e&&t.appendChild(s.serializeNode(r.text(e,n)))}))}}else e.someProp("transformPastedHTML",(t=>{n=t(n,e)})),i=function(e){let t=/^(\s*<meta [^>]*>)*/.exec(e);t&&(e=e.slice(t[0].length));let n,r=Uo().createElement("div"),o=/<([a-z][^>\s]+)/i.exec(e);(n=o&&Ko[o[1].toLowerCase()])&&(e=n.map((e=>"<"+e+">")).join("")+e+n.map((e=>"</"+e+">")).reverse().join(""));if(r.innerHTML=function(e){let t=window.trustedTypes;if(!t)return e;Go||(Go=t.defaultPolicy||t.createPolicy("ProseMirrorClipboard",{createHTML:e=>e}));return Go.createHTML(e)}(e),n)for(let e=0;e<n.length;e++)r=r.querySelector(n[e])||r;return r}(n),xr&&function(e){let t=e.querySelectorAll(pr?"span:not([class]):not([style])":"span.Apple-converted-space");for(let n=0;n<t.length;n++){let r=t[n];1==r.childNodes.length&&" "==r.textContent&&r.parentNode&&r.parentNode.replaceChild(e.ownerDocument.createTextNode(" "),r)}}(i);let c=i&&i.querySelector("[data-pm-slice]"),d=c&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(c.getAttribute("data-pm-slice")||"");if(d&&d[3])for(let e=+d[3];e>0;e--){let e=i.firstChild;for(;e&&1!=e.nodeType;)e=e.nextSibling;if(!e)break;i=e}if(!s){let t=e.someProp("clipboardParser")||e.someProp("domParser")||yt.fromSchema(e.state.schema);s=t.parseSlice(i,{preserveWhitespace:!(!l&&!d),context:o,ruleFromNode:e=>"BR"!=e.nodeName||e.nextSibling||!e.parentNode||jo.test(e.parentNode.nodeName)?null:{ignore:!0}})}if(d)s=function(e,t){if(!e.size)return e;let n,r=e.content.firstChild.type.schema;try{n=JSON.parse(t)}catch(t){return e}let{content:o,openStart:i,openEnd:s}=e;for(let e=n.length-2;e>=0;e-=2){let t=r.nodes[n[e]];if(!t||t.hasRequiredAttrs())break;o=Me.from(t.create(n[e+1],o)),i++,s++}return new Re(o,i,s)}(Wo(s,+d[1],+d[2]),d[4]);else if(s=Re.maxOpen(function(e,t){if(e.childCount<2)return e;for(let n=t.depth;n>=0;n--){let r,o=t.node(n).contentMatchAt(t.index(n)),i=[];if(e.forEach((e=>{if(!i)return;let t,n=o.findWrapping(e.type);if(!n)return i=null;if(t=i.length&&r.length&&Ho(n,r,e,i[i.length-1],0))i[i.length-1]=t;else{i.length&&(i[i.length-1]=_o(i[i.length-1],r.length));let t=Fo(e,n);i.push(t),o=o.matchType(t.type),r=n}})),i)return Me.from(i)}return e}(s.content,o),!0),s.openStart||s.openEnd){let e=0,t=0;for(let t=s.content.firstChild;e<s.openStart&&!t.type.spec.isolating;e++,t=t.firstChild);for(let e=s.content.lastChild;t<s.openEnd&&!e.type.spec.isolating;t++,e=e.lastChild);s=Wo(s,e,t)}return e.someProp("transformPasted",(t=>{s=t(s,e)})),s}const jo=/^(a|abbr|acronym|b|cite|code|del|em|i|ins|kbd|label|output|q|ruby|s|samp|span|strong|sub|sup|time|u|tt|var)$/i;function Fo(e,t,n=0){for(let r=t.length-1;r>=n;r--)e=t[r].create(null,Me.from(e));return e}function Ho(e,t,n,r,o){if(o<e.length&&o<t.length&&e[o]==t[o]){let i=Ho(e,t,n,r.lastChild,o+1);if(i)return r.copy(r.content.replaceChild(r.childCount-1,i));if(r.contentMatchAt(r.childCount).matchType(o==e.length-1?n.type:e[o+1]))return r.copy(r.content.append(Me.from(Fo(n,e,o+1))))}}function _o(e,t){if(0==t)return e;let n=e.content.replaceChild(e.childCount-1,_o(e.lastChild,t-1)),r=e.contentMatchAt(e.childCount).fillBefore(Me.empty,!0);return e.copy(n.append(r))}function qo(e,t,n,r,o,i){let s=t<0?e.firstChild:e.lastChild,a=s.content;return e.childCount>1&&(i=0),o<r-1&&(a=qo(a,t,n,r,o+1,i)),o>=n&&(a=t<0?s.contentMatchAt(0).fillBefore(a,i<=o).append(a):a.append(s.contentMatchAt(s.childCount).fillBefore(Me.empty,!0))),e.replaceChild(t<0?0:e.childCount-1,s.copy(a))}function Wo(e,t,n){return t<e.openStart&&(e=new Re(qo(e.content,-1,t,e.openStart,0,e.openEnd),t,e.openEnd)),n<e.openEnd&&(e=new Re(qo(e.content,1,n,e.openEnd,0,0),e.openStart,n)),e}const Ko={thead:["table"],tbody:["table"],tfoot:["table"],caption:["table"],colgroup:["table"],col:["table","colgroup"],tr:["table","tbody"],td:["table","tbody","tr"],th:["table","tbody","tr"]};let Jo=null;function Uo(){return Jo||(Jo=document.implementation.createHTMLDocument("title"))}let Go=null;const Yo={},Xo={},Qo={touchstart:!0,touchmove:!0};class Zo{constructor(){this.shiftKey=!1,this.mouseDown=null,this.lastKeyCode=null,this.lastKeyCodeTime=0,this.lastClick={time:0,x:0,y:0,type:"",button:0},this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastIOSEnter=0,this.lastIOSEnterFallbackTimeout=-1,this.lastFocus=0,this.lastTouch=0,this.lastChromeDelete=0,this.composing=!1,this.compositionNode=null,this.composingTimeout=-1,this.compositionNodes=[],this.compositionEndedAt=-2e8,this.compositionID=1,this.compositionPendingChanges=0,this.domChangeCount=0,this.eventHandlers=Object.create(null),this.hideSelectionGuard=null}}function ei(e,t){e.input.lastSelectionOrigin=t,e.input.lastSelectionTime=Date.now()}function ti(e){e.someProp("handleDOMEvents",(t=>{for(let n in t)e.input.eventHandlers[n]||e.dom.addEventListener(n,e.input.eventHandlers[n]=t=>ni(e,t))}))}function ni(e,t){return e.someProp("handleDOMEvents",(n=>{let r=n[t.type];return!!r&&(r(e,t)||t.defaultPrevented)}))}function ri(e,t){if(!t.bubbles)return!0;if(t.defaultPrevented)return!1;for(let n=t.target;n!=e.dom;n=n.parentNode)if(!n||11==n.nodeType||n.pmViewDesc&&n.pmViewDesc.stopEvent(t))return!1;return!0}function oi(e){return{left:e.clientX,top:e.clientY}}function ii(e,t,n,r,o){if(-1==r)return!1;let i=e.state.doc.resolve(r);for(let r=i.depth+1;r>0;r--)if(e.someProp(t,(t=>r>i.depth?t(e,n,i.nodeAfter,i.before(r),o,!0):t(e,n,i.node(r),i.before(r),o,!1))))return!0;return!1}function si(e,t,n){if(e.focused||e.focus(),e.state.selection.eq(t))return;let r=e.state.tr.setSelection(t);r.setMeta("pointer",!0),e.dispatch(r)}function ai(e,t,n,r,o){return ii(e,"handleClickOn",t,n,r)||e.someProp("handleClick",(n=>n(e,t,r)))||(o?function(e,t){if(-1==t)return!1;let n,r,o=e.state.selection;o instanceof En&&(n=o.node);let i=e.state.doc.resolve(t);for(let e=i.depth+1;e>0;e--){let t=e>i.depth?i.nodeAfter:i.node(e);if(En.isSelectable(t)){r=n&&o.$from.depth>0&&e>=o.$from.depth&&i.before(o.$from.depth+1)==o.$from.pos?i.before(o.$from.depth):i.before(e);break}}return null!=r&&(si(e,En.create(e.state.doc,r)),!0)}(e,n):function(e,t){if(-1==t)return!1;let n=e.state.doc.resolve(t),r=n.nodeAfter;return!!(r&&r.isAtom&&En.isSelectable(r))&&(si(e,new En(n)),!0)}(e,n))}function li(e,t,n,r){return ii(e,"handleDoubleClickOn",t,n,r)||e.someProp("handleDoubleClick",(n=>n(e,t,r)))}function ci(e,t,n,r){return ii(e,"handleTripleClickOn",t,n,r)||e.someProp("handleTripleClick",(n=>n(e,t,r)))||function(e,t,n){if(0!=n.button)return!1;let r=e.state.doc;if(-1==t)return!!r.inlineContent&&(si(e,Tn.create(r,0,r.content.size)),!0);let o=r.resolve(t);for(let t=o.depth+1;t>0;t--){let n=t>o.depth?o.nodeAfter:o.node(t),i=o.before(t);if(n.inlineContent)si(e,Tn.create(r,i+1,i+1+n.content.size));else{if(!En.isSelectable(n))continue;si(e,En.create(r,i))}return!0}}(e,n,r)}function di(e){return vi(e)}Xo.keydown=(e,t)=>{let n=t;if(e.input.shiftKey=16==n.keyCode||n.shiftKey,!pi(e,n)&&(e.input.lastKeyCode=n.keyCode,e.input.lastKeyCodeTime=Date.now(),!br||!pr||13!=n.keyCode))if(229!=n.keyCode&&e.domObserver.forceFlush(),!gr||13!=n.keyCode||n.ctrlKey||n.altKey||n.metaKey)e.someProp("handleKeyDown",(t=>t(e,n)))||Bo(e,n)?n.preventDefault():ei(e,"key");else{let t=Date.now();e.input.lastIOSEnter=t,e.input.lastIOSEnterFallbackTimeout=setTimeout((()=>{e.input.lastIOSEnter==t&&(e.someProp("handleKeyDown",(t=>t(e,nr(13,"Enter")))),e.input.lastIOSEnter=0)}),200)}},Xo.keyup=(e,t)=>{16==t.keyCode&&(e.input.shiftKey=!1)},Xo.keypress=(e,t)=>{let n=t;if(pi(e,n)||!n.charCode||n.ctrlKey&&!n.altKey||yr&&n.metaKey)return;if(e.someProp("handleKeyPress",(t=>t(e,n))))return void n.preventDefault();let r=e.state.selection;if(!(r instanceof Tn&&r.$from.sameParent(r.$to))){let t=String.fromCharCode(n.charCode),o=()=>e.state.tr.insertText(t).scrollIntoView();/[\r\n]/.test(t)||e.someProp("handleTextInput",(n=>n(e,r.$from.pos,r.$to.pos,t,o)))||e.dispatch(o()),n.preventDefault()}};const hi=yr?"metaKey":"ctrlKey";Yo.mousedown=(e,t)=>{let n=t;e.input.shiftKey=n.shiftKey;let r=di(e),o=Date.now(),i="singleClick";o-e.input.lastClick.time<500&&function(e,t){let n=t.x-e.clientX,r=t.y-e.clientY;return n*n+r*r<100}(n,e.input.lastClick)&&!n[hi]&&e.input.lastClick.button==n.button&&("singleClick"==e.input.lastClick.type?i="doubleClick":"doubleClick"==e.input.lastClick.type&&(i="tripleClick")),e.input.lastClick={time:o,x:n.clientX,y:n.clientY,type:i,button:n.button};let s=e.posAtCoords(oi(n));s&&("singleClick"==i?(e.input.mouseDown&&e.input.mouseDown.done(),e.input.mouseDown=new ui(e,s,n,!!r)):("doubleClick"==i?li:ci)(e,s.pos,s.inside,n)?n.preventDefault():ei(e,"pointer"))};class ui{constructor(e,t,n,r){let o,i;if(this.view=e,this.pos=t,this.event=n,this.flushed=r,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=e.state.doc,this.selectNode=!!n[hi],this.allowDefault=n.shiftKey,t.inside>-1)o=e.state.doc.nodeAt(t.inside),i=t.inside;else{let n=e.state.doc.resolve(t.pos);o=n.parent,i=n.depth?n.before():0}const s=r?null:n.target,a=s?e.docView.nearestDesc(s,!0):null;this.target=a&&1==a.dom.nodeType?a.dom:null;let{selection:l}=e.state;(0==n.button&&o.type.spec.draggable&&!1!==o.type.spec.selectable||l instanceof En&&l.from<=i&&l.to>i)&&(this.mightDrag={node:o,pos:i,addAttr:!(!this.target||this.target.draggable),setUneditable:!(!this.target||!hr||this.target.hasAttribute("contentEditable"))}),this.target&&this.mightDrag&&(this.mightDrag.addAttr||this.mightDrag.setUneditable)&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&(this.target.draggable=!0),this.mightDrag.setUneditable&&setTimeout((()=>{this.view.input.mouseDown==this&&this.target.setAttribute("contentEditable","false")}),20),this.view.domObserver.start()),e.root.addEventListener("mouseup",this.up=this.up.bind(this)),e.root.addEventListener("mousemove",this.move=this.move.bind(this)),ei(e,"pointer")}done(){this.view.root.removeEventListener("mouseup",this.up),this.view.root.removeEventListener("mousemove",this.move),this.mightDrag&&this.target&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&this.target.removeAttribute("draggable"),this.mightDrag.setUneditable&&this.target.removeAttribute("contentEditable"),this.view.domObserver.start()),this.delayedSelectionSync&&setTimeout((()=>mo(this.view))),this.view.input.mouseDown=null}up(e){if(this.done(),!this.view.dom.contains(e.target))return;let t=this.pos;this.view.state.doc!=this.startDoc&&(t=this.view.posAtCoords(oi(e))),this.updateAllowDefault(e),this.allowDefault||!t?ei(this.view,"pointer"):ai(this.view,t.pos,t.inside,e,this.selectNode)?e.preventDefault():0==e.button&&(this.flushed||mr&&this.mightDrag&&!this.mightDrag.node.isAtom||pr&&!this.view.state.selection.visible&&Math.min(Math.abs(t.pos-this.view.state.selection.from),Math.abs(t.pos-this.view.state.selection.to))<=2)?(si(this.view,Cn.near(this.view.state.doc.resolve(t.pos))),e.preventDefault()):ei(this.view,"pointer")}move(e){this.updateAllowDefault(e),ei(this.view,"pointer"),0==e.buttons&&this.done()}updateAllowDefault(e){!this.allowDefault&&(Math.abs(this.event.x-e.clientX)>4||Math.abs(this.event.y-e.clientY)>4)&&(this.allowDefault=!0)}}function pi(e,t){return!!e.composing||!!(mr&&Math.abs(t.timeStamp-e.input.compositionEndedAt)<500)&&(e.input.compositionEndedAt=-2e8,!0)}Yo.touchstart=e=>{e.input.lastTouch=Date.now(),di(e),ei(e,"pointer")},Yo.touchmove=e=>{e.input.lastTouch=Date.now(),ei(e,"pointer")},Yo.contextmenu=e=>di(e);const fi=br?5e3:-1;function mi(e,t){clearTimeout(e.input.composingTimeout),t>-1&&(e.input.composingTimeout=setTimeout((()=>vi(e)),t))}function gi(e){for(e.composing&&(e.input.composing=!1,e.input.compositionEndedAt=function(){let e=document.createEvent("Event");return e.initEvent("event",!0,!0),e.timeStamp}());e.input.compositionNodes.length>0;)e.input.compositionNodes.pop().markParentsDirty()}function yi(e){let t=e.domSelectionRange();if(!t.focusNode)return null;let n=function(e,t){for(;;){if(3==e.nodeType&&t)return e;if(1==e.nodeType&&t>0){if("false"==e.contentEditable)return null;t=Zn(e=e.childNodes[t-1])}else{if(!e.parentNode||er(e))return null;t=Kn(e),e=e.parentNode}}}(t.focusNode,t.focusOffset),r=function(e,t){for(;;){if(3==e.nodeType&&t<e.nodeValue.length)return e;if(1==e.nodeType&&t<e.childNodes.length){if("false"==e.contentEditable)return null;e=e.childNodes[t],t=0}else{if(!e.parentNode||er(e))return null;t=Kn(e)+1,e=e.parentNode}}}(t.focusNode,t.focusOffset);if(n&&r&&n!=r){let t=r.pmViewDesc,o=e.domObserver.lastChangedTextNode;if(n==o||r==o)return o;if(!t||!t.isText(r.nodeValue))return r;if(e.input.compositionNode==r){let e=n.pmViewDesc;if(e&&e.isText(n.nodeValue))return r}}return n||r}function vi(e,t=!1){if(!(br&&e.domObserver.flushingSoon>=0)){if(e.domObserver.forceFlush(),gi(e),t||e.docView&&e.docView.dirty){let n=po(e),r=e.state.selection;return n&&!n.eq(r)?e.dispatch(e.state.tr.setSelection(n)):!e.markCursor&&!t||r.$from.node(r.$from.sharedDepth(r.to)).inlineContent?e.updateState(e.state):e.dispatch(e.state.tr.deleteSelection()),!0}return!1}}Xo.compositionstart=Xo.compositionupdate=e=>{if(!e.composing){e.domObserver.flush();let{state:t}=e,n=t.selection.$to;if(t.selection instanceof Tn&&(t.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some((e=>!1===e.type.spec.inclusive))))e.markCursor=e.state.storedMarks||n.marks(),vi(e,!0),e.markCursor=null;else if(vi(e,!t.selection.empty),hr&&t.selection.empty&&n.parentOffset&&!n.textOffset&&n.nodeBefore.marks.length){let t=e.domSelectionRange();for(let n=t.focusNode,r=t.focusOffset;n&&1==n.nodeType&&0!=r;){let t=r<0?n.lastChild:n.childNodes[r-1];if(!t)break;if(3==t.nodeType){let n=e.domSelection();n&&n.collapse(t,t.nodeValue.length);break}n=t,r=-1}}e.input.composing=!0}mi(e,fi)},Xo.compositionend=(e,t)=>{e.composing&&(e.input.composing=!1,e.input.compositionEndedAt=t.timeStamp,e.input.compositionPendingChanges=e.domObserver.pendingRecords().length?e.input.compositionID:0,e.input.compositionNode=null,e.input.compositionPendingChanges&&Promise.resolve().then((()=>e.domObserver.flush())),e.input.compositionID++,mi(e,20))};const bi=cr&&dr<15||gr&&wr<604;function xi(e,t,n,r,o){let i=Vo(e,t,n,r,e.state.selection.$from);if(e.someProp("handlePaste",(t=>t(e,o,i||Re.empty))))return!0;if(!i)return!1;let s=function(e){return 0==e.openStart&&0==e.openEnd&&1==e.content.childCount?e.content.firstChild:null}(i),a=s?e.state.tr.replaceSelectionWith(s,r):e.state.tr.replaceSelection(i);return e.dispatch(a.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function wi(e){let t=e.getData("text/plain")||e.getData("Text");if(t)return t;let n=e.getData("text/uri-list");return n?n.replace(/\r?\n/g," "):""}Yo.copy=Xo.cut=(e,t)=>{let n=t,r=e.state.selection,o="cut"==n.type;if(r.empty)return;let i=bi?null:n.clipboardData,s=r.content(),{dom:a,text:l}=$o(e,s);i?(n.preventDefault(),i.clearData(),i.setData("text/html",a.innerHTML),i.setData("text/plain",l)):function(e,t){if(!e.dom.parentNode)return;let n=e.dom.parentNode.appendChild(document.createElement("div"));n.appendChild(t),n.style.cssText="position: fixed; left: -10000px; top: 10px";let r=getSelection(),o=document.createRange();o.selectNodeContents(t),e.dom.blur(),r.removeAllRanges(),r.addRange(o),setTimeout((()=>{n.parentNode&&n.parentNode.removeChild(n),e.focus()}),50)}(e,a),o&&e.dispatch(e.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))},Xo.paste=(e,t)=>{let n=t;if(e.composing&&!br)return;let r=bi?null:n.clipboardData,o=e.input.shiftKey&&45!=e.input.lastKeyCode;r&&xi(e,wi(r),r.getData("text/html"),o,n)?n.preventDefault():function(e,t){if(!e.dom.parentNode)return;let n=e.input.shiftKey||e.state.selection.$from.parent.type.spec.code,r=e.dom.parentNode.appendChild(document.createElement(n?"textarea":"div"));n||(r.contentEditable="true"),r.style.cssText="position: fixed; left: -10000px; top: 10px",r.focus();let o=e.input.shiftKey&&45!=e.input.lastKeyCode;setTimeout((()=>{e.focus(),r.parentNode&&r.parentNode.removeChild(r),n?xi(e,r.value,null,o,t):xi(e,r.textContent,r.innerHTML,o,t)}),50)}(e,n)};class ki{constructor(e,t,n){this.slice=e,this.move=t,this.node=n}}const Ci=yr?"altKey":"ctrlKey";function Ni(e,t){let n=e.someProp("dragCopies",(e=>!e(t)));return null!=n?n:!t[Ci]}Yo.dragstart=(e,t)=>{let n=t,r=e.input.mouseDown;if(r&&r.done(),!n.dataTransfer)return;let o,i=e.state.selection,s=i.empty?null:e.posAtCoords(oi(n));if(s&&s.pos>=i.from&&s.pos<=(i instanceof En?i.to-1:i.to));else if(r&&r.mightDrag)o=En.create(e.state.doc,r.mightDrag.pos);else if(n.target&&1==n.target.nodeType){let t=e.docView.nearestDesc(n.target,!0);t&&t.node.type.spec.draggable&&t!=e.docView&&(o=En.create(e.state.doc,t.posBefore))}let a=(o||e.state.selection).content(),{dom:l,text:c,slice:d}=$o(e,a);(!n.dataTransfer.files.length||!pr||fr>120)&&n.dataTransfer.clearData(),n.dataTransfer.setData(bi?"Text":"text/html",l.innerHTML),n.dataTransfer.effectAllowed="copyMove",bi||n.dataTransfer.setData("text/plain",c),e.dragging=new ki(d,Ni(e,n),o)},Yo.dragend=e=>{let t=e.dragging;window.setTimeout((()=>{e.dragging==t&&(e.dragging=null)}),50)},Xo.dragover=Xo.dragenter=(e,t)=>t.preventDefault(),Xo.drop=(e,t)=>{let n=t,r=e.dragging;if(e.dragging=null,!n.dataTransfer)return;let o=e.posAtCoords(oi(n));if(!o)return;let i=e.state.doc.resolve(o.pos),s=r&&r.slice;s?e.someProp("transformPasted",(t=>{s=t(s,e)})):s=Vo(e,wi(n.dataTransfer),bi?null:n.dataTransfer.getData("text/html"),!1,i);let a=!(!r||!Ni(e,n));if(e.someProp("handleDrop",(t=>t(e,n,s||Re.empty,a))))return void n.preventDefault();if(!s)return;n.preventDefault();let l=s?an(e.state.doc,i.pos,s):i.pos;null==l&&(l=i.pos);let c=e.state.tr;if(a){let{node:e}=r;e?e.replace(c):c.deleteSelection()}let d=c.mapping.map(l),h=0==s.openStart&&0==s.openEnd&&1==s.content.childCount,u=c.doc;if(h?c.replaceRangeWith(d,d,s.content.firstChild):c.replaceRange(d,d,s),c.doc.eq(u))return;let p=c.doc.resolve(d);if(h&&En.isSelectable(s.content.firstChild)&&p.nodeAfter&&p.nodeAfter.sameMarkup(s.content.firstChild))c.setSelection(new En(p));else{let t=c.mapping.map(l);c.mapping.maps[c.mapping.maps.length-1].forEach(((e,n,r,o)=>t=o)),c.setSelection(ko(e,p,c.doc.resolve(t)))}e.focus(),e.dispatch(c.setMeta("uiEvent","drop"))},Yo.focus=e=>{e.input.lastFocus=Date.now(),e.focused||(e.domObserver.stop(),e.dom.classList.add("ProseMirror-focused"),e.domObserver.start(),e.focused=!0,setTimeout((()=>{e.docView&&e.hasFocus()&&!e.domObserver.currentSelection.eq(e.domSelectionRange())&&mo(e)}),20))},Yo.blur=(e,t)=>{let n=t;e.focused&&(e.domObserver.stop(),e.dom.classList.remove("ProseMirror-focused"),e.domObserver.start(),n.relatedTarget&&e.dom.contains(n.relatedTarget)&&e.domObserver.currentSelection.clear(),e.focused=!1)},Yo.beforeinput=(e,t)=>{if(pr&&br&&"deleteContentBackward"==t.inputType){e.domObserver.flushSoon();let{domChangeCount:t}=e.input;setTimeout((()=>{if(e.input.domChangeCount!=t)return;if(e.dom.blur(),e.focus(),e.someProp("handleKeyDown",(t=>t(e,nr(8,"Backspace")))))return;let{$cursor:n}=e.state.selection;n&&n.pos>0&&e.dispatch(e.state.tr.delete(n.pos-1,n.pos).scrollIntoView())}),50)}};for(let e in Xo)Yo[e]=Xo[e];function Si(e,t){if(e==t)return!0;for(let n in e)if(e[n]!==t[n])return!1;for(let n in t)if(!(n in e))return!1;return!0}class Mi{constructor(e,t){this.toDOM=e,this.spec=t||Di,this.side=this.spec.side||0}map(e,t,n,r){let{pos:o,deleted:i}=e.mapResult(t.from+r,this.side<0?-1:1);return i?null:new Ei(o-n,o-n,this)}valid(){return!0}eq(e){return this==e||e instanceof Mi&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&Si(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class Ti{constructor(e,t){this.attrs=e,this.spec=t||Di}map(e,t,n,r){let o=e.map(t.from+r,this.spec.inclusiveStart?-1:1)-n,i=e.map(t.to+r,this.spec.inclusiveEnd?1:-1)-n;return o>=i?null:new Ei(o,i,this)}valid(e,t){return t.from<t.to}eq(e){return this==e||e instanceof Ti&&Si(this.attrs,e.attrs)&&Si(this.spec,e.spec)}static is(e){return e.type instanceof Ti}destroy(){}}class Oi{constructor(e,t){this.attrs=e,this.spec=t||Di}map(e,t,n,r){let o=e.mapResult(t.from+r,1);if(o.deleted)return null;let i=e.mapResult(t.to+r,-1);return i.deleted||i.pos<=o.pos?null:new Ei(o.pos-n,i.pos-n,this)}valid(e,t){let n,{index:r,offset:o}=e.content.findIndex(t.from);return o==t.from&&!(n=e.child(r)).isText&&o+n.nodeSize==t.to}eq(e){return this==e||e instanceof Oi&&Si(this.attrs,e.attrs)&&Si(this.spec,e.spec)}destroy(){}}class Ei{constructor(e,t,n){this.from=e,this.to=t,this.type=n}copy(e,t){return new Ei(e,t,this.type)}eq(e,t=0){return this.type.eq(e.type)&&this.from+t==e.from&&this.to+t==e.to}map(e,t,n){return this.type.map(e,this,t,n)}static widget(e,t,n){return new Ei(e,e,new Mi(t,n))}static inline(e,t,n,r){return new Ei(e,t,new Ti(n,r))}static node(e,t,n,r){return new Ei(e,t,new Oi(n,r))}get spec(){return this.type.spec}get inline(){return this.type instanceof Ti}get widget(){return this.type instanceof Mi}}const Ai=[],Di={};class Ri{constructor(e,t){this.local=e.length?e:Ai,this.children=t.length?t:Ai}static create(e,t){return t.length?$i(t,e,0,Di):Li}find(e,t,n){let r=[];return this.findInner(null==e?0:e,null==t?1e9:t,r,0,n),r}findInner(e,t,n,r,o){for(let i=0;i<this.local.length;i++){let s=this.local[i];s.from<=t&&s.to>=e&&(!o||o(s.spec))&&n.push(s.copy(s.from+r,s.to+r))}for(let i=0;i<this.children.length;i+=3)if(this.children[i]<t&&this.children[i+1]>e){let s=this.children[i]+1;this.children[i+2].findInner(e-s,t-s,n,r+s,o)}}map(e,t,n){return this==Li||0==e.maps.length?this:this.mapInner(e,t,0,0,n||Di)}mapInner(e,t,n,r,o){let i;for(let s=0;s<this.local.length;s++){let a=this.local[s].map(e,n,r);a&&a.type.valid(t,a)?(i||(i=[])).push(a):o.onRemove&&o.onRemove(this.local[s].spec)}return this.children.length?function(e,t,n,r,o,i,s){let a=e.slice();for(let e=0,t=i;e<n.maps.length;e++){let r=0;n.maps[e].forEach(((e,n,o,i)=>{let s=i-o-(n-e);for(let o=0;o<a.length;o+=3){let i=a[o+1];if(i<0||e>i+t-r)continue;let l=a[o]+t-r;n>=l?a[o+1]=e<=l?-2:-1:e>=t&&s&&(a[o]+=s,a[o+1]+=s)}r+=s})),t=n.maps[e].map(t,-1)}let l=!1;for(let t=0;t<a.length;t+=3)if(a[t+1]<0){if(-2==a[t+1]){l=!0,a[t+1]=-1;continue}let c=n.map(e[t]+i),d=c-o;if(d<0||d>=r.content.size){l=!0;continue}let h=n.map(e[t+1]+i,-1)-o,{index:u,offset:p}=r.content.findIndex(d),f=r.maybeChild(u);if(f&&p==d&&p+f.nodeSize==h){let r=a[t+2].mapInner(n,f,c+1,e[t]+i+1,s);r!=Li?(a[t]=d,a[t+1]=h,a[t+2]=r):(a[t+1]=-2,l=!0)}else l=!0}if(l){let l=function(e,t,n,r,o,i,s){function a(e,t){for(let i=0;i<e.local.length;i++){let a=e.local[i].map(r,o,t);a?n.push(a):s.onRemove&&s.onRemove(e.local[i].spec)}for(let n=0;n<e.children.length;n+=3)a(e.children[n+2],e.children[n]+t+1)}for(let n=0;n<e.length;n+=3)-1==e[n+1]&&a(e[n+2],t[n]+i+1);return n}(a,e,t,n,o,i,s),c=$i(l,r,0,s);t=c.local;for(let e=0;e<a.length;e+=3)a[e+1]<0&&(a.splice(e,3),e-=3);for(let e=0,t=0;e<c.children.length;e+=3){let n=c.children[e];for(;t<a.length&&a[t]<n;)t+=3;a.splice(t,0,c.children[e],c.children[e+1],c.children[e+2])}}return new Ri(t.sort(Vi),a)}(this.children,i||[],e,t,n,r,o):i?new Ri(i.sort(Vi),Ai):Li}add(e,t){return t.length?this==Li?Ri.create(e,t):this.addInner(e,t,0):this}addInner(e,t,n){let r,o=0;e.forEach(((e,i)=>{let s,a=i+n;if(s=Pi(t,e,a)){for(r||(r=this.children.slice());o<r.length&&r[o]<i;)o+=3;r[o]==i?r[o+2]=r[o+2].addInner(e,s,a+1):r.splice(o,0,i,i+e.nodeSize,$i(s,e,a+1,Di)),o+=3}}));let i=zi(o?Bi(t):t,-n);for(let t=0;t<i.length;t++)i[t].type.valid(e,i[t])||i.splice(t--,1);return new Ri(i.length?this.local.concat(i).sort(Vi):this.local,r||this.children)}remove(e){return 0==e.length||this==Li?this:this.removeInner(e,0)}removeInner(e,t){let n=this.children,r=this.local;for(let r=0;r<n.length;r+=3){let o,i=n[r]+t,s=n[r+1]+t;for(let t,n=0;n<e.length;n++)(t=e[n])&&t.from>i&&t.to<s&&(e[n]=null,(o||(o=[])).push(t));if(!o)continue;n==this.children&&(n=this.children.slice());let a=n[r+2].removeInner(o,i+1);a!=Li?n[r+2]=a:(n.splice(r,3),r-=3)}if(r.length)for(let n,o=0;o<e.length;o++)if(n=e[o])for(let e=0;e<r.length;e++)r[e].eq(n,t)&&(r==this.local&&(r=this.local.slice()),r.splice(e--,1));return n==this.children&&r==this.local?this:r.length||n.length?new Ri(r,n):Li}forChild(e,t){if(this==Li)return this;if(t.isLeaf)return Ri.empty;let n,r;for(let t=0;t<this.children.length;t+=3)if(this.children[t]>=e){this.children[t]==e&&(n=this.children[t+2]);break}let o=e+1,i=o+t.content.size;for(let e=0;e<this.local.length;e++){let t=this.local[e];if(t.from<i&&t.to>o&&t.type instanceof Ti){let e=Math.max(o,t.from)-o,n=Math.min(i,t.to)-o;e<n&&(r||(r=[])).push(t.copy(e,n))}}if(r){let e=new Ri(r.sort(Vi),Ai);return n?new Ii([e,n]):e}return n||Li}eq(e){if(this==e)return!0;if(!(e instanceof Ri)||this.local.length!=e.local.length||this.children.length!=e.children.length)return!1;for(let t=0;t<this.local.length;t++)if(!this.local[t].eq(e.local[t]))return!1;for(let t=0;t<this.children.length;t+=3)if(this.children[t]!=e.children[t]||this.children[t+1]!=e.children[t+1]||!this.children[t+2].eq(e.children[t+2]))return!1;return!0}locals(e){return ji(this.localsInner(e))}localsInner(e){if(this==Li)return Ai;if(e.inlineContent||!this.local.some(Ti.is))return this.local;let t=[];for(let e=0;e<this.local.length;e++)this.local[e].type instanceof Ti||t.push(this.local[e]);return t}forEachSet(e){e(this)}}Ri.empty=new Ri([],[]),Ri.removeOverlap=ji;const Li=Ri.empty;class Ii{constructor(e){this.members=e}map(e,t){const n=this.members.map((n=>n.map(e,t,Di)));return Ii.from(n)}forChild(e,t){if(t.isLeaf)return Ri.empty;let n=[];for(let r=0;r<this.members.length;r++){let o=this.members[r].forChild(e,t);o!=Li&&(o instanceof Ii?n=n.concat(o.members):n.push(o))}return Ii.from(n)}eq(e){if(!(e instanceof Ii)||e.members.length!=this.members.length)return!1;for(let t=0;t<this.members.length;t++)if(!this.members[t].eq(e.members[t]))return!1;return!0}locals(e){let t,n=!0;for(let r=0;r<this.members.length;r++){let o=this.members[r].localsInner(e);if(o.length)if(t){n&&(t=t.slice(),n=!1);for(let e=0;e<o.length;e++)t.push(o[e])}else t=o}return t?ji(n?t:t.sort(Vi)):Ai}static from(e){switch(e.length){case 0:return Li;case 1:return e[0];default:return new Ii(e.every((e=>e instanceof Ri))?e:e.reduce(((e,t)=>e.concat(t instanceof Ri?t:t.members)),[]))}}forEachSet(e){for(let t=0;t<this.members.length;t++)this.members[t].forEachSet(e)}}function zi(e,t){if(!t||!e.length)return e;let n=[];for(let r=0;r<e.length;r++){let o=e[r];n.push(new Ei(o.from+t,o.to+t,o.type))}return n}function Pi(e,t,n){if(t.isLeaf)return null;let r=n+t.nodeSize,o=null;for(let t,i=0;i<e.length;i++)(t=e[i])&&t.from>n&&t.to<r&&((o||(o=[])).push(t),e[i]=null);return o}function Bi(e){let t=[];for(let n=0;n<e.length;n++)null!=e[n]&&t.push(e[n]);return t}function $i(e,t,n,r){let o=[],i=!1;t.forEach(((t,s)=>{let a=Pi(e,t,s+n);if(a){i=!0;let e=$i(a,t,n+s+1,r);e!=Li&&o.push(s,s+t.nodeSize,e)}}));let s=zi(i?Bi(e):e,-n).sort(Vi);for(let e=0;e<s.length;e++)s[e].type.valid(t,s[e])||(r.onRemove&&r.onRemove(s[e].spec),s.splice(e--,1));return s.length||o.length?new Ri(s,o):Li}function Vi(e,t){return e.from-t.from||e.to-t.to}function ji(e){let t=e;for(let n=0;n<t.length-1;n++){let r=t[n];if(r.from!=r.to)for(let o=n+1;o<t.length;o++){let i=t[o];if(i.from!=r.from){i.from<r.to&&(t==e&&(t=e.slice()),t[n]=r.copy(r.from,i.from),Fi(t,o,r.copy(i.from,r.to)));break}i.to!=r.to&&(t==e&&(t=e.slice()),t[o]=i.copy(i.from,r.to),Fi(t,o+1,i.copy(r.to,i.to)))}}return t}function Fi(e,t,n){for(;t<e.length&&Vi(n,e[t])>0;)t++;e.splice(t,0,n)}function Hi(e){let t=[];return e.someProp("decorations",(n=>{let r=n(e.state);r&&r!=Li&&t.push(r)})),e.cursorWrapper&&t.push(Ri.create(e.state.doc,[e.cursorWrapper.deco])),Ii.from(t)}const _i={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},qi=cr&&dr<=11;class Wi{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}set(e){this.anchorNode=e.anchorNode,this.anchorOffset=e.anchorOffset,this.focusNode=e.focusNode,this.focusOffset=e.focusOffset}clear(){this.anchorNode=this.focusNode=null}eq(e){return e.anchorNode==this.anchorNode&&e.anchorOffset==this.anchorOffset&&e.focusNode==this.focusNode&&e.focusOffset==this.focusOffset}}class Ki{constructor(e,t){this.view=e,this.handleDOMChange=t,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new Wi,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.lastChangedTextNode=null,this.observer=window.MutationObserver&&new window.MutationObserver((e=>{for(let t=0;t<e.length;t++)this.queue.push(e[t]);cr&&dr<=11&&e.some((e=>"childList"==e.type&&e.removedNodes.length||"characterData"==e.type&&e.oldValue.length>e.target.nodeValue.length))?this.flushSoon():this.flush()})),qi&&(this.onCharData=e=>{this.queue.push({target:e.target,type:"characterData",oldValue:e.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this)}flushSoon(){this.flushingSoon<0&&(this.flushingSoon=window.setTimeout((()=>{this.flushingSoon=-1,this.flush()}),20))}forceFlush(){this.flushingSoon>-1&&(window.clearTimeout(this.flushingSoon),this.flushingSoon=-1,this.flush())}start(){this.observer&&(this.observer.takeRecords(),this.observer.observe(this.view.dom,_i)),this.onCharData&&this.view.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.connectSelection()}stop(){if(this.observer){let e=this.observer.takeRecords();if(e.length){for(let t=0;t<e.length;t++)this.queue.push(e[t]);window.setTimeout((()=>this.flush()),20)}this.observer.disconnect()}this.onCharData&&this.view.dom.removeEventListener("DOMCharacterDataModified",this.onCharData),this.disconnectSelection()}connectSelection(){this.view.dom.ownerDocument.addEventListener("selectionchange",this.onSelectionChange)}disconnectSelection(){this.view.dom.ownerDocument.removeEventListener("selectionchange",this.onSelectionChange)}suppressSelectionUpdates(){this.suppressingSelectionUpdates=!0,setTimeout((()=>this.suppressingSelectionUpdates=!1),50)}onSelectionChange(){if(Co(this.view)){if(this.suppressingSelectionUpdates)return mo(this.view);if(cr&&dr<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&Yn(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset))return this.flushSoon()}this.flush()}}setCurSelection(){this.currentSelection.set(this.view.domSelectionRange())}ignoreSelectionChange(e){if(!e.focusNode)return!0;let t,n=new Set;for(let t=e.focusNode;t;t=Jn(t))n.add(t);for(let r=e.anchorNode;r;r=Jn(r))if(n.has(r)){t=r;break}let r=t&&this.view.docView.nearestDesc(t);return r&&r.ignoreMutation({type:"selection",target:3==t.nodeType?t.parentNode:t})?(this.setCurSelection(),!0):void 0}pendingRecords(){if(this.observer)for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}flush(){let{view:e}=this;if(!e.docView||this.flushingSoon>-1)return;let t=this.pendingRecords();t.length&&(this.queue=[]);let n=e.domSelectionRange(),r=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(n)&&Co(e)&&!this.ignoreSelectionChange(n),o=-1,i=-1,s=!1,a=[];if(e.editable)for(let e=0;e<t.length;e++){let n=this.registerMutation(t[e],a);n&&(o=o<0?n.from:Math.min(n.from,o),i=i<0?n.to:Math.max(n.to,i),n.typeOver&&(s=!0))}if(hr&&a.length){let t=a.filter((e=>"BR"==e.nodeName));if(2==t.length){let[e,n]=t;e.parentNode&&e.parentNode.parentNode==n.parentNode?n.remove():e.remove()}else{let{focusNode:n}=this.currentSelection;for(let r of t){let t=r.parentNode;!t||"LI"!=t.nodeName||n&&Yi(e,n)==t||r.remove()}}}let l=null;o<0&&r&&e.input.lastFocus>Date.now()-200&&Math.max(e.input.lastTouch,e.input.lastClick.time)<Date.now()-300&&tr(n)&&(l=po(e))&&l.eq(Cn.near(e.state.doc.resolve(0),1))?(e.input.lastFocus=0,mo(e),this.currentSelection.set(n),e.scrollToSelection()):(o>-1||r)&&(o>-1&&(e.docView.markDirty(o,i),function(e){if(Ji.has(e))return;if(Ji.set(e,null),-1!==["normal","nowrap","pre-line"].indexOf(getComputedStyle(e.dom).whiteSpace)){if(e.requiresGeckoHackNode=hr,Ui)return;console.warn("ProseMirror expects the CSS white-space property to be set, preferably to 'pre-wrap'. It is recommended to load style/prosemirror.css from the prosemirror-view package."),Ui=!0}}(e)),this.handleDOMChange(o,i,s,a),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(n)||mo(e),this.currentSelection.set(n))}registerMutation(e,t){if(t.indexOf(e.target)>-1)return null;let n=this.view.docView.nearestDesc(e.target);if("attributes"==e.type&&(n==this.view.docView||"contenteditable"==e.attributeName||"style"==e.attributeName&&!e.oldValue&&!e.target.getAttribute("style")))return null;if(!n||n.ignoreMutation(e))return null;if("childList"==e.type){for(let n=0;n<e.addedNodes.length;n++){let r=e.addedNodes[n];t.push(r),3==r.nodeType&&(this.lastChangedTextNode=r)}if(n.contentDOM&&n.contentDOM!=n.dom&&!n.contentDOM.contains(e.target))return{from:n.posBefore,to:n.posAfter};let r=e.previousSibling,o=e.nextSibling;if(cr&&dr<=11&&e.addedNodes.length)for(let t=0;t<e.addedNodes.length;t++){let{previousSibling:n,nextSibling:i}=e.addedNodes[t];(!n||Array.prototype.indexOf.call(e.addedNodes,n)<0)&&(r=n),(!i||Array.prototype.indexOf.call(e.addedNodes,i)<0)&&(o=i)}let i=r&&r.parentNode==e.target?Kn(r)+1:0,s=n.localPosFromDOM(e.target,i,-1),a=o&&o.parentNode==e.target?Kn(o):e.target.childNodes.length;return{from:s,to:n.localPosFromDOM(e.target,a,1)}}return"attributes"==e.type?{from:n.posAtStart-n.border,to:n.posAtEnd+n.border}:(this.lastChangedTextNode=e.target,{from:n.posAtStart,to:n.posAtEnd,typeOver:e.target.nodeValue==e.oldValue})}}let Ji=new WeakMap,Ui=!1;function Gi(e,t){let n=t.startContainer,r=t.startOffset,o=t.endContainer,i=t.endOffset,s=e.domAtPos(e.state.selection.anchor);return Yn(s.node,s.offset,o,i)&&([n,r,o,i]=[o,i,n,r]),{anchorNode:n,anchorOffset:r,focusNode:o,focusOffset:i}}function Yi(e,t){for(let n=t.parentNode;n&&n!=e.dom;n=n.parentNode){let t=e.docView.nearestDesc(n,!0);if(t&&t.node.isBlock)return n}return null}function Xi(e){let t=e.pmViewDesc;if(t)return t.parseRule();if("BR"==e.nodeName&&e.parentNode){if(mr&&/^(ul|ol)$/i.test(e.parentNode.nodeName)){let e=document.createElement("div");return e.appendChild(document.createElement("li")),{skip:e}}if(e.parentNode.lastChild==e||mr&&/^(tr|table)$/i.test(e.parentNode.nodeName))return{ignore:!0}}else if("IMG"==e.nodeName&&e.getAttribute("mark-placeholder"))return{ignore:!0};return null}const Qi=/^(a|abbr|acronym|b|bd[io]|big|br|button|cite|code|data(list)?|del|dfn|em|i|img|ins|kbd|label|map|mark|meter|output|q|ruby|s|samp|small|span|strong|su[bp]|time|u|tt|var)$/i;function Zi(e,t,n,r,o){let i=e.input.compositionPendingChanges||(e.composing?e.input.compositionID:0);if(e.input.compositionPendingChanges=0,t<0){let t=e.input.lastSelectionTime>Date.now()-50?e.input.lastSelectionOrigin:null,n=po(e,t);if(n&&!e.state.selection.eq(n)){if(pr&&br&&13===e.input.lastKeyCode&&Date.now()-100<e.input.lastKeyCodeTime&&e.someProp("handleKeyDown",(t=>t(e,nr(13,"Enter")))))return;let r=e.state.tr.setSelection(n);"pointer"==t?r.setMeta("pointer",!0):"key"==t&&r.scrollIntoView(),i&&r.setMeta("composition",i),e.dispatch(r)}return}let s=e.state.doc.resolve(t),a=s.sharedDepth(n);t=s.before(a+1),n=e.state.doc.resolve(n).after(a+1);let l,c,d=e.state.selection,h=function(e,t,n){let r,{node:o,fromOffset:i,toOffset:s,from:a,to:l}=e.docView.parseRange(t,n),c=e.domSelectionRange(),d=c.anchorNode;if(d&&e.dom.contains(1==d.nodeType?d:d.parentNode)&&(r=[{node:d,offset:c.anchorOffset}],tr(c)||r.push({node:c.focusNode,offset:c.focusOffset})),pr&&8===e.input.lastKeyCode)for(let e=s;e>i;e--){let t=o.childNodes[e-1],n=t.pmViewDesc;if("BR"==t.nodeName&&!n){s=e;break}if(!n||n.size)break}let h=e.state.doc,u=e.someProp("domParser")||yt.fromSchema(e.state.schema),p=h.resolve(a),f=null,m=u.parse(o,{topNode:p.parent,topMatch:p.parent.contentMatchAt(p.index()),topOpen:!0,from:i,to:s,preserveWhitespace:"pre"!=p.parent.type.whitespace||"full",findPositions:r,ruleFromNode:Xi,context:p});if(r&&null!=r[0].pos){let e=r[0].pos,t=r[1]&&r[1].pos;null==t&&(t=e),f={anchor:e+a,head:t+a}}return{doc:m,sel:f,from:a,to:l}}(e,t,n),u=e.state.doc,p=u.slice(h.from,h.to);8===e.input.lastKeyCode&&Date.now()-100<e.input.lastKeyCodeTime?(l=e.state.selection.to,c="end"):(l=e.state.selection.from,c="start"),e.input.lastKeyCode=null;let f=function(e,t,n,r,o){let i=e.findDiffStart(t,n);if(null==i)return null;let{a:s,b:a}=e.findDiffEnd(t,n+e.size,n+t.size);if("end"==o){r-=s+Math.max(0,i-Math.min(s,a))-i}if(s<i&&e.size<t.size){let e=r<=i&&r>=s?i-r:0;i-=e,i&&i<t.size&&ns(t.textBetween(i-1,i+1))&&(i+=e?1:-1),a=i+(a-s),s=i}else if(a<i){let t=r<=i&&r>=a?i-r:0;i-=t,i&&i<e.size&&ns(e.textBetween(i-1,i+1))&&(i+=t?1:-1),s=i+(s-a),a=i}return{start:i,endA:s,endB:a}}(p.content,h.doc.content,h.from,l,c);if(f&&e.input.domChangeCount++,(gr&&e.input.lastIOSEnter>Date.now()-225||br)&&o.some((e=>1==e.nodeType&&!Qi.test(e.nodeName)))&&(!f||f.endA>=f.endB)&&e.someProp("handleKeyDown",(t=>t(e,nr(13,"Enter")))))return void(e.input.lastIOSEnter=0);if(!f){if(!(r&&d instanceof Tn&&!d.empty&&d.$head.sameParent(d.$anchor))||e.composing||h.sel&&h.sel.anchor!=h.sel.head){if(h.sel){let t=es(e,e.state.doc,h.sel);if(t&&!t.eq(e.state.selection)){let n=e.state.tr.setSelection(t);i&&n.setMeta("composition",i),e.dispatch(n)}}return}f={start:d.from,endA:d.to,endB:d.to}}e.state.selection.from<e.state.selection.to&&f.start==f.endB&&e.state.selection instanceof Tn&&(f.start>e.state.selection.from&&f.start<=e.state.selection.from+2&&e.state.selection.from>=h.from?f.start=e.state.selection.from:f.endA<e.state.selection.to&&f.endA>=e.state.selection.to-2&&e.state.selection.to<=h.to&&(f.endB+=e.state.selection.to-f.endA,f.endA=e.state.selection.to)),cr&&dr<=11&&f.endB==f.start+1&&f.endA==f.start&&f.start>h.from&&"  "==h.doc.textBetween(f.start-h.from-1,f.start-h.from+1)&&(f.start--,f.endA--,f.endB--);let m,g=h.doc.resolveNoCache(f.start-h.from),y=h.doc.resolveNoCache(f.endB-h.from),v=u.resolve(f.start),b=g.sameParent(y)&&g.parent.inlineContent&&v.end()>=f.endA;if((gr&&e.input.lastIOSEnter>Date.now()-225&&(!b||o.some((e=>"DIV"==e.nodeName||"P"==e.nodeName)))||!b&&g.pos<h.doc.content.size&&(!g.sameParent(y)||!g.parent.inlineContent)&&!/\S/.test(h.doc.textBetween(g.pos,y.pos,"",""))&&(m=Cn.findFrom(h.doc.resolve(g.pos+1),1,!0))&&m.head>g.pos)&&e.someProp("handleKeyDown",(t=>t(e,nr(13,"Enter")))))return void(e.input.lastIOSEnter=0);if(e.state.selection.anchor>f.start&&function(e,t,n,r,o){if(n-t<=o.pos-r.pos||ts(r,!0,!1)<o.pos)return!1;let i=e.resolve(t);if(!r.parent.isTextblock){let e=i.nodeAfter;return null!=e&&n==t+e.nodeSize}if(i.parentOffset<i.parent.content.size||!i.parent.isTextblock)return!1;let s=e.resolve(ts(i,!0,!0));return!(!s.parent.isTextblock||s.pos>n||ts(s,!0,!1)<n)&&r.parent.content.cut(r.parentOffset).eq(s.parent.content)}(u,f.start,f.endA,g,y)&&e.someProp("handleKeyDown",(t=>t(e,nr(8,"Backspace")))))return void(br&&pr&&e.domObserver.suppressSelectionUpdates());pr&&f.endB==f.start&&(e.input.lastChromeDelete=Date.now()),br&&!b&&g.start()!=y.start()&&0==y.parentOffset&&g.depth==y.depth&&h.sel&&h.sel.anchor==h.sel.head&&h.sel.head==f.endA&&(f.endB-=2,y=h.doc.resolveNoCache(f.endB-h.from),setTimeout((()=>{e.someProp("handleKeyDown",(function(t){return t(e,nr(13,"Enter"))}))}),20));let x,w=f.start,k=f.endA,C=t=>{let n=t||e.state.tr.replace(w,k,h.doc.slice(f.start-h.from,f.endB-h.from));if(h.sel){let t=es(e,n.doc,h.sel);t&&!(pr&&e.composing&&t.empty&&(f.start!=f.endB||e.input.lastChromeDelete<Date.now()-100)&&(t.head==w||t.head==n.mapping.map(k)-1)||cr&&t.empty&&t.head==w)&&n.setSelection(t)}return i&&n.setMeta("composition",i),n.scrollIntoView()};if(b){if(g.pos==y.pos){cr&&dr<=11&&0==g.parentOffset&&(e.domObserver.suppressSelectionUpdates(),setTimeout((()=>mo(e)),20));let t=C(e.state.tr.delete(w,k)),n=u.resolve(f.start).marksAcross(u.resolve(f.endA));n&&t.ensureMarks(n),e.dispatch(t)}else if(f.endA==f.endB&&(x=function(e,t){let n,r,o,i=e.firstChild.marks,s=t.firstChild.marks,a=i,l=s;for(let e=0;e<s.length;e++)a=s[e].removeFromSet(a);for(let e=0;e<i.length;e++)l=i[e].removeFromSet(l);if(1==a.length&&0==l.length)r=a[0],n="add",o=e=>e.mark(r.addToSet(e.marks));else{if(0!=a.length||1!=l.length)return null;r=l[0],n="remove",o=e=>e.mark(r.removeFromSet(e.marks))}let c=[];for(let e=0;e<t.childCount;e++)c.push(o(t.child(e)));if(Me.from(c).eq(e))return{mark:r,type:n}}(g.parent.content.cut(g.parentOffset,y.parentOffset),v.parent.content.cut(v.parentOffset,f.endA-v.start())))){let t=C(e.state.tr);"add"==x.type?t.addMark(w,k,x.mark):t.removeMark(w,k,x.mark),e.dispatch(t)}else if(g.parent.child(g.index()).isText&&g.index()==y.index()-(y.textOffset?0:1)){let t=g.parent.textBetween(g.parentOffset,y.parentOffset),n=()=>C(e.state.tr.insertText(t,w,k));e.someProp("handleTextInput",(r=>r(e,w,k,t,n)))||e.dispatch(n())}}else e.dispatch(C())}function es(e,t,n){return Math.max(n.anchor,n.head)>t.content.size?null:ko(e,t.resolve(n.anchor),t.resolve(n.head))}function ts(e,t,n){let r=e.depth,o=t?e.end():e.pos;for(;r>0&&(t||e.indexAfter(r)==e.node(r).childCount);)r--,o++,t=!1;if(n){let t=e.node(r).maybeChild(e.indexAfter(r));for(;t&&!t.isLeaf;)t=t.firstChild,o++}return o}function ns(e){if(2!=e.length)return!1;let t=e.charCodeAt(0),n=e.charCodeAt(1);return t>=56320&&t<=57343&&n>=55296&&n<=56319}class rs{constructor(e,t){this._root=null,this.focused=!1,this.trackWrites=null,this.mounted=!1,this.markCursor=null,this.cursorWrapper=null,this.lastSelectedViewDesc=void 0,this.input=new Zo,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=t,this.state=t.state,this.directPlugins=t.plugins||[],this.directPlugins.forEach(cs),this.dispatch=this.dispatch.bind(this),this.dom=e&&e.mount||document.createElement("div"),e&&(e.appendChild?e.appendChild(this.dom):"function"==typeof e?e(this.dom):e.mount&&(this.mounted=!0)),this.editable=as(this),ss(this),this.nodeViews=ls(this),this.docView=Yr(this.state.doc,is(this),Hi(this),this.dom,this),this.domObserver=new Ki(this,((e,t,n,r)=>Zi(this,e,t,n,r))),this.domObserver.start(),function(e){for(let t in Yo){let n=Yo[t];e.dom.addEventListener(t,e.input.eventHandlers[t]=t=>{!ri(e,t)||ni(e,t)||!e.editable&&t.type in Xo||n(e,t)},Qo[t]?{passive:!0}:void 0)}mr&&e.dom.addEventListener("input",(()=>null)),ti(e)}(this),this.updatePluginViews()}get composing(){return this.input.composing}get props(){if(this._props.state!=this.state){let e=this._props;this._props={};for(let t in e)this._props[t]=e[t];this._props.state=this.state}return this._props}update(e){e.handleDOMEvents!=this._props.handleDOMEvents&&ti(this);let t=this._props;this._props=e,e.plugins&&(e.plugins.forEach(cs),this.directPlugins=e.plugins),this.updateStateInner(e.state,t)}setProps(e){let t={};for(let e in this._props)t[e]=this._props[e];t.state=this.state;for(let n in e)t[n]=e[n];this.update(t)}updateState(e){this.updateStateInner(e,this._props)}updateStateInner(e,t){var n;let r=this.state,o=!1,i=!1;e.storedMarks&&this.composing&&(gi(this),i=!0),this.state=e;let s=r.plugins!=e.plugins||this._props.plugins!=t.plugins;if(s||this._props.plugins!=t.plugins||this._props.nodeViews!=t.nodeViews){let e=ls(this);(function(e,t){let n=0,r=0;for(let r in e){if(e[r]!=t[r])return!0;n++}for(let e in t)r++;return n!=r})(e,this.nodeViews)&&(this.nodeViews=e,o=!0)}(s||t.handleDOMEvents!=this._props.handleDOMEvents)&&ti(this),this.editable=as(this),ss(this);let a=Hi(this),l=is(this),c=r.plugins==e.plugins||r.doc.eq(e.doc)?e.scrollToSelection>r.scrollToSelection?"to selection":"preserve":"reset",d=o||!this.docView.matchesNode(e.doc,l,a);!d&&e.selection.eq(r.selection)||(i=!0);let h="preserve"==c&&i&&null==this.dom.style.overflowAnchor&&function(e){let t,n,r=e.dom.getBoundingClientRect(),o=Math.max(0,r.top);for(let i=(r.left+r.right)/2,s=o+1;s<Math.min(innerHeight,r.bottom);s+=5){let r=e.root.elementFromPoint(i,s);if(!r||r==e.dom||!e.dom.contains(r))continue;let a=r.getBoundingClientRect();if(a.top>=o-20){t=r,n=a.top;break}}return{refDOM:t,refTop:n,stack:Mr(e.dom)}}(this);if(i){this.domObserver.stop();let t=d&&(cr||pr)&&!this.composing&&!r.selection.empty&&!e.selection.empty&&function(e,t){let n=Math.min(e.$anchor.sharedDepth(e.head),t.$anchor.sharedDepth(t.head));return e.$anchor.start(n)!=t.$anchor.start(n)}(r.selection,e.selection);if(d){let n=pr?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=yi(this)),!o&&this.docView.update(e.doc,l,a,this)||(this.docView.updateOuterDeco(l),this.docView.destroy(),this.docView=Yr(e.doc,l,a,this.dom,this)),n&&!this.trackWrites&&(t=!0)}t||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&function(e){let t=e.docView.domFromPos(e.state.selection.anchor,0),n=e.domSelectionRange();return Yn(t.node,t.offset,n.anchorNode,n.anchorOffset)}(this))?mo(this,t):(xo(this,e.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(r),(null===(n=this.dragging)||void 0===n?void 0:n.node)&&!r.doc.eq(e.doc)&&this.updateDraggedNode(this.dragging,r),"reset"==c?this.dom.scrollTop=0:"to selection"==c?this.scrollToSelection():h&&function({refDOM:e,refTop:t,stack:n}){let r=e?e.getBoundingClientRect().top:0;Tr(n,0==r?0:r-t)}(h)}scrollToSelection(){let e=this.domSelectionRange().focusNode;if(e&&this.dom.contains(1==e.nodeType?e:e.parentNode))if(this.someProp("handleScrollToSelection",(e=>e(this))));else if(this.state.selection instanceof En){let t=this.docView.domAfterPos(this.state.selection.from);1==t.nodeType&&Sr(this,t.getBoundingClientRect(),e)}else Sr(this,this.coordsAtPos(this.state.selection.head,1),e);else;}destroyPluginViews(){let e;for(;e=this.pluginViews.pop();)e.destroy&&e.destroy()}updatePluginViews(e){if(e&&e.plugins==this.state.plugins&&this.directPlugins==this.prevDirectPlugins)for(let t=0;t<this.pluginViews.length;t++){let n=this.pluginViews[t];n.update&&n.update(this,e)}else{this.prevDirectPlugins=this.directPlugins,this.destroyPluginViews();for(let e=0;e<this.directPlugins.length;e++){let t=this.directPlugins[e];t.spec.view&&this.pluginViews.push(t.spec.view(this))}for(let e=0;e<this.state.plugins.length;e++){let t=this.state.plugins[e];t.spec.view&&this.pluginViews.push(t.spec.view(this))}}}updateDraggedNode(e,t){let n=e.node,r=-1;if(this.state.doc.nodeAt(n.from)==n.node)r=n.from;else{let e=n.from+(this.state.doc.content.size-t.doc.content.size);(e>0&&this.state.doc.nodeAt(e))==n.node&&(r=e)}this.dragging=new ki(e.slice,e.move,r<0?void 0:En.create(this.state.doc,r))}someProp(e,t){let n,r=this._props&&this._props[e];if(null!=r&&(n=t?t(r):r))return n;for(let r=0;r<this.directPlugins.length;r++){let o=this.directPlugins[r].props[e];if(null!=o&&(n=t?t(o):o))return n}let o=this.state.plugins;if(o)for(let r=0;r<o.length;r++){let i=o[r].props[e];if(null!=i&&(n=t?t(i):i))return n}}hasFocus(){if(cr){let e=this.root.activeElement;if(e==this.dom)return!0;if(!e||!this.dom.contains(e))return!1;for(;e&&this.dom!=e&&this.dom.contains(e);){if("false"==e.contentEditable)return!1;e=e.parentElement}return!0}return this.root.activeElement==this.dom}focus(){this.domObserver.stop(),this.editable&&function(e){if(e.setActive)return e.setActive();if(Or)return e.focus(Or);let t=Mr(e);e.focus(null==Or?{get preventScroll(){return Or={preventScroll:!0},!0}}:void 0),Or||(Or=!1,Tr(t,0))}(this.dom),mo(this),this.domObserver.start()}get root(){let e=this._root;if(null==e)for(let e=this.dom.parentNode;e;e=e.parentNode)if(9==e.nodeType||11==e.nodeType&&e.host)return e.getSelection||(Object.getPrototypeOf(e).getSelection=()=>e.ownerDocument.getSelection()),this._root=e;return e||document}updateRoot(){this._root=null}posAtCoords(e){return Rr(this,e)}coordsAtPos(e,t=1){return Pr(this,e,t)}domAtPos(e,t=0){return this.docView.domFromPos(e,t)}nodeDOM(e){let t=this.docView.descAt(e);return t?t.nodeDOM:null}posAtDOM(e,t,n=-1){let r=this.docView.posFromDOM(e,t,n);if(null==r)throw new RangeError("DOM position not inside the editor");return r}endOfTextblock(e,t){return qr(this,t||this.state,e)}pasteHTML(e,t){return xi(this,"",e,!1,t||new ClipboardEvent("paste"))}pasteText(e,t){return xi(this,e,null,!0,t||new ClipboardEvent("paste"))}serializeForClipboard(e){return $o(this,e)}destroy(){this.docView&&(!function(e){e.domObserver.stop();for(let t in e.input.eventHandlers)e.dom.removeEventListener(t,e.input.eventHandlers[t]);clearTimeout(e.input.composingTimeout),clearTimeout(e.input.lastIOSEnterFallbackTimeout)}(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],Hi(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,Un=null)}get isDestroyed(){return null==this.docView}dispatchEvent(e){return function(e,t){ni(e,t)||!Yo[t.type]||!e.editable&&t.type in Xo||Yo[t.type](e,t)}(this,e)}domSelectionRange(){let e=this.domSelection();return e?mr&&11===this.root.nodeType&&function(e){let t=e.activeElement;for(;t&&t.shadowRoot;)t=t.shadowRoot.activeElement;return t}(this.dom.ownerDocument)==this.dom&&function(e,t){if(t.getComposedRanges){let n=t.getComposedRanges(e.root)[0];if(n)return Gi(e,n)}let n;function r(e){e.preventDefault(),e.stopImmediatePropagation(),n=e.getTargetRanges()[0]}return e.dom.addEventListener("beforeinput",r,!0),document.execCommand("indent"),e.dom.removeEventListener("beforeinput",r,!0),n?Gi(e,n):null}(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}function is(e){let t=Object.create(null);return t.class="ProseMirror",t.contenteditable=String(e.editable),e.someProp("attributes",(n=>{if("function"==typeof n&&(n=n(e.state)),n)for(let e in n)"class"==e?t.class+=" "+n[e]:"style"==e?t.style=(t.style?t.style+";":"")+n[e]:t[e]||"contenteditable"==e||"nodeName"==e||(t[e]=String(n[e]))})),t.translate||(t.translate="no"),[Ei.node(0,e.state.doc.content.size,t)]}function ss(e){if(e.markCursor){let t=document.createElement("img");t.className="ProseMirror-separator",t.setAttribute("mark-placeholder","true"),t.setAttribute("alt",""),e.cursorWrapper={dom:t,deco:Ei.widget(e.state.selection.from,t,{raw:!0,marks:e.markCursor})}}else e.cursorWrapper=null}function as(e){return!e.someProp("editable",(t=>!1===t(e.state)))}function ls(e){let t=Object.create(null);function n(e){for(let n in e)Object.prototype.hasOwnProperty.call(t,n)||(t[n]=e[n])}return e.someProp("nodeViews",n),e.someProp("markViews",n),t}function cs(e){if(e.spec.state||e.spec.filterTransaction||e.spec.appendTransaction)throw new RangeError("Plugins passed directly to the view must not have a state component")}rs.prototype.dispatch=function(e){let t=this._props.dispatchTransaction;t?t.call(this,e):this.updateState(this.state.apply(e))};for(var ds={8:"Backspace",9:"Tab",10:"Enter",12:"NumLock",13:"Enter",16:"Shift",17:"Control",18:"Alt",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",44:"PrintScreen",45:"Insert",46:"Delete",59:";",61:"=",91:"Meta",92:"Meta",106:"*",107:"+",108:",",109:"-",110:".",111:"/",144:"NumLock",145:"ScrollLock",160:"Shift",161:"Shift",162:"Control",163:"Control",164:"Alt",165:"Alt",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},hs={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},us="undefined"!=typeof navigator&&/Mac/.test(navigator.platform),ps="undefined"!=typeof navigator&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),fs=0;fs<10;fs++)ds[48+fs]=ds[96+fs]=String(fs);for(fs=1;fs<=24;fs++)ds[fs+111]="F"+fs;for(fs=65;fs<=90;fs++)ds[fs]=String.fromCharCode(fs+32),hs[fs]=String.fromCharCode(fs);for(var ms in ds)hs.hasOwnProperty(ms)||(hs[ms]=ds[ms]);const gs="undefined"!=typeof navigator&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),ys="undefined"!=typeof navigator&&/Win/.test(navigator.platform);function vs(e){let t,n,r,o,i=e.split(/-(?!$)/),s=i[i.length-1];"Space"==s&&(s=" ");for(let e=0;e<i.length-1;e++){let s=i[e];if(/^(cmd|meta|m)$/i.test(s))o=!0;else if(/^a(lt)?$/i.test(s))t=!0;else if(/^(c|ctrl|control)$/i.test(s))n=!0;else if(/^s(hift)?$/i.test(s))r=!0;else{if(!/^mod$/i.test(s))throw new Error("Unrecognized modifier name: "+s);gs?o=!0:n=!0}}return t&&(s="Alt-"+s),n&&(s="Ctrl-"+s),o&&(s="Meta-"+s),r&&(s="Shift-"+s),s}function bs(e,t,n=!0){return t.altKey&&(e="Alt-"+e),t.ctrlKey&&(e="Ctrl-"+e),t.metaKey&&(e="Meta-"+e),n&&t.shiftKey&&(e="Shift-"+e),e}function xs(e){let t=function(e){let t=Object.create(null);for(let n in e)t[vs(n)]=e[n];return t}(e);return function(e,n){let r,o=function(e){var t=!(us&&e.metaKey&&e.shiftKey&&!e.ctrlKey&&!e.altKey||ps&&e.shiftKey&&e.key&&1==e.key.length||"Unidentified"==e.key)&&e.key||(e.shiftKey?hs:ds)[e.keyCode]||e.key||"Unidentified";return"Esc"==t&&(t="Escape"),"Del"==t&&(t="Delete"),"Left"==t&&(t="ArrowLeft"),"Up"==t&&(t="ArrowUp"),"Right"==t&&(t="ArrowRight"),"Down"==t&&(t="ArrowDown"),t}(n),i=t[bs(o,n)];if(i&&i(e.state,e.dispatch,e))return!0;if(1==o.length&&" "!=o){if(n.shiftKey){let r=t[bs(o,n,!1)];if(r&&r(e.state,e.dispatch,e))return!0}if((n.altKey||n.metaKey||n.ctrlKey)&&!(ys&&n.ctrlKey&&n.altKey)&&(r=ds[n.keyCode])&&r!=o){let o=t[bs(r,n)];if(o&&o(e.state,e.dispatch,e))return!0}}return!1}}const ws=(e,t)=>!e.selection.empty&&(t&&t(e.tr.deleteSelection().scrollIntoView()),!0);function ks(e,t){let{$cursor:n}=e.selection;return!n||(t?!t.endOfTextblock("backward",e):n.parentOffset>0)?null:n}const Cs=(e,t,n)=>{let r=ks(e,n);if(!r)return!1;let o=Ts(r);if(!o){let n=r.blockRange(),o=n&&Xt(n);return null!=o&&(t&&t(e.tr.lift(n,o).scrollIntoView()),!0)}let i=o.nodeBefore;if(Bs(e,o,t,-1))return!0;if(0==r.parent.content.size&&(Ss(i,"end")||En.isSelectable(i)))for(let n=r.depth;;n--){let s=ln(e.doc,r.before(n),r.after(n),Re.empty);if(s&&s.slice.size<s.to-s.from){if(t){let n=e.tr.step(s);n.setSelection(Ss(i,"end")?Cn.findFrom(n.doc.resolve(n.mapping.map(o.pos,-1)),-1):En.create(n.doc,o.pos-i.nodeSize)),t(n.scrollIntoView())}return!0}if(1==n||r.node(n-1).childCount>1)break}return!(!i.isAtom||o.depth!=r.depth-1)&&(t&&t(e.tr.delete(o.pos-i.nodeSize,o.pos).scrollIntoView()),!0)};function Ns(e,t,n){let r=t.nodeBefore,o=t.pos-1;for(;!r.isTextblock;o--){if(r.type.spec.isolating)return!1;let e=r.lastChild;if(!e)return!1;r=e}let i=t.nodeAfter,s=t.pos+1;for(;!i.isTextblock;s++){if(i.type.spec.isolating)return!1;let e=i.firstChild;if(!e)return!1;i=e}let a=ln(e.doc,o,s,Re.empty);if(!a||a.from!=o||a instanceof Kt&&a.slice.size>=s-o)return!1;if(n){let t=e.tr.step(a);t.setSelection(Tn.create(t.doc,o)),n(t.scrollIntoView())}return!0}function Ss(e,t,n=!1){for(let r=e;r;r="start"==t?r.firstChild:r.lastChild){if(r.isTextblock)return!0;if(n&&1!=r.childCount)return!1}return!1}const Ms=(e,t,n)=>{let{$head:r,empty:o}=e.selection,i=r;if(!o)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("backward",e):r.parentOffset>0)return!1;i=Ts(r)}let s=i&&i.nodeBefore;return!(!s||!En.isSelectable(s))&&(t&&t(e.tr.setSelection(En.create(e.doc,i.pos-s.nodeSize)).scrollIntoView()),!0)};function Ts(e){if(!e.parent.type.spec.isolating)for(let t=e.depth-1;t>=0;t--){if(e.index(t)>0)return e.doc.resolve(e.before(t+1));if(e.node(t).type.spec.isolating)break}return null}function Os(e,t){let{$cursor:n}=e.selection;return!n||(t?!t.endOfTextblock("forward",e):n.parentOffset<n.parent.content.size)?null:n}const Es=(e,t,n)=>{let r=Os(e,n);if(!r)return!1;let o=Ds(r);if(!o)return!1;let i=o.nodeAfter;if(Bs(e,o,t,1))return!0;if(0==r.parent.content.size&&(Ss(i,"start")||En.isSelectable(i))){let n=ln(e.doc,r.before(),r.after(),Re.empty);if(n&&n.slice.size<n.to-n.from){if(t){let r=e.tr.step(n);r.setSelection(Ss(i,"start")?Cn.findFrom(r.doc.resolve(r.mapping.map(o.pos)),1):En.create(r.doc,r.mapping.map(o.pos))),t(r.scrollIntoView())}return!0}}return!(!i.isAtom||o.depth!=r.depth-1)&&(t&&t(e.tr.delete(o.pos,o.pos+i.nodeSize).scrollIntoView()),!0)},As=(e,t,n)=>{let{$head:r,empty:o}=e.selection,i=r;if(!o)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("forward",e):r.parentOffset<r.parent.content.size)return!1;i=Ds(r)}let s=i&&i.nodeAfter;return!(!s||!En.isSelectable(s))&&(t&&t(e.tr.setSelection(En.create(e.doc,i.pos)).scrollIntoView()),!0)};function Ds(e){if(!e.parent.type.spec.isolating)for(let t=e.depth-1;t>=0;t--){let n=e.node(t);if(e.index(t)+1<n.childCount)return e.doc.resolve(e.after(t+1));if(n.type.spec.isolating)break}return null}const Rs=(e,t)=>{let{$head:n,$anchor:r}=e.selection;return!(!n.parent.type.spec.code||!n.sameParent(r))&&(t&&t(e.tr.insertText("\n").scrollIntoView()),!0)};function Ls(e){for(let t=0;t<e.edgeCount;t++){let{type:n}=e.edge(t);if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}const Is=(e,t)=>{let n=e.selection,{$from:r,$to:o}=n;if(n instanceof Dn||r.parent.inlineContent||o.parent.inlineContent)return!1;let i=Ls(o.parent.contentMatchAt(o.indexAfter()));if(!i||!i.isTextblock)return!1;if(t){let n=(!r.parentOffset&&o.index()<o.parent.childCount?r:o).pos,s=e.tr.insert(n,i.createAndFill());s.setSelection(Tn.create(s.doc,n+1)),t(s.scrollIntoView())}return!0},zs=(e,t)=>{let{$cursor:n}=e.selection;if(!n||n.parent.content.size)return!1;if(n.depth>1&&n.after()!=n.end(-1)){let r=n.before();if(nn(e.doc,r))return t&&t(e.tr.split(r).scrollIntoView()),!0}let r=n.blockRange(),o=r&&Xt(r);return null!=o&&(t&&t(e.tr.lift(r,o).scrollIntoView()),!0)};const Ps=(e,t)=>{let{$from:n,$to:r}=e.selection;if(e.selection instanceof En&&e.selection.node.isBlock)return!(!n.parentOffset||!nn(e.doc,n.pos)||(t&&t(e.tr.split(n.pos).scrollIntoView()),0));if(!n.depth)return!1;let o,i,s=[],a=!1,l=!1;for(let e=n.depth;;e--){if(n.node(e).isBlock){a=n.end(e)==n.pos+(n.depth-e),l=n.start(e)==n.pos-(n.depth-e),i=Ls(n.node(e-1).contentMatchAt(n.indexAfter(e-1))),s.unshift(a&&i?{type:i}:null),o=e;break}if(1==e)return!1;s.unshift(null)}let c=e.tr;(e.selection instanceof Tn||e.selection instanceof Dn)&&c.deleteSelection();let d=c.mapping.map(n.pos),h=nn(c.doc,d,s.length,s);if(h||(s[0]=i?{type:i}:null,h=nn(c.doc,d,s.length,s)),!h)return!1;if(c.split(d,s.length,s),!a&&l&&n.node(o).type!=i){let e=c.mapping.map(n.before(o)),t=c.doc.resolve(e);i&&n.node(o-1).canReplaceWith(t.index(),t.index()+1,i)&&c.setNodeMarkup(c.mapping.map(n.before(o)),i)}return t&&t(c.scrollIntoView()),!0};function Bs(e,t,n,r){let o,i,s=t.nodeBefore,a=t.nodeAfter,l=s.type.spec.isolating||a.type.spec.isolating;if(!l&&function(e,t,n){let r=t.nodeBefore,o=t.nodeAfter,i=t.index();return!(!(r&&o&&r.type.compatibleContent(o.type))||(!r.content.size&&t.parent.canReplace(i-1,i)?(n&&n(e.tr.delete(t.pos-r.nodeSize,t.pos).scrollIntoView()),0):!t.parent.canReplace(i,i+1)||!o.isTextblock&&!rn(e.doc,t.pos)||(n&&n(e.tr.join(t.pos).scrollIntoView()),0)))}(e,t,n))return!0;let c=!l&&t.parent.canReplace(t.index(),t.index()+1);if(c&&(o=(i=s.contentMatchAt(s.childCount)).findWrapping(a.type))&&i.matchType(o[0]||a.type).validEnd){if(n){let r=t.pos+a.nodeSize,i=Me.empty;for(let e=o.length-1;e>=0;e--)i=Me.from(o[e].create(null,i));i=Me.from(s.copy(i));let l=e.tr.step(new Jt(t.pos-1,r,t.pos,r,new Re(i,1,0),o.length,!0)),c=l.doc.resolve(r+2*o.length);c.nodeAfter&&c.nodeAfter.type==s.type&&rn(l.doc,c.pos)&&l.join(c.pos),n(l.scrollIntoView())}return!0}let d=a.type.spec.isolating||r>0&&l?null:Cn.findFrom(t,1),h=d&&d.$from.blockRange(d.$to),u=h&&Xt(h);if(null!=u&&u>=t.depth)return n&&n(e.tr.lift(h,u).scrollIntoView()),!0;if(c&&Ss(a,"start",!0)&&Ss(s,"end")){let r=s,o=[];for(;o.push(r),!r.isTextblock;)r=r.lastChild;let i=a,l=1;for(;!i.isTextblock;i=i.firstChild)l++;if(r.canReplace(r.childCount,r.childCount,i.content)){if(n){let r=Me.empty;for(let e=o.length-1;e>=0;e--)r=Me.from(o[e].copy(r));n(e.tr.step(new Jt(t.pos-o.length,t.pos+a.nodeSize,t.pos+l,t.pos+a.nodeSize-l,new Re(r,o.length,0),0,!0)).scrollIntoView())}return!0}}return!1}function $s(e){return function(t,n){let r=t.selection,o=e<0?r.$from:r.$to,i=o.depth;for(;o.node(i).isInline;){if(!i)return!1;i--}return!!o.node(i).isTextblock&&(n&&n(t.tr.setSelection(Tn.create(t.doc,e<0?o.start(i):o.end(i)))),!0)}}const Vs=$s(-1),js=$s(1);function Fs(e,t=null){return function(n,r){let o=!1;for(let r=0;r<n.selection.ranges.length&&!o;r++){let{$from:{pos:i},$to:{pos:s}}=n.selection.ranges[r];n.doc.nodesBetween(i,s,((r,i)=>{if(o)return!1;if(r.isTextblock&&!r.hasMarkup(e,t))if(r.type==e)o=!0;else{let t=n.doc.resolve(i),r=t.index();o=t.parent.canReplaceWith(r,r+1,e)}}))}if(!o)return!1;if(r){let o=n.tr;for(let r=0;r<n.selection.ranges.length;r++){let{$from:{pos:i},$to:{pos:s}}=n.selection.ranges[r];o.setBlockType(i,s,e,t)}r(o.scrollIntoView())}return!0}}function Hs(...e){return function(t,n,r){for(let o=0;o<e.length;o++)if(e[o](t,n,r))return!0;return!1}}function _s(e,t=null){return function(n,r){let{$from:o,$to:i}=n.selection,s=o.blockRange(i);if(!s)return!1;let a=r?n.tr:null;return!!function(e,t,n,r=null){let o=!1,i=t,s=t.$from.doc;if(t.depth>=2&&t.$from.node(t.depth-1).type.compatibleContent(n)&&0==t.startIndex){if(0==t.$from.index(t.depth-1))return!1;let e=s.resolve(t.start-2);i=new Ue(e,e,t.depth),t.endIndex<t.parent.childCount&&(t=new Ue(t.$from,s.resolve(t.$to.end(t.depth)),t.depth)),o=!0}let a=Qt(i,n,r,t);if(!a)return!1;e&&function(e,t,n,r,o){let i=Me.empty;for(let e=n.length-1;e>=0;e--)i=Me.from(n[e].type.create(n[e].attrs,i));e.step(new Jt(t.start-(r?2:0),t.end,t.start,t.end,new Re(i,0,0),n.length,!0));let s=0;for(let e=0;e<n.length;e++)n[e].type==o&&(s=e+1);let a=n.length-s,l=t.start+n.length-(r?2:0),c=t.parent;for(let n=t.startIndex,r=t.endIndex,o=!0;n<r;n++,o=!1)!o&&nn(e.doc,l,a)&&(e.split(l,a),l+=2*a),l+=c.child(n).nodeSize}(e,t,a,o,n);return!0}(a,s,e,t)&&(r&&r(a.scrollIntoView()),!0)}}function qs(e){return function(t,n){let{$from:r,$to:o}=t.selection,i=r.blockRange(o,(t=>t.childCount>0&&t.firstChild.type==e));return!!i&&(!n||(r.node(i.depth-1).type==e?function(e,t,n,r){let o=e.tr,i=r.end,s=r.$to.end(r.depth);i<s&&(o.step(new Jt(i-1,s,i,s,new Re(Me.from(n.create(null,r.parent.copy())),1,0),1,!0)),r=new Ue(o.doc.resolve(r.$from.pos),o.doc.resolve(s),r.depth));const a=Xt(r);if(null==a)return!1;o.lift(r,a);let l=o.doc.resolve(o.mapping.map(i,-1)-1);rn(o.doc,l.pos)&&l.nodeBefore.type==l.nodeAfter.type&&o.join(l.pos);return t(o.scrollIntoView()),!0}(t,n,e,i):function(e,t,n){let r=e.tr,o=n.parent;for(let e=n.end,t=n.endIndex-1,i=n.startIndex;t>i;t--)e-=o.child(t).nodeSize,r.delete(e-1,e+1);let i=r.doc.resolve(n.start),s=i.nodeAfter;if(r.mapping.map(n.end)!=n.start+i.nodeAfter.nodeSize)return!1;let a=0==n.startIndex,l=n.endIndex==o.childCount,c=i.node(-1),d=i.index(-1);if(!c.canReplace(d+(a?0:1),d+1,s.content.append(l?Me.empty:Me.from(o))))return!1;let h=i.pos,u=h+s.nodeSize;return r.step(new Jt(h-(a?1:0),u+(l?1:0),h+1,u-1,new Re((a?Me.empty:Me.from(o.copy(Me.empty))).append(l?Me.empty:Me.from(o.copy(Me.empty))),a?0:1,l?0:1),a?0:1)),t(r.scrollIntoView()),!0}(t,n,i)))}}Hs(ws,Cs,Ms),Hs(ws,Es,As),Hs(Rs,Is,zs,Ps),"undefined"!=typeof navigator?/Mac|iP(hone|[oa]d)/.test(navigator.platform):"undefined"!=typeof os&&os.platform&&os.platform();var Ws=Object.defineProperty,Ks=(e,t)=>{for(var n in t)Ws(e,n,{get:t[n],enumerable:!0})};function Js(e){const{state:t,transaction:n}=e;let{selection:r}=n,{doc:o}=n,{storedMarks:i}=n;return{...t,apply:t.apply.bind(t),applyTransaction:t.applyTransaction.bind(t),plugins:t.plugins,schema:t.schema,reconfigure:t.reconfigure.bind(t),toJSON:t.toJSON.bind(t),get storedMarks(){return i},get selection(){return r},get doc(){return o},get tr(){return r=n.selection,o=n.doc,i=n.storedMarks,n}}}var Us=class{constructor(e){this.editor=e.editor,this.rawCommands=this.editor.extensionManager.commands,this.customState=e.state}get hasCustomState(){return!!this.customState}get state(){return this.customState||this.editor.state}get commands(){const{rawCommands:e,editor:t,state:n}=this,{view:r}=t,{tr:o}=n,i=this.buildProps(o);return Object.fromEntries(Object.entries(e).map((([e,t])=>[e,(...e)=>{const n=t(...e)(i);return o.getMeta("preventDispatch")||this.hasCustomState||r.dispatch(o),n}])))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(e,t=!0){const{rawCommands:n,editor:r,state:o}=this,{view:i}=r,s=[],a=!!e,l=e||o.tr,c={...Object.fromEntries(Object.entries(n).map((([e,n])=>[e,(...e)=>{const r=this.buildProps(l,t),o=n(...e)(r);return s.push(o),c}]))),run:()=>(a||!t||l.getMeta("preventDispatch")||this.hasCustomState||i.dispatch(l),s.every((e=>!0===e)))};return c}createCan(e){const{rawCommands:t,state:n}=this,r=!1,o=e||n.tr,i=this.buildProps(o,r);return{...Object.fromEntries(Object.entries(t).map((([e,t])=>[e,(...e)=>t(...e)({...i,dispatch:void 0})]))),chain:()=>this.createChain(o,r)}}buildProps(e,t=!0){const{rawCommands:n,editor:r,state:o}=this,{view:i}=r,s={tr:e,editor:r,view:i,state:Js({state:o,transaction:e}),dispatch:t?()=>{}:void 0,chain:()=>this.createChain(e,t),can:()=>this.createCan(e),get commands(){return Object.fromEntries(Object.entries(n).map((([e,t])=>[e,(...e)=>t(...e)(s)])))}};return s}},Gs=class{constructor(){this.callbacks={}}on(e,t){return this.callbacks[e]||(this.callbacks[e]=[]),this.callbacks[e].push(t),this}emit(e,...t){const n=this.callbacks[e];return n&&n.forEach((e=>e.apply(this,t))),this}off(e,t){const n=this.callbacks[e];return n&&(t?this.callbacks[e]=n.filter((e=>e!==t)):delete this.callbacks[e]),this}once(e,t){const n=(...r)=>{this.off(e,n),t.apply(this,r)};return this.on(e,n)}removeAllListeners(){this.callbacks={}}};function Ys(e,t){const n=new wn(e);return t.forEach((e=>{e.steps.forEach((e=>{n.step(e)}))})),n}var Xs=e=>{const t=e.childNodes;for(let n=t.length-1;n>=0;n-=1){const r=t[n];3===r.nodeType&&r.nodeValue&&/^(\n\s\s|\n)$/.test(r.nodeValue)?e.removeChild(r):1===r.nodeType&&Xs(r)}return e};function Qs(e){if("undefined"==typeof window)throw new Error("[tiptap error]: there is no window object available, so this function cannot be used");const t=`<body>${e}</body>`,n=(new window.DOMParser).parseFromString(t,"text/html").body;return Xs(n)}function Zs(e,t,n){if(e instanceof Ye||e instanceof Me)return e;n={slice:!0,parseOptions:{},...n};const r="string"==typeof e;if("object"==typeof e&&null!==e)try{if(Array.isArray(e)&&e.length>0)return Me.fromArray(e.map((e=>t.nodeFromJSON(e))));const r=t.nodeFromJSON(e);return n.errorOnInvalidContent&&r.check(),r}catch(r){if(n.errorOnInvalidContent)throw new Error("[tiptap error]: Invalid JSON content",{cause:r});return console.warn("[tiptap warn]: Invalid content.","Passed value:",e,"Error:",r),Zs("",t,n)}if(r){if(n.errorOnInvalidContent){let r=!1,o="";const i=new mt({topNode:t.spec.topNode,marks:t.spec.marks,nodes:t.spec.nodes.append({__tiptap__private__unknown__catch__all__node:{content:"inline*",group:"block",parseDOM:[{tag:"*",getAttrs:e=>(r=!0,o="string"==typeof e?e:e.outerHTML,null)}]}})});if(n.slice?yt.fromSchema(i).parseSlice(Qs(e),n.parseOptions):yt.fromSchema(i).parse(Qs(e),n.parseOptions),n.errorOnInvalidContent&&r)throw new Error("[tiptap error]: Invalid HTML content",{cause:new Error(`Invalid element found: ${o}`)})}const r=yt.fromSchema(t);return n.slice?r.parseSlice(Qs(e),n.parseOptions).content:r.parse(Qs(e),n.parseOptions)}return Zs("",t,n)}function ea(e,t,n={},r={}){return Zs(e,t,{slice:!1,parseOptions:n,errorOnInvalidContent:r.errorOnInvalidContent})}function ta(e){return t=>function(e,t){for(let n=e.depth;n>0;n-=1){const r=e.node(n);if(t(r))return{pos:n>0?e.before(n):0,start:e.start(n),depth:n,node:r}}}(t.$from,e)}function na(e,t,n){if(void 0===e.config[t]&&e.parent)return na(e.parent,t,n);if("function"==typeof e.config[t]){return e.config[t].bind({...n,parent:e.parent?na(e.parent,t,n):null})}return e.config[t]}function ra(e){return e.map((e=>{const t=na(e,"addExtensions",{name:e.name,options:e.options,storage:e.storage});return t?[e,...ra(t())]:e})).flat(10)}function oa(e,t){const n=Tt.fromSchema(t).serializeFragment(e),r=document.implementation.createHTMLDocument().createElement("div");return r.appendChild(n),r.innerHTML}function ia(e){return"function"==typeof e}function sa(e,t=void 0,...n){return ia(e)?t?e.bind(t)(...n):e(...n):e}function aa(e){return{baseExtensions:e.filter((e=>"extension"===e.type)),nodeExtensions:e.filter((e=>"node"===e.type)),markExtensions:e.filter((e=>"mark"===e.type))}}function la(e){const t=[],{nodeExtensions:n,markExtensions:r}=aa(e),o=[...n,...r],i={default:null,validate:void 0,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1};return e.forEach((e=>{const n=na(e,"addGlobalAttributes",{name:e.name,options:e.options,storage:e.storage,extensions:o});if(!n)return;n().forEach((e=>{e.types.forEach((n=>{Object.entries(e.attributes).forEach((([e,r])=>{t.push({type:n,name:e,attribute:{...i,...r}})}))}))}))})),o.forEach((e=>{const n={name:e.name,options:e.options,storage:e.storage},r=na(e,"addAttributes",n);if(!r)return;const o=r();Object.entries(o).forEach((([n,r])=>{const o={...i,...r};"function"==typeof(null==o?void 0:o.default)&&(o.default=o.default()),(null==o?void 0:o.isRequired)&&void 0===(null==o?void 0:o.default)&&delete o.default,t.push({type:e.name,name:n,attribute:o})}))})),t}function ca(...e){return e.filter((e=>!!e)).reduce(((e,t)=>{const n={...e};return Object.entries(t).forEach((([e,t])=>{if(n[e])if("class"===e){const r=t?String(t).split(" "):[],o=n[e]?n[e].split(" "):[],i=r.filter((e=>!o.includes(e)));n[e]=[...o,...i].join(" ")}else if("style"===e){const r=t?t.split(";").map((e=>e.trim())).filter(Boolean):[],o=n[e]?n[e].split(";").map((e=>e.trim())).filter(Boolean):[],i=new Map;o.forEach((e=>{const[t,n]=e.split(":").map((e=>e.trim()));i.set(t,n)})),r.forEach((e=>{const[t,n]=e.split(":").map((e=>e.trim()));i.set(t,n)})),n[e]=Array.from(i.entries()).map((([e,t])=>`${e}: ${t}`)).join("; ")}else n[e]=t;else n[e]=t})),n}),{})}function da(e,t){return t.filter((t=>t.type===e.type.name)).filter((e=>e.attribute.rendered)).map((t=>t.attribute.renderHTML?t.attribute.renderHTML(e.attrs)||{}:{[t.name]:e.attrs[t.name]})).reduce(((e,t)=>ca(e,t)),{})}function ha(e,t){return"style"in e?e:{...e,getAttrs:n=>{const r=e.getAttrs?e.getAttrs(n):e.attrs;if(!1===r)return!1;const o=t.reduce(((e,t)=>{const r=t.attribute.parseHTML?t.attribute.parseHTML(n):function(e){return"string"!=typeof e?e:e.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(e):"true"===e||"false"!==e&&e}(n.getAttribute(t.name));return null==r?e:{...e,[t.name]:r}}),{});return{...r,...o}}}}function ua(e){return Object.fromEntries(Object.entries(e).filter((([e,t])=>("attrs"!==e||!function(e={}){return 0===Object.keys(e).length&&e.constructor===Object}(t))&&null!=t)))}function pa(e){return e.sort(((e,t)=>{const n=na(e,"priority")||100,r=na(t,"priority")||100;return n>r?-1:n<r?1:0}))}function fa(e){const t=pa(ra(e)),n=function(e){const t=e.filter(((t,n)=>e.indexOf(t)!==n));return Array.from(new Set(t))}(t.map((e=>e.name)));return n.length&&console.warn(`[tiptap warn]: Duplicate extension names found: [${n.map((e=>`'${e}'`)).join(", ")}]. This can lead to issues.`),t}function ma(e,t,n){const{from:r,to:o}=t,{blockSeparator:i="\n\n",textSerializers:s={}}=n||{};let a="";return e.nodesBetween(r,o,((e,n,l,c)=>{var d;e.isBlock&&n>r&&(a+=i);const h=null==s?void 0:s[e.type.name];if(h)return l&&(a+=h({node:e,pos:n,parent:l,index:c,range:t})),!1;e.isText&&(a+=null==(d=null==e?void 0:e.text)?void 0:d.slice(Math.max(r,n)-n,o-n))})),a}function ga(e){return Object.fromEntries(Object.entries(e.nodes).filter((([,e])=>e.spec.toText)).map((([e,t])=>[e,t.spec.toText])))}function ya(e,t){if("string"==typeof e){if(!t.marks[e])throw Error(`There is no mark type named '${e}'. Maybe you forgot to add the extension?`);return t.marks[e]}return e}function va(e,t){const n=ya(t,e.schema),{from:r,to:o,empty:i}=e.selection,s=[];i?(e.storedMarks&&s.push(...e.storedMarks),s.push(...e.selection.$head.marks())):e.doc.nodesBetween(r,o,(e=>{s.push(...e.marks)}));const a=s.find((e=>e.type.name===n.name));return a?{...a.attrs}:{}}function ba(e,t){if("string"==typeof e){if(!t.nodes[e])throw Error(`There is no node type named '${e}'. Maybe you forgot to add the extension?`);return t.nodes[e]}return e}function xa(e,t){return t.nodes[e]?"node":t.marks[e]?"mark":null}function wa(e,t){const n=xa("string"==typeof t?t:t.name,e.schema);return"node"===n?function(e,t){const n=ba(t,e.schema),{from:r,to:o}=e.selection,i=[];e.doc.nodesBetween(r,o,(e=>{i.push(e)}));const s=i.reverse().find((e=>e.type.name===n.name));return s?{...s.attrs}:{}}(e,t):"mark"===n?va(e,t):{}}function ka(e){const t=function(e,t=JSON.stringify){const n={};return e.filter((e=>{const r=t(e);return!Object.prototype.hasOwnProperty.call(n,r)&&(n[r]=!0)}))}(e);return 1===t.length?t:t.filter(((e,n)=>{const r=t.filter(((e,t)=>t!==n));return!r.some((t=>e.oldRange.from>=t.oldRange.from&&e.oldRange.to<=t.oldRange.to&&e.newRange.from>=t.newRange.from&&e.newRange.to<=t.newRange.to))}))}function Ca(e){const{mapping:t,steps:n}=e,r=[];return t.maps.forEach(((e,o)=>{const i=[];if(e.ranges.length)e.forEach(((e,t)=>{i.push({from:e,to:t})}));else{const{from:e,to:t}=n[o];if(void 0===e||void 0===t)return;i.push({from:e,to:t})}i.forEach((({from:e,to:n})=>{const i=t.slice(o).map(e,-1),s=t.slice(o).map(n),a=t.invert().map(i,-1),l=t.invert().map(s);r.push({oldRange:{from:a,to:l},newRange:{from:i,to:s}})}))})),ka(r)}function Na(e){return"[object RegExp]"===Object.prototype.toString.call(e)}function Sa(e,t,n={strict:!0}){const r=Object.keys(t);return!r.length||r.every((r=>n.strict?t[r]===e[r]:Na(t[r])?t[r].test(e[r]):t[r]===e[r]))}function Ma(e,t,n={}){return e.find((e=>e.type===t&&Sa(Object.fromEntries(Object.keys(n).map((t=>[t,e.attrs[t]]))),n)))}function Ta(e,t,n={}){return!!Ma(e,t,n)}function Oa(e,t,n){var r;if(!e||!t)return;let o=e.parent.childAfter(e.parentOffset);if(o.node&&o.node.marks.some((e=>e.type===t))||(o=e.parent.childBefore(e.parentOffset)),!o.node||!o.node.marks.some((e=>e.type===t)))return;n=n||(null==(r=o.node.marks[0])?void 0:r.attrs);if(!Ma([...o.node.marks],t,n))return;let i=o.index,s=e.start()+o.offset,a=i+1,l=s+o.node.nodeSize;for(;i>0&&Ta([...e.parent.child(i-1).marks],t,n);)i-=1,s-=e.parent.child(i).nodeSize;for(;a<e.parent.childCount&&Ta([...e.parent.child(a).marks],t,n);)l+=e.parent.child(a).nodeSize,a+=1;return{from:s,to:l}}function Ea(e,t,n){const r=[];return e===t?n.resolve(e).marks().forEach((t=>{const o=Oa(n.resolve(e),t.type);o&&r.push({mark:t,...o})})):n.nodesBetween(e,t,((e,t)=>{e&&void 0!==(null==e?void 0:e.nodeSize)&&r.push(...e.marks.map((n=>({from:t,to:t+e.nodeSize,mark:n}))))})),r}function Aa(e,t){return t.nodes[e]||t.marks[e]||null}function Da(e,t,n){return Object.fromEntries(Object.entries(n).filter((([n])=>{const r=e.find((e=>e.type===t&&e.name===n));return!!r&&r.attribute.keepOnSplit})))}function Ra(e,t,n={}){const{empty:r,ranges:o}=e.selection,i=t?ya(t,e.schema):null;if(r)return!!(e.storedMarks||e.selection.$from.marks()).filter((e=>!i||i.name===e.type.name)).find((e=>Sa(e.attrs,n,{strict:!1})));let s=0;const a=[];if(o.forEach((({$from:t,$to:n})=>{const r=t.pos,o=n.pos;e.doc.nodesBetween(r,o,((e,t)=>{if(!e.isText&&!e.marks.length)return;const n=Math.max(r,t),i=Math.min(o,t+e.nodeSize);s+=i-n,a.push(...e.marks.map((e=>({mark:e,from:n,to:i}))))}))})),0===s)return!1;const l=a.filter((e=>!i||i.name===e.mark.type.name)).filter((e=>Sa(e.mark.attrs,n,{strict:!1}))).reduce(((e,t)=>e+t.to-t.from),0),c=a.filter((e=>!i||e.mark.type!==i&&e.mark.type.excludes(i))).reduce(((e,t)=>e+t.to-t.from),0);return(l>0?l+c:l)>=s}function La(e,t,n={}){const{from:r,to:o,empty:i}=e.selection,s=t?ba(t,e.schema):null,a=[];e.doc.nodesBetween(r,o,((e,t)=>{if(e.isText)return;const n=Math.max(r,t),i=Math.min(o,t+e.nodeSize);a.push({node:e,from:n,to:i})}));const l=o-r,c=a.filter((e=>!s||s.name===e.node.type.name)).filter((e=>Sa(e.node.attrs,n,{strict:!1})));if(i)return!!c.length;return c.reduce(((e,t)=>e+t.to-t.from),0)>=l}function Ia(e,t){return Array.isArray(t)?t.some((t=>("string"==typeof t?t:t.name)===e.name)):t}function za(e,t){const{nodeExtensions:n}=aa(t),r=n.find((t=>t.name===e));if(!r)return!1;const o=sa(na(r,"group",{name:r.name,options:r.options,storage:r.storage}));return"string"==typeof o&&o.split(" ").includes("list")}function Pa(e,{checkChildren:t=!0,ignoreWhitespace:n=!1}={}){var r;if(n){if("hardBreak"===e.type.name)return!0;if(e.isText)return/^\s*$/m.test(null!=(r=e.text)?r:"")}if(e.isText)return!e.text;if(e.isAtom||e.isLeaf)return!1;if(0===e.content.childCount)return!0;if(t){let r=!0;return e.content.forEach((e=>{!1!==r&&(Pa(e,{ignoreWhitespace:n,checkChildren:t})||(r=!1))})),r}return!1}function Ba(e){return e instanceof En}function $a(e){return e instanceof Tn}function Va(e=0,t=0,n=0){return Math.min(Math.max(e,t),n)}function ja(e,t=null){if(!t)return null;const n=Cn.atStart(e),r=Cn.atEnd(e);if("start"===t||!0===t)return n;if("end"===t)return r;const o=n.from,i=r.to;return"all"===t?Tn.create(e,Va(0,o,i),Va(e.content.size,o,i)):Tn.create(e,Va(t,o,i),Va(t,o,i))}var Fa=class{constructor(e){this.find=e.find,this.handler=e.handler}};function Ha(e){var t;const{editor:n,from:r,to:o,text:i,rules:s,plugin:a}=e,{view:l}=n;if(l.composing)return!1;const c=l.state.doc.resolve(r);if(c.parent.type.spec.code||(null==(t=c.nodeBefore||c.nodeAfter)?void 0:t.marks.find((e=>e.type.spec.code))))return!1;let d=!1;const h=((e,t=500)=>{let n="";const r=e.parentOffset;return e.parent.nodesBetween(Math.max(0,r-t),r,((e,t,o,i)=>{var s,a;const l=(null==(a=(s=e.type.spec).toText)?void 0:a.call(s,{node:e,pos:t,parent:o,index:i}))||e.textContent||"%leaf%";n+=e.isAtom&&!e.isText?l:l.slice(0,Math.max(0,r-t))})),n})(c)+i;return s.forEach((e=>{if(d)return;const t=((e,t)=>{if(Na(t))return t.exec(e);const n=t(e);if(!n)return null;const r=[n.text];return r.index=n.index,r.input=e,r.data=n.data,n.replaceWith&&(n.text.includes(n.replaceWith)||console.warn('[tiptap warn]: "inputRuleMatch.replaceWith" must be part of "inputRuleMatch.text".'),r.push(n.replaceWith)),r})(h,e.find);if(!t)return;const s=l.state.tr,c=Js({state:l.state,transaction:s}),u={from:r-(t[0].length-i.length),to:o},{commands:p,chain:f,can:m}=new Us({editor:n,state:c});null!==e.handler({state:c,range:u,match:t,commands:p,chain:f,can:m})&&s.steps.length&&(s.setMeta(a,{transform:s,from:r,to:o,text:i}),l.dispatch(s),d=!0)})),d}function _a(e){const{editor:t,rules:n}=e,r=new Hn({state:{init:()=>null,apply(e,o,i){const s=e.getMeta(r);if(s)return s;const a=e.getMeta("applyInputRules");return!!a&&setTimeout((()=>{let{text:e}=a;"string"==typeof e||(e=oa(Me.from(e),i.schema));const{from:o}=a,s=o+e.length;Ha({editor:t,from:o,to:s,text:e,rules:n,plugin:r})})),e.selectionSet||e.docChanged?null:o}},props:{handleTextInput:(e,o,i,s)=>Ha({editor:t,from:o,to:i,text:s,rules:n,plugin:r}),handleDOMEvents:{compositionend:e=>(setTimeout((()=>{const{$cursor:o}=e.state.selection;o&&Ha({editor:t,from:o.pos,to:o.pos,text:"",rules:n,plugin:r})})),!1)},handleKeyDown(e,o){if("Enter"!==o.key)return!1;const{$cursor:i}=e.state.selection;return!!i&&Ha({editor:t,from:i.pos,to:i.pos,text:"\n",rules:n,plugin:r})}},isInputRules:!0});return r}function qa(e){return"Object"===function(e){return Object.prototype.toString.call(e).slice(8,-1)}(e)&&(e.constructor===Object&&Object.getPrototypeOf(e)===Object.prototype)}function Wa(e,t){const n={...e};return qa(e)&&qa(t)&&Object.keys(t).forEach((r=>{qa(t[r])&&qa(e[r])?n[r]=Wa(e[r],t[r]):n[r]=t[r]})),n}var Ka=class{constructor(e={}){this.type="extendable",this.parent=null,this.child=null,this.name="",this.config={name:this.name},this.config={...this.config,...e},this.name=this.config.name}get options(){return{...sa(na(this,"addOptions",{name:this.name}))||{}}}get storage(){return{...sa(na(this,"addStorage",{name:this.name,options:this.options}))||{}}}configure(e={}){const t=this.extend({...this.config,addOptions:()=>Wa(this.options,e)});return t.name=this.name,t.parent=this.parent,t}extend(e={}){const t=new this.constructor({...this.config,...e});return t.parent=this,this.child=t,t.name="name"in e?e.name:t.parent.name,t}},Ja=class e extends Ka{constructor(){super(...arguments),this.type="mark"}static create(t={}){const n="function"==typeof t?t():t;return new e(n)}static handleExit({editor:e,mark:t}){const{tr:n}=e.state,r=e.state.selection.$from;if(r.pos===r.end()){const o=r.marks();if(!!!o.find((e=>(null==e?void 0:e.type.name)===t.name)))return!1;const i=o.find((e=>(null==e?void 0:e.type.name)===t.name));return i&&n.removeStoredMark(i),n.insertText(" ",r.pos),e.view.dispatch(n),!0}return!1}configure(e){return super.configure(e)}extend(e){const t="function"==typeof e?e():e;return super.extend(t)}};var Ua=class{constructor(e){this.find=e.find,this.handler=e.handler}};function Ga(e){const{editor:t,state:n,from:r,to:o,rule:i,pasteEvent:s,dropEvent:a}=e,{commands:l,chain:c,can:d}=new Us({editor:t,state:n}),h=[];n.doc.nodesBetween(r,o,((e,t)=>{if(!e.isTextblock||e.type.spec.code)return;const u=Math.max(r,t),p=Math.min(o,t+e.content.size),f=((e,t,n)=>{if(Na(t))return[...e.matchAll(t)];const r=t(e,n);return r?r.map((t=>{const n=[t.text];return n.index=t.index,n.input=e,n.data=t.data,t.replaceWith&&(t.text.includes(t.replaceWith)||console.warn('[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".'),n.push(t.replaceWith)),n})):[]})(e.textBetween(u-t,p-t,void 0,""),i.find,s);f.forEach((e=>{if(void 0===e.index)return;const t=u+e.index+1,r=t+e[0].length,o={from:n.tr.mapping.map(t),to:n.tr.mapping.map(r)},p=i.handler({state:n,range:o,match:e,commands:l,chain:c,can:d,pasteEvent:s,dropEvent:a});h.push(p)}))}));return h.every((e=>null!==e))}var Ya=null;function Xa(e){const{editor:t,rules:n}=e;let r,o=null,i=!1,s=!1,a="undefined"!=typeof ClipboardEvent?new ClipboardEvent("paste"):null;try{r="undefined"!=typeof DragEvent?new DragEvent("drop"):null}catch{r=null}const l=({state:e,from:n,to:o,rule:i,pasteEvt:s})=>{const l=e.tr,c=Js({state:e,transaction:l});if(Ga({editor:t,state:c,from:Math.max(n-1,0),to:o.b-1,rule:i,pasteEvent:s,dropEvent:r})&&l.steps.length){try{r="undefined"!=typeof DragEvent?new DragEvent("drop"):null}catch{r=null}return a="undefined"!=typeof ClipboardEvent?new ClipboardEvent("paste"):null,l}};return n.map((e=>new Hn({view(e){const n=n=>{var r;o=(null==(r=e.dom.parentElement)?void 0:r.contains(n.target))?e.dom.parentElement:null,o&&(Ya=t)},r=()=>{Ya&&(Ya=null)};return window.addEventListener("dragstart",n),window.addEventListener("dragend",r),{destroy(){window.removeEventListener("dragstart",n),window.removeEventListener("dragend",r)}}},props:{handleDOMEvents:{drop:(e,t)=>{if(s=o===e.dom.parentElement,r=t,!s){const e=Ya;(null==e?void 0:e.isEditable)&&setTimeout((()=>{const t=e.state.selection;t&&e.commands.deleteRange({from:t.from,to:t.to})}),10)}return!1},paste:(e,t)=>{var n;const r=null==(n=t.clipboardData)?void 0:n.getData("text/html");return a=t,i=!!(null==r?void 0:r.includes("data-pm-slice")),!1}}},appendTransaction:(t,n,r)=>{const o=t[0],c="paste"===o.getMeta("uiEvent")&&!i,d="drop"===o.getMeta("uiEvent")&&!s,h=o.getMeta("applyPasteRules"),u=!!h;if(!c&&!d&&!u)return;if(u){let{text:t}=h;"string"==typeof t||(t=oa(Me.from(t),r.schema));const{from:n}=h,o=n+t.length,i=(e=>{var t;const n=new ClipboardEvent("paste",{clipboardData:new DataTransfer});return null==(t=n.clipboardData)||t.setData("text/html",e),n})(t);return l({rule:e,state:r,from:n,to:{b:o},pasteEvt:i})}const p=n.doc.content.findDiffStart(r.doc.content),f=n.doc.content.findDiffEnd(r.doc.content);return"number"==typeof p&&f&&p!==f.b?l({rule:e,state:r,from:p,to:f,pasteEvt:a}):void 0}})))}var Qa=class{constructor(e,t){this.splittableMarks=[],this.editor=t,this.extensions=fa(e),this.schema=function(e,t){var n;const r=la(e),{nodeExtensions:o,markExtensions:i}=aa(e),s=null==(n=o.find((e=>na(e,"topNode"))))?void 0:n.name,a=Object.fromEntries(o.map((n=>{const o=r.filter((e=>e.type===n.name)),i={name:n.name,options:n.options,storage:n.storage,editor:t},s=ua({...e.reduce(((e,t)=>{const r=na(t,"extendNodeSchema",i);return{...e,...r?r(n):{}}}),{}),content:sa(na(n,"content",i)),marks:sa(na(n,"marks",i)),group:sa(na(n,"group",i)),inline:sa(na(n,"inline",i)),atom:sa(na(n,"atom",i)),selectable:sa(na(n,"selectable",i)),draggable:sa(na(n,"draggable",i)),code:sa(na(n,"code",i)),whitespace:sa(na(n,"whitespace",i)),linebreakReplacement:sa(na(n,"linebreakReplacement",i)),defining:sa(na(n,"defining",i)),isolating:sa(na(n,"isolating",i)),attrs:Object.fromEntries(o.map((e=>{var t,n;return[e.name,{default:null==(t=null==e?void 0:e.attribute)?void 0:t.default,validate:null==(n=null==e?void 0:e.attribute)?void 0:n.validate}]})))}),a=sa(na(n,"parseHTML",i));a&&(s.parseDOM=a.map((e=>ha(e,o))));const l=na(n,"renderHTML",i);l&&(s.toDOM=e=>l({node:e,HTMLAttributes:da(e,o)}));const c=na(n,"renderText",i);return c&&(s.toText=c),[n.name,s]}))),l=Object.fromEntries(i.map((n=>{const o=r.filter((e=>e.type===n.name)),i={name:n.name,options:n.options,storage:n.storage,editor:t},s=ua({...e.reduce(((e,t)=>{const r=na(t,"extendMarkSchema",i);return{...e,...r?r(n):{}}}),{}),inclusive:sa(na(n,"inclusive",i)),excludes:sa(na(n,"excludes",i)),group:sa(na(n,"group",i)),spanning:sa(na(n,"spanning",i)),code:sa(na(n,"code",i)),attrs:Object.fromEntries(o.map((e=>{var t,n;return[e.name,{default:null==(t=null==e?void 0:e.attribute)?void 0:t.default,validate:null==(n=null==e?void 0:e.attribute)?void 0:n.validate}]})))}),a=sa(na(n,"parseHTML",i));a&&(s.parseDOM=a.map((e=>ha(e,o))));const l=na(n,"renderHTML",i);return l&&(s.toDOM=e=>l({mark:e,HTMLAttributes:da(e,o)})),[n.name,s]})));return new mt({topNode:s,nodes:a,marks:l})}(this.extensions,t),this.setupExtensions()}get commands(){return this.extensions.reduce(((e,t)=>{const n=na(t,"addCommands",{name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:this.editor,type:Aa(t.name,this.schema)});return n?{...e,...n()}:e}),{})}get plugins(){const{editor:e}=this,t=pa([...this.extensions].reverse()),n=[],r=[],o=t.map((t=>{const o={name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:e,type:Aa(t.name,this.schema)},i=[],s=na(t,"addKeyboardShortcuts",o);let a={};if("mark"===t.type&&na(t,"exitable",o)&&(a.ArrowRight=()=>Ja.handleExit({editor:e,mark:t})),s){const t=Object.fromEntries(Object.entries(s()).map((([t,n])=>[t,()=>n({editor:e})])));a={...a,...t}}const l=new Hn({props:{handleKeyDown:xs(a)}});i.push(l);const c=na(t,"addInputRules",o);Ia(t,e.options.enableInputRules)&&c&&n.push(...c());const d=na(t,"addPasteRules",o);Ia(t,e.options.enablePasteRules)&&d&&r.push(...d());const h=na(t,"addProseMirrorPlugins",o);if(h){const e=h();i.push(...e)}return i})).flat();return[_a({editor:e,rules:n}),...Xa({editor:e,rules:r}),...o]}get attributes(){return la(this.extensions)}get nodeViews(){const{editor:e}=this,{nodeExtensions:t}=aa(this.extensions);return Object.fromEntries(t.filter((e=>!!na(e,"addNodeView"))).map((t=>{const n=this.attributes.filter((e=>e.type===t.name)),r={name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:e,type:ba(t.name,this.schema)},o=na(t,"addNodeView",r);if(!o)return[];return[t.name,(r,i,s,a,l)=>{const c=da(r,n);return o()({node:r,view:i,getPos:s,decorations:a,innerDecorations:l,editor:e,extension:t,HTMLAttributes:c})}]})))}get markViews(){const{editor:e}=this,{markExtensions:t}=aa(this.extensions);return Object.fromEntries(t.filter((e=>!!na(e,"addMarkView"))).map((t=>{const n=this.attributes.filter((e=>e.type===t.name)),r={name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:e,type:ya(t.name,this.schema)},o=na(t,"addMarkView",r);if(!o)return[];return[t.name,(r,i,s)=>{const a=da(r,n);return o()({mark:r,view:i,inline:s,editor:e,extension:t,HTMLAttributes:a,updateAttributes:t=>{!function(e,t,n={}){const{state:r}=t,{doc:o,tr:i}=r,s=e;o.descendants(((t,r)=>{const o=i.mapping.map(r),a=i.mapping.map(r)+t.nodeSize;let l=null;if(t.marks.forEach((e=>{if(e!==s)return!1;l=e})),!l)return;let c=!1;if(Object.keys(n).forEach((e=>{n[e]!==l.attrs[e]&&(c=!0)})),c){const t=e.type.create({...e.attrs,...n});i.removeMark(o,a,e.type),i.addMark(o,a,t)}})),i.docChanged&&t.view.dispatch(i)}(r,e,t)}})}]})))}setupExtensions(){const e=this.extensions;this.editor.extensionStorage=Object.fromEntries(e.map((e=>[e.name,e.storage]))),e.forEach((e=>{var t;const n={name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:this.editor,type:Aa(e.name,this.schema)};if("mark"===e.type){(null==(t=sa(na(e,"keepOnSplit",n)))||t)&&this.splittableMarks.push(e.name)}const r=na(e,"onBeforeCreate",n),o=na(e,"onCreate",n),i=na(e,"onUpdate",n),s=na(e,"onSelectionUpdate",n),a=na(e,"onTransaction",n),l=na(e,"onFocus",n),c=na(e,"onBlur",n),d=na(e,"onDestroy",n);r&&this.editor.on("beforeCreate",r),o&&this.editor.on("create",o),i&&this.editor.on("update",i),s&&this.editor.on("selectionUpdate",s),a&&this.editor.on("transaction",a),l&&this.editor.on("focus",l),c&&this.editor.on("blur",c),d&&this.editor.on("destroy",d)}))}};Qa.resolve=fa,Qa.sort=pa,Qa.flatten=ra;Ks({},{ClipboardTextSerializer:()=>el,Commands:()=>uc,Delete:()=>pc,Drop:()=>fc,Editable:()=>mc,FocusEvents:()=>yc,Keymap:()=>vc,Paste:()=>bc,Tabindex:()=>xc,focusEventsPluginKey:()=>gc});var Za=class e extends Ka{constructor(){super(...arguments),this.type="extension"}static create(t={}){const n="function"==typeof t?t():t;return new e(n)}configure(e){return super.configure(e)}extend(e){const t="function"==typeof e?e():e;return super.extend(t)}},el=Za.create({name:"clipboardTextSerializer",addOptions:()=>({blockSeparator:void 0}),addProseMirrorPlugins(){return[new Hn({key:new Wn("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{const{editor:e}=this,{state:t,schema:n}=e,{doc:r,selection:o}=t,{ranges:i}=o,s=Math.min(...i.map((e=>e.$from.pos))),a=Math.max(...i.map((e=>e.$to.pos))),l=ga(n);return ma(r,{from:s,to:a},{...void 0!==this.options.blockSeparator?{blockSeparator:this.options.blockSeparator}:{},textSerializers:l})}}})]}}),tl={};Ks(tl,{blur:()=>nl,clearContent:()=>rl,clearNodes:()=>ol,command:()=>il,createParagraphNear:()=>sl,cut:()=>al,deleteCurrentNode:()=>ll,deleteNode:()=>cl,deleteRange:()=>dl,deleteSelection:()=>hl,enter:()=>ul,exitCode:()=>pl,extendMarkRange:()=>fl,first:()=>ml,focus:()=>yl,forEach:()=>vl,insertContent:()=>bl,insertContentAt:()=>xl,joinBackward:()=>Cl,joinDown:()=>kl,joinForward:()=>Nl,joinItemBackward:()=>Sl,joinItemForward:()=>Ml,joinTextblockBackward:()=>Tl,joinTextblockForward:()=>Ol,joinUp:()=>wl,keyboardShortcut:()=>Al,lift:()=>Dl,liftEmptyBlock:()=>Rl,liftListItem:()=>Ll,newlineInCode:()=>Il,resetAttributes:()=>Pl,scrollIntoView:()=>Bl,selectAll:()=>$l,selectNodeBackward:()=>Vl,selectNodeForward:()=>jl,selectParentNode:()=>Fl,selectTextblockEnd:()=>Hl,selectTextblockStart:()=>_l,setContent:()=>ql,setMark:()=>Wl,setMeta:()=>Kl,setNode:()=>Jl,setNodeSelection:()=>Ul,setTextSelection:()=>Gl,sinkListItem:()=>Yl,splitBlock:()=>Ql,splitListItem:()=>Zl,toggleList:()=>nc,toggleMark:()=>rc,toggleNode:()=>oc,toggleWrap:()=>ic,undoInputRule:()=>sc,unsetAllMarks:()=>ac,unsetMark:()=>lc,updateAttributes:()=>cc,wrapIn:()=>dc,wrapInList:()=>hc});var nl=()=>({editor:e,view:t})=>(requestAnimationFrame((()=>{var n;e.isDestroyed||(t.dom.blur(),null==(n=null==window?void 0:window.getSelection())||n.removeAllRanges())})),!0),rl=(e=!0)=>({commands:t})=>t.setContent("",{emitUpdate:e}),ol=()=>({state:e,tr:t,dispatch:n})=>{const{selection:r}=t,{ranges:o}=r;return!n||(o.forEach((({$from:n,$to:r})=>{e.doc.nodesBetween(n.pos,r.pos,((e,n)=>{if(e.type.isText)return;const{doc:r,mapping:o}=t,i=r.resolve(o.map(n)),s=r.resolve(o.map(n+e.nodeSize)),a=i.blockRange(s);if(!a)return;const l=Xt(a);if(e.type.isTextblock){const{defaultType:e}=i.parent.contentMatchAt(i.index());t.setNodeMarkup(a.start,e)}(l||0===l)&&t.lift(a,l)}))})),!0)},il=e=>t=>e(t),sl=()=>({state:e,dispatch:t})=>Is(e,t),al=(e,t)=>({editor:n,tr:r})=>{const{state:o}=n,i=o.doc.slice(e.from,e.to);r.deleteRange(e.from,e.to);const s=r.mapping.map(t);return r.insert(s,i.content),r.setSelection(new Tn(r.doc.resolve(Math.max(s-1,0)))),!0},ll=()=>({tr:e,dispatch:t})=>{const{selection:n}=e,r=n.$anchor.node();if(r.content.size>0)return!1;const o=e.selection.$anchor;for(let n=o.depth;n>0;n-=1){if(o.node(n).type===r.type){if(t){const t=o.before(n),r=o.after(n);e.delete(t,r).scrollIntoView()}return!0}}return!1},cl=e=>({tr:t,state:n,dispatch:r})=>{const o=ba(e,n.schema),i=t.selection.$anchor;for(let e=i.depth;e>0;e-=1){if(i.node(e).type===o){if(r){const n=i.before(e),r=i.after(e);t.delete(n,r).scrollIntoView()}return!0}}return!1},dl=e=>({tr:t,dispatch:n})=>{const{from:r,to:o}=e;return n&&t.delete(r,o),!0},hl=()=>({state:e,dispatch:t})=>ws(e,t),ul=()=>({commands:e})=>e.keyboardShortcut("Enter"),pl=()=>({state:e,dispatch:t})=>((e,t)=>{let{$head:n,$anchor:r}=e.selection;if(!n.parent.type.spec.code||!n.sameParent(r))return!1;let o=n.node(-1),i=n.indexAfter(-1),s=Ls(o.contentMatchAt(i));if(!s||!o.canReplaceWith(i,i,s))return!1;if(t){let r=n.after(),o=e.tr.replaceWith(r,r,s.createAndFill());o.setSelection(Cn.near(o.doc.resolve(r),1)),t(o.scrollIntoView())}return!0})(e,t),fl=(e,t={})=>({tr:n,state:r,dispatch:o})=>{const i=ya(e,r.schema),{doc:s,selection:a}=n,{$from:l,from:c,to:d}=a;if(o){const e=Oa(l,i,t);if(e&&e.from<=c&&e.to>=d){const t=Tn.create(s,e.from,e.to);n.setSelection(t)}}return!0},ml=e=>t=>{const n="function"==typeof e?e(t):e;for(let e=0;e<n.length;e+=1)if(n[e](t))return!0;return!1};function gl(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}var yl=(e=null,t={})=>({editor:n,view:r,tr:o,dispatch:i})=>{t={scrollIntoView:!0,...t};const s=()=>{(gl()||"Android"===navigator.platform||/android/i.test(navigator.userAgent))&&r.dom.focus(),requestAnimationFrame((()=>{n.isDestroyed||(r.focus(),(null==t?void 0:t.scrollIntoView)&&n.commands.scrollIntoView())}))};if(r.hasFocus()&&null===e||!1===e)return!0;if(i&&null===e&&!$a(n.state.selection))return s(),!0;const a=ja(o.doc,e)||n.state.selection,l=n.state.selection.eq(a);return i&&(l||o.setSelection(a),l&&o.storedMarks&&o.setStoredMarks(o.storedMarks),s()),!0},vl=(e,t)=>n=>e.every(((e,r)=>t(e,{...n,index:r}))),bl=(e,t)=>({tr:n,commands:r})=>r.insertContentAt({from:n.selection.from,to:n.selection.to},e,t),xl=(e,t,n)=>({tr:r,dispatch:o,editor:i})=>{var s;if(o){let o;n={parseOptions:i.options.parseOptions,updateSelection:!0,applyInputRules:!1,applyPasteRules:!1,...n};const{selection:a}=i.state,l=e=>{i.emit("contentError",{editor:i,error:e,disableCollaboration:()=>{"collaboration"in i.storage&&"object"==typeof i.storage.collaboration&&i.storage.collaboration&&(i.storage.collaboration.isDisabled=!0)}})},c={preserveWhitespace:"full",...n.parseOptions};if(!n.errorOnInvalidContent&&!i.options.enableContentCheck&&i.options.emitContentError)try{Zs(t,i.schema,{parseOptions:c,errorOnInvalidContent:!0})}catch(e){l(e)}try{o=Zs(t,i.schema,{parseOptions:c,errorOnInvalidContent:null!=(s=n.errorOnInvalidContent)?s:i.options.enableContentCheck})}catch(e){return l(e),!1}let{from:d,to:h}="number"==typeof e?{from:e,to:e}:{from:e.from,to:e.to},u=!0,p=!0;if(("type"in o?[o]:o).forEach((e=>{e.check(),u=!!u&&(e.isText&&0===e.marks.length),p=!!p&&e.isBlock})),d===h&&p){const{parent:e}=r.doc.resolve(d);e.isTextblock&&!e.type.spec.code&&!e.childCount&&(d-=1,h+=1)}let f;if(u){if(Array.isArray(t))f=t.map((e=>e.text||"")).join("");else if(t instanceof Me){let e="";t.forEach((t=>{t.text&&(e+=t.text)})),f=e}else f="object"==typeof t&&t&&t.text?t.text:t;r.insertText(f,d,h)}else{f=o;const e=0===a.$from.parentOffset,t=a.$from.node().isText||a.$from.node().isTextblock,n=a.$from.node().content.size>0;e&&t&&n&&(d=Math.max(0,d-1)),r.replaceWith(d,h,f)}n.updateSelection&&function(e,t,n){const r=e.steps.length-1;if(r<t)return;const o=e.steps[r];if(!(o instanceof Kt||o instanceof Jt))return;const i=e.mapping.maps[r];let s=0;i.forEach(((e,t,n,r)=>{0===s&&(s=r)})),e.setSelection(Cn.near(e.doc.resolve(s),n))}(r,r.steps.length-1,-1),n.applyInputRules&&r.setMeta("applyInputRules",{from:d,text:f}),n.applyPasteRules&&r.setMeta("applyPasteRules",{from:d,text:f})}return!0},wl=()=>({state:e,dispatch:t})=>((e,t)=>{let n,r=e.selection,o=r instanceof En;if(o){if(r.node.isTextblock||!rn(e.doc,r.from))return!1;n=r.from}else if(n=sn(e.doc,r.from,-1),null==n)return!1;if(t){let r=e.tr.join(n);o&&r.setSelection(En.create(r.doc,n-e.doc.resolve(n).nodeBefore.nodeSize)),t(r.scrollIntoView())}return!0})(e,t),kl=()=>({state:e,dispatch:t})=>((e,t)=>{let n,r=e.selection;if(r instanceof En){if(r.node.isTextblock||!rn(e.doc,r.to))return!1;n=r.to}else if(n=sn(e.doc,r.to,1),null==n)return!1;return t&&t(e.tr.join(n).scrollIntoView()),!0})(e,t),Cl=()=>({state:e,dispatch:t})=>Cs(e,t),Nl=()=>({state:e,dispatch:t})=>Es(e,t),Sl=()=>({state:e,dispatch:t,tr:n})=>{try{const r=sn(e.doc,e.selection.$from.pos,-1);return null!=r&&(n.join(r,2),t&&t(n),!0)}catch{return!1}},Ml=()=>({state:e,dispatch:t,tr:n})=>{try{const r=sn(e.doc,e.selection.$from.pos,1);return null!=r&&(n.join(r,2),t&&t(n),!0)}catch{return!1}},Tl=()=>({state:e,dispatch:t})=>((e,t,n)=>{let r=ks(e,n);if(!r)return!1;let o=Ts(r);return!!o&&Ns(e,o,t)})(e,t),Ol=()=>({state:e,dispatch:t})=>((e,t,n)=>{let r=Os(e,n);if(!r)return!1;let o=Ds(r);return!!o&&Ns(e,o,t)})(e,t);function El(){return"undefined"!=typeof navigator&&/Mac/.test(navigator.platform)}var Al=e=>({editor:t,view:n,tr:r,dispatch:o})=>{const i=function(e){const t=e.split(/-(?!$)/);let n,r,o,i,s=t[t.length-1];"Space"===s&&(s=" ");for(let e=0;e<t.length-1;e+=1){const s=t[e];if(/^(cmd|meta|m)$/i.test(s))i=!0;else if(/^a(lt)?$/i.test(s))n=!0;else if(/^(c|ctrl|control)$/i.test(s))r=!0;else if(/^s(hift)?$/i.test(s))o=!0;else{if(!/^mod$/i.test(s))throw new Error(`Unrecognized modifier name: ${s}`);gl()||El()?i=!0:r=!0}}return n&&(s=`Alt-${s}`),r&&(s=`Ctrl-${s}`),i&&(s=`Meta-${s}`),o&&(s=`Shift-${s}`),s}(e).split(/-(?!$)/),s=i.find((e=>!["Alt","Ctrl","Meta","Shift"].includes(e))),a=new KeyboardEvent("keydown",{key:"Space"===s?" ":s,altKey:i.includes("Alt"),ctrlKey:i.includes("Ctrl"),metaKey:i.includes("Meta"),shiftKey:i.includes("Shift"),bubbles:!0,cancelable:!0}),l=t.captureTransaction((()=>{n.someProp("handleKeyDown",(e=>e(n,a)))}));return null==l||l.steps.forEach((e=>{const t=e.map(r.mapping);t&&o&&r.maybeStep(t)})),!0},Dl=(e,t={})=>({state:n,dispatch:r})=>!!La(n,ba(e,n.schema),t)&&((e,t)=>{let{$from:n,$to:r}=e.selection,o=n.blockRange(r),i=o&&Xt(o);return null!=i&&(t&&t(e.tr.lift(o,i).scrollIntoView()),!0)})(n,r),Rl=()=>({state:e,dispatch:t})=>zs(e,t),Ll=e=>({state:t,dispatch:n})=>qs(ba(e,t.schema))(t,n),Il=()=>({state:e,dispatch:t})=>Rs(e,t);function zl(e,t){const n="string"==typeof t?[t]:t;return Object.keys(e).reduce(((t,r)=>(n.includes(r)||(t[r]=e[r]),t)),{})}var Pl=(e,t)=>({tr:n,state:r,dispatch:o})=>{let i=null,s=null;const a=xa("string"==typeof e?e:e.name,r.schema);return!!a&&("node"===a&&(i=ba(e,r.schema)),"mark"===a&&(s=ya(e,r.schema)),o&&n.selection.ranges.forEach((e=>{r.doc.nodesBetween(e.$from.pos,e.$to.pos,((e,r)=>{i&&i===e.type&&n.setNodeMarkup(r,void 0,zl(e.attrs,t)),s&&e.marks.length&&e.marks.forEach((o=>{s===o.type&&n.addMark(r,r+e.nodeSize,s.create(zl(o.attrs,t)))}))}))})),!0)},Bl=()=>({tr:e,dispatch:t})=>(t&&e.scrollIntoView(),!0),$l=()=>({tr:e,dispatch:t})=>{if(t){const t=new Dn(e.doc);e.setSelection(t)}return!0},Vl=()=>({state:e,dispatch:t})=>Ms(e,t),jl=()=>({state:e,dispatch:t})=>As(e,t),Fl=()=>({state:e,dispatch:t})=>((e,t)=>{let n,{$from:r,to:o}=e.selection,i=r.sharedDepth(o);return 0!=i&&(n=r.before(i),t&&t(e.tr.setSelection(En.create(e.doc,n))),!0)})(e,t),Hl=()=>({state:e,dispatch:t})=>js(e,t),_l=()=>({state:e,dispatch:t})=>Vs(e,t),ql=(e,{errorOnInvalidContent:t,emitUpdate:n=!0,parseOptions:r={}}={})=>({editor:o,tr:i,dispatch:s,commands:a})=>{const{doc:l}=i;if("full"!==r.preserveWhitespace){const a=ea(e,o.schema,r,{errorOnInvalidContent:null!=t?t:o.options.enableContentCheck});return s&&i.replaceWith(0,l.content.size,a).setMeta("preventUpdate",!n),!0}return s&&i.setMeta("preventUpdate",!n),a.insertContentAt({from:0,to:l.content.size},e,{parseOptions:r,errorOnInvalidContent:null!=t?t:o.options.enableContentCheck})};var Wl=(e,t={})=>({tr:n,state:r,dispatch:o})=>{const{selection:i}=n,{empty:s,ranges:a}=i,l=ya(e,r.schema);if(o)if(s){const e=va(r,l);n.addStoredMark(l.create({...e,...t}))}else a.forEach((e=>{const o=e.$from.pos,i=e.$to.pos;r.doc.nodesBetween(o,i,((e,r)=>{const s=Math.max(r,o),a=Math.min(r+e.nodeSize,i);e.marks.find((e=>e.type===l))?e.marks.forEach((e=>{l===e.type&&n.addMark(s,a,l.create({...e.attrs,...t}))})):n.addMark(s,a,l.create(t))}))}));return function(e,t,n){var r;const{selection:o}=t;let i=null;if($a(o)&&(i=o.$cursor),i){const t=null!=(r=e.storedMarks)?r:i.marks();return!!n.isInSet(t)||!t.some((e=>e.type.excludes(n)))}const{ranges:s}=o;return s.some((({$from:t,$to:r})=>{let o=0===t.depth&&e.doc.inlineContent&&e.doc.type.allowsMarkType(n);return e.doc.nodesBetween(t.pos,r.pos,((e,t,r)=>{if(o)return!1;if(e.isInline){const t=!r||r.type.allowsMarkType(n),i=!!n.isInSet(e.marks)||!e.marks.some((e=>e.type.excludes(n)));o=t&&i}return!o})),o}))}(r,n,l)},Kl=(e,t)=>({tr:n})=>(n.setMeta(e,t),!0),Jl=(e,t={})=>({state:n,dispatch:r,chain:o})=>{const i=ba(e,n.schema);let s;return n.selection.$anchor.sameParent(n.selection.$head)&&(s=n.selection.$anchor.parent.attrs),i.isTextblock?o().command((({commands:e})=>!!Fs(i,{...s,...t})(n)||e.clearNodes())).command((({state:e})=>Fs(i,{...s,...t})(e,r))).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},Ul=e=>({tr:t,dispatch:n})=>{if(n){const{doc:n}=t,r=Va(e,0,n.content.size),o=En.create(n,r);t.setSelection(o)}return!0},Gl=e=>({tr:t,dispatch:n})=>{if(n){const{doc:n}=t,{from:r,to:o}="number"==typeof e?{from:e,to:e}:e,i=Tn.atStart(n).from,s=Tn.atEnd(n).to,a=Va(r,i,s),l=Va(o,i,s),c=Tn.create(n,a,l);t.setSelection(c)}return!0},Yl=e=>({state:t,dispatch:n})=>{const r=ba(e,t.schema);return(o=r,function(e,t){let{$from:n,$to:r}=e.selection,i=n.blockRange(r,(e=>e.childCount>0&&e.firstChild.type==o));if(!i)return!1;let s=i.startIndex;if(0==s)return!1;let a=i.parent,l=a.child(s-1);if(l.type!=o)return!1;if(t){let n=l.lastChild&&l.lastChild.type==a.type,r=Me.from(n?o.create():null),s=new Re(Me.from(o.create(null,Me.from(a.type.create(null,r)))),n?3:1,0),c=i.start,d=i.end;t(e.tr.step(new Jt(c-(n?3:1),d,c,d,s,1,!0)).scrollIntoView())}return!0})(t,n);var o};function Xl(e,t){const n=e.storedMarks||e.selection.$to.parentOffset&&e.selection.$from.marks();if(n){const r=n.filter((e=>null==t?void 0:t.includes(e.type.name)));e.tr.ensureMarks(r)}}var Ql=({keepMarks:e=!0}={})=>({tr:t,state:n,dispatch:r,editor:o})=>{const{selection:i,doc:s}=t,{$from:a,$to:l}=i,c=Da(o.extensionManager.attributes,a.node().type.name,a.node().attrs);if(i instanceof En&&i.node.isBlock)return!(!a.parentOffset||!nn(s,a.pos))&&(r&&(e&&Xl(n,o.extensionManager.splittableMarks),t.split(a.pos).scrollIntoView()),!0);if(!a.parent.isBlock)return!1;const d=l.parentOffset===l.parent.content.size,h=0===a.depth?void 0:function(e){for(let t=0;t<e.edgeCount;t+=1){const{type:n}=e.edge(t);if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}(a.node(-1).contentMatchAt(a.indexAfter(-1)));let u=d&&h?[{type:h,attrs:c}]:void 0,p=nn(t.doc,t.mapping.map(a.pos),1,u);if(u||p||!nn(t.doc,t.mapping.map(a.pos),1,h?[{type:h}]:void 0)||(p=!0,u=h?[{type:h,attrs:c}]:void 0),r){if(p&&(i instanceof Tn&&t.deleteSelection(),t.split(t.mapping.map(a.pos),1,u),h&&!d&&!a.parentOffset&&a.parent.type!==h)){const e=t.mapping.map(a.before()),n=t.doc.resolve(e);a.node(-1).canReplaceWith(n.index(),n.index()+1,h)&&t.setNodeMarkup(t.mapping.map(a.before()),h)}e&&Xl(n,o.extensionManager.splittableMarks),t.scrollIntoView()}return p},Zl=(e,t={})=>({tr:n,state:r,dispatch:o,editor:i})=>{var s;const a=ba(e,r.schema),{$from:l,$to:c}=r.selection,d=r.selection.node;if(d&&d.isBlock||l.depth<2||!l.sameParent(c))return!1;const h=l.node(-1);if(h.type!==a)return!1;const u=i.extensionManager.attributes;if(0===l.parent.content.size&&l.node(-1).childCount===l.indexAfter(-1)){if(2===l.depth||l.node(-3).type!==a||l.index(-2)!==l.node(-2).childCount-1)return!1;if(o){let e=Me.empty;const r=l.index(-1)?1:l.index(-2)?2:3;for(let t=l.depth-r;t>=l.depth-3;t-=1)e=Me.from(l.node(t).copy(e));const o=l.indexAfter(-1)<l.node(-2).childCount?1:l.indexAfter(-2)<l.node(-3).childCount?2:3,i={...Da(u,l.node().type.name,l.node().attrs),...t},c=(null==(s=a.contentMatch.defaultType)?void 0:s.createAndFill(i))||void 0;e=e.append(Me.from(a.createAndFill(null,c)||void 0));const d=l.before(l.depth-(r-1));n.replace(d,l.after(-o),new Re(e,4-r,0));let h=-1;n.doc.nodesBetween(d,n.doc.content.size,((e,t)=>{if(h>-1)return!1;e.isTextblock&&0===e.content.size&&(h=t+1)})),h>-1&&n.setSelection(Tn.near(n.doc.resolve(h))),n.scrollIntoView()}return!0}const p=c.pos===l.end()?h.contentMatchAt(0).defaultType:null,f={...Da(u,h.type.name,h.attrs),...t},m={...Da(u,l.node().type.name,l.node().attrs),...t};n.delete(l.pos,c.pos);const g=p?[{type:a,attrs:f},{type:p,attrs:m}]:[{type:a,attrs:f}];if(!nn(n.doc,l.pos,2))return!1;if(o){const{selection:e,storedMarks:t}=r,{splittableMarks:s}=i.extensionManager,a=t||e.$to.parentOffset&&e.$from.marks();if(n.split(l.pos,2,g).scrollIntoView(),!a||!o)return!0;const c=a.filter((e=>s.includes(e.type.name)));n.ensureMarks(c)}return!0},ec=(e,t)=>{const n=ta((e=>e.type===t))(e.selection);if(!n)return!0;const r=e.doc.resolve(Math.max(0,n.pos-1)).before(n.depth);if(void 0===r)return!0;const o=e.doc.nodeAt(r);return n.node.type!==(null==o?void 0:o.type)||!rn(e.doc,n.pos)||(e.join(n.pos),!0)},tc=(e,t)=>{const n=ta((e=>e.type===t))(e.selection);if(!n)return!0;const r=e.doc.resolve(n.start).after(n.depth);if(void 0===r)return!0;const o=e.doc.nodeAt(r);return n.node.type!==(null==o?void 0:o.type)||!rn(e.doc,r)||(e.join(r),!0)},nc=(e,t,n,r={})=>({editor:o,tr:i,state:s,dispatch:a,chain:l,commands:c,can:d})=>{const{extensions:h,splittableMarks:u}=o.extensionManager,p=ba(e,s.schema),f=ba(t,s.schema),{selection:m,storedMarks:g}=s,{$from:y,$to:v}=m,b=y.blockRange(v),x=g||m.$to.parentOffset&&m.$from.marks();if(!b)return!1;const w=ta((e=>za(e.type.name,h)))(m);if(b.depth>=1&&w&&b.depth-w.depth<=1){if(w.node.type===p)return c.liftListItem(f);if(za(w.node.type.name,h)&&p.validContent(w.node.content)&&a)return l().command((()=>(i.setNodeMarkup(w.pos,p),!0))).command((()=>ec(i,p))).command((()=>tc(i,p))).run()}return n&&x&&a?l().command((()=>{const e=d().wrapInList(p,r),t=x.filter((e=>u.includes(e.type.name)));return i.ensureMarks(t),!!e||c.clearNodes()})).wrapInList(p,r).command((()=>ec(i,p))).command((()=>tc(i,p))).run():l().command((()=>!!d().wrapInList(p,r)||c.clearNodes())).wrapInList(p,r).command((()=>ec(i,p))).command((()=>tc(i,p))).run()},rc=(e,t={},n={})=>({state:r,commands:o})=>{const{extendEmptyMarkRange:i=!1}=n,s=ya(e,r.schema);return Ra(r,s,t)?o.unsetMark(s,{extendEmptyMarkRange:i}):o.setMark(s,t)},oc=(e,t,n={})=>({state:r,commands:o})=>{const i=ba(e,r.schema),s=ba(t,r.schema),a=La(r,i,n);let l;return r.selection.$anchor.sameParent(r.selection.$head)&&(l=r.selection.$anchor.parent.attrs),a?o.setNode(s,l):o.setNode(i,{...l,...n})},ic=(e,t={})=>({state:n,commands:r})=>{const o=ba(e,n.schema);return La(n,o,t)?r.lift(o):r.wrapIn(o,t)},sc=()=>({state:e,dispatch:t})=>{const n=e.plugins;for(let r=0;r<n.length;r+=1){const o=n[r];let i;if(o.spec.isInputRules&&(i=o.getState(e))){if(t){const t=e.tr,n=i.transform;for(let e=n.steps.length-1;e>=0;e-=1)t.step(n.steps[e].invert(n.docs[e]));if(i.text){const n=t.doc.resolve(i.from).marks();t.replaceWith(i.from,i.to,e.schema.text(i.text,n))}else t.delete(i.from,i.to)}return!0}}return!1},ac=()=>({tr:e,dispatch:t})=>{const{selection:n}=e,{empty:r,ranges:o}=n;return r||t&&o.forEach((t=>{e.removeMark(t.$from.pos,t.$to.pos)})),!0},lc=(e,t={})=>({tr:n,state:r,dispatch:o})=>{var i;const{extendEmptyMarkRange:s=!1}=t,{selection:a}=n,l=ya(e,r.schema),{$from:c,empty:d,ranges:h}=a;if(!o)return!0;if(d&&s){let{from:e,to:t}=a;const r=null==(i=c.marks().find((e=>e.type===l)))?void 0:i.attrs,o=Oa(c,l,r);o&&(e=o.from,t=o.to),n.removeMark(e,t,l)}else h.forEach((e=>{n.removeMark(e.$from.pos,e.$to.pos,l)}));return n.removeStoredMark(l),!0},cc=(e,t={})=>({tr:n,state:r,dispatch:o})=>{let i=null,s=null;const a=xa("string"==typeof e?e:e.name,r.schema);return!!a&&("node"===a&&(i=ba(e,r.schema)),"mark"===a&&(s=ya(e,r.schema)),o&&n.selection.ranges.forEach((e=>{const o=e.$from.pos,a=e.$to.pos;let l,c,d,h;n.selection.empty?r.doc.nodesBetween(o,a,((e,t)=>{i&&i===e.type&&(d=Math.max(t,o),h=Math.min(t+e.nodeSize,a),l=t,c=e)})):r.doc.nodesBetween(o,a,((e,r)=>{r<o&&i&&i===e.type&&(d=Math.max(r,o),h=Math.min(r+e.nodeSize,a),l=r,c=e),r>=o&&r<=a&&(i&&i===e.type&&n.setNodeMarkup(r,void 0,{...e.attrs,...t}),s&&e.marks.length&&e.marks.forEach((i=>{if(s===i.type){const l=Math.max(r,o),c=Math.min(r+e.nodeSize,a);n.addMark(l,c,s.create({...i.attrs,...t}))}})))})),c&&(void 0!==l&&n.setNodeMarkup(l,void 0,{...c.attrs,...t}),s&&c.marks.length&&c.marks.forEach((e=>{s===e.type&&n.addMark(d,h,s.create({...e.attrs,...t}))})))})),!0)},dc=(e,t={})=>({state:n,dispatch:r})=>function(e,t=null){return function(n,r){let{$from:o,$to:i}=n.selection,s=o.blockRange(i),a=s&&Qt(s,e,t);return!!a&&(r&&r(n.tr.wrap(s,a).scrollIntoView()),!0)}}(ba(e,n.schema),t)(n,r),hc=(e,t={})=>({state:n,dispatch:r})=>_s(ba(e,n.schema),t)(n,r),uc=Za.create({name:"commands",addCommands:()=>({...tl})}),pc=Za.create({name:"delete",onUpdate({transaction:e,appendedTransactions:t}){var n,r,o;const i=()=>{var n,r,o,i;if(null!=(i=null==(o=null==(r=null==(n=this.editor.options.coreExtensionOptions)?void 0:n.delete)?void 0:r.filterTransaction)?void 0:o.call(r,e))?i:e.getMeta("y-sync$"))return;const s=Ys(e.before,[e,...t]);Ca(s).forEach((t=>{s.mapping.mapResult(t.oldRange.from).deletedAfter&&s.mapping.mapResult(t.oldRange.to).deletedBefore&&s.before.nodesBetween(t.oldRange.from,t.oldRange.to,((n,r)=>{const o=r+n.nodeSize-2,i=t.oldRange.from<=r&&o<=t.oldRange.to;this.editor.emit("delete",{type:"node",node:n,from:r,to:o,newFrom:s.mapping.map(r),newTo:s.mapping.map(o),deletedRange:t.oldRange,newRange:t.newRange,partial:!i,editor:this.editor,transaction:e,combinedTransform:s})}))}));const a=s.mapping;s.steps.forEach(((t,n)=>{var r,o;if(t instanceof _t){const i=a.slice(n).map(t.from,-1),l=a.slice(n).map(t.to),c=a.invert().map(i,-1),d=a.invert().map(l),h=null==(r=s.doc.nodeAt(i-1))?void 0:r.marks.some((e=>e.eq(t.mark))),u=null==(o=s.doc.nodeAt(l))?void 0:o.marks.some((e=>e.eq(t.mark)));this.editor.emit("delete",{type:"mark",mark:t.mark,from:t.from,to:t.to,deletedRange:{from:c,to:d},newRange:{from:i,to:l},partial:Boolean(u||h),editor:this.editor,transaction:e,combinedTransform:s})}}))};null==(o=null==(r=null==(n=this.editor.options.coreExtensionOptions)?void 0:n.delete)?void 0:r.async)||o?setTimeout(i,0):i()}}),fc=Za.create({name:"drop",addProseMirrorPlugins(){return[new Hn({key:new Wn("tiptapDrop"),props:{handleDrop:(e,t,n,r)=>{this.editor.emit("drop",{editor:this.editor,event:t,slice:n,moved:r})}}})]}}),mc=Za.create({name:"editable",addProseMirrorPlugins(){return[new Hn({key:new Wn("editable"),props:{editable:()=>this.editor.options.editable}})]}}),gc=new Wn("focusEvents"),yc=Za.create({name:"focusEvents",addProseMirrorPlugins(){const{editor:e}=this;return[new Hn({key:gc,props:{handleDOMEvents:{focus:(t,n)=>{e.isFocused=!0;const r=e.state.tr.setMeta("focus",{event:n}).setMeta("addToHistory",!1);return t.dispatch(r),!1},blur:(t,n)=>{e.isFocused=!1;const r=e.state.tr.setMeta("blur",{event:n}).setMeta("addToHistory",!1);return t.dispatch(r),!1}}}})]}}),vc=Za.create({name:"keymap",addKeyboardShortcuts(){const e=()=>this.editor.commands.first((({commands:e})=>[()=>e.undoInputRule(),()=>e.command((({tr:t})=>{const{selection:n,doc:r}=t,{empty:o,$anchor:i}=n,{pos:s,parent:a}=i,l=i.parent.isTextblock&&s>0?t.doc.resolve(s-1):i,c=l.parent.type.spec.isolating,d=i.pos-i.parentOffset,h=c&&1===l.parent.childCount?d===i.pos:Cn.atStart(r).from===s;return!(!o||!a.type.isTextblock||a.textContent.length||!h||h&&"paragraph"===i.parent.type.name)&&e.clearNodes()})),()=>e.deleteSelection(),()=>e.joinBackward(),()=>e.selectNodeBackward()])),t=()=>this.editor.commands.first((({commands:e})=>[()=>e.deleteSelection(),()=>e.deleteCurrentNode(),()=>e.joinForward(),()=>e.selectNodeForward()])),n={Enter:()=>this.editor.commands.first((({commands:e})=>[()=>e.newlineInCode(),()=>e.createParagraphNear(),()=>e.liftEmptyBlock(),()=>e.splitBlock()])),"Mod-Enter":()=>this.editor.commands.exitCode(),Backspace:e,"Mod-Backspace":e,"Shift-Backspace":e,Delete:t,"Mod-Delete":t,"Mod-a":()=>this.editor.commands.selectAll()},r={...n},o={...n,"Ctrl-h":e,"Alt-Backspace":e,"Ctrl-d":t,"Ctrl-Alt-Backspace":t,"Alt-Delete":t,"Alt-d":t,"Ctrl-a":()=>this.editor.commands.selectTextblockStart(),"Ctrl-e":()=>this.editor.commands.selectTextblockEnd()};return gl()||El()?o:r},addProseMirrorPlugins(){return[new Hn({key:new Wn("clearDocument"),appendTransaction:(e,t,n)=>{if(e.some((e=>e.getMeta("composition"))))return;const r=e.some((e=>e.docChanged))&&!t.doc.eq(n.doc),o=e.some((e=>e.getMeta("preventClearDocument")));if(!r||o)return;const{empty:i,from:s,to:a}=t.selection,l=Cn.atStart(t.doc).from,c=Cn.atEnd(t.doc).to;if(i||!(s===l&&a===c))return;if(!Pa(n.doc))return;const d=n.tr,h=Js({state:n,transaction:d}),{commands:u}=new Us({editor:this.editor,state:h});return u.clearNodes(),d.steps.length?d:void 0}})]}}),bc=Za.create({name:"paste",addProseMirrorPlugins(){return[new Hn({key:new Wn("tiptapPaste"),props:{handlePaste:(e,t,n)=>{this.editor.emit("paste",{editor:this.editor,event:t,slice:n})}}})]}}),xc=Za.create({name:"tabindex",addProseMirrorPlugins(){return[new Hn({key:new Wn("tabindex"),props:{attributes:()=>this.editor.isEditable?{tabindex:"0"}:{}}})]}}),wc=class e{constructor(e,t,n=!1,r=null){this.currentNode=null,this.actualDepth=null,this.isBlock=n,this.resolvedPos=e,this.editor=t,this.currentNode=r}get name(){return this.node.type.name}get node(){return this.currentNode||this.resolvedPos.node()}get element(){return this.editor.view.domAtPos(this.pos).node}get depth(){var e;return null!=(e=this.actualDepth)?e:this.resolvedPos.depth}get pos(){return this.resolvedPos.pos}get content(){return this.node.content}set content(e){let t=this.from,n=this.to;if(this.isBlock){if(0===this.content.size)return void console.error(`You can’t set content on a block node. Tried to set content on ${this.name} at ${this.pos}`);t=this.from+1,n=this.to-1}this.editor.commands.insertContentAt({from:t,to:n},e)}get attributes(){return this.node.attrs}get textContent(){return this.node.textContent}get size(){return this.node.nodeSize}get from(){return this.isBlock?this.pos:this.resolvedPos.start(this.resolvedPos.depth)}get range(){return{from:this.from,to:this.to}}get to(){return this.isBlock?this.pos+this.size:this.resolvedPos.end(this.resolvedPos.depth)+(this.node.isText?0:1)}get parent(){if(0===this.depth)return null;const t=this.resolvedPos.start(this.resolvedPos.depth-1),n=this.resolvedPos.doc.resolve(t);return new e(n,this.editor)}get before(){let t=this.resolvedPos.doc.resolve(this.from-(this.isBlock?1:2));return t.depth!==this.depth&&(t=this.resolvedPos.doc.resolve(this.from-3)),new e(t,this.editor)}get after(){let t=this.resolvedPos.doc.resolve(this.to+(this.isBlock?2:1));return t.depth!==this.depth&&(t=this.resolvedPos.doc.resolve(this.to+3)),new e(t,this.editor)}get children(){const t=[];return this.node.content.forEach(((n,r)=>{const o=n.isBlock&&!n.isTextblock,i=n.isAtom&&!n.isText,s=this.pos+r+(i?0:1);if(s<0||s>this.resolvedPos.doc.nodeSize-2)return;const a=this.resolvedPos.doc.resolve(s);if(!o&&a.depth<=this.depth)return;const l=new e(a,this.editor,o,o?n:null);o&&(l.actualDepth=this.depth+1),t.push(new e(a,this.editor,o,o?n:null))})),t}get firstChild(){return this.children[0]||null}get lastChild(){const e=this.children;return e[e.length-1]||null}closest(e,t={}){let n=null,r=this.parent;for(;r&&!n;){if(r.node.type.name===e)if(Object.keys(t).length>0){const e=r.node.attrs,n=Object.keys(t);for(let r=0;r<n.length;r+=1){const o=n[r];if(e[o]!==t[o])break}}else n=r;r=r.parent}return n}querySelector(e,t={}){return this.querySelectorAll(e,t,!0)[0]||null}querySelectorAll(e,t={},n=!1){let r=[];if(!this.children||0===this.children.length)return r;const o=Object.keys(t);return this.children.forEach((i=>{if(!(n&&r.length>0)){if(i.node.type.name===e){o.every((e=>t[e]===i.node.attrs[e]))&&r.push(i)}n&&r.length>0||(r=r.concat(i.querySelectorAll(e,t,n)))}})),r}setAttribute(e){const{tr:t}=this.editor.state;t.setNodeMarkup(this.from,void 0,{...this.node.attrs,...e}),this.editor.view.dispatch(t)}};var kc=class extends Gs{constructor(e={}){super(),this.css=null,this.editorView=null,this.isFocused=!1,this.isInitialized=!1,this.extensionStorage={},this.instanceId=Math.random().toString(36).slice(2,9),this.options={element:"undefined"!=typeof document?document.createElement("div"):null,content:"",injectCSS:!0,injectNonce:void 0,extensions:[],autofocus:!1,editable:!0,editorProps:{},parseOptions:{},coreExtensionOptions:{},enableInputRules:!0,enablePasteRules:!0,enableCoreExtensions:!0,enableContentCheck:!1,emitContentError:!1,onBeforeCreate:()=>null,onCreate:()=>null,onUpdate:()=>null,onSelectionUpdate:()=>null,onTransaction:()=>null,onFocus:()=>null,onBlur:()=>null,onDestroy:()=>null,onContentError:({error:e})=>{throw e},onPaste:()=>null,onDrop:()=>null,onDelete:()=>null},this.isCapturingTransaction=!1,this.capturedTransaction=null,this.setOptions(e),this.createExtensionManager(),this.createCommandManager(),this.createSchema(),this.on("beforeCreate",this.options.onBeforeCreate),this.emit("beforeCreate",{editor:this}),this.on("contentError",this.options.onContentError),this.on("create",this.options.onCreate),this.on("update",this.options.onUpdate),this.on("selectionUpdate",this.options.onSelectionUpdate),this.on("transaction",this.options.onTransaction),this.on("focus",this.options.onFocus),this.on("blur",this.options.onBlur),this.on("destroy",this.options.onDestroy),this.on("drop",(({event:e,slice:t,moved:n})=>this.options.onDrop(e,t,n))),this.on("paste",(({event:e,slice:t})=>this.options.onPaste(e,t))),this.on("delete",this.options.onDelete);const t=this.createDoc(),n=ja(t,this.options.autofocus);this.editorState=jn.create({doc:t,schema:this.schema,selection:n||void 0}),this.options.element&&this.mount(this.options.element)}mount(e){if("undefined"==typeof document)throw new Error("[tiptap error]: The editor cannot be mounted because there is no 'document' defined in this environment.");this.createView(e),window.setTimeout((()=>{this.isDestroyed||(this.commands.focus(this.options.autofocus),this.emit("create",{editor:this}),this.isInitialized=!0)}),0)}unmount(){var e;if(this.editorView){const e=this.editorView.dom;(null==e?void 0:e.editor)&&delete e.editor,this.editorView.destroy()}this.editorView=null,this.isInitialized=!1,null==(e=this.css)||e.remove(),this.css=null}get storage(){return this.extensionStorage}get commands(){return this.commandManager.commands}chain(){return this.commandManager.chain()}can(){return this.commandManager.can()}injectCSS(){this.options.injectCSS&&"undefined"!=typeof document&&(this.css=function(e,t){const n=document.querySelector("style[data-tiptap-style]");if(null!==n)return n;const r=document.createElement("style");return t&&r.setAttribute("nonce",t),r.setAttribute("data-tiptap-style",""),r.innerHTML=e,document.getElementsByTagName("head")[0].appendChild(r),r}('.ProseMirror {\n position: relative;\n}\n\n.ProseMirror {\n word-wrap: break-word;\n white-space: pre-wrap;\n white-space: break-spaces;\n -webkit-font-variant-ligatures: none;\n font-variant-ligatures: none;\n font-feature-settings: "liga" 0; /* the above doesn\'t seem to work in Edge */\n}\n\n.ProseMirror [contenteditable="false"] {\n white-space: normal;\n}\n\n.ProseMirror [contenteditable="false"] [contenteditable="true"] {\n white-space: pre-wrap;\n}\n\n.ProseMirror pre {\n white-space: pre-wrap;\n}\n\nimg.ProseMirror-separator {\n display: inline !important;\n border: none !important;\n margin: 0 !important;\n width: 0 !important;\n height: 0 !important;\n}\n\n.ProseMirror-gapcursor {\n display: none;\n pointer-events: none;\n position: absolute;\n margin: 0;\n}\n\n.ProseMirror-gapcursor:after {\n content: "";\n display: block;\n position: absolute;\n top: -2px;\n width: 20px;\n border-top: 1px solid black;\n animation: ProseMirror-cursor-blink 1.1s steps(2, start) infinite;\n}\n\n@keyframes ProseMirror-cursor-blink {\n to {\n visibility: hidden;\n }\n}\n\n.ProseMirror-hideselection *::selection {\n background: transparent;\n}\n\n.ProseMirror-hideselection *::-moz-selection {\n background: transparent;\n}\n\n.ProseMirror-hideselection * {\n caret-color: transparent;\n}\n\n.ProseMirror-focused .ProseMirror-gapcursor {\n display: block;\n}',this.options.injectNonce))}setOptions(e={}){this.options={...this.options,...e},this.editorView&&this.state&&!this.isDestroyed&&(this.options.editorProps&&this.view.setProps(this.options.editorProps),this.view.updateState(this.state))}setEditable(e,t=!0){this.setOptions({editable:e}),t&&this.emit("update",{editor:this,transaction:this.state.tr,appendedTransactions:[]})}get isEditable(){return this.options.editable&&this.view&&this.view.editable}get view(){return this.editorView?this.editorView:new Proxy({state:this.editorState,updateState:e=>{this.editorState=e},dispatch:e=>{this.editorState=this.state.apply(e)},composing:!1,dragging:null,editable:!0,isDestroyed:!1},{get:(e,t)=>{if("state"===t)return this.editorState;if(t in e)return Reflect.get(e,t);throw new Error(`[tiptap error]: The editor view is not available. Cannot access view['${t}']. The editor may not be mounted yet.`)}})}get state(){return this.editorView&&(this.editorState=this.view.state),this.editorState}registerPlugin(e,t){const n=ia(t)?t(e,[...this.state.plugins]):[...this.state.plugins,e],r=this.state.reconfigure({plugins:n});return this.view.updateState(r),r}unregisterPlugin(e){if(this.isDestroyed)return;const t=this.state.plugins;let n=t;if([].concat(e).forEach((e=>{const t="string"==typeof e?`${e}$`:e.key;n=n.filter((e=>!e.key.startsWith(t)))})),t.length===n.length)return;const r=this.state.reconfigure({plugins:n});return this.view.updateState(r),r}createExtensionManager(){var e,t;const n=[...this.options.enableCoreExtensions?[mc,el.configure({blockSeparator:null==(t=null==(e=this.options.coreExtensionOptions)?void 0:e.clipboardTextSerializer)?void 0:t.blockSeparator}),uc,yc,vc,xc,fc,bc,pc].filter((e=>"object"!=typeof this.options.enableCoreExtensions||!1!==this.options.enableCoreExtensions[e.name])):[],...this.options.extensions].filter((e=>["extension","node","mark"].includes(null==e?void 0:e.type)));this.extensionManager=new Qa(n,this)}createCommandManager(){this.commandManager=new Us({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createDoc(){let e;try{e=ea(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:this.options.enableContentCheck})}catch(t){if(!(t instanceof Error&&["[tiptap error]: Invalid JSON content","[tiptap error]: Invalid HTML content"].includes(t.message)))throw t;this.emit("contentError",{editor:this,error:t,disableCollaboration:()=>{"collaboration"in this.storage&&"object"==typeof this.storage.collaboration&&this.storage.collaboration&&(this.storage.collaboration.isDisabled=!0),this.options.extensions=this.options.extensions.filter((e=>"collaboration"!==e.name)),this.createExtensionManager()}}),e=ea(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:!1})}return e}createView(e){var t;this.editorView=new rs(e,{...this.options.editorProps,attributes:{role:"textbox",...null==(t=this.options.editorProps)?void 0:t.attributes},dispatchTransaction:this.dispatchTransaction.bind(this),state:this.editorState});const n=this.state.reconfigure({plugins:this.extensionManager.plugins});this.view.updateState(n),this.createNodeViews(),this.prependClass(),this.injectCSS();this.view.dom.editor=this}createNodeViews(){this.view.isDestroyed||this.view.setProps({markViews:this.extensionManager.markViews,nodeViews:this.extensionManager.nodeViews})}prependClass(){this.view.dom.className=`tiptap ${this.view.dom.className}`}captureTransaction(e){this.isCapturingTransaction=!0,e(),this.isCapturingTransaction=!1;const t=this.capturedTransaction;return this.capturedTransaction=null,t}dispatchTransaction(e){if(this.view.isDestroyed)return;if(this.isCapturingTransaction)return this.capturedTransaction?void e.steps.forEach((e=>{var t;return null==(t=this.capturedTransaction)?void 0:t.step(e)})):void(this.capturedTransaction=e);const{state:t,transactions:n}=this.state.applyTransaction(e),r=!this.state.selection.eq(t.selection),o=n.includes(e),i=this.state;if(this.emit("beforeTransaction",{editor:this,transaction:e,nextState:t}),!o)return;this.view.updateState(t),this.emit("transaction",{editor:this,transaction:e,appendedTransactions:n.slice(1)}),r&&this.emit("selectionUpdate",{editor:this,transaction:e});const s=n.findLast((e=>e.getMeta("focus")||e.getMeta("blur"))),a=null==s?void 0:s.getMeta("focus"),l=null==s?void 0:s.getMeta("blur");a&&this.emit("focus",{editor:this,event:a.event,transaction:s}),l&&this.emit("blur",{editor:this,event:l.event,transaction:s}),e.getMeta("preventUpdate")||!n.some((e=>e.docChanged))||i.doc.eq(t.doc)||this.emit("update",{editor:this,transaction:e,appendedTransactions:n.slice(1)})}getAttributes(e){return wa(this.state,e)}isActive(e,t){const n="string"==typeof e?e:null,r="string"==typeof e?t:e;return function(e,t,n={}){if(!t)return La(e,null,n)||Ra(e,null,n);const r=xa(t,e.schema);return"node"===r?La(e,t,n):"mark"===r&&Ra(e,t,n)}(this.state,n,r)}getJSON(){return this.state.doc.toJSON()}getHTML(){return oa(this.state.doc.content,this.schema)}getText(e){const{blockSeparator:t="\n\n",textSerializers:n={}}=e||{};return function(e,t){return ma(e,{from:0,to:e.content.size},t)}(this.state.doc,{blockSeparator:t,textSerializers:{...ga(this.schema),...n}})}get isEmpty(){return Pa(this.state.doc)}destroy(){this.emit("destroy"),this.unmount(),this.removeAllListeners()}get isDestroyed(){var e,t;return null==(t=null==(e=this.editorView)?void 0:e.isDestroyed)||t}$node(e,t){var n;return(null==(n=this.$doc)?void 0:n.querySelector(e,t))||null}$nodes(e,t){var n;return(null==(n=this.$doc)?void 0:n.querySelectorAll(e,t))||null}$pos(e){const t=this.state.doc.resolve(e);return new wc(t,this)}get $doc(){return this.$pos(0)}};function Cc(e){return new Fa({find:e.find,handler:({state:t,range:n,match:r})=>{const o=sa(e.getAttributes,void 0,r);if(!1===o||null===o)return null;const{tr:i}=t,s=r[r.length-1],a=r[0];if(s){const r=a.search(/\S/),l=n.from+a.indexOf(s),c=l+s.length;if(Ea(n.from,n.to,t.doc).filter((t=>t.mark.type.excluded.find((n=>n===e.type&&n!==t.mark.type)))).filter((e=>e.to>l)).length)return null;c<n.to&&i.delete(c,n.to),l>n.from&&i.delete(n.from+r,l);const d=n.from+r+s.length;i.addMark(n.from+r,d,e.type.create(o||{})),i.removeStoredMark(e.type)}}})}function Nc(e){return new Fa({find:e.find,handler:({state:t,range:n,match:r})=>{const o=t.doc.resolve(n.from),i=sa(e.getAttributes,void 0,r)||{};if(!o.node(-1).canReplaceWith(o.index(-1),o.indexAfter(-1),e.type))return null;t.tr.delete(n.from,n.to).setBlockType(n.from,n.from,e.type,i)}})}function Sc(e){return new Fa({find:e.find,handler:({state:t,range:n,match:r,chain:o})=>{const i=sa(e.getAttributes,void 0,r)||{},s=t.tr.delete(n.from,n.to),a=s.doc.resolve(n.from).blockRange(),l=a&&Qt(a,e.type,i);if(!l)return null;if(s.wrap(a,l),e.keepMarks&&e.editor){const{selection:n,storedMarks:r}=t,{splittableMarks:o}=e.editor.extensionManager,i=r||n.$to.parentOffset&&n.$from.marks();if(i){const e=i.filter((e=>o.includes(e.type.name)));s.ensureMarks(e)}}if(e.keepAttributes){const t="bulletList"===e.type.name||"orderedList"===e.type.name?"listItem":"taskList";o().updateAttributes(t,i).run()}const c=s.doc.resolve(n.from-1).nodeBefore;c&&c.type===e.type&&rn(s.doc,n.from-1)&&(!e.joinPredicate||e.joinPredicate(r,c))&&s.join(n.from-1)}})}var Mc=class e extends Ka{constructor(){super(...arguments),this.type="node"}static create(t={}){const n="function"==typeof t?t():t;return new e(n)}configure(e){return super.configure(e)}extend(e){const t="function"==typeof e?e():e;return super.extend(t)}};function Tc(e){return new Ua({find:e.find,handler:({state:t,range:n,match:r,pasteEvent:o})=>{const i=sa(e.getAttributes,void 0,r,o);if(!1===i||null===i)return null;const{tr:s}=t,a=r[r.length-1],l=r[0];let c=n.to;if(a){const r=l.search(/\S/),o=n.from+l.indexOf(a),d=o+a.length;if(Ea(n.from,n.to,t.doc).filter((t=>t.mark.type.excluded.find((n=>n===e.type&&n!==t.mark.type)))).filter((e=>e.to>o)).length)return null;d<n.to&&s.delete(d,n.to),o>n.from&&s.delete(n.from+r,o),c=n.from+r+a.length,s.addMark(n.from+r,c,e.type.create(i||{})),s.removeStoredMark(e.type)}}})}var Oc=(e,t)=>{if("slot"===e)return 0;if(e instanceof Function)return e(t);const{children:n,...r}=null!=t?t:{};if("svg"===e)throw new Error("SVG elements are not supported in the JSX syntax, use the array syntax instead");return[e,r,n]},Ec=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,Ac=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,Dc=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,Rc=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,Lc=Ja.create({name:"bold",addOptions:()=>({HTMLAttributes:{}}),parseHTML(){return[{tag:"strong"},{tag:"b",getAttrs:e=>"normal"!==e.style.fontWeight&&null},{style:"font-weight=400",clearMark:e=>e.type.name===this.name},{style:"font-weight",getAttrs:e=>/^(bold(er)?|[5-9]\d{2,})$/.test(e)&&null}]},renderHTML({HTMLAttributes:e}){return Oc("strong",{...ca(this.options.HTMLAttributes,e),children:Oc("slot",{})})},addCommands(){return{setBold:()=>({commands:e})=>e.setMark(this.name),toggleBold:()=>({commands:e})=>e.toggleMark(this.name),unsetBold:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-b":()=>this.editor.commands.toggleBold(),"Mod-B":()=>this.editor.commands.toggleBold()}},addInputRules(){return[Cc({find:Ec,type:this.type}),Cc({find:Dc,type:this.type})]},addPasteRules(){return[Tc({find:Ac,type:this.type}),Tc({find:Rc,type:this.type})]}}),Ic=Lc,zc=Object.defineProperty,Pc="textStyle",Bc=/^\s*([-+*])\s$/,$c=Mc.create({name:"bulletList",addOptions:()=>({itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}),group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML:()=>[{tag:"ul"}],renderHTML({HTMLAttributes:e}){return["ul",ca(this.options.HTMLAttributes,e),0]},addCommands(){return{toggleBulletList:()=>({commands:e,chain:t})=>this.options.keepAttributes?t().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes("listItem",this.editor.getAttributes(Pc)).run():e.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let e=Sc({find:Bc,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(e=Sc({find:Bc,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(Pc),editor:this.editor})),[e]}}),Vc=Mc.create({name:"listItem",addOptions:()=>({HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}),content:"paragraph block*",defining:!0,parseHTML:()=>[{tag:"li"}],renderHTML({HTMLAttributes:e}){return["li",ca(this.options.HTMLAttributes,e),0]},addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)}}});((e,t)=>{for(var n in t)zc(e,n,{get:t[n],enumerable:!0})})({},{findListItemPos:()=>jc,getNextListDepth:()=>Fc,handleBackspace:()=>Wc,handleDelete:()=>Uc,hasListBefore:()=>Hc,hasListItemAfter:()=>Gc,hasListItemBefore:()=>_c,listItemHasSubList:()=>qc,nextListIsDeeper:()=>Kc,nextListIsHigher:()=>Jc});var jc=(e,t)=>{const{$from:n}=t.selection,r=ba(e,t.schema);let o=null,i=n.depth,s=n.pos,a=null;for(;i>0&&null===a;)o=n.node(i),o.type===r?a=i:(i-=1,s-=1);return null===a?null:{$pos:t.doc.resolve(s),depth:a}},Fc=(e,t)=>{const n=jc(e,t);if(!n)return!1;const[,r]=((e,t,n,r=20)=>{const o=e.doc.resolve(n);let i=r,s=null;for(;i>0&&null===s;){const e=o.node(i);(null==e?void 0:e.type.name)===t?s=e:i-=1}return[s,i]})(t,e,n.$pos.pos+4);return r},Hc=(e,t,n)=>{const{$anchor:r}=e.selection,o=Math.max(0,r.pos-2),i=e.doc.resolve(o).node();return!(!i||!n.includes(i.type.name))},_c=(e,t)=>{var n;const{$anchor:r}=t.selection,o=t.doc.resolve(r.pos-2);return 0!==o.index()&&(null==(n=o.nodeBefore)?void 0:n.type.name)===e},qc=(e,t,n)=>{if(!n)return!1;const r=ba(e,t.schema);let o=!1;return n.descendants((e=>{e.type===r&&(o=!0)})),o},Wc=(e,t,n)=>{if(e.commands.undoInputRule())return!0;if(e.state.selection.from!==e.state.selection.to)return!1;if(!La(e.state,t)&&Hc(e.state,t,n)){const{$anchor:n}=e.state.selection,r=e.state.doc.resolve(n.before()-1),o=[];r.node().descendants(((e,n)=>{e.type.name===t&&o.push({node:e,pos:n})}));const i=o.at(-1);if(!i)return!1;const s=e.state.doc.resolve(r.start()+i.pos+1);return e.chain().cut({from:n.start()-1,to:n.end()+1},s.end()).joinForward().run()}if(!La(e.state,t))return!1;if(!(e=>{const{$from:t,$to:n}=e.selection;return!(t.parentOffset>0||t.pos!==n.pos)})(e.state))return!1;const r=jc(t,e.state);if(!r)return!1;const o=e.state.doc.resolve(r.$pos.pos-2).node(r.depth),i=qc(t,e.state,o);return _c(t,e.state)&&!i?e.commands.joinItemBackward():e.chain().liftListItem(t).run()},Kc=(e,t)=>{const n=Fc(e,t),r=jc(e,t);return!(!r||!n)&&n>r.depth},Jc=(e,t)=>{const n=Fc(e,t),r=jc(e,t);return!(!r||!n)&&n<r.depth},Uc=(e,t)=>{if(!La(e.state,t))return!1;if(!((e,t)=>{const{$from:n,$to:r,$anchor:o}=e.selection;if(t){const n=ta((e=>e.type.name===t))(e.selection);if(!n)return!1;const r=e.doc.resolve(n.pos+1);return o.pos+1===r.end()}return!(r.parentOffset<r.parent.nodeSize-2||n.pos!==r.pos)})(e.state,t))return!1;const{selection:n}=e.state,{$from:r,$to:o}=n;return!(!n.empty&&r.sameParent(o))&&(Kc(t,e.state)?e.chain().focus(e.state.selection.from+4).lift(t).joinBackward().run():Jc(t,e.state)?e.chain().joinForward().joinBackward().run():e.commands.joinItemForward())},Gc=(e,t)=>{var n;const{$anchor:r}=t.selection,o=t.doc.resolve(r.pos-r.parentOffset-2);return o.index()!==o.parent.childCount-1&&(null==(n=o.nodeAfter)?void 0:n.type.name)===e},Yc=Za.create({name:"listKeymap",addOptions:()=>({listTypes:[{itemName:"listItem",wrapperNames:["bulletList","orderedList"]},{itemName:"taskItem",wrapperNames:["taskList"]}]}),addKeyboardShortcuts(){return{Delete:({editor:e})=>{let t=!1;return this.options.listTypes.forEach((({itemName:n})=>{void 0!==e.state.schema.nodes[n]&&Uc(e,n)&&(t=!0)})),t},"Mod-Delete":({editor:e})=>{let t=!1;return this.options.listTypes.forEach((({itemName:n})=>{void 0!==e.state.schema.nodes[n]&&Uc(e,n)&&(t=!0)})),t},Backspace:({editor:e})=>{let t=!1;return this.options.listTypes.forEach((({itemName:n,wrapperNames:r})=>{void 0!==e.state.schema.nodes[n]&&Wc(e,n,r)&&(t=!0)})),t},"Mod-Backspace":({editor:e})=>{let t=!1;return this.options.listTypes.forEach((({itemName:n,wrapperNames:r})=>{void 0!==e.state.schema.nodes[n]&&Wc(e,n,r)&&(t=!0)})),t}}}}),Xc="textStyle",Qc=/^(\d+)\.\s$/,Zc=Mc.create({name:"orderedList",addOptions:()=>({itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}),group:"block list",content(){return`${this.options.itemTypeName}+`},addAttributes:()=>({start:{default:1,parseHTML:e=>e.hasAttribute("start")?parseInt(e.getAttribute("start")||"",10):1},type:{default:null,parseHTML:e=>e.getAttribute("type")}}),parseHTML:()=>[{tag:"ol"}],renderHTML({HTMLAttributes:e}){const{start:t,...n}=e;return 1===t?["ol",ca(this.options.HTMLAttributes,n),0]:["ol",ca(this.options.HTMLAttributes,e),0]},addCommands(){return{toggleOrderedList:()=>({commands:e,chain:t})=>this.options.keepAttributes?t().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes("listItem",this.editor.getAttributes(Xc)).run():e.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let e=Sc({find:Qc,type:this.type,getAttributes:e=>({start:+e[1]}),joinPredicate:(e,t)=>t.childCount+t.attrs.start===+e[1]});return(this.options.keepMarks||this.options.keepAttributes)&&(e=Sc({find:Qc,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes(Xc)}),joinPredicate:(e,t)=>t.childCount+t.attrs.start===+e[1],editor:this.editor})),[e]}}),ed=/^\s*(\[([( |x])?\])\s$/,td=Mc.create({name:"taskItem",addOptions:()=>({nested:!1,HTMLAttributes:{},taskListTypeName:"taskList",a11y:void 0}),content(){return this.options.nested?"paragraph block*":"paragraph+"},defining:!0,addAttributes:()=>({checked:{default:!1,keepOnSplit:!1,parseHTML:e=>{const t=e.getAttribute("data-checked");return""===t||"true"===t},renderHTML:e=>({"data-checked":e.checked})}}),parseHTML(){return[{tag:`li[data-type="${this.name}"]`,priority:51}]},renderHTML({node:e,HTMLAttributes:t}){return["li",ca(this.options.HTMLAttributes,t,{"data-type":this.name}),["label",["input",{type:"checkbox",checked:e.attrs.checked?"checked":null}],["span"]],["div",0]]},addKeyboardShortcuts(){const e={Enter:()=>this.editor.commands.splitListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)};return this.options.nested?{...e,Tab:()=>this.editor.commands.sinkListItem(this.name)}:e},addNodeView(){return({node:e,HTMLAttributes:t,getPos:n,editor:r})=>{const o=document.createElement("li"),i=document.createElement("label"),s=document.createElement("span"),a=document.createElement("input"),l=document.createElement("div"),c=()=>{var t,n;a.ariaLabel=(null==(n=null==(t=this.options.a11y)?void 0:t.checkboxLabel)?void 0:n.call(t,e,a.checked))||`Task item checkbox for ${e.textContent||"empty task item"}`};return c(),i.contentEditable="false",a.type="checkbox",a.addEventListener("mousedown",(e=>e.preventDefault())),a.addEventListener("change",(t=>{if(!r.isEditable&&!this.options.onReadOnlyChecked)return void(a.checked=!a.checked);const{checked:o}=t.target;r.isEditable&&"function"==typeof n&&r.chain().focus(void 0,{scrollIntoView:!1}).command((({tr:e})=>{const t=n();if("number"!=typeof t)return!1;const r=e.doc.nodeAt(t);return e.setNodeMarkup(t,void 0,{...null==r?void 0:r.attrs,checked:o}),!0})).run(),!r.isEditable&&this.options.onReadOnlyChecked&&(this.options.onReadOnlyChecked(e,o)||(a.checked=!a.checked))})),Object.entries(this.options.HTMLAttributes).forEach((([e,t])=>{o.setAttribute(e,t)})),o.dataset.checked=e.attrs.checked,a.checked=e.attrs.checked,i.append(a,s),o.append(i,l),Object.entries(t).forEach((([e,t])=>{o.setAttribute(e,t)})),{dom:o,contentDOM:l,update:e=>e.type===this.type&&(o.dataset.checked=e.attrs.checked,a.checked=e.attrs.checked,c(),!0)}}},addInputRules(){return[Sc({find:ed,type:this.type,getAttributes:e=>({checked:"x"===e[e.length-1]})})]}}),nd=Mc.create({name:"taskList",addOptions:()=>({itemTypeName:"taskItem",HTMLAttributes:{}}),group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:`ul[data-type="${this.name}"]`,priority:51}]},renderHTML({HTMLAttributes:e}){return["ul",ca(this.options.HTMLAttributes,e,{"data-type":this.name}),0]},addCommands(){return{toggleTaskList:()=>({commands:e})=>e.toggleList(this.name,this.options.itemTypeName)}},addKeyboardShortcuts(){return{"Mod-Shift-9":()=>this.editor.commands.toggleTaskList()}}});Za.create({name:"listKit",addExtensions(){const e=[];return!1!==this.options.bulletList&&e.push($c.configure(this.options.bulletList)),!1!==this.options.listItem&&e.push(Vc.configure(this.options.listItem)),!1!==this.options.listKeymap&&e.push(Yc.configure(this.options.listKeymap)),!1!==this.options.orderedList&&e.push(Zc.configure(this.options.orderedList)),!1!==this.options.taskItem&&e.push(td.configure(this.options.taskItem)),!1!==this.options.taskList&&e.push(nd.configure(this.options.taskList)),e}});var rd=$c,od=/(^|[^`])`([^`]+)`(?!`)/,id=/(^|[^`])`([^`]+)`(?!`)/g,sd=Ja.create({name:"code",addOptions:()=>({HTMLAttributes:{}}),excludes:"_",code:!0,exitable:!0,parseHTML:()=>[{tag:"code"}],renderHTML({HTMLAttributes:e}){return["code",ca(this.options.HTMLAttributes,e),0]},addCommands(){return{setCode:()=>({commands:e})=>e.setMark(this.name),toggleCode:()=>({commands:e})=>e.toggleMark(this.name),unsetCode:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-e":()=>this.editor.commands.toggleCode()}},addInputRules(){return[Cc({find:od,type:this.type})]},addPasteRules(){return[Tc({find:id,type:this.type})]}}),ad=sd,ld=/^```([a-z]+)?[\s\n]$/,cd=/^~~~([a-z]+)?[\s\n]$/,dd=Mc.create({name:"codeBlock",addOptions:()=>({languageClassPrefix:"language-",exitOnTripleEnter:!0,exitOnArrowDown:!0,defaultLanguage:null,HTMLAttributes:{}}),content:"text*",marks:"",group:"block",code:!0,defining:!0,addAttributes(){return{language:{default:this.options.defaultLanguage,parseHTML:e=>{var t;const{languageClassPrefix:n}=this.options,r=[...(null==(t=e.firstElementChild)?void 0:t.classList)||[]].filter((e=>e.startsWith(n))).map((e=>e.replace(n,"")))[0];return r||null},rendered:!1}}},parseHTML:()=>[{tag:"pre",preserveWhitespace:"full"}],renderHTML({node:e,HTMLAttributes:t}){return["pre",ca(this.options.HTMLAttributes,t),["code",{class:e.attrs.language?this.options.languageClassPrefix+e.attrs.language:null},0]]},addCommands(){return{setCodeBlock:e=>({commands:t})=>t.setNode(this.name,e),toggleCodeBlock:e=>({commands:t})=>t.toggleNode(this.name,"paragraph",e)}},addKeyboardShortcuts(){return{"Mod-Alt-c":()=>this.editor.commands.toggleCodeBlock(),Backspace:()=>{const{empty:e,$anchor:t}=this.editor.state.selection,n=1===t.pos;return!(!e||t.parent.type.name!==this.name)&&(!(!n&&t.parent.textContent.length)&&this.editor.commands.clearNodes())},Enter:({editor:e})=>{if(!this.options.exitOnTripleEnter)return!1;const{state:t}=e,{selection:n}=t,{$from:r,empty:o}=n;if(!o||r.parent.type!==this.type)return!1;const i=r.parentOffset===r.parent.nodeSize-2,s=r.parent.textContent.endsWith("\n\n");return!(!i||!s)&&e.chain().command((({tr:e})=>(e.delete(r.pos-2,r.pos),!0))).exitCode().run()},ArrowDown:({editor:e})=>{if(!this.options.exitOnArrowDown)return!1;const{state:t}=e,{selection:n,doc:r}=t,{$from:o,empty:i}=n;if(!i||o.parent.type!==this.type)return!1;if(!(o.parentOffset===o.parent.nodeSize-2))return!1;const s=o.after();if(void 0===s)return!1;return r.nodeAt(s)?e.commands.command((({tr:e})=>(e.setSelection(Cn.near(r.resolve(s))),!0))):e.commands.exitCode()}}},addInputRules(){return[Nc({find:ld,type:this.type,getAttributes:e=>({language:e[1]})}),Nc({find:cd,type:this.type,getAttributes:e=>({language:e[1]})})]},addProseMirrorPlugins(){return[new Hn({key:new Wn("codeBlockVSCodeHandler"),props:{handlePaste:(e,t)=>{if(!t.clipboardData)return!1;if(this.editor.isActive(this.type.name))return!1;const n=t.clipboardData.getData("text/plain"),r=t.clipboardData.getData("vscode-editor-data"),o=r?JSON.parse(r):void 0,i=null==o?void 0:o.mode;if(!n||!i)return!1;const{tr:s,schema:a}=e.state,l=a.text(n.replace(/\r\n?/g,"\n"));return s.replaceSelectionWith(this.type.create({language:i},l)),s.selection.$from.parent.type!==this.type&&s.setSelection(Tn.near(s.doc.resolve(Math.max(0,s.selection.from-2)))),s.setMeta("paste",!0),e.dispatch(s),!0}}})]}}),hd=dd,ud=Mc.create({name:"doc",topNode:!0,content:"block+"}),pd=ud,fd=Mc.create({name:"heading",addOptions:()=>({levels:[1,2,3,4,5,6],HTMLAttributes:{}}),content:"inline*",group:"block",defining:!0,addAttributes:()=>({level:{default:1,rendered:!1}}),parseHTML(){return this.options.levels.map((e=>({tag:`h${e}`,attrs:{level:e}})))},renderHTML({node:e,HTMLAttributes:t}){return[`h${this.options.levels.includes(e.attrs.level)?e.attrs.level:this.options.levels[0]}`,ca(this.options.HTMLAttributes,t),0]},addCommands(){return{setHeading:e=>({commands:t})=>!!this.options.levels.includes(e.level)&&t.setNode(this.name,e),toggleHeading:e=>({commands:t})=>!!this.options.levels.includes(e.level)&&t.toggleNode(this.name,"paragraph",e)}},addKeyboardShortcuts(){return this.options.levels.reduce(((e,t)=>({...e,[`Mod-Alt-${t}`]:()=>this.editor.commands.toggleHeading({level:t})})),{})},addInputRules(){return this.options.levels.map((e=>Nc({find:new RegExp(`^(#{${Math.min(...this.options.levels)},${e}})\\s$`),type:this.type,getAttributes:{level:e}})))}}),md=fd,gd=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,yd=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,vd=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,bd=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,xd=Ja.create({name:"italic",addOptions:()=>({HTMLAttributes:{}}),parseHTML(){return[{tag:"em"},{tag:"i",getAttrs:e=>"normal"!==e.style.fontStyle&&null},{style:"font-style=normal",clearMark:e=>e.type.name===this.name},{style:"font-style=italic"}]},renderHTML({HTMLAttributes:e}){return["em",ca(this.options.HTMLAttributes,e),0]},addCommands(){return{setItalic:()=>({commands:e})=>e.setMark(this.name),toggleItalic:()=>({commands:e})=>e.toggleMark(this.name),unsetItalic:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-i":()=>this.editor.commands.toggleItalic(),"Mod-I":()=>this.editor.commands.toggleItalic()}},addInputRules(){return[Cc({find:gd,type:this.type}),Cc({find:vd,type:this.type})]},addPasteRules(){return[Tc({find:yd,type:this.type}),Tc({find:bd,type:this.type})]}}),wd=xd;const kd=(e,t)=>{for(const n in t)e[n]=t[n];return e},Cd="numeric",Nd="ascii",Sd="alpha",Md="asciinumeric",Td="alphanumeric",Od="domain",Ed="emoji",Ad="scheme",Dd="slashscheme",Rd="whitespace";function Ld(e,t){return e in t||(t[e]=[]),t[e]}function Id(e,t,n){t[Cd]&&(t[Md]=!0,t[Td]=!0),t[Nd]&&(t[Md]=!0,t[Sd]=!0),t[Md]&&(t[Td]=!0),t[Sd]&&(t[Td]=!0),t[Td]&&(t[Od]=!0),t[Ed]&&(t[Od]=!0);for(const r in t){const t=Ld(r,n);t.indexOf(e)<0&&t.push(e)}}function zd(e=null){this.j={},this.jr=[],this.jd=null,this.t=e}zd.groups={},zd.prototype={accepts(){return!!this.t},go(e){const t=this,n=t.j[e];if(n)return n;for(let n=0;n<t.jr.length;n++){const r=t.jr[n][0],o=t.jr[n][1];if(o&&r.test(e))return o}return t.jd},has(e,t=!1){return t?e in this.j:!!this.go(e)},ta(e,t,n,r){for(let o=0;o<e.length;o++)this.tt(e[o],t,n,r)},tr(e,t,n,r){let o;return r=r||zd.groups,t&&t.j?o=t:(o=new zd(t),n&&r&&Id(t,n,r)),this.jr.push([e,o]),o},ts(e,t,n,r){let o=this;const i=e.length;if(!i)return o;for(let t=0;t<i-1;t++)o=o.tt(e[t]);return o.tt(e[i-1],t,n,r)},tt(e,t,n,r){r=r||zd.groups;const o=this;if(t&&t.j)return o.j[e]=t,t;const i=t;let s,a=o.go(e);if(a?(s=new zd,kd(s.j,a.j),s.jr.push.apply(s.jr,a.jr),s.jd=a.jd,s.t=a.t):s=new zd,i){if(r)if(s.t&&"string"==typeof s.t){const e=kd(function(e,t){const n={};for(const r in t)t[r].indexOf(e)>=0&&(n[r]=!0);return n}(s.t,r),n);Id(i,e,r)}else n&&Id(i,n,r);s.t=i}return o.j[e]=s,s}};const Pd=(e,t,n,r,o)=>e.ta(t,n,r,o),Bd=(e,t,n,r,o)=>e.tr(t,n,r,o),$d=(e,t,n,r,o)=>e.ts(t,n,r,o),Vd=(e,t,n,r,o)=>e.tt(t,n,r,o),jd="WORD",Fd="UWORD",Hd="ASCIINUMERICAL",_d="ALPHANUMERICAL",qd="LOCALHOST",Wd="TLD",Kd="UTLD",Jd="SCHEME",Ud="SLASH_SCHEME",Gd="NUM",Yd="WS",Xd="NL",Qd="OPENBRACE",Zd="CLOSEBRACE",eh="OPENBRACKET",th="CLOSEBRACKET",nh="OPENPAREN",rh="CLOSEPAREN",oh="OPENANGLEBRACKET",ih="CLOSEANGLEBRACKET",sh="FULLWIDTHLEFTPAREN",ah="FULLWIDTHRIGHTPAREN",lh="LEFTCORNERBRACKET",ch="RIGHTCORNERBRACKET",dh="LEFTWHITECORNERBRACKET",hh="RIGHTWHITECORNERBRACKET",uh="FULLWIDTHLESSTHAN",ph="FULLWIDTHGREATERTHAN",fh="AMPERSAND",mh="APOSTROPHE",gh="ASTERISK",yh="AT",vh="BACKSLASH",bh="BACKTICK",xh="CARET",wh="COLON",kh="COMMA",Ch="DOLLAR",Nh="DOT",Sh="EQUALS",Mh="EXCLAMATION",Th="HYPHEN",Oh="PERCENT",Eh="PIPE",Ah="PLUS",Dh="POUND",Rh="QUERY",Lh="QUOTE",Ih="FULLWIDTHMIDDLEDOT",zh="SEMI",Ph="SLASH",Bh="TILDE",$h="UNDERSCORE",Vh="EMOJI",jh="SYM";var Fh=Object.freeze({__proto__:null,ALPHANUMERICAL:_d,AMPERSAND:fh,APOSTROPHE:mh,ASCIINUMERICAL:Hd,ASTERISK:gh,AT:yh,BACKSLASH:vh,BACKTICK:bh,CARET:xh,CLOSEANGLEBRACKET:ih,CLOSEBRACE:Zd,CLOSEBRACKET:th,CLOSEPAREN:rh,COLON:wh,COMMA:kh,DOLLAR:Ch,DOT:Nh,EMOJI:Vh,EQUALS:Sh,EXCLAMATION:Mh,FULLWIDTHGREATERTHAN:ph,FULLWIDTHLEFTPAREN:sh,FULLWIDTHLESSTHAN:uh,FULLWIDTHMIDDLEDOT:Ih,FULLWIDTHRIGHTPAREN:ah,HYPHEN:Th,LEFTCORNERBRACKET:lh,LEFTWHITECORNERBRACKET:dh,LOCALHOST:qd,NL:Xd,NUM:Gd,OPENANGLEBRACKET:oh,OPENBRACE:Qd,OPENBRACKET:eh,OPENPAREN:nh,PERCENT:Oh,PIPE:Eh,PLUS:Ah,POUND:Dh,QUERY:Rh,QUOTE:Lh,RIGHTCORNERBRACKET:ch,RIGHTWHITECORNERBRACKET:hh,SCHEME:Jd,SEMI:zh,SLASH:Ph,SLASH_SCHEME:Ud,SYM:jh,TILDE:Bh,TLD:Wd,UNDERSCORE:$h,UTLD:Kd,UWORD:Fd,WORD:jd,WS:Yd});const Hh=/[a-z]/,_h=/\p{L}/u,qh=/\p{Emoji}/u,Wh=/\d/,Kh=/\s/;let Jh=null,Uh=null;function Gh(e,t){const n=function(e){const t=[],n=e.length;let r=0;for(;r<n;){let o,i=e.charCodeAt(r),s=i<55296||i>56319||r+1===n||(o=e.charCodeAt(r+1))<56320||o>57343?e[r]:e.slice(r,r+2);t.push(s),r+=s.length}return t}(t.replace(/[A-Z]/g,(e=>e.toLowerCase()))),r=n.length,o=[];let i=0,s=0;for(;s<r;){let a=e,l=null,c=0,d=null,h=-1,u=-1;for(;s<r&&(l=a.go(n[s]));)a=l,a.accepts()?(h=0,u=0,d=a):h>=0&&(h+=n[s].length,u++),c+=n[s].length,i+=n[s].length,s++;i-=h,s-=u,c-=h,o.push({t:d.t,v:t.slice(i-c,i),s:i-c,e:i})}return o}function Yh(e,t,n,r,o){let i;const s=t.length;for(let n=0;n<s-1;n++){const s=t[n];e.j[s]?i=e.j[s]:(i=new zd(r),i.jr=o.slice(),e.j[s]=i),e=i}return i=new zd(n),i.jr=o.slice(),e.j[t[s-1]]=i,i}function Xh(e){const t=[],n=[];let r=0;for(;r<e.length;){let o=0;for(;"0123456789".indexOf(e[r+o])>=0;)o++;if(o>0){t.push(n.join(""));for(let t=parseInt(e.substring(r,r+o),10);t>0;t--)n.pop();r+=o}else n.push(e[r]),r++}return t}const Qh={defaultProtocol:"http",events:null,format:eu,formatHref:eu,nl2br:!1,tagName:"a",target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function Zh(e,t=null){let n=kd({},Qh);e&&(n=kd(n,e instanceof Zh?e.o:e));const r=n.ignoreTags,o=[];for(let e=0;e<r.length;e++)o.push(r[e].toUpperCase());this.o=n,t&&(this.defaultRender=t),this.ignoreTags=o}function eu(e){return e}function tu(e,t){this.t="token",this.v=e,this.tk=t}function nu(e,t){class n extends tu{constructor(t,n){super(t,n),this.t=e}}for(const e in t)n.prototype[e]=t[e];return n.t=e,n}Zh.prototype={o:Qh,ignoreTags:[],defaultRender:e=>e,check(e){return this.get("validate",e.toString(),e)},get(e,t,n){const r=null!=t;let o=this.o[e];return o?("object"==typeof o?(o=n.t in o?o[n.t]:Qh[e],"function"==typeof o&&r&&(o=o(t,n))):"function"==typeof o&&r&&(o=o(t,n.t,n)),o):o},getObj(e,t,n){let r=this.o[e];return"function"==typeof r&&null!=t&&(r=r(t,n.t,n)),r},render(e){const t=e.render(this);return(this.get("render",null,e)||this.defaultRender)(t,e.t,e)}},tu.prototype={isLink:!1,toString(){return this.v},toHref(e){return this.toString()},toFormattedString(e){const t=this.toString(),n=e.get("truncate",t,this),r=e.get("format",t,this);return n&&r.length>n?r.substring(0,n)+"…":r},toFormattedHref(e){return e.get("formatHref",this.toHref(e.get("defaultProtocol")),this)},startIndex(){return this.tk[0].s},endIndex(){return this.tk[this.tk.length-1].e},toObject(e=Qh.defaultProtocol){return{type:this.t,value:this.toString(),isLink:this.isLink,href:this.toHref(e),start:this.startIndex(),end:this.endIndex()}},toFormattedObject(e){return{type:this.t,value:this.toFormattedString(e),isLink:this.isLink,href:this.toFormattedHref(e),start:this.startIndex(),end:this.endIndex()}},validate(e){return e.get("validate",this.toString(),this)},render(e){const t=this,n=this.toHref(e.get("defaultProtocol")),r=e.get("formatHref",n,this),o=e.get("tagName",n,t),i=this.toFormattedString(e),s={},a=e.get("className",n,t),l=e.get("target",n,t),c=e.get("rel",n,t),d=e.getObj("attributes",n,t),h=e.getObj("events",n,t);return s.href=r,a&&(s.class=a),l&&(s.target=l),c&&(s.rel=c),d&&kd(s,d),{tagName:o,attributes:s,content:i,eventListeners:h}}};const ru=nu("email",{isLink:!0,toHref(){return"mailto:"+this.toString()}}),ou=nu("text"),iu=nu("nl"),su=nu("url",{isLink:!0,toHref(e=Qh.defaultProtocol){return this.hasProtocol()?this.v:`${e}://${this.v}`},hasProtocol(){const e=this.tk;return e.length>=2&&e[0].t!==qd&&e[1].t===wh}}),au=e=>new zd(e);function lu(e,t,n){const r=n[0].s,o=n[n.length-1].e;return new e(t.slice(r,o),n)}const cu="undefined"!=typeof console&&console&&console.warn||(()=>{}),du={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1};function hu(e,t=!1){if(du.initialized&&cu(`linkifyjs: already initialized - will not register custom scheme "${e}" until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.`),!/^[0-9a-z]+(-[0-9a-z]+)*$/.test(e))throw new Error('linkifyjs: incorrect scheme format.\n1. Must only contain digits, lowercase ASCII letters or "-"\n2. Cannot start or end with "-"\n3. "-" cannot repeat');du.customSchemes.push([e,t])}function uu(){du.scanner=function(e=[]){const t={};zd.groups=t;const n=new zd;null==Jh&&(Jh=Xh("aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dad1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3nlop4pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2o0dyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3nd0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rckmsd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0america6xi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0stone5umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp3ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5mögensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2olterskluwer11odside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2")),null==Uh&&(Uh=Xh("ελ1υ2бг1ел3дети4ею2католик6ом3мкд2он1сква6онлайн5рг3рус2ф2сайт3рб3укр3қаз3հայ3ישראל5קום3ابوظبي5رامكو5لاردن4بحرين5جزائر5سعودية6عليان5مغرب5مارات5یران5بارت2زار4يتك3ھارت5تونس4سودان3رية5شبكة4عراق2ب2مان4فلسطين6قطر3كاثوليك6وم3مصر2ليسيا5وريتانيا7قع4همراه5پاکستان7ڀارت4कॉम3नेट3भारत0म्3ोत5संगठन5বাংলা5ভারত2ৰত4ਭਾਰਤ4ભારત4ଭାରତ4இந்தியா6லங்கை6சிங்கப்பூர்11భారత్5ಭಾರತ4ഭാരതം5ලංකා4คอม3ไทย3ລາວ3გე2みんな3アマゾン4クラウド4グーグル4コム2ストア3セール3ファッション6ポイント4世界2中信1国1國1文网3亚马逊3企业2佛山2信息2健康2八卦2公司1益2台湾1灣2商城1店1标2嘉里0大酒店5在线2大拿2天主教3娱乐2家電2广东2微博2慈善2我爱你3手机2招聘2政务1府2新加坡2闻2时尚2書籍2机构2淡马锡3游戏2澳門2点看2移动2组织机构4网址1店1站1络2联通2谷歌2购物2通販2集团2電訊盈科4飞利浦3食品2餐厅2香格里拉3港2닷넷1컴2삼성2한국2")),Vd(n,"'",mh),Vd(n,"{",Qd),Vd(n,"}",Zd),Vd(n,"[",eh),Vd(n,"]",th),Vd(n,"(",nh),Vd(n,")",rh),Vd(n,"<",oh),Vd(n,">",ih),Vd(n,"(",sh),Vd(n,")",ah),Vd(n,"「",lh),Vd(n,"」",ch),Vd(n,"『",dh),Vd(n,"』",hh),Vd(n,"<",uh),Vd(n,">",ph),Vd(n,"&",fh),Vd(n,"*",gh),Vd(n,"@",yh),Vd(n,"`",bh),Vd(n,"^",xh),Vd(n,":",wh),Vd(n,",",kh),Vd(n,"$",Ch),Vd(n,".",Nh),Vd(n,"=",Sh),Vd(n,"!",Mh),Vd(n,"-",Th),Vd(n,"%",Oh),Vd(n,"|",Eh),Vd(n,"+",Ah),Vd(n,"#",Dh),Vd(n,"?",Rh),Vd(n,'"',Lh),Vd(n,"/",Ph),Vd(n,";",zh),Vd(n,"~",Bh),Vd(n,"_",$h),Vd(n,"\\",vh),Vd(n,"・",Ih);const r=Bd(n,Wh,Gd,{[Cd]:!0});Bd(r,Wh,r);const o=Bd(r,Hh,Hd,{[Md]:!0}),i=Bd(r,_h,_d,{[Td]:!0}),s=Bd(n,Hh,jd,{[Nd]:!0});Bd(s,Wh,o),Bd(s,Hh,s),Bd(o,Wh,o),Bd(o,Hh,o);const a=Bd(n,_h,Fd,{[Sd]:!0});Bd(a,Hh),Bd(a,Wh,i),Bd(a,_h,a),Bd(i,Wh,i),Bd(i,Hh),Bd(i,_h,i);const l=Vd(n,"\n",Xd,{[Rd]:!0}),c=Vd(n,"\r",Yd,{[Rd]:!0}),d=Bd(n,Kh,Yd,{[Rd]:!0});Vd(n,"",d),Vd(c,"\n",l),Vd(c,"",d),Bd(c,Kh,d),Vd(d,"\r"),Vd(d,"\n"),Bd(d,Kh,d),Vd(d,"",d);const h=Bd(n,qh,Vh,{[Ed]:!0});Vd(h,"#"),Bd(h,qh,h),Vd(h,"️",h);const u=Vd(h,"‍");Vd(u,"#"),Bd(u,qh,h);const p=[[Hh,s],[Wh,o]],f=[[Hh,null],[_h,a],[Wh,i]];for(let e=0;e<Jh.length;e++)Yh(n,Jh[e],Wd,jd,p);for(let e=0;e<Uh.length;e++)Yh(n,Uh[e],Kd,Fd,f);Id(Wd,{tld:!0,ascii:!0},t),Id(Kd,{utld:!0,alpha:!0},t),Yh(n,"file",Jd,jd,p),Yh(n,"mailto",Jd,jd,p),Yh(n,"http",Ud,jd,p),Yh(n,"https",Ud,jd,p),Yh(n,"ftp",Ud,jd,p),Yh(n,"ftps",Ud,jd,p),Id(Jd,{scheme:!0,ascii:!0},t),Id(Ud,{slashscheme:!0,ascii:!0},t),e=e.sort(((e,t)=>e[0]>t[0]?1:-1));for(let t=0;t<e.length;t++){const r=e[t][0],o=e[t][1]?{[Ad]:!0}:{[Dd]:!0};r.indexOf("-")>=0?o[Od]=!0:Hh.test(r)?Wh.test(r)?o[Md]=!0:o[Nd]=!0:o[Cd]=!0,$d(n,r,r,o)}return $d(n,"localhost",qd,{ascii:!0}),n.jd=new zd(jh),{start:n,tokens:kd({groups:t},Fh)}}(du.customSchemes);for(let e=0;e<du.tokenQueue.length;e++)du.tokenQueue[e][1]({scanner:du.scanner});du.parser=function({groups:e}){const t=e.domain.concat([fh,gh,yh,vh,bh,xh,Ch,Sh,Th,Gd,Oh,Eh,Ah,Dh,Ph,jh,Bh,$h]),n=[mh,wh,kh,Nh,Mh,Oh,Rh,Lh,zh,oh,ih,Qd,Zd,th,eh,nh,rh,sh,ah,lh,ch,dh,hh,uh,ph],r=[fh,mh,gh,vh,bh,xh,Ch,Sh,Th,Qd,Zd,Oh,Eh,Ah,Dh,Rh,Ph,jh,Bh,$h],o=au(),i=Vd(o,Bh);Pd(i,r,i),Pd(i,e.domain,i);const s=au(),a=au(),l=au();Pd(o,e.domain,s),Pd(o,e.scheme,a),Pd(o,e.slashscheme,l),Pd(s,r,i),Pd(s,e.domain,s);const c=Vd(s,yh);Vd(i,yh,c),Vd(a,yh,c),Vd(l,yh,c);const d=Vd(i,Nh);Pd(d,r,i),Pd(d,e.domain,i);const h=au();Pd(c,e.domain,h),Pd(h,e.domain,h);const u=Vd(h,Nh);Pd(u,e.domain,h);const p=au(ru);Pd(u,e.tld,p),Pd(u,e.utld,p),Vd(c,qd,p);const f=Vd(h,Th);Vd(f,Th,f),Pd(f,e.domain,h),Pd(p,e.domain,h),Vd(p,Nh,u),Vd(p,Th,f);const m=Vd(p,wh);Pd(m,e.numeric,ru);const g=Vd(s,Th),y=Vd(s,Nh);Vd(g,Th,g),Pd(g,e.domain,s),Pd(y,r,i),Pd(y,e.domain,s);const v=au(su);Pd(y,e.tld,v),Pd(y,e.utld,v),Pd(v,e.domain,s),Pd(v,r,i),Vd(v,Nh,y),Vd(v,Th,g),Vd(v,yh,c);const b=Vd(v,wh),x=au(su);Pd(b,e.numeric,x);const w=au(su),k=au();Pd(w,t,w),Pd(w,n,k),Pd(k,t,w),Pd(k,n,k),Vd(v,Ph,w),Vd(x,Ph,w);const C=Vd(a,wh),N=Vd(l,wh),S=Vd(N,Ph),M=Vd(S,Ph);Pd(a,e.domain,s),Vd(a,Nh,y),Vd(a,Th,g),Pd(l,e.domain,s),Vd(l,Nh,y),Vd(l,Th,g),Pd(C,e.domain,w),Vd(C,Ph,w),Vd(C,Rh,w),Pd(M,e.domain,w),Pd(M,t,w),Vd(M,Ph,w);const T=[[Qd,Zd],[eh,th],[nh,rh],[oh,ih],[sh,ah],[lh,ch],[dh,hh],[uh,ph]];for(let e=0;e<T.length;e++){const[r,o]=T[e],i=Vd(w,r);Vd(k,r,i),Vd(i,o,w);const s=au(su);Pd(i,t,s);const a=au();Pd(i,n),Pd(s,t,s),Pd(s,n,a),Pd(a,t,s),Pd(a,n,a),Vd(s,o,w),Vd(a,o,w)}return Vd(o,qd,v),Vd(o,Xd,iu),{start:o,tokens:Fh}}(du.scanner.tokens);for(let e=0;e<du.pluginQueue.length;e++)du.pluginQueue[e][1]({scanner:du.scanner,parser:du.parser});return du.initialized=!0,du}function pu(e){return du.initialized||uu(),function(e,t,n){let r=n.length,o=0,i=[],s=[];for(;o<r;){let a=e,l=null,c=null,d=0,h=null,u=-1;for(;o<r&&!(l=a.go(n[o].t));)s.push(n[o++]);for(;o<r&&(c=l||a.go(n[o].t));)l=null,a=c,a.accepts()?(u=0,h=a):u>=0&&u++,o++,d++;if(u<0)o-=d,o<r&&(s.push(n[o]),o++);else{s.length>0&&(i.push(lu(ou,t,s)),s=[]),o-=u,d-=u;const e=h.t,r=n.slice(o-d,o);i.push(lu(e,t,r))}}return s.length>0&&i.push(lu(ou,t,s)),i}(du.parser.start,e,Gh(du.scanner.start,e))}function fu(e,t=null,n=null){if(t&&"object"==typeof t){if(n)throw Error(`linkifyjs: Invalid link type ${t}; must be a string`);n=t,t=null}const r=new Zh(n),o=pu(e),i=[];for(let e=0;e<o.length;e++){const n=o[e];!n.isLink||t&&n.t!==t||!r.check(n)||i.push(n.toFormattedObject(r))}return i}pu.scan=Gh;var mu="[\0-   ᠎ -\u2029  ]",gu=new RegExp(mu),yu=new RegExp(`${mu}$`),vu=new RegExp(mu,"g");function bu(e,t){const n=["http","https","ftp","ftps","mailto","tel","callto","sms","cid","xmpp"];return t&&t.forEach((e=>{const t="string"==typeof e?e:e.scheme;t&&n.push(t)})),!e||e.replace(vu,"").match(new RegExp(`^(?:(?:${n.join("|")}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`,"i"))}var xu,wu=Ja.create({name:"link",priority:1e3,keepOnSplit:!1,exitable:!0,onCreate(){this.options.validate&&!this.options.shouldAutoLink&&(this.options.shouldAutoLink=this.options.validate,console.warn("The `validate` option is deprecated. Rename to the `shouldAutoLink` option instead.")),this.options.protocols.forEach((e=>{"string"!=typeof e?hu(e.scheme,e.optionalSlashes):hu(e)}))},onDestroy(){zd.groups={},du.scanner=null,du.parser=null,du.tokenQueue=[],du.pluginQueue=[],du.customSchemes=[],du.initialized=!1},inclusive(){return this.options.autolink},addOptions:()=>({openOnClick:!0,enableClickSelection:!1,linkOnPaste:!0,autolink:!0,protocols:[],defaultProtocol:"http",HTMLAttributes:{target:"_blank",rel:"noopener noreferrer nofollow",class:null},isAllowedUri:(e,t)=>!!bu(e,t.protocols),validate:e=>!!e,shouldAutoLink:e=>!!e}),addAttributes(){return{href:{default:null,parseHTML:e=>e.getAttribute("href")},target:{default:this.options.HTMLAttributes.target},rel:{default:this.options.HTMLAttributes.rel},class:{default:this.options.HTMLAttributes.class}}},parseHTML(){return[{tag:"a[href]",getAttrs:e=>{const t=e.getAttribute("href");return!(!t||!this.options.isAllowedUri(t,{defaultValidate:e=>!!bu(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol}))&&null}}]},renderHTML({HTMLAttributes:e}){return this.options.isAllowedUri(e.href,{defaultValidate:e=>!!bu(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?["a",ca(this.options.HTMLAttributes,e),0]:["a",ca(this.options.HTMLAttributes,{...e,href:""}),0]},addCommands(){return{setLink:e=>({chain:t})=>{const{href:n}=e;return!!this.options.isAllowedUri(n,{defaultValidate:e=>!!bu(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})&&t().setMark(this.name,e).setMeta("preventAutolink",!0).run()},toggleLink:e=>({chain:t})=>{const{href:n}=e||{};return!(n&&!this.options.isAllowedUri(n,{defaultValidate:e=>!!bu(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol}))&&t().toggleMark(this.name,e,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()},unsetLink:()=>({chain:e})=>e().unsetMark(this.name,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()}},addPasteRules(){return[Tc({find:e=>{const t=[];if(e){const{protocols:n,defaultProtocol:r}=this.options,o=fu(e).filter((e=>e.isLink&&this.options.isAllowedUri(e.value,{defaultValidate:e=>!!bu(e,n),protocols:n,defaultProtocol:r})));o.length&&o.forEach((e=>t.push({text:e.value,data:{href:e.href},index:e.start})))}return t},type:this.type,getAttributes:e=>{var t;return{href:null==(t=e.data)?void 0:t.href}}})]},addProseMirrorPlugins(){const e=[],{protocols:t,defaultProtocol:n}=this.options;var r;return this.options.autolink&&e.push((r={type:this.type,defaultProtocol:this.options.defaultProtocol,validate:e=>this.options.isAllowedUri(e,{defaultValidate:e=>!!bu(e,t),protocols:t,defaultProtocol:n}),shouldAutoLink:this.options.shouldAutoLink},new Hn({key:new Wn("autolink"),appendTransaction:(e,t,n)=>{const o=e.some((e=>e.docChanged))&&!t.doc.eq(n.doc),i=e.some((e=>e.getMeta("preventAutolink")));if(!o||i)return;const{tr:s}=n;return Ca(Ys(t.doc,[...e])).forEach((({newRange:e})=>{const t=function(e,t,n){const r=[];return e.nodesBetween(t.from,t.to,((e,t)=>{n(e)&&r.push({node:e,pos:t})})),r}(n.doc,e,(e=>e.isTextblock));let o,i;if(t.length>1)o=t[0],i=n.doc.textBetween(o.pos,o.pos+o.node.nodeSize,void 0," ");else if(t.length){const r=n.doc.textBetween(e.from,e.to," "," ");if(!yu.test(r))return;o=t[0],i=n.doc.textBetween(o.pos,e.to,void 0," ")}if(o&&i){const e=i.split(gu).filter(Boolean);if(e.length<=0)return!1;const t=e[e.length-1],l=o.pos+i.lastIndexOf(t);if(!t)return!1;const c=pu(t).map((e=>e.toObject(r.defaultProtocol)));if(!(1===(a=c).length?a[0].isLink:3===a.length&&a[1].isLink&&["()","[]"].includes(a[0].value+a[2].value)))return!1;c.filter((e=>e.isLink)).map((e=>({...e,from:l+e.start+1,to:l+e.end+1}))).filter((e=>!n.schema.marks.code||!n.doc.rangeHasMark(e.from,e.to,n.schema.marks.code))).filter((e=>r.validate(e.value))).filter((e=>r.shouldAutoLink(e.value))).forEach((e=>{Ea(e.from,e.to,n.doc).some((e=>e.mark.type===r.type))||s.addMark(e.from,e.to,r.type.create({href:e.href}))}))}var a})),s.steps.length?s:void 0}}))),!0===this.options.openOnClick&&e.push(function(e){return new Hn({key:new Wn("handleClickLink"),props:{handleClick:(t,n,r)=>{var o,i;if(0!==r.button)return!1;if(!t.editable)return!1;let s=null;if(r.target instanceof HTMLAnchorElement)s=r.target;else{let e=r.target;const t=[];for(;"DIV"!==e.nodeName;)t.push(e),e=e.parentNode;s=t.find((e=>"A"===e.nodeName))}if(!s)return!1;const a=wa(t.state,e.type.name),l=null!=(o=null==s?void 0:s.href)?o:a.href,c=null!=(i=null==s?void 0:s.target)?i:a.target;return e.enableClickSelection&&e.editor.commands.extendMarkRange(e.type.name),!(!s||!l||(window.open(l,c),0))}}})}({type:this.type,editor:this.editor,enableClickSelection:this.options.enableClickSelection})),this.options.linkOnPaste&&e.push(function(e){return new Hn({key:new Wn("handlePasteLink"),props:{handlePaste:(t,n,r)=>{const{state:o}=t,{selection:i}=o,{empty:s}=i;if(s)return!1;let a="";r.content.forEach((e=>{a+=e.textContent}));const l=fu(a,{defaultProtocol:e.defaultProtocol}).find((e=>e.isLink&&e.value===a));return!(!a||!l)&&e.editor.commands.setMark(e.type,{href:l.href})}}})}({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type})),e}}),ku=wu,Cu=Vc,Nu=Zc,Su=Mc.create({name:"paragraph",priority:1e3,addOptions:()=>({HTMLAttributes:{}}),group:"block",content:"inline*",parseHTML:()=>[{tag:"p"}],renderHTML({HTMLAttributes:e}){return["p",ca(this.options.HTMLAttributes,e),0]},addCommands(){return{setParagraph:()=>({commands:e})=>e.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),Mu=Su,Tu=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,Ou=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,Eu=Ja.create({name:"strike",addOptions:()=>({HTMLAttributes:{}}),parseHTML:()=>[{tag:"s"},{tag:"del"},{tag:"strike"},{style:"text-decoration",consuming:!1,getAttrs:e=>!!e.includes("line-through")&&{}}],renderHTML({HTMLAttributes:e}){return["s",ca(this.options.HTMLAttributes,e),0]},addCommands(){return{setStrike:()=>({commands:e})=>e.setMark(this.name),toggleStrike:()=>({commands:e})=>e.toggleMark(this.name),unsetStrike:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-s":()=>this.editor.commands.toggleStrike()}},addInputRules(){return[Cc({find:Tu,type:this.type})]},addPasteRules(){return[Tc({find:Ou,type:this.type})]}}),Au=Eu,Du=Mc.create({name:"text",group:"inline"}),Ru=Du,Lu=Ja.create({name:"underline",addOptions:()=>({HTMLAttributes:{}}),parseHTML:()=>[{tag:"u"},{style:"text-decoration",consuming:!1,getAttrs:e=>!!e.includes("underline")&&{}}],renderHTML({HTMLAttributes:e}){return["u",ca(this.options.HTMLAttributes,e),0]},addCommands(){return{setUnderline:()=>({commands:e})=>e.setMark(this.name),toggleUnderline:()=>({commands:e})=>e.toggleMark(this.name),unsetUnderline:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-u":()=>this.editor.commands.toggleUnderline(),"Mod-U":()=>this.editor.commands.toggleUnderline()}}}),Iu=Lu,zu={exports:{}},Pu={};var Bu,$u={};
33
33
  /**
34
34
  * @license React
35
35
  * use-sync-external-store-shim.development.js
@@ -38,7 +38,7 @@ var N={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24"
38
38
  *
39
39
  * This source code is licensed under the MIT license found in the
40
40
  * LICENSE file in the root directory of this source tree.
41
- */"production"===process.env.NODE_ENV?Iu.exports=function(){if(bu)return zu;bu=1;var e=r,t="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},n=e.useState,o=e.useEffect,i=e.useLayoutEffect,s=e.useDebugValue;function a(e){var n=e.getSnapshot;e=e.value;try{var r=n();return!t(e,r)}catch(e){return!0}}var l="undefined"==typeof window||void 0===window.document||void 0===window.document.createElement?function(e,t){return t()}:function(e,t){var r=t(),l=n({inst:{value:r,getSnapshot:t}}),c=l[0].inst,d=l[1];return i((function(){c.value=r,c.getSnapshot=t,a(c)&&d({inst:c})}),[e,r,t]),o((function(){return a(c)&&d({inst:c}),e((function(){a(c)&&d({inst:c})}))}),[e]),s(r),r};return zu.useSyncExternalStore=void 0!==e.useSyncExternalStore?e.useSyncExternalStore:l,zu}():Iu.exports=(Pu||(Pu=1,"production"!==process.env.NODE_ENV&&function(){function e(e){var t=e.getSnapshot;e=e.value;try{var r=t();return!n(e,r)}catch(e){return!0}}"undefined"!=typeof __REACT_DEVTOOLS_GLOBAL_HOOK__&&"function"==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var t=r,n="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},o=t.useState,i=t.useEffect,s=t.useLayoutEffect,a=t.useDebugValue,l=!1,c=!1,d="undefined"==typeof window||void 0===window.document||void 0===window.document.createElement?function(e,t){return t()}:function(r,d){l||void 0===t.startTransition||(l=!0,console.error("You are using an outdated, pre-release alpha of React 18 that does not support useSyncExternalStore. The use-sync-external-store shim will not work correctly. Upgrade to a newer pre-release."));var h=d();if(!c){var u=d();n(h,u)||(console.error("The result of getSnapshot should be cached to avoid an infinite loop"),c=!0)}var p=(u=o({inst:{value:h,getSnapshot:d}}))[0].inst,f=u[1];return s((function(){p.value=h,p.getSnapshot=d,e(p)&&f({inst:p})}),[r,h,d]),i((function(){return e(p)&&f({inst:p}),r((function(){e(p)&&f({inst:p})}))}),[r]),a(h),h};Bu.useSyncExternalStore=void 0!==t.useSyncExternalStore?t.useSyncExternalStore:d,"undefined"!=typeof __REACT_DEVTOOLS_GLOBAL_HOOK__&&"function"==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())}()),Bu);var $u,Vu=Iu.exports,ju=function e(t,n){if(t===n)return!0;if(t&&n&&"object"==typeof t&&"object"==typeof n){if(t.constructor!==n.constructor)return!1;var r,o,i;if(Array.isArray(t)){if((r=t.length)!=n.length)return!1;for(o=r;0!==o--;)if(!e(t[o],n[o]))return!1;return!0}if(t instanceof Map&&n instanceof Map){if(t.size!==n.size)return!1;for(o of t.entries())if(!n.has(o[0]))return!1;for(o of t.entries())if(!e(o[1],n.get(o[0])))return!1;return!0}if(t instanceof Set&&n instanceof Set){if(t.size!==n.size)return!1;for(o of t.entries())if(!n.has(o[0]))return!1;return!0}if(ArrayBuffer.isView(t)&&ArrayBuffer.isView(n)){if((r=t.length)!=n.length)return!1;for(o=r;0!==o--;)if(t[o]!==n[o])return!1;return!0}if(t.constructor===RegExp)return t.source===n.source&&t.flags===n.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===n.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===n.toString();if((r=(i=Object.keys(t)).length)!==Object.keys(n).length)return!1;for(o=r;0!==o--;)if(!Object.prototype.hasOwnProperty.call(n,i[o]))return!1;for(o=r;0!==o--;){var s=i[o];if(("_owner"!==s||!t.$$typeof)&&!e(t[s],n[s]))return!1}return!0}return t!=t&&n!=n},Fu=g(ju),Hu={exports:{}},_u={};var qu,Wu={};
41
+ */"production"===process.env.NODE_ENV?zu.exports=function(){if(xu)return Pu;xu=1;var e=r,t="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},n=e.useState,o=e.useEffect,i=e.useLayoutEffect,s=e.useDebugValue;function a(e){var n=e.getSnapshot;e=e.value;try{var r=n();return!t(e,r)}catch(e){return!0}}var l="undefined"==typeof window||void 0===window.document||void 0===window.document.createElement?function(e,t){return t()}:function(e,t){var r=t(),l=n({inst:{value:r,getSnapshot:t}}),c=l[0].inst,d=l[1];return i((function(){c.value=r,c.getSnapshot=t,a(c)&&d({inst:c})}),[e,r,t]),o((function(){return a(c)&&d({inst:c}),e((function(){a(c)&&d({inst:c})}))}),[e]),s(r),r};return Pu.useSyncExternalStore=void 0!==e.useSyncExternalStore?e.useSyncExternalStore:l,Pu}():zu.exports=(Bu||(Bu=1,"production"!==process.env.NODE_ENV&&function(){function e(e){var t=e.getSnapshot;e=e.value;try{var r=t();return!n(e,r)}catch(e){return!0}}"undefined"!=typeof __REACT_DEVTOOLS_GLOBAL_HOOK__&&"function"==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var t=r,n="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},o=t.useState,i=t.useEffect,s=t.useLayoutEffect,a=t.useDebugValue,l=!1,c=!1,d="undefined"==typeof window||void 0===window.document||void 0===window.document.createElement?function(e,t){return t()}:function(r,d){l||void 0===t.startTransition||(l=!0,console.error("You are using an outdated, pre-release alpha of React 18 that does not support useSyncExternalStore. The use-sync-external-store shim will not work correctly. Upgrade to a newer pre-release."));var h=d();if(!c){var u=d();n(h,u)||(console.error("The result of getSnapshot should be cached to avoid an infinite loop"),c=!0)}var p=(u=o({inst:{value:h,getSnapshot:d}}))[0].inst,f=u[1];return s((function(){p.value=h,p.getSnapshot=d,e(p)&&f({inst:p})}),[r,h,d]),i((function(){return e(p)&&f({inst:p}),r((function(){e(p)&&f({inst:p})}))}),[r]),a(h),h};$u.useSyncExternalStore=void 0!==t.useSyncExternalStore?t.useSyncExternalStore:d,"undefined"!=typeof __REACT_DEVTOOLS_GLOBAL_HOOK__&&"function"==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())}()),$u);var Vu,ju=zu.exports,Fu=function e(t,n){if(t===n)return!0;if(t&&n&&"object"==typeof t&&"object"==typeof n){if(t.constructor!==n.constructor)return!1;var r,o,i;if(Array.isArray(t)){if((r=t.length)!=n.length)return!1;for(o=r;0!==o--;)if(!e(t[o],n[o]))return!1;return!0}if(t instanceof Map&&n instanceof Map){if(t.size!==n.size)return!1;for(o of t.entries())if(!n.has(o[0]))return!1;for(o of t.entries())if(!e(o[1],n.get(o[0])))return!1;return!0}if(t instanceof Set&&n instanceof Set){if(t.size!==n.size)return!1;for(o of t.entries())if(!n.has(o[0]))return!1;return!0}if(ArrayBuffer.isView(t)&&ArrayBuffer.isView(n)){if((r=t.length)!=n.length)return!1;for(o=r;0!==o--;)if(t[o]!==n[o])return!1;return!0}if(t.constructor===RegExp)return t.source===n.source&&t.flags===n.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===n.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===n.toString();if((r=(i=Object.keys(t)).length)!==Object.keys(n).length)return!1;for(o=r;0!==o--;)if(!Object.prototype.hasOwnProperty.call(n,i[o]))return!1;for(o=r;0!==o--;){var s=i[o];if(("_owner"!==s||!t.$$typeof)&&!e(t[s],n[s]))return!1}return!0}return t!=t&&n!=n},Hu=g(Fu),_u={exports:{}},qu={};var Wu,Ku={};
42
42
  /**
43
43
  * @license React
44
44
  * use-sync-external-store-shim/with-selector.development.js
@@ -47,5 +47,5 @@ var N={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24"
47
47
  *
48
48
  * This source code is licensed under the MIT license found in the
49
49
  * LICENSE file in the root directory of this source tree.
50
- */"production"===process.env.NODE_ENV?Hu.exports=function(){if($u)return _u;$u=1;var e=r,t=Vu,n="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},o=t.useSyncExternalStore,i=e.useRef,s=e.useEffect,a=e.useMemo,l=e.useDebugValue;return _u.useSyncExternalStoreWithSelector=function(e,t,r,c,d){var h=i(null);if(null===h.current){var u={hasValue:!1,value:null};h.current=u}else u=h.current;h=a((function(){function e(e){if(!s){if(s=!0,o=e,e=c(e),void 0!==d&&u.hasValue){var t=u.value;if(d(t,e))return i=t}return i=e}if(t=i,n(o,e))return t;var r=c(e);return void 0!==d&&d(t,r)?(o=e,t):(o=e,i=r)}var o,i,s=!1,a=void 0===r?null:r;return[function(){return e(t())},null===a?void 0:function(){return e(a())}]}),[t,r,c,d]);var p=o(e,h[0],h[1]);return s((function(){u.hasValue=!0,u.value=p}),[p]),l(p),p},_u}():Hu.exports=(qu||(qu=1,"production"!==process.env.NODE_ENV&&function(){"undefined"!=typeof __REACT_DEVTOOLS_GLOBAL_HOOK__&&"function"==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var e=r,t=Vu,n="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},o=t.useSyncExternalStore,i=e.useRef,s=e.useEffect,a=e.useMemo,l=e.useDebugValue;Wu.useSyncExternalStoreWithSelector=function(e,t,r,c,d){var h=i(null);if(null===h.current){var u={hasValue:!1,value:null};h.current=u}else u=h.current;h=a((function(){function e(e){if(!s){if(s=!0,o=e,e=c(e),void 0!==d&&u.hasValue){var t=u.value;if(d(t,e))return i=t}return i=e}if(t=i,n(o,e))return t;var r=c(e);return void 0!==d&&d(t,r)?(o=e,t):(o=e,i=r)}var o,i,s=!1,a=void 0===r?null:r;return[function(){return e(t())},null===a?void 0:function(){return e(a())}]}),[t,r,c,d]);var p=o(e,h[0],h[1]);return s((function(){u.hasValue=!0,u.value=p}),[p]),l(p),p},"undefined"!=typeof __REACT_DEVTOOLS_GLOBAL_HOOK__&&"function"==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())}()),Wu);var Ku=Hu.exports,Ju=(...e)=>t=>{e.forEach((e=>{"function"==typeof e?e(t):e&&(e.current=t)}))},Uu=({contentComponent:t})=>{const r=Vu.useSyncExternalStore(t.subscribe,t.getSnapshot,t.getServerSnapshot);return e(n,{children:Object.values(r)})};var Gu=class extends r.Component{constructor(e){var t;super(e),this.editorContentRef=r.createRef(),this.initialized=!1,this.state={hasContentComponentInitialized:Boolean(null==(t=e.editor)?void 0:t.contentComponent)}}componentDidMount(){this.init()}componentDidUpdate(){this.init()}init(){const e=this.props.editor;if(e&&!e.isDestroyed&&e.options.element){if(e.contentComponent)return;const t=this.editorContentRef.current;t.append(...e.options.element.childNodes),e.setOptions({element:t}),e.contentComponent=function(){const e=new Set;let t={};return{subscribe:t=>(e.add(t),()=>{e.delete(t)}),getSnapshot:()=>t,getServerSnapshot:()=>t,setRenderer(n,r){t={...t,[n]:m.createPortal(r.reactElement,r.element,n)},e.forEach((e=>e()))},removeRenderer(n){const r={...t};delete r[n],t=r,e.forEach((e=>e()))}}}(),this.state.hasContentComponentInitialized||(this.unsubscribeToContentComponent=e.contentComponent.subscribe((()=>{this.setState((e=>e.hasContentComponentInitialized?e:{hasContentComponentInitialized:!0})),this.unsubscribeToContentComponent&&this.unsubscribeToContentComponent()}))),e.createNodeViews(),this.initialized=!0}}componentWillUnmount(){var e;const t=this.props.editor;if(!t)return;if(this.initialized=!1,t.isDestroyed||t.view.setProps({nodeViews:{}}),this.unsubscribeToContentComponent&&this.unsubscribeToContentComponent(),t.contentComponent=null,!(null==(e=t.options.element)?void 0:e.firstChild))return;const n=document.createElement("div");n.append(...t.options.element.childNodes),t.setOptions({element:n})}render(){const{editor:r,innerRef:o,...i}=this.props;return t(n,{children:[e("div",{ref:Ju(o,this.editorContentRef),...i}),(null==r?void 0:r.contentComponent)&&e(Uu,{contentComponent:r.contentComponent})]})}},Yu=o(((e,t)=>{const n=r.useMemo((()=>Math.floor(4294967295*Math.random()).toString()),[e.editor]);return r.createElement(Gu,{key:n,innerRef:t,...e})})),Xu=r.memo(Yu),Qu="undefined"!=typeof window?h:l,Zu=class{constructor(e){this.transactionNumber=0,this.lastTransactionNumber=0,this.subscribers=new Set,this.editor=e,this.lastSnapshot={editor:e,transactionNumber:0},this.getSnapshot=this.getSnapshot.bind(this),this.getServerSnapshot=this.getServerSnapshot.bind(this),this.watch=this.watch.bind(this),this.subscribe=this.subscribe.bind(this)}getSnapshot(){return this.transactionNumber===this.lastTransactionNumber||(this.lastTransactionNumber=this.transactionNumber,this.lastSnapshot={editor:this.editor,transactionNumber:this.transactionNumber}),this.lastSnapshot}getServerSnapshot(){return{editor:null,transactionNumber:0}}subscribe(e){return this.subscribers.add(e),()=>{this.subscribers.delete(e)}}watch(e){if(this.editor=e,this.editor){const e=()=>{this.transactionNumber+=1,this.subscribers.forEach((e=>e()))},t=this.editor;return t.on("transaction",e),()=>{t.off("transaction",e)}}}};var ep="production"!==process.env.NODE_ENV,tp="undefined"==typeof window,np=tp||Boolean("undefined"!=typeof window&&window.next),rp=class e{constructor(e){this.editor=null,this.subscriptions=new Set,this.isComponentMounted=!1,this.previousDeps=null,this.instanceId="",this.options=e,this.subscriptions=new Set,this.setEditor(this.getInitialEditor()),this.scheduleDestroy(),this.getEditor=this.getEditor.bind(this),this.getServerSnapshot=this.getServerSnapshot.bind(this),this.subscribe=this.subscribe.bind(this),this.refreshEditorInstance=this.refreshEditorInstance.bind(this),this.scheduleDestroy=this.scheduleDestroy.bind(this),this.onRender=this.onRender.bind(this),this.createEditor=this.createEditor.bind(this)}setEditor(e){this.editor=e,this.instanceId=Math.random().toString(36).slice(2,9),this.subscriptions.forEach((e=>e()))}getInitialEditor(){if(void 0===this.options.current.immediatelyRender){if(tp||np){if(ep)throw new Error("Tiptap Error: SSR has been detected, please set `immediatelyRender` explicitly to `false` to avoid hydration mismatches.");return null}return this.createEditor()}if(this.options.current.immediatelyRender&&tp&&ep)throw new Error("Tiptap Error: SSR has been detected, and `immediatelyRender` has been set to `true` this is an unsupported configuration that may result in errors, explicitly set `immediatelyRender` to `false` to avoid hydration mismatches.");return this.options.current.immediatelyRender?this.createEditor():null}createEditor(){const e={...this.options.current,onBeforeCreate:(...e)=>{var t,n;return null==(n=(t=this.options.current).onBeforeCreate)?void 0:n.call(t,...e)},onBlur:(...e)=>{var t,n;return null==(n=(t=this.options.current).onBlur)?void 0:n.call(t,...e)},onCreate:(...e)=>{var t,n;return null==(n=(t=this.options.current).onCreate)?void 0:n.call(t,...e)},onDestroy:(...e)=>{var t,n;return null==(n=(t=this.options.current).onDestroy)?void 0:n.call(t,...e)},onFocus:(...e)=>{var t,n;return null==(n=(t=this.options.current).onFocus)?void 0:n.call(t,...e)},onSelectionUpdate:(...e)=>{var t,n;return null==(n=(t=this.options.current).onSelectionUpdate)?void 0:n.call(t,...e)},onTransaction:(...e)=>{var t,n;return null==(n=(t=this.options.current).onTransaction)?void 0:n.call(t,...e)},onUpdate:(...e)=>{var t,n;return null==(n=(t=this.options.current).onUpdate)?void 0:n.call(t,...e)},onContentError:(...e)=>{var t,n;return null==(n=(t=this.options.current).onContentError)?void 0:n.call(t,...e)},onDrop:(...e)=>{var t,n;return null==(n=(t=this.options.current).onDrop)?void 0:n.call(t,...e)},onPaste:(...e)=>{var t,n;return null==(n=(t=this.options.current).onPaste)?void 0:n.call(t,...e)},onDelete:(...e)=>{var t,n;return null==(n=(t=this.options.current).onDelete)?void 0:n.call(t,...e)}};return new wc(e)}getEditor(){return this.editor}getServerSnapshot(){return null}subscribe(e){return this.subscriptions.add(e),()=>{this.subscriptions.delete(e)}}static compareOptions(e,t){return Object.keys(e).every((n=>!!["onCreate","onBeforeCreate","onDestroy","onUpdate","onTransaction","onFocus","onBlur","onSelectionUpdate","onContentError","onDrop","onPaste"].includes(n)||("extensions"===n&&e.extensions&&t.extensions?e.extensions.length===t.extensions.length&&e.extensions.every(((e,n)=>{var r;return e===(null==(r=t.extensions)?void 0:r[n])})):e[n]===t[n])))}onRender(t){return()=>(this.isComponentMounted=!0,clearTimeout(this.scheduledDestructionTimeout),this.editor&&!this.editor.isDestroyed&&0===t.length?e.compareOptions(this.options.current,this.editor.options)||this.editor.setOptions({...this.options.current,editable:this.editor.isEditable}):this.refreshEditorInstance(t),()=>{this.isComponentMounted=!1,this.scheduleDestroy()})}refreshEditorInstance(e){if(this.editor&&!this.editor.isDestroyed){if(null===this.previousDeps)return void(this.previousDeps=e);if(this.previousDeps.length===e.length&&this.previousDeps.every(((t,n)=>t===e[n])))return}this.editor&&!this.editor.isDestroyed&&this.editor.destroy(),this.setEditor(this.createEditor()),this.previousDeps=e}scheduleDestroy(){const e=this.instanceId,t=this.editor;this.scheduledDestructionTimeout=setTimeout((()=>{this.isComponentMounted&&this.instanceId===e?t&&t.setOptions(this.options.current):t&&!t.isDestroyed&&(t.destroy(),this.instanceId===e&&this.setEditor(null))}),1)}};function op(e={},t=[]){const n=a(e);n.current=e;const[r]=s((()=>new rp(n))),o=Vu.useSyncExternalStore(r.subscribe,r.getEditor,r.getServerSnapshot);return d(o),l(r.onRender(t)),function(e){var t;const[n]=s((()=>new Zu(e.editor))),r=Ku.useSyncExternalStoreWithSelector(n.subscribe,n.getSnapshot,n.getServerSnapshot,e.selector,null!=(t=e.equalityFn)?t:Fu);Qu((()=>n.watch(e.editor)),[e.editor,n]),d(r)}({editor:o,selector:({transactionNumber:t})=>!1===e.shouldRerenderOnTransaction||void 0===e.shouldRerenderOnTransaction?null:e.immediatelyRender&&0===t?0:t+1}),o}u({editor:null}).Consumer;var ip=u({onDragStart:()=>{},nodeViewContentChildren:void 0,nodeViewContentRef:()=>{}});r.forwardRef(((t,n)=>{const{onDragStart:r}=p(ip),o=t.as||"div";return e(o,{...t,ref:n,"data-node-view-wrapper":"",onDragStart:r,style:{whiteSpace:"normal",...t.style}})})),r.createContext({markViewContentRef:()=>{}});var sp=/^\s*>\s$/,ap=Sc.create({name:"blockquote",addOptions:()=>({HTMLAttributes:{}}),content:"block+",group:"block",defining:!0,parseHTML:()=>[{tag:"blockquote"}],renderHTML({HTMLAttributes:e}){return Tc("blockquote",{...la(this.options.HTMLAttributes,e),children:Tc("slot",{})})},addCommands(){return{setBlockquote:()=>({commands:e})=>e.wrapIn(this.name),toggleBlockquote:()=>({commands:e})=>e.toggleWrap(this.name),unsetBlockquote:()=>({commands:e})=>e.lift(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-b":()=>this.editor.commands.toggleBlockquote()}},addInputRules(){return[Nc({find:sp,type:this.type})]}}),lp=Sc.create({name:"hardBreak",addOptions:()=>({keepMarks:!0,HTMLAttributes:{}}),inline:!0,group:"inline",selectable:!1,linebreakReplacement:!0,parseHTML:()=>[{tag:"br"}],renderHTML({HTMLAttributes:e}){return["br",la(this.options.HTMLAttributes,e)]},renderText:()=>"\n",addCommands(){return{setHardBreak:()=>({commands:e,chain:t,state:n,editor:r})=>e.first([()=>e.exitCode(),()=>e.command((()=>{const{selection:e,storedMarks:o}=n;if(e.$from.parent.type.spec.isolating)return!1;const{keepMarks:i}=this.options,{splittableMarks:s}=r.extensionManager,a=o||e.$to.parentOffset&&e.$from.marks();return t().insertContent({type:this.name}).command((({tr:e,dispatch:t})=>{if(t&&a&&i){const t=a.filter((e=>s.includes(e.type.name)));e.ensureMarks(t)}return!0})).run()}))])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}}),cp=Sc.create({name:"horizontalRule",addOptions:()=>({HTMLAttributes:{}}),group:"block",parseHTML:()=>[{tag:"hr"}],renderHTML({HTMLAttributes:e}){return["hr",la(this.options.HTMLAttributes,e)]},addCommands(){return{setHorizontalRule:()=>({chain:e,state:t})=>{if(!function(e,t){const{selection:n}=e,{$from:r}=n;if(n instanceof On){const e=r.index();return r.parent.canReplaceWith(e,e+1,t)}let o=r.depth;for(;o>=0;){const e=r.index(o);if(r.node(o).contentMatchAt(e).matchType(t))return!0;o-=1}return!1}(t,t.schema.nodes[this.name]))return!1;const{selection:n}=t,{$to:r}=n,o=e();return Pa(n)?o.insertContentAt(r.pos,{type:this.name}):o.insertContent({type:this.name}),o.command((({tr:e,dispatch:t})=>{var n;if(t){const{$to:t}=e.selection,r=t.end();if(t.nodeAfter)t.nodeAfter.isTextblock?e.setSelection(Mn.create(e.doc,t.pos+1)):t.nodeAfter.isBlock?e.setSelection(On.create(e.doc,t.pos)):e.setSelection(Mn.create(e.doc,t.pos));else{const o=null==(n=t.parent.type.contentMatch.defaultType)?void 0:n.create();o&&(e.insert(r,o),e.setSelection(Mn.create(e.doc,r+1)))}e.scrollIntoView()}return!0})).run()}}},addInputRules(){return[(e={find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type},new ja({find:e.find,handler:({state:t,range:n,match:r})=>{const o=ia(e.getAttributes,void 0,r)||{},{tr:i}=t,s=n.from;let a=n.to;const l=e.type.create(o);if(r[1]){let e=s+r[0].lastIndexOf(r[1]);e>a?e=a:a=e+r[1].length;const t=r[0][r[0].length-1];i.insertText(t,s+r[0].length-1),i.replaceWith(e,a,l)}else if(r[0]){const t=e.type.isInline?s:s-1;i.insert(t,e.type.create(o)).delete(i.mapping.map(s),i.mapping.map(a))}i.scrollIntoView()}}))];var e}});function dp(e={}){return new Fn({view:t=>new hp(t,e)})}class hp{constructor(e,t){var n;this.editorView=e,this.cursorPos=null,this.element=null,this.timeout=-1,this.width=null!==(n=t.width)&&void 0!==n?n:1,this.color=!1===t.color?void 0:t.color||"black",this.class=t.class,this.handlers=["dragover","dragend","drop","dragleave"].map((t=>{let n=e=>{this[t](e)};return e.dom.addEventListener(t,n),{name:t,handler:n}}))}destroy(){this.handlers.forEach((({name:e,handler:t})=>this.editorView.dom.removeEventListener(e,t)))}update(e,t){null!=this.cursorPos&&t.doc!=e.state.doc&&(this.cursorPos>e.state.doc.content.size?this.setCursor(null):this.updateOverlay())}setCursor(e){e!=this.cursorPos&&(this.cursorPos=e,null==e?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())}updateOverlay(){let e,t=this.editorView.state.doc.resolve(this.cursorPos),n=!t.parent.inlineContent,r=this.editorView.dom,o=r.getBoundingClientRect(),i=o.width/r.offsetWidth,s=o.height/r.offsetHeight;if(n){let n=t.nodeBefore,r=t.nodeAfter;if(n||r){let t=this.editorView.nodeDOM(this.cursorPos-(n?n.nodeSize:0));if(t){let o=t.getBoundingClientRect(),i=n?o.bottom:o.top;n&&r&&(i=(i+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let a=this.width/2*s;e={left:o.left,right:o.right,top:i-a,bottom:i+a}}}}if(!e){let t=this.editorView.coordsAtPos(this.cursorPos),n=this.width/2*i;e={left:t.left-n,right:t.left+n,top:t.top,bottom:t.bottom}}let a,l,c=this.editorView.dom.offsetParent;if(this.element||(this.element=c.appendChild(document.createElement("div")),this.class&&(this.element.className=this.class),this.element.style.cssText="position: absolute; z-index: 50; pointer-events: none;",this.color&&(this.element.style.backgroundColor=this.color)),this.element.classList.toggle("prosemirror-dropcursor-block",n),this.element.classList.toggle("prosemirror-dropcursor-inline",!n),!c||c==document.body&&"static"==getComputedStyle(c).position)a=-pageXOffset,l=-pageYOffset;else{let e=c.getBoundingClientRect(),t=e.width/c.offsetWidth,n=e.height/c.offsetHeight;a=e.left-c.scrollLeft*t,l=e.top-c.scrollTop*n}this.element.style.left=(e.left-a)/i+"px",this.element.style.top=(e.top-l)/s+"px",this.element.style.width=(e.right-e.left)/i+"px",this.element.style.height=(e.bottom-e.top)/s+"px"}scheduleRemoval(e){clearTimeout(this.timeout),this.timeout=setTimeout((()=>this.setCursor(null)),e)}dragover(e){if(!this.editorView.editable)return;let t=this.editorView.posAtCoords({left:e.clientX,top:e.clientY}),n=t&&t.inside>=0&&this.editorView.state.doc.nodeAt(t.inside),r=n&&n.type.spec.disableDropCursor,o="function"==typeof r?r(this.editorView,t,e):r;if(t&&!o){let e=t.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let t=sn(this.editorView.state.doc,e,this.editorView.dragging.slice);null!=t&&(e=t)}this.setCursor(e),this.scheduleRemoval(5e3)}}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(e){this.editorView.dom.contains(e.relatedTarget)||this.setCursor(null)}}class up extends kn{constructor(e){super(e,e)}map(e,t){let n=e.resolve(t.map(this.head));return up.valid(n)?new up(n):kn.near(n)}content(){return De.empty}eq(e){return e instanceof up&&e.head==this.head}toJSON(){return{type:"gapcursor",pos:this.head}}static fromJSON(e,t){if("number"!=typeof t.pos)throw new RangeError("Invalid input for GapCursor.fromJSON");return new up(e.resolve(t.pos))}getBookmark(){return new pp(this.anchor)}static valid(e){let t=e.parent;if(t.isTextblock||!function(e){for(let t=e.depth;t>=0;t--){let n=e.index(t),r=e.node(t);if(0!=n)for(let e=r.child(n-1);;e=e.lastChild){if(0==e.childCount&&!e.inlineContent||e.isAtom||e.type.spec.isolating)return!0;if(e.inlineContent)return!1}else if(r.type.spec.isolating)return!0}return!0}(e)||!function(e){for(let t=e.depth;t>=0;t--){let n=e.indexAfter(t),r=e.node(t);if(n!=r.childCount)for(let e=r.child(n);;e=e.firstChild){if(0==e.childCount&&!e.inlineContent||e.isAtom||e.type.spec.isolating)return!0;if(e.inlineContent)return!1}else if(r.type.spec.isolating)return!0}return!0}(e))return!1;let n=t.type.spec.allowGapCursor;if(null!=n)return n;let r=t.contentMatchAt(e.index()).defaultType;return r&&r.isTextblock}static findGapCursorFrom(e,t,n=!1){e:for(;;){if(!n&&up.valid(e))return e;let r=e.pos,o=null;for(let n=e.depth;;n--){let i=e.node(n);if(t>0?e.indexAfter(n)<i.childCount:e.index(n)>0){o=i.child(t>0?e.indexAfter(n):e.index(n)-1);break}if(0==n)return null;r+=t;let s=e.doc.resolve(r);if(up.valid(s))return s}for(;;){let i=t>0?o.firstChild:o.lastChild;if(!i){if(o.isAtom&&!o.isText&&!On.isSelectable(o)){e=e.doc.resolve(r+o.nodeSize*t),n=!1;continue e}break}o=i,r+=t;let s=e.doc.resolve(r);if(up.valid(s))return s}return null}}}up.prototype.visible=!1,up.findFrom=up.findGapCursorFrom,kn.jsonID("gapcursor",up);class pp{constructor(e){this.pos=e}map(e){return new pp(e.map(this.pos))}resolve(e){let t=e.resolve(this.pos);return up.valid(t)?new up(t):kn.near(t)}}const fp=bs({ArrowLeft:mp("horiz",-1),ArrowRight:mp("horiz",1),ArrowUp:mp("vert",-1),ArrowDown:mp("vert",1)});function mp(e,t){const n="vert"==e?t>0?"down":"up":t>0?"right":"left";return function(e,r,o){let i=e.selection,s=t>0?i.$to:i.$from,a=i.empty;if(i instanceof Mn){if(!o.endOfTextblock(n)||0==s.depth)return!1;a=!1,s=e.doc.resolve(t>0?s.after():s.before())}let l=up.findGapCursorFrom(s,t,a);return!!l&&(r&&r(e.tr.setSelection(new up(l))),!0)}}function gp(e,t,n){if(!e||!e.editable)return!1;let r=e.state.doc.resolve(t);if(!up.valid(r))return!1;let o=e.posAtCoords({left:n.clientX,top:n.clientY});return!(o&&o.inside>-1&&On.isSelectable(e.state.doc.nodeAt(o.inside)))&&(e.dispatch(e.state.tr.setSelection(new up(r))),!0)}function yp(e,t){if("insertCompositionText"!=t.inputType||!(e.state.selection instanceof up))return!1;let{$from:n}=e.state.selection,r=n.parent.contentMatchAt(n.index()).findWrapping(e.state.schema.nodes.text);if(!r)return!1;let o=Se.empty;for(let e=r.length-1;e>=0;e--)o=Se.from(r[e].createAndFill(null,o));let i=e.state.tr.replace(n.pos,n.pos,new De(o,0,0));return i.setSelection(Mn.near(i.doc.resolve(n.pos+1))),e.dispatch(i),!1}function vp(e){if(!(e.selection instanceof up))return null;let t=document.createElement("div");return t.className="ProseMirror-gapcursor",Di.create(e.doc,[Oi.widget(e.selection.head,t,{key:"gapcursor"})])}var bp=200,xp=function(){};xp.prototype.append=function(e){return e.length?(e=xp.from(e),!this.length&&e||e.length<bp&&this.leafAppend(e)||this.length<bp&&e.leafPrepend(this)||this.appendInner(e)):this},xp.prototype.prepend=function(e){return e.length?xp.from(e).append(this):this},xp.prototype.appendInner=function(e){return new kp(this,e)},xp.prototype.slice=function(e,t){return void 0===e&&(e=0),void 0===t&&(t=this.length),e>=t?xp.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,t))},xp.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)},xp.prototype.forEach=function(e,t,n){void 0===t&&(t=0),void 0===n&&(n=this.length),t<=n?this.forEachInner(e,t,n,0):this.forEachInvertedInner(e,t,n,0)},xp.prototype.map=function(e,t,n){void 0===t&&(t=0),void 0===n&&(n=this.length);var r=[];return this.forEach((function(t,n){return r.push(e(t,n))}),t,n),r},xp.from=function(e){return e instanceof xp?e:e&&e.length?new wp(e):xp.empty};var wp=function(e){function t(t){e.call(this),this.values=t}e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t;var n={length:{configurable:!0},depth:{configurable:!0}};return t.prototype.flatten=function(){return this.values},t.prototype.sliceInner=function(e,n){return 0==e&&n==this.length?this:new t(this.values.slice(e,n))},t.prototype.getInner=function(e){return this.values[e]},t.prototype.forEachInner=function(e,t,n,r){for(var o=t;o<n;o++)if(!1===e(this.values[o],r+o))return!1},t.prototype.forEachInvertedInner=function(e,t,n,r){for(var o=t-1;o>=n;o--)if(!1===e(this.values[o],r+o))return!1},t.prototype.leafAppend=function(e){if(this.length+e.length<=bp)return new t(this.values.concat(e.flatten()))},t.prototype.leafPrepend=function(e){if(this.length+e.length<=bp)return new t(e.flatten().concat(this.values))},n.length.get=function(){return this.values.length},n.depth.get=function(){return 0},Object.defineProperties(t.prototype,n),t}(xp);xp.empty=new wp([]);var kp=function(e){function t(t,n){e.call(this),this.left=t,this.right=n,this.length=t.length+n.length,this.depth=Math.max(t.depth,n.depth)+1}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},t.prototype.getInner=function(e){return e<this.left.length?this.left.get(e):this.right.get(e-this.left.length)},t.prototype.forEachInner=function(e,t,n,r){var o=this.left.length;return!(t<o&&!1===this.left.forEachInner(e,t,Math.min(n,o),r))&&(!(n>o&&!1===this.right.forEachInner(e,Math.max(t-o,0),Math.min(this.length,n)-o,r+o))&&void 0)},t.prototype.forEachInvertedInner=function(e,t,n,r){var o=this.left.length;return!(t>o&&!1===this.right.forEachInvertedInner(e,t-o,Math.max(n,o)-o,r+o))&&(!(n<o&&!1===this.left.forEachInvertedInner(e,Math.min(t,o),n,r))&&void 0)},t.prototype.sliceInner=function(e,t){if(0==e&&t==this.length)return this;var n=this.left.length;return t<=n?this.left.slice(e,t):e>=n?this.right.slice(e-n,t-n):this.left.slice(e,n).append(this.right.slice(0,t-n))},t.prototype.leafAppend=function(e){var n=this.right.leafAppend(e);if(n)return new t(this.left,n)},t.prototype.leafPrepend=function(e){var n=this.left.leafPrepend(e);if(n)return new t(n,this.right)},t.prototype.appendInner=function(e){return this.left.depth>=Math.max(this.right.depth,e.depth)+1?new t(this.left,new t(this.right,e)):new t(this,e)},t}(xp);class Cp{constructor(e,t){this.items=e,this.eventCount=t}popEvent(e,t){if(0==this.eventCount)return null;let n,r,o=this.items.length;for(;;o--){if(this.items.get(o-1).selection){--o;break}}t&&(n=this.remapping(o,this.items.length),r=n.maps.length);let i,s,a=e.tr,l=[],c=[];return this.items.forEach(((e,t)=>{if(!e.step)return n||(n=this.remapping(o,t+1),r=n.maps.length),r--,void c.push(e);if(n){c.push(new Np(e.map));let t,o=e.step.map(n.slice(r));o&&a.maybeStep(o).doc&&(t=a.mapping.maps[a.mapping.maps.length-1],l.push(new Np(t,void 0,void 0,l.length+c.length))),r--,t&&n.appendMap(t,r)}else a.maybeStep(e.step);return e.selection?(i=n?e.selection.map(n.slice(r)):e.selection,s=new Cp(this.items.slice(0,o).append(c.reverse().concat(l)),this.eventCount-1),!1):void 0}),this.items.length,0),{remaining:s,transform:a,selection:i}}addTransform(e,t,n,r){let o=[],i=this.eventCount,s=this.items,a=!r&&s.length?s.get(s.length-1):null;for(let n=0;n<e.steps.length;n++){let l,c=e.steps[n].invert(e.docs[n]),d=new Np(e.mapping.maps[n],c,t);(l=a&&a.merge(d))&&(d=l,n?o.pop():s=s.slice(0,s.length-1)),o.push(d),t&&(i++,t=void 0),r||(a=d)}let l=i-n.depth;return l>Mp&&(s=function(e,t){let n;return e.forEach(((e,r)=>{if(e.selection&&0==t--)return n=r,!1})),e.slice(n)}(s,l),i-=l),new Cp(s.append(o),i)}remapping(e,t){let n=new Pt;return this.items.forEach(((t,r)=>{let o=null!=t.mirrorOffset&&r-t.mirrorOffset>=e?n.maps.length-t.mirrorOffset:void 0;n.appendMap(t.map,o)}),e,t),n}addMaps(e){return 0==this.eventCount?this:new Cp(this.items.append(e.map((e=>new Np(e)))),this.eventCount)}rebased(e,t){if(!this.eventCount)return this;let n=[],r=Math.max(0,this.items.length-t),o=e.mapping,i=e.steps.length,s=this.eventCount;this.items.forEach((e=>{e.selection&&s--}),r);let a=t;this.items.forEach((t=>{let r=o.getMirror(--a);if(null==r)return;i=Math.min(i,r);let l=o.maps[r];if(t.step){let i=e.steps[r].invert(e.docs[r]),c=t.selection&&t.selection.map(o.slice(a+1,r));c&&s++,n.push(new Np(l,i,c))}else n.push(new Np(l))}),r);let l=[];for(let e=t;e<i;e++)l.push(new Np(o.maps[e]));let c=this.items.slice(0,r).append(l).append(n),d=new Cp(c,s);return d.emptyItemCount()>500&&(d=d.compress(this.items.length-n.length)),d}emptyItemCount(){let e=0;return this.items.forEach((t=>{t.step||e++})),e}compress(e=this.items.length){let t=this.remapping(0,e),n=t.maps.length,r=[],o=0;return this.items.forEach(((i,s)=>{if(s>=e)r.push(i),i.selection&&o++;else if(i.step){let e=i.step.map(t.slice(n)),s=e&&e.getMap();if(n--,s&&t.appendMap(s,n),e){let a=i.selection&&i.selection.map(t.slice(n));a&&o++;let l,c=new Np(s.invert(),e,a),d=r.length-1;(l=r.length&&r[d].merge(c))?r[d]=l:r.push(c)}}else i.map&&n--}),this.items.length,0),new Cp(xp.from(r.reverse()),o)}}Cp.empty=new Cp(xp.empty,0);class Np{constructor(e,t,n,r){this.map=e,this.step=t,this.selection=n,this.mirrorOffset=r}merge(e){if(this.step&&e.step&&!e.selection){let t=e.step.merge(this.step);if(t)return new Np(t.getMap().invert(),t,this.selection)}}}class Sp{constructor(e,t,n,r,o){this.done=e,this.undone=t,this.prevRanges=n,this.prevTime=r,this.prevComposition=o}}const Mp=20;function Tp(e){let t=[];for(let n=e.length-1;n>=0&&0==t.length;n--)e[n].forEach(((e,n,r,o)=>t.push(r,o)));return t}function Op(e,t){if(!e)return null;let n=[];for(let r=0;r<e.length;r+=2){let o=t.map(e[r],1),i=t.map(e[r+1],-1);o<=i&&n.push(o,i)}return n}let Ep=!1,Ap=null;function Dp(e){let t=e.plugins;if(Ap!=t){Ep=!1,Ap=t;for(let e=0;e<t.length;e++)if(t[e].spec.historyPreserveItems){Ep=!0;break}}return Ep}const Rp=new qn("history"),Lp=new qn("closeHistory");function Ip(e={}){return e={depth:e.depth||100,newGroupDelay:e.newGroupDelay||500},new Fn({key:Rp,state:{init:()=>new Sp(Cp.empty,Cp.empty,null,0,-1),apply:(t,n,r)=>function(e,t,n,r){let o,i=n.getMeta(Rp);if(i)return i.historyState;n.getMeta(Lp)&&(e=new Sp(e.done,e.undone,null,0,-1));let s=n.getMeta("appendedTransaction");if(0==n.steps.length)return e;if(s&&s.getMeta(Rp))return s.getMeta(Rp).redo?new Sp(e.done.addTransform(n,void 0,r,Dp(t)),e.undone,Tp(n.mapping.maps),e.prevTime,e.prevComposition):new Sp(e.done,e.undone.addTransform(n,void 0,r,Dp(t)),null,e.prevTime,e.prevComposition);if(!1===n.getMeta("addToHistory")||s&&!1===s.getMeta("addToHistory"))return(o=n.getMeta("rebased"))?new Sp(e.done.rebased(n,o),e.undone.rebased(n,o),Op(e.prevRanges,n.mapping),e.prevTime,e.prevComposition):new Sp(e.done.addMaps(n.mapping.maps),e.undone.addMaps(n.mapping.maps),Op(e.prevRanges,n.mapping),e.prevTime,e.prevComposition);{let o=n.getMeta("composition"),i=0==e.prevTime||!s&&e.prevComposition!=o&&(e.prevTime<(n.time||0)-r.newGroupDelay||!function(e,t){if(!t)return!1;if(!e.docChanged)return!0;let n=!1;return e.mapping.maps[0].forEach(((e,r)=>{for(let o=0;o<t.length;o+=2)e<=t[o+1]&&r>=t[o]&&(n=!0)})),n}(n,e.prevRanges)),a=s?Op(e.prevRanges,n.mapping):Tp(n.mapping.maps);return new Sp(e.done.addTransform(n,i?t.selection.getBookmark():void 0,r,Dp(t)),Cp.empty,a,n.time,null==o?e.prevComposition:o)}}(n,r,t,e)},config:e,props:{handleDOMEvents:{beforeinput(e,t){let n=t.inputType,r="historyUndo"==n?Pp:"historyRedo"==n?Bp:null;return!!r&&(t.preventDefault(),r(e.state,e.dispatch))}}}})}function zp(e,t){return(n,r)=>{let o=Rp.getState(n);if(!o||0==(e?o.undone:o.done).eventCount)return!1;if(r){let i=function(e,t,n){let r=Dp(t),o=Rp.get(t).spec.config,i=(n?e.undone:e.done).popEvent(t,r);if(!i)return null;let s=i.selection.resolve(i.transform.doc),a=(n?e.done:e.undone).addTransform(i.transform,t.selection.getBookmark(),o,r),l=new Sp(n?a:i.remaining,n?i.remaining:a,null,0,-1);return i.transform.setSelection(s).setMeta(Rp,{redo:n,historyState:l})}(o,n,e);i&&r(t?i.scrollIntoView():i)}return!0}}const Pp=zp(!1,!0),Bp=zp(!0,!0);Qa.create({name:"characterCount",addOptions:()=>({limit:null,mode:"textSize",textCounter:e=>e.length,wordCounter:e=>e.split(" ").filter((e=>""!==e)).length}),addStorage:()=>({characters:()=>0,words:()=>0}),onBeforeCreate(){this.storage.characters=e=>{const t=(null==e?void 0:e.node)||this.editor.state.doc;if("textSize"===((null==e?void 0:e.mode)||this.options.mode)){const e=t.textBetween(0,t.content.size,void 0," ");return this.options.textCounter(e)}return t.nodeSize},this.storage.words=e=>{const t=(null==e?void 0:e.node)||this.editor.state.doc,n=t.textBetween(0,t.content.size," "," ");return this.options.wordCounter(n)}},addProseMirrorPlugins(){let e=!1;return[new Fn({key:new qn("characterCount"),appendTransaction:(t,n,r)=>{if(e)return;const o=this.options.limit;if(null==o||0===o)return void(e=!0);const i=this.storage.characters({node:r.doc});if(i>o){const t=0,n=i-o;console.warn(`[CharacterCount] Initial content exceeded limit of ${o} characters. Content was automatically trimmed.`);const s=r.tr.deleteRange(t,n);return e=!0,s}e=!0},filterTransaction:(e,t)=>{const n=this.options.limit;if(!e.docChanged||0===n||null==n)return!0;const r=this.storage.characters({node:t.doc}),o=this.storage.characters({node:e.doc});if(o<=n)return!0;if(r>n&&o>n&&o<=r)return!0;if(r>n&&o>n&&o>r)return!1;if(!e.getMeta("paste"))return!1;const i=e.selection.$head.pos,s=i-(o-n),a=i;e.deleteRange(s,a);return!(this.storage.characters({node:e.doc})>n)}})]}});var $p=Qa.create({name:"dropCursor",addOptions:()=>({color:"currentColor",width:1,class:void 0}),addProseMirrorPlugins(){return[dp(this.options)]}});Qa.create({name:"focus",addOptions:()=>({className:"has-focus",mode:"all"}),addProseMirrorPlugins(){return[new Fn({key:new qn("focus"),props:{decorations:({doc:e,selection:t})=>{const{isEditable:n,isFocused:r}=this.editor,{anchor:o}=t,i=[];if(!n||!r)return Di.create(e,[]);let s=0;"deepest"===this.options.mode&&e.descendants(((e,t)=>{if(e.isText)return;if(!(o>=t&&o<=t+e.nodeSize-1))return!1;s+=1}));let a=0;return e.descendants(((e,t)=>{if(e.isText)return!1;if(!(o>=t&&o<=t+e.nodeSize-1))return!1;a+=1;if("deepest"===this.options.mode&&s-a>0||"shallowest"===this.options.mode&&a>1)return"deepest"===this.options.mode;i.push(Oi.node(t,t+e.nodeSize,{class:this.options.className}))})),Di.create(e,i)}}})]}});var Vp=Qa.create({name:"gapCursor",addProseMirrorPlugins:()=>[new Fn({props:{decorations:vp,createSelectionBetween:(e,t,n)=>t.pos==n.pos&&up.valid(n)?new up(n):null,handleClick:gp,handleKeyDown:fp,handleDOMEvents:{beforeinput:yp}}})],extendNodeSchema(e){var t;return{allowGapCursor:null!=(t=ia(ta(e,"allowGapCursor",{name:e.name,options:e.options,storage:e.storage})))?t:null}}});function jp({types:e,node:t}){return t&&Array.isArray(e)&&e.includes(t.type)||(null==t?void 0:t.type)===e}Qa.create({name:"placeholder",addOptions:()=>({emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",placeholder:"Write something …",showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}),addProseMirrorPlugins(){return[new Fn({key:new qn("placeholder"),props:{decorations:({doc:e,selection:t})=>{const n=this.editor.isEditable||!this.options.showOnlyWhenEditable,{anchor:r}=t,o=[];if(!n)return null;const i=this.editor.isEmpty;return e.descendants(((e,t)=>{const n=r>=t&&r<=t+e.nodeSize,s=!e.isLeaf&&za(e);if((n||!this.options.showOnlyCurrent)&&s){const r=[this.options.emptyNodeClass];i&&r.push(this.options.emptyEditorClass);const s=Oi.node(t,t+e.nodeSize,{class:r.join(" "),"data-placeholder":"function"==typeof this.options.placeholder?this.options.placeholder({editor:this.editor,node:e,pos:t,hasAnchor:n}):this.options.placeholder});o.push(s)}return this.options.includeChildren})),Di.create(e,o)}}})]}}),Qa.create({name:"selection",addOptions:()=>({className:"selection"}),addProseMirrorPlugins(){const{editor:e,options:t}=this;return[new Fn({key:new qn("selection"),props:{decorations:n=>n.selection.empty||e.isFocused||!e.isEditable||Pa(n.selection)||e.view.dragging?null:Di.create(n.doc,[Oi.inline(n.selection.from,n.selection.to,{class:t.className})])}})]}});var Fp=Qa.create({name:"trailingNode",addOptions:()=>({node:"paragraph",notAfter:[]}),addProseMirrorPlugins(){const e=new qn(this.name),t=Object.entries(this.editor.schema.nodes).map((([,e])=>e)).filter((e=>(this.options.notAfter||[]).concat(this.options.node).includes(e.name)));return[new Fn({key:e,appendTransaction:(t,n,r)=>{const{doc:o,tr:i,schema:s}=r,a=e.getState(r),l=o.content.size,c=s.nodes[this.options.node];if(a)return i.insert(l,c.create())},state:{init:(e,n)=>!jp({node:n.tr.doc.lastChild,types:t}),apply:(e,n)=>{if(!e.docChanged)return n;return!jp({node:e.doc.lastChild,types:t})}}})]}}),Hp=Qa.create({name:"undoRedo",addOptions:()=>({depth:100,newGroupDelay:500}),addCommands:()=>({undo:()=>({state:e,dispatch:t})=>Pp(e,t),redo:()=>({state:e,dispatch:t})=>Bp(e,t)}),addProseMirrorPlugins(){return[Ip(this.options)]},addKeyboardShortcuts(){return{"Mod-z":()=>this.editor.commands.undo(),"Shift-Mod-z":()=>this.editor.commands.redo(),"Mod-y":()=>this.editor.commands.redo(),"Mod-я":()=>this.editor.commands.undo(),"Shift-Mod-я":()=>this.editor.commands.redo()}}}),_p=Qa.create({name:"starterKit",addExtensions(){var e,t,n,r;const o=[];return!1!==this.options.bold&&o.push(Rc.configure(this.options.bold)),!1!==this.options.blockquote&&o.push(ap.configure(this.options.blockquote)),!1!==this.options.bulletList&&o.push(Bc.configure(this.options.bulletList)),!1!==this.options.code&&o.push(id.configure(this.options.code)),!1!==this.options.codeBlock&&o.push(cd.configure(this.options.codeBlock)),!1!==this.options.document&&o.push(hd.configure(this.options.document)),!1!==this.options.dropcursor&&o.push($p.configure(this.options.dropcursor)),!1!==this.options.gapcursor&&o.push(Vp.configure(this.options.gapcursor)),!1!==this.options.hardBreak&&o.push(lp.configure(this.options.hardBreak)),!1!==this.options.heading&&o.push(pd.configure(this.options.heading)),!1!==this.options.undoRedo&&o.push(Hp.configure(this.options.undoRedo)),!1!==this.options.horizontalRule&&o.push(cp.configure(this.options.horizontalRule)),!1!==this.options.italic&&o.push(bd.configure(this.options.italic)),!1!==this.options.listItem&&o.push($c.configure(this.options.listItem)),!1!==this.options.listKeymap&&o.push(Gc.configure(null==(e=this.options)?void 0:e.listKeymap)),!1!==this.options.link&&o.push(xu.configure(null==(t=this.options)?void 0:t.link)),!1!==this.options.orderedList&&o.push(Qc.configure(this.options.orderedList)),!1!==this.options.paragraph&&o.push(Nu.configure(this.options.paragraph)),!1!==this.options.strike&&o.push(Ou.configure(this.options.strike)),!1!==this.options.text&&o.push(Au.configure(this.options.text)),!1!==this.options.underline&&o.push(Ru.configure(null==(n=this.options)?void 0:n.underline)),!1!==this.options.trailingNode&&o.push(Fp.configure(null==(r=this.options)?void 0:r.trailingNode)),o}}),qp=function(n){var r=n.initialContent,o=void 0===r?"":r,i=n.onUpdate,s=op({extensions:[_p.configure({heading:!1,codeBlock:!1}),ud,Su,Du,Lc,xd,Lu,Eu,sd,dd.configure({HTMLAttributes:{class:"bg-gray-100 p-3 rounded text-sm font-mono"}}),fd.configure({levels:[1,2,3]}),nd,Cu,ku,wu.configure({openOnClick:!1,HTMLAttributes:{class:"text-blue-600 underline"}})],content:o,onUpdate:function(e){var t=e.editor;i(t.getHTML())},editorProps:{attributes:{class:"prose prose-sm sm:prose lg:prose-lg xl:prose-2xl mx-auto focus:outline-none min-h-[200px] p-4"}},immediatelyRender:!1});return s?t("div",{className:"rounded-lg border border-gray-200 shadow-sm",children:[t("div",{className:"flex flex-wrap items-center gap-1 border-b bg-gray-50 p-3",children:[e("button",{onClick:function(){return s.chain().focus().undo().run()},className:"p-2 rounded hover:bg-gray-200 transition-colors ".concat(s.can().undo()?"":"opacity-50 cursor-not-allowed"),type:"button",disabled:!s.can().undo(),title:"Undo",children:e(te,{size:16})}),e("button",{onClick:function(){return s.chain().focus().redo().run()},className:"p-2 rounded hover:bg-gray-200 transition-colors ".concat(s.can().redo()?"":"opacity-50 cursor-not-allowed"),type:"button",disabled:!s.can().redo(),title:"Redo",children:e(Y,{size:16})}),e("div",{className:"mx-2 h-6 w-px bg-gray-300"}),e("button",{onClick:function(){return s.chain().focus().toggleHeading({level:1}).run()},className:"p-2 rounded transition-colors ".concat(s.isActive("heading",{level:1})?"bg-blue-200 text-blue-800":"hover:bg-gray-200"),type:"button",title:"Heading 1",children:e(F,{size:16})}),e("button",{onClick:function(){return s.chain().focus().toggleHeading({level:2}).run()},className:"p-2 rounded transition-colors ".concat(s.isActive("heading",{level:2})?"bg-blue-200 text-blue-800":"hover:bg-gray-200"),type:"button",title:"Heading 2",children:e(H,{size:16})}),e("button",{onClick:function(){return s.chain().focus().toggleHeading({level:3}).run()},className:"p-2 rounded transition-colors ".concat(s.isActive("heading",{level:3})?"bg-blue-200 text-blue-800":"hover:bg-gray-200"),type:"button",title:"Heading 3",children:e(_,{size:16})}),e(X,{className:"mx-2 h-6 w-px bg-gray-300"}),e("button",{onClick:function(){return s.chain().focus().toggleBold().run()},className:"p-2 rounded transition-colors ".concat(s.isActive("bold")?"bg-blue-200 text-blue-800":"hover:bg-gray-200"),type:"button",title:"Bold",children:e(T,{size:16})}),e("button",{onClick:function(){return s.chain().focus().toggleItalic().run()},className:"p-2 rounded transition-colors ".concat(s.isActive("italic")?"bg-blue-200 text-blue-800":"hover:bg-gray-200"),type:"button",title:"Italic",children:e(W,{size:16})}),e("button",{onClick:function(){return s.chain().focus().toggleUnderline().run()},className:"p-2 rounded transition-colors ".concat(s.isActive("underline")?"bg-blue-200 text-blue-800":"hover:bg-gray-200"),type:"button",title:"Underline",children:e(ee,{size:16})}),e("button",{onClick:function(){return s.chain().focus().toggleStrike().run()},className:"p-2 rounded transition-colors ".concat(s.isActive("strike")?"bg-blue-200 text-blue-800":"hover:bg-gray-200"),type:"button",title:"Strikethrough",children:e(Q,{size:16})}),e(X,{className:"mx-2 h-6 w-px bg-gray-300"}),e("button",{onClick:function(){return s.chain().focus().toggleBulletList().run()},className:"p-2 rounded transition-colors ".concat(s.isActive("bulletList")?"bg-blue-200 text-blue-800":"hover:bg-gray-200"),type:"button",title:"Bullet List",children:e(U,{size:16})}),e("button",{onClick:function(){return s.chain().focus().toggleOrderedList().run()},className:"p-2 rounded transition-colors ".concat(s.isActive("orderedList")?"bg-blue-200 text-blue-800":"hover:bg-gray-200"),type:"button",title:"Numbered List",children:e(J,{size:16})}),e(X,{className:"mx-2 h-6 w-px bg-gray-300"}),e("button",{onClick:function(){return s.chain().focus().toggleCode().run()},className:"p-2 rounded transition-colors ".concat(s.isActive("code")?"bg-blue-200 text-blue-800":"hover:bg-gray-200"),type:"button",title:"Inline Code",children:e(I,{size:16})}),e("button",{onClick:function(){return s.chain().focus().toggleCodeBlock().run()},className:"p-2 rounded transition-colors ".concat(s.isActive("codeBlock")?"bg-blue-200 text-blue-800":"hover:bg-gray-200"),type:"button",title:"Code Block",children:e(B,{size:16})}),e(X,{className:"mx-2 h-6 w-px bg-gray-300"}),e("button",{onClick:function(){return s.chain().focus().toggleBlockquote().run()},className:"p-2 rounded transition-colors ".concat(s.isActive("blockquote")?"bg-blue-200 text-blue-800":"hover:bg-gray-200"),type:"button",title:"Quote",children:e(G,{size:16})}),e(X,{className:"mx-2 h-6 w-px bg-gray-300"}),s.isActive("link")?e("button",{onClick:function(){null==s||s.chain().focus().unsetLink().run()},className:"p-2 rounded bg-blue-200 text-blue-800 hover:bg-blue-300 transition-colors",type:"button",title:"Remove Link",children:e(K,{size:16})}):e("button",{onClick:function(){var e=window.prompt("Enter URL:");e&&(null==s||s.chain().focus().setLink({href:e}).run())},className:"p-2 rounded hover:bg-gray-200 transition-colors",type:"button",title:"Add Link",children:e(K,{size:16})})]}),e(Xu,{editor:s,className:"min-h-[300px] focus-within:bg-white"})]}):e("div",{className:"rounded-lg border bg-gray-50 h-48 animate-pulse"})};function Wp(n){var r=n.options,o=n.placeholder,i=void 0===o?"Select an option":o,a=n.onChange,l=n.value,c=n.size,d=void 0===c?"md":c,h=n.className,u=void 0===h?"":h,p=n.name,f=n.id,m=n.disabled,g=void 0!==m&&m,y=n.label,v=n.required,b=s(!1),x=b[0],w=b[1],k=s(l&&r.find((function(e){return e.value===l}))||null),C=k[0],N=k[1];return t("div",{className:"relative inline-block",children:[y&&t("label",{htmlFor:f,className:"mb-1 block text-sm font-medium text-gray-700",children:[y,v&&e("span",{className:"ml-1 text-red-500",children:"*"})]}),t("button",{type:"button",className:"flex w-full items-center justify-between rounded-md border border-gray-200 bg-white shadow-sm ".concat({sm:"px-3 py-2 text-sm",md:"px-4 py-2.5 text-base"}[d]," text-gray-700 hover:bg-gray-50 focus:outline-none ").concat(g?"cursor-not-allowed opacity-50":""," ").concat(u),onClick:function(){return!g&&w(!x)},disabled:g,id:f,children:[e("span",{className:"truncate",children:C?(null==C?void 0:C.label)||C.value:i}),e(E,{className:"ml-2 h-4 w-4 ".concat(x?"rotate-180 transform":"")})]}),x&&e("div",{className:"absolute z-10 mt-1 max-h-60 w-full min-w-[200px] p-1 font-medium text-sm overflow-auto rounded-lg bg-white shadow-xl",children:r.map((function(n){return t("div",{className:"cursor-pointer px-3 py-2 hover:bg-gray-100 rounded-lg flex justify-between item-center ".concat((null==C?void 0:C.value)===n.value?"bg-gray-50 text-black":"text-gray-900"),onClick:function(){return function(e){N(e),a(e.value),w(!1)}(n)},children:[e("div",{children:n.label||n.value}),(null==C?void 0:C.value)===n.value&&e("div",{children:e(O,{size:15,className:"text-primary"})})]},n.value)}))}),p&&e("input",{type:"hidden",name:p,value:(null==C?void 0:C.value)||""})]})}var Kp=function(n){var r=n.message,o=n.description,i=n.type,a=void 0===i?"info":i,c=n.duration,d=void 0===c?5e3:c,h=n.onClose,u=s(!0),p=u[0],f=u[1],m=s(100),g=m[0],y=m[1],v={success:{icon:e(R,{className:"h-5 w-5"}),bgColor:"bg-green-50",borderColor:"border-green-300",textColor:"text-green-800",iconColor:"text-green-500",progressColor:"bg-green-500"},error:{icon:e(D,{className:"h-5 w-5"}),bgColor:"bg-rose-50",borderColor:"border-rose-300",textColor:"text-rose-800",iconColor:"text-rose-500",progressColor:"bg-rose-500"},info:{icon:e(q,{className:"h-5 w-5"}),bgColor:"bg-blue-50",borderColor:"border-blue-300",textColor:"text-blue-800",iconColor:"text-blue-500",progressColor:"bg-blue-500"},warning:{icon:e(Z,{className:"h-5 w-5"}),bgColor:"bg-amber-50 ",borderColor:"border-amber-300 ",textColor:"text-amber-800",iconColor:"text-amber-500",progressColor:"bg-amber-500"}};l((function(){var e=setTimeout((function(){f(!1),setTimeout((function(){null==h||h()}),300)}),d),t=setInterval((function(){y((function(e){var t=e-100/(d/100);return t<=0?0:t}))}),100);return function(){clearTimeout(e),clearInterval(t)}}),[d,h]);var b=v[a],x=b.icon,w=b.bgColor,k=b.borderColor,C=b.textColor,N=b.iconColor,S=b.progressColor;return e("div",{className:"fixed right-4 top-4 z-50 transform transition-all duration-300 ".concat(p?"translate-x-0 opacity-100":"translate-x-full opacity-0"),children:t("div",{className:"flex w-72 rounded-lg border shadow-lg md:w-96 ".concat(k," ").concat(w," p-4"),children:[e("div",{className:"flex-shrink-0 ".concat(N),children:x}),t("div",{className:"ml-3 w-full",children:[t("div",{className:"flex items-start justify-between",children:[e("div",{className:"text-md font-semibold ".concat(C),children:r}),e("button",{onClick:function(){f(!1),setTimeout((function(){null==h||h()}),300)},className:"text-gray-600 hover:text-gray-600 focus:outline-none",children:e(ne,{className:"h-4 w-4"})})]}),o&&e("p",{className:"mt-1 text-sm ".concat(C," opacity-80"),children:o}),e("div",{className:"mt-2 h-1 w-full rounded-full bg-gray-200",children:e("div",{className:"".concat(S," h-1 rounded-full transition-all duration-100 ease-linear"),style:{width:"".concat(g,"%")}})})]})]})})},Jp=null,Up=u(void 0),Gp=function(n){var r=n.children,o=s([]),i=o[0],a=o[1],l=f((function(e){a((function(t){return t.filter((function(t){return t.id!==e}))}))}),[]),c=f((function(e){var t=Math.random().toString(36).substring(2,9),n=ae(ae({},e),{id:t,onClose:function(){return l(t)}});a((function(e){return ce(ce([],e,!0),[n],!1)}))}),[l]),d=f((function(e){return function(t,n){c({message:t,description:n,type:e})}}),[c]),h={showAlert:c,success:d("success"),error:d("error"),info:d("info"),warning:d("warning")};return Jp=h,t(Up.Provider,{value:h,children:[r,e("div",{className:"fixed right-4 top-4 z-50 space-y-2 w-full max-w-xs",children:i.map((function(t,n){return e("div",{style:{transform:"translateY(".concat(10*n,"px)"),zIndex:50-n},children:e(Kp,ae({},t))},t.id)}))})]})},Yp=function(){var e=p(Up);if(void 0===e)throw new Error("useAlert must be used within a AlertProvider");return e},Xp={success:function(e,t){Jp?Jp.success(e,t):console.warn("AlertProvider not mounted yet")},error:function(e,t){Jp?Jp.error(e,t):console.warn("AlertProvider not mounted yet")},info:function(e,t){Jp?Jp.info(e,t):console.warn("AlertProvider not mounted yet")},warning:function(e,t){Jp?Jp.warning(e,t):console.warn("AlertProvider not mounted yet")},show:function(e){Jp?Jp.showAlert(e):console.warn("AlertProvider not mounted yet")}},Qp=function(n){var r=n.isOpen,o=n.onConfirm,i=n.onCancel,s=n.title,c=n.message,d=n.confirmText,h=void 0===d?"Confirm":d,u=n.cancelText,p=void 0===u?"Cancel":u,f=n.type,m=void 0===f?"default":f,g=n.showIcon,y=void 0===g||g,v=n.showCloseButton,b=void 0===v||v,w=n.closeOnOverlayClick,k=void 0===w||w,C=n.closeOnEscape,N=void 0===C||C,S=n.isLoading,M=void 0!==S&&S,T=n.className,O=void 0===T?"":T,E=n.overlayClassName,A=void 0===E?"":E,D=n.maxWidth,I=void 0===D?"sm":D,z=a(null),P=a(null),B=a(null);l((function(){return r?(B.current=document.activeElement,setTimeout((function(){var e,t,n;"danger"===m?null===(t=null===(e=z.current)||void 0===e?void 0:e.querySelector("[data-cancel-button]"))||void 0===t||t.focus():null===(n=P.current)||void 0===n||n.focus()}),100),document.body.style.overflow="hidden"):(document.body.style.overflow="unset",B.current&&B.current.focus()),function(){document.body.style.overflow="unset"}}),[r,m]),l((function(){var e=function(e){"Escape"===e.key&&N&&!M&&i()};return r&&document.addEventListener("keydown",e),function(){document.removeEventListener("keydown",e)}}),[r,N,i,M]);var $=function(){M||i()},V={default:{icon:q,iconColor:"text-blue-600",iconBg:"bg-blue-100",confirmButton:"bg-blue-600 hover:bg-blue-700 focus:ring-blue-500"},danger:{icon:L,iconColor:"text-red-600",iconBg:"bg-red-100",confirmButton:"bg-red-600 hover:bg-red-700 focus:ring-red-500"},warning:{icon:Z,iconColor:"text-yellow-600",iconBg:"bg-yellow-100",confirmButton:"bg-yellow-600 hover:bg-yellow-700 focus:ring-yellow-500"},success:{icon:R,iconColor:"text-green-600",iconBg:"bg-green-100",confirmButton:"bg-green-600 hover:bg-green-700 focus:ring-green-500"},info:{icon:q,iconColor:"text-blue-600",iconBg:"bg-blue-100",confirmButton:"bg-blue-600 hover:bg-blue-700 focus:ring-blue-500"}}[m],j=V.icon;return r?t("div",{className:"fixed inset-0 z-50 ".concat(A),role:"dialog","aria-modal":"true","aria-labelledby":s?"confirmation-title":void 0,"aria-describedby":"confirmation-message",children:[e("div",{className:"fixed inset-0 bg-black/50 backdrop-blur-sm transition-opacity duration-300",onClick:function(e){e.target===e.currentTarget&&k&&!M&&i()}}),e("div",{className:"fixed inset-0 flex items-center justify-center p-4",children:t("div",{ref:z,className:"relative w-full ".concat({sm:"max-w-sm",md:"max-w-md",lg:"max-w-lg"}[I]," animate-in fade-in-0 zoom-in-95 slide-in-from-bottom-4 transform rounded-2xl bg-white shadow-2xl transition-all duration-300 ease-out ").concat(O," "),onClick:function(e){return e.stopPropagation()},children:[b&&e("button",{onClick:$,disabled:M,className:"absolute right-4 top-4 flex h-8 w-8 items-center justify-center rounded-full text-gray-400 transition-colors duration-200 hover:bg-gray-100 hover:text-gray-600 focus:outline-none focus:ring-2 focus:ring-gray-500 focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50","aria-label":"Close",children:e(ne,{size:20})}),t("div",{className:"p-6",children:[t("div",{className:"flex flex-col items-center justify-center space-y-4",children:[y&&e("div",{className:"h-12 w-12 flex-shrink-0 rounded-full ".concat(V.iconBg," flex items-center justify-center"),children:e(j,{size:24,className:V.iconColor})}),t("div",{className:"min-w-0 flex-1 justify-center",children:[s&&e("h3",{id:"confirmation-title",className:"mb-1 text-center text-lg font-semibold text-gray-900",children:s}),e("p",{id:"confirmation-message",className:"leading-relaxed text-gray-600",children:c})]})]}),t("div",{className:"flex ".concat("justify-center"," mt-6 space-x-3"),children:[e(x,{variant:"neutral",outline:!0,size:"small","data-cancel-button":"",onClick:$,disabled:M,children:p}),e("button",{ref:P,onClick:function(){M||o()},disabled:M,className:"flex min-w-[80px] items-center justify-center rounded-xl px-4 py-2 text-sm font-medium text-white transition-colors duration-200 focus:outline-none focus:ring-2 focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 ".concat(V.confirmButton," "),children:M?e("div",{className:"h-4 w-4 animate-spin rounded-full border-2 border-white border-t-transparent"}):h})]})]})]})})]}):null},Zp=function(n){var r=n.isOpen,o=n.onClose,i=n.title,s=n.children,c=n.size,d=void 0===c?"md":c,h=n.position,u=void 0===h?"right":h,p=n.showCloseButton,f=void 0===p||p,m=n.closeOnOverlayClick,g=void 0===m||m,y=n.closeOnEscape,v=void 0===y||y,b=n.className,x=void 0===b?"":b,w=n.overlayClassName,k=void 0===w?"":w,C=n.contentClassName,N=void 0===C?"":C,S=n.headerClassName,M=void 0===S?"":S,T=n.footer,O=n.footerClassName,E=void 0===O?"":O,A=n.maxHeight,D=void 0!==A&&A,R=a(null),L=a(null);l((function(){var e;return r?(L.current=document.activeElement,null===(e=R.current)||void 0===e||e.focus(),document.body.style.overflow="hidden"):(document.body.style.overflow="unset",L.current&&L.current.focus()),function(){document.body.style.overflow="unset"}}),[r]),l((function(){var e=function(e){"Escape"===e.key&&v&&o()};return r&&document.addEventListener("keydown",e),function(){document.removeEventListener("keydown",e)}}),[r,v,o]);var I=function(e){e.target===e.currentTarget&&g&&"full"!==d&&o()};return r?t("div",{className:"fixed inset-0 z-50 ".concat(k),role:"dialog","aria-modal":"true","aria-labelledby":i?"modal-title":void 0,children:["full"!==d&&e("div",{className:"fixed inset-0 bg-black/50 backdrop-blur-sm transition-opacity duration-700",onClick:I}),e("div",{className:"fixed inset-0 flex ".concat("p-0"," ").concat(function(){if("full"===d)return"items-start justify-start";return{left:"items-start justify-start",right:"items-start justify-end",center:"items-center justify-center"}[u]}()),onClick:I,children:t("div",{ref:R,tabIndex:-1,className:"\n relative w-full ".concat({xs:"max-w-xs",sm:"max-w-sm",md:"max-w-md",lg:"max-w-lg",xl:"max-w-xl","2xl":"max-w-2xl",full:"w-full h-full"}[d]," bg-white shadow-2xl transform transition-all duration-700 ease-out flex flex-col\n ").concat("full"===d?"h-full max-h-screen overflow-hidden":"left"===u||"right"===u?"h-full ".concat(D?"max-h-screen":""):"".concat(D?"max-h-[90vh] overflow-hidden":""),"\n ").concat("full"===d?"animate-in fade-in-0":"center"===u?"animate-in fade-in-0 zoom-in-95":"left"===u?"animate-in slide-in-from-left-full":"animate-in slide-in-from-right-full","\n ").concat(x,"\n "),onClick:function(e){return e.stopPropagation()},children:[(i||f)&&t("div",{className:"flex items-center justify-between px-6 py-3 border-b border-gray-200 flex-shrink-0 ".concat(M),children:[i&&e("h2",{id:"modal-title",className:"text-xl font-semibold text-gray-900 truncate pr-4",children:i}),f&&e("button",{onClick:o,className:"flex items-center justify-center w-8 h-8 rounded-full text-gray-400 hover:text-gray-600 hover:bg-gray-100 transition-colors duration-200 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2","aria-label":"Close modal",children:e(ne,{size:20})})]}),e("div",{className:"flex-1 min-h-0 overflow-y-auto ".concat(D||"full"===d?"overflow-y-auto":""," ").concat(N),children:e("div",D&&("left"===u||"right"===u)||"full"===d?{className:"p-6 min-h-0 flex-1",children:s}:{className:"p-6",children:s})}),T&&e("div",{className:"px-6 py-4 border-t border-gray-200 flex-shrink-0 ".concat(""," ").concat(E),children:T})]})})]}):null},ef=function(){var n=r.useState(!1),o=n[0],i=n[1],s=r.useState("left"),a=s[0],l=s[1],c=r.useState("md"),d=c[0],h=c[1],u=t("div",{className:"flex justify-end space-x-3",children:[e("button",{onClick:function(){return i(!1)},className:"px-4 py-2 text-sm font-medium text-gray-700 bg-white border border-gray-300 rounded-lg hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 transition-colors duration-200",children:"Cancel"}),e("button",{onClick:function(){return i(!1)},className:"px-4 py-2 text-sm font-medium text-white bg-blue-600 rounded-lg hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 transition-colors duration-200",children:"Save Changes"})]});return t("div",{className:"p-8 space-y-4",children:[t("div",{className:"flex flex-wrap gap-4 mb-6",children:[t("div",{children:[e("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"Position"}),t("select",{value:a,onChange:function(e){return l(e.target.value)},className:"border border-gray-300 rounded-md px-3 py-2 text-sm",disabled:"full"===d,children:[e("option",{value:"left",children:"Left"}),e("option",{value:"right",children:"Right"}),e("option",{value:"center",children:"Center"})]})]}),t("div",{children:[e("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"Size"}),t("select",{value:d,onChange:function(e){return h(e.target.value)},className:"border border-gray-300 rounded-md px-3 py-2 text-sm",children:[e("option",{value:"xs",children:"Extra Small"}),e("option",{value:"sm",children:"Small"}),e("option",{value:"md",children:"Medium"}),e("option",{value:"lg",children:"Large"}),e("option",{value:"xl",children:"Extra Large"}),e("option",{value:"2xl",children:"2X Large"}),e("option",{value:"full",children:"Full Screen"})]})]})]}),e("button",{onClick:function(){return i(!0)},className:"px-6 py-3 bg-blue-600 text-white rounded-lg hover:bg-blue-700 transition-colors duration-200 font-medium",children:"Open Modal"}),e(Zp,{isOpen:o,onClose:function(){return i(!1)},title:"Example Modal",size:d,position:a,footer:u,maxHeight:"center"!==a,children:t("div",{className:"space-y-4",children:[e("p",{className:"text-gray-600",children:"This is an example of the multipurpose modal component. It supports different sizes, positions, and configurations."}),t("div",{className:"bg-gray-50 p-4 rounded-lg",children:[e("h4",{className:"font-medium text-gray-900 mb-2",children:"Features:"}),t("ul",{className:"text-sm text-gray-600 space-y-1 list-disc list-inside",children:[e("li",{children:"Multiple sizes (xs, sm, md, lg, xl, 2xl, full screen)"}),e("li",{children:"Three positions (left, right, center)"}),e("li",{children:"Customizable styling with className props"}),e("li",{children:"Keyboard navigation and accessibility"}),e("li",{children:"Click outside to close (disabled for full screen)"}),e("li",{children:"Smooth animations"}),e("li",{children:"Optional footer with actions"}),e("li",{children:"Full screen mode without margins or border radius"})]})]}),("left"===a||"right"===a||"full"===d)&&e("div",{className:"space-y-2",children:Array.from({length:20},(function(e,n){return t("p",{className:"text-gray-600",children:["This is paragraph ",n+1," to demonstrate scrolling in side panels","full"===d?" and full screen mode":"","."]},n)}))})]})})]})};function tf(n){var r=n.currentPage,o=n.totalPages,i=n.totalItems,s=n.itemsPerPage,a=n.onPageChange,l=n.onViewChange,c=n.loading,d=void 0!==c&&c,h=function(e){e>0&&e<=o&&!d&&a&&a(e)},u=(r-1)*s,p=Math.min(u+s,i);return t("div",{className:"flex items-center justify-between border-t border-gray-200 bg-white py-3",children:[t("div",{className:"flex flex-1 justify-between sm:hidden",children:[e("button",{onClick:function(){return h(r-1)},disabled:1===r||d,className:"relative inline-flex items-center rounded-md border border-gray-300 bg-white px-4 py-2 text-sm font-medium text-gray-700 hover:bg-gray-50 ".concat(1===r||d?"cursor-not-allowed opacity-50":""),children:"Previous"}),e("button",{onClick:function(){return h(r+1)},disabled:r===o||d,className:"relative ml-3 inline-flex items-center rounded-md border border-gray-300 bg-white px-4 py-2 text-sm font-medium text-gray-700 hover:bg-gray-50 ".concat(r===o||d?"cursor-not-allowed opacity-50":""),children:"Next"})]}),t("div",{className:"hidden sm:flex sm:flex-1 sm:items-center sm:justify-between",children:[t("div",{className:"flex items-center justify-center gap-2",children:[t("div",{className:"relative",children:[e("select",{value:s,onChange:function(e){return l&&l(e.target.value)},disabled:d,className:"appearance-none rounded-md border border-gray-300 bg-white py-2 pl-3 pr-8 text-sm focus:outline-none focus:ring-2 focus:ring-blue-500",children:[10,20,30,50].map((function(t){return e("option",{value:t,children:t},t)}))}),e("div",{className:"pointer-events-none absolute inset-y-0 right-0 flex items-center px-2 text-gray-700",children:e("svg",{className:"h-4 w-4",fill:"currentColor",viewBox:"0 0 20 20",children:e("path",{fillRule:"evenodd",d:"M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z",clipRule:"evenodd"})})})]}),t("p",{className:"text-sm text-gray-700",children:[t("span",{children:[i," Entries"]}),t("span",{className:"ml-1",children:["(Showing ",u+1,"-",p," of ",i,")"]})]})]}),e("div",{children:t("nav",{className:"relative z-0 inline-flex gap-2 -space-x-px rounded-md shadow-sm","aria-label":"Pagination",children:[t("button",{onClick:function(){return h(r-1)},disabled:1===r||d,className:"relative inline-flex items-center rounded-md border border-gray-300 bg-white px-2 py-2 text-sm font-medium text-gray-500 hover:bg-gray-50 ".concat(1===r||d?"cursor-not-allowed opacity-50":""),children:[e("span",{className:"sr-only",children:"Previous"}),e("svg",{className:"h-5 w-5",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true",children:e("path",{fillRule:"evenodd",d:"M12.707 5.293a1 1 0 010 1.414L9.414 10l3.293 3.293a1 1 0 01-1.414 1.414l-4-4a1 1 0 010-1.414l4-4a1 1 0 011.414 0z",clipRule:"evenodd"})})]}),function(){var e=[];if(o<=5)for(var t=1;t<=o;t++)e.push(t);else{var n=Math.max(1,r-2),i=Math.min(o,n+5-1);i-n<4&&(n=Math.max(1,i-5+1));for(t=n;t<=i;t++)e.push(t)}return e}().map((function(t){return e("button",{onClick:function(){return h(t)},disabled:d,"aria-current":r===t?"page":void 0,className:"relative inline-flex items-center rounded-md border px-4 py-2 text-sm font-semibold ".concat(r===t?"z-10 border-primary-100 bg-primary-50 text-primary":"border-gray-300 bg-white text-gray-500 hover:bg-gray-50"," ").concat(d?"cursor-not-allowed opacity-50":""),children:t},t)})),t(x,{onClick:function(){return h(r+1)},disabled:r===o||d,type:"button",variant:"primary",size:"small",outline:!0,children:["Next Page",e("svg",{className:"h-5 w-5",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true",children:e("path",{fillRule:"evenodd",d:"M7.293 14.707a1 1 0 010-1.414L10.586 10 7.293 6.707a1 1 0 011.414-1.414l4 4a1 1 0 010 1.414l-4 4a1 1 0 01-1.414 0z",clipRule:"evenodd"})})]})]})})]})]})}function nf(t){var r=t.columns,o=void 0===r?5:r,i=t.rows,s=void 0===i?3:i;return e(n,{children:Array.from({length:s}).map((function(t,n){return e("tr",{children:Array.from({length:o}).map((function(t,r){return e("td",{className:"whitespace-nowrap px-6 py-4",children:e("div",{className:"h-4 animate-pulse rounded bg-gray-200"})},"skeleton-cell-".concat(n,"-").concat(r))}))},"skeleton-row-".concat(n))}))})}function rf(r){var o=r.data,i=r.columns,s=r.itemsPerPage,a=void 0===s?20:s,l=r.onViewChange,c=r.totalItems,d=r.currentPage,h=void 0===d?1:d,u=r.onPageChange,p=r.loading,f=void 0!==p&&p,m=r.showPagination,g=void 0===m||m,y=r.onRowClick,v=r.useCardLayout,b=void 0!==v&&v,x=c||o.length,w=Math.ceil(x/a),k=o,C=function(e){y&&y(e)},N=function(){return t("div",{className:"grid gap-4 grid-cols-1 sm:grid-cols-2 lg:grid-cols-3",children:[f&&Array.from({length:a}).map((function(n,r){return e("div",{className:"bg-white rounded-lg border border-gray-200 p-4 animate-pulse",children:e("div",{className:"space-y-3",children:i.slice(0,3).map((function(n,r){return t("div",{className:"flex justify-between items-center",children:[e("div",{className:"h-4 bg-gray-200 rounded w-1/3"}),e("div",{className:"h-4 bg-gray-200 rounded w-1/2"})]},r)}))})},r)})),k.length>0?k.map((function(n,r){return e("div",{onClick:function(){return C(n)},className:"bg-white rounded-lg border border-gray-200 p-4 transition-all duration-200 hover:shadow-md hover:border-gray-300 ".concat(y?"cursor-pointer":""," ").concat(f?"opacity-50":""),children:e("div",{className:"space-y-3",children:i.map((function(r,o){return t("div",{className:"flex justify-between items-start",children:[t("span",{className:"text-sm font-medium text-gray-500 flex-shrink-0 mr-3",children:[r.title,":"]}),e("span",{className:"text-sm text-gray-800 text-right",children:"function"==typeof r.value?r.value(n):n[r.value]})]},o)}))})},r)})):!f&&e("div",{className:"col-span-full",children:e(se,{title:"No Record found"})})]})};return t(n,{children:[b?N():t(n,{children:[e("div",{className:"hidden md:block",children:e("div",{className:"relative overflow-x-auto",children:t("table",{className:"w-full",children:[e("thead",{children:e("tr",{children:i.map((function(t,n){return e("th",{className:"bg-gray-100 px-6 py-3 text-left text-sm font-semibold tracking-wider text-gray-500 ".concat(t.width||""," ").concat(0===n?"rounded-bl-xl rounded-tl-xl":""," ").concat(n===i.length-1?"rounded-br-xl rounded-tr-xl":""," "),children:t.title},n)}))})}),t("tbody",{className:"divide-y divide-gray-200 bg-white \n ".concat(f?"opacity-50":""," ").concat(y?"cursor-pointer":"","\n "),children:[f&&e(nf,{columns:i.length,rows:a}),k.length>0?k.map((function(t,n){return e("tr",{onClick:function(){return C(t)},className:"hover:bg-gray-50",children:i.map((function(n,r){return e("td",{className:"whitespace-nowrap px-6 py-4 text-sm font-medium text-gray-800",children:"function"==typeof n.value?n.value(t):t[n.value]},r)}))},n)})):!f&&e("tr",{children:e("td",{colSpan:i.length,children:e(se,{title:"No Record found"})})})]})]})})}),e("div",{className:"block md:hidden",children:N()})]}),g&&e(tf,{currentPage:h,totalPages:w,totalItems:x,itemsPerPage:a,onPageChange:u,onViewChange:l,loading:f})]})}function of(n){var r=n.actions,o=n.trigger,i=n.className,c=void 0===i?"":i,d=n.dropdownClassName,h=void 0===d?"":d,u=s(!1),p=u[0],f=u[1],m=a(null),g=function(){f(!p)},y=function(){f(!1)};l((function(){var e=function(e){m.current&&!m.current.contains(e.target)&&y()};return p&&document.addEventListener("mousedown",e),function(){document.removeEventListener("mousedown",e)}}),[p]),l((function(){var e=function(e){"Escape"===e.key&&y()};return p&&document.addEventListener("keydown",e),function(){document.removeEventListener("keydown",e)}}),[p]);return t("div",{className:"relative inline-block ".concat(c),ref:m,children:[e("div",{className:"flex",children:o?e("div",{onClick:g,className:"cursor-pointer",children:o}):e("button",{className:"rounded-md border-gray-300 bg-white px-2 py-2 text-sm font-medium text-gray-700 transition-colors duration-200 focus:ring-offset-2",onClick:g,"aria-expanded":p,"aria-haspopup":"true",children:e(P,{className:"h-4 w-4"})})}),p&&e("div",{className:"absolute right-0 z-50 mt-1 w-48 origin-top-right rounded-md bg-white shadow-lg ring-1 ring-black ring-opacity-5 focus:outline-none ".concat(h),children:t("div",{className:"py-1",role:"menu","aria-orientation":"vertical",children:[r.map((function(n,r){return t("button",{className:"flex w-full items-center px-4 py-2 text-left text-sm transition-colors duration-150 ".concat(n.disabled?"cursor-not-allowed bg-gray-50 text-gray-400":"danger"===n.variant?"text-red-700 hover:bg-red-50 hover:text-red-900":"text-gray-700 hover:bg-gray-100 hover:text-gray-900"," "),onClick:function(){return function(e){e.disabled||(e.onClick(),y())}(n)},disabled:n.disabled,role:"menuitem",children:[n.icon&&e("span",{className:"mr-3 flex-shrink-0",children:n.icon}),n.label]},r)})),0===r.length&&e("div",{className:"px-4 py-2 text-sm text-gray-500",children:"No actions available"})]})})]})}var sf={xs:{width:"4rem",height:"1rem"},sm:{width:"6rem",height:"1.25rem"},md:{width:"8rem",height:"1.5rem"},lg:{width:"12rem",height:"2rem"},xl:{width:"16rem",height:"2.5rem"}},af={text:{baseClasses:"rounded",defaultSize:{width:"100%",height:"1rem"}},rectangular:{baseClasses:"",defaultSize:{width:"100%",height:"8rem"}},circular:{baseClasses:"rounded-full aspect-square",defaultSize:{width:"3rem",height:"3rem"}},rounded:{baseClasses:"rounded-lg",defaultSize:{width:"100%",height:"6rem"}},card:{baseClasses:"rounded-lg",defaultSize:{width:"100%",height:"12rem"}},avatar:{baseClasses:"rounded-full aspect-square",defaultSize:{width:"2.5rem",height:"2.5rem"}},button:{baseClasses:"rounded-md",defaultSize:{width:"5rem",height:"2.25rem"}},image:{baseClasses:"rounded",defaultSize:{width:"100%",height:"10rem"}},line:{baseClasses:"rounded-full",defaultSize:{width:"100%",height:"0.25rem"}}},lf=function(t){var n=t.variant,o=void 0===n?"text":n,i=t.animation,s=void 0===i?"pulse":i,a=t.size,l=t.width,c=t.height,d=t.count,h=void 0===d?1:d,u=t.className,p=void 0===u?"":u,f=t.shimmer,m=void 0!==f&&f,g=t.borderRadius,y=t.intensity,v=void 0===y?"medium":y,b=t.delay,x=void 0===b?0:b,w=r.useState(0===x),k=w[0],C=w[1];r.useEffect((function(){!function(){if("undefined"!=typeof document&&!document.getElementById("skeleton-loader-styles")){var e=document.createElement("style");e.id="skeleton-loader-styles",e.textContent="\n @keyframes wave {\n 0% { transform: translateX(-100%); }\n 50% { transform: translateX(100%); }\n 100% { transform: translateX(100%); }\n }\n\n @keyframes shimmer {\n 0% { background-position: -200% 0; }\n 100% { background-position: 200% 0; }\n }\n\n .skeleton-wave {\n animation: wave 1.6s linear infinite;\n position: relative;\n overflow: hidden;\n }\n\n .skeleton-shimmer {\n animation: shimmer 2s ease-in-out infinite;\n background-size: 200% 100%;\n }\n\n .skeleton-wave::after {\n content: '';\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n background: linear-gradient(\n 90deg,\n transparent,\n rgba(255, 255, 255, 0.6),\n transparent\n );\n animation: wave 1.6s linear infinite;\n }\n",document.head.appendChild(e)}}()}),[]);var N=af[o],S=r.useMemo((function(){return{width:void 0!==l?"number"==typeof l?"".concat(l,"px"):l:a?sf[a].width:N.defaultSize.width,height:void 0!==c?"number"==typeof c?"".concat(c,"px"):c:a?sf[a].height:N.defaultSize.height}}),[l,c,a,N]);if(r.useEffect((function(){if(x>0){var e=setTimeout((function(){return C(!0)}),x);return function(){return clearTimeout(e)}}}),[x]),!k)return null;var M=function(){var e=["block","bg-gray-200",N.baseClasses];switch("pulse"===s?e.push("animate-pulse"):"wave"===s&&e.push("animate-wave"),v){case"light":e.push("bg-gray-100");break;case"medium":e.push("bg-gray-200");break;case"dark":e.push("bg-gray-300")}return m&&e.push("bg-gradient-to-r","from-gray-200","via-gray-100","to-gray-200","bg-200%","animate-shimmer"),e.join(" ")},T=function(t){return e("div",{className:"".concat(M()," ").concat(p),style:(n={width:S.width,height:S.height},g&&(n.borderRadius=g),n),"aria-hidden":"true"},t);var n};return h>1?e("div",{className:"space-y-2",children:Array.from({length:h},(function(e,t){return T(t)}))}):T(0)},cf=function(t){return e(lf,ae({},t,{variant:"text"}))},df=function(t){return e(lf,ae({},t,{variant:"avatar"}))},hf=function(t){return e(lf,ae({},t,{variant:"button"}))},uf=function(t){return e(lf,ae({},t,{variant:"card"}))},pf=function(t){return e(lf,ae({},t,{variant:"image"}))},ff=function(n){var r=n.showBio,o=void 0===r||r;return t("div",{className:"flex items-start space-x-4",children:[e(df,{size:"lg"}),t("div",{className:"flex-1 space-y-2",children:[e(cf,{width:"60%",height:"1.25rem"}),e(cf,{width:"40%",height:"1rem",intensity:"light"}),o&&t("div",{className:"space-y-1 pt-2",children:[e(cf,{width:"100%"}),e(cf,{width:"80%"}),e(cf,{width:"90%"})]})]})]})},mf=function(n){var r=n.itemCount,o=void 0===r?3:r,i=n.showAvatar,s=void 0===i||i,a=n.showMeta,l=void 0===a||a;return e("div",{className:"space-y-4",children:Array.from({length:o},(function(n,r){return t("div",{className:"flex items-start space-x-3",children:[s&&e(df,{}),t("div",{className:"flex-1 space-y-2",children:[e(cf,{width:"75%",height:"1.125rem"}),e(cf,{width:"100%",height:"0.875rem",intensity:"light"}),l&&t("div",{className:"flex space-x-4",children:[e(cf,{width:"3rem",height:"0.75rem",intensity:"light"}),e(cf,{width:"4rem",height:"0.75rem",intensity:"light"})]})]})]},r)}))})},gf=function(n){var r=n.rows,o=void 0===r?5:r,i=n.columns,s=void 0===i?4:i,a=n.showHeader;return t("div",{className:"space-y-3",children:[(void 0===a||a)&&e("div",{className:"flex space-x-4",children:Array.from({length:s},(function(t,n){return e(cf,{width:"100%",height:"1rem",intensity:"dark"},n)}))}),e("div",{className:"space-y-2",children:Array.from({length:o},(function(t,n){return e("div",{className:"flex space-x-4",children:Array.from({length:s},(function(t,n){return e(cf,{width:"100%",height:"0.875rem"},n)}))},n)}))})]})},yf=function(){return t(ie,{children:[e("div",{className:"mb-4",children:e(cf,{width:"180px",height:"28px"})}),t("div",{className:"mt-4 grid grid-cols-1 gap-4",children:[t("div",{className:"rounded-lg bg-blue-50 p-4",children:[e(cf,{width:"40px",height:"32px",className:"mb-1"}),e(cf,{width:"100px",height:"16px"})]}),t("div",{className:"rounded-lg bg-green-50 p-4",children:[e(cf,{width:"40px",height:"32px",className:"mb-1"}),e(cf,{width:"110px",height:"16px"})]}),t("div",{className:"rounded-lg bg-yellow-50 p-4",children:[e(cf,{width:"40px",height:"32px",className:"mb-1"}),e(cf,{width:"120px",height:"16px"})]})]})]})},vf=function(){return t("div",{className:"bg-white p-5",children:[e(lf,{variant:"text",width:"200px"}),e(lf,{variant:"text",count:3}),e(df,{size:"lg"}),e(hf,{animation:"wave"}),e(ff,{showBio:!0}),e(mf,{itemCount:5,showAvatar:!0}),e(gf,{rows:5,columns:4}),e(lf,{variant:"card",shimmer:!0,intensity:"dark",borderRadius:"12px",className:"custom-skeleton"})]})},bf="1.0.0",xf={sizes:{xs:{width:"4rem",height:"1rem"},sm:{width:"6rem",height:"1.25rem"},md:{width:"8rem",height:"1.5rem"},lg:{width:"12rem",height:"2rem"},xl:{width:"16rem",height:"2.5rem"}},variants:["text","rectangular","circular","rounded","card","avatar","button","image","line"],animations:["pulse","wave","none"],intensities:["light","medium","dark"]},wf={userProfile:{variant:"avatar",size:"lg",animation:"pulse"},cardTitle:{variant:"text",width:"75%",height:"1.5rem"},cardDescription:{variant:"text",count:2,width:"100%",height:"1rem",intensity:"light"},button:{variant:"button",animation:"wave"},image:{variant:"image",shimmer:!0}},kf=function(n){var r=n.size,o=void 0===r?"md":r,i=n.variant,s=void 0===i?"pulse":i,a=n.color,l=void 0===a?"primary":a,c=n.fullScreen,d=void 0!==c&&c,h=n.text,u=n.className,p=void 0===u?"":u,f=n.image,m=n.imageEffect,g=void 0===m?"pulse":m,y=l.startsWith("#"),v=function(e){return y?"":{text:"text-".concat(l),bg:"bg-".concat(l),border:"border-".concat(l),borderTop:"border-t-".concat(l),borderRight:"border-r-".concat(l)}[e]||""},b={sm:"w-4 h-4",md:"w-8 h-8",lg:"w-12 h-12",xl:"w-16 h-16"},x={sm:"w-8 h-8",md:"w-12 h-12",lg:"w-16 h-16",xl:"w-20 h-20"},w=function(){switch(g){case"bounce":return"animate-bounce";case"spin":return"animate-spin";case"float":return"animate-pulse hover:animate-bounce";case"heartbeat":return"animate-ping";default:return"animate-pulse"}},k=function(){return t("div",{className:"relative flex items-center justify-center",children:[e("img",{src:f,alt:"Loading",className:"".concat(x[o]," object-contain ").concat(w()),style:{filter:"drop-shadow(0 4px 8px rgba(0, 0, 0, 0.1))",animationDuration:"heartbeat"===g?"1.5s":"bounce"===g?"1s":"2s"}}),"float"===g&&e("div",{className:"absolute inset-0 ".concat(x[o]," rounded-full bg-gradient-to-r from-purple-400 to-blue-400 opacity-20 animate-ping"),style:{animationDuration:"2s"}})]})},C=function(){return t("div",{className:"relative",children:[e("div",{className:"".concat(b[o]," border-4 border-gray-200 rounded-full animate-spin ").concat(y?"":v("borderTop")),style:y?{borderTopColor:l}:{}}),e("div",{className:"absolute inset-0 ".concat(b[o]," border-4 border-transparent rounded-full animate-spin ").concat(y?"":v("borderRight")),style:y?{borderRightColor:l,animationDirection:"reverse",animationDuration:"0.75s"}:{animationDirection:"reverse",animationDuration:"0.75s"}})]})},N=function(){return e("div",{className:"flex space-x-1",children:[0,1,2].map((function(t){return e("div",{className:"".concat("sm"===o?"w-2 h-2":"md"===o?"w-3 h-3":"lg"===o?"w-4 h-4":"w-5 h-5"," rounded-full animate-bounce ").concat(y?"":v("bg")),style:y?{backgroundColor:l,animationDelay:"".concat(.2*t,"s"),animationDuration:"1.4s"}:{animationDelay:"".concat(.2*t,"s"),animationDuration:"1.4s"}},t)}))})},S=function(){return t("div",{className:"relative",children:[e("div",{className:"".concat(b[o]," rounded-full animate-pulse ").concat(y?"":v("bg")),style:y?{backgroundColor:l}:{}}),e("div",{className:"absolute inset-0 ".concat(b[o]," rounded-full animate-ping opacity-30 ").concat(y?"":v("bg")),style:y?{backgroundColor:l}:{}})]})},M=function(){return e("div",{className:"flex space-x-1 items-end",children:[0,1,2,3].map((function(t){return e("div",{className:"".concat("sm"===o?"w-1":"md"===o?"w-1.5":"lg"===o?"w-2":"w-2.5"," rounded-sm animate-pulse ").concat(y?"":v("bg")),style:y?{backgroundColor:l,height:"".concat(20+10*t,"px"),animationDelay:"".concat(.15*t,"s"),animationDuration:"1.2s"}:{height:"".concat(20+10*t,"px"),animationDelay:"".concat(.15*t,"s"),animationDuration:"1.2s"}},t)}))})},T=function(){return t("div",{className:"relative",children:[e("div",{className:"".concat(b[o]," border-4 rounded-full animate-ping ").concat(y?"":v("border")),style:y?{borderColor:l}:{}}),e("div",{className:"absolute inset-2 border-4 rounded-full animate-ping ".concat(y?"":v("border")),style:y?{borderColor:l,animationDelay:"0.5s"}:{animationDelay:"0.5s"}})]})},O=t("div",{className:"flex flex-col items-center justify-center space-y-3 ".concat(p),children:[function(){if("image"===s&&f)return e(k,{});switch(s){case"dots":return e(N,{});case"pulse":return e(S,{});case"bars":return e(M,{});case"ripple":return e(T,{});default:return e(C,{})}}(),h&&e("p",{className:"".concat({sm:"text-xs",md:"text-sm",lg:"text-base",xl:"text-lg"}[o]," font-medium animate-pulse ").concat(y?"":v("text")),style:y?{color:l}:{},children:h})]});return d?e("div",{className:"fixed inset-0 bg-white/80 backdrop-blur-sm flex items-center justify-center z-50",children:O}):O},Cf=function(){var n=r.useState("blue-500"),o=n[0],i=n[1],s=r.useState("spinner"),a=s[0],l=s[1],c=r.useState("md"),d=c[0],h=c[1],u=r.useState(!1),p=u[0],f=u[1],m=["spinner","dots","pulse","bars","ripple"];return t("div",{className:"p-8 max-w-4xl mx-auto",children:[e("h1",{className:"text-3xl font-bold text-gray-800 mb-8 text-center",children:"Modern Loading Component"}),t("div",{className:"bg-white rounded-xl shadow-lg p-6 mb-8",children:[e("h2",{className:"text-xl font-semibold text-gray-700 mb-4",children:"Customization"}),t("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-4 mb-6",children:[t("div",{children:[e("label",{className:"block text-sm font-medium text-gray-600 mb-2",children:"Color"}),e("div",{className:"flex flex-wrap gap-2",children:[{name:"Blue",value:"blue-500",hex:"#3B82F6"},{name:"Purple",value:"purple-500",hex:"#8B5CF6"},{name:"Green",value:"green-500",hex:"#10B981"},{name:"Red",value:"red-500",hex:"#EF4444"},{name:"Orange",value:"orange-500",hex:"#F59E0B"},{name:"Pink",value:"pink-500",hex:"#EC4899"},{name:"Indigo",value:"indigo-500",hex:"#6366F1"},{name:"Teal",value:"teal-500",hex:"#14B8A6"}].map((function(t){return e("button",{onClick:function(){return i(t.value)},className:"w-8 h-8 rounded-full border-2 transition-all ".concat(o===t.value?"border-gray-400 scale-110":"border-gray-200"),style:{backgroundColor:t.hex},title:"".concat(t.name," (").concat(t.value,")")},t.value)}))})]}),t("div",{children:[e("label",{className:"block text-sm font-medium text-gray-600 mb-2",children:"Variant"}),e("select",{value:a,onChange:function(e){return l(e.target.value)},className:"w-full p-2 border border-gray-300 rounded-md focus:ring-2 focus:ring-blue-500 focus:border-transparent",children:m.map((function(t){return e("option",{value:t,children:t&&(null==t?void 0:t.charAt(0).toUpperCase())+(null==t?void 0:t.slice(1))},t)}))})]}),t("div",{children:[e("label",{className:"block text-sm font-medium text-gray-600 mb-2",children:"Size"}),e("select",{value:d,onChange:function(e){return h(e.target.value)},className:"w-full p-2 border border-gray-300 rounded-md focus:ring-2 focus:ring-blue-500 focus:border-transparent",children:["sm","md","lg","xl"].map((function(t){return e("option",{value:t,children:null==t?void 0:t.toUpperCase()},t)}))})]}),t("div",{children:[e("label",{className:"block text-sm font-medium text-gray-600 mb-2",children:"Full Screen"}),e("button",{onClick:function(){return f(!0)},className:"w-full p-2 bg-gray-600 text-white rounded-md hover:bg-gray-700 transition-colors",children:"Demo Full Screen"})]})]}),t("div",{className:"bg-gray-50 rounded-lg p-8 flex flex-col items-center justify-center min-h-32",children:[e(kf,{variant:a,size:d,color:o,text:"Loading..."}),e("div",{className:"mt-4 p-3 bg-white rounded-md shadow-sm",children:t("code",{className:"text-sm text-gray-600",children:['color="',o,'"']})})]})]}),t("div",{className:"bg-white rounded-xl shadow-lg p-6",children:[e("h2",{className:"text-xl font-semibold text-gray-700 mb-4",children:"All Variants"}),e("div",{className:"grid grid-cols-2 md:grid-cols-3 lg:grid-cols-5 gap-6",children:m.map((function(n){return t("div",{className:"text-center",children:[e("div",{className:"bg-gray-50 rounded-lg p-4 flex items-center justify-center h-24 mb-2",children:e(kf,{variant:n,color:o})}),e("p",{className:"text-sm text-gray-600 capitalize",children:n})]},n)}))}),t("div",{className:"mt-6 p-4 bg-blue-50 rounded-lg",children:[e("h3",{className:"font-semibold text-blue-800 mb-2",children:"Usage Examples:"}),t("div",{className:"space-y-2 text-sm",children:[t("div",{className:"bg-white p-2 rounded border",children:[e("code",{className:"text-blue-600",children:"// Tailwind CSS class"}),e("br",{}),e("code",{children:'<Loading color="primary-500" />'})]}),t("div",{className:"bg-white p-2 rounded border",children:[e("code",{className:"text-blue-600",children:"// Hex color"}),e("br",{}),e("code",{children:'<Loading color="#your-brand-color" />'})]}),t("div",{className:"bg-white p-2 rounded border",children:[e("code",{className:"text-blue-600",children:"// Custom Tailwind color"}),e("br",{}),e("code",{children:'<Loading color="emerald-400" variant="dots" />'})]})]})]})]}),p&&e(kf,{variant:a,size:d,color:o,text:"Loading in full screen...",fullScreen:!0}),p&&e("button",{onClick:function(){return f(!1)},className:"fixed top-4 right-4 z-50 bg-red-500 text-white px-4 py-2 rounded-md hover:bg-red-600 transition-colors",children:"Close Full Screen"})]})},Nf=function(n){var r=n.items,o=void 0===r?[]:r,i=n.onBackClick,s=n.showBackButton,a=void 0===s||s,l=n.separator,c=void 0===l?" / ":l,d=n.className;return t("div",{className:"flex gap-2 ".concat(void 0===d?"":d),children:[a&&e("div",{onClick:i,className:"cursor-pointer",children:e(A,{className:"text-gray-500 transition-colors hover:text-gray-700"})}),e("p",{className:"text-gray-400",children:o.map((function(n,r){return t("span",{children:[n.isActive?e("span",{className:"text-primary",children:n.label}):e("span",{className:n.onClick?"cursor-pointer transition-colors hover:text-gray-600":"",onClick:n.onClick,children:n.label}),r<o.length-1&&c]},r)}))})]})},Sf=function(r){var o=r.children,i=r.content,c=r.position,d=void 0===c?"top":c,h=r.variant,u=void 0===h?"light":h,p=r.size,f=void 0===p?"md":p,m=r.delay,g=void 0===m?200:m,y=r.disabled,v=void 0!==y&&y,b=r.className,x=void 0===b?"":b,w=s(!1),k=w[0],C=w[1],N=s(d),S=N[0],M=N[1],T=a(null),O=a(null),E=a(null);l((function(){if(k&&O.current&&E.current){var e=O.current,t=E.current.getBoundingClientRect(),n=e.getBoundingClientRect(),r=d;"top"===d&&t.top-n.height<10?r="bottom":"bottom"===d&&t.bottom+n.height>window.innerHeight-10?r="top":"left"===d&&t.left-n.width<10?r="right":"right"===d&&t.right+n.width>window.innerWidth-10&&(r="left"),M(r)}}),[k,d]);var A=function(){v||(T.current&&clearTimeout(T.current),T.current=setTimeout((function(){C(!0)}),g))},D=function(){T.current&&clearTimeout(T.current),C(!1)};l((function(){return function(){T.current&&clearTimeout(T.current)}}),[]);var R={dark:{tooltip:"bg-gray-900 text-white border-gray-700",arrow:{top:"border-t-gray-900",bottom:"border-b-gray-900",left:"border-l-gray-900",right:"border-r-gray-900"}},light:{tooltip:"bg-white text-gray-900 border-gray-200 shadow-lg",arrow:{top:"border-t-white",bottom:"border-b-white",left:"border-l-white",right:"border-r-white"}},accent:{tooltip:"bg-blue-600 text-white border-blue-500",arrow:{top:"border-t-blue-600",bottom:"border-b-blue-600",left:"border-l-blue-600",right:"border-r-blue-600"}}};return v||!i?e(n,{children:o}):t("div",{className:"relative inline-block",children:[e("div",{ref:E,onMouseEnter:A,onMouseLeave:D,onFocus:A,onBlur:D,className:"cursor-help",children:o}),k&&t("div",{ref:O,className:"absolute z-50 ".concat({top:"bottom-full left-1/2 -translate-x-1/2 mb-2",bottom:"top-full left-1/2 -translate-x-1/2 mt-2",left:"right-full top-1/2 -translate-y-1/2 mr-2",right:"left-full top-1/2 -translate-y-1/2 ml-2"}[S]," ").concat(R[u].tooltip," ").concat({sm:"px-2 py-1 text-xs",md:"px-3 py-2 text-sm",lg:"px-4 py-3 text-base"}[f]," animate-in fade-in-0 zoom-in-95 max-w-xs whitespace-nowrap break-words rounded-lg border font-medium backdrop-blur-sm duration-200 ").concat(x," "),role:"tooltip","aria-hidden":"false",children:[i,e("div",{className:"absolute h-0 w-0 border-4 ".concat({top:"top-full left-1/2 -translate-x-1/2 border-l-transparent border-r-transparent border-b-transparent",bottom:"bottom-full left-1/2 -translate-x-1/2 border-l-transparent border-r-transparent border-t-transparent",left:"left-full top-1/2 -translate-y-1/2 border-t-transparent border-b-transparent border-r-transparent",right:"right-full top-1/2 -translate-y-1/2 border-t-transparent border-b-transparent border-l-transparent"}[S]," ").concat(R[u].arrow[S]," ")})]})]})},Mf=function(t){var n=t.children,r=t.variant,o=void 0===r?"default":r,i=t.size,s=void 0===i?"md":i,a=t.className,l=void 0===a?"":a,c=t.onClick,d=["inline-flex items-center font-medium rounded-full transition-colors duration-200",{default:"bg-gray-100 text-gray-800 hover:bg-gray-200",secondary:"bg-blue-100 text-blue-800 hover:bg-blue-200",success:"bg-green-100 text-green-800 hover:bg-green-200",warning:"bg-yellow-100 text-yellow-800 hover:bg-yellow-200",error:"bg-red-100 text-red-800 hover:bg-red-200",info:"bg-cyan-100 text-cyan-800 hover:bg-cyan-200"}[o],{sm:"px-2 py-0.5 text-xs",md:"px-2.5 py-1 text-sm",lg:"px-3 py-1.5 text-base"}[s],c?"cursor-pointer":"",l].filter(Boolean).join(" ");return e("span",{className:d,onClick:c,role:c?"button":void 0,tabIndex:c?0:void 0,onKeyDown:c?function(e){"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),c())}:void 0,children:n})};export{Up as AlertContext,Gp as AlertProvider,Mf as Badge,Nf as Breadcrumb,x as Button,ie as Card,yf as CardStatsSkeleton,de as CheckBox,ue as CheckBoxDemo,Qp as ConfirmationAlert,ve as DateTimePicker,be as DateTimePickerDemo,se as EmptyStateCard,oe as ExportButton,pe as FileUpload,fe as Input,me as InputWithPrefix,kf as Loading,Cf as LoadingDemo,Zp as Modal,ef as ModalExample,tf as Pagination,he as RadioGroup,bf as SKELETON_LOADER_VERSION,wf as SKELETON_PATTERNS,xf as SKELETON_PRESETS,xe as Search,we as Select,Wp as SelectButton,df as SkeletonAvatar,hf as SkeletonButton,uf as SkeletonCard,pf as SkeletonImage,mf as SkeletonList,lf as SkeletonLoader,vf as SkeletonLoaderExample,ff as SkeletonProfile,gf as SkeletonTable,cf as SkeletonText,rf as Table,of as TableDropdown,nf as TableSkeleton,ge as TagInput,ye as TagInputDemo,qp as TextEditor,Sf as Tooltip,Xp as alert,Yp as useAlert};
50
+ */"production"===process.env.NODE_ENV?_u.exports=function(){if(Vu)return qu;Vu=1;var e=r,t=ju,n="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},o=t.useSyncExternalStore,i=e.useRef,s=e.useEffect,a=e.useMemo,l=e.useDebugValue;return qu.useSyncExternalStoreWithSelector=function(e,t,r,c,d){var h=i(null);if(null===h.current){var u={hasValue:!1,value:null};h.current=u}else u=h.current;h=a((function(){function e(e){if(!s){if(s=!0,o=e,e=c(e),void 0!==d&&u.hasValue){var t=u.value;if(d(t,e))return i=t}return i=e}if(t=i,n(o,e))return t;var r=c(e);return void 0!==d&&d(t,r)?(o=e,t):(o=e,i=r)}var o,i,s=!1,a=void 0===r?null:r;return[function(){return e(t())},null===a?void 0:function(){return e(a())}]}),[t,r,c,d]);var p=o(e,h[0],h[1]);return s((function(){u.hasValue=!0,u.value=p}),[p]),l(p),p},qu}():_u.exports=(Wu||(Wu=1,"production"!==process.env.NODE_ENV&&function(){"undefined"!=typeof __REACT_DEVTOOLS_GLOBAL_HOOK__&&"function"==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var e=r,t=ju,n="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},o=t.useSyncExternalStore,i=e.useRef,s=e.useEffect,a=e.useMemo,l=e.useDebugValue;Ku.useSyncExternalStoreWithSelector=function(e,t,r,c,d){var h=i(null);if(null===h.current){var u={hasValue:!1,value:null};h.current=u}else u=h.current;h=a((function(){function e(e){if(!s){if(s=!0,o=e,e=c(e),void 0!==d&&u.hasValue){var t=u.value;if(d(t,e))return i=t}return i=e}if(t=i,n(o,e))return t;var r=c(e);return void 0!==d&&d(t,r)?(o=e,t):(o=e,i=r)}var o,i,s=!1,a=void 0===r?null:r;return[function(){return e(t())},null===a?void 0:function(){return e(a())}]}),[t,r,c,d]);var p=o(e,h[0],h[1]);return s((function(){u.hasValue=!0,u.value=p}),[p]),l(p),p},"undefined"!=typeof __REACT_DEVTOOLS_GLOBAL_HOOK__&&"function"==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())}()),Ku);var Ju=_u.exports,Uu=(...e)=>t=>{e.forEach((e=>{"function"==typeof e?e(t):e&&(e.current=t)}))},Gu=({contentComponent:t})=>{const r=ju.useSyncExternalStore(t.subscribe,t.getSnapshot,t.getServerSnapshot);return e(n,{children:Object.values(r)})};var Yu=class extends r.Component{constructor(e){var t;super(e),this.editorContentRef=r.createRef(),this.initialized=!1,this.state={hasContentComponentInitialized:Boolean(null==(t=e.editor)?void 0:t.contentComponent)}}componentDidMount(){this.init()}componentDidUpdate(){this.init()}init(){const e=this.props.editor;if(e&&!e.isDestroyed&&e.options.element){if(e.contentComponent)return;const t=this.editorContentRef.current;t.append(...e.options.element.childNodes),e.setOptions({element:t}),e.contentComponent=function(){const e=new Set;let t={};return{subscribe:t=>(e.add(t),()=>{e.delete(t)}),getSnapshot:()=>t,getServerSnapshot:()=>t,setRenderer(n,r){t={...t,[n]:m.createPortal(r.reactElement,r.element,n)},e.forEach((e=>e()))},removeRenderer(n){const r={...t};delete r[n],t=r,e.forEach((e=>e()))}}}(),this.state.hasContentComponentInitialized||(this.unsubscribeToContentComponent=e.contentComponent.subscribe((()=>{this.setState((e=>e.hasContentComponentInitialized?e:{hasContentComponentInitialized:!0})),this.unsubscribeToContentComponent&&this.unsubscribeToContentComponent()}))),e.createNodeViews(),this.initialized=!0}}componentWillUnmount(){var e;const t=this.props.editor;if(!t)return;if(this.initialized=!1,t.isDestroyed||t.view.setProps({nodeViews:{}}),this.unsubscribeToContentComponent&&this.unsubscribeToContentComponent(),t.contentComponent=null,!(null==(e=t.options.element)?void 0:e.firstChild))return;const n=document.createElement("div");n.append(...t.options.element.childNodes),t.setOptions({element:n})}render(){const{editor:r,innerRef:o,...i}=this.props;return t(n,{children:[e("div",{ref:Uu(o,this.editorContentRef),...i}),(null==r?void 0:r.contentComponent)&&e(Gu,{contentComponent:r.contentComponent})]})}},Xu=o(((e,t)=>{const n=r.useMemo((()=>Math.floor(4294967295*Math.random()).toString()),[e.editor]);return r.createElement(Yu,{key:n,innerRef:t,...e})})),Qu=r.memo(Xu),Zu="undefined"!=typeof window?h:l,ep=class{constructor(e){this.transactionNumber=0,this.lastTransactionNumber=0,this.subscribers=new Set,this.editor=e,this.lastSnapshot={editor:e,transactionNumber:0},this.getSnapshot=this.getSnapshot.bind(this),this.getServerSnapshot=this.getServerSnapshot.bind(this),this.watch=this.watch.bind(this),this.subscribe=this.subscribe.bind(this)}getSnapshot(){return this.transactionNumber===this.lastTransactionNumber||(this.lastTransactionNumber=this.transactionNumber,this.lastSnapshot={editor:this.editor,transactionNumber:this.transactionNumber}),this.lastSnapshot}getServerSnapshot(){return{editor:null,transactionNumber:0}}subscribe(e){return this.subscribers.add(e),()=>{this.subscribers.delete(e)}}watch(e){if(this.editor=e,this.editor){const e=()=>{this.transactionNumber+=1,this.subscribers.forEach((e=>e()))},t=this.editor;return t.on("transaction",e),()=>{t.off("transaction",e)}}}};var tp="production"!==process.env.NODE_ENV,np="undefined"==typeof window,rp=np||Boolean("undefined"!=typeof window&&window.next),op=class e{constructor(e){this.editor=null,this.subscriptions=new Set,this.isComponentMounted=!1,this.previousDeps=null,this.instanceId="",this.options=e,this.subscriptions=new Set,this.setEditor(this.getInitialEditor()),this.scheduleDestroy(),this.getEditor=this.getEditor.bind(this),this.getServerSnapshot=this.getServerSnapshot.bind(this),this.subscribe=this.subscribe.bind(this),this.refreshEditorInstance=this.refreshEditorInstance.bind(this),this.scheduleDestroy=this.scheduleDestroy.bind(this),this.onRender=this.onRender.bind(this),this.createEditor=this.createEditor.bind(this)}setEditor(e){this.editor=e,this.instanceId=Math.random().toString(36).slice(2,9),this.subscriptions.forEach((e=>e()))}getInitialEditor(){if(void 0===this.options.current.immediatelyRender){if(np||rp){if(tp)throw new Error("Tiptap Error: SSR has been detected, please set `immediatelyRender` explicitly to `false` to avoid hydration mismatches.");return null}return this.createEditor()}if(this.options.current.immediatelyRender&&np&&tp)throw new Error("Tiptap Error: SSR has been detected, and `immediatelyRender` has been set to `true` this is an unsupported configuration that may result in errors, explicitly set `immediatelyRender` to `false` to avoid hydration mismatches.");return this.options.current.immediatelyRender?this.createEditor():null}createEditor(){const e={...this.options.current,onBeforeCreate:(...e)=>{var t,n;return null==(n=(t=this.options.current).onBeforeCreate)?void 0:n.call(t,...e)},onBlur:(...e)=>{var t,n;return null==(n=(t=this.options.current).onBlur)?void 0:n.call(t,...e)},onCreate:(...e)=>{var t,n;return null==(n=(t=this.options.current).onCreate)?void 0:n.call(t,...e)},onDestroy:(...e)=>{var t,n;return null==(n=(t=this.options.current).onDestroy)?void 0:n.call(t,...e)},onFocus:(...e)=>{var t,n;return null==(n=(t=this.options.current).onFocus)?void 0:n.call(t,...e)},onSelectionUpdate:(...e)=>{var t,n;return null==(n=(t=this.options.current).onSelectionUpdate)?void 0:n.call(t,...e)},onTransaction:(...e)=>{var t,n;return null==(n=(t=this.options.current).onTransaction)?void 0:n.call(t,...e)},onUpdate:(...e)=>{var t,n;return null==(n=(t=this.options.current).onUpdate)?void 0:n.call(t,...e)},onContentError:(...e)=>{var t,n;return null==(n=(t=this.options.current).onContentError)?void 0:n.call(t,...e)},onDrop:(...e)=>{var t,n;return null==(n=(t=this.options.current).onDrop)?void 0:n.call(t,...e)},onPaste:(...e)=>{var t,n;return null==(n=(t=this.options.current).onPaste)?void 0:n.call(t,...e)},onDelete:(...e)=>{var t,n;return null==(n=(t=this.options.current).onDelete)?void 0:n.call(t,...e)}};return new kc(e)}getEditor(){return this.editor}getServerSnapshot(){return null}subscribe(e){return this.subscriptions.add(e),()=>{this.subscriptions.delete(e)}}static compareOptions(e,t){return Object.keys(e).every((n=>!!["onCreate","onBeforeCreate","onDestroy","onUpdate","onTransaction","onFocus","onBlur","onSelectionUpdate","onContentError","onDrop","onPaste"].includes(n)||("extensions"===n&&e.extensions&&t.extensions?e.extensions.length===t.extensions.length&&e.extensions.every(((e,n)=>{var r;return e===(null==(r=t.extensions)?void 0:r[n])})):e[n]===t[n])))}onRender(t){return()=>(this.isComponentMounted=!0,clearTimeout(this.scheduledDestructionTimeout),this.editor&&!this.editor.isDestroyed&&0===t.length?e.compareOptions(this.options.current,this.editor.options)||this.editor.setOptions({...this.options.current,editable:this.editor.isEditable}):this.refreshEditorInstance(t),()=>{this.isComponentMounted=!1,this.scheduleDestroy()})}refreshEditorInstance(e){if(this.editor&&!this.editor.isDestroyed){if(null===this.previousDeps)return void(this.previousDeps=e);if(this.previousDeps.length===e.length&&this.previousDeps.every(((t,n)=>t===e[n])))return}this.editor&&!this.editor.isDestroyed&&this.editor.destroy(),this.setEditor(this.createEditor()),this.previousDeps=e}scheduleDestroy(){const e=this.instanceId,t=this.editor;this.scheduledDestructionTimeout=setTimeout((()=>{this.isComponentMounted&&this.instanceId===e?t&&t.setOptions(this.options.current):t&&!t.isDestroyed&&(t.destroy(),this.instanceId===e&&this.setEditor(null))}),1)}};function ip(e={},t=[]){const n=a(e);n.current=e;const[r]=s((()=>new op(n))),o=ju.useSyncExternalStore(r.subscribe,r.getEditor,r.getServerSnapshot);return d(o),l(r.onRender(t)),function(e){var t;const[n]=s((()=>new ep(e.editor))),r=Ju.useSyncExternalStoreWithSelector(n.subscribe,n.getSnapshot,n.getServerSnapshot,e.selector,null!=(t=e.equalityFn)?t:Hu);Zu((()=>n.watch(e.editor)),[e.editor,n]),d(r)}({editor:o,selector:({transactionNumber:t})=>!1===e.shouldRerenderOnTransaction||void 0===e.shouldRerenderOnTransaction?null:e.immediatelyRender&&0===t?0:t+1}),o}u({editor:null}).Consumer;var sp=u({onDragStart:()=>{},nodeViewContentChildren:void 0,nodeViewContentRef:()=>{}});r.forwardRef(((t,n)=>{const{onDragStart:r}=p(sp),o=t.as||"div";return e(o,{...t,ref:n,"data-node-view-wrapper":"",onDragStart:r,style:{whiteSpace:"normal",...t.style}})})),r.createContext({markViewContentRef:()=>{}});var ap=/^\s*>\s$/,lp=Mc.create({name:"blockquote",addOptions:()=>({HTMLAttributes:{}}),content:"block+",group:"block",defining:!0,parseHTML:()=>[{tag:"blockquote"}],renderHTML({HTMLAttributes:e}){return Oc("blockquote",{...ca(this.options.HTMLAttributes,e),children:Oc("slot",{})})},addCommands(){return{setBlockquote:()=>({commands:e})=>e.wrapIn(this.name),toggleBlockquote:()=>({commands:e})=>e.toggleWrap(this.name),unsetBlockquote:()=>({commands:e})=>e.lift(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-b":()=>this.editor.commands.toggleBlockquote()}},addInputRules(){return[Sc({find:ap,type:this.type})]}}),cp=Mc.create({name:"hardBreak",addOptions:()=>({keepMarks:!0,HTMLAttributes:{}}),inline:!0,group:"inline",selectable:!1,linebreakReplacement:!0,parseHTML:()=>[{tag:"br"}],renderHTML({HTMLAttributes:e}){return["br",ca(this.options.HTMLAttributes,e)]},renderText:()=>"\n",addCommands(){return{setHardBreak:()=>({commands:e,chain:t,state:n,editor:r})=>e.first([()=>e.exitCode(),()=>e.command((()=>{const{selection:e,storedMarks:o}=n;if(e.$from.parent.type.spec.isolating)return!1;const{keepMarks:i}=this.options,{splittableMarks:s}=r.extensionManager,a=o||e.$to.parentOffset&&e.$from.marks();return t().insertContent({type:this.name}).command((({tr:e,dispatch:t})=>{if(t&&a&&i){const t=a.filter((e=>s.includes(e.type.name)));e.ensureMarks(t)}return!0})).run()}))])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}}),dp=Mc.create({name:"horizontalRule",addOptions:()=>({HTMLAttributes:{}}),group:"block",parseHTML:()=>[{tag:"hr"}],renderHTML({HTMLAttributes:e}){return["hr",ca(this.options.HTMLAttributes,e)]},addCommands(){return{setHorizontalRule:()=>({chain:e,state:t})=>{if(!function(e,t){const{selection:n}=e,{$from:r}=n;if(n instanceof En){const e=r.index();return r.parent.canReplaceWith(e,e+1,t)}let o=r.depth;for(;o>=0;){const e=r.index(o);if(r.node(o).contentMatchAt(e).matchType(t))return!0;o-=1}return!1}(t,t.schema.nodes[this.name]))return!1;const{selection:n}=t,{$to:r}=n,o=e();return Ba(n)?o.insertContentAt(r.pos,{type:this.name}):o.insertContent({type:this.name}),o.command((({tr:e,dispatch:t})=>{var n;if(t){const{$to:t}=e.selection,r=t.end();if(t.nodeAfter)t.nodeAfter.isTextblock?e.setSelection(Tn.create(e.doc,t.pos+1)):t.nodeAfter.isBlock?e.setSelection(En.create(e.doc,t.pos)):e.setSelection(Tn.create(e.doc,t.pos));else{const o=null==(n=t.parent.type.contentMatch.defaultType)?void 0:n.create();o&&(e.insert(r,o),e.setSelection(Tn.create(e.doc,r+1)))}e.scrollIntoView()}return!0})).run()}}},addInputRules(){return[(e={find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type},new Fa({find:e.find,handler:({state:t,range:n,match:r})=>{const o=sa(e.getAttributes,void 0,r)||{},{tr:i}=t,s=n.from;let a=n.to;const l=e.type.create(o);if(r[1]){let e=s+r[0].lastIndexOf(r[1]);e>a?e=a:a=e+r[1].length;const t=r[0][r[0].length-1];i.insertText(t,s+r[0].length-1),i.replaceWith(e,a,l)}else if(r[0]){const t=e.type.isInline?s:s-1;i.insert(t,e.type.create(o)).delete(i.mapping.map(s),i.mapping.map(a))}i.scrollIntoView()}}))];var e}});function hp(e={}){return new Hn({view:t=>new up(t,e)})}class up{constructor(e,t){var n;this.editorView=e,this.cursorPos=null,this.element=null,this.timeout=-1,this.width=null!==(n=t.width)&&void 0!==n?n:1,this.color=!1===t.color?void 0:t.color||"black",this.class=t.class,this.handlers=["dragover","dragend","drop","dragleave"].map((t=>{let n=e=>{this[t](e)};return e.dom.addEventListener(t,n),{name:t,handler:n}}))}destroy(){this.handlers.forEach((({name:e,handler:t})=>this.editorView.dom.removeEventListener(e,t)))}update(e,t){null!=this.cursorPos&&t.doc!=e.state.doc&&(this.cursorPos>e.state.doc.content.size?this.setCursor(null):this.updateOverlay())}setCursor(e){e!=this.cursorPos&&(this.cursorPos=e,null==e?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())}updateOverlay(){let e,t=this.editorView.state.doc.resolve(this.cursorPos),n=!t.parent.inlineContent,r=this.editorView.dom,o=r.getBoundingClientRect(),i=o.width/r.offsetWidth,s=o.height/r.offsetHeight;if(n){let n=t.nodeBefore,r=t.nodeAfter;if(n||r){let t=this.editorView.nodeDOM(this.cursorPos-(n?n.nodeSize:0));if(t){let o=t.getBoundingClientRect(),i=n?o.bottom:o.top;n&&r&&(i=(i+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let a=this.width/2*s;e={left:o.left,right:o.right,top:i-a,bottom:i+a}}}}if(!e){let t=this.editorView.coordsAtPos(this.cursorPos),n=this.width/2*i;e={left:t.left-n,right:t.left+n,top:t.top,bottom:t.bottom}}let a,l,c=this.editorView.dom.offsetParent;if(this.element||(this.element=c.appendChild(document.createElement("div")),this.class&&(this.element.className=this.class),this.element.style.cssText="position: absolute; z-index: 50; pointer-events: none;",this.color&&(this.element.style.backgroundColor=this.color)),this.element.classList.toggle("prosemirror-dropcursor-block",n),this.element.classList.toggle("prosemirror-dropcursor-inline",!n),!c||c==document.body&&"static"==getComputedStyle(c).position)a=-pageXOffset,l=-pageYOffset;else{let e=c.getBoundingClientRect(),t=e.width/c.offsetWidth,n=e.height/c.offsetHeight;a=e.left-c.scrollLeft*t,l=e.top-c.scrollTop*n}this.element.style.left=(e.left-a)/i+"px",this.element.style.top=(e.top-l)/s+"px",this.element.style.width=(e.right-e.left)/i+"px",this.element.style.height=(e.bottom-e.top)/s+"px"}scheduleRemoval(e){clearTimeout(this.timeout),this.timeout=setTimeout((()=>this.setCursor(null)),e)}dragover(e){if(!this.editorView.editable)return;let t=this.editorView.posAtCoords({left:e.clientX,top:e.clientY}),n=t&&t.inside>=0&&this.editorView.state.doc.nodeAt(t.inside),r=n&&n.type.spec.disableDropCursor,o="function"==typeof r?r(this.editorView,t,e):r;if(t&&!o){let e=t.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let t=an(this.editorView.state.doc,e,this.editorView.dragging.slice);null!=t&&(e=t)}this.setCursor(e),this.scheduleRemoval(5e3)}}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(e){this.editorView.dom.contains(e.relatedTarget)||this.setCursor(null)}}class pp extends Cn{constructor(e){super(e,e)}map(e,t){let n=e.resolve(t.map(this.head));return pp.valid(n)?new pp(n):Cn.near(n)}content(){return Re.empty}eq(e){return e instanceof pp&&e.head==this.head}toJSON(){return{type:"gapcursor",pos:this.head}}static fromJSON(e,t){if("number"!=typeof t.pos)throw new RangeError("Invalid input for GapCursor.fromJSON");return new pp(e.resolve(t.pos))}getBookmark(){return new fp(this.anchor)}static valid(e){let t=e.parent;if(t.isTextblock||!function(e){for(let t=e.depth;t>=0;t--){let n=e.index(t),r=e.node(t);if(0!=n)for(let e=r.child(n-1);;e=e.lastChild){if(0==e.childCount&&!e.inlineContent||e.isAtom||e.type.spec.isolating)return!0;if(e.inlineContent)return!1}else if(r.type.spec.isolating)return!0}return!0}(e)||!function(e){for(let t=e.depth;t>=0;t--){let n=e.indexAfter(t),r=e.node(t);if(n!=r.childCount)for(let e=r.child(n);;e=e.firstChild){if(0==e.childCount&&!e.inlineContent||e.isAtom||e.type.spec.isolating)return!0;if(e.inlineContent)return!1}else if(r.type.spec.isolating)return!0}return!0}(e))return!1;let n=t.type.spec.allowGapCursor;if(null!=n)return n;let r=t.contentMatchAt(e.index()).defaultType;return r&&r.isTextblock}static findGapCursorFrom(e,t,n=!1){e:for(;;){if(!n&&pp.valid(e))return e;let r=e.pos,o=null;for(let n=e.depth;;n--){let i=e.node(n);if(t>0?e.indexAfter(n)<i.childCount:e.index(n)>0){o=i.child(t>0?e.indexAfter(n):e.index(n)-1);break}if(0==n)return null;r+=t;let s=e.doc.resolve(r);if(pp.valid(s))return s}for(;;){let i=t>0?o.firstChild:o.lastChild;if(!i){if(o.isAtom&&!o.isText&&!En.isSelectable(o)){e=e.doc.resolve(r+o.nodeSize*t),n=!1;continue e}break}o=i,r+=t;let s=e.doc.resolve(r);if(pp.valid(s))return s}return null}}}pp.prototype.visible=!1,pp.findFrom=pp.findGapCursorFrom,Cn.jsonID("gapcursor",pp);class fp{constructor(e){this.pos=e}map(e){return new fp(e.map(this.pos))}resolve(e){let t=e.resolve(this.pos);return pp.valid(t)?new pp(t):Cn.near(t)}}const mp=xs({ArrowLeft:gp("horiz",-1),ArrowRight:gp("horiz",1),ArrowUp:gp("vert",-1),ArrowDown:gp("vert",1)});function gp(e,t){const n="vert"==e?t>0?"down":"up":t>0?"right":"left";return function(e,r,o){let i=e.selection,s=t>0?i.$to:i.$from,a=i.empty;if(i instanceof Tn){if(!o.endOfTextblock(n)||0==s.depth)return!1;a=!1,s=e.doc.resolve(t>0?s.after():s.before())}let l=pp.findGapCursorFrom(s,t,a);return!!l&&(r&&r(e.tr.setSelection(new pp(l))),!0)}}function yp(e,t,n){if(!e||!e.editable)return!1;let r=e.state.doc.resolve(t);if(!pp.valid(r))return!1;let o=e.posAtCoords({left:n.clientX,top:n.clientY});return!(o&&o.inside>-1&&En.isSelectable(e.state.doc.nodeAt(o.inside)))&&(e.dispatch(e.state.tr.setSelection(new pp(r))),!0)}function vp(e,t){if("insertCompositionText"!=t.inputType||!(e.state.selection instanceof pp))return!1;let{$from:n}=e.state.selection,r=n.parent.contentMatchAt(n.index()).findWrapping(e.state.schema.nodes.text);if(!r)return!1;let o=Me.empty;for(let e=r.length-1;e>=0;e--)o=Me.from(r[e].createAndFill(null,o));let i=e.state.tr.replace(n.pos,n.pos,new Re(o,0,0));return i.setSelection(Tn.near(i.doc.resolve(n.pos+1))),e.dispatch(i),!1}function bp(e){if(!(e.selection instanceof pp))return null;let t=document.createElement("div");return t.className="ProseMirror-gapcursor",Ri.create(e.doc,[Ei.widget(e.selection.head,t,{key:"gapcursor"})])}var xp=200,wp=function(){};wp.prototype.append=function(e){return e.length?(e=wp.from(e),!this.length&&e||e.length<xp&&this.leafAppend(e)||this.length<xp&&e.leafPrepend(this)||this.appendInner(e)):this},wp.prototype.prepend=function(e){return e.length?wp.from(e).append(this):this},wp.prototype.appendInner=function(e){return new Cp(this,e)},wp.prototype.slice=function(e,t){return void 0===e&&(e=0),void 0===t&&(t=this.length),e>=t?wp.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,t))},wp.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)},wp.prototype.forEach=function(e,t,n){void 0===t&&(t=0),void 0===n&&(n=this.length),t<=n?this.forEachInner(e,t,n,0):this.forEachInvertedInner(e,t,n,0)},wp.prototype.map=function(e,t,n){void 0===t&&(t=0),void 0===n&&(n=this.length);var r=[];return this.forEach((function(t,n){return r.push(e(t,n))}),t,n),r},wp.from=function(e){return e instanceof wp?e:e&&e.length?new kp(e):wp.empty};var kp=function(e){function t(t){e.call(this),this.values=t}e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t;var n={length:{configurable:!0},depth:{configurable:!0}};return t.prototype.flatten=function(){return this.values},t.prototype.sliceInner=function(e,n){return 0==e&&n==this.length?this:new t(this.values.slice(e,n))},t.prototype.getInner=function(e){return this.values[e]},t.prototype.forEachInner=function(e,t,n,r){for(var o=t;o<n;o++)if(!1===e(this.values[o],r+o))return!1},t.prototype.forEachInvertedInner=function(e,t,n,r){for(var o=t-1;o>=n;o--)if(!1===e(this.values[o],r+o))return!1},t.prototype.leafAppend=function(e){if(this.length+e.length<=xp)return new t(this.values.concat(e.flatten()))},t.prototype.leafPrepend=function(e){if(this.length+e.length<=xp)return new t(e.flatten().concat(this.values))},n.length.get=function(){return this.values.length},n.depth.get=function(){return 0},Object.defineProperties(t.prototype,n),t}(wp);wp.empty=new kp([]);var Cp=function(e){function t(t,n){e.call(this),this.left=t,this.right=n,this.length=t.length+n.length,this.depth=Math.max(t.depth,n.depth)+1}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},t.prototype.getInner=function(e){return e<this.left.length?this.left.get(e):this.right.get(e-this.left.length)},t.prototype.forEachInner=function(e,t,n,r){var o=this.left.length;return!(t<o&&!1===this.left.forEachInner(e,t,Math.min(n,o),r))&&(!(n>o&&!1===this.right.forEachInner(e,Math.max(t-o,0),Math.min(this.length,n)-o,r+o))&&void 0)},t.prototype.forEachInvertedInner=function(e,t,n,r){var o=this.left.length;return!(t>o&&!1===this.right.forEachInvertedInner(e,t-o,Math.max(n,o)-o,r+o))&&(!(n<o&&!1===this.left.forEachInvertedInner(e,Math.min(t,o),n,r))&&void 0)},t.prototype.sliceInner=function(e,t){if(0==e&&t==this.length)return this;var n=this.left.length;return t<=n?this.left.slice(e,t):e>=n?this.right.slice(e-n,t-n):this.left.slice(e,n).append(this.right.slice(0,t-n))},t.prototype.leafAppend=function(e){var n=this.right.leafAppend(e);if(n)return new t(this.left,n)},t.prototype.leafPrepend=function(e){var n=this.left.leafPrepend(e);if(n)return new t(n,this.right)},t.prototype.appendInner=function(e){return this.left.depth>=Math.max(this.right.depth,e.depth)+1?new t(this.left,new t(this.right,e)):new t(this,e)},t}(wp);class Np{constructor(e,t){this.items=e,this.eventCount=t}popEvent(e,t){if(0==this.eventCount)return null;let n,r,o=this.items.length;for(;;o--){if(this.items.get(o-1).selection){--o;break}}t&&(n=this.remapping(o,this.items.length),r=n.maps.length);let i,s,a=e.tr,l=[],c=[];return this.items.forEach(((e,t)=>{if(!e.step)return n||(n=this.remapping(o,t+1),r=n.maps.length),r--,void c.push(e);if(n){c.push(new Sp(e.map));let t,o=e.step.map(n.slice(r));o&&a.maybeStep(o).doc&&(t=a.mapping.maps[a.mapping.maps.length-1],l.push(new Sp(t,void 0,void 0,l.length+c.length))),r--,t&&n.appendMap(t,r)}else a.maybeStep(e.step);return e.selection?(i=n?e.selection.map(n.slice(r)):e.selection,s=new Np(this.items.slice(0,o).append(c.reverse().concat(l)),this.eventCount-1),!1):void 0}),this.items.length,0),{remaining:s,transform:a,selection:i}}addTransform(e,t,n,r){let o=[],i=this.eventCount,s=this.items,a=!r&&s.length?s.get(s.length-1):null;for(let n=0;n<e.steps.length;n++){let l,c=e.steps[n].invert(e.docs[n]),d=new Sp(e.mapping.maps[n],c,t);(l=a&&a.merge(d))&&(d=l,n?o.pop():s=s.slice(0,s.length-1)),o.push(d),t&&(i++,t=void 0),r||(a=d)}let l=i-n.depth;return l>Tp&&(s=function(e,t){let n;return e.forEach(((e,r)=>{if(e.selection&&0==t--)return n=r,!1})),e.slice(n)}(s,l),i-=l),new Np(s.append(o),i)}remapping(e,t){let n=new Bt;return this.items.forEach(((t,r)=>{let o=null!=t.mirrorOffset&&r-t.mirrorOffset>=e?n.maps.length-t.mirrorOffset:void 0;n.appendMap(t.map,o)}),e,t),n}addMaps(e){return 0==this.eventCount?this:new Np(this.items.append(e.map((e=>new Sp(e)))),this.eventCount)}rebased(e,t){if(!this.eventCount)return this;let n=[],r=Math.max(0,this.items.length-t),o=e.mapping,i=e.steps.length,s=this.eventCount;this.items.forEach((e=>{e.selection&&s--}),r);let a=t;this.items.forEach((t=>{let r=o.getMirror(--a);if(null==r)return;i=Math.min(i,r);let l=o.maps[r];if(t.step){let i=e.steps[r].invert(e.docs[r]),c=t.selection&&t.selection.map(o.slice(a+1,r));c&&s++,n.push(new Sp(l,i,c))}else n.push(new Sp(l))}),r);let l=[];for(let e=t;e<i;e++)l.push(new Sp(o.maps[e]));let c=this.items.slice(0,r).append(l).append(n),d=new Np(c,s);return d.emptyItemCount()>500&&(d=d.compress(this.items.length-n.length)),d}emptyItemCount(){let e=0;return this.items.forEach((t=>{t.step||e++})),e}compress(e=this.items.length){let t=this.remapping(0,e),n=t.maps.length,r=[],o=0;return this.items.forEach(((i,s)=>{if(s>=e)r.push(i),i.selection&&o++;else if(i.step){let e=i.step.map(t.slice(n)),s=e&&e.getMap();if(n--,s&&t.appendMap(s,n),e){let a=i.selection&&i.selection.map(t.slice(n));a&&o++;let l,c=new Sp(s.invert(),e,a),d=r.length-1;(l=r.length&&r[d].merge(c))?r[d]=l:r.push(c)}}else i.map&&n--}),this.items.length,0),new Np(wp.from(r.reverse()),o)}}Np.empty=new Np(wp.empty,0);class Sp{constructor(e,t,n,r){this.map=e,this.step=t,this.selection=n,this.mirrorOffset=r}merge(e){if(this.step&&e.step&&!e.selection){let t=e.step.merge(this.step);if(t)return new Sp(t.getMap().invert(),t,this.selection)}}}class Mp{constructor(e,t,n,r,o){this.done=e,this.undone=t,this.prevRanges=n,this.prevTime=r,this.prevComposition=o}}const Tp=20;function Op(e){let t=[];for(let n=e.length-1;n>=0&&0==t.length;n--)e[n].forEach(((e,n,r,o)=>t.push(r,o)));return t}function Ep(e,t){if(!e)return null;let n=[];for(let r=0;r<e.length;r+=2){let o=t.map(e[r],1),i=t.map(e[r+1],-1);o<=i&&n.push(o,i)}return n}let Ap=!1,Dp=null;function Rp(e){let t=e.plugins;if(Dp!=t){Ap=!1,Dp=t;for(let e=0;e<t.length;e++)if(t[e].spec.historyPreserveItems){Ap=!0;break}}return Ap}const Lp=new Wn("history"),Ip=new Wn("closeHistory");function zp(e={}){return e={depth:e.depth||100,newGroupDelay:e.newGroupDelay||500},new Hn({key:Lp,state:{init:()=>new Mp(Np.empty,Np.empty,null,0,-1),apply:(t,n,r)=>function(e,t,n,r){let o,i=n.getMeta(Lp);if(i)return i.historyState;n.getMeta(Ip)&&(e=new Mp(e.done,e.undone,null,0,-1));let s=n.getMeta("appendedTransaction");if(0==n.steps.length)return e;if(s&&s.getMeta(Lp))return s.getMeta(Lp).redo?new Mp(e.done.addTransform(n,void 0,r,Rp(t)),e.undone,Op(n.mapping.maps),e.prevTime,e.prevComposition):new Mp(e.done,e.undone.addTransform(n,void 0,r,Rp(t)),null,e.prevTime,e.prevComposition);if(!1===n.getMeta("addToHistory")||s&&!1===s.getMeta("addToHistory"))return(o=n.getMeta("rebased"))?new Mp(e.done.rebased(n,o),e.undone.rebased(n,o),Ep(e.prevRanges,n.mapping),e.prevTime,e.prevComposition):new Mp(e.done.addMaps(n.mapping.maps),e.undone.addMaps(n.mapping.maps),Ep(e.prevRanges,n.mapping),e.prevTime,e.prevComposition);{let o=n.getMeta("composition"),i=0==e.prevTime||!s&&e.prevComposition!=o&&(e.prevTime<(n.time||0)-r.newGroupDelay||!function(e,t){if(!t)return!1;if(!e.docChanged)return!0;let n=!1;return e.mapping.maps[0].forEach(((e,r)=>{for(let o=0;o<t.length;o+=2)e<=t[o+1]&&r>=t[o]&&(n=!0)})),n}(n,e.prevRanges)),a=s?Ep(e.prevRanges,n.mapping):Op(n.mapping.maps);return new Mp(e.done.addTransform(n,i?t.selection.getBookmark():void 0,r,Rp(t)),Np.empty,a,n.time,null==o?e.prevComposition:o)}}(n,r,t,e)},config:e,props:{handleDOMEvents:{beforeinput(e,t){let n=t.inputType,r="historyUndo"==n?Bp:"historyRedo"==n?$p:null;return!!r&&(t.preventDefault(),r(e.state,e.dispatch))}}}})}function Pp(e,t){return(n,r)=>{let o=Lp.getState(n);if(!o||0==(e?o.undone:o.done).eventCount)return!1;if(r){let i=function(e,t,n){let r=Rp(t),o=Lp.get(t).spec.config,i=(n?e.undone:e.done).popEvent(t,r);if(!i)return null;let s=i.selection.resolve(i.transform.doc),a=(n?e.done:e.undone).addTransform(i.transform,t.selection.getBookmark(),o,r),l=new Mp(n?a:i.remaining,n?i.remaining:a,null,0,-1);return i.transform.setSelection(s).setMeta(Lp,{redo:n,historyState:l})}(o,n,e);i&&r(t?i.scrollIntoView():i)}return!0}}const Bp=Pp(!1,!0),$p=Pp(!0,!0);Za.create({name:"characterCount",addOptions:()=>({limit:null,mode:"textSize",textCounter:e=>e.length,wordCounter:e=>e.split(" ").filter((e=>""!==e)).length}),addStorage:()=>({characters:()=>0,words:()=>0}),onBeforeCreate(){this.storage.characters=e=>{const t=(null==e?void 0:e.node)||this.editor.state.doc;if("textSize"===((null==e?void 0:e.mode)||this.options.mode)){const e=t.textBetween(0,t.content.size,void 0," ");return this.options.textCounter(e)}return t.nodeSize},this.storage.words=e=>{const t=(null==e?void 0:e.node)||this.editor.state.doc,n=t.textBetween(0,t.content.size," "," ");return this.options.wordCounter(n)}},addProseMirrorPlugins(){let e=!1;return[new Hn({key:new Wn("characterCount"),appendTransaction:(t,n,r)=>{if(e)return;const o=this.options.limit;if(null==o||0===o)return void(e=!0);const i=this.storage.characters({node:r.doc});if(i>o){const t=0,n=i-o;console.warn(`[CharacterCount] Initial content exceeded limit of ${o} characters. Content was automatically trimmed.`);const s=r.tr.deleteRange(t,n);return e=!0,s}e=!0},filterTransaction:(e,t)=>{const n=this.options.limit;if(!e.docChanged||0===n||null==n)return!0;const r=this.storage.characters({node:t.doc}),o=this.storage.characters({node:e.doc});if(o<=n)return!0;if(r>n&&o>n&&o<=r)return!0;if(r>n&&o>n&&o>r)return!1;if(!e.getMeta("paste"))return!1;const i=e.selection.$head.pos,s=i-(o-n),a=i;e.deleteRange(s,a);return!(this.storage.characters({node:e.doc})>n)}})]}});var Vp=Za.create({name:"dropCursor",addOptions:()=>({color:"currentColor",width:1,class:void 0}),addProseMirrorPlugins(){return[hp(this.options)]}});Za.create({name:"focus",addOptions:()=>({className:"has-focus",mode:"all"}),addProseMirrorPlugins(){return[new Hn({key:new Wn("focus"),props:{decorations:({doc:e,selection:t})=>{const{isEditable:n,isFocused:r}=this.editor,{anchor:o}=t,i=[];if(!n||!r)return Ri.create(e,[]);let s=0;"deepest"===this.options.mode&&e.descendants(((e,t)=>{if(e.isText)return;if(!(o>=t&&o<=t+e.nodeSize-1))return!1;s+=1}));let a=0;return e.descendants(((e,t)=>{if(e.isText)return!1;if(!(o>=t&&o<=t+e.nodeSize-1))return!1;a+=1;if("deepest"===this.options.mode&&s-a>0||"shallowest"===this.options.mode&&a>1)return"deepest"===this.options.mode;i.push(Ei.node(t,t+e.nodeSize,{class:this.options.className}))})),Ri.create(e,i)}}})]}});var jp=Za.create({name:"gapCursor",addProseMirrorPlugins:()=>[new Hn({props:{decorations:bp,createSelectionBetween:(e,t,n)=>t.pos==n.pos&&pp.valid(n)?new pp(n):null,handleClick:yp,handleKeyDown:mp,handleDOMEvents:{beforeinput:vp}}})],extendNodeSchema(e){var t;return{allowGapCursor:null!=(t=sa(na(e,"allowGapCursor",{name:e.name,options:e.options,storage:e.storage})))?t:null}}});function Fp({types:e,node:t}){return t&&Array.isArray(e)&&e.includes(t.type)||(null==t?void 0:t.type)===e}Za.create({name:"placeholder",addOptions:()=>({emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",placeholder:"Write something …",showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}),addProseMirrorPlugins(){return[new Hn({key:new Wn("placeholder"),props:{decorations:({doc:e,selection:t})=>{const n=this.editor.isEditable||!this.options.showOnlyWhenEditable,{anchor:r}=t,o=[];if(!n)return null;const i=this.editor.isEmpty;return e.descendants(((e,t)=>{const n=r>=t&&r<=t+e.nodeSize,s=!e.isLeaf&&Pa(e);if((n||!this.options.showOnlyCurrent)&&s){const r=[this.options.emptyNodeClass];i&&r.push(this.options.emptyEditorClass);const s=Ei.node(t,t+e.nodeSize,{class:r.join(" "),"data-placeholder":"function"==typeof this.options.placeholder?this.options.placeholder({editor:this.editor,node:e,pos:t,hasAnchor:n}):this.options.placeholder});o.push(s)}return this.options.includeChildren})),Ri.create(e,o)}}})]}}),Za.create({name:"selection",addOptions:()=>({className:"selection"}),addProseMirrorPlugins(){const{editor:e,options:t}=this;return[new Hn({key:new Wn("selection"),props:{decorations:n=>n.selection.empty||e.isFocused||!e.isEditable||Ba(n.selection)||e.view.dragging?null:Ri.create(n.doc,[Ei.inline(n.selection.from,n.selection.to,{class:t.className})])}})]}});var Hp=Za.create({name:"trailingNode",addOptions:()=>({node:"paragraph",notAfter:[]}),addProseMirrorPlugins(){const e=new Wn(this.name),t=Object.entries(this.editor.schema.nodes).map((([,e])=>e)).filter((e=>(this.options.notAfter||[]).concat(this.options.node).includes(e.name)));return[new Hn({key:e,appendTransaction:(t,n,r)=>{const{doc:o,tr:i,schema:s}=r,a=e.getState(r),l=o.content.size,c=s.nodes[this.options.node];if(a)return i.insert(l,c.create())},state:{init:(e,n)=>!Fp({node:n.tr.doc.lastChild,types:t}),apply:(e,n)=>{if(!e.docChanged)return n;return!Fp({node:e.doc.lastChild,types:t})}}})]}}),_p=Za.create({name:"undoRedo",addOptions:()=>({depth:100,newGroupDelay:500}),addCommands:()=>({undo:()=>({state:e,dispatch:t})=>Bp(e,t),redo:()=>({state:e,dispatch:t})=>$p(e,t)}),addProseMirrorPlugins(){return[zp(this.options)]},addKeyboardShortcuts(){return{"Mod-z":()=>this.editor.commands.undo(),"Shift-Mod-z":()=>this.editor.commands.redo(),"Mod-y":()=>this.editor.commands.redo(),"Mod-я":()=>this.editor.commands.undo(),"Shift-Mod-я":()=>this.editor.commands.redo()}}}),qp=Za.create({name:"starterKit",addExtensions(){var e,t,n,r;const o=[];return!1!==this.options.bold&&o.push(Lc.configure(this.options.bold)),!1!==this.options.blockquote&&o.push(lp.configure(this.options.blockquote)),!1!==this.options.bulletList&&o.push($c.configure(this.options.bulletList)),!1!==this.options.code&&o.push(sd.configure(this.options.code)),!1!==this.options.codeBlock&&o.push(dd.configure(this.options.codeBlock)),!1!==this.options.document&&o.push(ud.configure(this.options.document)),!1!==this.options.dropcursor&&o.push(Vp.configure(this.options.dropcursor)),!1!==this.options.gapcursor&&o.push(jp.configure(this.options.gapcursor)),!1!==this.options.hardBreak&&o.push(cp.configure(this.options.hardBreak)),!1!==this.options.heading&&o.push(fd.configure(this.options.heading)),!1!==this.options.undoRedo&&o.push(_p.configure(this.options.undoRedo)),!1!==this.options.horizontalRule&&o.push(dp.configure(this.options.horizontalRule)),!1!==this.options.italic&&o.push(xd.configure(this.options.italic)),!1!==this.options.listItem&&o.push(Vc.configure(this.options.listItem)),!1!==this.options.listKeymap&&o.push(Yc.configure(null==(e=this.options)?void 0:e.listKeymap)),!1!==this.options.link&&o.push(wu.configure(null==(t=this.options)?void 0:t.link)),!1!==this.options.orderedList&&o.push(Zc.configure(this.options.orderedList)),!1!==this.options.paragraph&&o.push(Su.configure(this.options.paragraph)),!1!==this.options.strike&&o.push(Eu.configure(this.options.strike)),!1!==this.options.text&&o.push(Du.configure(this.options.text)),!1!==this.options.underline&&o.push(Lu.configure(null==(n=this.options)?void 0:n.underline)),!1!==this.options.trailingNode&&o.push(Hp.configure(null==(r=this.options)?void 0:r.trailingNode)),o}}),Wp=function(n){var r=n.initialContent,o=void 0===r?"":r,i=n.onUpdate,s=ip({extensions:[qp.configure({heading:!1,codeBlock:!1}),pd,Mu,Ru,Ic,wd,Iu,Au,ad,hd.configure({HTMLAttributes:{class:"bg-gray-100 p-3 rounded text-sm font-mono"}}),md.configure({levels:[1,2,3]}),rd,Nu,Cu,ku.configure({openOnClick:!1,HTMLAttributes:{class:"text-blue-600 underline"}})],content:o,onUpdate:function(e){var t=e.editor;i(t.getHTML())},editorProps:{attributes:{class:"prose prose-sm sm:prose lg:prose-lg xl:prose-2xl mx-auto focus:outline-none min-h-[200px] p-4"}},immediatelyRender:!1});return s?t("div",{className:"rounded-lg border border-gray-200 shadow-sm",children:[t("div",{className:"flex flex-wrap items-center gap-1 border-b bg-gray-50 p-3",children:[e("button",{onClick:function(){return s.chain().focus().undo().run()},className:"p-2 rounded hover:bg-gray-200 transition-colors ".concat(s.can().undo()?"":"opacity-50 cursor-not-allowed"),type:"button",disabled:!s.can().undo(),title:"Undo",children:e(te,{size:16})}),e("button",{onClick:function(){return s.chain().focus().redo().run()},className:"p-2 rounded hover:bg-gray-200 transition-colors ".concat(s.can().redo()?"":"opacity-50 cursor-not-allowed"),type:"button",disabled:!s.can().redo(),title:"Redo",children:e(Y,{size:16})}),e("div",{className:"mx-2 h-6 w-px bg-gray-300"}),e("button",{onClick:function(){return s.chain().focus().toggleHeading({level:1}).run()},className:"p-2 rounded transition-colors ".concat(s.isActive("heading",{level:1})?"bg-blue-200 text-blue-800":"hover:bg-gray-200"),type:"button",title:"Heading 1",children:e(F,{size:16})}),e("button",{onClick:function(){return s.chain().focus().toggleHeading({level:2}).run()},className:"p-2 rounded transition-colors ".concat(s.isActive("heading",{level:2})?"bg-blue-200 text-blue-800":"hover:bg-gray-200"),type:"button",title:"Heading 2",children:e(H,{size:16})}),e("button",{onClick:function(){return s.chain().focus().toggleHeading({level:3}).run()},className:"p-2 rounded transition-colors ".concat(s.isActive("heading",{level:3})?"bg-blue-200 text-blue-800":"hover:bg-gray-200"),type:"button",title:"Heading 3",children:e(_,{size:16})}),e(X,{className:"mx-2 h-6 w-px bg-gray-300"}),e("button",{onClick:function(){return s.chain().focus().toggleBold().run()},className:"p-2 rounded transition-colors ".concat(s.isActive("bold")?"bg-blue-200 text-blue-800":"hover:bg-gray-200"),type:"button",title:"Bold",children:e(T,{size:16})}),e("button",{onClick:function(){return s.chain().focus().toggleItalic().run()},className:"p-2 rounded transition-colors ".concat(s.isActive("italic")?"bg-blue-200 text-blue-800":"hover:bg-gray-200"),type:"button",title:"Italic",children:e(W,{size:16})}),e("button",{onClick:function(){return s.chain().focus().toggleUnderline().run()},className:"p-2 rounded transition-colors ".concat(s.isActive("underline")?"bg-blue-200 text-blue-800":"hover:bg-gray-200"),type:"button",title:"Underline",children:e(ee,{size:16})}),e("button",{onClick:function(){return s.chain().focus().toggleStrike().run()},className:"p-2 rounded transition-colors ".concat(s.isActive("strike")?"bg-blue-200 text-blue-800":"hover:bg-gray-200"),type:"button",title:"Strikethrough",children:e(Q,{size:16})}),e(X,{className:"mx-2 h-6 w-px bg-gray-300"}),e("button",{onClick:function(){return s.chain().focus().toggleBulletList().run()},className:"p-2 rounded transition-colors ".concat(s.isActive("bulletList")?"bg-blue-200 text-blue-800":"hover:bg-gray-200"),type:"button",title:"Bullet List",children:e(U,{size:16})}),e("button",{onClick:function(){return s.chain().focus().toggleOrderedList().run()},className:"p-2 rounded transition-colors ".concat(s.isActive("orderedList")?"bg-blue-200 text-blue-800":"hover:bg-gray-200"),type:"button",title:"Numbered List",children:e(J,{size:16})}),e(X,{className:"mx-2 h-6 w-px bg-gray-300"}),e("button",{onClick:function(){return s.chain().focus().toggleCode().run()},className:"p-2 rounded transition-colors ".concat(s.isActive("code")?"bg-blue-200 text-blue-800":"hover:bg-gray-200"),type:"button",title:"Inline Code",children:e(I,{size:16})}),e("button",{onClick:function(){return s.chain().focus().toggleCodeBlock().run()},className:"p-2 rounded transition-colors ".concat(s.isActive("codeBlock")?"bg-blue-200 text-blue-800":"hover:bg-gray-200"),type:"button",title:"Code Block",children:e(B,{size:16})}),e(X,{className:"mx-2 h-6 w-px bg-gray-300"}),e("button",{onClick:function(){return s.chain().focus().toggleBlockquote().run()},className:"p-2 rounded transition-colors ".concat(s.isActive("blockquote")?"bg-blue-200 text-blue-800":"hover:bg-gray-200"),type:"button",title:"Quote",children:e(G,{size:16})}),e(X,{className:"mx-2 h-6 w-px bg-gray-300"}),s.isActive("link")?e("button",{onClick:function(){null==s||s.chain().focus().unsetLink().run()},className:"p-2 rounded bg-blue-200 text-blue-800 hover:bg-blue-300 transition-colors",type:"button",title:"Remove Link",children:e(K,{size:16})}):e("button",{onClick:function(){var e=window.prompt("Enter URL:");e&&(null==s||s.chain().focus().setLink({href:e}).run())},className:"p-2 rounded hover:bg-gray-200 transition-colors",type:"button",title:"Add Link",children:e(K,{size:16})})]}),e(Qu,{editor:s,className:"min-h-[300px] focus-within:bg-white"})]}):e("div",{className:"rounded-lg border bg-gray-50 h-48 animate-pulse"})};function Kp(n){var r=n.options,o=n.placeholder,i=void 0===o?"Select an option":o,a=n.onChange,l=n.value,c=n.size,d=void 0===c?"md":c,h=n.className,u=void 0===h?"":h,p=n.name,f=n.id,m=n.disabled,g=void 0!==m&&m,y=n.label,v=n.required,b=s(!1),x=b[0],w=b[1],k=s(l&&r.find((function(e){return e.value===l}))||null),C=k[0],N=k[1];return t("div",{className:"relative inline-block",children:[y&&t("label",{htmlFor:f,className:"mb-1 block text-sm font-medium text-gray-700",children:[y,v&&e("span",{className:"ml-1 text-red-500",children:"*"})]}),t("button",{type:"button",className:"flex w-full items-center justify-between rounded-md border border-gray-200 bg-white shadow-sm ".concat({sm:"px-3 py-2 text-sm",md:"px-4 py-2.5 text-base"}[d]," text-gray-700 hover:bg-gray-50 focus:outline-none ").concat(g?"cursor-not-allowed opacity-50":""," ").concat(u),onClick:function(){return!g&&w(!x)},disabled:g,id:f,children:[e("span",{className:"truncate",children:C?(null==C?void 0:C.label)||C.value:i}),e(E,{className:"ml-2 h-4 w-4 ".concat(x?"rotate-180 transform":"")})]}),x&&e("div",{className:"absolute z-10 mt-1 max-h-60 w-full min-w-[200px] p-1 font-medium text-sm overflow-auto rounded-lg bg-white shadow-xl",children:r.map((function(n){return t("div",{className:"cursor-pointer px-3 py-2 hover:bg-gray-100 rounded-lg flex justify-between item-center ".concat((null==C?void 0:C.value)===n.value?"bg-gray-50 text-black":"text-gray-900"),onClick:function(){return function(e){N(e),a(e.value),w(!1)}(n)},children:[e("div",{children:n.label||n.value}),(null==C?void 0:C.value)===n.value&&e("div",{children:e(O,{size:15,className:"text-primary"})})]},n.value)}))}),p&&e("input",{type:"hidden",name:p,value:(null==C?void 0:C.value)||""})]})}var Jp=function(n){var r=n.message,o=n.description,i=n.type,a=void 0===i?"info":i,c=n.duration,d=void 0===c?5e3:c,h=n.onClose,u=s(!0),p=u[0],f=u[1],m=s(100),g=m[0],y=m[1],v={success:{icon:e(R,{className:"h-5 w-5"}),bgColor:"bg-green-50",borderColor:"border-green-300",textColor:"text-green-800",iconColor:"text-green-500",progressColor:"bg-green-500"},error:{icon:e(D,{className:"h-5 w-5"}),bgColor:"bg-rose-50",borderColor:"border-rose-300",textColor:"text-rose-800",iconColor:"text-rose-500",progressColor:"bg-rose-500"},info:{icon:e(q,{className:"h-5 w-5"}),bgColor:"bg-blue-50",borderColor:"border-blue-300",textColor:"text-blue-800",iconColor:"text-blue-500",progressColor:"bg-blue-500"},warning:{icon:e(Z,{className:"h-5 w-5"}),bgColor:"bg-amber-50 ",borderColor:"border-amber-300 ",textColor:"text-amber-800",iconColor:"text-amber-500",progressColor:"bg-amber-500"}};l((function(){var e=setTimeout((function(){f(!1),setTimeout((function(){null==h||h()}),300)}),d),t=setInterval((function(){y((function(e){var t=e-100/(d/100);return t<=0?0:t}))}),100);return function(){clearTimeout(e),clearInterval(t)}}),[d,h]);var b=v[a],x=b.icon,w=b.bgColor,k=b.borderColor,C=b.textColor,N=b.iconColor,S=b.progressColor;return e("div",{className:"fixed right-4 top-4 z-50 transform transition-all duration-300 ".concat(p?"translate-x-0 opacity-100":"translate-x-full opacity-0"),children:t("div",{className:"flex w-72 rounded-lg border shadow-lg md:w-96 ".concat(k," ").concat(w," p-4"),children:[e("div",{className:"flex-shrink-0 ".concat(N),children:x}),t("div",{className:"ml-3 w-full",children:[t("div",{className:"flex items-start justify-between",children:[e("div",{className:"text-md font-semibold ".concat(C),children:r}),e("button",{onClick:function(){f(!1),setTimeout((function(){null==h||h()}),300)},className:"text-gray-600 hover:text-gray-600 focus:outline-none",children:e(re,{className:"h-4 w-4"})})]}),o&&e("p",{className:"mt-1 text-sm ".concat(C," opacity-80"),children:o}),e("div",{className:"mt-2 h-1 w-full rounded-full bg-gray-200",children:e("div",{className:"".concat(S," h-1 rounded-full transition-all duration-100 ease-linear"),style:{width:"".concat(g,"%")}})})]})]})})},Up=null,Gp=u(void 0),Yp=function(n){var r=n.children,o=s([]),i=o[0],a=o[1],l=f((function(e){a((function(t){return t.filter((function(t){return t.id!==e}))}))}),[]),c=f((function(e){var t=Math.random().toString(36).substring(2,9),n=le(le({},e),{id:t,onClose:function(){return l(t)}});a((function(e){return de(de([],e,!0),[n],!1)}))}),[l]),d=f((function(e){return function(t,n){c({message:t,description:n,type:e})}}),[c]),h={showAlert:c,success:d("success"),error:d("error"),info:d("info"),warning:d("warning")};return Up=h,t(Gp.Provider,{value:h,children:[r,e("div",{className:"fixed right-4 top-4 z-50 space-y-2 w-full max-w-xs",children:i.map((function(t,n){return e("div",{style:{transform:"translateY(".concat(10*n,"px)"),zIndex:50-n},children:e(Jp,le({},t))},t.id)}))})]})},Xp=function(){var e=p(Gp);if(void 0===e)throw new Error("useAlert must be used within a AlertProvider");return e},Qp={success:function(e,t){Up?Up.success(e,t):console.warn("AlertProvider not mounted yet")},error:function(e,t){Up?Up.error(e,t):console.warn("AlertProvider not mounted yet")},info:function(e,t){Up?Up.info(e,t):console.warn("AlertProvider not mounted yet")},warning:function(e,t){Up?Up.warning(e,t):console.warn("AlertProvider not mounted yet")},show:function(e){Up?Up.showAlert(e):console.warn("AlertProvider not mounted yet")}},Zp=function(n){var r=n.isOpen,o=n.onConfirm,i=n.onCancel,s=n.title,c=n.message,d=n.confirmText,h=void 0===d?"Confirm":d,u=n.cancelText,p=void 0===u?"Cancel":u,f=n.type,m=void 0===f?"default":f,g=n.showIcon,y=void 0===g||g,v=n.showCloseButton,b=void 0===v||v,w=n.closeOnOverlayClick,k=void 0===w||w,C=n.closeOnEscape,N=void 0===C||C,S=n.isLoading,M=void 0!==S&&S,T=n.className,O=void 0===T?"":T,E=n.overlayClassName,A=void 0===E?"":E,D=n.maxWidth,I=void 0===D?"sm":D,z=a(null),P=a(null),B=a(null);l((function(){return r?(B.current=document.activeElement,setTimeout((function(){var e,t,n;"danger"===m?null===(t=null===(e=z.current)||void 0===e?void 0:e.querySelector("[data-cancel-button]"))||void 0===t||t.focus():null===(n=P.current)||void 0===n||n.focus()}),100),document.body.style.overflow="hidden"):(document.body.style.overflow="unset",B.current&&B.current.focus()),function(){document.body.style.overflow="unset"}}),[r,m]),l((function(){var e=function(e){"Escape"===e.key&&N&&!M&&i()};return r&&document.addEventListener("keydown",e),function(){document.removeEventListener("keydown",e)}}),[r,N,i,M]);var $=function(){M||i()},V={default:{icon:q,iconColor:"text-blue-600",iconBg:"bg-blue-100",confirmButton:"bg-blue-600 hover:bg-blue-700 focus:ring-blue-500"},danger:{icon:L,iconColor:"text-red-600",iconBg:"bg-red-100",confirmButton:"bg-red-600 hover:bg-red-700 focus:ring-red-500"},warning:{icon:Z,iconColor:"text-yellow-600",iconBg:"bg-yellow-100",confirmButton:"bg-yellow-600 hover:bg-yellow-700 focus:ring-yellow-500"},success:{icon:R,iconColor:"text-green-600",iconBg:"bg-green-100",confirmButton:"bg-green-600 hover:bg-green-700 focus:ring-green-500"},info:{icon:q,iconColor:"text-blue-600",iconBg:"bg-blue-100",confirmButton:"bg-blue-600 hover:bg-blue-700 focus:ring-blue-500"}}[m],j=V.icon;return r?t("div",{className:"fixed inset-0 z-50 ".concat(A),role:"dialog","aria-modal":"true","aria-labelledby":s?"confirmation-title":void 0,"aria-describedby":"confirmation-message",children:[e("div",{className:"fixed inset-0 bg-black/50 backdrop-blur-sm transition-opacity duration-300",onClick:function(e){e.target===e.currentTarget&&k&&!M&&i()}}),e("div",{className:"fixed inset-0 flex items-center justify-center p-4",children:t("div",{ref:z,className:"relative w-full ".concat({sm:"max-w-sm",md:"max-w-md",lg:"max-w-lg"}[I]," animate-in fade-in-0 zoom-in-95 slide-in-from-bottom-4 transform rounded-2xl bg-white shadow-2xl transition-all duration-300 ease-out ").concat(O," "),onClick:function(e){return e.stopPropagation()},children:[b&&e("button",{onClick:$,disabled:M,className:"absolute right-4 top-4 flex h-8 w-8 items-center justify-center rounded-full text-gray-400 transition-colors duration-200 hover:bg-gray-100 hover:text-gray-600 focus:outline-none focus:ring-2 focus:ring-gray-500 focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50","aria-label":"Close",children:e(re,{size:20})}),t("div",{className:"p-6",children:[t("div",{className:"flex flex-col items-center justify-center space-y-4",children:[y&&e("div",{className:"h-12 w-12 flex-shrink-0 rounded-full ".concat(V.iconBg," flex items-center justify-center"),children:e(j,{size:24,className:V.iconColor})}),t("div",{className:"min-w-0 flex-1 justify-center",children:[s&&e("h3",{id:"confirmation-title",className:"mb-1 text-center text-lg font-semibold text-gray-900",children:s}),e("p",{id:"confirmation-message",className:"leading-relaxed text-gray-600",children:c})]})]}),t("div",{className:"flex ".concat("justify-center"," mt-6 space-x-3"),children:[e(x,{variant:"neutral",outline:!0,size:"small","data-cancel-button":"",onClick:$,disabled:M,children:p}),e("button",{ref:P,onClick:function(){M||o()},disabled:M,className:"flex min-w-[80px] items-center justify-center rounded-xl px-4 py-2 text-sm font-medium text-white transition-colors duration-200 focus:outline-none focus:ring-2 focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 ".concat(V.confirmButton," "),children:M?e("div",{className:"h-4 w-4 animate-spin rounded-full border-2 border-white border-t-transparent"}):h})]})]})]})})]}):null},ef=function(n){var r=n.isOpen,o=n.onClose,i=n.title,s=n.children,c=n.size,d=void 0===c?"md":c,h=n.position,u=void 0===h?"right":h,p=n.showCloseButton,f=void 0===p||p,m=n.closeOnOverlayClick,g=void 0===m||m,y=n.closeOnEscape,v=void 0===y||y,b=n.className,x=void 0===b?"":b,w=n.overlayClassName,k=void 0===w?"":w,C=n.contentClassName,N=void 0===C?"":C,S=n.headerClassName,M=void 0===S?"":S,T=n.footer,O=n.footerClassName,E=void 0===O?"":O,A=n.maxHeight,D=void 0!==A&&A,R=a(null),L=a(null);l((function(){var e;return r?(L.current=document.activeElement,null===(e=R.current)||void 0===e||e.focus(),document.body.style.overflow="hidden"):(document.body.style.overflow="unset",L.current&&L.current.focus()),function(){document.body.style.overflow="unset"}}),[r]),l((function(){var e=function(e){"Escape"===e.key&&v&&o()};return r&&document.addEventListener("keydown",e),function(){document.removeEventListener("keydown",e)}}),[r,v,o]);var I=function(e){e.target===e.currentTarget&&g&&"full"!==d&&o()};return r?t("div",{className:"fixed inset-0 z-50 ".concat(k),role:"dialog","aria-modal":"true","aria-labelledby":i?"modal-title":void 0,children:["full"!==d&&e("div",{className:"fixed inset-0 bg-black/50 backdrop-blur-sm transition-opacity duration-700",onClick:I}),e("div",{className:"fixed inset-0 flex ".concat("p-0"," ").concat(function(){if("full"===d)return"items-start justify-start";return{left:"items-start justify-start",right:"items-start justify-end",center:"items-center justify-center"}[u]}()),onClick:I,children:t("div",{ref:R,tabIndex:-1,className:"\n relative w-full ".concat({xs:"max-w-xs",sm:"max-w-sm",md:"max-w-md",lg:"max-w-lg",xl:"max-w-xl","2xl":"max-w-2xl",full:"w-full h-full"}[d]," bg-white shadow-2xl transform transition-all duration-700 ease-out flex flex-col\n ").concat("full"===d?"h-full max-h-screen overflow-hidden":"left"===u||"right"===u?"h-full ".concat(D?"max-h-screen":""):"".concat(D?"max-h-[90vh] overflow-hidden":""),"\n ").concat("full"===d?"animate-in fade-in-0":"center"===u?"animate-in fade-in-0 zoom-in-95":"left"===u?"animate-in slide-in-from-left-full":"animate-in slide-in-from-right-full","\n ").concat(x,"\n "),onClick:function(e){return e.stopPropagation()},children:[(i||f)&&t("div",{className:"flex items-center justify-between px-6 py-3 border-b border-gray-200 flex-shrink-0 ".concat(M),children:[i&&e("h2",{id:"modal-title",className:"text-xl font-semibold text-gray-900 truncate pr-4",children:i}),f&&e("button",{onClick:o,className:"flex items-center justify-center w-8 h-8 rounded-full text-gray-400 hover:text-gray-600 hover:bg-gray-100 transition-colors duration-200 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2","aria-label":"Close modal",children:e(re,{size:20})})]}),e("div",{className:"flex-1 min-h-0 overflow-y-auto ".concat(D||"full"===d?"overflow-y-auto":""," ").concat(N),children:e("div",D&&("left"===u||"right"===u)||"full"===d?{className:"p-6 min-h-0 flex-1",children:s}:{className:"p-6",children:s})}),T&&e("div",{className:"px-6 py-4 border-t border-gray-200 flex-shrink-0 ".concat(""," ").concat(E),children:T})]})})]}):null},tf=function(){var n=r.useState(!1),o=n[0],i=n[1],s=r.useState("left"),a=s[0],l=s[1],c=r.useState("md"),d=c[0],h=c[1],u=t("div",{className:"flex justify-end space-x-3",children:[e("button",{onClick:function(){return i(!1)},className:"px-4 py-2 text-sm font-medium text-gray-700 bg-white border border-gray-300 rounded-lg hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 transition-colors duration-200",children:"Cancel"}),e("button",{onClick:function(){return i(!1)},className:"px-4 py-2 text-sm font-medium text-white bg-blue-600 rounded-lg hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 transition-colors duration-200",children:"Save Changes"})]});return t("div",{className:"p-8 space-y-4",children:[t("div",{className:"flex flex-wrap gap-4 mb-6",children:[t("div",{children:[e("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"Position"}),t("select",{value:a,onChange:function(e){return l(e.target.value)},className:"border border-gray-300 rounded-md px-3 py-2 text-sm",disabled:"full"===d,children:[e("option",{value:"left",children:"Left"}),e("option",{value:"right",children:"Right"}),e("option",{value:"center",children:"Center"})]})]}),t("div",{children:[e("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"Size"}),t("select",{value:d,onChange:function(e){return h(e.target.value)},className:"border border-gray-300 rounded-md px-3 py-2 text-sm",children:[e("option",{value:"xs",children:"Extra Small"}),e("option",{value:"sm",children:"Small"}),e("option",{value:"md",children:"Medium"}),e("option",{value:"lg",children:"Large"}),e("option",{value:"xl",children:"Extra Large"}),e("option",{value:"2xl",children:"2X Large"}),e("option",{value:"full",children:"Full Screen"})]})]})]}),e("button",{onClick:function(){return i(!0)},className:"px-6 py-3 bg-blue-600 text-white rounded-lg hover:bg-blue-700 transition-colors duration-200 font-medium",children:"Open Modal"}),e(ef,{isOpen:o,onClose:function(){return i(!1)},title:"Example Modal",size:d,position:a,footer:u,maxHeight:"center"!==a,children:t("div",{className:"space-y-4",children:[e("p",{className:"text-gray-600",children:"This is an example of the multipurpose modal component. It supports different sizes, positions, and configurations."}),t("div",{className:"bg-gray-50 p-4 rounded-lg",children:[e("h4",{className:"font-medium text-gray-900 mb-2",children:"Features:"}),t("ul",{className:"text-sm text-gray-600 space-y-1 list-disc list-inside",children:[e("li",{children:"Multiple sizes (xs, sm, md, lg, xl, 2xl, full screen)"}),e("li",{children:"Three positions (left, right, center)"}),e("li",{children:"Customizable styling with className props"}),e("li",{children:"Keyboard navigation and accessibility"}),e("li",{children:"Click outside to close (disabled for full screen)"}),e("li",{children:"Smooth animations"}),e("li",{children:"Optional footer with actions"}),e("li",{children:"Full screen mode without margins or border radius"})]})]}),("left"===a||"right"===a||"full"===d)&&e("div",{className:"space-y-2",children:Array.from({length:20},(function(e,n){return t("p",{className:"text-gray-600",children:["This is paragraph ",n+1," to demonstrate scrolling in side panels","full"===d?" and full screen mode":"","."]},n)}))})]})})]})};function nf(n){var r=n.currentPage,o=n.totalPages,i=n.totalItems,s=n.itemsPerPage,a=n.onPageChange,l=n.onViewChange,c=n.loading,d=void 0!==c&&c,h=function(e){e>0&&e<=o&&!d&&a&&a(e)},u=(r-1)*s,p=Math.min(u+s,i);return t("div",{className:"flex items-center justify-between border-t border-gray-200 bg-white py-3",children:[t("div",{className:"flex flex-1 justify-between sm:hidden",children:[e("button",{onClick:function(){return h(r-1)},disabled:1===r||d,className:"relative inline-flex items-center rounded-md border border-gray-300 bg-white px-4 py-2 text-sm font-medium text-gray-700 hover:bg-gray-50 ".concat(1===r||d?"cursor-not-allowed opacity-50":""),children:"Previous"}),e("button",{onClick:function(){return h(r+1)},disabled:r===o||d,className:"relative ml-3 inline-flex items-center rounded-md border border-gray-300 bg-white px-4 py-2 text-sm font-medium text-gray-700 hover:bg-gray-50 ".concat(r===o||d?"cursor-not-allowed opacity-50":""),children:"Next"})]}),t("div",{className:"hidden sm:flex sm:flex-1 sm:items-center sm:justify-between",children:[t("div",{className:"flex items-center justify-center gap-2",children:[t("div",{className:"relative",children:[e("select",{value:s,onChange:function(e){return l&&l(e.target.value)},disabled:d,className:"appearance-none rounded-md border border-gray-300 bg-white py-2 pl-3 pr-8 text-sm focus:outline-none focus:ring-2 focus:ring-blue-500",children:[10,20,30,50].map((function(t){return e("option",{value:t,children:t},t)}))}),e("div",{className:"pointer-events-none absolute inset-y-0 right-0 flex items-center px-2 text-gray-700",children:e("svg",{className:"h-4 w-4",fill:"currentColor",viewBox:"0 0 20 20",children:e("path",{fillRule:"evenodd",d:"M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z",clipRule:"evenodd"})})})]}),t("p",{className:"text-sm text-gray-700",children:[t("span",{children:[i," Entries"]}),t("span",{className:"ml-1",children:["(Showing ",u+1,"-",p," of ",i,")"]})]})]}),e("div",{children:t("nav",{className:"relative z-0 inline-flex gap-2 -space-x-px rounded-md shadow-sm","aria-label":"Pagination",children:[t("button",{onClick:function(){return h(r-1)},disabled:1===r||d,className:"relative inline-flex items-center rounded-md border border-gray-300 bg-white px-2 py-2 text-sm font-medium text-gray-500 hover:bg-gray-50 ".concat(1===r||d?"cursor-not-allowed opacity-50":""),children:[e("span",{className:"sr-only",children:"Previous"}),e("svg",{className:"h-5 w-5",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true",children:e("path",{fillRule:"evenodd",d:"M12.707 5.293a1 1 0 010 1.414L9.414 10l3.293 3.293a1 1 0 01-1.414 1.414l-4-4a1 1 0 010-1.414l4-4a1 1 0 011.414 0z",clipRule:"evenodd"})})]}),function(){var e=[];if(o<=5)for(var t=1;t<=o;t++)e.push(t);else{var n=Math.max(1,r-2),i=Math.min(o,n+5-1);i-n<4&&(n=Math.max(1,i-5+1));for(t=n;t<=i;t++)e.push(t)}return e}().map((function(t){return e("button",{onClick:function(){return h(t)},disabled:d,"aria-current":r===t?"page":void 0,className:"relative inline-flex items-center rounded-md border px-4 py-2 text-sm font-semibold ".concat(r===t?"z-10 border-primary-100 bg-primary-50 text-primary":"border-gray-300 bg-white text-gray-500 hover:bg-gray-50"," ").concat(d?"cursor-not-allowed opacity-50":""),children:t},t)})),t(x,{onClick:function(){return h(r+1)},disabled:r===o||d,type:"button",variant:"primary",size:"small",outline:!0,children:["Next Page",e("svg",{className:"h-5 w-5",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true",children:e("path",{fillRule:"evenodd",d:"M7.293 14.707a1 1 0 010-1.414L10.586 10 7.293 6.707a1 1 0 011.414-1.414l4 4a1 1 0 010 1.414l-4 4a1 1 0 01-1.414 0z",clipRule:"evenodd"})})]})]})})]})]})}function rf(t){var r=t.columns,o=void 0===r?5:r,i=t.rows,s=void 0===i?3:i;return e(n,{children:Array.from({length:s}).map((function(t,n){return e("tr",{children:Array.from({length:o}).map((function(t,r){return e("td",{className:"whitespace-nowrap px-6 py-4",children:e("div",{className:"h-4 animate-pulse rounded bg-gray-200"})},"skeleton-cell-".concat(n,"-").concat(r))}))},"skeleton-row-".concat(n))}))})}function of(r){var o=r.data,i=r.columns,s=r.itemsPerPage,a=void 0===s?20:s,l=r.onViewChange,c=r.totalItems,d=r.currentPage,h=void 0===d?1:d,u=r.onPageChange,p=r.loading,f=void 0!==p&&p,m=r.showPagination,g=void 0===m||m,y=r.onRowClick,v=r.useCardLayout,b=void 0!==v&&v,x=c||o.length,w=Math.ceil(x/a),k=o,C=function(e){y&&y(e)},N=function(){return t("div",{className:"grid gap-4 grid-cols-1 sm:grid-cols-2 lg:grid-cols-3",children:[f&&Array.from({length:a}).map((function(n,r){return e("div",{className:"bg-white rounded-lg border border-gray-200 p-4 animate-pulse",children:e("div",{className:"space-y-3",children:i.slice(0,3).map((function(n,r){return t("div",{className:"flex justify-between items-center",children:[e("div",{className:"h-4 bg-gray-200 rounded w-1/3"}),e("div",{className:"h-4 bg-gray-200 rounded w-1/2"})]},r)}))})},r)})),k.length>0?k.map((function(n,r){return e("div",{onClick:function(){return C(n)},className:"bg-white rounded-lg border border-gray-200 p-4 transition-all duration-200 hover:shadow-md hover:border-gray-300 ".concat(y?"cursor-pointer":""," ").concat(f?"opacity-50":""),children:e("div",{className:"space-y-3",children:i.map((function(r,o){return t("div",{className:"flex justify-between items-start",children:[t("span",{className:"text-sm font-medium text-gray-500 flex-shrink-0 mr-3",children:[r.title,":"]}),e("span",{className:"text-sm text-gray-800 text-right",children:"function"==typeof r.value?r.value(n):n[r.value]})]},o)}))})},r)})):!f&&e("div",{className:"col-span-full",children:e(ae,{title:"No Record found"})})]})};return t(n,{children:[b?N():t(n,{children:[e("div",{className:"hidden md:block",children:e("div",{className:"relative overflow-x-auto",children:t("table",{className:"w-full",children:[e("thead",{children:e("tr",{children:i.map((function(t,n){return e("th",{className:"bg-gray-100 px-6 py-3 text-left text-sm font-semibold tracking-wider text-gray-500 ".concat(t.width||""," ").concat(0===n?"rounded-bl-xl rounded-tl-xl":""," ").concat(n===i.length-1?"rounded-br-xl rounded-tr-xl":""," "),children:t.title},n)}))})}),t("tbody",{className:"divide-y divide-gray-200 bg-white \n ".concat(f?"opacity-50":""," ").concat(y?"cursor-pointer":"","\n "),children:[f&&e(rf,{columns:i.length,rows:a}),k.length>0?k.map((function(t,n){return e("tr",{onClick:function(){return C(t)},className:"hover:bg-gray-50",children:i.map((function(n,r){return e("td",{className:"whitespace-nowrap px-6 py-4 text-sm font-medium text-gray-800",children:"function"==typeof n.value?n.value(t):t[n.value]},r)}))},n)})):!f&&e("tr",{children:e("td",{colSpan:i.length,children:e(ae,{title:"No Record found"})})})]})]})})}),e("div",{className:"block md:hidden",children:N()})]}),g&&e(nf,{currentPage:h,totalPages:w,totalItems:x,itemsPerPage:a,onPageChange:u,onViewChange:l,loading:f})]})}function sf(n){var r=n.actions,o=n.trigger,i=n.className,c=void 0===i?"":i,d=n.dropdownClassName,h=void 0===d?"":d,u=s(!1),p=u[0],f=u[1],m=a(null),g=function(){f(!p)},y=function(){f(!1)};l((function(){var e=function(e){m.current&&!m.current.contains(e.target)&&y()};return p&&document.addEventListener("mousedown",e),function(){document.removeEventListener("mousedown",e)}}),[p]),l((function(){var e=function(e){"Escape"===e.key&&y()};return p&&document.addEventListener("keydown",e),function(){document.removeEventListener("keydown",e)}}),[p]);return t("div",{className:"relative inline-block ".concat(c),ref:m,children:[e("div",{className:"flex",children:o?e("div",{onClick:g,className:"cursor-pointer",children:o}):e("button",{className:"rounded-md border-gray-300 bg-white px-2 py-2 text-sm font-medium text-gray-700 transition-colors duration-200 focus:ring-offset-2",onClick:g,"aria-expanded":p,"aria-haspopup":"true",children:e(P,{className:"h-4 w-4"})})}),p&&e("div",{className:"absolute right-0 z-50 mt-1 w-48 origin-top-right rounded-md bg-white shadow-lg ring-1 ring-black ring-opacity-5 focus:outline-none ".concat(h),children:t("div",{className:"py-1",role:"menu","aria-orientation":"vertical",children:[r.map((function(n,r){return t("button",{className:"flex w-full items-center px-4 py-2 text-left text-sm transition-colors duration-150 ".concat(n.disabled?"cursor-not-allowed bg-gray-50 text-gray-400":"danger"===n.variant?"text-red-700 hover:bg-red-50 hover:text-red-900":"text-gray-700 hover:bg-gray-100 hover:text-gray-900"," "),onClick:function(){return function(e){e.disabled||(e.onClick(),y())}(n)},disabled:n.disabled,role:"menuitem",children:[n.icon&&e("span",{className:"mr-3 flex-shrink-0",children:n.icon}),n.label]},r)})),0===r.length&&e("div",{className:"px-4 py-2 text-sm text-gray-500",children:"No actions available"})]})})]})}var af={xs:{width:"4rem",height:"1rem"},sm:{width:"6rem",height:"1.25rem"},md:{width:"8rem",height:"1.5rem"},lg:{width:"12rem",height:"2rem"},xl:{width:"16rem",height:"2.5rem"}},lf={text:{baseClasses:"rounded",defaultSize:{width:"100%",height:"1rem"}},rectangular:{baseClasses:"",defaultSize:{width:"100%",height:"8rem"}},circular:{baseClasses:"rounded-full aspect-square",defaultSize:{width:"3rem",height:"3rem"}},rounded:{baseClasses:"rounded-lg",defaultSize:{width:"100%",height:"6rem"}},card:{baseClasses:"rounded-lg",defaultSize:{width:"100%",height:"12rem"}},avatar:{baseClasses:"rounded-full aspect-square",defaultSize:{width:"2.5rem",height:"2.5rem"}},button:{baseClasses:"rounded-md",defaultSize:{width:"5rem",height:"2.25rem"}},image:{baseClasses:"rounded",defaultSize:{width:"100%",height:"10rem"}},line:{baseClasses:"rounded-full",defaultSize:{width:"100%",height:"0.25rem"}}},cf=function(t){var n=t.variant,o=void 0===n?"text":n,i=t.animation,s=void 0===i?"pulse":i,a=t.size,l=t.width,c=t.height,d=t.count,h=void 0===d?1:d,u=t.className,p=void 0===u?"":u,f=t.shimmer,m=void 0!==f&&f,g=t.borderRadius,y=t.intensity,v=void 0===y?"medium":y,b=t.delay,x=void 0===b?0:b,w=r.useState(0===x),k=w[0],C=w[1];r.useEffect((function(){!function(){if("undefined"!=typeof document&&!document.getElementById("skeleton-loader-styles")){var e=document.createElement("style");e.id="skeleton-loader-styles",e.textContent="\n @keyframes wave {\n 0% { transform: translateX(-100%); }\n 50% { transform: translateX(100%); }\n 100% { transform: translateX(100%); }\n }\n\n @keyframes shimmer {\n 0% { background-position: -200% 0; }\n 100% { background-position: 200% 0; }\n }\n\n .skeleton-wave {\n animation: wave 1.6s linear infinite;\n position: relative;\n overflow: hidden;\n }\n\n .skeleton-shimmer {\n animation: shimmer 2s ease-in-out infinite;\n background-size: 200% 100%;\n }\n\n .skeleton-wave::after {\n content: '';\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n background: linear-gradient(\n 90deg,\n transparent,\n rgba(255, 255, 255, 0.6),\n transparent\n );\n animation: wave 1.6s linear infinite;\n }\n",document.head.appendChild(e)}}()}),[]);var N=lf[o],S=r.useMemo((function(){return{width:void 0!==l?"number"==typeof l?"".concat(l,"px"):l:a?af[a].width:N.defaultSize.width,height:void 0!==c?"number"==typeof c?"".concat(c,"px"):c:a?af[a].height:N.defaultSize.height}}),[l,c,a,N]);if(r.useEffect((function(){if(x>0){var e=setTimeout((function(){return C(!0)}),x);return function(){return clearTimeout(e)}}}),[x]),!k)return null;var M=function(){var e=["block","bg-gray-200",N.baseClasses];switch("pulse"===s?e.push("animate-pulse"):"wave"===s&&e.push("animate-wave"),v){case"light":e.push("bg-gray-100");break;case"medium":e.push("bg-gray-200");break;case"dark":e.push("bg-gray-300")}return m&&e.push("bg-gradient-to-r","from-gray-200","via-gray-100","to-gray-200","bg-200%","animate-shimmer"),e.join(" ")},T=function(t){return e("div",{className:"".concat(M()," ").concat(p),style:(n={width:S.width,height:S.height},g&&(n.borderRadius=g),n),"aria-hidden":"true"},t);var n};return h>1?e("div",{className:"space-y-2",children:Array.from({length:h},(function(e,t){return T(t)}))}):T(0)},df=function(t){return e(cf,le({},t,{variant:"text"}))},hf=function(t){return e(cf,le({},t,{variant:"avatar"}))},uf=function(t){return e(cf,le({},t,{variant:"button"}))},pf=function(t){return e(cf,le({},t,{variant:"card"}))},ff=function(t){return e(cf,le({},t,{variant:"image"}))},mf=function(n){var r=n.showBio,o=void 0===r||r;return t("div",{className:"flex items-start space-x-4",children:[e(hf,{size:"lg"}),t("div",{className:"flex-1 space-y-2",children:[e(df,{width:"60%",height:"1.25rem"}),e(df,{width:"40%",height:"1rem",intensity:"light"}),o&&t("div",{className:"space-y-1 pt-2",children:[e(df,{width:"100%"}),e(df,{width:"80%"}),e(df,{width:"90%"})]})]})]})},gf=function(n){var r=n.itemCount,o=void 0===r?3:r,i=n.showAvatar,s=void 0===i||i,a=n.showMeta,l=void 0===a||a;return e("div",{className:"space-y-4",children:Array.from({length:o},(function(n,r){return t("div",{className:"flex items-start space-x-3",children:[s&&e(hf,{}),t("div",{className:"flex-1 space-y-2",children:[e(df,{width:"75%",height:"1.125rem"}),e(df,{width:"100%",height:"0.875rem",intensity:"light"}),l&&t("div",{className:"flex space-x-4",children:[e(df,{width:"3rem",height:"0.75rem",intensity:"light"}),e(df,{width:"4rem",height:"0.75rem",intensity:"light"})]})]})]},r)}))})},yf=function(n){var r=n.rows,o=void 0===r?5:r,i=n.columns,s=void 0===i?4:i,a=n.showHeader;return t("div",{className:"space-y-3",children:[(void 0===a||a)&&e("div",{className:"flex space-x-4",children:Array.from({length:s},(function(t,n){return e(df,{width:"100%",height:"1rem",intensity:"dark"},n)}))}),e("div",{className:"space-y-2",children:Array.from({length:o},(function(t,n){return e("div",{className:"flex space-x-4",children:Array.from({length:s},(function(t,n){return e(df,{width:"100%",height:"0.875rem"},n)}))},n)}))})]})},vf=function(){return t(se,{children:[e("div",{className:"mb-4",children:e(df,{width:"180px",height:"28px"})}),t("div",{className:"mt-4 grid grid-cols-1 gap-4",children:[t("div",{className:"rounded-lg bg-blue-50 p-4",children:[e(df,{width:"40px",height:"32px",className:"mb-1"}),e(df,{width:"100px",height:"16px"})]}),t("div",{className:"rounded-lg bg-green-50 p-4",children:[e(df,{width:"40px",height:"32px",className:"mb-1"}),e(df,{width:"110px",height:"16px"})]}),t("div",{className:"rounded-lg bg-yellow-50 p-4",children:[e(df,{width:"40px",height:"32px",className:"mb-1"}),e(df,{width:"120px",height:"16px"})]})]})]})},bf=function(){return t("div",{className:"bg-white p-5",children:[e(cf,{variant:"text",width:"200px"}),e(cf,{variant:"text",count:3}),e(hf,{size:"lg"}),e(uf,{animation:"wave"}),e(mf,{showBio:!0}),e(gf,{itemCount:5,showAvatar:!0}),e(yf,{rows:5,columns:4}),e(cf,{variant:"card",shimmer:!0,intensity:"dark",borderRadius:"12px",className:"custom-skeleton"})]})},xf="1.0.0",wf={sizes:{xs:{width:"4rem",height:"1rem"},sm:{width:"6rem",height:"1.25rem"},md:{width:"8rem",height:"1.5rem"},lg:{width:"12rem",height:"2rem"},xl:{width:"16rem",height:"2.5rem"}},variants:["text","rectangular","circular","rounded","card","avatar","button","image","line"],animations:["pulse","wave","none"],intensities:["light","medium","dark"]},kf={userProfile:{variant:"avatar",size:"lg",animation:"pulse"},cardTitle:{variant:"text",width:"75%",height:"1.5rem"},cardDescription:{variant:"text",count:2,width:"100%",height:"1rem",intensity:"light"},button:{variant:"button",animation:"wave"},image:{variant:"image",shimmer:!0}},Cf=function(n){var r=n.size,o=void 0===r?"md":r,i=n.variant,s=void 0===i?"pulse":i,a=n.color,l=void 0===a?"primary":a,c=n.fullScreen,d=void 0!==c&&c,h=n.text,u=n.className,p=void 0===u?"":u,f=n.image,m=n.imageEffect,g=void 0===m?"pulse":m,y=l.startsWith("#"),v=function(e){return y?"":{text:"text-".concat(l),bg:"bg-".concat(l),border:"border-".concat(l),borderTop:"border-t-".concat(l),borderRight:"border-r-".concat(l)}[e]||""},b={sm:"w-4 h-4",md:"w-8 h-8",lg:"w-12 h-12",xl:"w-16 h-16"},x={sm:"w-8 h-8",md:"w-12 h-12",lg:"w-16 h-16",xl:"w-20 h-20"},w=function(){switch(g){case"bounce":return"animate-bounce";case"spin":return"animate-spin";case"float":return"animate-pulse hover:animate-bounce";case"heartbeat":return"animate-ping";default:return"animate-pulse"}},k=function(){return t("div",{className:"relative flex items-center justify-center",children:[e("img",{src:f,alt:"Loading",className:"".concat(x[o]," object-contain ").concat(w()),style:{filter:"drop-shadow(0 4px 8px rgba(0, 0, 0, 0.1))",animationDuration:"heartbeat"===g?"1.5s":"bounce"===g?"1s":"2s"}}),"float"===g&&e("div",{className:"absolute inset-0 ".concat(x[o]," rounded-full bg-gradient-to-r from-purple-400 to-blue-400 opacity-20 animate-ping"),style:{animationDuration:"2s"}})]})},C=function(){return t("div",{className:"relative",children:[e("div",{className:"".concat(b[o]," border-4 border-gray-200 rounded-full animate-spin ").concat(y?"":v("borderTop")),style:y?{borderTopColor:l}:{}}),e("div",{className:"absolute inset-0 ".concat(b[o]," border-4 border-transparent rounded-full animate-spin ").concat(y?"":v("borderRight")),style:y?{borderRightColor:l,animationDirection:"reverse",animationDuration:"0.75s"}:{animationDirection:"reverse",animationDuration:"0.75s"}})]})},N=function(){return e("div",{className:"flex space-x-1",children:[0,1,2].map((function(t){return e("div",{className:"".concat("sm"===o?"w-2 h-2":"md"===o?"w-3 h-3":"lg"===o?"w-4 h-4":"w-5 h-5"," rounded-full animate-bounce ").concat(y?"":v("bg")),style:y?{backgroundColor:l,animationDelay:"".concat(.2*t,"s"),animationDuration:"1.4s"}:{animationDelay:"".concat(.2*t,"s"),animationDuration:"1.4s"}},t)}))})},S=function(){return t("div",{className:"relative",children:[e("div",{className:"".concat(b[o]," rounded-full animate-pulse ").concat(y?"":v("bg")),style:y?{backgroundColor:l}:{}}),e("div",{className:"absolute inset-0 ".concat(b[o]," rounded-full animate-ping opacity-30 ").concat(y?"":v("bg")),style:y?{backgroundColor:l}:{}})]})},M=function(){return e("div",{className:"flex space-x-1 items-end",children:[0,1,2,3].map((function(t){return e("div",{className:"".concat("sm"===o?"w-1":"md"===o?"w-1.5":"lg"===o?"w-2":"w-2.5"," rounded-sm animate-pulse ").concat(y?"":v("bg")),style:y?{backgroundColor:l,height:"".concat(20+10*t,"px"),animationDelay:"".concat(.15*t,"s"),animationDuration:"1.2s"}:{height:"".concat(20+10*t,"px"),animationDelay:"".concat(.15*t,"s"),animationDuration:"1.2s"}},t)}))})},T=function(){return t("div",{className:"relative",children:[e("div",{className:"".concat(b[o]," border-4 rounded-full animate-ping ").concat(y?"":v("border")),style:y?{borderColor:l}:{}}),e("div",{className:"absolute inset-2 border-4 rounded-full animate-ping ".concat(y?"":v("border")),style:y?{borderColor:l,animationDelay:"0.5s"}:{animationDelay:"0.5s"}})]})},O=t("div",{className:"flex flex-col items-center justify-center space-y-3 ".concat(p),children:[function(){if("image"===s&&f)return e(k,{});switch(s){case"dots":return e(N,{});case"pulse":return e(S,{});case"bars":return e(M,{});case"ripple":return e(T,{});default:return e(C,{})}}(),h&&e("p",{className:"".concat({sm:"text-xs",md:"text-sm",lg:"text-base",xl:"text-lg"}[o]," font-medium animate-pulse ").concat(y?"":v("text")),style:y?{color:l}:{},children:h})]});return d?e("div",{className:"fixed inset-0 bg-white/80 backdrop-blur-sm flex items-center justify-center z-50",children:O}):O},Nf=function(){var n=r.useState("blue-500"),o=n[0],i=n[1],s=r.useState("spinner"),a=s[0],l=s[1],c=r.useState("md"),d=c[0],h=c[1],u=r.useState(!1),p=u[0],f=u[1],m=["spinner","dots","pulse","bars","ripple"];return t("div",{className:"p-8 max-w-4xl mx-auto",children:[e("h1",{className:"text-3xl font-bold text-gray-800 mb-8 text-center",children:"Modern Loading Component"}),t("div",{className:"bg-white rounded-xl shadow-lg p-6 mb-8",children:[e("h2",{className:"text-xl font-semibold text-gray-700 mb-4",children:"Customization"}),t("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-4 mb-6",children:[t("div",{children:[e("label",{className:"block text-sm font-medium text-gray-600 mb-2",children:"Color"}),e("div",{className:"flex flex-wrap gap-2",children:[{name:"Blue",value:"blue-500",hex:"#3B82F6"},{name:"Purple",value:"purple-500",hex:"#8B5CF6"},{name:"Green",value:"green-500",hex:"#10B981"},{name:"Red",value:"red-500",hex:"#EF4444"},{name:"Orange",value:"orange-500",hex:"#F59E0B"},{name:"Pink",value:"pink-500",hex:"#EC4899"},{name:"Indigo",value:"indigo-500",hex:"#6366F1"},{name:"Teal",value:"teal-500",hex:"#14B8A6"}].map((function(t){return e("button",{onClick:function(){return i(t.value)},className:"w-8 h-8 rounded-full border-2 transition-all ".concat(o===t.value?"border-gray-400 scale-110":"border-gray-200"),style:{backgroundColor:t.hex},title:"".concat(t.name," (").concat(t.value,")")},t.value)}))})]}),t("div",{children:[e("label",{className:"block text-sm font-medium text-gray-600 mb-2",children:"Variant"}),e("select",{value:a,onChange:function(e){return l(e.target.value)},className:"w-full p-2 border border-gray-300 rounded-md focus:ring-2 focus:ring-blue-500 focus:border-transparent",children:m.map((function(t){return e("option",{value:t,children:t&&(null==t?void 0:t.charAt(0).toUpperCase())+(null==t?void 0:t.slice(1))},t)}))})]}),t("div",{children:[e("label",{className:"block text-sm font-medium text-gray-600 mb-2",children:"Size"}),e("select",{value:d,onChange:function(e){return h(e.target.value)},className:"w-full p-2 border border-gray-300 rounded-md focus:ring-2 focus:ring-blue-500 focus:border-transparent",children:["sm","md","lg","xl"].map((function(t){return e("option",{value:t,children:null==t?void 0:t.toUpperCase()},t)}))})]}),t("div",{children:[e("label",{className:"block text-sm font-medium text-gray-600 mb-2",children:"Full Screen"}),e("button",{onClick:function(){return f(!0)},className:"w-full p-2 bg-gray-600 text-white rounded-md hover:bg-gray-700 transition-colors",children:"Demo Full Screen"})]})]}),t("div",{className:"bg-gray-50 rounded-lg p-8 flex flex-col items-center justify-center min-h-32",children:[e(Cf,{variant:a,size:d,color:o,text:"Loading..."}),e("div",{className:"mt-4 p-3 bg-white rounded-md shadow-sm",children:t("code",{className:"text-sm text-gray-600",children:['color="',o,'"']})})]})]}),t("div",{className:"bg-white rounded-xl shadow-lg p-6",children:[e("h2",{className:"text-xl font-semibold text-gray-700 mb-4",children:"All Variants"}),e("div",{className:"grid grid-cols-2 md:grid-cols-3 lg:grid-cols-5 gap-6",children:m.map((function(n){return t("div",{className:"text-center",children:[e("div",{className:"bg-gray-50 rounded-lg p-4 flex items-center justify-center h-24 mb-2",children:e(Cf,{variant:n,color:o})}),e("p",{className:"text-sm text-gray-600 capitalize",children:n})]},n)}))}),t("div",{className:"mt-6 p-4 bg-blue-50 rounded-lg",children:[e("h3",{className:"font-semibold text-blue-800 mb-2",children:"Usage Examples:"}),t("div",{className:"space-y-2 text-sm",children:[t("div",{className:"bg-white p-2 rounded border",children:[e("code",{className:"text-blue-600",children:"// Tailwind CSS class"}),e("br",{}),e("code",{children:'<Loading color="primary-500" />'})]}),t("div",{className:"bg-white p-2 rounded border",children:[e("code",{className:"text-blue-600",children:"// Hex color"}),e("br",{}),e("code",{children:'<Loading color="#your-brand-color" />'})]}),t("div",{className:"bg-white p-2 rounded border",children:[e("code",{className:"text-blue-600",children:"// Custom Tailwind color"}),e("br",{}),e("code",{children:'<Loading color="emerald-400" variant="dots" />'})]})]})]})]}),p&&e(Cf,{variant:a,size:d,color:o,text:"Loading in full screen...",fullScreen:!0}),p&&e("button",{onClick:function(){return f(!1)},className:"fixed top-4 right-4 z-50 bg-red-500 text-white px-4 py-2 rounded-md hover:bg-red-600 transition-colors",children:"Close Full Screen"})]})},Sf=function(n){var r=n.items,o=void 0===r?[]:r,i=n.onBackClick,s=n.showBackButton,a=void 0===s||s,l=n.separator,c=void 0===l?" / ":l,d=n.className;return t("div",{className:"flex gap-2 ".concat(void 0===d?"":d),children:[a&&e("div",{onClick:i,className:"cursor-pointer",children:e(A,{className:"text-gray-500 transition-colors hover:text-gray-700"})}),e("p",{className:"text-gray-400",children:o.map((function(n,r){return t("span",{children:[n.isActive?e("span",{className:"text-primary",children:n.label}):e("span",{className:n.onClick?"cursor-pointer transition-colors hover:text-gray-600":"",onClick:n.onClick,children:n.label}),r<o.length-1&&c]},r)}))})]})},Mf=function(r){var o=r.children,i=r.content,c=r.position,d=void 0===c?"top":c,h=r.variant,u=void 0===h?"light":h,p=r.size,f=void 0===p?"md":p,m=r.delay,g=void 0===m?200:m,y=r.disabled,v=void 0!==y&&y,b=r.className,x=void 0===b?"":b,w=s(!1),k=w[0],C=w[1],N=s(d),S=N[0],M=N[1],T=a(null),O=a(null),E=a(null);l((function(){if(k&&O.current&&E.current){var e=O.current,t=E.current.getBoundingClientRect(),n=e.getBoundingClientRect(),r=d;"top"===d&&t.top-n.height<10?r="bottom":"bottom"===d&&t.bottom+n.height>window.innerHeight-10?r="top":"left"===d&&t.left-n.width<10?r="right":"right"===d&&t.right+n.width>window.innerWidth-10&&(r="left"),M(r)}}),[k,d]);var A=function(){v||(T.current&&clearTimeout(T.current),T.current=setTimeout((function(){C(!0)}),g))},D=function(){T.current&&clearTimeout(T.current),C(!1)};l((function(){return function(){T.current&&clearTimeout(T.current)}}),[]);var R={dark:{tooltip:"bg-gray-900 text-white border-gray-700",arrow:{top:"border-t-gray-900",bottom:"border-b-gray-900",left:"border-l-gray-900",right:"border-r-gray-900"}},light:{tooltip:"bg-white text-gray-900 border-gray-200 shadow-lg",arrow:{top:"border-t-white",bottom:"border-b-white",left:"border-l-white",right:"border-r-white"}},accent:{tooltip:"bg-blue-600 text-white border-blue-500",arrow:{top:"border-t-blue-600",bottom:"border-b-blue-600",left:"border-l-blue-600",right:"border-r-blue-600"}}};return v||!i?e(n,{children:o}):t("div",{className:"relative inline-block",children:[e("div",{ref:E,onMouseEnter:A,onMouseLeave:D,onFocus:A,onBlur:D,className:"cursor-help",children:o}),k&&t("div",{ref:O,className:"absolute z-50 ".concat({top:"bottom-full left-1/2 -translate-x-1/2 mb-2",bottom:"top-full left-1/2 -translate-x-1/2 mt-2",left:"right-full top-1/2 -translate-y-1/2 mr-2",right:"left-full top-1/2 -translate-y-1/2 ml-2"}[S]," ").concat(R[u].tooltip," ").concat({sm:"px-2 py-1 text-xs",md:"px-3 py-2 text-sm",lg:"px-4 py-3 text-base"}[f]," animate-in fade-in-0 zoom-in-95 max-w-xs whitespace-nowrap break-words rounded-lg border font-medium backdrop-blur-sm duration-200 ").concat(x," "),role:"tooltip","aria-hidden":"false",children:[i,e("div",{className:"absolute h-0 w-0 border-4 ".concat({top:"top-full left-1/2 -translate-x-1/2 border-l-transparent border-r-transparent border-b-transparent",bottom:"bottom-full left-1/2 -translate-x-1/2 border-l-transparent border-r-transparent border-t-transparent",left:"left-full top-1/2 -translate-y-1/2 border-t-transparent border-b-transparent border-r-transparent",right:"right-full top-1/2 -translate-y-1/2 border-t-transparent border-b-transparent border-l-transparent"}[S]," ").concat(R[u].arrow[S]," ")})]})]})},Tf=function(t){var n=t.children,r=t.variant,o=void 0===r?"default":r,i=t.size,s=void 0===i?"md":i,a=t.className,l=void 0===a?"":a,c=t.onClick,d=["inline-flex items-center font-medium rounded-full transition-colors duration-200",{default:"bg-gray-100 text-gray-800 hover:bg-gray-200",secondary:"bg-blue-100 text-blue-800 hover:bg-blue-200",success:"bg-green-100 text-green-800 hover:bg-green-200",warning:"bg-yellow-100 text-yellow-800 hover:bg-yellow-200",error:"bg-red-100 text-red-800 hover:bg-red-200",info:"bg-cyan-100 text-cyan-800 hover:bg-cyan-200"}[o],{sm:"px-2 py-0.5 text-xs",md:"px-2.5 py-1 text-sm",lg:"px-3 py-1.5 text-base"}[s],c?"cursor-pointer":"",l].filter(Boolean).join(" ");return e("span",{className:d,onClick:c,role:c?"button":void 0,tabIndex:c?0:void 0,onKeyDown:c?function(e){"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),c())}:void 0,children:n})};export{Gp as AlertContext,Yp as AlertProvider,Tf as Badge,Sf as Breadcrumb,x as Button,se as Card,vf as CardStatsSkeleton,he as CheckBox,pe as CheckBoxDemo,Zp as ConfirmationAlert,be as DateTimePicker,xe as DateTimePickerDemo,ae as EmptyStateCard,ie as ExportButton,fe as FileUpload,me as Input,ge as InputWithPrefix,Cf as Loading,Nf as LoadingDemo,ef as Modal,tf as ModalExample,nf as Pagination,ue as RadioGroup,xf as SKELETON_LOADER_VERSION,kf as SKELETON_PATTERNS,wf as SKELETON_PRESETS,we as Search,ke as Select,Kp as SelectButton,hf as SkeletonAvatar,uf as SkeletonButton,pf as SkeletonCard,ff as SkeletonImage,gf as SkeletonList,cf as SkeletonLoader,bf as SkeletonLoaderExample,mf as SkeletonProfile,yf as SkeletonTable,df as SkeletonText,of as Table,sf as TableDropdown,rf as TableSkeleton,ye as TagInput,ve as TagInputDemo,Wp as TextEditor,Mf as Tooltip,Qp as alert,Xp as useAlert};
51
51
  //# sourceMappingURL=index.mjs.map