1import{c as oe,t as de,f as Fn,aT as ws,aV as Cr,aW as Ol,aX as bp,aY as vp,r as w,j as p,M as te,g as vu,h as xu,A as ku,i as pi,q as Lr,o as hn,P as ua,n as xp,R as kp,p as wp,F as Sp,D as Cp,C as Mp,w as Np,J as wu,z as Ep,K as Tp,G as Ap,H as Op,I as _e,B as be,aZ as xt,a_ as Dp,aS as Rp,a$ as da,b0 as _p,b1 as Ip,aM as St,b2 as Su,aJ as Dl,aN as Cu,b3 as Pp,a8 as se,X as or,e as Ss,a4 as Y,s as Q,aa as vn,b4 as jp,b5 as Lp,ax as Bp,aw as zp,u as Fp,b as Vi,ao as $p,aq as Hp,ar as Vp,as as Wp,a1 as Up}from"./index-DD1X_XGF.js";import{T as qp}from"./textarea-znLT3ysG.js";import{S as en,a as tn,b as nn,c as rn,d as Fe}from"./select-qNn5g3k-.js";import{C as Mu,a as Oo}from"./clock-B8uKRFS7.js";import{C as Kp,g as Rl}from"./prices-DIGSw8Pi.js";import{C as Nu}from"./check-DJB0I5KT.js";import{C as Jp}from"./chevron-down-JmiIgBKV.js";import{H as Yp}from"./history-BPazhZ0v.js";import{E as Gp}from"./external-link-CAjc5cA8.js";/** 2 * @license lucide-react v0.462.0 - ISC 3 * 4 * This source code is licensed under the ISC license. 5 * See the LICENSE file in the root directory of this source tree. 6 */const Xp=oe("ArrowDown",[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]]);/** 7 * @license lucide-react v0.462.0 - ISC 8 * 9 * This source code is licensed under the ISC license. 10 * See the LICENSE file in the root directory of this source tree. 11 */const Qp=oe("ArrowUpDown",[["path",{d:"m21 16-4 4-4-4",key:"f6ql7i"}],["path",{d:"M17 20V4",key:"1ejh1v"}],["path",{d:"m3 8 4-4 4 4",key:"11wl7u"}],["path",{d:"M7 4v16",key:"1glfcx"}]]);/** 12 * @license lucide-react v0.462.0 - ISC 13 * 14 * This source code is licensed under the ISC license. 15 * See the LICENSE file in the root directory of this source tree. 16 */const Zp=oe("ArrowUp",[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]]);/** 17 * @license lucide-react v0.462.0 - ISC 18 * 19 * This source code is licensed under the ISC license. 20 * See the LICENSE file in the root directory of this source tree. 21 */const em=oe("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"}]]);/** 22 * @license lucide-react v0.462.0 - ISC 23 * 24 * This source code is licensed under the ISC license. 25 * See the LICENSE file in the root directory of this source tree. 26 */const tm=oe("ChevronLeft",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]);/** 27 * @license lucide-react v0.462.0 - ISC 28 * 29 * This source code is licensed under the ISC license. 30 * See the LICENSE file in the root directory of this source tree. 31 */const nm=oe("Copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]);/** 32 * @license lucide-react v0.462.0 - ISC 33 * 34 * This source code is licensed under the ISC license. 35 * See the LICENSE file in the root directory of this source tree. 36 */const rm=oe("Heading2",[["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"}]]);/** 37 * @license lucide-react v0.462.0 - ISC 38 * 39 * This source code is licensed under the ISC license. 40 * See the LICENSE file in the root directory of this source tree. 41 */const sm=oe("Heading3",[["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"}]]);/** 42 * @license lucide-react v0.462.0 - ISC 43 * 44 * This source code is licensed under the ISC license. 45 * See the LICENSE file in the root directory of this source tree. 46 */const im=oe("ImageOff",[["line",{x1:"2",x2:"22",y1:"2",y2:"22",key:"a6p6uj"}],["path",{d:"M10.41 10.41a2 2 0 1 1-2.83-2.83",key:"1bzlo9"}],["line",{x1:"13.5",x2:"6",y1:"13.5",y2:"21",key:"1q0aeu"}],["line",{x1:"18",x2:"21",y1:"12",y2:"15",key:"5mozeu"}],["path",{d:"M3.59 3.59A1.99 1.99 0 0 0 3 5v14a2 2 0 0 0 2 2h14c.55 0 1.052-.22 1.41-.59",key:"mmje98"}],["path",{d:"M21 15V5a2 2 0 0 0-2-2H9",key:"43el77"}]]);/** 47 * @license lucide-react v0.462.0 - ISC 48 * 49 * This source code is licensed under the ISC license. 50 * See the LICENSE file in the root directory of this source tree. 51 */const om=oe("Image",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]]);/** 52 * @license lucide-react v0.462.0 - ISC 53 * 54 * This source code is licensed under the ISC license. 55 * See the LICENSE file in the root directory of this source tree. 56 */const am=oe("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"}]]);/** 57 * @license lucide-react v0.462.0 - ISC 58 * 59 * This source code is licensed under the ISC license. 60 * See the LICENSE file in the root directory of this source tree. 61 */const lm=oe("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"}]]);/** 62 * @license lucide-react v0.462.0 - ISC 63 * 64 * This source code is licensed under the ISC license. 65 * See the LICENSE file in the root directory of this source tree. 66 */const cm=oe("ListOrdered",[["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"}]]);/** 67 * @license lucide-react v0.462.0 - ISC 68 * 69 * This source code is licensed under the ISC license. 70 * See the LICENSE file in the root directory of this source tree. 71 */const um=oe("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"}]]);/** 72 * @license lucide-react v0.462.0 - ISC 73 * 74 * This source code is licensed under the ISC license. 75 * See the LICENSE file in the root directory of this source tree. 76 */const dm=oe("Minus",[["path",{d:"M5 12h14",key:"1ays0h"}]]);/** 77 * @license lucide-react v0.462.0 - ISC 78 * 79 * This source code is licensed under the ISC license. 80 * See the LICENSE file in the root directory of this source tree. 81 */const Wi=oe("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);/** 82 * @license lucide-react v0.462.0 - ISC 83 * 84 * This source code is licensed under the ISC license. 85 * See the LICENSE file in the root directory of this source tree. 86 */const fm=oe("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"}]]);/** 87 * @license lucide-react v0.462.0 - ISC 88 * 89 * This source code is licensed under the ISC license. 90 * See the LICENSE file in the root directory of this source tree. 91 */const hm=oe("Redo",[["path",{d:"M21 7v6h-6",key:"3ptur4"}],["path",{d:"M3 17a9 9 0 0 1 9-9 9 9 0 0 1 6 2.3l3 2.7",key:"1kgawr"}]]);/** 92 * @license lucide-react v0.462.0 - ISC 93 * 94 * This source code is licensed under the ISC license. 95 * See the LICENSE file in the root directory of this source tree. 96 */const pm=oe("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"}]]);/** 97 * @license lucide-react v0.462.0 - ISC 98 * 99 * This source code is licensed under the ISC license. 100 * See the LICENSE file in the root directory of this source tree. 101 */const _l=oe("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}
vendor: 10,142 bytes, lines 101-116
101],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]]);/** 102 * @license lucide-react v0.462.0 - ISC 103 * 104 * This source code is licensed under the ISC license. 105 * See the LICENSE file in the root directory of this source tree. 106 */const mm=oe("Undo",[["path",{d:"M3 7v6h6",key:"1v2h90"}],["path",{d:"M21 17a9 9 0 0 0-9-9 9 9 0 0 0-6 2.3L3 13",key:"1r6uu6"}]]);/** 107 * @license lucide-react v0.462.0 - ISC 108 * 109 * This source code is licensed under the ISC license. 110 * See the LICENSE file in the root directory of this source tree. 111 */const gm=oe("Upload",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"17 8 12 3 7 8",key:"t8dd8p"}],["line",{x1:"12",x2:"12",y1:"3",y2:"15",key:"widbto"}]]);/** 112 * @license lucide-react v0.462.0 - ISC 113 * 114 * This source code is licensed under the ISC license. 115 * See the LICENSE file in the root directory of this source tree. 116 */const ym=oe("Youtube",[["path",{d:"M2.5 17a24.12 24.12 0 0 1 0-10 2 2 0 0 1 1.4-1.4 49.56 49.56 0 0 1 16.2 0A2 2 0 0 1 21.5 7a24.12 24.12 0 0 1 0 10 2 2 0 0 1-1.4 1.4 49.55 49.55 0 0 1-16.2 0A2 2 0 0 1 2.5 17",key:"1q2vi4"}],["path",{d:"m10 15 5-3-5-3z",key:"1jp15x"}]]);function Ie(n,e){const t=de(n);return isNaN(e)?Fn(n,NaN):(e&&t.setDate(t.getDate()+e),t)}function st(n,e){const t=de(n);if(isNaN(e))return Fn(n,NaN);if(!e)return t;const r=t.getDate(),s=Fn(n,t.getTime());s.setMonth(t.getMonth()+e+1,0);const i=s.getDate();return r>=i?s:(t.setFullYear(s.getFullYear(),s.getMonth(),r),t)}function Do(n,e){const t=e*7;return Ie(n,t)}function bm(n,e){return st(n,e*12)}function vm(n){let e;return n.forEach(function(t){const r=de(t);(e===void 0||e<r||isNaN(Number(r)))&&(e=r)}),e||new Date(NaN)}function xm(n){let e;return n.forEach(t=>{const r=de(t);(!e||e>r||isNaN(+r))&&(e=r)}),e||new Date(NaN)}function He(n,e){const t=ws(n),r=ws(e);return+t==+r}function Mr(n,e){const t=de(n),r=de(e),s=t.getFullYear()-r.getFullYear(),i=t.getMonth()-r.getMonth();return s*12+i}function km(n,e,t){const r=Cr(n,t),s=Cr(e,t),i=+r-Ol(r),o=+s-Ol(s);return Math.round((i-o)/bp)}function fa(n){const e=de(n),t=e.getMonth();return e.setFullYear(e.getFullYear(),t+1,0),e.setHours(23,59,59,999),e}function Ve(n){const e=de(n);return e.setDate(1),e.setHours(0,0,0,0),e}function ha(n,e){var a,l,c,u;const t=vp(),r=(e==null?void 0:e.weekStartsOn)??((l=(a=e==null?void 0:e.locale)==null?void 0:a.options)==null?void 0:l.weekStartsOn)??t.weekStartsOn??((u=(c=t.locale)==null?void 0:c.options)==null?void 0:u.weekStartsOn)??0,s=de(n),i=s.getDay(),o=(i<r?-7:0)+6-(i-r);return s.setDate(s.getDate()+o),s.setHours(23,59,59,999),s}function Eu(n){return ha(n,{weekStartsOn:1})}function wm(n){const e=de(n),t=e.getFullYear(),r=e.getMonth(),s=Fn(n,0);return s.setFullYear(t,r+1,0),s.setHours(0,0,0,0),s.getDate()}function Sm(n){return Math.trunc(+de(n)/1e3)}function Cm(n){const e=de(n),t=e.getMonth();return e.setFullYear(e.getFullYear(),t+1,0),e.setHours(0,0,0,0),e}function Mm(n,e){return km(Cm(n),Ve(n),e)+1}function Ro(n,e){const t=de(n),r=de(e);return t.getTime()>r.getTime()}function Tu(n,e){const t=de(n),r=de(e);return+t<+r}function pa(n,e){const t=de(n),r=de(e);return t.getFullYear()===r.getFullYear()&&t.getMonth()===r.getMonth()}function Nm(n,e){const t=de(n),r=de(e);return t.getFullYear()===r.getFullYear()}function Ui(n,e){return Ie(n,-e)}function qi(n,e){const t=de(n),r=t.getFullYear(),s=t.getDate(),i=Fn(n,0);i.setFullYear(r,e,15),i.setHours(0,0,0,0);const o=wm(i);return t.setMonth(e,Math.min(s,o)),t}function Il(n,e){const t=de(n);return isNaN(+t)?Fn(n,NaN):(t.setFullYear(e),t)}const Au=w.forwardRef(({className:n,...e},t)=>p.jsx("div",{className:"relative w-full overflow-auto",children:p.jsx("table",{ref:t,className:te("w-full caption-bottom text-sm",n),...e})}));Au.displayName="Table";const Ou=w.forwardRef(({className:n,...e},t)=>p.jsx("thead",{ref:t,className:te("[&_tr]:border-b",n),...e}));Ou.displayName="TableHeader";const Du=w.forwardRef(({className:n,...e},t)=>p.jsx("tbody",{ref:t,className:te("[&_tr:last-child]:border-0",n),...e}));Du.displayName="TableBody";const Em=w.forwardRef(({className:n,...e},t)=>p.jsx("tfoot",{ref:t,className:te("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0",n),...e}));Em.displayName="TableFooter";const _o=w.forwardRef(({className:n,...e},t)=>p.jsx("tr",{ref:t,className:te("border-b transition-colors data-[state=selected]:bg-muted hover:bg-muted/50",n),...e}));_o.displayName="TableRow";const on=w.forwardRef(({className:n,...e},t)=>p.jsx("th",{ref:t,className:te("h-12 px-4 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0",n),...e}));on.displayName="TableHead";const an=w.forwardRef(({className:n,...e},t)=>p.jsx("td",{ref:t,className:te("p-4 align-middle [&:has([role=checkbox])]:pr-0",n),...e}));an.displayName="TableCell";const Tm=w.forwardRef(({className:n,...e},t)=>p.jsx("caption",{ref:t,className:te("mt-4 text-sm text-muted-foreground",n),...e}));Tm.displayName="TableCaption";var mi="Popover",[Ru,dC]=vu(mi,[xu]),Br=xu(),[Am,Kt]=Ru(mi),_u=n=>{const{__scopePopover:e,children:t,open:r,defaultOpen:s,onOpenChange:i,modal:o=!1}=n,a=Br(e),l=w.useRef(null),[c,u]=w.useState(!1),[d,f]=wu({prop:r,defaultProp:s??!1,onChange:i,caller:mi});return p.jsx(Ep,{...a,children:p.jsx(Am,{scope:e,contentId:Tp(),triggerRef:l,open:d,onOpenChange:f,onOpenToggle:w.useCallback(()=>f(h=>!h),[f]),hasCustomAnchor:c,onCustomAnchorAdd:w.useCallback(()=>u(!0),[]),onCustomAnchorRemove:w.useCallback(()=>u(!1),[]),modal:o,children:t})})};_u.displayName=mi;var Iu="PopoverAnchor",Om=w.forwardRef((n,e)=>{const{__scopePopover:t,...r}=n,s=Kt(Iu,t),i=Br(t),{onCustomAnchorAdd:o,onCustomAnchorRemove:a}=s;return w.useEffect(()=>(o(),()=>a()),[o,a]),p.jsx(ku,{...i,...r,ref:e})});Om.displayName=Iu;var Pu="PopoverTrigger",ju=w.forwardRef((n,e)=>{const{__scopePopover:t,...r}=n,s=Kt(Pu,t),i=Br(t),o=pi(e,s.triggerRef),a=p.jsx(Lr.button,{type:"button","aria-haspopup":"dialog","aria-expanded":s.open,"aria-controls":s.contentId,"data-state":$u(s.open),...r,ref:o,onClick:hn(n.onClick,s.onOpenToggle)});return s.hasCustomAnchor?a:p.jsx(ku,{asChild:!0,...i,children:a})});ju.displayName=Pu;var ma="PopoverPortal",[Dm,Rm]=Ru(ma,{forceMount:void 0}),Lu=n=>{const{__scopePopover:e,forceMount:t,children:r,container:s}=n,i=Kt(ma,e);return p.jsx(Dm,{scope:e,forceMount:t,children:p.jsx(ua,{present:t||i.open,children:p.jsx(Ap,{asChild:!0,container:s,children:r})})})};Lu.displayName=ma;var $n="PopoverContent",Bu=w.forwardRef((n,e)=>{const t=Rm($n,n.__scopePopover),{forceMount:r=t.forceMount,...s}=n,i=Kt($n,n.__scopePopover);return p.jsx(ua,{present:r||i.open,children:i.modal?p.jsx(Im,{...s,ref:e}):p.jsx(Pm,{...s,ref:e})})});Bu.displayName=$n;var _m=Op("PopoverContent.RemoveScroll"),Im=w.forwardRef((n,e)=>{const t=Kt($n,n.__scopePopover),r=w.useRef(null),s=pi(e,r),i=w.useRef(!1);return w.useEffect(()=>{const o=r.current;if(o)return xp(o)},[]),p.jsx(kp,{as:_m,allowPinchZoom:!0,children:p.jsx(zu,{...n,ref:s,trapFocus:t.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:hn(n.onCloseAutoFocus,o=>{var a;o.preventDefault(),i.current||(a=t.triggerRef.current)==null||a.focus()}),onPointerDownOutside:hn(n.onPointerDownOutside,o=>{const a=o.detail.originalEvent,l=a.button===0&&a.ctrlKey===!0,c=a.button===2||l;i.current=c},{checkForDefaultPrevented:!1}),onFocusOutside:hn(n.onFocusOutside,o=>o.preventDefault(),{checkForDefaultPrevented:!1})})})}),Pm=w.forwardRef((n,e)=>{const t=Kt($n,n.__scopePopover),r=w.useRef(!1),s=w.useRef(!1);return p.jsx(zu,{...n,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:i=>{var o,a;(o=n.onCloseAutoFocus)==null||o.call(n,i),i.defaultPrevented||(r.current||(a=t.triggerRef.current)==null||a.focus(),i.preventDefault()),r.current=!1,s.current=!1},onInteractOutside:i=>{var l,c;(l=n.onInteractOutside)==null||l.call(n,i),i.defaultPrevented||(r.current=!0,i.detail.originalEvent.type==="pointerdown"&&(s.current=!0));const o=i.target;((c=t.triggerRef.current)==null?void 0:c.contains(o))&&i.preventDefault(),i.detail.originalEvent.type==="focusin"&&s.current&&i.preventDefault()}})}),zu=w.forwardRef((n,e)=>{const{__scopePopover:t,trapFocus:r,onOpenAutoFocus:s,onCloseAutoFocus:i,disableOutsidePointerEvents:o,onEscapeKeyDown:a,onPointerDownOutside:l,onFocusOutside:c,onInteractOutside:u,...d}=n,f=Kt($n,t),h=Br(t);return wp(),p.jsx(Sp,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:s,onUnmountAutoFocus:i,children:p.jsx(Cp,{asChild:!0,disableOutsidePointerEvents:o,onInteractOutside:u,onEscapeKeyDown:a,onPointerDownOutside:l,onFocusOutside:c,onDismiss:()=>f.onOpenChange(!1),children:p.jsx(Mp,{"data-state":$u(f.open),role:"dialog",id:f.contentId,...h,...d,ref:e,style:{...d.style,"--radix-popover-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-popover-content-available-width":"var(--radix-popper-available-width)","--radix-popover-content-available-height":"var(--radix-popper-available-height)","--radix-popover-trigger-width":"var(--radix-popper-anchor-width)","--radix-popover-trigger-height":"var(--radix-popper-anchor-height)"}})})})}),Fu="PopoverClose",jm=w.forwardRef((n,e)=>{const{__scopePopover:t,...r}=n,s=Kt(Fu,t);return p.jsx(Lr.button,{type:"button",...r,ref:e,onClick:hn(n.onClick,()=>s.onOpenChange(!1))})});jm.displayName=Fu;var Lm="PopoverArrow",Bm=w.forwardRef((n,e)=>{const{__scopePopover:t,...r}=n,s=Br(t);return p.jsx(Np,{...s,...r,ref:e})});Bm.displayName=Lm;function $u(n){return n?"open":"closed"}var zm=_u,Fm=ju,$m=Lu,Hu=Bu;const ga=zm,ya=Fm,gi=w.forwardRef(({className:n,align:e="center",sideOffset:t=4,...r},s)=>p.jsx($m,{children:p.jsx(Hu,{ref:s,align:e,sideOffset:t,className:te("z-50 w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:sli
116de-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",n),...r})}));gi.displayName=Hu.displayName;const Pl=/^([01]?\d|2[0-3]):([0-5]\d)$/,Hm=n=>{if(!n)return"";const e=n.replace(/\D/g,"");if(e.length===0)return"";let t="",r="";e.length<=2?(t=e.padStart(2,"0"),r="00"):e.length===3?(t="0"+e[0],r=e.slice(1)):(t=e.slice(0,2),r=e.slice(2,4));const s=parseInt(t,10),i=parseInt(r,10);return Number.isNaN(s)||Number.isNaN(i)||s>23||i>59?null:`${String(s).padStart(2,"0")}:${String(i).padStart(2,"0")}`},ar=w.forwardRef(({id:n,value:e,onChange:t,required:r,className:s,placeholder:i="HH:MM",minuteStep:o=5},a)=>{const[l,c]=w.useState(e||""),[u,d]=w.useState(!1),[f,h]=w.useState(!1);w.useEffect(()=>{c(e||""),h(!1)},[e]);const m=S=>{const O=S.target.value,M=O.replace(/\D/g,"").slice(0,4);let B=M;M.length>=3?B=M.slice(0,2)+":"+M.slice(2):M.length===2&&O.endsWith(":")&&(B=M+":"),c(B),Pl.test(B)&&(h(!1),t(B))},y=()=>{if(!l){h(!1),t("");return}const S=Hm(l);if(S===null){h(!0);return}h(!1),c(S),t(S)},[g,v]=(e&&Pl.test(e)?e:"00:00").split(":"),x=Array.from({length:24},(S,O)=>String(O).padStart(2,"0")),N=Array.from({length:Math.ceil(60/o)},(S,O)=>String(O*o).padStart(2,"0")),A=(S,O)=>{const M=`${S}:${O}`;c(M),h(!1),t(M)};return p.jsxs("div",{className:te("flex gap-1",s),children:[p.jsx(_e,{id:n,ref:a,type:"text",inputMode:"numeric",autoComplete:"off",placeholder:i,value:l,onChange:m,onBlur:y,required:r,maxLength:5,className:te("flex-1",f&&"border-destructive text-destructive")}
116),p.jsxs(ga,{open:u,onOpenChange:d,children:[p.jsx(ya,{asChild:!0,children:p.jsx(be,{type:"button",variant:"outline",size:"icon",className:"shrink-0","aria-label":"Uhrzeit auswählen",children:p.jsx(Mu,{className:"h-4 w-4"})})}),p.jsx(gi,{className:"w-auto p-0 pointer-events-auto",align:"end",children:p.jsxs("div",{className:"flex",children:[p.jsx("div",{className:"max-h-60 overflow-y-auto border-r border-foreground/10",children:x.map(S=>p.jsx("button",{type:"button",onClick:()=>A(S,v),className:te("block w-14 px-3 py-1.5 text-sm text-left hover:bg-foreground/10",S===g&&"bg-foreground/15 font-bold"),children:S},S))}),p.jsx("div",{className:"max-h-60 overflow-y-auto",children:N.map(S=>p.jsx("button",{type:"button",onClick:()=>A(g,S),className:te("block w-14 px-3 py-1.5 text-sm text-left hover:bg-foreground/10",S===v&&"bg-foreground/15 font-bold"),children:S},S))})]})})]})]})});ar.displayName="TimeInput";var z=function(){return z=Object.assign||function(e){for(var t,r=1,s=arguments.length;r<s;r++){t=arguments[r];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])}return e},z.apply(this,arguments)};function Vm(n,e){var t={};for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&e.indexOf(r)<0&&(t[r]=n[r]);if(n!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,r=Object.getOwnPropertySymbols(n);s<r.length;s++)e.indexOf(r[s])<0&&Object.prototype.propertyIsEnumerable.call(n,r[s])&&(t[r[s]]=n[r[s]]);return t}function Vu(n,e,t){for(var r=0,s=e.length,i;r<s;r++)(i||!(r in e))&&(i||(i=Array.prototype.slice.call(e,0,r)),i[r]=e[r]);return n.concat(i||Array.prototype.slice.call(e))}function zr(n){return n.mode==="multiple"}function Fr(n){return n.mode==="range"}function yi(n){return n.mode==="single"}var Wm={root:"rdp",multiple_months:"rdp-multiple_months",with_weeknumber:"rdp-with_weeknumber",vhidden:"rdp-vhidden",button_reset:"rdp-button_reset",button:"rdp-button",caption:"rdp-caption",caption_start:"rdp-caption_start",caption_end:"rdp-caption_end",caption_between:"rdp-caption_between",caption_label:"rdp-caption_label",caption_dropdowns:"rdp-caption_dropdowns",dropdown:"rdp-dropdown",dropdown_month:"rdp-dropdown_month",dropdown_year:"rdp-dropdown_year",dropdown_icon:"rdp-dropdown_icon",months:"rdp-months",month:"rdp-month",table:"rdp-table",tbody:"rdp-tbody",tfoot:"rdp-tfoot",head:"rdp-head",head_row:"rdp-head_row",head_cell:"rdp-head_cell",nav:"rdp-nav",nav_button:"rdp-nav_button",nav_button_previous:"rdp-nav_button_previous",nav_button_next:"rdp-nav_button_next",nav_icon:"rdp-nav_icon",row:"rdp-row",weeknumber:"rdp-weeknumber",cell:"rdp-cell",day:"rdp-day",day_today:"rdp-day_today",day_outside:"rdp-day_outside",day_selected:"rdp-day_selected",day_disabled:"rdp-day_disabled",day_hidden:"rdp-day_hidden",day_range_start:"rdp-day_range_start",day_range_end:"rdp-day_range_end",day_range_middle:"rdp-day_range_middle"};function Um(n,e){return St(n,"LLLL y",e)}function qm(n,e){return St(n,"d",e)}function Km(n,e){return St(n,"LLLL",e)}function Jm(n){return"".concat(n)}function Ym(n,e){return St(n,"cccccc",e)}function Gm(n,e){return St(n,"yyyy",e)}var Xm=Object.freeze({__proto__:null,formatCaption:Um,formatDay:qm,formatMonthCaption:Km,formatWeekNumber:Jm,formatWeekdayName:Ym,formatYearCaption:Gm}),Qm=function(n,e,t){return St(n,"do MMMM (EEEE)",t)},Zm=function(){return"Month: "},eg=function(){return"Go to next month"},tg=function(){return"Go to previous month"},ng=function(n,e){return St(n,"cccc",e)},rg=function(n){return"Week n. ".concat(n)},sg=function(){return"Year: "},ig=Object.freeze({__proto__:null,labelDay:Qm,labelMonthDropdown:Zm,labelNext:eg,labelPrevious:tg,labelWeekNumber:rg,labelWeekday:ng,labelYearDropdown:sg});function og(){var n="buttons",e=Wm,t=Dp,r={},s={},i=1,o={},a=new Date;return{captionLayout:n,classNames:e,formatters:Xm,labels:ig,locale:t,modifiersClassNames:r,modifiers:s,numberOfMonths:i,styles:o,today:a,mode:"default"}}function ag(n){var e=n.fromYear,t=n.toYear,r=n.fromMonth,s=n.toMonth,i=n.fromDate,o=n.toDate;return r?i=Ve(r):e&&(i=new Date(e,0,1)),s?o=fa(s):t&&(o=new Date(t,11,31)),{fromDate:i?ws(i):void 0,toDate:o?ws(o):void 0}}var Wu=w.createContext(void 0);function lg(n){var e,t=n.initialProps,r=og(),s=ag(t),i=s.fromDate,o=s.toDate,a=(e=t.captionLayout)!==null&&e!==void 0?e:r.captionLayout;a!=="buttons"&&(!i||!o)&&(a="buttons");var l;(yi(t)||zr(t)||Fr(t))&&(l=t.onSelect);var c=z(z(z({},r),t),{captionLayout:a,classNames:z(z({},r.classNames),t.classNames),components:z({},t.components),formatters:z(z({},r.formatters),t.formatters),fromDate:i,labels:z(z({},r.labels),t.labels),mode:t.mode||r.mode,modifiers:z(z({},r.modifiers),t.modifiers),modifiersClassNames:z(z({},r.modifiersClassNames),t.modifiersClassNames),onSelect:l,styles:z(z({},r.styles),t.styles),toDate:o});return p.jsx(Wu.Provider,{value:c,children:n.children})}function Z(){var n=w.useContext(Wu);
116if(!n)throw new Error("useDayPicker must be used within a DayPickerProvider.");return n}function Uu(n){var e=Z(),t=e.locale,r=e.classNames,s=e.styles,i=e.formatters.formatCaption;return p.jsx("div",{className:r.caption_label,style:s.caption_label,"aria-live":"polite",role:"presentation",id:n.id,children:i(n.displayMonth,{locale:t})})}function cg(n){return p.jsx("svg",z({width:"8px",height:"8px",viewBox:"0 0 120 120","data-testid":"iconDropdown"},n,{children:p.jsx("path",{d:"M4.22182541,48.2218254 C8.44222828,44.0014225 15.2388494,43.9273804 19.5496459,47.9996989 L19.7781746,48.2218254 L60,88.443 L100.221825,48.2218254 C104.442228,44.0014225 111.238849,43.9273804 115.549646,47.9996989 L115.778175,48.2218254 C119.998577,52.4422283 120.07262,59.2388494 116.000301,63.5496459 L115.778175,63.7781746 L67.7781746,111.778175 C63.5577717,115.998577 56.7611506,116.07262 52.4503541,112.000301 L52.2218254,111.778175 L4.22182541,63.7781746 C-0.0739418023,59.4824074 -0.0739418023,52.5175926 4.22182541,48.2218254 Z",fill:"currentColor",fillRule:"nonzero"})}))}function qu(n){var e,t,r=n.onChange,s=n.value,i=n.children,o=n.caption,a=n.className,l=n.style,c=Z(),u=(t=(e=c.components)===null||e===void 0?void 0:e.IconDropdown)!==null&&t!==void 0?t:cg;return p.jsxs("div",{className:a,style:l,children:[p.jsx("span",{className:c.classNames.vhidden,children:n["aria-label"]}),p.jsx("select",{name:n.name,"aria-label":n["aria-label"],className:c.classNames.dropdown,style:c.styles.dropdown,value:s,onChange:r,children:i}),p.jsxs("div",{className:c.classNames.caption_label,style:c.styles.caption_label,"aria-hidden":"true",children:[o,p.jsx(u,{className:c.classNames.dropdown_icon,style:c.styles.dropdown_icon})]})]})}function ug(n){var e,t=Z(),r=t.fromDate,s=t.toDate,i=t.styles,o=t.locale,a=t.formatters.formatMonthCaption,l=t.classNames,c=t.components,u=t.labels.labelMonthDropdown;if(!r)return p.jsx(p.Fragment,{});if(!s)return p.jsx(p.Fragment,{});var d=[];if(Nm(r,s))for(var f=Ve(r),h=r.getMonth();h<=s.getMonth();h++)d.push(qi(f,h));else for(var f=Ve(new Date),h=0;h<=11;h++)d.push(qi(f,h));var m=function(g){var v=Number(g.target.value),x=qi(Ve(n.displayMonth),v);n.onChange(x)},y=(e=c==null?void 0:c.Dropdown)!==null&&e!==void 0?e:qu;return p.jsx(y,{name:"months","aria-label":u(),className:l.dropdown_month,style:i.dropdown_month,onChange:m,value:n.displayMonth.getMonth(),caption:a(n.displayMonth,{locale:o}),children:d.map(function(g){return p.jsx("option",{value:g.getMonth(),children:a(g,{locale:o})},g.getMonth())})})}function dg(n){var e,t=n.displayMonth,r=Z(),s=r.fromDate,i=r.toDate,o=r.locale,a=r.styles,l=r.classNames,c=r.components,u=r.formatters.formatYearCaption,d=r.labels.labelYearDropdown,f=[];if(!s)return p.jsx(p.Fragment,{});if(!i)return p.jsx(p.Fragment,{});for(var h=s.getFullYear(),m=i.getFullYear(),y=h;y<=m;y++)f.push(Il(Rp(new Date),y));var g=function(x){var N=Il(Ve(t),Number(x.target.value));n.onChange(N)},v=(e=c==null?void 0:c.Dropdown)!==null&&e!==void 0?e:qu;return p.jsx(v,{name:"years","aria-label":d(),className:l.dropdown_year,style:a.dropdown_year,onChange:g,value:t.getFullYear(),caption:u(t,{locale:o}),children:f.map(function(x){return p.jsx("option",{value:x.getFullYear(),children:u(x,{locale:o})},x.getFullYear())})})}function fg(n,e){var t=w.useState(n),r=t[0],s=t[1],i=e===void 0?r:e;return[i,s]}function hg(n){var e=n.month,t=n.defaultMonth,r=n.today,s=e||t||r||new Date,i=n.toDate,o=n.fromDate,a=n.numberOfMonths,l=a===void 0?1:a;if(i&&Mr(i,s)<0){var c=-1*(l-1);s=st(i,c)}return o&&Mr(s,o)<0&&(s=o),Ve(s)}function pg(){var n=Z(),e=hg(n),t=fg(e,n.month),r=t[0],s=t[1],i=function(o){var a;if(!n.disableNavigation){var l=Ve(o);s(l),(a=n.onMonthChange)===null||a===void 0||a.call(n,l)}};return[r,i]}function mg(n,e){for(var t=e.reverseMonths,r=e.numberOfMonths,s=Ve(n),i=Ve(st(s,r)),o=Mr(i,s),a=[],l=0;l<o;l++){var c=st(s,l);a.push(c)}return t&&(a=a.reverse()),a}function gg(n,e){if(!e.disableNavigation){var t=e.toDate,r=e.pagedNavigation,s=e.numberOfMonths,i=s===void 0?1:s,o=r?i:1,a=Ve(n);if(!t)return st(a,o);var l=Mr(t,n);if(!(l<i))return st(a,o)}}function yg(n,e){if(!e.disableNavigation){var t=e.fromDate,r=e.pagedNavigation,s=e.numberOfMonths,i=s===void 0?1:s,o=r?i:1,a=Ve(n);if(!t)return st(a,-o);var l=Mr(a,t);if(!(l<=0))return st(a,-o)}}var Ku=w.createContext(void 0);function bg(n){var e=Z(),t=pg(),r=t[0],s=t[1],i=mg(r,e),o=gg(r,e),a=yg(r,e),l=function(d){return i.some(function(f){return pa(d,f)})},c=function(d,f){l(d)||(f&&Tu(d,f)?s(st(d,1+e.numberOfMonths*-1)):s(d))},u={currentMonth:r,displayMonths:i,goToMonth:s,goToDate:c,previousMonth:a,nextMonth:o,isDateDisplayed:l};return p.jsx(Ku.Provider,{value:u,children:n.children})}function $r(){var n=w.useContext(Ku);if(!n)throw new Error("useNavigation must be used within a NavigationProvider");return n}function jl(n){var e,t=Z(),r=t.classNames,s=t.styles,i=t.components,o=$r().goToMonth,a=function(u){o(st(u,n.displayIndex?-n.displayIndex:0))},l=(e=i==null?void 0:i.CaptionLabel)!==null&&e!==void 0?e:Uu,c=p.jsx(l,{id:n.id,displayMonth:n.displayMonth});return p.jsxs("div",{className:r.caption_dropdowns,style:s.caption_dropdowns,children:[p.jsx("div",{className:r.vhidden,children:c}),p.jsx(ug,{onChange:a,displayMonth:n.displayMonth}),p.jsx(dg,{onChange:a,displayMonth:n.displayMonth})]})}function vg(n){return p.jsx("svg",z({width:"16px",height:"16px",viewBox:"0 0 120 120"},n,{children:p.jsx("path",{d:"M69.490332,3.34314575 C72.6145263,0.218951416 77.6798462,0.218951416 80.8040405,3.34314575 C83.8617626,6.40086786 83.9268205,11.3179931 80.9992143,14.4548388 L80.8040405,14.6568542 L35.461,60 L80.8040405,105.343146 C83.8617626,108.400868 83.9268205,113.317993 80.9992143,116.454839 L80.8040405,116.656854 C77.7463184,119.714576 72.8291931,119.779634 69.6923475,116.852028 L69.490332,116.656854 L18.490332,65.6568542 C15.4326099,62.5991321 15.367552,57.6820069 18.2951583,54.5451612 L18.490332,54.3431458 L69.490332,3.34314575 Z",fill:"currentColor",fillRule:"nonzero"})}))}function xg(n){return p.jsx("svg",z({width:"16px",height:"16px",viewBox:"0 0 120 120"}
116,n,{children:p.jsx("path",{d:"M49.8040405,3.34314575 C46.6798462,0.218951416 41.6145263,0.218951416 38.490332,3.34314575 C35.4326099,6.40086786 35.367552,11.3179931 38.2951583,14.4548388 L38.490332,14.6568542 L83.8333725,60 L38.490332,105.343146 C35.4326099,108.400868 35.367552,113.317993 38.2951583,116.454839 L38.490332,116.656854 C41.5480541,119.714576 46.4651794,119.779634 49.602025,116.852028 L49.8040405,116.656854 L100.804041,65.6568542 C103.861763,62.5991321 103.926821,57.6820069 100.999214,54.5451612 L100.804041,54.3431458 L49.8040405,3.34314575 Z",fill:"currentColor"})}))}var Cs=w.forwardRef(function(n,e){var t=Z(),r=t.classNames,s=t.styles,i=[r.button_reset,r.button];n.className&&i.push(n.className);var o=i.join(" "),a=z(z({},s.button_reset),s.button);return n.style&&Object.assign(a,n.style),p.jsx("button",z({},n,{ref:e,type:"button",className:o,style:a}))});function kg(n){var e,t,r=Z(),s=r.dir,i=r.locale,o=r.classNames,a=r.styles,l=r.labels,c=l.labelPrevious,u=l.labelNext,d=r.components;if(!n.nextMonth&&!n.previousMonth)return p.jsx(p.Fragment,{});var f=c(n.previousMonth,{locale:i}),h=[o.nav_button,o.nav_button_previous].join(" "),m=u(n.nextMonth,{locale:i}),y=[o.nav_button,o.nav_button_next].join(" "),g=(e=d==null?void 0:d.IconRight)!==null&&e!==void 0?e:xg,v=(t=d==null?void 0:d.IconLeft)!==null&&t!==void 0?t:vg;return p.jsxs("div",{className:o.nav,style:a.nav,children:[!n.hidePrevious&&p.jsx(Cs,{name:"previous-month","aria-label":f,className:h,style:a.nav_button_previous,disabled:!n.previousMonth,onClick:n.onPreviousClick,children:s==="rtl"?p.jsx(g,{className:o.nav_icon,style:a.nav_icon}):p.jsx(v,{className:o.nav_icon,style:a.nav_icon})}),!n.hideNext&&p.jsx(Cs,{name:"next-month","aria-label":m,className:y,style:a.nav_button_next,disabled:!n.nextMonth,onClick:n.onNextClick,children:s==="rtl"?p.jsx(v,{className:o.nav_icon,style:a.nav_icon}):p.jsx(g,{className:o.nav_icon,style:a.nav_icon})})]})}function Ll(n){var e=Z().numberOfMonths,t=$r(),r=t.previousMonth,s=t.nextMonth,i=t.goToMonth,o=t.displayMonths,a=o.findIndex(function(m){return pa(n.displayMonth,m)}),l=a===0,c=a===o.length-1,u=e>1&&(l||!c),d=e>1&&(c||!l),f=function(){r&&i(r)},h=function(){s&&i(s)};return p.jsx(kg,{displayMonth:n.displayMonth,hideNext:u,hidePrevious:d,nextMonth:s,previousMonth:r,onPreviousClick:f,onNextClick:h})}function wg(n){var e,t=Z(),r=t.classNames,s=t.disableNavigation,i=t.styles,o=t.captionLayout,a=t.components,l=(e=a==null?void 0:a.CaptionLabel)!==null&&e!==void 0?e:Uu,c;return s?c=p.jsx(l,{id:n.id,displayMonth:n.displayMonth}):o==="dropdown"?c=p.jsx(jl,{displayMonth:n.displayMonth,id:n.id}):o==="dropdown-buttons"?c=p.jsxs(p.Fragment,{children:[p.jsx(jl,{displayMonth:n.displayMonth,displayIndex:n.displayIndex,id:n.id}),p.jsx(Ll,{displayMonth:n.displayMonth,displayIndex:n.displayIndex,id:n.id})]}):c=p.jsxs(p.Fragment,{children:[p.jsx(l,{id:n.id,displayMonth:n.displayMonth,displayIndex:n.displayIndex}),p.jsx(Ll,{displayMonth:n.displayMonth,id:n.id})]}),p.jsx("div",{className:r.caption,style:i.caption,children:c})}function Sg(n){var e=Z(),t=e.footer,r=e.styles,s=e.classNames.tfoot;return t?p.jsx("tfoot",{className:s,style:r.tfoot,children:p.jsx("tr",{children:p.jsx("td",{colSpan:8,children:t})})}):p.jsx(p.Fragment,{})}function Cg(n,e,t){for(var r=t?da(new Date):Cr(new Date,{locale:n,weekStartsOn:e}),s=[],i=0;i<7;i++){var o=Ie(r,i);s.push(o)}return s}function Mg(){var n=Z(),e=n.classNames,t=n.styles,r=n.showWeekNumber,s=n.locale,i=n.weekStartsOn,o=n.ISOWeek,a=n.formatters.formatWeekdayName,l=n.labels.labelWeekday,c=Cg(s,i,o);return p.jsxs("tr",{style:t.head_row,className:e.head_row,children:[r&&p.jsx("td",{style:t.head_cell,className:e.head_cell}),c.map(function(u,d){return p.jsx("th",{scope:"col",className:e.head_cell,style:t.head_cell,"aria-label":l(u,{locale:s}),children:a(u,{locale:s})},d)})]})}function Ng(){var n,e=Z(),t=e.classNames,r=e.styles,s=e.components,i=(n=s==null?void 0:s.HeadRow)!==null&&n!==void 0?n:Mg;return p.jsx("thead",{style:r.head,className:t.head,children:p.jsx(i,{})})}function Eg(n){var e=Z(),t=e.locale,r=e.formatters.formatDay;return p.jsx(p.Fragment,{children:r(n.date,{locale:t})})}var ba=w.createContext(void 0);function Tg(n){if(!zr(n.initialProps)){var e={selected:void 0,modifiers:{disabled:[]}};return p.jsx(ba.Provider,{value:e,children:n.children})}return p.jsx(Ag,{initialProps:n.initialProps,children:n.children})}function Ag(n){var e=n.initialProps,t=n.children,r=e.selected,s=e.min,i=e.max,o=function(c,u,d){var f,h;(f=e.onDayClick)===null||f===void 0||f.call(e,c,u,d);var m=!!(u.selected&&s&&(r==null?void 0:r.length)===s);if(!m){var y=!!(!u.selected&&i&&(r==null?void 0:r.length)===i);if(!y){var g=r?Vu([],r):[];if(u.selected){var v=g.findIndex(function(x){return He(c,x)});g.splice(v,1)}else g.push(c);(h=e.onSelect)===null||h===void 0||h.call(e,g,c,u,d)}}},a={disabled:[]};r&&a.disabled.push(function(c){var u=i&&r.length>i-1,d=r.some(function(f){return He(f,c)});return!!(u&&!d)});var l={selected:r,onDayClick:o,modifiers:a};return p.jsx(ba.Provider,{value:l,children:t})}function va(){var n=w.useContext(ba);if(!n)throw new Error("useSelectMultiple must be used within a SelectMultipleProvider");return n}function Og(n,e){var t=e||{},r=t.from,s=t.to;return r&&s?He(s,n)&&He(r,n)?void 0:He(s,n)?{from:s,to:void 0}:He(r,n)?void 0:Ro(r,n)?{from:n,to:s}:{from:r,to:n}:s?Ro(n,s)?{from:s,to:n}:{from:n,to:s}:r?Tu(n,r)?{from:n,to:r}:{from:r,to:n}:{from:n,to:void 0}}var xa=w.createContext(void 0);function Dg(n){if(!Fr(n.initialProps)){var e={selected:void 0,modifiers:{range_start:[],range_end:[],range_middle:[],disabled:[]}};return p.jsx(xa.Provider,{value:e,children:n.children})}return p.jsx(Rg,{initialProps:n.initialProps,children:n.children})}function Rg(n){var e=n.initialProps,t=n.children,r=e.selected,s=r||{},i=s.from,o=s.to,a=e.min,l=e.max,c=function(h,m,y){var g,v;(g=e.onDayClick)===null||g===void 0||g.call(e,h,m,y);var x=Og(h,r);(v=e.onSelect)===null||v===void 0||v.call(e,x,h,m,y)},u={range_start:[],range_end:[],range_middle:[],disabled:[]};if(i?(u.range_start=[i],o?(u.range_end=[o],He(i,o)||(u.range_middle=[{after:i,before:o}])):u.range_end=[i]):o&&(u.range_start=[o],u.range_end=[o]),a&&(i&&!o&&u.disabled.push({after:Ui(i,a-1),before:Ie(i,a-1)}),i&&o&&u.disabled.push({after:i,before:Ie(i,a-1)}),!i&&o&&u.disabled.push({after:Ui(o,a-1),before:Ie(o,a-1)})),l){if(i&&!o&&(u.disabled.push({before:Ie(i,-l+1)}),u.disabled.push({after:Ie(i,l-1)})),i&&o){var d=xt(o,i)+1,f=l-d;u.disabled.push({before:Ui(i,f)}),u.disabled.push({after:Ie(o,f)})}!i&&o&&(u.disabled.push({before:Ie(o,-l+1)}),u.disabled.push({after:Ie(o,l-1)}))}return p.jsx(xa.Provider,{value:{selected:r,onDayClick:c,modifiers:u},children:t})}function ka(){var n=w.useContext(xa);if(!n)throw new Error("useSelectRange must be used within a SelectRangeProvider");return n}function ps(n){return Array.isArray(n)?Vu([],n):n!==void 0?[n]:[]}function _g(n){var e={};
116return Object.entries(n).forEach(function(t){var r=t[0],s=t[1];e[r]=ps(s)}),e}var it;(function(n){n.Outside="outside",n.Disabled="disabled",n.Selected="selected",n.Hidden="hidden",n.Today="today",n.RangeStart="range_start",n.RangeEnd="range_end",n.RangeMiddle="range_middle"})(it||(it={}));var Ig=it.Selected,pt=it.Disabled,Pg=it.Hidden,jg=it.Today,Ki=it.RangeEnd,Ji=it.RangeMiddle,Yi=it.RangeStart,Lg=it.Outside;function Bg(n,e,t){var r,s=(r={},r[Ig]=ps(n.selected),r[pt]=ps(n.disabled),r[Pg]=ps(n.hidden),r[jg]=[n.today],r[Ki]=[],r[Ji]=[],r[Yi]=[],r[Lg]=[],r);return n.fromDate&&s[pt].push({before:n.fromDate}),n.toDate&&s[pt].push({after:n.toDate}),zr(n)?s[pt]=s[pt].concat(e.modifiers[pt]):Fr(n)&&(s[pt]=s[pt].concat(t.modifiers[pt]),s[Yi]=t.modifiers[Yi],s[Ji]=t.modifiers[Ji],s[Ki]=t.modifiers[Ki]),s}var Ju=w.createContext(void 0);function zg(n){var e=Z(),t=va(),r=ka(),s=Bg(e,t,r),i=_g(e.modifiers),o=z(z({},s),i);return p.jsx(Ju.Provider,{value:o,children:n.children})}function Yu(){var n=w.useContext(Ju);if(!n)throw new Error("useModifiers must be used within a ModifiersProvider");return n}function Fg(n){return!!(n&&typeof n=="object"&&"before"in n&&"after"in n)}function $g(n){return!!(n&&typeof n=="object"&&"from"in n)}function Hg(n){return!!(n&&typeof n=="object"&&"after"in n)}function Vg(n){return!!(n&&typeof n=="object"&&"before"in n)}function Wg(n){return!!(n&&typeof n=="object"&&"dayOfWeek"in n)}function Ug(n,e){var t,r=e.from,s=e.to;if(r&&s){var i=xt(s,r)<0;i&&(t=[s,r],r=t[0],s=t[1]);var o=xt(n,r)>=0&&xt(s,n)>=0;return o}return s?He(s,n):r?He(r,n):!1}function qg(n){return Su(n)}function Kg(n){return Array.isArray(n)&&n.every(Su)}function Jg(n,e){return e.some(function(t){if(typeof t=="boolean")return t;if(qg(t))return He(n,t);if(Kg(t))return t.includes(n);if($g(t))return Ug(n,t);if(Wg(t))return t.dayOfWeek.includes(n.getDay());if(Fg(t)){var r=xt(t.before,n),s=xt(t.after,n),i=r>0,o=s<0,a=Ro(t.before,t.after);return a?o&&i:i||o}return Hg(t)?xt(n,t.after)>0:Vg(t)?xt(t.before,n)>0:typeof t=="function"?t(n):!1})}function wa(n,e,t){var r=Object.keys(e).reduce(function(i,o){var a=e[o];return Jg(n,a)&&i.push(o),i},[]),s={};return r.forEach(function(i){return s[i]=!0}),t&&!pa(n,t)&&(s.outside=!0),s}function Yg(n,e){for(var t=Ve(n[0]),r=fa(n[n.length-1]),s,i,o=t;o<=r;){var a=wa(o,e),l=!a.disabled&&!a.hidden;if(!l){o=Ie(o,1);continue}if(a.selected)return o;a.today&&!i&&(i=o),s||(s=o),o=Ie(o,1)}return i||s}var Gg=365;function Gu(n,e){var t=e.moveBy,r=e.direction,s=e.context,i=e.modifiers,o=e.retry,a=o===void 0?{count:0,lastFocused:n}:o,l=s.weekStartsOn,c=s.fromDate,u=s.toDate,d=s.locale,f={day:Ie,week:Do,month:st,year:bm,startOfWeek:function(g){return s.ISOWeek?da(g):Cr(g,{locale:d,weekStartsOn:l})},endOfWeek:function(g){return s.ISOWeek?Eu(g):ha(g,{locale:d,weekStartsOn:l})}},h=f[t](n,r==="after"?1:-1);r==="before"&&c?h=vm([c,h]):r==="after"&&u&&(h=xm([u,h]));var m=!0;if(i){var y=wa(h,i);m=!y.disabled&&!y.hidden}return m?h:a.count>Gg?a.lastFocused:Gu(h,{moveBy:t,direction:r,context:s,modifiers:i,retry:z(z({},a),{count:a.count+1})})}var Xu=w.createContext(void 0);function Xg(n){var e=$r(),t=Yu(),r=w.useState(),s=r[0],i=r[1],o=w.useState(),a=o[0],l=o[1],c=Yg(e.displayMonths,t),u=s??(a&&e.isDateDisplayed(a))?a:c,d=function(){l(s),i(void 0)},f=function(g){i(g)},h=Z(),m=function(g,v){if(s){var x=Gu(s,{moveBy:g,direction:v,context:h,modifiers:t});He(s,x)||(e.goToDate(x,s),f(x))}},y={focusedDay:s,focusTarget:u,blur:d,focus:f,focusDayAfter:function(){return m("day","after")},focusDayBefore:function(){return m("day","before")},focusWeekAfter:function(){return m("week","after")},focusWeekBefore:function(){return m("week","before")},focusMonthBefore:function(){return m("month","before")},focusMonthAfter:function(){return m("month","after")},focusYearBefore:function(){return m("year","before")},focusYearAfter:function(){return m("year","after")},focusStartOfWeek:function(){return m("startOfWeek","before")},focusEndOfWeek:function(){return m("endOfWeek","after")}};return p.jsx(Xu.Provider,{value:y,children:n.children})}function Sa(){var n=w.useContext(Xu);if(!n)throw new Error("useFocusContext must be used within a FocusProvider");return n}function Qg(n,e){var t=Yu(),r=wa(n,t,e);return r}var Ca=w.createContext(void 0);function Zg(n){if(!yi(n.initialProps)){var e={selected:void 0};return p.jsx(Ca.Provider,{value:e,children:n.children})}return p.jsx(ey,{initialProps:n.initialProps,children:n.children})}function ey(n){var e=n.initialProps,t=n.children,r=function(i,o,a){var l,c,u;if((l=e.onDayClick)===null||l===void 0||l.call(e,i,o,a),o.selected&&!e.required){(c=e.onSelect)===null||c===void 0||c.c
116all(e,void 0,i,o,a);return}(u=e.onSelect)===null||u===void 0||u.call(e,i,i,o,a)},s={selected:e.selected,onDayClick:r};return p.jsx(Ca.Provider,{value:s,children:t})}function Qu(){var n=w.useContext(Ca);if(!n)throw new Error("useSelectSingle must be used within a SelectSingleProvider");return n}function ty(n,e){var t=Z(),r=Qu(),s=va(),i=ka(),o=Sa(),a=o.focusDayAfter,l=o.focusDayBefore,c=o.focusWeekAfter,u=o.focusWeekBefore,d=o.blur,f=o.focus,h=o.focusMonthBefore,m=o.focusMonthAfter,y=o.focusYearBefore,g=o.focusYearAfter,v=o.focusStartOfWeek,x=o.focusEndOfWeek,N=function(_){var I,ze,Xt,ot;yi(t)?(I=r.onDayClick)===null||I===void 0||I.call(r,n,e,_):zr(t)?(ze=s.onDayClick)===null||ze===void 0||ze.call(s,n,e,_):Fr(t)?(Xt=i.onDayClick)===null||Xt===void 0||Xt.call(i,n,e,_):(ot=t.onDayClick)===null||ot===void 0||ot.call(t,n,e,_)},A=function(_){var I;f(n),(I=t.onDayFocus)===null||I===void 0||I.call(t,n,e,_)},S=function(_){var I;d(),(I=t.onDayBlur)===null||I===void 0||I.call(t,n,e,_)},O=function(_){var I;(I=t.onDayMouseEnter)===null||I===void 0||I.call(t,n,e,_)},M=function(_){var I;(I=t.onDayMouseLeave)===null||I===void 0||I.call(t,n,e,_)},B=function(_){var I;(I=t.onDayPointerEnter)===null||I===void 0||I.call(t,n,e,_)},U=function(_){var I;(I=t.onDayPointerLeave)===null||I===void 0||I.call(t,n,e,_)},re=function(_){var I;(I=t.onDayTouchCancel)===null||I===void 0||I.call(t,n,e,_)},we=function(_){var I;(I=t.onDayTouchEnd)===null||I===void 0||I.call(t,n,e,_)},ne=function(_){var I;(I=t.onDayTouchMove)===null||I===void 0||I.call(t,n,e,_)},le=function(_){var I;(I=t.onDayTouchStart)===null||I===void 0||I.call(t,n,e,_)},D=function(_){var I;(I=t.onDayKeyUp)===null||I===void 0||I.call(t,n,e,_)},j=function(_){var I;switch(_.key){case"ArrowLeft":_.preventDefault(),_.stopPropagation(),t.dir==="rtl"?a():l();break;case"ArrowRight":_.preventDefault(),_.stopPropagation(),t.dir==="rtl"?l():a();break;case"ArrowDown":_.preventDefault(),_.stopPropagation(),c();break;case"ArrowUp":_.preventDefault(),_.stopPropagation(),u();break;case"PageUp":_.preventDefault(),_.stopPropagation(),_.shiftKey?y():h();break;case"PageDown":_.preventDefault(),_.stopPropagation(),_.shiftKey?g():m();break;case"Home":_.preventDefault(),_.stopPropagation(),v();break;case"End":_.preventDefault(),_.stopPropagation(),x();break}(I=t.onDayKeyDown)===null||I===void 0||I.call(t,n,e,_)},et={onClick:N,onFocus:A,onBlur:S,onKeyDown:j,onKeyUp:D,onMouseEnter:O,onMouseLeave:M,onPointerEnter:B,onPointerLeave:U,onTouchCancel:re,onTouchEnd:we,onTouchMove:ne,onTouchStart:le};return et}function ny(){var n=Z(),e=Qu(),t=va(),r=ka(),s=yi(n)?e.selected:zr(n)?t.selected:Fr(n)?r.selected:void 0;return s}function ry(n){return Object.values(it).includes(n)}function sy(n,e){var t=[n.classNames.day];return Object.keys(e).forEach(function(r){var s=n.modifiersClassNames[r];if(s)t.push(s);else if(ry(r)){var i=n.classNames["day_".concat(r)];i&&t.push(i)}}),t}function iy(n,e){var t=z({},n.styles.day);return Object.keys(e).forEach(function(r){var s;t=z(z({},t),(s=n.modifiersStyles)===null||s===void 0?void 0:s[r])}),t}function oy(n,e,t){var r,s,i,o=Z(),a=Sa(),l=Qg(n,e),c=ty(n,l),u=ny(),d=!!(o.onDayCl
116ick||o.mode!=="default");w.useEffect(function(){var O;l.outside||a.focusedDay&&d&&He(a.focusedDay,n)&&((O=t.current)===null||O===void 0||O.focus())},[a.focusedDay,n,t,d,l.outside]);var f=sy(o,l).join(" "),h=iy(o,l),m=!!(l.outside&&!o.showOutsideDays||l.hidden),y=(i=(s=o.components)===null||s===void 0?void 0:s.DayContent)!==null&&i!==void 0?i:Eg,g=p.jsx(y,{date:n,displayMonth:e,activeModifiers:l}),v={style:h,className:f,children:g,role:"gridcell"},x=a.focusTarget&&He(a.focusTarget,n)&&!l.outside,N=a.focusedDay&&He(a.focusedDay,n),A=z(z(z({},v),(r={disabled:l.disabled,role:"gridcell"},r["aria-selected"]=l.selected,r.tabIndex=N||x?0:-1,r)),c),S={isButton:d,isHidden:m,activeModifiers:l,selectedDays:u,buttonProps:A,divProps:v};return S}function ay(n){var e=w.useRef(null),t=oy(n.date,n.displayMonth,e);return t.isHidden?p.jsx("div",{role:"gridcell"}):t.isButton?p.jsx(Cs,z({name:"day",ref:e},t.buttonProps)):p.jsx("div",z({},t.divProps))}function ly(n){var e=n.number,t=n.dates,r=Z(),s=r.onWeekNumberClick,i=r.styles,o=r.classNames,a=r.locale,l=r.labels.labelWeekNumber,c=r.formatters.formatWeekNumber,u=c(Number(e),{locale:a});if(!s)return p.jsx("span",{className:o.weeknumber,style:i.weeknumber,children:u});var d=l(Number(e),{locale:a}),f=function(h){s(e,t,h)};return p.jsx(Cs,{name:"week-number","aria-label":d,className:o.weeknumber,style:i.weeknumber,onClick:f,children:u})}function cy(n){var e,t,r=Z(),s=r.styles,i=r.classNames,o=r.showWeekNumber,a=r.components,l=(e=a==null?void 0:a.Day)!==null&&e!==void 0?e:ay,c=(t=a==null?void 0:a.WeekNumber)!==null&&t!==void 0?t:ly,u;return o&&(u=p.jsx("td",{className:i.cell,style:s.cell,children:p.jsx(c,{number:n.weekNumber,dates:n.dates})})),p.jsxs("tr",{className:i.row,style:s.row,children:[u,n.dates.map(function(d){return p.jsx("td",{className:i.cell,style:s.cell,role:"presentation",children:p.jsx(l,{displayMonth:n.displayMonth,date:d})},Sm(d))})]})}function Bl(n,e,t){for(var r=t!=null&&t.ISOWeek?Eu(e):ha(e,t),s=t!=null&&t.ISOWeek?da(n):Cr(n,t),i=xt(r,s),o=[],a=0;a<=i;a++)o.push(Ie(s,a));var l=o.reduce(function(c,u){var d=t!=null&&t.ISOWeek?_p(u):Ip(u,t),f=c.find(function(h){return h.weekNumber===d});return f?(f.dates.push(u),c):(c.push({weekNumber:d,dates:[u]}),c)},[]);return l}function uy(n,e){var t=Bl(Ve(n),fa(n),e);if(e!=null&&e.useFixedWeeks){var r=Mm(n,e);if(r<6){var s=t[t.length-1],i=s.dates[s.dates.length-1],o=Do(i,6-r),a=Bl(Do(i,1),o,e);t.push.apply(t,a)}}return t}function dy(n){var e,t,r,s=Z(),i=s.locale,o=s.classNames,a=s.styles,l=s.hideHead,c=s.fixedWeeks,u=s.components,d=s.weekStartsOn,f=s.firstWeekContainsDate,h=s.ISOWeek,m=uy(n.displayMonth,{useFixedWeeks:!!c,ISOWeek:h,locale:i,weekStartsOn:d,firstWeekContainsDate:f}),y=(e=u==null?void 0:u.Head)!==null&&e!==void 0?e:Ng,g=(t=u==null?void 0:u.Row)!==null&&t!==void 0?t:cy,v=(r=u==null?void 0:u.Footer)!==null&&r!==void 0?r:Sg;return p.jsxs("table",{id:n.id,className:o.table,style:a.table,role:"grid","aria-labelledby":n["aria-labelledby"],children:[!l&&p.jsx(y,{}),p.jsx("tbody",{className:o.tbody,style:a.tbody,children:m.map(function(x){return p.jsx(g,{displayMonth:n.displayMonth,dates:x.dates,weekNumber:x.weekNumber},x.weekNumber)})}),p.jsx(v,{displayMonth:n.displayMonth})]})}function fy(){return!!(typeof window<"u"&&window.document&&window.document.createElement)}var hy=fy()?w.useLayoutEffect:w.useEffect,Gi=!1,py=0;function zl(){return"react-day-picker-".concat(++py)}function my(n){var e,t=n??(Gi?zl():null),r=w.useState(t),s=r[0],i=r[1];return hy(function(){s===null&&i(zl())},[]),w.useEffect(function(){Gi===!1&&(Gi=!0)},[]),(e=n??s)!==null&&e!==void 0?e:void 0}function gy(n){var e,t,r=Z(),s=r.dir,i=r.classNames,o=r.styles,a=r.components,l=$r().displayMonths,c=my(r.id?"".concat(r.id,"-").concat(n.displayIndex):void 0),u=r.id?"".concat(r.id,"-grid-").concat(n.displayIndex):void 0,d=[i.month],f=o.month,h=n.displayIndex===0,m=n.displayIndex===l.length-1,y=!h&&!m;s==="rtl"&&(e=[h,m],m=e[0],h=e[1]),h&&(d.push(i.caption_start),f=z(z({},f),o.caption_start)),m&&(d.push(i.caption_end),f=z(z({},f),o.caption_end)),y&&(d.push(i.caption_between),f=z(z({},f),o.caption_between));var g=(t=a==null?void 0:a.Caption)!==null&&t!==void 0?t:wg;return p.jsxs("div",{className:d.join(" "),style:f,children:[p.jsx(g,{id:c,displayMonth:n.displayMonth,displayIndex:n.displayIndex}),p.jsx(dy,{id:u,"aria-labelledby":c,displayMonth:n.displayMonth})]},n.displayIndex)}function yy(n){var e=Z(),t=e.classNames,r=e.styles;return p.jsx("div",{className:t.months,style:r.months,children:n.children})}function by(n){var e,t,r=n.initialProps,s=Z(),i=Sa(),o=$r(),a=w.useState(!1),l=a[0],c=a[1];w.useEffect(function(){s.initialFocus&&i.focusTarget&&(l||(i.focus(i.focusTarget),c(!0)))},[s.initialFocus,l,i.focus,i.focusTarget,i]);var u=[s.classNames.root,s.className];s.numberOfMonths>1&&u.push(s.classNames.multiple_months),s.showWeekNumber&&u.push(s.classNames.with_weeknumber);var d=z(z({},s.styles.root),s.style),f=Object.keys(r).filter(function(m){return m.startsWith("data-")}).reduce(function(m,y){var g;return z(z({},m),(g={},g[y]=r[y],g))},{}),h=(t=(e=r.components)===null||e===void 0?void 0:e.Months)!==null&&t!==void 0?t:yy;return p.jsx("div",z({className:u.join(" "),style:d,dir:s.dir,id:s.id,nonce:r.nonce,title:r.title,lang:r.lang},f,{children:p.jsx(h,{children:o.displayMonths.map(function(m,y){return p.jsx(gy,{displayIndex:y,displayMonth:m},y)})})}))}function vy(n){var e=n.children,t=Vm(n,["children"]);return p.jsx(lg,{initialProps:t,children:p.jsx(bg,{children:p.jsx(Zg,{initialProps:t,children:p.jsx(Tg,{initialProps:t,children:p.jsx(Dg,{initialProps:t,children:p.jsx(zg,{children:p.jsx(Xg,{children:e})})})})})})})}function xy(n){return p.jsx(vy,z({},n,{children:p.jsx(by,{initialProps:n})}))}function Zu({className:n,classNames:e,showOutsideDays:t=!0,...r}){return p.jsx(xy,{showOutsideDays:t,className:te("p-3",n),classNames:{months:"flex flex-col sm:flex-row space-y-4 sm:sp
116ace-x-4 sm:space-y-0",month:"space-y-4",caption:"flex justify-center pt-1 relative items-center",caption_label:"text-sm font-medium",nav:"space-x-1 flex items-center",nav_button:te(Dl({variant:"outline"}),"h-7 w-7 bg-transparent p-0 opacity-50 hover:opacity-100"),nav_button_previous:"absolute left-1",nav_button_next:"absolute right-1",table:"w-full border-collapse space-y-1",head_row:"flex",head_cell:"text-muted-foreground rounded-md w-9 font-normal text-[0.8rem]",row:"flex w-full mt-2",cell:"h-9 w-9 text-center text-sm p-0 relative [&:has([aria-selected].day-range-end)]:rounded-r-md [&:has([aria-selected].day-outside)]:bg-accent/50 [&:has([aria-selected])]:bg-accent first:[&:has([aria-selected])]:rounded-l-md last:[&:has([aria-selected])]:rounded-r-md focus-within:relative focus-within:z-20",day:te(Dl({variant:"ghost"}),"h-9 w-9 p-0 font-normal aria-selected:opacity-100"),day_range_end:"day-range-end",day_selected:"bg-primary text-primary-foreground hover:bg-primary hover:text-primary-foreground focus:bg-primary focus:text-primary-foreground",day_today:"bg-accent text-accent-foreground",day_outside:"day-outside text-muted-foreground opacity-50 aria-selected:bg-accent/50 aria-selected:text-muted-foreground aria-selected:opacity-30",day_disabled:"text-muted-foreground opacity-50",day_range_middle:"aria-selected:bg-accent aria-selected:text-accent-foreground",day_hidden:"invisible",...e},components:{IconLeft:({...s})=>p.jsx(tm,{className:"h-4 w-4"}),IconRight:({...s})=>p.jsx(Kp,{className:"h-4 w-4"})},...r})}Zu.displayName="Calendar";const ed=n=>{if(!n)return null;const e=n.match(/^(\d{4})-(\d{2})-(\d{2})$/);if(!e)return null;const t=new Date(+e[1],+e[2]-1,+e[3]);return Pp(t)?t:null},td=n=>`${n.getFullYear()}-${String(n.getMonth()+1).padStart(2,"0")}-${String(n.getDate()).padStart(2,"0")}`,Qr=n=>{const e=ed(n);return e?St(e,"dd.MM.yyyy"):""},Fl=n=>{if(!n)return"";const e=n.trim(),t=e.match(/^(\d{1,2})[.\/\-](\d{1,2})[.\/\-](\d{2,4})$/);let r,s,i;if(t)r=+t[1],s=+t[2],i=+t[3];else{const a=e.replace(/\D/g,"");if(a.length===6)r=+a.slice(0,2),s=+a.slice(2,4),i=+a.slice(4,6);else if(a.length===8)r=+a.slice(0,2),s=+a.slice(2,4),i=+a.slice(4,8);else return null}if(i<100&&(i+=2e3),i<1900||i>2100||s<1||s>12||r<1||r>31)return null;const o=new Date(i,s-1,r);return o.getFullYear()!==i||o.getMonth()!==s-1||o.getDate()!==r?null:td(o)},ms=w.forwardRef(({id:n,value:e,onChange:t,required:r,className:s,placeholder:i="TT.MM.JJJJ"},o)=>{const[a,l]=w.useState(Qr(e)),[c,u]=w.useState(!1),[d,f]=w.useState(!1);w.useEffect(()=>{l(Qr(e)),f(!1)},[e]);const h=g=>{const x=g.target.value.replace(/[^\d.\/\-]/g,""),N=x.replace(/\D/g,"").slice(0,8);let A=x;x===N&&(N.length>4?A=`${N.slice(0,2)}.${N.slice(2,4)}.${N.slice(4)}`:N.length>2?A=`${N.slice(0,2)}.${N.slice(2)}`:A=N),l(A);const S=Fl(A);S&&(f(!1),S!==e&&t(S))},m=()=>{if(!a){f(!1),t("");return}const g=Fl(a);if(!g){f(!0);return}f(!1),l(Qr(g)),t(g)},y=ed(e)||void 0;return p.jsxs("div",{className:te("flex gap-1",s),children:[p.jsx(_e,{id:n,ref:o,type:"text",inputMode:"numeric",autoComplete:"off",placeholder:i,value:a,onChange:h,onBlur:m,required:r,maxLength:10,className:te("flex-1",d&&"border-destructive text-destructive")}
116),p.jsxs(ga,{open:c,onOpenChange:u,children:[p.jsx(ya,{asChild:!0,children:p.jsx(be,{type:"button",variant:"outline",size:"icon",className:"shrink-0","aria-label":"Datum auswählen",children:p.jsx(Oo,{className:"h-4 w-4"})})}),p.jsx(gi,{className:"w-auto p-0 pointer-events-auto",align:"end",children:p.jsx(Zu,{mode:"single",selected:y,defaultMonth:y,onSelect:g=>{if(g){const v=td(g);f(!1),l(Qr(v)),t(v),u(!1)}},locale:Cu,weekStartsOn:1,captionLayout:"dropdown-buttons",fromYear:2e3,toYear:2035,initialFocus:!0,className:te("p-3 pointer-events-auto")})})]})]})});ms.displayName="DateInput";function $l({label:n,value:e,onChange:t,bucket:r,folder:s="",className:i}){const[o,a]=w.useState(!1),[l,c]=w.useState(!1),u=w.useRef(null),d=async g=>{if(g){if(!g.type.startsWith("image/")){Y.error("Bitte nur Bilddateien hochladen");return}if(g.size>10*1024*1024){Y.error("Datei zu groà (max. 10MB)");return}a(!0);try{const v=g.name.split(".").pop(),x=`${s?s+"/":""}${Date.now()}-${Math.random().toString(36).substring(7)}.${v}`,{data:N,error:A}=await Q.storage.from(r).upload(x,g,{cacheControl:"3600",upsert:!1});if(A)throw A;const{data:S}=Q.storage.from(r).getPublicUrl(N.path);t(S.publicUrl),Y.success("Bild hochgeladen")}catch(v){console.error("Upload error:",v),Y.error(v.message||"Fehler beim Hochladen")}finally{a(!1)}}},f=g=>{var x;const v=(x=g.target.files)==null?void 0:x[0];v&&d(v)},h=g=>{g.preventDefault(),g.stopPropagation(),g.type==="dragenter"||g.type==="dragover"?c(!0):g.type==="dragleave"&&c(!1)},m=g=>{var x;g.preventDefault(),g.stopPropagation(),c(!1);const v=(x=g.dataTransfer.files)==null?void 0:x[0];v&&d(v)},y=()=>{t("")};return p.jsxs("div",{className:te("space-y-2",i),children:[p.jsx(se,{children:n}),e?p.jsxs("div",{className:"relative group",children:[p.jsx("div",{className:"relative aspect-video rounded-lg overflow-hidden border border-border bg-muted",children:p.jsx("img",{src:e,alt:"Vorschau",className:"w-full h-full object-cover",onError:g=>{g.currentTarget.src="/placeholder.svg"}})}),p.jsx(be,{type:"button",variant:"destructive",size:"icon",className:"absolute top-2 right-2 opacity-0 group-hover:opacity-100 transition-opacity h-8 w-8",onClick:y,children:p.jsx(or,{className:"h-4 w-4"})}),p.jsx("p",{className:"text-xs text-muted-foreground mt-1 truncate",children:e})]}):p.jsxs("div",{className:te("border-2 border-dashed rounded-lg p-6 text-center transition-colors cursor-pointer",l?"border-primary bg-primary/5":"border-border hover:border-primary/50",o&&"pointer-events-none opacity-50"),onDragEnter:h,onDragLeave:h,onDragOver:h,onDrop:m,onClick:()=>{var g;return(g=u.current)==null?void 0:g.click()},children:[p.jsx("input",{ref:u,type:"file",accept:"image/*",onChange:f,className:"hidden"}),o?p.jsxs("div",{className:"flex flex-col items-center gap-2",children:[p.jsx(Ss,{className:"h-8 w-8 animate-spin text-muted-foreground"}),p.jsx("p",{className:"text-sm text-muted-foreground",children:"Wird hochgeladen..."})]}):p.jsxs("div",{className:"flex flex-col items-center gap-2",children:[p.jsx("div",{className:"p-3 rounded-full bg-muted",children:p.jsx(gm,{className:"h-6 w-6 text-muted-foreground"})}),p.jsxs("div",{children:[p.jsx("p",{className:"text-sm font-medium",children:"Bild hierher ziehen oder klicken"}),p.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"JPG, PNG, WebP (max. 10MB)"})]})]})]}),p.jsx("div",{className:"flex gap-2 items-center",children:p.jsx(_e,{type:"url",placeholder:"Oder URL eingeben...",value:e,onChange:g=>t(g.target.value),className:"text-xs"})})]})}var nd={exports:{}},rd={};/** 117 * @license React 118 * use-sync-external-store-shim.production.js 119 * 120 * Copyright (c) Meta Platforms, Inc. and affiliates. 121 * 122 * This source code is licensed under the MIT license found in the 123 * LICENSE file in the root directory of this source tree. 124 */var Hn=w;function ky(n,e){return n===e&&(n!==0||1/n===1/e)||n!==n&&e!==e}var wy=typeof Object.is=="function"?Object.is:ky,Sy=Hn.useState,Cy=Hn.useEffect,My=Hn.useLayoutEffect,Ny=Hn.useDebugValue;function Ey(n,e){var t=e(),r=Sy({inst:{value:t,getSnapshot:e}}),s=r[0].inst,i=r[1];return My(function(){s.value=t,s.getSnapshot=e,Xi(s)&&i({inst:s})},[n,t,e]),Cy(function(){return Xi(s)&&i({inst:s}),n(function(){Xi(s)&&i({inst:s})})},[n]),Ny(t),t}function Xi(n){var e=n.getSnapshot;n=n.value;try{var t=e();return!wy(n,t)}catch{return!0}}function Ty(n,e){return e()}var Ay=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?Ty:Ey;rd.useSyncExternalStore=Hn.useSyncExternalStore!==void 0?Hn.useSyncExternalStore:Ay;nd.exports=rd;var Ma=nd.exports;function Ce(n){this.content=n}Ce.prototype={constructor:Ce,find:function(n){for(var e=0;e<this.content.length;e+=2)if(this.content[e]===n)return e;return-1},get:function(n){var e=this.find(n);return e==-1?void 0:this.content[e+1]},update:function(n,e,t){var r=t&&t!=n?this.remove(t):this,s=r.find(n),i=r.content.slice();return s==-1?i.push(t||n,e):(i[s+1]=e,t&&(i[s]=t)),new Ce(i)},remove:function(n){var e=this.find(n);if(e==-1)return this;var t=this.content.slice();return t.splice(e,2),new Ce(t)},addToStart:function(n,e){return new Ce([n,e].concat(this.remove(n).content))},addToEnd:function(n,e){var t=this.remove(n).content.slice();return t.push(n,e),new Ce(t)},addBefore:function(n,e,t){var r=this.remove(e),s=r.content.slice(),i=r.find(n);return s.splice(i==-1?s.length:i,0,e,t),new Ce(s)}
vendor: 17,575 bytes, line 124
124,forEach:function(n){for(var e=0;e<this.content.length;e+=2)n(this.content[e],this.content[e+1])},prepend:function(n){return n=Ce.from(n),n.size?new Ce(n.content.concat(this.subtract(n).content)):this},append:function(n){return n=Ce.from(n),n.size?new Ce(this.subtract(n).content.concat(n.content)):this},subtract:function(n){var e=this;n=Ce.from(n);for(var t=0;t<n.content.length;t+=2)e=e.remove(n.content[t]);return e},toObject:function(){var n={};return this.forEach(function(e,t){n[e]=t}),n},get size(){return this.content.length>>1}};Ce.from=function(n){if(n instanceof Ce)return n;var e=[];if(n)for(var t in n)e.push(t,n[t]);return new Ce(e)};function sd(n,e,t){for(let r=0;;r++){if(r==n.childCount||r==e.childCount)return n.childCount==e.childCount?null:t;let s=n.child(r),i=e.child(r);if(s==i){t+=s.nodeSize;continue}if(!s.sameMarkup(i))return t;if(s.isText&&s.text!=i.text){for(let o=0;s.text[o]==i.text[o];o++)t++;return t}if(s.content.size||i.content.size){let o=sd(s.content,i.content,t+1);if(o!=null)return o}t+=s.nodeSize}}function id(n,e,t,r){for(let s=n.childCount,i=e.childCount;;){if(s==0||i==0)return s==i?null:{a:t,b:r};let o=n.child(--s),a=e.child(--i),l=o.nodeSize;if(o==a){t-=l,r-=l;continue}if(!o.sameMarkup(a))return{a:t,b:r};if(o.isText&&o.text!=a.text){let c=0,u=Math.min(o.text.length,a.text.length);for(;c<u&&o.text[o.text.length-c-1]==a.text[a.text.length-c-1];)c++,t--,r--;return{a:t,b:r}}if(o.content.size||a.content.size){let c=id(o.content,a.content,t-1,r-1);if(c)return c}t-=l,r-=l}}class C{constructor(e,t){if(this.content=e,this.size=t||0,t==null)for(let r=0;r<e.length;r++)this.size+=e[r].nodeSize}nodesBetween(e,t,r,s=0,i){for(let o=0,a=0;a<t;o++){let l=this.content[o],c=a+l.nodeSize;if(c>e&&r(l,s+a,i||null,o)!==!1&&l.content.size){let u=a+1;l.nodesBetween(Math.max(0,e-u),Math.min(l.content.size,t-u),r,s+u)}a=c}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,t,r,s){let i="",o=!0;return this.nodesBetween(e,t,(a,l)=>{let c=a.isText?a.text.slice(Math.max(e,l)-l,t-l):a.isLeaf?s?typeof s=="function"?s(a):s:a.type.spec.leafText?a.type.spec.leafText(a):"":"";a.isBlock&&(a.isLeaf&&c||a.isTextblock)&&r&&(o?o=!1:i+=r),i+=c},0),i}append(e){if(!e.size)return this;if(!this.size)return e;let t=this.lastChild,r=e.firstChild,s=this.content.slice(),i=0;for(t.isText&&t.sameMarkup(r)&&(s[s.length-1]=t.withText(t.text+r.text),i=1);i<e.content.length;i++)s.push(e.content[i]);return new C(s,this.size+e.size)}cut(e,t=this.size){if(e==0&&t==this.size)return this;let r=[],s=0;if(t>e)for(let i=0,o=0;o<t;i++){let a=this.content[i],l=o+a.nodeSize;l>e&&((o<e||l>t)&&(a.isText?a=a.cut(Math.max(0,e-o),Math.min(a.text.length,t-o)):a=a.cut(Math.max(0,e-o-1),Math.min(a.content.size,t-o-1))),r.push(a),s+=a.nodeSize),o=l}return new C(r,s)}cutByIndex(e,t){return e==t?C.empty:e==0&&t==this.content.length?this:new C(this.content.slice(e,t))}replaceChild(e,t){let r=this.content[e];if(r==t)return this;let s=this.content.slice(),i=this.size+t.nodeSize-r.nodeSize;return s[e]=t,new C(s,i)}addToStart(e){return new C([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new C(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,r=0;t<this.content.length;t++){let s=this.content[t];e(s,r,t),r+=s.nodeSize}}findDiffStart(e,t=0){return sd(this,e,t)}findDiffEnd(e,t=this.size,r=e.size){return id(this,e,t,r)}findIndex(e){if(e==0)return Zr(0,e);if(e==this.size)return Zr(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let t=0,r=0;;t++){let s=this.child(t),i=r+s.nodeSize;if(i>=e)return i==e?Zr(t+1,i):Zr(t,r);r=i}}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 C.empty;if(!Array.isArray(t))throw new RangeError("Invalid input for Fragment.fromJSON");return new C(t.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return C.empty;let t,r=0;for(let s=0;s<e.length;s++){let i=e[s];r+=i.nodeSize,s&&i.isText&&e[s-1].sameMarkup(i)?(t||(t=e.slice(0,s)),t[t.length-1]=i.withText(t[t.length-1].text+i.text)):t&&t.push(i)}return new C(t||e,r)}static from(e){if(!e)return C.empty;if(e instanceof C)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new C([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}C.empty=new C([],0);const Qi={index:0,offset:0};function Zr(n,e){return Qi.index=n,Qi.offset=e,Qi}function Ms(n,e){if(n===e)return!0;if(!(n&&typeof n=="object")||!(e&&typeof e=="object"))return!1;let t=Array.isArray(n);if(Array.isArray(e)!=t)return!1;if(t){if(n.length!=e.length)return!1;for(let r=0;r<n.length;r++)if(!Ms(n[r],e[r]))return!1}else{for(let r in n)if(!(r in e)||!Ms(n[r],e[r]))return!1;for(let r in e)if(!(r in n))return!1}return!0}let G=class Io{constructor(e,t){this.type=e,this.attrs=t}addToSet(e){let t,r=!1;for(let s=0;s<e.length;s++){let i=e[s];if(this.eq(i))return e;if(this.type.excludes(i.type))t||(t=e.slice(0,s));else{if(i.type.excludes(this.type))return e;!r&&i.type.rank>this.type.rank&&(t||(t=e.slice(0,s)),t.push(this),r=!0),t&&t.push(i)}}return t||(t=e.slice()),r||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&&Ms(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 r=e.marks[t.type];if(!r)throw new RangeError(`There is no mark type ${t.type} in this schema`);let s=r.create(t.attrs);return r.checkAttrs(s.attrs),s}static sameSet(e,t){if(e==t)return!0;if(e.length!=t.length)return!1;for(let r=0;r<e.length;r++)if(!e[r].eq(t[r]))return!1;return!0}static setFrom(e){if(!e||Array.isArray(e)&&e.length==0)return Io.none;if(e instanceof Io)return[e];let t=e.slice();return t.sort((r,s)=>r.type.rank-s.type.rank),t}};G.none=[];class Ns extends Error{}class R{constructor(e,t,r){this.content=e,this.openStart=t,this.openEnd=r}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,t){let r=ad(this.content,e+this.openStart,t);return r&&new R(r,this.openStart,this.openEnd)}removeBetween(e,t){return new R(od(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 R.empty;let r=t.openStart||0,s=t.openEnd||0;if(typeof r!="number"||typeof s!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new R(C.fromJSON(e,t.content),r,s)}static maxOpen(e,t=!0){let r=0,s=0;for(let i=e.firstChild;i&&!i.isLeaf&&(t||!i.type.spec.isolating);i=i.firstChild)r++;for(let i=e.lastChild;i&&!i.isLeaf&&(t||!i.type.spec.isolating);i=i.lastChild)s++;return new R(e,r,s)}}R.empty=new R(C.empty,0,0);function od(n,e,t){let{index:r,offset:s}=n.findIndex(e),i=n.maybeChild(r),{index:o,offset:a}=n.findIndex(t);if(s==e||i.isText){if(a!=t&&!n.child(o).isText)throw new RangeError("Removing non-flat range");return n.cut(0,e).append(n.cut(t))}if(r!=o)throw new RangeError("Removing non-flat range");return n.replaceChild(r,i.copy(od(i.content,e-s-1,t-s-1)))}function ad(n,e,t,r){let{index:s,offset:i}=n.findIndex(e),o=n.maybeChild(s);if(i==e||o.isText)return r&&!r.canReplace(s,s,t)?null:n.cut(0,e).append(t).append(n.cut(e));let a=ad(o.content,e-i-1,t,o);return a&&n.replaceChild(s,o.copy(a))}function Oy(n,e,t){if(t.openStart>n.depth)throw new Ns("Inserted content deeper than insertion position");if(n.depth-t.openStart!=e.depth-t.openEnd)throw new Ns("Inconsistent open depths");return ld(n,e,t,0)}function ld(n,e,t,r){let s=n.index(r),i=n.node(r);if(s==e.index(r)&&r<n.depth-t.openStart){let o=ld(n,e,t,r+1);return i.copy(i.content.replaceChild(s,o))}else if(t.content.size)if(!t.openStart&&!t.openEnd&&n.depth==r&&e.depth==r){let o=n.parent,a=o.content;return mn(o,a.cut(0,n.parentOffset).append(t.content).append(a.cut(e.parentOffset)))}else{let{start:o,end:a}=Dy(t,n);return mn(i,ud(n,o,a,e,r))}else return mn(i,Es(n,e,r))}function cd(n,e){if(!e.type.compatibleContent(n.type))throw new Ns("Cannot join "+e.type.name+" onto "+n.type.name)}function Po(n,e,t){let r=n.node(t);return cd(r,e.node(t)),r}function pn(n,e){let t=e.length-1;t>=0&&n.isText&&n.sameMarkup(e[t])?e[t]=n.withText(e[t].text+n.text):e.push(n)}function hr(n,e,t,r){let s=(e||n).node(t),i=0,o=e?e.index(t):s.childCount;n&&(i=n.index(t),n.depth>t?i++:n.textOffset&&(pn(n.nodeAfter,r),i++));for(let a=i;a<o;a++)pn(s.child(a),r);e&&e.depth==t&&e.textOffset&&pn(e.nodeBefore,r)}function mn(n,e){return n.type.checkContent(e),n.copy(e)}function ud(n,e,t,r,s){let i=n.depth>s&&Po(n,e,s+1),o=r.depth>s&&Po(t,r,s+1),a=[];return hr(null,n,s,a),i&&o&&e.index(s)==t.index(s)?(cd(i,o),pn(mn(i,ud(n,e,t,r,s+1)),a)):(i&&pn(mn(i,Es(n,e,s+1)),a),hr(e,t,s,a),o&&pn(mn(o,Es(t,r,s+1)),a)),hr(r,null,s,a),new C(a)}function Es(n,e,t){let r=[];if(hr(null,n,t,r),n.depth>t){let s=Po(n,e,t+1);pn(mn(s,Es(n,e,t+1)),r)}return hr(e,null,t,r),new C(r)}function Dy(n,e){let t=e.depth-n.openStart,s=e.node(t).copy(n.content);for(let i=t-1;i>=0;i--)s=e.node(i).copy(C.from(s));return{start:s.resolveNoCache(n.openStart+t),end:s.resolveNoCache(s.content.size-n.openEnd-t)}}class Nr{constructor(e,t,r){this.pos=e,this.path=t,this.parentOffset=r,this.depth=t.length/3-1}resolveDepth(e){return e==null?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[this.resolveDepth(e)*3]}index(e){return this.path[this.resolveDepth(e)*3+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e==this.depth&&!this.textOffset?0:1)}start(e){return e=this.resolveDepth(e),e==0?0:this.path[e*3-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position before the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]}after(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position after the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]+this.path[e*3].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 r=this.pos-this.path[this.path.length-1],s=e.child(t);return r?e.child(t).cut(r):s}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):e==0?null:this.parent.child(e-1)}posAtIndex(e,t){t=this.resolveDepth(t);let r=this.path[t*3],s=t==0?0:this.path[t*3-1]+1;for(let i=0;i<e;i++)s+=r.child(i).nodeSize;return s}marks(){let e=this.parent,t=this.index();if(e.content.size==0)return G.none;if(this.textOffset)return e.child(t).marks;let r=e.maybeChild(t-1),s=e.maybeChild(t);if(!r){let a=r;r=s,s=a}let i=r.marks;for(var o=0;o<i.length;o++)i[o].type.spec.inclusive===!1&&(!s||!i[o].isInSet(s.marks))&&(i=i[o--].removeFromSet(i));return i}marksAcross(e){let t=this.parent.maybeChild(this.index());if(!t||!t.isInline)return null;let r=t.marks,s=e.parent.maybeChild(e.index());for(var i=0;i<r.length;i++)r[i].type.spec.inclusive===!1&&(!s||!r[i].isInSet(s.marks))&&(r=r[i--].removeFromSet(r));return r}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 r=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);r>=0;r--)if(e.pos<=this.end(r)&&(!t||t(this.node(r))))return new Ts(this,e,r);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 r=[],s=0,i=t;for(let o=e;;){let{index:a,offset:l}=o.content.findIndex(i),c=i-l;if(r.push(o,a,s+l),!c||(o=o.child(a),o.isText))break;i=c-1,s+=l+1}return new Nr(t,r,i)}static resolveCached(e,t){let r=Hl.get(e);if(r)for(let i=0;i<r.elts.length;i++){let o=r.elts[i];if(o.pos==t)return o}else Hl.set(e,r=new Ry);let s=r.elts[r.i]=Nr.resolve(e,t);return r.i=(r.i+1)%_y,s}}class Ry{constructor(){this.elts=[],this.i=0}}const _y=12,Hl=new WeakMap;class Ts{constructor(e,t,r){this.$from=e,this.$to=t,this.depth=r}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 Iy=Object.create(null);class rt{constructor(e,t,r,s=G.none){this.type=e,this.attrs=t,this.marks=s,this.content=r||C.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,r,s=0){this.content.nodesBetween(e,t,r,s,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,r,s){return this.content.textBetween(e,t,r,s)}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,r){return this.type==e&&Ms(this.attrs,t||e.defaultAttrs||Iy)&&G.sameSet(this.marks,r||G.none)}copy(e=null){return e==this.content?this:new rt(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new rt(this.type,this.attrs,this.content,e)}cut(e,t=this.content.size){return e==0&&t==this.content.size?this:this.copy(this.content.cut(e,t))}slice(e,t=this.content.size,r=!1){if(e==t)return R.empty;let s=this.resolve(e),i=this.resolve(t),o=r?0:s.sharedDepth(t),a=s.start(o),c=s.node(o).content.cut(s.pos-a,i.pos-a);return new R(c,s.depth-o,i.depth-o)}replace(e,t,r){return Oy(this.resolve(e),this.resolve(t),r)}nodeAt(e){for(let t=this;;){let{index:r,offset:s}=t.content.findIndex(e);if(t=t.maybeChild(r),!t)return null;if(s==e||t.isText)return t;e-=s+1}}childAfter(e){let{index:t,offset:r}=this.content.findIndex(e);return{node:this.content.maybeChild(t),index:t,offset:r}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:t,offset:r}=this.content.findIndex(e);if(r<e)return{node:this.content.child(t),index:t,offset:r};let s=this.content.child(t-1);return{node:s,index:t-1,offset:r-s.nodeSize}}resolve(e){return Nr.resolveCached(this,e)}resolveNoCache(e){return Nr.resolve(this,e)}rangeHasMark(e,t,r){let s=!1;return t>e&&this.nodesBetween(e,t,i=>(r.isInSet(i.marks)&&(s=!0),!s)),s}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()+")"),dd(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,r=C.empty,s=0,i=r.childCount){let o=this.contentMatchAt(e).matchFragment(r,s,i),a=o&&o.matchFragment(this.content,t);if(!a||!a.validEnd)return!1;for(let l=s;l<i;l++)if(!this.type.allowsMarks(r.child(l).marks))return!1;return!0}canReplaceWith(e,t,r,s){if(s&&!this.type.allowsMarks(s))return!1;let i=this.contentMatchAt(e).matchType(r),o=i&&i.matchFragment(this.content,t);return o?o.validEnd:!1}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=G.none;for(let t=0;t<this.marks.length;t++){let r=this.marks[t];r.type.checkAttrs(r.attrs),e=r.addToSet(e)}if(!G.sameSet(e,this.marks))throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(t=>t.type.name)}
124`);this.content.forEach(t=>t.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(t=>t.toJSON())),e}static fromJSON(e,t){if(!t)throw new RangeError("Invalid input for Node.fromJSON");let r;if(t.marks){if(!Array.isArray(t.marks))throw new RangeError("Invalid mark data for Node.fromJSON");r=t.marks.map(e.markFromJSON)}if(t.type=="text"){if(typeof t.text!="string")throw new RangeError("Invalid text node in JSON");return e.text(t.text,r)}let s=C.fromJSON(e,t.content),i=e.nodeType(t.type).create(t.attrs,s,r);return i.type.checkAttrs(i.attrs),i}}rt.prototype.text=void 0;class As extends rt{constructor(e,t,r,s){if(super(e,t,null,s),!r)throw new RangeError("Empty text nodes are not allowed");this.text=r}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):dd(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 As(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new As(this.type,this.attrs,e,this.marks)}cut(e=0,t=this.text.length){return e==0&&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 dd(n,e){for(let t=n.length-1;t>=0;t--)e=n[t].type.name+"("+e+")";return e}class xn{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,t){let r=new Py(e,t);if(r.next==null)return xn.empty;let s=fd(r);r.next&&r.err("Unexpected trailing text");let i=Hy($y(s));return Vy(i,r),i}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,r=e.childCount){let s=this;for(let i=t;s&&i<r;i++)s=s.matchType(e.child(i).type);return s}get inlineContent(){return this.next.length!=0&&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 r=0;r<e.next.length;r++)if(this.next[t].type==e.next[r].type)return!0;return!1}fillBefore(e,t=!1,r=0){let s=[this];function i(o,a){let l=o.matchFragment(e,r);if(l&&(!t||l.validEnd))return C.from(a.map(c=>c.createAndFill()));for(let c=0;c<o.next.length;c++){let{type:u,next:d}=o.next[c];if(!(u.isText||u.hasRequiredAttrs())&&s.indexOf(d)==-1){s.push(d);let f=i(d,a.concat(u));if(f)return f}}return null}return i(this,[])}findWrapping(e){for(let r=0;r<this.wrapCache.length;r+=2)if(this.wrapCache[r]==e)return this.wrapCache[r+1];let t=this.computeWrapping(e);return this.wrapCache.push(e,t),t}computeWrapping(e){let t=Object.create(null),r=[{match:this,type:null,via:null}];for(;r.length;){let s=r.shift(),i=s.match;if(i.matchType(e)){let o=[];for(let a=s;a.type;a=a.via)o.push(a.type);return o.reverse()}for(let o=0;o<i.next.length;o++){let{type:a,next:l}=i.next[o];!a.isLeaf&&!a.hasRequiredAttrs()&&!(a.name in t)&&(!s.type||l.validEnd)&&(r.push({match:a.contentMatch,type:a,via:s}),t[a.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=[];function t(r){e.push(r);for(let s=0;s<r.next.length;s++)e.indexOf(r.next[s].next)==-1&&t(r.next[s].next)}return t(this),e.map((r,s)=>{let i=s+(r.validEnd?"*":" ")+" ";for(let o=0;o<r.next.length;o++)i+=(o?", ":"")+r.next[o].type.name+"->"+e.indexOf(r.next[o].next);return i}).join(` 125`)}}xn.empty=new xn(!0);class Py{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 fd(n){let e=[];do e.push(jy(n));while(n.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function jy(n){let e=[];do e.push(Ly(n));while(n.next&&n.next!=")"&&n.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function Ly(n){let e=Fy(n);for(;;)if(n.eat("+"))e={type:"plus",expr:e};else if(n.eat("*"))e={type:"star",expr:e};else if(n.eat("?"))e={type:"opt",expr:e};else if(n.eat("{"))e=By(n,e);else break;return e}function Vl(n){/\D/.test(n.next)&&n.err("Expected number, got '"+n.next+"'");let e=Number(n.next);return n.pos++,e}function By(n,e){let t=Vl(n),r=t;return n.eat(",")&&(n.next!="}"?r=Vl(n):r=-1),n.eat("}")||n.err("Unclosed braced range"),{type:"range",min:t,max:r,expr:e}}function zy(n,e){let t=n.nodeTypes,r=t[e];if(r)return[r];let s=[];for(let i in t){let o=t[i];o.isInGroup(e)&&s.push(o)}return s.length==0&&n.err("No node type or group '"+e+"' found"),s}function Fy(n){if(n.eat("(")){let e=fd(n);return n.eat(")")||n.err("Missing closing paren"),e}else if(/\W/.test(n.next))n.err("Unexpected token '"+n.next+"'");else{let e=zy(n,n.next).map(t=>(n.inline==null?n.inline=t.isInline:n.inline!=t.isInline&&n.err("Mixing inline and block content"),{type:"name",value:t}));return n.pos++,e.length==1?e[0]:{type:"choice",exprs:e}}}function $y(n){let e=[[]];return s(i(n,0),t()),e;function t(){return e.push([])-1}function r(o,a,l){let c={term:l,to:a};return e[o].push(c),c}function s(o,a){o.forEach(l=>l.to=a)}function i(o,a){if(o.type=="choice")return o.exprs.reduce((l,c)=>l.concat(i(c,a)),[]);if(o.type=="seq")for(let l=0;;l++){let c=i(o.exprs[l],a);if(l==o.exprs.length-1)return c;s(c,a=t())}else if(o.type=="star"){let l=t();return r(a,l),s(i(o.expr,l),l),[r(l)]}else if(o.type=="plus"){let l=t();return s(i(o.expr,a),l),s(i(o.expr,l),l),[r(l)]}else{if(o.type=="opt")return[r(a)].concat(i(o.expr,a));if(o.type=="range"){let l=a;for(let c=0;c<o.min;c++){let u=t();s(i(o.expr,l),u),l=u}if(o.max==-1)s(i(o.expr,l),l);else for(let c=o.min;c<o.max;c++){let u=t();r(l,u),s(i(o.expr,l),u),l=u}return[r(l)]}else{if(o.type=="name")return[r(a,void 0,o.value)];throw new Error("Unknown expr type")}}}}function hd(n,e){return e-n}function Wl(n,e){let t=[];return r(e),t.sort(hd);function r(s){let i=n[s];if(i.length==1&&!i[0].term)return r(i[0].to);t.push(s);for(let o=0;o<i.length;o++){let{term:a,to:l}=i[o];!a&&t.indexOf(l)==-1&&r(l)}}}function Hy(n){let e=Object.create(null);return t(Wl(n,0));function t(r){let s=[];r.forEach(o=>
vendor: 7,704 bytes, line 125
125{n[o].forEach(({term:a,to:l})=>{if(!a)return;let c;for(let u=0;u<s.length;u++)s[u][0]==a&&(c=s[u][1]);Wl(n,l).forEach(u=>{c||s.push([a,c=[]]),c.indexOf(u)==-1&&c.push(u)})})});let i=e[r.join(",")]=new xn(r.indexOf(n.length-1)>-1);for(let o=0;o<s.length;o++){let a=s[o][1].sort(hd);i.next.push({type:s[o][0],next:e[a.join(",")]||t(a)})}return i}}function Vy(n,e){for(let t=0,r=[n];t<r.length;t++){let s=r[t],i=!s.validEnd,o=[];for(let a=0;a<s.next.length;a++){let{type:l,next:c}=s.next[a];o.push(l.name),i&&!(l.isText||l.hasRequiredAttrs())&&(i=!1),r.indexOf(c)==-1&&r.push(c)}i&&e.err("Only non-generatable nodes ("+o.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}function pd(n){let e=Object.create(null);for(let t in n){let r=n[t];if(!r.hasDefault)return null;e[t]=r.default}return e}function md(n,e){let t=Object.create(null);for(let r in n){let s=e&&e[r];if(s===void 0){let i=n[r];if(i.hasDefault)s=i.default;else throw new RangeError("No value supplied for attribute "+r)}t[r]=s}return t}function gd(n,e,t,r){for(let s in e)if(!(s in n))throw new RangeError(`Unsupported attribute ${s} for ${t} of type ${s}`);for(let s in n){let i=n[s];i.validate&&i.validate(e[s])}}function yd(n,e){let t=Object.create(null);if(e)for(let r in e)t[r]=new Uy(n,r,e[r]);return t}let Ul=class bd{constructor(e,t,r){this.name=e,this.schema=t,this.spec=r,this.markSet=null,this.groups=r.group?r.group.split(" "):[],this.attrs=yd(e,r.attrs),this.defaultAttrs=pd(this.attrs),this.contentMatch=null,this.inlineContent=null,this.isBlock=!(r.inline||e=="text"),this.isText=e=="text"}get isInline(){return!this.isBlock}get isTextblock(){return this.isBlock&&this.inlineContent}get isLeaf(){return this.contentMatch==xn.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:md(this.attrs,e)}create(e=null,t,r){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new rt(this,this.computeAttrs(e),C.from(t),G.setFrom(r))}createChecked(e=null,t,r){return t=C.from(t),this.checkContent(t),new rt(this,this.computeAttrs(e),t,G.setFrom(r))}createAndFill(e=null,t,r){if(e=this.computeAttrs(e),t=C.from(t),t.size){let o=this.contentMatch.fillBefore(t);if(!o)return null;t=o.append(t)}let s=this.contentMatch.matchFragment(t),i=s&&s.fillBefore(C.empty,!0);return i?new rt(this,e,t.append(i),G.setFrom(r)):null}validContent(e){let t=this.contentMatch.matchFragment(e);if(!t||!t.validEnd)return!1;for(let r=0;r<e.childCount;r++)if(!this.allowsMarks(e.child(r).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){gd(this.attrs,e,"node",this.name)}allowsMarkType(e){return this.markSet==null||this.markSet.indexOf(e)>-1}allowsMarks(e){if(this.markSet==null)return!0;for(let t=0;t<e.length;t++)if(!this.allowsMarkType(e[t].type))return!1;return!0}allowedMarks(e){if(this.markSet==null)return e;let t;for(let r=0;r<e.length;r++)this.allowsMarkType(e[r].type)?t&&t.push(e[r]):t||(t=e.slice(0,r));return t?t.length?t:G.none:e}static compile(e,t){let r=Object.create(null);e.forEach((i,o)=>r[i]=new bd(i,t,o));let s=t.spec.topNode||"doc";if(!r[s])throw new RangeError("Schema is missing its top node type ('"+s+"')");if(!r.text)throw new RangeError("Every schema needs a 'text' type");for(let i in r.text.attrs)throw new RangeError("The text node type should not have attributes");return r}};function Wy(n,e,t){let r=t.split("|");return s=>{let i=s===null?"null":typeof s;if(r.indexOf(i)<0)throw new RangeError(`Expected value of type ${r} for attribute ${e} on type ${n}, got ${i}`)}}class Uy{constructor(e,t,r){this.hasDefault=Object.prototype.hasOwnProperty.call(r,"default"),this.default=r.default,this.validate=typeof r.validate=="string"?Wy(e,t,r.validate):r.validate}get isRequired(){return!this.hasDefault}}class bi{constructor(e,t,r,s){this.name=e,this.rank=t,this.schema=r,this.spec=s,this.attrs=yd(e,s.attrs),this.excluded=null;let i=pd(this.attrs);this.instance=i?new G(this,i):null}create(e=null){return!e&&this.instance?this.instance:new G(this,md(this.attrs,e))}static compile(e,t){let r=Object.create(null),s=0;return e.forEach((i,o)=>r[i]=new bi(i,s++,t,o)),r}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){gd(this.attrs,e,"mark",this.name)}excludes(e){return this.excluded.indexOf(e)>-1}}class vd{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let t=this.spec={};for(let s in e)t[s]=e[s];t.nodes=Ce.from(e.nodes),t.marks=Ce.from(e.marks||{}),this.nodes=Ul.compile(this.spec.nodes,this),this.marks=bi.compile(this.spec.marks,this);let r=Object.create(null);for(let s in this.nodes){if(s in this.marks)throw new RangeError(s+" can not be both a node and a mark");let i=this.nodes[s],o=i.spec.content||"",a=i.spec.marks;if(i.contentMatch=r[o]||(r[o]=xn.parse(o,this.nodes)),i.inlineContent=i.contentMatch.inlineContent,i.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!i.isInline||!i.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=i}i.markSet=a=="_"?null:a?ql(this,a.split(" ")):a==""||!i.inlineContent?[]:null}for(let s in this.marks){let i=this.marks[s],o=i.spec.excludes;i.excluded=o==null?[i]:o==""?[]:ql(this,o.split(" "))}this.nodeFromJSON=s=>rt.fromJSON(this,s),this.markFromJSON=s=>G.fromJSON(this,s),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(e,t=null,r,s){if(typeof e=="string")e=this.nodeType(e);else if(e instanceof Ul){if(e.schema!=this)throw new RangeError("Node type from different schema used ("+e.name+")")}else throw new RangeError("Invalid node type: "+e);return e.createChecked(t,r,s)}text(e,t){let r=this.nodes.text;return new As(r,r.defaultAttrs,e,G.setFrom(t))}mark(e,t){return typeof e=="string"&&(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 ql(n,e){let t=[];for(let r=0;r<e.length;r++){let s=e[r],i=n.marks[s],o=i;if(i)t.push(i);else for(let a in n.marks){let l=n.marks[a];(s=="_"||l.spec.group&&l.spec.group.split(" ").indexOf(s)>-1)&&t.push(o=l)}if(!o)throw new SyntaxError("Unknown mark type: '"+e[r]+"'")}return t}function qy(n){return n.tag!=null}function Ky(n){return n.style!=null}class Ft{constructor(e,t){this.schema=e,this.rules=t,this.tags=[],this.styles=[];let r=this.matchedStyles=[];t.forEach(s=>{if(qy(s))this.tags.push(s);else if(Ky(s)){let i=/[^=]*/.exec(s.style)[0];r.indexOf(i)<0&&r.push(i),this.styles.push(s)}}),this.normalizeLists=!this.tags.some(s=>{if(!/^(ul|ol)\b/.test(s.tag)||!s.node)return!1;let i=e.nodes[s.node];return i.contentMatch.matchType(i)})}parse(e,t={}){let r=new Jl(this,t,!1);return r.addAll(e,G.none,t.from,t.to),r.finish()}parseSlice(e,t={}){let r=new Jl(this,t,!0);return r.addAll(e,G.none,t.from,t.to),R.maxOpen(r.finish())}matchTag(e,t,r){for(let s=r?this.tags.indexOf(r)+1:0;s<this.tags.length;s++){let i=this.tags[s];if(Gy(e,i.tag)&&(i.namespace===void 0||e.namespaceURI==i.namespace)&&(!i.context||t.matchesContext(i.context))){if(i.getAttrs
vendor: 5,541 bytes, lines 125-127
125){let o=i.getAttrs(e);if(o===!1)continue;i.attrs=o||void 0}return i}}}matchStyle(e,t,r,s){for(let i=s?this.styles.indexOf(s)+1:0;i<this.styles.length;i++){let o=this.styles[i],a=o.style;if(!(a.indexOf(e)!=0||o.context&&!r.matchesContext(o.context)||a.length>e.length&&(a.charCodeAt(e.length)!=61||a.slice(e.length+1)!=t))){if(o.getAttrs){let l=o.getAttrs(t);if(l===!1)continue;o.attrs=l||void 0}return o}}}static schemaRules(e){let t=[];function r(s){let i=s.priority==null?50:s.priority,o=0;for(;o<t.length;o++){let a=t[o];if((a.priority==null?50:a.priority)<i)break}t.splice(o,0,s)}for(let s in e.marks){let i=e.marks[s].spec.parseDOM;i&&i.forEach(o=>{r(o=Yl(o)),o.mark||o.ignore||o.clearMark||(o.mark=s)})}for(let s in e.nodes){let i=e.nodes[s].spec.parseDOM;i&&i.forEach(o=>{r(o=Yl(o)),o.node||o.ignore||o.mark||(o.node=s)})}return t}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new Ft(e,Ft.schemaRules(e)))}}const xd={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},Jy={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},kd={ol:!0,ul:!0},Er=1,jo=2,pr=4;function Kl(n,e,t){return e!=null?(e?Er:0)|(e==="full"?jo:0):n&&n.whitespace=="pre"?Er|jo:t&~pr}class es{constructor(e,t,r,s,i,o){this.type=e,this.attrs=t,this.marks=r,this.solid=s,this.options=o,this.content=[],this.activeMarks=G.none,this.match=i||(o&pr?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let t=this.type.contentMatch.fillBefore(C.from(e));if(t)this.match=this.type.contentMatch.matchFragment(t);else{let r=this.type.contentMatch,s;return(s=r.findWrapping(e.type))?(this.match=r,s):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&Er)){let r=this.content[this.content.length-1],s;if(r&&r.isText&&(s=/[ \t\r\n\u000c]+$/.exec(r.text))){let i=r;r.text.length==s[0].length?this.content.pop():this.content[this.content.length-1]=i.withText(i.text.slice(0,i.text.length-s[0].length))}}let t=C.from(this.content);return!e&&this.match&&(t=t.append(this.match.fillBefore(C.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&&!xd.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class Jl{constructor(e,t,r){this.parser=e,this.options=t,this.isOpen=r,this.open=0,this.localPreserveWS=!1;let s=t.topNode,i,o=Kl(null,t.preserveWhitespace,0)|(r?pr:0);s?i=new es(s.type,s.attrs,G.none,!0,t.topMatch||s.type.contentMatch,o):r?i=new es(null,null,G.none,!0,null,o):i=new es(e.schema.topNodeType,null,G.none,!0,null,o),this.nodes=[i],this.find=t.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e,t){e.nodeType==3?this.addTextNode(e,t):e.nodeType==1&&this.addElement(e,t)}addTextNode(e,t){let r=e.nodeValue,s=this.top,i=s.options&jo?"full":this.localPreserveWS||(s.options&Er)>0,{schema:o}=this.parser;if(i==="full"||s.inlineContext(e)||/[^ \t\r\n\u000c]/.test(r)){if(i)if(i==="full")r=r.replace(/\r\n?/g,` 126`);else if(o.linebreakReplacement&&/[\r\n]/.test(r)&&this.top.findWrapping(o.linebreakReplacement.create())){let a=r.split(/\r?\n|\r/);for(let l=0;l<a.length;l++)l&&this.insertNode(o.linebreakReplacement.create(),t,!0),a[l]&&this.insertNode(o.text(a[l]),t,!/\S/.test(a[l]));r=""}else r=r.replace(/\r?\n|\r/g," ");else if(r=r.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(r)&&this.open==this.nodes.length-1){let a=s.content[s.content.length-1],l=e.previousSibling;(!a||l&&l.nodeName=="BR"||a.isText&&/[ \t\r\n\u000c]$/.test(a.text))&&(r=r.slice(1))}r&&this.insertNode(o.text(r),t,!/\S/.test(r)),this.findInText(e)}else this.findInside(e)}addElement(e,t,r){let s=this.localPreserveWS,i=this.top;(e.tagName=="PRE"||/pre/.test(e.style&&e.style.whiteSpace))&&(this.localPreserveWS=!0);let o=e.nodeName.toLowerCase(),a;kd.hasOwnProperty(o)&&this.parser.normalizeLists&&Yy(e);let l=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(a=this.parser.matchTag(e,this,r));e:if(l?l.ignore:Jy.hasOwnProperty(o))this.findInside(e),this.ignoreFallback(e,t);else if(!l||l.skip||l.closeParent){l&&l.closeParent?this.open=Math.max(0,this.open-1):l&&l.skip.nodeType&&(e=l.skip);let c,u=this.needsBlock;if(xd.hasOwnProperty(o))i.content.length&&i.content[0].isInline&&this.open&&(this.open--,i=this.top),c=!0,i.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e,t);break e}let d=l&&l.skip?t:this.readStyles(e,t);d&&this.addAll(e,d),c&&this.sync(i),this.needsBlock=u}else{let c=this.readStyles(e,t);c&&this.addElementByRule(e,l,c,l.consuming===!1?a:void 0)}this.localPreserveWS=s}leafFallback(e,t){e.nodeName=="BR"&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode(` 127`),t)}ignoreFallback(e,t){e.nodeName=="BR"&&(!this.top.type||!this.top.type.inlineContent)&&this.findPlace(this.parser.schema.text("-"),t,!0)}readStyles(e,t){let r=e.style;if(r&&r.length)for(let s=0;s<this.parser.matchedStyles.length;s++){let i=this.parser.matchedStyles[s],o=r.getPropertyValue(i);if(o)for(let a=void 0;;){let l=this.parser.matchStyle(i,o,this,a);if(!l)break;if(l.ignore)return null;if(l.clearMark?t=t.filter(c=>!l.clearMark(c)):t=t.concat(this.parser.schema.marks[l.mark].create(l.attrs)),l.consuming===!1)a=l;else break}}return t}addElementByRule(e,t,r,s){let i,o;
vendor: 4,117 bytes, line 127
127if(t.node)if(o=this.parser.schema.nodes[t.node],o.isLeaf)this.insertNode(o.create(t.attrs),r,e.nodeName=="BR")||this.leafFallback(e,r);else{let l=this.enter(o,t.attrs||null,r,t.preserveWhitespace);l&&(i=!0,r=l)}else{let l=this.parser.schema.marks[t.mark];r=r.concat(l.create(t.attrs))}let a=this.top;if(o&&o.isLeaf)this.findInside(e);else if(s)this.addElement(e,r,s);else if(t.getContent)this.findInside(e),t.getContent(e,this.parser.schema).forEach(l=>this.insertNode(l,r,!1));else{let l=e;typeof t.contentElement=="string"?l=e.querySelector(t.contentElement):typeof t.contentElement=="function"?l=t.contentElement(e):t.contentElement&&(l=t.contentElement),this.findAround(e,l,!0),this.addAll(l,r),this.findAround(e,l,!1)}i&&this.sync(a)&&this.open--}addAll(e,t,r,s){let i=r||0;for(let o=r?e.childNodes[r]:e.firstChild,a=s==null?null:e.childNodes[s];o!=a;o=o.nextSibling,++i)this.findAtPoint(e,i),this.addDOM(o,t);this.findAtPoint(e,i)}findPlace(e,t,r){let s,i;for(let o=this.open,a=0;o>=0;o--){let l=this.nodes[o],c=l.findWrapping(e);if(c&&(!s||s.length>c.length+a)&&(s=c,i=l,!c.length))break;if(l.solid){if(r)break;a+=2}}if(!s)return null;this.sync(i);for(let o=0;o<s.length;o++)t=this.enterInner(s[o],null,t,!1);return t}insertNode(e,t,r){if(e.isInline&&this.needsBlock&&!this.top.type){let i=this.textblockFromContext();i&&(t=this.enterInner(i,null,t))}let s=this.findPlace(e,t,r);if(s){this.closeExtra();let i=this.top;i.match&&(i.match=i.match.matchType(e.type));let o=G.none;for(let a of s.concat(e.marks))(i.type?i.type.allowsMarkType(a.type):Gl(a.type,e.type))&&(o=a.addToSet(o));return i.content.push(e.mark(o)),!0}return!1}enter(e,t,r,s){let i=this.findPlace(e.create(t),r,!1);return i&&(i=this.enterInner(e,t,r,!0,s)),i}enterInner(e,t,r,s=!1,i){this.closeExtra();let o=this.top;o.match=o.match&&o.match.matchType(e);let a=Kl(e,i,o.options);o.options&pr&&o.content.length==0&&(a|=pr);let l=G.none;return r=r.filter(c=>(o.type?o.type.allowsMarkType(c.type):Gl(c.type,e))?(l=c.addToSet(l),!1):!0),this.nodes.push(new es(e,t,l,s,null,a)),this.open++,r}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|=Er)}return!1}get currentPos(){this.closeExtra();let e=0;for(let t=this.open;t>=0;t--){let r=this.nodes[t].content;for(let s=r.length-1;s>=0;s--)e+=r[s].nodeSize;t&&e++}return e}findAtPoint(e,t){if(this.find)for(let r=0;r<this.find.length;r++)this.find[r].node==e&&this.find[r].offset==t&&(this.find[r].pos=this.currentPos)}findInside(e){if(this.find)for(let t=0;t<this.find.length;t++)this.find[t].pos==null&&e.nodeType==1&&e.contains(this.find[t].node)&&(this.find[t].pos=this.currentPos)}findAround(e,t,r){if(e!=t&&this.find)for(let s=0;s<this.find.length;s++)this.find[s].pos==null&&e.nodeType==1&&e.contains(this.find[s].node)&&t.compareDocumentPosition(this.find[s].node)&(r?2:4)&&(this.find[s].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("/"),r=this.options.context,s=!this.isOpen&&(!r||r.parent.type==this.nodes[0].type),i=-(r?r.depth+1:0)+(s?0:1),o=(a,l)=>{for(;a>=0;a--){let c=t[a];if(c==""){if(a==t.length-1||a==0)continue;for(;l>=i;l--)if(o(a-1,l))return!0;return!1}else{let u=l>0||l==0&&s?this.nodes[l].type:r&&l>=i?r.node(l-i).type:null;if(!u||u.name!=c&&!u.isInGroup(c))return!1;l--}}return!0};return o(t.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let t=e.depth;t>=0;t--){let r=e.node(t).contentMatchAt(e.indexAfter(t)).defaultType;if(r&&r.isTextblock&&r.defaultAttrs)return r}for(let t in this.parser.schema.nodes){let r=this.parser.schema.nodes[t];
vendor: 11,009 bytes, line 127
127if(r.isTextblock&&r.defaultAttrs)return r}}}function Yy(n){for(let e=n.firstChild,t=null;e;e=e.nextSibling){let r=e.nodeType==1?e.nodeName.toLowerCase():null;r&&kd.hasOwnProperty(r)&&t?(t.appendChild(e),e=t):r=="li"?t=e:r&&(t=null)}}function Gy(n,e){return(n.matches||n.msMatchesSelector||n.webkitMatchesSelector||n.mozMatchesSelector).call(n,e)}function Yl(n){let e={};for(let t in n)e[t]=n[t];return e}function Gl(n,e){let t=e.schema.nodes;for(let r in t){let s=t[r];if(!s.allowsMarkType(n))continue;let i=[],o=a=>{i.push(a);for(let l=0;l<a.edgeCount;l++){let{type:c,next:u}=a.edge(l);if(c==e||i.indexOf(u)<0&&o(u))return!0}};if(o(s.contentMatch))return!0}}class Mn{constructor(e,t){this.nodes=e,this.marks=t}serializeFragment(e,t={},r){r||(r=Zi(t).createDocumentFragment());let s=r,i=[];return e.forEach(o=>{if(i.length||o.marks.length){let a=0,l=0;for(;a<i.length&&l<o.marks.length;){let c=o.marks[l];if(!this.marks[c.type.name]){l++;continue}if(!c.eq(i[a][0])||c.type.spec.spanning===!1)break;a++,l++}for(;a<i.length;)s=i.pop()[1];for(;l<o.marks.length;){let c=o.marks[l++],u=this.serializeMark(c,o.isInline,t);u&&(i.push([c,s]),s.appendChild(u.dom),s=u.contentDOM||u.dom)}}s.appendChild(this.serializeNodeInner(o,t))}),r}serializeNodeInner(e,t){let{dom:r,contentDOM:s}=gs(Zi(t),this.nodes[e.type.name](e),null,e.attrs);if(s){if(e.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(e.content,t,s)}return r}serializeNode(e,t={}){let r=this.serializeNodeInner(e,t);for(let s=e.marks.length-1;s>=0;s--){let i=this.serializeMark(e.marks[s],e.isInline,t);i&&((i.contentDOM||i.dom).appendChild(r),r=i.dom)}return r}serializeMark(e,t,r={}){let s=this.marks[e.type.name];return s&&gs(Zi(r),s(e,t),null,e.attrs)}static renderSpec(e,t,r=null,s){return gs(e,t,r,s)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new Mn(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let t=Xl(e.nodes);return t.text||(t.text=r=>r.text),t}static marksFromSchema(e){return Xl(e.marks)}}function Xl(n){let e={};for(let t in n){let r=n[t].spec.toDOM;r&&(e[t]=r)}return e}function Zi(n){return n.document||window.document}const Ql=new WeakMap;function Xy(n){let e=Ql.get(n);return e===void 0&&Ql.set(n,e=Qy(n)),e}function Qy(n){let e=null;function t(r){if(r&&typeof r=="object")if(Array.isArray(r))if(typeof r[0]=="string")e||(e=[]),e.push(r);else for(let s=0;s<r.length;s++)t(r[s]);else for(let s in r)t(r[s])}return t(n),e}function gs(n,e,t,r){if(typeof e=="string")return{dom:n.createTextNode(e)};if(e.nodeType!=null)return{dom:e};if(e.dom&&e.dom.nodeType!=null)return e;let s=e[0],i;if(typeof s!="string")throw new RangeError("Invalid array passed to renderSpec");if(r&&(i=Xy(r))&&i.indexOf(e)>-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 o=s.indexOf(" ");o>0&&(t=s.slice(0,o),s=s.slice(o+1));let a,l=t?n.createElementNS(t,s):n.createElement(s),c=e[1],u=1;if(c&&typeof c=="object"&&c.nodeType==null&&!Array.isArray(c)){u=2;for(let d in c)if(c[d]!=null){let f=d.indexOf(" ");f>0?l.setAttributeNS(d.slice(0,f),d.slice(f+1),c[d]):d=="style"&&l.style?l.style.cssText=c[d]:l.setAttribute(d,c[d])}}for(let d=u;d<e.length;d++){let f=e[d];if(f===0){if(d<e.length-1||d>u)throw new RangeError("Content hole must be the only child of its parent node");return{dom:l,contentDOM:l}}else{let{dom:h,contentDOM:m}=gs(n,f,t,r);if(l.appendChild(h),m){if(a)throw new RangeError("Multiple content holes");a=m}}}return{dom:l,contentDOM:a}}const wd=65535,Sd=Math.pow(2,16);function Zy(n,e){return n+e*Sd}function Zl(n){return n&wd}function e0(n){return(n-(n&wd))/Sd}const Cd=1,Md=2,ys=4,Nd=8;class Lo{constructor(e,t,r){this.pos=e,this.delInfo=t,this.recover=r}get deleted(){return(this.delInfo&Nd)>0}get deletedBefore(){return(this.delInfo&(Cd|ys))>0}get deletedAfter(){return(this.delInfo&(Md|ys))>0}get deletedAcross(){return(this.delInfo&ys)>0}}class Ue{constructor(e,t=!1){if(this.ranges=e,this.inverted=t,!e.length&&Ue.empty)return Ue.empty}recover(e){let t=0,r=Zl(e);if(!this.inverted)for(let s=0;s<r;s++)t+=this.ranges[s*3+2]-this.ranges[s*3+1];return this.ranges[r*3]+t+e0(e)}mapResult(e,t=1){return this._map(e,t,!1)}map(e,t=1){return this._map(e,t,!0)}_map(e,t,r){let s=0,i=this.inverted?2:1,o=this.inverted?1:2;for(let a=0;a<this.ranges.length;a+=3){let l=this.ranges[a]-(this.inverted?s:0);if(l>e)break;let c=this.ranges[a+i],u=this.ranges[a+o],d=l+c;if(e<=d){let f=c?e==l?-1:e==d?1:t:t,h=l+s+(f<0?0:u);if(r)return h;let m=e==(t<0?l:d)?null:Zy(a/3,e-l),y=e==l?Md:e==d?Cd:ys;return(t<0?e!=l:e!=d)&&(y|=Nd),new Lo(h,y,m)}s+=u-c}return r?e+s:new Lo(e+s,0,null)}touches(e,t){let r=0,s=Zl(t),i=this.inverted?2:1,o=this.inverted?1:2;for(let a=0;a<this.ranges.length;a+=3){let l=this.ranges[a]-(this.inverted?r:0);if(l>e)break;let c=this.ranges[a+i],u=l+c;if(e<=u&&a==s*3)return!0;r+=this.ranges[a+o]-c}return!1}forEach(e){let t=this.inverted?2:1,r=this.inverted?1:2;for(let s=0,i=0;s<this.ranges.length;s+=3){let o=this.ranges[s],a=o-(this.inverted?i:0),l=o+(this.inverted?0:i),c=this.ranges[s+t],u=this.ranges[s+r];e(a,a+c,l,l+u),i+=u-c}}invert(){return new Ue(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?Ue.empty:new Ue(e<0?[0,-e,0]:[0,0,e])}}Ue.empty=new Ue([]);class Tr{constructor(e,t,r=0,s=e?e.length:0){this.mirror=t,this.from=r,this.to=s,this._maps=e||[],this.ownData=!(e||t)}get maps(){return this._maps}slice(e=0,t=this.maps.length){return new Tr(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),t!=null&&this.setMirror(this._maps.length-1,t)}appendMapping(e){for(let t=0,r=this._maps.length;t<e._maps.length;t++){let s=e.getMirror(t);this.appendMap(e._maps[t],s!=null&&s<t?r+s: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,r=this._maps.length+e._maps.length;t>=0;t--){let s=e.getMirror(t);this.appendMap(e._maps[t].invert(),s!=null&&s>t?r-s-1:void 0)}}invert(){let e=new Tr;return e.appendMappingInverted(this),e}map(e,t=1){if(this.mirror)return this._map(e,t,!0);for(let r=this.from;r<this.to;r++)e=this._maps[r].map(e,t);return e}mapResult(e,t=1){return this._map(e,t,!1)}_map(e,t,r){let s=0;for(let i=this.from;i<this.to;i++){let o=this._maps[i],a=o.mapResult(e,t);if(a.recover!=null){let l=this.getMirror(i);if(l!=null&&l>i&&l<this.to){i=l,e=this._maps[l].recover(a.recover);continue}}s|=a.delInfo,e=a.pos}return r?e:new Lo(e,s,null)}}const eo=Object.create(null);class De{getMap(){return Ue.empty}merge(e){return null}static fromJSON(e,t){if(!t||!t.stepType)throw new RangeError("Invalid input for Step.fromJSON");let r=eo[t.stepType];if(!r)throw new RangeError(`No step type ${t.stepType} defined`);return r.fromJSON(e,t)}static jsonID(e,t){if(e in eo)throw new RangeError("Duplicate use of step JSON ID "+e);return eo[e]=t,t.prototype.jsonID=e,t}}class ge{constructor(e,t){this.doc=e,this.failed=t}static ok(e){return new ge(e,null)}static fail(e){return new ge(null,e)}static fromReplace(e,t,r,s){try{return ge.ok(e.replace(t,r,s))}catch(i){if(i instanceof Ns)return ge.fail(i.message);throw i}}}function Na(n,e,t){let r=[];for(let s=0;s<n.childCount;s++){let i=n.child(s);i.content.size&&(i=i.copy(Na(i.content,e,i))),i.isInline&&(i=e(i,t,s)),r.push(i)}return C.fromArray(r)}class Lt extends De{constructor(e,t,r){super(),this.from=e,this.to=t,this.mark=r}apply(e){let t=e.slice(this.from,this.to),r=e.resolve(this.from),s=r.node(r.sharedDepth(this.to)),i=new R(Na(t.content,(o,a)=>!o.isAtom||!a.type.allowsMarkType(this.mark.type)?o:o.mark(this.mark.addToSet(o.marks)),s),t.openStart,t.openEnd);return ge.fromReplace(e,this.from,this.to,i)}invert(){return new nt(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return t.deleted&&r.deleted||t.pos>=r.pos?null:new Lt(t.pos,r.pos,this.mark)}merge(e){return e instanceof Lt&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Lt(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(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new Lt(t.from,t.to,e.markFromJSON(t.mark))}}De.jsonID("addMark",Lt);class nt extends De{constructor(e,t,r){super(),this.from=e,this.to=t,this.mark=r}apply(e){let t=e.slice(this.from,this.to),r=new R(Na(t.content,s=>s.mark(this.mark.removeFromSet(s.marks)),e),t.openStart,t.openEnd);return ge.fromReplace(e,this.from,this.to,r)}invert(){return new Lt(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return t.deleted&&r.deleted||t.pos>=r.pos?null:new nt(t.pos,r.pos,this.mark)}merge(e){return e instanceof nt&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new nt(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(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new nt(t.from,t.to,e.markFromJSON(t.mark))}}De.jsonID("removeMark",nt);class Bt extends De{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return ge.fail("No node at mark step's position");let r=t.type.create(t.attrs,null,this.mark.addToSet(t.marks));return ge.fromReplace(e,this.pos,this.pos+1,new R(C.from(r),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);if(t){let r=this.mark.addToSet(t.marks);if(r.length==t.marks.length){for(let s=0;s<t.marks.length;s++)if(!t.marks[s].isInSet(r))return new Bt(this.pos,t.marks[s]);return new Bt(this.pos,this.mark)}}return new kn(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new Bt(t.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,t){if(typeof t.pos!="number")throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new Bt(t.pos,e.markFromJSON(t.mark))}}De.jsonID("addNodeMark",Bt);class kn extends De{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return ge.fail("No node at mark step's position");let r=t.type.create(t.attrs,null,this.mark.removeFromSet(t.marks));return ge.fromReplace(e,this.pos,this.pos+1,new R(C.from(r),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);return!t||!this.mark.isInSet(t.marks)?this:new Bt(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new kn(t.pos,this.mark)}
vendor: 4,283 bytes, line 127
127toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,t){if(typeof t.pos!="number")throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new kn(t.pos,e.markFromJSON(t.mark))}}De.jsonID("removeNodeMark",kn);class me extends De{constructor(e,t,r,s=!1){super(),this.from=e,this.to=t,this.slice=r,this.structure=s}apply(e){return this.structure&&Bo(e,this.from,this.to)?ge.fail("Structure replace would overwrite content"):ge.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new Ue([this.from,this.to-this.from,this.slice.size])}invert(e){return new me(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let t=e.mapResult(this.to,-1),r=this.from==this.to&&me.MAP_BIAS<0?t:e.mapResult(this.from,1);return r.deletedAcross&&t.deletedAcross?null:new me(r.pos,Math.max(r.pos,t.pos),this.slice,this.structure)}merge(e){if(!(e instanceof me)||e.structure||this.structure)return null;if(this.from+this.slice.size==e.from&&!this.slice.openEnd&&!e.slice.openStart){let t=this.slice.size+e.slice.size==0?R.empty:new R(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new me(this.from,this.to+(e.to-e.from),t,this.structure)}else if(e.to==this.from&&!this.slice.openStart&&!e.slice.openEnd){let t=this.slice.size+e.slice.size==0?R.empty:new R(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new me(e.from,this.to,t,this.structure)}else return null}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(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new me(t.from,t.to,R.fromJSON(e,t.slice),!!t.structure)}}me.MAP_BIAS=1;De.jsonID("replace",me);class xe extends De{constructor(e,t,r,s,i,o,a=!1){super(),this.from=e,this.to=t,this.gapFrom=r,this.gapTo=s,this.slice=i,this.insert=o,this.structure=a}apply(e){if(this.structure&&(Bo(e,this.from,this.gapFrom)||Bo(e,this.gapTo,this.to)))return ge.fail("Structure gap-replace would overwrite content");let t=e.slice(this.gapFrom,this.gapTo);if(t.openStart||t.openEnd)return ge.fail("Gap is not a flat range");let r=this.slice.insertAt(this.insert,t.content);return r?ge.fromReplace(e,this.from,this.to,r):ge.fail("Content does not fit in gap")}getMap(){return new Ue([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 xe(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),r=e.mapResult(this.to,-1),s=this.from==this.gapFrom?t.pos:e.map(this.gapFrom,-1),i=this.to==this.gapTo?r.pos:e.map(this.gapTo,1);return t.deletedAcross&&r.deletedAcross||s<t.pos||i>r.pos?null:new xe(t.pos,r.pos,s,i,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(typeof t.from!="number"||typeof t.to!="number"||typeof t.gapFrom!="number"||typeof t.gapTo!="number"||typeof t.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new xe(t.from,t.to,t.gapFrom,t.gapTo,R.fromJSON(e,t.slice),t.insert,!!t.structure)}}De.jsonID("replaceAround",xe);function Bo(n,e,t){let r=n.resolve(e),s=t-e,i=r.depth;for(;s>0&&i>0&&r.indexAfter(i)==r.node(i).childCount;)i--,s--;if(s>0){let o=r.node(i).maybeChild(r.indexAfter(i));for(;s>0;){if(!o||o.isLeaf)return!0;o=o.firstChild,s--}}return!1}function t0(n,e,t,r){let s=[],i=[],o,a;n.doc.nodesBetween(e,t,(l,c,u)=>{if(!l.isInline)return;let d=l.marks;if(!r.isInSet(d)&&u.type.allowsMarkType(r.type)){let f=Math.max(c,e),h=Math.min(c+l.nodeSize,t),m=r.addToSet(d);for(let y=0;y<d.length;y++)d[y].isInSet(m)||(o&&o.to==f&&o.mark.eq(d[y])?o.to=h:s.push(o=new nt(f,h,d[y])));a&&a.to==f?a.to=h:i.push(a=new Lt(f,h,r))}}
vendor: 7,284 bytes, lines 127-128
127),s.forEach(l=>n.step(l)),i.forEach(l=>n.step(l))}function n0(n,e,t,r){let s=[],i=0;n.doc.nodesBetween(e,t,(o,a)=>{if(!o.isInline)return;i++;let l=null;if(r instanceof bi){let c=o.marks,u;for(;u=r.isInSet(c);)(l||(l=[])).push(u),c=u.removeFromSet(c)}else r?r.isInSet(o.marks)&&(l=[r]):l=o.marks;if(l&&l.length){let c=Math.min(a+o.nodeSize,t);for(let u=0;u<l.length;u++){let d=l[u],f;for(let h=0;h<s.length;h++){let m=s[h];m.step==i-1&&d.eq(s[h].style)&&(f=m)}f?(f.to=c,f.step=i):s.push({style:d,from:Math.max(a,e),to:c,step:i})}}}),s.forEach(o=>n.step(new nt(o.from,o.to,o.style)))}function Ea(n,e,t,r=t.contentMatch,s=!0){let i=n.doc.nodeAt(e),o=[],a=e+1;for(let l=0;l<i.childCount;l++){let c=i.child(l),u=a+c.nodeSize,d=r.matchType(c.type);if(!d)o.push(new me(a,u,R.empty));else{r=d;for(let f=0;f<c.marks.length;f++)t.allowsMarkType(c.marks[f].type)||n.step(new nt(a,u,c.marks[f]));if(s&&c.isText&&t.whitespace!="pre"){let f,h=/\r?\n|\r/g,m;for(;f=h.exec(c.text);)m||(m=new R(C.from(t.schema.text(" ",t.allowedMarks(c.marks))),0,0)),o.push(new me(a+f.index,a+f.index+f[0].length,m))}}a=u}if(!r.validEnd){let l=r.fillBefore(C.empty,!0);n.replace(a,a,new R(l,0,0))}for(let l=o.length-1;l>=0;l--)n.step(o[l])}function r0(n,e,t){return(e==0||n.canReplace(e,n.childCount))&&(t==n.childCount||n.canReplace(0,t))}function Gn(n){let t=n.parent.content.cutByIndex(n.startIndex,n.endIndex);for(let r=n.depth,s=0,i=0;;--r){let o=n.$from.node(r),a=n.$from.index(r)+s,l=n.$to.indexAfter(r)-i;if(r<n.depth&&o.canReplace(a,l,t))return r;if(r==0||o.type.spec.isolating||!r0(o,a,l))break;a&&(s=1),l<o.childCount&&(i=1)}return null}function s0(n,e,t){let{$from:r,$to:s,depth:i}=e,o=r.before(i+1),a=s.after(i+1),l=o,c=a,u=C.empty,d=0;for(let m=i,y=!1;m>t;m--)y||r.index(m)>0?(y=!0,u=C.from(r.node(m).copy(u)),d++):l--;let f=C.empty,h=0;for(let m=i,y=!1;m>t;m--)y||s.after(m+1)<s.end(m)?(y=!0,f=C.from(s.node(m).copy(f)),h++):c++;n.step(new xe(l,c,o,a,new R(u.append(f),d,h),u.size-d,!0))}function Ta(n,e,t=null,r=n){let s=i0(n,e),i=s&&o0(r,e);return i?s.map(ec).concat({type:e,attrs:t}).concat(i.map(ec)):null}function ec(n){return{type:n,attrs:null}}function i0(n,e){let{parent:t,startIndex:r,endIndex:s}=n,i=t.contentMatchAt(r).findWrapping(e);if(!i)return null;let o=i.length?i[0]:e;return t.canReplaceWith(r,s,o)?i:null}function o0(n,e){let{parent:t,startIndex:r,endIndex:s}=n,i=t.child(r),o=e.contentMatch.findWrapping(i.type);if(!o)return null;let l=(o.length?o[o.length-1]:e).contentMatch;for(let c=r;l&&c<s;c++)l=l.matchType(t.child(c).type);return!l||!l.validEnd?null:o}function a0(n,e,t){let r=C.empty;for(let o=t.length-1;o>=0;o--){if(r.size){let a=t[o].type.contentMatch.matchFragment(r);if(!a||!a.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}r=C.from(t[o].type.create(t[o].attrs,r))}let s=e.start,i=e.end;n.step(new xe(s,i,s,i,new R(r,0,0),t.length,!0))}function l0(n,e,t,r,s){if(!r.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let i=n.steps.length;n.doc.nodesBetween(e,t,(o,a)=>{let l=typeof s=="function"?s(o):s;if(o.isTextblock&&!o.hasMarkup(r,l)&&c0(n.doc,n.mapping.slice(i).map(a),r)){let c=null;if(r.schema.linebreakReplacement){let h=r.whitespace=="pre",m=!!r.contentMatch.matchType(r.schema.linebreakReplacement);h&&!m?c=!1:!h&&m&&(c=!0)}c===!1&&Td(n,o,a,i),Ea(n,n.mapping.slice(i).map(a,1),r,void 0,c===null);let u=n.mapping.slice(i),d=u.map(a,1),f=u.map(a+o.nodeSize,1);return n.step(new xe(d,f,d+1,f-1,new R(C.from(r.create(l,null,o.marks)),0,0),1,!0)),c===!0&&Ed(n,o,a,i),!1}})}function Ed(n,e,t,r){e.forEach((s,i)=>{if(s.isText){let o,a=/\r?\n|\r/g;for(;o=a.exec(s.text);){let l=n.mapping.slice(r).map(t+1+i+o.index);n.replaceWith(l,l+1,e.type.schema.linebreakReplacement.create())}}})}function Td(n,e,t,r){e.forEach((s,i)=>{if(s.type==s.type.schema.linebreakReplacement){let o=n.mapping.slice(r).map(t+1+i);n.replaceWith(o,o+1,e.type.schema.text(` 128`))}})}function c0(n,e,t){let r=n.resolve(e),s=r.index();return r.parent.canReplaceWith(s,s+1,t)}function u0(n,e,t,r,s){let i=n.doc.nodeAt(e);if(!i)throw new RangeError("No node at given position");t||(t=i.type);let o=t.create(r,null,s||i.marks);if(i.isLeaf)return n.replaceWith(e,e+i.nodeSize,o);if(!t.validContent(i.content))throw new RangeError("Invalid content for node type "+t.name);n.step(new xe(e,e+i.nodeSize,e+1,e+i.nodeSize-1,new R(C.from(o),0,0),1,!0))}function Ln(n,e,t=1,r){let s=n.resolve(e),i=s.depth-t,o=r&&r[r.length-1]||s.parent;if(i<0||s.parent.type.spec.isolating||!s.parent.canReplace(s.index(),s.parent.childCount)||!o.type.validContent(s.parent.content.cutByIndex(s.index(),s.parent.childCount)))return!1;for(let c=s.depth-1,u=t-2;c>i;c--,u--){let d=s.node(c),f=s.index(c);if(d.type.spec.isolating)return!1;let h=d.content.cutByIndex(f,d.childCount),m=r&&r[u+1];m&&(h=h.replaceChild(0,m.type.create(m.attrs)));let y=r&&r[u]||d;if(!d.canReplace(f+1,d.childCount)||!y.type.validContent(h))return!1}let a=s.indexAfter(i),l=r&&r[0];return s.node(i).canReplaceWith(a,a,l?l.type:s.node(i+1).type)}function d0(n,e,t=1,r){let s=n.doc.resolve(e),i=C.empty,o=C.empty;for(let a=s.depth,l=s.depth-t,c=t-1;a>l;a--,c--){i=C.from(s.node(a).copy(i));let u=r&&r[c];o=C.from(u?u.type.create(u.attrs,o):s.node(a).copy(o))}n.step(new me(e,e,new R(i.append(o),t,t),!0))}function Jt(n,e){let t=n.resolve(e),r=t.index();return Ad(t.nodeBefore,t.nodeAfter)&&t.parent.canReplace(r,r+1)}function f0(n,e){e.content.size||n.type.compatibleContent(e.type);let t=n.contentMatchAt(n.childCount),{linebreakReplacement:r}=n.type.schema;for(let s=0;s<e.childCount;s++){let i=e.child(s),o=i.type==r?n.type.schema.nodes.text:i.type;if(t=t.matchType(o),!t||!n.type.allowsMarks(i.marks))return!1}return t.validEnd}function Ad(n,e){return!!(n&&e&&!n.isLeaf&&f0(n,e))}function vi(n,e,t=-1){let r=n.resolve(e);for(let s=r.depth;;s--){let i,o,a=r.index(s);if(s==r.depth?(i=r.nodeBefore,o=r.nodeAfter):t>0?(i=r.node(s+1),a++,o=r.node(s).maybeChild(a)):(i=r.node(s).maybeChild(a-1),o=r.node(s+1)),i&&!i.isTextblock&&Ad(i,o)&&r.node(s).canReplace(a,a+1))return e;if(s==0)break;e=t<0?r.before(s):r.after(s)}}function h0(n,e,t){let r=null,{linebreakReplacement:s}=n.doc.type.schema,i=n.doc.resolve(e-t),o=i.node().type;if(s&&o.inlineContent){let u=o.whitespace=="pre",d=!!o.contentMatch.matchType(s);u&&!d?r=!1:!u&&d&&(r=!0)}let a=n.steps.length;if(r===!1){let u=n.doc.resolve(e+t);Td(n,u.node(),u.before(),a)}o.inlineContent&&Ea(n,e+t-1,o,i.node().contentMatchAt(i.index()),r==null);let l=n.mapping.slice(a),c=l.map(e-t);if(n.step(new me(c,l.map(e+t,-1),R.empty,!0)),r===!0){let u=n.doc.resolve(c);Ed(n,u.node(),u.before(),n.steps.length)}return n}function p0(n,e,t){let r=n.resolve(e);if(r.parent.canReplaceWith(r.index(),r.index(),t))return e;if(r.parentOffset==0)for(let s=r.depth-1;s>=0;s--){let i=r.index(s);if(r.node(s).canReplaceWith(i,i,t))return r.before(s+1);if(i>0)return null}if(r.parentOffset==r.parent.content.size)for(let s=r.depth-1;s>=0;s--){let i=r.indexAfter(s);if(r.node(s).canReplaceWith(i,i,t))return r.after(s+1);if(i<r.node(s).childCount)return null}return null}function Od(n,e,t){let r=n.resolve(e);if(!t.content.size)return e;let s=t.content;for(let i=0;i<t.openStart;i++)s=s.firstChild.content;for(let i=1;
vendor: 5,514 bytes, line 128
128i<=(t.openStart==0&&t.size?2:1);i++)for(let o=r.depth;o>=0;o--){let a=o==r.depth?0:r.pos<=(r.start(o+1)+r.end(o+1))/2?-1:1,l=r.index(o)+(a>0?1:0),c=r.node(o),u=!1;if(i==1)u=c.canReplace(l,l,s);else{let d=c.contentMatchAt(l).findWrapping(s.firstChild.type);u=d&&c.canReplaceWith(l,l,d[0])}if(u)return a==0?r.pos:a<0?r.before(o+1):r.after(o+1)}return null}function xi(n,e,t=e,r=R.empty){if(e==t&&!r.size)return null;let s=n.resolve(e),i=n.resolve(t);return Dd(s,i,r)?new me(e,t,r):new m0(s,i,r).fit()}function Dd(n,e,t){return!t.openStart&&!t.openEnd&&n.start()==e.start()&&n.parent.canReplace(n.index(),e.index(),t.content)}class m0{constructor(e,t,r){this.$from=e,this.$to=t,this.unplaced=r,this.frontier=[],this.placed=C.empty;for(let s=0;s<=e.depth;s++){let i=e.node(s);this.frontier.push({type:i.type,match:i.contentMatchAt(e.indexAfter(s))})}for(let s=e.depth;s>0;s--)this.placed=C.from(e.node(s).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let c=this.findFittable();c?this.placeNodes(c):this.openMore()||this.dropNode()}let e=this.mustMoveInline(),t=this.placed.size-this.depth-this.$from.depth,r=this.$from,s=this.close(e<0?this.$to:r.doc.resolve(e));if(!s)return null;let i=this.placed,o=r.depth,a=s.depth;for(;o&&a&&i.childCount==1;)i=i.firstChild.content,o--,a--;let l=new R(i,o,a);return e>-1?new xe(r.pos,e,this.$to.pos,this.$to.end(),l,t):l.size||r.pos!=this.$to.pos?new me(r.pos,s.pos,l):null}findFittable(){let e=this.unplaced.openStart;for(let t=this.unplaced.content,r=0,s=this.unplaced.openEnd;r<e;r++){let i=t.firstChild;if(t.childCount>1&&(s=0),i.type.spec.isolating&&s<=r){e=r;break}t=i.content}for(let t=1;t<=2;t++)for(let r=t==1?e:this.unplaced.openStart;r>=0;r--){let s,i=null;r?(i=to(this.unplaced.content,r-1).firstChild,s=i.content):s=this.unplaced.content;let o=s.firstChild;for(let a=this.depth;a>=0;a--){let{type:l,match:c}=this.frontier[a],u,d=null;if(t==1&&(o?c.matchType(o.type)||(d=c.fillBefore(C.from(o),!1)):i&&l.compatibleContent(i.type)))return{sliceDepth:r,frontierDepth:a,parent:i,inject:d};if(t==2&&o&&(u=c.findWrapping(o.type)))return{sliceDepth:r,frontierDepth:a,parent:i,wrap:u};if(i&&c.matchType(i.type))break}}}openMore(){let{content:e,openStart:t,openEnd:r}=this.unplaced,s=to(e,t);return!s.childCount||s.firstChild.isLeaf?!1:(this.unplaced=new R(e,t+1,Math.max(r,s.size+t>=e.size-r?t+1:0)),!0)}dropNode(){let{content:e,openStart:t,openEnd:r}=this.unplaced,s=to(e,t);if(s.childCount<=1&&t>0){let i=e.size-t<=t+s.size;this.unplaced=new R(lr(e,t-1,1),t-1,i?t-1:r)}else this.unplaced=new R(lr(e,t,1),t,r)}placeNodes({sliceDepth:e,frontierDepth:t,parent:r,inject:s,wrap:i}){for(;this.depth>t;)this.closeFrontierNode();if(i)for(let y=0;y<i.length;y++)this.openFrontierNode(i[y]);let o=this.unplaced,a=r?r.content:o.content,l=o.openStart-e,c=0,u=[],{match:d,type:f}=this.frontier[t];if(s){for(let y=0;y<s.childCount;y++)u.push(s.child(y));d=d.matchFragment(s)}let h=a.size+e-(o.content.size-o.openEnd);for(;c<a.childCount;){let y=a.child(c),g=d.matchType(y.type);if(!g)break;c++,(c>1||l==0||y.content.size)&&(d=g,u.push(Rd(y.mark(f.allowedMarks(y.marks)),c==1?l:0,c==a.childCount?h:-1)))}let m=c==a.childCount;m||(h=-1),this.placed=cr(this.placed,t,C.from(u)),this.frontier[t].match=d,m&&h<0&&r&&r.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let y=0,g=a;y<h;y++){let v=g.lastChild;this.frontier.push({type:v.type,match:v.contentMatchAt(v.childCount)}),g=v.content}this.unplaced=m?e==0?R.empty:new R(lr(o.content,e-1,1),e-1,h<0?o.openEnd:e-1):new R(lr(o.content,e,c),o.openStart,o.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let e=this.frontier[this.depth],t;if(!e.type.isTextblock||!no(this.$to,this.$to.depth,e.type,e.match,!1)||this.$to.depth==this.depth&&(t=this.findCloseLevel(this.$to))&&t.depth==this.depth)return-1;let{depth:r}=this.$to,s=this.$to.after(r);for(;r>1&&s==this.$to.end(--r);)++s;return s}findCloseLevel(e){e:for(let t=Math.min(this.depth,e.depth);t>=0;t--){let{match:r,type:s}=this.frontier[t],i=t<e.depth&&e.end(t+1)==e.pos+(e.depth-(t+1)),o=no(e,t,s,r,i);if(o){for(let a=t-1;a>=0;a--){let{match:l,type:c}=this.frontier[a],u=no(e,a,c,l,!0);if(!u||u.childCount)continue e}return{depth:t,fit:o,move:i?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=cr(this.placed,t.depth,t.fit)),e=t.move;for(let r=t.depth+1;r<=e.depth;r++){let s=e.node(r),i=s.type.contentMatch.fillBefore(s.content,!0,e.index(r));this.openFrontierNode(s.type,s.attrs,i)}return e}openFrontierNode(e,t=null,r){let s=this.frontier[this.depth];s.match=s.match.matchType(e),this.placed=cr(this.placed,this.depth,C.from(e.create(t,r))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let t=this.frontier.pop().match.fillBefore(C.empty,!0);t.childCount&&(this.placed=cr(this.placed,this.frontier.length,t))}}function lr(n,e,t){return e==0?n.cutByIndex(t,n.childCount):n.replaceChild(0,n.firstChild.copy(lr(n.firstChild.content,e-1,t)))}function cr(n,e,t){return e==0?n.append(t):n.replaceChild(n.childCount-1,n.lastChild.copy(cr(n.lastChild.content,e-1,t)))}function to(n,e){for(let t=0;t<e;t++)n=n.firstChild.content;return n}function Rd(n,e,t){if(e<=0)return n;let r=n.content;return e>1&&(r=r.replaceChild(0,Rd(r.firstChild,e-1,r.childCount==1?t-1:0))),e>0&&(r=n.type.contentMatch.fillBefore(r).append(r),t<=0&&(r=r.append(n.t
vendor: 15,597 bytes, line 128
128ype.contentMatch.matchFragment(r).fillBefore(C.empty,!0)))),n.copy(r)}function no(n,e,t,r,s){let i=n.node(e),o=s?n.indexAfter(e):n.index(e);if(o==i.childCount&&!t.compatibleContent(i.type))return null;let a=r.fillBefore(i.content,!0,o);return a&&!g0(t,i.content,o)?a:null}function g0(n,e,t){for(let r=t;r<e.childCount;r++)if(!n.allowsMarks(e.child(r).marks))return!0;return!1}function y0(n){return n.spec.defining||n.spec.definingForContent}function b0(n,e,t,r){if(!r.size)return n.deleteRange(e,t);let s=n.doc.resolve(e),i=n.doc.resolve(t);if(Dd(s,i,r))return n.step(new me(e,t,r));let o=Id(s,i);o[o.length-1]==0&&o.pop();let a=-(s.depth+1);o.unshift(a);for(let f=s.depth,h=s.pos-1;f>0;f--,h--){let m=s.node(f).type.spec;if(m.defining||m.definingAsContext||m.isolating)break;o.indexOf(f)>-1?a=f:s.before(f)==h&&o.splice(1,0,-f)}let l=o.indexOf(a),c=[],u=r.openStart;for(let f=r.content,h=0;;h++){let m=f.firstChild;if(c.push(m),h==r.openStart)break;f=m.content}for(let f=u-1;f>=0;f--){let h=c[f],m=y0(h.type);if(m&&!h.sameMarkup(s.node(Math.abs(a)-1)))u=f;else if(m||!h.type.isTextblock)break}for(let f=r.openStart;f>=0;f--){let h=(f+u+1)%(r.openStart+1),m=c[h];if(m)for(let y=0;y<o.length;y++){let g=o[(y+l)%o.length],v=!0;g<0&&(v=!1,g=-g);let x=s.node(g-1),N=s.index(g-1);if(x.canReplaceWith(N,N,m.type,m.marks))return n.replace(s.before(g),v?i.after(g):t,new R(_d(r.content,0,r.openStart,h),h,r.openEnd))}}let d=n.steps.length;for(let f=o.length-1;f>=0&&(n.replace(e,t,r),!(n.steps.length>d));f--){let h=o[f];h<0||(e=s.before(h),t=i.after(h))}}function _d(n,e,t,r,s){if(e<t){let i=n.firstChild;n=n.replaceChild(0,i.copy(_d(i.content,e+1,t,r,i)))}if(e>r){let i=s.contentMatchAt(0),o=i.fillBefore(n).append(n);n=o.append(i.matchFragment(o).fillBefore(C.empty,!0))}return n}function v0(n,e,t,r){if(!r.isInline&&e==t&&n.doc.resolve(e).parent.content.size){let s=p0(n.doc,e,r.type);s!=null&&(e=t=s)}n.replaceRange(e,t,new R(C.from(r),0,0))}function x0(n,e,t){let r=n.doc.resolve(e),s=n.doc.resolve(t);if(r.parent.isTextblock&&s.parent.isTextblock&&r.start()!=s.start()&&r.parentOffset==0&&s.parentOffset==0){let o=r.sharedDepth(t),a=!1;for(let l=r.depth;l>o;l--)r.node(l).type.spec.isolating&&(a=!0);for(let l=s.depth;l>o;l--)s.node(l).type.spec.isolating&&(a=!0);if(!a){for(let l=r.depth;l>0&&e==r.start(l);l--)e=r.before(l);for(let l=s.depth;l>0&&t==s.start(l);l--)t=s.before(l);r=n.doc.resolve(e),s=n.doc.resolve(t)}}let i=Id(r,s);for(let o=0;o<i.length;o++){let a=i[o],l=o==i.length-1;if(l&&a==0||r.node(a).type.contentMatch.validEnd)return n.delete(r.start(a),s.end(a));if(a>0&&(l||r.node(a-1).canReplace(r.index(a-1),s.indexAfter(a-1))))return n.delete(r.before(a),s.after(a))}for(let o=1;o<=r.depth&&o<=s.depth;o++)if(e-r.start(o)==r.depth-o&&t>r.end(o)&&s.end(o)-t!=s.depth-o&&r.start(o-1)==s.start(o-1)&&r.node(o-1).canReplace(r.index(o-1),s.index(o-1)))return n.delete(r.before(o),t);n.delete(e,t)}function Id(n,e){let t=[],r=Math.min(n.depth,e.depth);for(let s=r;s>=0;s--){let i=n.start(s);if(i<n.pos-(n.depth-s)||e.end(s)>e.pos+(e.depth-s)||n.node(s).type.spec.isolating||e.node(s).type.spec.isolating)break;(i==e.start(s)||s==n.depth&&s==e.depth&&n.parent.inlineContent&&e.parent.inlineContent&&s&&e.start(s-1)==i-1)&&t.push(s)}return t}class Bn extends De{constructor(e,t,r){super(),this.pos=e,this.attr=t,this.value=r}apply(e){let t=e.nodeAt(this.pos);if(!t)return ge.fail("No node at attribute step's position");let r=Object.create(null);for(let i in t.attrs)r[i]=t.attrs[i];r[this.attr]=this.value;let s=t.type.create(r,null,t.marks);return ge.fromReplace(e,this.pos,this.pos+1,new R(C.from(s),0,t.isLeaf?0:1))}getMap(){return Ue.empty}invert(e){return new Bn(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 Bn(t.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(e,t){if(typeof t.pos!="number"||typeof t.attr!="string")throw new RangeError("Invalid input for AttrStep.fromJSON");return new Bn(t.pos,t.attr,t.value)}}De.jsonID("attr",Bn);class Ar extends De{constructor(e,t){super(),this.attr=e,this.value=t}apply(e){let t=Object.create(null);for(let s in e.attrs)t[s]=e.attrs[s];t[this.attr]=this.value;let r=e.type.create(t,e.content,e.marks);return ge.ok(r)}getMap(){return Ue.empty}invert(e){return new Ar(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(typeof t.attr!="string")throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new Ar(t.attr,t.value)}}De.jsonID("docAttr",Ar);let Vn=class extends Error{};Vn=function n(e){let t=Error.call(this,e);return t.__proto__=n.prototype,t};Vn.prototype=Object.create(Error.prototype);Vn.prototype.constructor=Vn;Vn.prototype.name="TransformError";class Pd{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new Tr}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let t=this.maybeStep(e);if(t.failed)throw new Vn(t.failed);return this}maybeStep(e){let t=e.apply(this.doc);return t.failed||this.addStep(e,t.doc),t}get docChanged(){return this.steps.length>0}changedRange(){let e=1e9,t=-1e9;for(let r=0;r<this.mapping.maps.length;r++){let s=this.mapping.maps[r];r&&(e=s.map(e,1),t=s.map(t,-1)),s.forEach((i,o,a,l)=>{e=Math.min(e,a),t=Math.max(t,l)})}return e==1e9?null:{from:e,to:t}}addStep(e,t){this.docs.push(this.doc),this.steps.push(e),this.mapping.appendMap(e.getMap()),this.doc=t}replace(e,t=e,r=R.empty){let s=xi(this.doc,e,t,r);return s&&this.step(s),this}replaceWith(e,t,r){return this.replace(e,t,new R(C.from(r),0,0))}delete(e,t){return this.replace(e,t,R.empty)}insert(e,t){return this.replaceWith(e,e,t)}replaceRange(e,t,r){return b0(this,e,t,r),this}replaceRangeWith(e,t,r){return v0(this,e,t,r),this}deleteRange(e,t){return x0(this,e,t),this}lift(e,t){return s0(this,e,t),this}join(e,t=1){return h0(this,e,t),this}wrap(e,t){return a0(this,e,t),this}setBlockType(e,t=e,r,s=null){return l0(this,e,t,r,s),this}setNodeMarkup(e,t,r=null,s){return u0(this,e,t,r,s),this}setNodeAttribute(e,t,r){return this.step(new Bn(e,t,r)),this}setDocAttribute(e,t){return this.step(new Ar(e,t)),this}addNodeMark(e,t){return this.step(new Bt(e,t)),this}removeNodeMark(e,t){let r=this.doc.nodeAt(e);if(!r)throw new RangeError("No node at position "+e);if(t instanceof G)t.isInSet(r.marks)&&this.step(new kn(e,t));else{let s=r.marks,i,o=[];for(;i=t.isInSet(s);)o.push(new kn(e,i)),s=i.removeFromSet(s);for(let a=o.length-1;a>=0;a--)this.step(o[a])}return this}split(e,t=1,r){return d0(this,e,t,r),this}addMark(e,t,r){return t0(this,e,t,r),this}removeMark(e,t,r){return n0(this,e,t,r),this}clearIncompatible(e,t,r){return Ea(this,e,t,r),this}}const ro=Object.create(null);class W{constructor(e,t,r){this.$anchor=e,this.$head=t,this.ranges=r||[new k0(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=R.empty){let r=t.content.lastChild,s=null;for(let a=0;a<t.openEnd;a++)s=r,r=r.lastChild;let i=e.steps.length,o=this.ranges;for(let a=0;a<o.length;a++){let{$from:l,$to:c}=o[a],u=e.mapping.slice(i);e.replaceRange(u.map(l.pos),u.map(c.pos),a?R.empty:t),a==0&&rc(e,i,(r?r.isInline:s&&s.isTextblock)?-1:1)}}replaceWith(e,t){let r=e.steps.length,s=this.ranges;for(let i=0;i<s.length;i++){let{$from:o,$to:a}=s[i],l=e.mapping.slice(r),c=l.map(o.pos),u=l.map(a.pos);i?e.deleteRange(c,u):(e.replaceRangeWith(c,u,t),rc(e,r,t.isInline?-1:1))}}static findFrom(e,t,r=!1){let s=e.parent.inlineContent?new $(e):_n(e.node(0),e.parent,e.pos,e.index(),t,r);if(s)return s;for(let i=e.depth-1;i>=0;i--){let o=t<0?_n(e.node(0),e.node(i),e.before(i+1),e.index(i),t,r):_n(e.node(0),e.node(i),e.after(i+1),e.index(i)+1,t,r);if(o)return o}return null}static near(e,t=1){return this.findFrom(e,t)||this.findFrom(e,-t)||new Xe(e.node(0))}static atStart(e){return _n(e,e,0,0,1)||new Xe(e)}static atEnd(e){return _n(e,e,e.content.size,e.childCount,-1)||new Xe(e)}static fromJSON(e,t){if(!t||!t.type)throw new RangeError("Invalid input for Selection.fromJSON");let r=ro[t.type];if(!r)throw new RangeError(`No selection type ${t.type} defined`);return r.fromJSON(e,t)}static jsonID(e,t){if(e in ro)throw new RangeError("Duplicate use of selection JSON ID "+e);return ro[e]=t,t.prototype.jsonID=e,t}getBookmark(){return $.between(this.$anchor,this.$head).getBookmark()}}W.prototype.visible=!0;class k0{constructor(e,t){this.$from=e,this.$to=t}}let tc=!1;function nc(n){!tc&&!n.parent.inlineContent&&(tc=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+n.parent.type.name+")"))}class $ extends W{constructor(e,t=e){nc(e),nc(t),super(e,t)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(e,t){let r=e.resolve(t.map(this.head));if(!r.parent.inlineContent)return W.near(r);let s=e.resolve(t.map(this.anchor));return new $(s.parent.inlineContent?s:r,r)}replace(e,t=R.empty){if(super.replace(e,t),t==R.empty){let r=this.$from.marksAcross(this.$to);r&&e.ensureMarks(r)}}eq(e){return e instanceof $&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new ki(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(e,t){if(typeof t.anchor!="number"||typeof t.head!="number")throw new RangeError("Invalid input for TextSelection.fromJSON");return new $(e.resolve(t.anchor),e.resolve(t.head))}static create(e,t,r=t){let s=e.resolve(t);return new this(s,r==t?s:e.resolve(r))}static between(e,t,r){let s=e.pos-t.pos;if((!r||s)&&(r=s>=0?1:-1),!t.parent.inlineContent){let i=W.findFrom(t,r,!0)||W.findFrom(t,-r,!0);if(i)t=i.$head;else return W.near(t,r)}return e.parent.inlineContent||(s==0?e=t:(e=(W.findFrom(e,-r,!0)||W.findFrom(e,r,!0)).$anchor,e.pos<t.pos!=s<0&&(e=t))),new $(e,t)}}W.jsonID("text",$);class ki{constructor(e,t){this.anchor=e,this.head=t}map(e){return new ki(e.map(this.anchor),e.map(this.head))}resolve(e){return $.between(e.resolve(this.anchor),e.resolve(this.head))}}class L extends W{constructor(e){let t=e.nodeAfter,r=e.node(0).resolve(e.pos+t.nodeSize);super(e,r),this.node=t}map(e,t){let{deleted:r,pos:s}=t.mapResult(this.anchor),i=e.resolve(s);return r?W.near(i):new L(i)}content(){return new R(C.from(this.node),0,0)}eq(e){return e instanceof L&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new Aa(this.anchor)}static fromJSON(e,t){if(typeof t.anchor!="number")throw new RangeError("Invalid input for NodeSelection.fromJSON");return new L(e.resolve(t.anchor))}static create(e,t){return new L(e.resolve(t))}static isSelectable(e){return!e.isText&&e.type.spec.selectable!==!1}}L.prototype.visible=!1;W.jsonID("node",L);class Aa{constructor(e){this.anchor=e}map(e){let{deleted:t,pos:r}=e.mapResult(this.anchor);return t?new ki(r,r):new Aa(r)}resolve(e){let t=e.resolve(this.anchor),r=t.nodeAfter;return r&&L.isSelectable(r)?new L(t):W.near(t)}}class Xe extends W{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,t=R.empty){if(t==R.empty){e.delete(0,e.doc.content.size);let r=W.atStart(e.doc);r.eq(e.selection)||e.setSelection(r)}else super.replace(e,t)}toJSON(){return{type:"all"}}static fromJSON(e){return new Xe(e)}map(e){return new Xe(e)}eq(e){return e instanceof Xe}getBookmark(){return w0}}W.jsonID("all",Xe);const w0={map(){return this},resolve(n){return new Xe(n)}};function _n(n,e,t,r,s,i=!1){if(e.inlineContent)return $.create(n,t);for(let o=r-(s>0?0:1);s>0?o<e.childCount:o>=0;o+=s){let a=e.child(o);if(a.isAtom){if(!i&&L.isSelectable(a))return L.create(n,t-(s<0?a.nodeSize:0))}else{let l=_n(n,a,t+s,s<0?a.childCount:0,s,i);if(l)return l}t+=a.nodeSize*s}return null}function rc(n,e,t){let r=n.steps.length-1;if(r<e)return;let s=n.steps[r];if(!(s instanceof me||s instanceof xe))return;let i=n.mapping.maps[r],o;i.forEach((a,l,c,u)=>{o==null&&(o=u)}),n.setSelection(W.near(n.doc.resolve(o),t))}const sc=1,ts=2,ic=4;class S0 extends Pd{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=(this.updated|sc)&~ts,this.storedMarks=null,this}get selectionSet(){return(this.updated&sc)>0}setStoredMarks(e){return this.storedMarks=e,this.updated|=ts,this}ensureMarks(e){return G.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(this.updated&ts)>0}addStep(e,t){super.addStep(e,t),this.updated=this.updated&~ts,this.storedMarks=null}setTime(e){return this.time=e,this}replaceSelection(e){return this.selection.replace(this,e),this}replaceSelectionWith(e,t=!0){let r=this.selection;return t&&(e=e.mark(this.storedMarks||(r.empty?r.$from.marks():r.$from.marksAcross(r.$to)||G.none))),r.replaceWith(this,e),this}deleteSelection(){return this.selection.replace(this),this}insertText(e,t,r){let s=this.doc.type.schema;if(t==null)return e?this.replaceSelectionWith(s.text(e),!0):this.deleteSelection();{if(r==null&&(r=t),!e)return this.deleteRange(t,r);let i=this.storedMarks;if(!i){let o=this.doc.resolve(t);i=r==t?o.marks():o.marksAcross(this.doc.resolve(r))}return this.replaceRangeWith(t,r,s.text(e,i)),!this.selection.empty&&this.selection.to==t+e.length&&this.setSelection(W.near(this.selection.$to)),this}}setMeta(e,t){return this.meta[typeof e=="string"?e:e.key]=t,this}getMeta(e){return this.meta[typeof e=="string"?e:e.key]}get isGeneric(){for(let e in this.meta)return!1;return!0}scrollIntoView(){return this.updated|=ic,this}get scrolledIntoView(){return(this.updated&ic)>0}}function oc(n,e){return!e||!n?n:n.bind(e)}class ur{constructor(e,t,r){this.name=e,this.init=oc(t.init,r),this.apply=oc(t.apply,r)}}const C0=[new ur("doc",{init(n){return n.doc||n.schema.topNodeType.createAndFill()},apply(n){return n.doc}}),new ur("selection",{init(n,e){return n.selection||W.atStart(e.doc)},apply(n){return n.selection}}),new ur("storedMarks",{init(n){return n.storedMarks||null},apply(n,e,t,r){return r.selection.$cursor?n.storedMarks:null}}),new ur("scrollToSelection",{init(){return 0},apply(n,e){return n.scrolledIntoView?e+1:e}})];class so{constructor(e,t){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=C0.slice(),t&&t.forEach(r=>{if(this.pluginsByKey[r.key])throw new RangeError("Adding different instances of a keyed plugin ("+r.key+")");this.plugins.push(r),this.pluginsByKey[r.key]=r,r.spec.state&&this.fields.push(new ur(r.key,r.spec.state,r))})}}class jn{constructor(e){this.config=e}get schema(){return this.config.schema}get plugins(){return this.config.plugins}
vendor: 14,072 bytes, lines 128-129
128apply(e){return this.applyTransaction(e).state}filterTransaction(e,t=-1){for(let r=0;r<this.config.plugins.length;r++)if(r!=t){let s=this.config.plugins[r];if(s.spec.filterTransaction&&!s.spec.filterTransaction.call(s,e,this))return!1}return!0}applyTransaction(e){if(!this.filterTransaction(e))return{state:this,transactions:[]};let t=[e],r=this.applyInner(e),s=null;for(;;){let i=!1;for(let o=0;o<this.config.plugins.length;o++){let a=this.config.plugins[o];if(a.spec.appendTransaction){let l=s?s[o].n:0,c=s?s[o].state:this,u=l<t.length&&a.spec.appendTransaction.call(a,l?t.slice(l):t,c,r);if(u&&r.filterTransaction(u,o)){if(u.setMeta("appendedTransaction",e),!s){s=[];for(let d=0;d<this.config.plugins.length;d++)s.push(d<o?{state:r,n:t.length}:{state:this,n:0})}t.push(u),r=r.applyInner(u),i=!0}s&&(s[o]={state:r,n:t.length})}}if(!i)return{state:r,transactions:t}}}applyInner(e){if(!e.before.eq(this.doc))throw new RangeError("Applying a mismatched transaction");let t=new jn(this.config),r=this.config.fields;for(let s=0;s<r.length;s++){let i=r[s];t[i.name]=i.apply(e,this[i.name],this,t)}return t}get tr(){return new S0(this)}static create(e){let t=new so(e.doc?e.doc.type.schema:e.schema,e.plugins),r=new jn(t);for(let s=0;s<t.fields.length;s++)r[t.fields[s].name]=t.fields[s].init(e,r);return r}reconfigure(e){let t=new so(this.schema,e.plugins),r=t.fields,s=new jn(t);for(let i=0;i<r.length;i++){let o=r[i].name;s[o]=this.hasOwnProperty(o)?this[o]:r[i].init(e,s)}return s}toJSON(e){let t={doc:this.doc.toJSON(),selection:this.selection.toJSON()};if(this.storedMarks&&(t.storedMarks=this.storedMarks.map(r=>r.toJSON())),e&&typeof e=="object")for(let r in e){if(r=="doc"||r=="selection")throw new RangeError("The JSON fields `doc` and `selection` are reserved");let s=e[r],i=s.spec.state;i&&i.toJSON&&(t[r]=i.toJSON.call(s,this[s.key]))}return t}static fromJSON(e,t,r){if(!t)throw new RangeError("Invalid input for EditorState.fromJSON");if(!e.schema)throw new RangeError("Required config field 'schema' missing");let s=new so(e.schema,e.plugins),i=new jn(s);return s.fields.forEach(o=>{if(o.name=="doc")i.doc=rt.fromJSON(e.schema,t.doc);else if(o.name=="selection")i.selection=W.fromJSON(i.doc,t.selection);else if(o.name=="storedMarks")t.storedMarks&&(i.storedMarks=t.storedMarks.map(e.schema.markFromJSON));else{if(r)for(let a in r){let l=r[a],c=l.spec.state;if(l.key==o.name&&c&&c.fromJSON&&Object.prototype.hasOwnProperty.call(t,a)){i[o.name]=c.fromJSON.call(l,e,t[a],i);return}}i[o.name]=o.init(e,i)}}),i}}function jd(n,e,t){for(let r in n){let s=n[r];s instanceof Function?s=s.bind(e):r=="handleDOMEvents"&&(s=jd(s,e,{})),t[r]=s}return t}class ae{constructor(e){this.spec=e,this.props={},e.props&&jd(e.props,this,this.props),this.key=e.key?e.key.key:Ld("plugin")}getState(e){return e[this.key]}}const io=Object.create(null);function Ld(n){return n in io?n+"$"+ ++io[n]:(io[n]=0,n+"$")}class ve{constructor(e="key"){this.key=Ld(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}const M0=(n,e)=>n.selection.empty?!1:(e&&e(n.tr.deleteSelection().scrollIntoView()),!0);function Bd(n,e){let{$cursor:t}=n.selection;return!t||(e?!e.endOfTextblock("backward",n):t.parentOffset>0)?null:t}const N0=(n,e,t)=>{let r=Bd(n,t);if(!r)return!1;let s=Oa(r);if(!s){let o=r.blockRange(),a=o&&Gn(o);return a==null?!1:(e&&e(n.tr.lift(o,a).scrollIntoView()),!0)}let i=s.nodeBefore;if(Hd(n,s,e,-1))return!0;if(r.parent.content.size==0&&(Wn(i,"end")||L.isSelectable(i)))for(let o=r.depth;;o--){let a=xi(n.doc,r.before(o),r.after(o),R.empty);if(a&&a.slice.size<a.to-a.from){if(e){let l=n.tr.step(a);l.setSelection(Wn(i,"end")?W.findFrom(l.doc.resolve(l.mapping.map(s.pos,-1)),-1):L.create(l.doc,s.pos-i.nodeSize)),e(l.scrollIntoView())}return!0}if(o==1||r.node(o-1).childCount>1)break}return i.isAtom&&s.depth==r.depth-1?(e&&e(n.tr.delete(s.pos-i.nodeSize,s.pos).scrollIntoView()),!0):!1},E0=(n,e,t)=>{let r=Bd(n,t);if(!r)return!1;let s=Oa(r);return s?zd(n,s,e):!1},T0=(n,e,t)=>{let r=Fd(n,t);if(!r)return!1;let s=Da(r);return s?zd(n,s,e):!1};function zd(n,e,t){let r=e.nodeBefore,s=r,i=e.pos-1;for(;!s.isTextblock;i--){if(s.type.spec.isolating)return!1;let u=s.lastChild;if(!u)return!1;s=u}let o=e.nodeAfter,a=o,l=e.pos+1;for(;!a.isTextblock;l++){if(a.type.spec.isolating)return!1;let u=a.firstChild;if(!u)return!1;a=u}let c=xi(n.doc,i,l,R.empty);if(!c||c.from!=i||c instanceof me&&c.slice.size>=l-i)return!1;if(t){let u=n.tr.step(c);u.setSelection($.create(u.doc,i)),t(u.scrollIntoView())}return!0}function Wn(n,e,t=!1){for(let r=n;r;r=e=="start"?r.firstChild:r.lastChild){if(r.isTextblock)return!0;if(t&&r.childCount!=1)return!1}return!1}const A0=(n,e,t)=>{let{$head:r,empty:s}=n.selection,i=r;if(!s)return!1;if(r.parent.isTextblock){if(t?!t.endOfTextblock("backward",n):r.parentOffset>0)return!1;i=Oa(r)}let o=i&&i.nodeBefore;return!o||!L.isSelectable(o)?!1:(e&&e(n.tr.setSelection(L.create(n.doc,i.pos-o.nodeSize)).scrollIntoView()),!0)};function Oa(n){if(!n.parent.type.spec.isolating)for(let e=n.depth-1;e>=0;e--){if(n.index(e)>0)return n.doc.resolve(n.before(e+1));if(n.node(e).type.spec.isolating)break}return null}function Fd(n,e){let{$cursor:t}=n.selection;return!t||(e?!e.endOfTextblock("forward",n):t.parentOffset<t.parent.content.size)?null:t}const O0=(n,e,t)=>{let r=Fd(n,t);if(!r)return!1;let s=Da(r);if(!s)return!1;let i=s.nodeAfter;if(Hd(n,s,e,1))return!0;if(r.parent.content.size==0&&(Wn(i,"start")||L.isSelectable(i))){let o=xi(n.doc,r.before(),r.after(),R.empty);if(o&&o.slice.size<o.to-o.from){if(e){let a=n.tr.step(o);a.setSelection(Wn(i,"start")?W.findFrom(a.doc.resolve(a.mapping.map(s.pos)),1):L.create(a.doc,a.mapping.map(s.pos))),e(a.scrollIntoView())}return!0}}return i.isAtom&&s.depth==r.depth-1?(e&&e(n.tr.delete(s.pos,s.pos+i.nodeSize).scrollIntoView()),!0):!1},D0=(n,e,t)=>{let{$head:r,empty:s}=n.selection,i=r;if(!s)return!1;if(r.parent.isTextblock){if(t?!t.endOfTextblock("forward",n):r.parentOffset<r.parent.content.size)return!1;i=Da(r)}let o=i&&i.nodeAfter;return!o||!L.isSelectable(o)?!1:(e&&e(n.tr.setSelection(L.create(n.doc,i.pos)).scrollIntoView()),!0)};function Da(n){if(!n.parent.type.spec.isolating)for(let e=n.depth-1;e>=0;e--){let t=n.node(e);if(n.index(e)+1<t.childCount)return n.doc.resolve(n.after(e+1));if(t.type.spec.isolating)break}return null}const R0=(n,e)=>{let t=n.selection,r=t instanceof L,s;if(r){if(t.node.isTextblock||!Jt(n.doc,t.from))return!1;s=t.from}else if(s=vi(n.doc,t.from,-1),s==null)return!1;if(e){let i=n.tr.join(s);r&&i.setSelection(L.create(i.doc,s-n.doc.resolve(s).nodeBefore.nodeSize)),e(i.scrollIntoView())}return!0},_0=(n,e)=>{let t=n.selection,r;if(t instanceof L){if(t.node.isTextblock||!Jt(n.doc,t.to))return!1;r=t.to}else if(r=vi(n.doc,t.to,1),r==null)return!1;return e&&e(n.tr.join(r).scrollIntoView()),!0},I0=(n,e)=>{let{$from:t,$to:r}=n.selection,s=t.blockRange(r),i=s&&Gn(s);return i==null?!1:(e&&e(n.tr.lift(s,i).scrollIntoView()),!0)},P0=(n,e)=>{let{$head:t,$anchor:r}=n.selection;return!t.parent.type.spec.code||!t.sameParent(r)?!1:(e&&e(n.tr.insertText(` 129`).scrollIntoView()),!0)};function $d(n){for(let e=0;e<n.edgeCount;e++){let{type:t}=n.edge(e);if(t.isTextblock&&!t.hasRequiredAttrs())return t}return null}const j0=(n,e)=>{let{$head:t,$anchor:r}=n.selection;if(!t.parent.type.spec.code||!t.sameParent(r))return!1;let s=t.node(-1),i=t.indexAfter(-1),o=$d(s.contentMatchAt(i));if(!o||!s.canReplaceWith(i,i,o))return!1;if(e){let a=t.after(),l=n.tr.replaceWith(a,a,o.createAndFill());l.setSelection(W.near(l.doc.resolve(a),1)),e(l.scrollIntoView())}return!0},L0=(n,e)=>{let t=n.selection,{$from:r,$to:s}=t;if(t instanceof Xe||r.parent.inlineContent||s.parent.inlineContent)return!1;let i=$d(s.parent.contentMatchAt(s.indexAfter()));if(!i||!i.isTextblock)return!1;if(e){let o=(!r.parentOffset&&s.index()<s.parent.childCount?r:s).pos,a=n.tr.insert(o,i.createAndFill());a.setSelection($.create(a.doc,o+1)),e(a.scrollIntoView())}return!0},B0=(n,e)=>{let{$cursor:t}=n.selection;if(!t||t.parent.content.size)return!1;if(t.depth>1&&t.after()!=t.end(-1)){let i=t.before();if(Ln(n.doc,i))return e&&e(n.tr.split(i).scrollIntoView()),!0}let r=t.blockRange(),s=r&&Gn(r);return s==null?!1:(e&&e(n.tr.lift(r,s).scrollIntoView()),!0)},z0=(n,e)=>{let{$from:t,to:r}=n.selection,s,i=t.sharedDepth(r);return i==0?!1:(s=t.before(i),e&&e(n.tr.setSelection(L.create(n.doc,s))),!0)};function F0(n,e,t){let r=e.nodeBefore,s=e.nodeAfter,i=e.index();return!r||!s||!r.type.compatibleContent(s.type)?!1:!r.content.size&&e.parent.canReplace(i-1,i)?(t&&t(n.tr.delete(e.pos-r.nodeSize,e.pos).scrollIntoView()),!0):!e.parent.canReplace(i,i+1)||!(s.isTextblock||Jt(n.doc,e.pos))?!1:(t&&t(n.tr.join(e.pos).scrollIntoView()),!0)}function Hd(n,e,t,r){let s=e.nodeBefore,i=e.nodeAfter,o,a,l=s.type.spec.isolating||i.type.spec.isolating;if(!l&&F0(n,e,t))return!0;let c=!l&&e.parent.canReplace(e.index(),e.index()+1);if(c&&(o=(a=s.contentMatchAt(s.childCount)).findWrapping(i.type))&&a.matchType(o[0]||i.type).validEnd){if(t){let h=e.pos+i.nodeSize,m=C.empty;for(let v=o.length-1;v>=0;v--)m=C.from(o[v].create(null,m));m=C.from(s.copy(m));let y=n.tr.step(new xe(e.pos-1,h,e.pos,h,new R(m,1,0),o.length,!0)),g=y.doc.resolve(h+2*o.length);g.nodeAfter&&g.nodeAfter.type==s.type&&Jt(y.doc,g.pos)&&y.join(g.pos),t(y.scrollIntoView())}return!0}let u=i.type.spec.isolating||r>0&&l?null:W.findFrom(e,1),d=u&&u.$from.blockRange(u.$to),f=d&&Gn(d);if(f!=null&&f>=e.depth)return t&&t(n.tr.lift(d,f).scrollIntoView()),!0;if(c&&Wn(i,"start",!0)&&Wn(s,"end")){let h=s,m=[];for(;m.push(h),!h.isTextblock;)h=h.lastChild;let y=i,g=1;for(;!y.isTextblock;y=y.firstChild)g++;if(h.canReplace(h.childCount,h.childCount,y.content)){if(t){let v=C.empty;for(let N=m.length-1;N>=0;N--)v=C.from(m[N].copy(v));let x=n.tr.step(new xe(e.pos-m.length,e.pos+i.nodeSize,e.pos+g,e.pos+i.nodeSize-g,new R(v,m.length,0),0,!0));t(x.scrollIntoView())}return!0}}return!1}function Vd(n){return function(e,t){let r=e.selection,s=n<0?r.$from:r.$to,i=s.depth;for(;s.node(i).isInline;){if(!i)return!1;i--}return s.node(i).isTextblock?(t&&t(e.tr.setSelection($.create(e.doc,n<0?s.start(i):s.end(i)))),!0):!1}}const $0=Vd(-1),H0=Vd(1);function V0(n,e=null){return function(t,r){let{$from:s,$to:i}=t.selection,o=s.blockRange(i),a=o&&Ta(o,n,e);return a?(r&&r(t.tr.wrap(o,a).scrollIntoView()),!0):!1}}function ac(n,e=null){return function(t,r){let s=!1;for(let i=0;i<t.selection.ranges.length&&!s;i++){let{$from:{pos:o},$to:{pos:a}}=t.selection.ranges[i];t.doc.nodesBetween(o,a,(l,c)=>{if(s)return!1;if(!(!l.isTextblock||l.hasMarkup(n,e)))if(l.type==n)s=!0;else{let u=t.doc.resolve(c),d=u.index();s=u.parent.canReplaceWith(d,d+1,n)}})}if(!s)return!1;if(r){let i=t.tr;for(let o=0;o<t.selection.ranges.length;o++){let{$from:{pos:a},$to:{pos:l}}=t.selection.ranges[o];i.setBlockType(a,l,n,e)}r(i.scrollIntoView())}return!0}}typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):typeof os<"u"&&os.platform&&os.platform()=="darwin";function W0(n,e=null){return function(t,r){let{$from:s,$to:i}=t.selection,o=s.blockRange(i);if(!o)return!1;let a=r?t.tr:null;return U0(a,o,n,e)?(r&&r(a.scrollIntoView()),!0):!1}}function U0(n,e,t,r=null){let s=!1,i=e,o=e.$from.doc;if(e.depth>=2&&e.$from.node(e.depth-1).type.compatibleContent(t)&&e.startIndex==0){if(e.$from.index(e.depth-1)==0)return!1;let l=o.resolve(e.start-2);i=new Ts(l,l,e.depth),e.endIndex<e.parent.childCount&&(e=new Ts(e.$from,o.resolve(e.$to.end(e.depth)),e.depth)),s=!0}let a=Ta(i,t,r,e);return a?(n&&q0(n,e,a,s,t),!0):!1}function q0(n,e,t,r,s){let i=C.empty;for(let u=t.length-1;u>=0;u--)i=C.from(t[u].type.create(t[u].attrs,i));n.step(new xe(e.start-(r?2:0),e.end,e.start,e.end,new R(i,0,0),t.length,!0));let o=0;for(let u=0;u<t.length;u++)t[u].type==s&&(o=u+1);let a=t.length-o,l=e.start+t.length-(r?2:0),c=e.parent;for(let u=e.startIndex,d=e.endIndex,f=!0;u<d;u++,f=!1)!f&&Ln(n.doc,l,a)&&(n.split(l,a),l+=2*a),l+=c.child(u).nodeSize;return n}function K0(n){return function(e,t){let{$from:r,$to:s}=e.selection,i=r.blockRange(s,o=>o.childCount>0&&o.firstChild.type==n);return i?t?r.node(i.depth-1).type==n?J0(e,t,n,i):Y0(e,t,i):!0:!1}}function J0(n,e,t,r){let s=n.tr,i=r.end,o=r.$to.end(r.depth);i<o&&(s.step(new xe(i-1,o,i,o,new R(C.from(t.create(null,r.parent.copy())),1,0),1,!0)),r=new Ts(s.doc.resolve(r.$from.pos),s.doc.resolve(o),r.depth));const a=Gn(r);if(a==null)return!1;s.lift(r,a);let l=s.doc.resolve(s.mapping.map(i,-1)-1);return Jt(s.doc,l.pos)&&l.nodeBefore.type==l.nodeAfter.type&&s.join(l.pos),e(s.scrollIntoView()),!0}function Y0(n,e,t){let r=n.tr,s=t.parent;for(let h=t.end,m=t.endIndex-1,y=t.startIndex;m>y;m--)h-=s.child(m).nodeSize,r.delete(h-1,h+1);let i=r.doc.resolve(t.start),o=i.nodeAfter;if(r.mapping.map(t.end)!=t.start+i.nodeAfter.nodeSize)return!1;let a=t.startIndex==0,l=t.endIndex==s.childCount,c=i.node(-1),u=i.index(-1);if(!c.canReplace(u+(a?0:1),u+1,o.content.append(l?C.empty:C.from(s))))return!1;let d=i.pos,f=d+o.nodeSize;return r.step(new xe(d-(a?1:0),f+(l?1:0),d+1,f-1,new R((a?C.empty:C.from(s.copy(C.empty))).append(l?C.empty:C.from(s.copy(C.empty))),a?0:1,l?0:1),a?0:1)),e(r.scrollIntoView()),!0}function G0(n){return function(e,t){let{$from:r,$to:s}=e.selection,i=r.blockRange(s,c=>c.childCount>0&&c.firstChild.type==n);if(!i)return!1;let o=i.startIndex;if(o==0)return!1;let a=i.parent,l=a.child(o-1);if(l.type!=n)return!1;if(t){let c=l.lastChild&&l.lastChild.type==a.type,u=C.from(c?n.create():null),d=new R(C.from(n.create(null,C.from(a.type.create(null,u)))),c?3:1,0),f=i.start,h=i.end;t(e.tr.step(new xe(f-(c?3:1),h,f,h,d,1,!0)).scrollIntoView())}return!0}}const Me=function(n){for(var e=0;;e++)if(n=n.previousSibling,!n)return e},Un=function(n){let e=n.assignedSlot||n.parentNode;return e&&e.nodeType==11?e.host:e};let zo=null;const vt=function(n,e,t){let r=zo||(zo=document.createRange());return r.setEnd(n,t??n.nodeValue.length),r.setStart(n,e||0),r},X0=function(){zo=null},wn=function(n,e,t,r){return t&&(lc(n,e,t,r,-1)||lc(n,e,t,r,1))},Q0=/^(img|br|input|textarea|hr)$/i;function lc(n,e,t,r,s){for(var i;;){if(n==t&&e==r)return!0;
vendor: 10,986 bytes, line 129
129if(e==(s<0?0:Ge(n))){let o=n.parentNode;if(!o||o.nodeType!=1||Hr(n)||Q0.test(n.nodeName)||n.contentEditable=="false")return!1;e=Me(n)+(s<0?0:1),n=o}else if(n.nodeType==1){let o=n.childNodes[e+(s<0?-1:0)];if(o.nodeType==1&&o.contentEditable=="false")if(!((i=o.pmViewDesc)===null||i===void 0)&&i.ignoreForSelection)e+=s;else return!1;else n=o,e=s<0?Ge(n):0}else return!1}}function Ge(n){return n.nodeType==3?n.nodeValue.length:n.childNodes.length}function Z0(n,e){for(;;){if(n.nodeType==3&&e)return n;if(n.nodeType==1&&e>0){if(n.contentEditable=="false")return null;n=n.childNodes[e-1],e=Ge(n)}else if(n.parentNode&&!Hr(n))e=Me(n),n=n.parentNode;else return null}}function eb(n,e){for(;;){if(n.nodeType==3&&e<n.nodeValue.length)return n;if(n.nodeType==1&&e<n.childNodes.length){if(n.contentEditable=="false")return null;n=n.childNodes[e],e=0}else if(n.parentNode&&!Hr(n))e=Me(n)+1,n=n.parentNode;else return null}}function tb(n,e,t){for(let r=e==0,s=e==Ge(n);r||s;){if(n==t)return!0;let i=Me(n);if(n=n.parentNode,!n)return!1;r=r&&i==0,s=s&&i==Ge(n)}}function Hr(n){let e;for(let t=n;t&&!(e=t.pmViewDesc);t=t.parentNode);return e&&e.node&&e.node.isBlock&&(e.dom==n||e.contentDOM==n)}const wi=function(n){return n.focusNode&&wn(n.focusNode,n.focusOffset,n.anchorNode,n.anchorOffset)};function ln(n,e){let t=document.createEvent("Event");return t.initEvent("keydown",!0,!0),t.keyCode=n,t.key=t.code=e,t}function nb(n){let e=n.activeElement;for(;e&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e}function rb(n,e,t){if(n.caretPositionFromPoint)try{let r=n.caretPositionFromPoint(e,t);if(r)return{node:r.offsetNode,offset:Math.min(Ge(r.offsetNode),r.offset)}}catch{}if(n.caretRangeFromPoint){let r=n.caretRangeFromPoint(e,t);if(r)return{node:r.startContainer,offset:Math.min(Ge(r.startContainer),r.startOffset)}}}const ut=typeof navigator<"u"?navigator:null,cc=typeof document<"u"?document:null,Yt=ut&&ut.userAgent||"",Fo=/Edge\/(\d+)/.exec(Yt),Wd=/MSIE \d/.exec(Yt),$o=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Yt),We=!!(Wd||$o||Fo),$t=Wd?document.documentMode:$o?+$o[1]:Fo?+Fo[1]:0,Qe=!We&&/gecko\/(\d+)/i.test(Yt);Qe&&+(/Firefox\/(\d+)/.exec(Yt)||[0,0])[1];const Ho=!We&&/Chrome\/(\d+)/.exec(Yt),Ee=!!Ho,Ud=Ho?+Ho[1]:0,Oe=!We&&!!ut&&/Apple Computer/.test(ut.vendor),qn=Oe&&(/Mobile\/\w+/.test(Yt)||!!ut&&ut.maxTouchPoints>2),Ye=qn||(ut?/Mac/.test(ut.platform):!1),qd=ut?/Win/.test(ut.platform):!1,kt=/Android \d/.test(Yt),Vr=!!cc&&"webkitFontSmoothing"in cc.documentElement.style,sb=Vr?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function ib(n){let e=n.defaultView&&n.defaultView.visualViewport;return e?{left:0,right:e.width,top:0,bottom:e.height}:{left:0,right:n.documentElement.clientWidth,top:0,bottom:n.documentElement.clientHeight}}function mt(n,e){return typeof n=="number"?n:n[e]}function ob(n){let e=n.getBoundingClientRect(),t=e.width/n.offsetWidth||1,r=e.height/n.offsetHeight||1;return{left:e.left,right:e.left+n.clientWidth*t,top:e.top,bottom:e.top+n.clientHeight*r}}function uc(n,e,t){let r=n.someProp("scrollThreshold")||0,s=n.someProp("scrollMargin")||5,i=n.dom.ownerDocument;for(let o=t||n.dom;o;){if(o.nodeType!=1){o=Un(o);continue}let a=o,l=a==i.body,c=l?ib(i):ob(a),u=0,d=0;if(e.top<c.top+mt(r,"top")?d=-(c.top-e.top+mt(s,"top")):e.bottom>c.bottom-mt(r,"bottom")&&(d=e.bottom-e.top>c.bottom-c.top?e.top+mt(s,"top")-c.top:e.bottom-c.bottom+mt(s,"bottom")),e.left<c.left+mt(r,"left")?u=-(c.left-e.left+mt(s,"left")):e.right>c.right-mt(r,"right")&&(u=e.right-c.right+mt(s,"right")),u||d)if(l)i.defaultView.scrollBy(u,d);else{let h=a.scrollLeft,m=a.scrollTop;d&&(a.scrollTop+=d),u&&(a.scrollLeft+=u);let y=a.scrollLeft-h,g=a.scrollTop-m;e={left:e.left-y,top:e.top-g,right:e.right-y,bottom:e.bottom-g}}let f=l?"fixed":getComputedStyle(o).position;if(/^(fixed|sticky)$/.test(f))break;o=f=="absolute"?o.offsetParent:Un(o)}}function ab(n){let e=n.dom.getBoundingClientRect(),t=Math.max(0,e.top),r,s;for(let i=(e.left+e.right)/2,o=t+1;o<Math.min(innerHeight,e.bottom);o+=5){let a=n.root.elementFromPoint(i,o);if(!a||a==n.dom||!n.dom.contains(a))continue;let l=a.getBoundingClientRect();if(l.top>=t-20){r=a,s=l.top;break}}return{refDOM:r,refTop:s,stack:Kd(n.dom)}}function Kd(n){let e=[],t=n.ownerDocument;for(let r=n;r&&(e.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),n!=t);r=Un(r));return e}function lb({refDOM:n,refTop:e,stack:t}){let r=n?n.getBoundingClientRect().top:0;Jd(t,r==0?0:r-e)}function Jd(n,e){for(let t=0;t<n.length;t++){let{dom:r,top:s,left:i}=n[t];r.scrollTop!=s+e&&(r.scrollTop=s+e),r.scrollLeft!=i&&(r.scrollLeft=i)}}let Dn=null;function cb(n){if(n.setActive)return n.setActive();if(Dn)return n.focus(Dn);let e=Kd(n);n.focus(Dn==null?{get preventScroll(){return Dn={preventScroll:!0},!0}}:void 0),Dn||(Dn=!1,Jd(e,0))}function Yd(n,e){let t,r=2e8,s,i=0,o=e.top,a=e.top,l,c;for(let u=n.firstChild,d=0;u;u=u.nextSibling,d++){let f;if(u.nodeType==1)f=u.getClientRects();else if(u.nodeType==3)f=vt(u).getClientRects();else continue;for(let h=0;h<f.length;h++){let m=f[h];if(m.top<=o&&m.bottom>=a){o=Math.max(m.bottom,o),a=Math.min(m.top,a);let y=m.left>e.left?m.left-e.left:m.right<e.left?e.left-m.right:0;if(y<r){t=u,r=y,s=y&&t.nodeType==3?{left:m.right<e.left?m.right:m.left,top:e.top}:e,u.nodeType==1&&y&&(i=d+(e.left>=(m.left+m.right)/2?1:0));continue}}else m.top>e.top&&!l&&m.left<=e.left&&m.right>=e.left&&(l=u,c={left:Math.max(m.left,Math.min(m.right,e.left)),top:m.top});!t&&(e.left>=m.right&&e.top>=m.top||e.left>=m.left&&e.top>=m.bottom)&&(i=d+1)}}return!t&&l&&(t=l,s=c,r=0),t&&t.nodeType==3?ub(t,s):!t||r&&t.nodeType==1?{node:n,offset:i}:Yd(t,s)}function ub(n,e){let t=n.nodeValue.length,r=document.createRange(),s;for(let i=0;i<t;i++){r.setEnd(n,i+1),r.setStart(n,i);let o=Dt(r,1);if(o.top!=o.bottom&&Ra(e,o)){s={node:n,offset:i+(e.left>=(o.left+o.right)/2?1:0)};break}}return r.detach(),s||{node:n,offset:0}}function Ra(n,e){return n.left>=e.left-1&&n.left<=e.right+1&&n.top>=e.top-1&&n.top<=e.bottom+1}function db(n,e){let t=n.parentNode;return t&&/^li$/i.test(t.nodeName)&&e.left<n.getBoundingClientRect().left?t:n}function fb(n,e,t){let{node:r,offset:s}=Yd(e,t),i=-1;if(r.nodeType==1&&!r.firstChild){let o=r.getBoundingClientRect();i=o.left!=o.right&&t.left>(o.left+o.right)/2?1:-1}return n.docView.posFromDOM(r,s,i)}function hb(n,e,t,r){let s=-1;for(let i=e,o=!1;i!=n.dom;){let a=n.docView.nearestDesc(i,!0),l;if(!a)return null;if(a.dom.nodeType==1&&(a.node.isBlock&&a.parent||!a.contentDOM)&&((l=a.dom.getBoundingClientRect()).width||l.height)&&(a.node.isBlock&&a.parent&&!/^T(R|BODY|HEAD|FOOT)$/.test(a.dom.nodeName)&&(!o&&l.left>r.left||l.top>r.top?s=a.posBefore:(!o&&l.right<r.left||l.bottom<r.top)&&(s=a.posAfter),o=!0),!a.contentDOM&&s<0&&!a.node.isText))return(a.node.isBlock?r.top<(l.top+l.bottom)/2:r.left<(l.left+l.right)/2)?a.posBefore:a.posAfter;i=a.dom.parentNode}return s>-1?s:n.docView.posFromDOM(e,t,-1)}function Gd(n,e,t){let r=n.childNodes.length;if(r&&t.top<t.bottom)for(let s=Math.max(0,Math.min(r-1,Math.floor(r*(e.top-t.top)/(t.bottom-t.top))-2)),i=s;;){let o=n.childNodes[i];if(o.nodeType==1){let a=o.getClientRects();for(let l=0;l<a.length;l++){let c=a[l];if(Ra(e,c))return Gd(o,e,c)}}if((i=(i+1)%r)==s)break}return n}function pb(n,e){let t=n.dom.ownerDocument,r,s=0,i=rb(t,e.left,e.top);i&&({node:r,offset:s}=i);let o=(n.root.elementFromPoint?n.root:t).elementFromPoint(e.left,e.top),a;if(!o||!n.dom.contains(o.nodeType!=1?o.parentNode:o)){let c=n.dom.getBoundingClientRect();if(!Ra(e,c)||(o=Gd(n.dom,e,c),!o))return null}if(Oe)for(let c=o;r&&c;c=Un(c))c.draggable&&(r=void 0);if(o=db(o,e),r){if(Qe&&r.nodeType==1&&(s=Math.min(s,r.childNodes.length),s<r.childNodes.length)){let u=r.childNodes[s],d;u.nodeName=="IMG"&&(d=u.getBoundingClientRect()).right<=e.left&&d.bottom>e.top&&s++}let c;Vr&&s&&r.nodeType==1&&(c=r.childNodes[s-1]).nodeType==1&&c.contentEditable=="false"&&c.getBoundingClientRect().top>=e.top&&s--,r==n.dom&&s==r.childNodes.length-1&&r.lastChild.nodeType==1&&e.top>r.lastChild.getBoundingClientRect().bottom?a=n.state.doc.content.size:(s==0||r.nodeType!=1||r.childNodes[s-1].nodeName!="BR")&&(a=hb(n,r,s,e))}a==null&&(a=fb(n,o,e));let l=n.docView.nearestDesc(o,!0);return{pos:a,inside:l?l.posAtStart-l.border:-1}}function dc(n){return n.top<n.bottom||n.left<n.right}function Dt(n,e){let t=n.getClientRects();if(t.length){let r=t[e<0?0:t.length-1];if(dc(r))return r}return Array.prototype.find.call(t,dc)||n.getBoundingClientRect()}const mb=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function Xd(n,e,t){let{node:r,offset:s,atom:i}=n.docView.domFromPos(e,t<0?-1:1),o=Vr||Qe;if(r.nodeType==3)if(o&&(mb.test(r.nodeValue)||(t<0?!s:s==r.nodeValue.length))){let l=Dt(vt(r,s,s),t);if(Qe&&s&&/\s/.test(r.nodeValue[s-1])&&s<r.nodeValue.length){let c=Dt(vt(r,s-1,s-1),-1);if(c.top==l.top){let u=Dt(vt(r,s,s+1),-1);if(u.top!=l.top)return nr(u,u.left<c.left)}}return l}else{let l=s,c=s,u=t<0?1:-1;return t<0&&!s?(c++,u=-1):t>=0&&s==r.nodeValue.length?(l--,u=1):t<0?l--:c++,nr(Dt(vt(r,l,c),u),u<0)}if(!n.state.doc.resolve(e-(i||0)).parent.inlineContent){if(i==null&&s&&(t<0||s==Ge(r))){let l=r.childNodes[s-1];if(l.nodeType==1)return oo(l.getBoundingClientRect(),!1)}if(i==null&&s<Ge(r)){let l=r.childNodes[s];if(l.nodeType==1)return oo(l.getBoundingClientRect(),!0)}return oo(r.getBoundingClientRect(),t>=0)}if(i==null&&s&&(t<0||s==Ge(r))){let l=r.childNodes[s-1],c=l.nodeType==3?vt(l,Ge(l)-(o?0:1)):l.nodeType==1&&(l.nodeName!="BR"||!l.nextSibling)?l:null;if(c)return nr(Dt(c,1),!1)}if(i==null&&s<Ge(r)){let l=r.childNodes[s];for(;l.pmViewDesc&&l.pmViewDesc.ignoreForCoords;)l=l.nextSibling;let c=l?l.nodeType==3?vt(l,0,o?0:1):l.nodeType==1?l:null:null;if(c)return nr(Dt(c,-1),!0)}return nr(Dt(r.nodeType==3?vt(r):r,-t),t>=0)}function nr(n,e){if(n.width==0)return n;let t=e?n.left:n.right;return{top:n.top,bottom:n.bottom,left:t,right:t}}function oo(n,e){if(n.height==0)return n;let t=e?n.top:n.bottom;return{top:t,bottom:t,left:n.left,right:n.right}}function Qd(n,e,t){let r=n.state,s=n.root.activeElement;r!=e&&n.updateState(e),s!=n.dom&&n.focus();try{return t()}finally{r!=e&&n.updateState(r),s!=n.dom&&s&&s.focus()}}function gb(n,e,t){let r=e.selection,s=t=="up"?r.$from:r.$to;return Qd(n,e,()=>{let{node:i}=n.docView.domFromPos(s.pos,t=="up"?-1:1);for(;;){let a=n.docView.nearestDesc(i,!0);if(!a)break;if(a.node.isBlock){i=a.contentDOM||a.dom;break}i=a.dom.parentNode}let o=Xd(n,s.pos,1);for(let a=i.firstChild;a;a=a.nextSibling){let l;if(a.nodeType==1)l=a.getClientRects();else if(a.nodeType==3)l=vt(a,0,a.nodeValue.length).getClientRects();else continue;for(let c=0;c<l.length;c++){let u=l[c];if(u.bottom>u.top+1&&(t=="up"?o.top-u.top>(u.bottom-o.top)*2:u.bottom-o.bottom>(o.bottom-u.top)*2))return!1}}return!0})}const yb=/[\u0590-\u08ac]/;function bb(n,e,t){let{$head:r}=e.selection;if(!r.parent.isTextblock)return!1;let s=r.parentOffset,i=!s,o=s==r.parent.content.size,a=n.domSelection();return a?!yb.test(r.parent.textContent)||!a.modify?t=="left"||t=="backward"?i:o:Qd(n,e,()=>
vendor: 5,068 bytes, line 129
129{let{focusNode:l,focusOffset:c,anchorNode:u,anchorOffset:d}=n.domSelectionRange(),f=a.caretBidiLevel;a.modify("move",t,"character");let h=r.depth?n.docView.domAfterPos(r.before()):n.dom,{focusNode:m,focusOffset:y}=n.domSelectionRange(),g=m&&!h.contains(m.nodeType==1?m:m.parentNode)||l==m&&c==y;try{a.collapse(u,d),l&&(l!=u||c!=d)&&a.extend&&a.extend(l,c)}catch{}return f!=null&&(a.caretBidiLevel=f),g}):r.pos==r.start()||r.pos==r.end()}let fc=null,hc=null,pc=!1;function vb(n,e,t){return fc==e&&hc==t?pc:(fc=e,hc=t,pc=t=="up"||t=="down"?gb(n,e,t):bb(n,e,t))}const Ze=0,mc=1,cn=2,dt=3;class Wr{constructor(e,t,r,s){this.parent=e,this.children=t,this.dom=r,this.contentDOM=s,this.dirty=Ze,r.pmViewDesc=this}matchesWidget(e){return!1}matchesMark(e){return!1}matchesNode(e,t,r){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,r=this.posAtStart;;t++){let s=this.children[t];if(s==e)return r;r+=s.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,r){if(this.contentDOM&&this.contentDOM.contains(e.nodeType==1?e:e.parentNode))if(r<0){let i,o;if(e==this.contentDOM)i=e.childNodes[t-1];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;i=e.previousSibling}for(;i&&!((o=i.pmViewDesc)&&o.parent==this);)i=i.previousSibling;return i?this.posBeforeChild(o)+o.size:this.posAtStart}else{let i,o;if(e==this.contentDOM)i=e.childNodes[t];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;i=e.nextSibling}for(;i&&!((o=i.pmViewDesc)&&o.parent==this);)i=i.nextSibling;return i?this.posBeforeChild(o):this.posAtEnd}let s;if(e==this.dom&&this.contentDOM)s=t>Me(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))s=e.compareDocumentPosition(this.contentDOM)&2;else if(this.dom.firstChild){if(t==0)for(let i=e;;i=i.parentNode){if(i==this.dom){s=!1;break}if(i.previousSibling)break}if(s==null&&t==e.childNodes.length)for(let i=e;;i=i.parentNode){if(i==this.dom){s=!0;break}if(i.nextSibling)break}}return s??r>0?this.posAtEnd:this.posAtStart}nearestDesc(e,t=!1){for(let r=!0,s=e;s;s=s.parentNode){let i=this.getDesc(s),o;if(i&&(!t||i.node))if(r&&(o=i.nodeDOM)&&!(o.nodeType==1?o.contains(e.nodeType==1?e:e.parentNode):o==e))r=!1;else return i}}getDesc(e){let t=e.pmViewDesc;for(let r=t;r;r=r.parent)if(r==this)return t}posFromDOM(e,t,r){for(let s=e;s;s=s.parentNode){let i=this.getDesc(s);if(i)return i.localPosFromDOM(e,t,r)}return-1}descAt(e){for(let t=0,r=0;t<this.children.length;t++){let s=this.children[t],i=r+s.size;if(r==e&&i!=r){for(;!s.border&&s.children.length;)for(let o=0;o<s.children.length;o++){let a=s.children[o];if(a.size){s=a;break}}return s}if(e<i)return s.descAt(e-r-s.border);r=i}}domFromPos(e,t){if(!this.contentDOM)return{node:this.dom,offset:0,atom:e+1};let r=0,s=0;for(let i=0;r<this.children.length;r++){let o=this.children[r],a=i+o.size;if(a>e||o instanceof ef){s=e-i;break}i=a}if(s)return this.children[r].domFromPos(s-this.children[r].border,t);for(let i;r&&!(i=this.children[r-1]).size&&i instanceof Zd&&i.side>=0;r--);if(t<=0){let i,o=!0;for(;i=r?this.children[r-1]:null,!(!i||i.dom.parentNode==this.contentDOM);r--,o=!1);return i&&t&&o&&!i.border&&!i.domAtom?i.domFromPos(i.size,t):{node:this.contentDOM,offset:i?Me(i.dom)+1:0}}else{let i,o=!0;for(;i=r<this.children.length?this.children[r]:null,!(!i||i.dom.parentNode==this.contentDOM);r++,o=!1);return i&&o&&!i.border&&!i.domAtom?i.domFromPos(0,t):{node:this.contentDOM,offset:i?Me(i.dom):this.contentDOM.childNodes.length}}}parseRange(e,t,r=0){if(this.children.length==0)return{node:this.contentDOM,from:e,to:t,fromOffset:0,toOffset:this.contentDOM.childNodes.length};let s=-1,i=-1;for(let o=r,a=0;;a++){let l=this.children[a],c=o+l.size;if(s==-1&&e<=c){let u=o+l.border;if(e>=u&&t<=c-l.border&&l.node&&l.contentDOM&&this.contentDOM.contains(l.contentDOM))return l.parseRange(e,t,u);e=o;for(let d=a;d>0;d--){let f=this.children[d-1];if(f.size&&f.dom.parentNode==this.contentDOM&&!f.emptyChildAt(1)){s=Me(f.dom)+1;break}e-=f.size}s==-1&&(s=0)}if(s>-1&&(c>t||a==this.children.length-1)){t=c;for(let u=a+1;u<this.children.length;u++){let d=this.children[u];if(d.size&&d.dom.parentNode==this.contentDOM&&!d.emptyChildAt(-1)){i=Me(d.dom);break}t+=d.size}i==-1&&(i=this.contentDOM.childNodes.length);break}o=c}return{node:this.contentDOM,from:e,to:t,fromOffset:s,toOffset:i}}emptyChildAt(e){if(this.border||!this.contentDOM||!this.children.length)return!1;let t=this.children[e<0?0:this.children.length-1];return t.size==0||t.emptyChildAt(e)}domAfterPos(e){let{node:t,offset:r}=this.domFromPos(e,0);
vendor: 4,411 bytes, lines 129-130
129if(t.nodeType!=1||r==t.childNodes.length)throw new RangeError("No node after pos "+e);return t.childNodes[r]}setSelection(e,t,r,s=!1){let i=Math.min(e,t),o=Math.max(e,t);for(let h=0,m=0;h<this.children.length;h++){let y=this.children[h],g=m+y.size;if(i>m&&o<g)return y.setSelection(e-m-y.border,t-m-y.border,r,s);m=g}let a=this.domFromPos(e,e?-1:1),l=t==e?a:this.domFromPos(t,t?-1:1),c=r.root.getSelection(),u=r.domSelectionRange(),d=!1;if((Qe||Oe)&&e==t){let{node:h,offset:m}=a;if(h.nodeType==3){if(d=!!(m&&h.nodeValue[m-1]==` 130`),d&&m==h.nodeValue.length)for(let y=h,g;y;y=y.parentNode){if(g=y.nextSibling){g.nodeName=="BR"&&(a=l={node:g.parentNode,offset:Me(g)+1});break}let v=y.pmViewDesc;if(v&&v.node&&v.node.isBlock)break}}else{let y=h.childNodes[m-1];d=y&&(y.nodeName=="BR"||y.contentEditable=="false")}}if(Qe&&u.focusNode&&u.focusNode!=l.node&&u.focusNode.nodeType==1){let h=u.focusNode.childNodes[u.focusOffset];h&&h.contentEditable=="false"&&(s=!0)}if(!(s||d&&Oe)&&wn(a.node,a.offset,u.anchorNode,u.anchorOffset)&&wn(l.node,l.offset,u.focusNode,u.focusOffset))return;let f=!1;if((c.extend||e==t)&&!(d&&Qe)){c.collapse(a.node,a.offset);try{e!=t&&c.extend(l.node,l.offset),f=!0}catch{}}if(!f){if(e>t){let m=a;a=l,l=m}let h=document.createRange();h.setEnd(l.node,l.offset),h.setStart(a.node,a.offset),c.removeAllRanges(),c.addRange(h)}}ignoreMutation(e){return!this.contentDOM&&e.type!="selection"}get contentLost(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}markDirty(e,t){for(let r=0,s=0;s<this.children.length;s++){let i=this.children[s],o=r+i.size;if(r==o?e<=o&&t>=r:e<o&&t>r){let a=r+i.border,l=o-i.border;if(e>=a&&t<=l){this.dirty=e==r||t==o?cn:mc,e==a&&t==l&&(i.contentLost||i.dom.parentNode!=this.contentDOM)?i.dirty=dt:i.markDirty(e-a,t-a);return}else i.dirty=i.dom==i.contentDOM&&i.dom.parentNode==this.contentDOM&&!i.children.length?cn:dt}r=o}this.dirty=cn}markParentsDirty(){let e=1;for(let t=this.parent;t;t=t.parent,e++){let r=e==1?cn:mc;t.dirty<r&&(t.dirty=r)}}get domAtom(){return!1}get ignoreForCoords(){return!1}get ignoreForSelection(){return!1}isText(e){return!1}}class Zd extends Wr{constructor(e,t,r,s){let i,o=t.type.toDOM;if(typeof o=="function"&&(o=o(r,()=>{if(!i)return s;if(i.parent)return i.parent.posBeforeChild(i)})),!t.type.spec.raw){if(o.nodeType!=1){let a=document.createElement("span");a.appendChild(o),o=a}o.contentEditable="false",o.classList.add("ProseMirror-widget")}super(e,[],o,null),this.widget=t,this.widget=t,i=this}matchesWidget(e){return this.dirty==Ze&&e.type.eq(this.widget.type)}parseRule(){return{ignore:!0}}stopEvent(e){let t=this.widget.spec.stopEvent;return t?t(e):!1}ignoreMutation(e){return e.type!="selection"||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 xb extends Wr{constructor(e,t,r,s){super(e,[],t,null),this.textDOM=r,this.text=s}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 e.type==="characterData"&&e.target.nodeValue==e.oldValue}}class Sn extends Wr{constructor(e,t,r,s,i){super(e,[],r,s),this.mark=t,this.spec=i}static create(e,t,r,s){let i=s.nodeViews[t.type.name],o=i&&i(t,s,r);return(!o||!o.dom)&&(o=Mn.renderSpec(document,t.type.spec.toDOM(t,r),null,t.attrs)),new Sn(e,t,o.dom,o.contentDOM||o.dom,o)}parseRule(){return this.dirty&dt||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return this.dirty!=dt&&this.mark.eq(e)}markDirty(e,t){if(super.markDirty(e,t),this.dirty!=Ze){let r=this.parent;for(;!r.node;)r=r.parent;r.dirty<this.dirty&&(r.dirty=this.dirty),this.dirty=Ze}}slice(e,t,r){let s=Sn.create(this.parent,this.mark,!0,r),i=this.children,o=this.size;t<o&&(i=Wo(i,t,o,r)),e>0&&(i=Wo(i,0,e,r));for(let a=0;a<i.length;a++)i[a].parent=s;return s.children=i,s}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}}class Ht extends Wr{constructor(e,t,r,s,i,o,a,l,c){super(e,[],i,o),this.node=t,this.outerDeco=r,this.innerDeco=s,this.nodeDOM=a}
vendor: 7,530 bytes, line 130
130static create(e,t,r,s,i,o){let a=i.nodeViews[t.type.name],l,c=a&&a(t,i,()=>{if(!l)return o;if(l.parent)return l.parent.posBeforeChild(l)},r,s),u=c&&c.dom,d=c&&c.contentDOM;if(t.isText){if(!u)u=document.createTextNode(t.text);else if(u.nodeType!=3)throw new RangeError("Text must be rendered as a DOM text node")}else u||({dom:u,contentDOM:d}=Mn.renderSpec(document,t.type.spec.toDOM(t),null,t.attrs));!d&&!t.isText&&u.nodeName!="BR"&&(u.hasAttribute("contenteditable")||(u.contentEditable="false"),t.type.spec.draggable&&(u.draggable=!0));let f=u;return u=rf(u,r,t),c?l=new kb(e,t,r,s,u,d||null,f,c,i,o+1):t.isText?new Si(e,t,r,s,u,f,i):new Ht(e,t,r,s,u,d||null,f,i,o+1)}parseRule(){if(this.node.type.spec.reparseInView)return null;let e={node:this.node.type.name,attrs:this.node.attrs};if(this.node.type.whitespace=="pre"&&(e.preserveWhitespace="full"),!this.contentDOM)e.getContent=()=>this.node.content;else if(!this.contentLost)e.contentElement=this.contentDOM;else{for(let t=this.children.length-1;t>=0;t--){let r=this.children[t];if(this.dom.contains(r.dom.parentNode)){e.contentElement=r.dom.parentNode;break}}e.contentElement||(e.getContent=()=>C.empty)}return e}matchesNode(e,t,r){return this.dirty==Ze&&e.eq(this.node)&&Os(t,this.outerDeco)&&r.eq(this.innerDeco)}get size(){return this.node.nodeSize}get border(){return this.node.isLeaf?0:1}updateChildren(e,t){let r=this.node.inlineContent,s=t,i=e.composing?this.localCompositionInfo(e,t):null,o=i&&i.pos>-1?i:null,a=i&&i.pos<0,l=new Sb(this,o&&o.node,e);Nb(this.node,this.innerDeco,(c,u,d)=>{c.spec.marks?l.syncToMarks(c.spec.marks,r,e,u):c.type.side>=0&&!d&&l.syncToMarks(u==this.node.childCount?G.none:this.node.child(u).marks,r,e,u),l.placeWidget(c,e,s)},(c,u,d,f)=>{l.syncToMarks(c.marks,r,e,f);let h;l.findNodeMatch(c,u,d,f)||a&&e.state.selection.from>s&&e.state.selection.to<s+c.nodeSize&&(h=l.findIndexWithChild(i.node))>-1&&l.updateNodeAt(c,u,d,h,e)||l.updateNextNode(c,u,d,e,f,s)||l.addNode(c,u,d,e,s),s+=c.nodeSize}),l.syncToMarks([],r,e,0),this.node.isTextblock&&l.addTextblockHacks(),l.destroyRest(),(l.changed||this.dirty==cn)&&(o&&this.protectLocalComposition(e,o),tf(this.contentDOM,this.children,e),qn&&Eb(this.dom))}localCompositionInfo(e,t){let{from:r,to:s}=e.state.selection;if(!(e.state.selection instanceof $)||r<t||s>t+this.node.content.size)return null;let i=e.input.compositionNode;if(!i||!this.dom.contains(i.parentNode))return null;if(this.node.inlineContent){let o=i.nodeValue,a=Tb(this.node.content,o,r-t,s-t);return a<0?null:{node:i,pos:a,text:o}}else return{node:i,pos:-1,text:""}}protectLocalComposition(e,{node:t,pos:r,text:s}){if(this.getDesc(t))return;let i=t;for(;i.parentNode!=this.contentDOM;i=i.parentNode){for(;i.previousSibling;)i.parentNode.removeChild(i.previousSibling);for(;i.nextSibling;)i.parentNode.removeChild(i.nextSibling);i.pmViewDesc&&(i.pmViewDesc=void 0)}let o=new xb(this,i,t,s);e.input.compositionNodes.push(o),this.children=Wo(this.children,r,r+s.length,e,o)}update(e,t,r,s){return this.dirty==dt||!e.sameMarkup(this.node)?!1:(this.updateInner(e,t,r,s),!0)}updateInner(e,t,r,s){this.updateOuterDeco(t),this.node=e,this.innerDeco=r,this.contentDOM&&this.updateChildren(s,this.posAtStart),this.dirty=Ze}updateOuterDeco(e){if(Os(e,this.outerDeco))return;let t=this.nodeDOM.nodeType!=1,r=this.dom;this.dom=nf(this.dom,this.nodeDOM,Vo(this.outerDeco,this.node,t),Vo(e,this.node,t)),this.dom!=r&&(r.pmViewDesc=void 0,this.dom.pmViewDesc=this),this.outerDeco=e}selectNode(){this.nodeDOM.nodeType==1&&(this.nodeDOM.classList.add("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&(this.nodeDOM.draggable=!0))}deselectNode(){this.nodeDOM.nodeType==1&&(this.nodeDOM.classList.remove("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&this.nodeDOM.removeAttribute("draggable"))}get domAtom(){return this.node.isAtom}}function gc(n,e,t,r,s){rf(r,e,n);let i=new Ht(void 0,n,e,t,r,r,r,s,0);return i.contentDOM&&i.updateChildren(s,0),i}class Si extends Ht{constructor(e,t,r,s,i,o,a){super(e,t,r,s,i,null,o,a,0)}parseRule(){let e=this.nodeDOM.parentNode;for(;e&&e!=this.dom&&!e.pmIsDeco;)e=e.parentNode;return{skip:e||!0}}update(e,t,r,s){return this.dirty==dt||this.dirty!=Ze&&!this.inParent()||!e.sameMarkup(this.node)?!1:(this.updateOuterDeco(t),(this.dirty!=Ze||e.text!=this.node.text)&&e.text!=this.nodeDOM.nodeValue&&(this.nodeDOM.nodeValue=e.text,s.trackWrites==this.nodeDOM&&(s.trackWrites=null)),this.node=e,this.dirty=Ze,!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,r){return e==this.nodeDOM?this.posAtStart+Math.min(t,this.node.text.length):super.localPosFromDOM(e,t,r)}ignoreMutation(e){return e.type!="characterData"&&e.type!="selection"}slice(e,t,r){let s=this.node.cut(e,t),i=document.createTextNode(s.text);return new Si(this.parent,s,this.outerDeco,this.innerDeco,i,i,r)}markDirty(e,t){super.markDirty(e,t),this.dom!=this.nodeDOM&&(e==0||t==this.nodeDOM.nodeValue.length)&&(this.dirty=dt)}get domAtom(){return!1}isText(e){return this.node.text==e}}class ef extends Wr{parseRule(){return{ignore:!0}}matchesHack(e){return this.dirty==Ze&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}}class kb extends Ht{constructor(e,t,r,s,i,o,a,l,c,u){super(e,t,r,s,i,o,a,c,u),this.spec=l}update(e,t,r,s){if(this.dirty==dt)return!1;if(this.spec.update&&(this.node.type==e.type||this.spec.multiType)){let i=this.spec.update(e,t,r);return i&&this.updateInner(e,t,r,s),i}else return!this.contentDOM&&!e.isLeaf?!1:super.update(e,t,r,s)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(e,t,r,s){this.spec.setSelection?this.spec.setSelection(e,t,r.root):super.setSelection(e,t,r,s)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}stopEvent(e){return this.spec.stopEvent?this.spec.stopEvent(e):!1}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}}function tf(n,e,t){let r=n.firstChild,s=!1;for(let i=0;i<e.length;i++){let o=e[i],a=o.dom;if(a.parentNode==n){for(;a!=r;)r=yc(r),s=!0;r=r.nextSibling}else s=!0,n.insertBefore(a,r);if(o instanceof Sn){let l=r?r.previousSibling:n.lastChild;tf(o.contentDOM,o.children,t),r=l?l.nextSibling:n.firstChild}}for(;r;)r=yc(r),s=!0;s&&t.trackWrites==n&&(t.trackWrites=null)}const mr=function(n){n&&(this.nodeName=n)};mr.prototype=Object.create(null);const un=[new mr];function Vo(n,e,t){if(n.length==0)return un;let r=t?un[0]:new mr,s=[r];for(let i=0;i<n.length;i++){let o=n[i].type.attrs;if(o){o.nodeName&&s.push(r=new mr(o.nodeName));for(let a in o){let l=o[a];l!=null&&(t&&s.length==1&&s.push(r=new mr(e.isInline?"span":"div")),a=="class"?r.class=(r.class?r.class+" ":"")+l:a=="style"?r.style=(r.style?r.style+";":"")+l:a!="nodeName"&&(r[a]=l))}}}return s}function nf(n,e,t,r){if(t==un&&r==un)return e;let s=e;for(let i=0;i<r.length;i++){let o=r[i],a=t[i];if(i){let l;a&&a.nodeName==o.nodeName&&s!=n&&(l=s.parentNode)&&l.nodeName.toLowerCase()==o.nodeName||(l=document.createElement(o.nodeName),l.pmIsDeco=!0,l.appendChild(s),a=un[0]),s=l}wb(s,a||un[0],o)}return s}function wb(n,e,t){for(let r in e)r!="class"&&r!="style"&&r!="nodeName"&&!(r in t)&&n.removeAttribute(r);for(let r in t)r!="class"&&r!="style"&&r!="nodeName"&&t[r]!=e[r]&&n.setAttribute(r,t[r]);
vendor: 8,166 bytes, line 130
130if(e.class!=t.class){let r=e.class?e.class.split(" ").filter(Boolean):[],s=t.class?t.class.split(" ").filter(Boolean):[];for(let i=0;i<r.length;i++)s.indexOf(r[i])==-1&&n.classList.remove(r[i]);for(let i=0;i<s.length;i++)r.indexOf(s[i])==-1&&n.classList.add(s[i]);n.classList.length==0&&n.removeAttribute("class")}if(e.style!=t.style){if(e.style){let r=/\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g,s;for(;s=r.exec(e.style);)n.style.removeProperty(s[1])}t.style&&(n.style.cssText+=t.style)}}function rf(n,e,t){return nf(n,n,un,Vo(e,t,n.nodeType!=1))}function Os(n,e){if(n.length!=e.length)return!1;for(let t=0;t<n.length;t++)if(!n[t].type.eq(e[t].type))return!1;return!0}function yc(n){let e=n.nextSibling;return n.parentNode.removeChild(n),e}class Sb{constructor(e,t,r){this.lock=t,this.view=r,this.index=0,this.stack=[],this.changed=!1,this.top=e,this.preMatch=Cb(e.node.content,e)}destroyBetween(e,t){if(e!=t){for(let r=e;r<t;r++)this.top.children[r].destroy();this.top.children.splice(e,t-e),this.changed=!0}}destroyRest(){this.destroyBetween(this.index,this.top.children.length)}syncToMarks(e,t,r,s){let i=0,o=this.stack.length>>1,a=Math.min(o,e.length);for(;i<a&&(i==o-1?this.top:this.stack[i+1<<1]).matchesMark(e[i])&&e[i].type.spec.spanning!==!1;)i++;for(;i<o;)this.destroyRest(),this.top.dirty=Ze,this.index=this.stack.pop(),this.top=this.stack.pop(),o--;for(;o<e.length;){this.stack.push(this.top,this.index+1);let l=-1,c=this.top.children.length;s<this.preMatch.index&&(c=Math.min(this.index+3,c));for(let u=this.index;u<c;u++){let d=this.top.children[u];if(d.matchesMark(e[o])&&!this.isLocked(d.dom)){l=u;break}}if(l>-1)l>this.index&&(this.changed=!0,this.destroyBetween(this.index,l)),this.top=this.top.children[this.index];else{let u=Sn.create(this.top,e[o],t,r);this.top.children.splice(this.index,0,u),this.top=u,this.changed=!0}this.index=0,o++}}findNodeMatch(e,t,r,s){let i=-1,o;if(s>=this.preMatch.index&&(o=this.preMatch.matches[s-this.preMatch.index]).parent==this.top&&o.matchesNode(e,t,r))i=this.top.children.indexOf(o,this.index);else for(let a=this.index,l=Math.min(this.top.children.length,a+5);a<l;a++){let c=this.top.children[a];if(c.matchesNode(e,t,r)&&!this.preMatch.matched.has(c)){i=a;break}}return i<0?!1:(this.destroyBetween(this.index,i),this.index++,!0)}updateNodeAt(e,t,r,s,i){let o=this.top.children[s];return o.dirty==dt&&o.dom==o.contentDOM&&(o.dirty=cn),o.update(e,t,r,i)?(this.destroyBetween(this.index,s),this.index++,!0):!1}findIndexWithChild(e){for(;;){let t=e.parentNode;if(!t)return-1;if(t==this.top.contentDOM){let r=e.pmViewDesc;if(r){for(let s=this.index;s<this.top.children.length;s++)if(this.top.children[s]==r)return s}return-1}e=t}}updateNextNode(e,t,r,s,i,o){for(let a=this.index;a<this.top.children.length;a++){let l=this.top.children[a];if(l instanceof Ht){let c=this.preMatch.matched.get(l);if(c!=null&&c!=i)return!1;let u=l.dom,d,f=this.isLocked(u)&&!(e.isText&&l.node&&l.node.isText&&l.nodeDOM.nodeValue==e.text&&l.dirty!=dt&&Os(t,l.outerDeco));if(!f&&l.update(e,t,r,s))return this.destroyBetween(this.index,a),l.dom!=u&&(this.changed=!0),this.index++,!0;if(!f&&(d=this.recreateWrapper(l,e,t,r,s,o)))return this.destroyBetween(this.index,a),this.top.children[this.index]=d,d.contentDOM&&(d.dirty=cn,d.updateChildren(s,o+1),d.dirty=Ze),this.changed=!0,this.index++,!0;break}}return!1}recreateWrapper(e,t,r,s,i,o){if(e.dirty||t.isAtom||!e.children.length||!e.node.content.eq(t.content)||!Os(r,e.outerDeco)||!s.eq(e.innerDeco))return null;let a=Ht.create(this.top,t,r,s,i,o);if(a.contentDOM){a.children=e.children,e.children=[];for(let l of a.children)l.parent=a}return e.destroy(),a}addNode(e,t,r,s,i){let o=Ht.create(this.top,e,t,r,s,i);o.contentDOM&&o.updateChildren(s,i+1),this.top.children.splice(this.index++,0,o),this.changed=!0}placeWidget(e,t,r){let s=this.index<this.top.children.length?this.top.children[this.index]:null;if(s&&s.matchesWidget(e)&&(e==s.widget||!s.widget.type.toDOM.parentNode))this.index++;else{let i=new Zd(this.top,e,t,r);this.top.children.splice(this.index++,0,i),this.changed=!0}}addTextblockHacks(){let e=this.top.children[this.index-1],t=this.top;for(;e instanceof Sn;)t=e,e=t.children[t.children.length-1];(!e||!(e instanceof Si)||/\n$/.test(e.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(e.node.text))&&((Oe||Ee)&&e&&e.dom.contentEditable=="false"&&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 r=document.createElement(e);e=="IMG"&&(r.className="ProseMirror-separator",r.alt=""),e=="BR"&&(r.className="ProseMirror-trailingBreak");let s=new ef(this.top,[],r,null);t!=this.top?t.children.push(s):t.children.splice(this.index++,0,s),this.changed=!0}}isLocked(e){return this.lock&&(e==this.lock||e.nodeType==1&&e.contains(this.lock.parentNode))}}function Cb(n,e){let t=e,r=t.children.length,s=n.childCount,i=new Map,o=[];e:for(;s>0;){let a;for(;;)if(r){let c=t.children[r-1];if(c instanceof Sn)t=c,r=c.children.length;else{a=c,r--;break}}else{if(t==e)break e;r=t.parent.children.indexOf(t),t=t.parent}let l=a.node;if(l){if(l!=n.child(s-1))break;--s,i.set(a,s),o.push(a)}}return{index:s,matched:i,matches:o.reverse()}}function Mb(n,e){return n.type.side-e.type.side}function Nb(n,e,t,r){let s=e.locals(n),i=0;if(s.length==0){for(let c=0;c<n.childCount;c++){let u=n.child(c);r(u,s,e.forChild(i,u),c),i+=u.nodeSize}return}let o=0,a=[],l=null;for(let c=0;;){let u,d;for(;o<s.length&&s[o].to==i;){let g=s[o++];g.widget&&(u?(d||(d=[u])).push(g):u=g)}if(u)if(d){d.sort(Mb);for(let g=0;g<d.length;g++)t(d[g],c,!!l)}else t(u,c,!!l);let f,h;if(l)h=-1,f=l,l=null;else if(c<n.childCount)h=c,f=n.child(c++);else break;for(let g=0;g<a.length;g++)a[g].to<=i&&a.splice(g--,1);for(;o<s.length&&s[o].from<=i&&s[o].to>i;)a.push(s[o++]);let m=i+f.nodeSize;if(f.isText){let g=m;o<s.length&&s[o].from<g&&(g=s[o].from);for(let v=0;v<a.length;v++)a[v].to<g&&(g=a[v].to);g<m&&(l=f.cut(g-i),f=f.cut(0,g-i),m=g,h=-1)}else for(;o<s.length&&s[o].to<m;)o++;let y=f.isInline&&!f.isLeaf?a.filter(g=>!g.inline):a.slice();r(f,y,e.forChild(i,f),h),i=m}}function Eb(n){if(n.nodeName=="UL"||n.nodeName=="OL"){let e=n.style.cssText;n.style.cssText=e+"; list-style: square !important",window.getComputedStyle(n).listStyle,n.style.cssText=e}}function Tb(n,e,t,r){for(let s=0,i=0;s<n.childCount&&i<=r;){let o=n.child(s++),a=i;if(i+=o.nodeSize,!o.isText)continue;let l=o.text;for(;s<n.childCount;){let c=n.child(s++);if(i+=c.nodeSize,!c.isText)break;l+=c.text}if(i>=t){if(i>=r&&l.slice(r-e.length-a,r-a)==e)return r-e.length;let c=a<r?l.lastIndexOf(e,r-a-1):-1;if(c>=0&&c+e.length+a>=t)return a+c;if(t==r&&l.length>=r+e.length-a&&l.slice(r-a,r-a+e.length)==e)return r}}return-1}function Wo(n,e,t,r,s){let i=[];for(let o=0,a=0;o<n.length;o++){let l=n[o],c=a,u=a+=l.size;c>=t||u<=e?i.push(l):(c<e&&i.push(l.slice(0,e-c,r)),s&&(i.push(s),s=void 0),u>t&&i.push(l.slice(t-c,l.size,r)))}return i}function _a(n,e=null){let t=n.domSelectionRange(),r=n.state.doc;if(!t.focusNode)return null;let s=n.docView.nearestDesc(t.focusNode),i=s&&s.size==0,o=n.docView.posFromDOM(t.focusNode,t.focusOffset,1);if(o<0)return null;let a=r.resolve(o),l,c;if(wi(t)){for(l=o;s&&!s.node;)s=s.parent;let d=s.node;if(s&&d.isAtom&&L.isSelectable(d)&&s.parent&&!(d.isInline&&tb(t.focusNode,t.focusOffset,s.dom))){let f=s.posBefore;c=new L(o==f?a:r.resolve(f))}}else{if(t instanceof n.dom.ownerDocument.defaultView.Selection&&t.rangeCount>1){let d=o,f=o;for(let h=0;h<t.rangeCount;h++){let m=t.getRangeAt(h);d=Math.min(d,n.docView.posFromDOM(m.startContainer,m.startOffset,1)),f=Math.max(f,n.docView.posFromDOM(m.endContainer,m.endOffset,-1))}if(d<0)return null;[l,o]=f==n.state.selection.anchor?[f,d]:[d,f],a=r.resolve(o)}else l=n.docView.posFromDOM(t.anchorNode,t.anchorOffset,1);if(l<0)return null}let u=r.resolve(l);if(!c){let d=e=="pointer"||n.state.selection.head<a.pos&&!i?1:-1;c=Ia(n,u,a,d)}return c}function sf(n){return n.editable?n.hasFocus():af(n)&&document.activeElement&&document.activeElement.contains(n.dom)}function wt(n,e=!1){let t=n.state.selection;
vendor: 8,511 bytes, line 130
130if(of(n,t),!!sf(n)){if(!e&&n.input.mouseDown&&n.input.mouseDown.allowDefault&&Ee){let r=n.domSelectionRange(),s=n.domObserver.currentSelection;if(r.anchorNode&&s.anchorNode&&wn(r.anchorNode,r.anchorOffset,s.anchorNode,s.anchorOffset)){n.input.mouseDown.delayedSelectionSync=!0,n.domObserver.setCurSelection();return}}if(n.domObserver.disconnectSelection(),n.cursorWrapper)Ob(n);else{let{anchor:r,head:s}=t,i,o;bc&&!(t instanceof $)&&(t.$from.parent.inlineContent||(i=vc(n,t.from)),!t.empty&&!t.$from.parent.inlineContent&&(o=vc(n,t.to))),n.docView.setSelection(r,s,n,e),bc&&(i&&xc(i),o&&xc(o)),t.visible?n.dom.classList.remove("ProseMirror-hideselection"):(n.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&Ab(n))}n.domObserver.setCurSelection(),n.domObserver.connectSelection()}}const bc=Oe||Ee&&Ud<63;function vc(n,e){let{node:t,offset:r}=n.docView.domFromPos(e,0),s=r<t.childNodes.length?t.childNodes[r]:null,i=r?t.childNodes[r-1]:null;if(Oe&&s&&s.contentEditable=="false")return ao(s);if((!s||s.contentEditable=="false")&&(!i||i.contentEditable=="false")){if(s)return ao(s);if(i)return ao(i)}}function ao(n){return n.contentEditable="true",Oe&&n.draggable&&(n.draggable=!1,n.wasDraggable=!0),n}function xc(n){n.contentEditable="false",n.wasDraggable&&(n.draggable=!0,n.wasDraggable=null)}function Ab(n){let e=n.dom.ownerDocument;e.removeEventListener("selectionchange",n.input.hideSelectionGuard);let t=n.domSelectionRange(),r=t.anchorNode,s=t.anchorOffset;e.addEventListener("selectionchange",n.input.hideSelectionGuard=()=>{(t.anchorNode!=r||t.anchorOffset!=s)&&(e.removeEventListener("selectionchange",n.input.hideSelectionGuard),setTimeout(()=>{(!sf(n)||n.state.selection.visible)&&n.dom.classList.remove("ProseMirror-hideselection")},20))})}function Ob(n){let e=n.domSelection();if(!e)return;let t=n.cursorWrapper.dom,r=t.nodeName=="IMG";r?e.collapse(t.parentNode,Me(t)+1):e.collapse(t,0),!r&&!n.state.selection.visible&&We&&$t<=11&&(t.disabled=!0,t.disabled=!1)}function of(n,e){if(e instanceof L){let t=n.docView.descAt(e.from);t!=n.lastSelectedViewDesc&&(kc(n),t&&t.selectNode(),n.lastSelectedViewDesc=t)}else kc(n)}function kc(n){n.lastSelectedViewDesc&&(n.lastSelectedViewDesc.parent&&n.lastSelectedViewDesc.deselectNode(),n.lastSelectedViewDesc=void 0)}function Ia(n,e,t,r){return n.someProp("createSelectionBetween",s=>s(n,e,t))||$.between(e,t,r)}function wc(n){return n.editable&&!n.hasFocus()?!1:af(n)}function af(n){let e=n.domSelectionRange();if(!e.anchorNode)return!1;try{return n.dom.contains(e.anchorNode.nodeType==3?e.anchorNode.parentNode:e.anchorNode)&&(n.editable||n.dom.contains(e.focusNode.nodeType==3?e.focusNode.parentNode:e.focusNode))}catch{return!1}}function Db(n){let e=n.docView.domFromPos(n.state.selection.anchor,0),t=n.domSelectionRange();return wn(e.node,e.offset,t.anchorNode,t.anchorOffset)}function Uo(n,e){let{$anchor:t,$head:r}=n.selection,s=e>0?t.max(r):t.min(r),i=s.parent.inlineContent?s.depth?n.doc.resolve(e>0?s.after():s.before()):null:s;return i&&W.findFrom(i,e)}function Rt(n,e){return n.dispatch(n.state.tr.setSelection(e).scrollIntoView()),!0}function Sc(n,e,t){let r=n.state.selection;if(r instanceof $)if(t.indexOf("s")>-1){let{$head:s}=r,i=s.textOffset?null:e<0?s.nodeBefore:s.nodeAfter;if(!i||i.isText||!i.isLeaf)return!1;let o=n.state.doc.resolve(s.pos+i.nodeSize*(e<0?-1:1));return Rt(n,new $(r.$anchor,o))}else if(r.empty){if(n.endOfTextblock(e>0?"forward":"backward")){let s=Uo(n.state,e);return s&&s instanceof L?Rt(n,s):!1}else if(!(Ye&&t.indexOf("m")>-1)){let s=r.$head,i=s.textOffset?null:e<0?s.nodeBefore:s.nodeAfter,o;if(!i||i.isText)return!1;let a=e<0?s.pos-i.nodeSize:s.pos;return i.isAtom||(o=n.docView.descAt(a))&&!o.contentDOM?L.isSelectable(i)?Rt(n,new L(e<0?n.state.doc.resolve(s.pos-i.nodeSize):s)):Vr?Rt(n,new $(n.state.doc.resolve(e<0?a:a+i.nodeSize))):!1:!1}}else return!1;else{if(r instanceof L&&r.node.isInline)return Rt(n,new $(e>0?r.$to:r.$from));{let s=Uo(n.state,e);return s?Rt(n,s):!1}}}function Ds(n){return n.nodeType==3?n.nodeValue.length:n.childNodes.length}function gr(n,e){let t=n.pmViewDesc;return t&&t.size==0&&(e<0||n.nextSibling||n.nodeName!="BR")}function Rn(n,e){return e<0?Rb(n):_b(n)}function Rb(n){let e=n.domSelectionRange(),t=e.focusNode,r=e.focusOffset;if(!t)return;let s,i,o=!1;for(Qe&&t.nodeType==1&&r<Ds(t)&&gr(t.childNodes[r],-1)&&(o=!0);;)if(r>0){if(t.nodeType!=1)break;{let a=t.childNodes[r-1];if(gr(a,-1))s=t,i=--r;else if(a.nodeType==3)t=a,r=t.nodeValue.length;else break}}else{if(lf(t))break;{let a=t.previousSibling;for(;a&&gr(a,-1);)s=t.parentNode,i=Me(a),a=a.previousSibling;if(a)t=a,r=Ds(t);else{if(t=t.parentNode,t==n.dom)break;r=0}}}o?qo(n,t,r):s&&qo(n,s,i)}function _b(n){let e=n.domSelectionRange(),t=e.focusNode,r=e.focusOffset;if(!t)return;let s=Ds(t),i,o;for(;;)if(r<s){if(t.nodeType!=1)break;let a=t.childNodes[r];if(gr(a,1))i=t,o=++r;else break}else{if(lf(t))break;{let a=t.nextSibling;for(;a&&gr(a,1);)i=a.parentNode,o=Me(a)+1,a=a.nextSibling;if(a)t=a,r=0,s=Ds(t);else{if(t=t.parentNode,t==n.dom)break;r=s=0}}}i&&qo(n,i,o)}function lf(n){let e=n.pmViewDesc;return e&&e.node&&e.node.isBlock}function Ib(n,e){for(;n&&e==n.childNodes.length&&!Hr(n);)e=Me(n)+1,n=n.parentNode;for(;n&&e<n.childNodes.length;){let t=n.childNodes[e];if(t.nodeType==3)return t;if(t.nodeType==1&&t.contentEditable=="false")break;n=t,e=0}}function Pb(n,e){for(;n&&!e&&!Hr(n);)e=Me(n),n=n.parentNode;for(;n&&e;){let t=n.childNodes[e-1];if(t.nodeType==3)return t;if(t.nodeType==1&&t.contentEditable=="false")break;n=t,e=n.childNodes.length}}function qo(n,e,t){if(e.nodeType!=3){let i,o;(o=Ib(e,t))?(e=o,t=0):(i=Pb(e,t))&&(e=i,t=i.nodeValue.length)}let r=n.domSelection();if(!r)return;if(wi(r)){let i=document.createRange();i.setEnd(e,t),i.setStart(e,t),r.removeAllRanges(),r.addRange(i)}else r.extend&&r.extend(e,t);n.domObserver.setCurSelection();let{state:s}=n;setTimeout(()=>{n.state==s&&wt(n)},50)}function Cc(n,e){let t=n.state.doc.resolve(e);if(!(Ee||qd)&&t.parent.inlineContent){let s=n.coordsAtPos(e);if(e>t.start()){let i=n.coordsAtPos(e-1),o=(i.top+i.bottom)/2;if(o>s.top&&o<s.bottom&&Math.abs(i.left-s.left)>1)return i.left<s.left?"ltr":"rtl"}if(e<t.end()){let i=n.coordsAtPos(e+1),o=(i.top+i.bottom)/2;if(o>s.top&&o<s.bottom&&Math.abs(i.left-s.left)>1)return i.left>s.left?"ltr":"rtl"}}return getComputedStyle(n.dom).direction=="rtl"?"rtl":"ltr"}function Mc(n,e,t){let r=n.state.selection;if(r instanceof $&&!r.empty||t.indexOf("s")>-1||Ye&&t.indexOf("m")>-1)return!1;let{$from:s,$to:i}=r;if(!s.parent.inlineContent||n.endOfTextblock(e<0?"up":"down")){let o=Uo(n.state,e);if(o&&o instanceof L)return Rt(n,o)}if(!s.parent.inlineContent){let o=e<0?s:i,a=r instanceof Xe?W.near(o,e):W.findFrom(o,e);return a?Rt(n,a):!1}return!1}function Nc(n,e){if(!(n.state.selection instanceof $))return!0;let{$head:t,$anchor:r,empty:s}=n.state.selection;if(!t.sameParent(r))return!0;if(!s)return!1;if(n.endOfTextblock(e>0?"forward":"backward"))return!0;let i=!t.textOffset&&(e<0?t.nodeBefore:t.nodeAfter);if(i&&!i.isText){let o=n.state.tr;return e<0?o.delete(t.pos-i.nodeSize,t.pos):o.delete(t.pos,t.pos+i.nodeSize),n.dispatch(o),!0}return!1}function Ec(n,e,t){n.domObserver.stop(),e.contentEditable=t,n.domObserver.start()}function jb(n){if(!Oe||n.state.selection.$head.parentOffset>0)return!1;let{focusNode:e,focusOffset:t}=n.domSelectionRange();if(e&&e.nodeType==1&&t==0&&e.firstChild&&e.firstChild.contentEditable=="false"){let r=e.firstChild;Ec(n,r,"true"),setTimeout(()=>Ec(n,r,"false"),20)}return!1}function Lb(n){let e="";return n.ctrlKey&&(e+="c"),n.metaKey&&(e+="m"),n.altKey&&(e+="a"),n.shiftKey&&(e+="s"),e}function Bb(n,e){let t=e.keyCode,r=Lb(e);if(t==8||Ye&&t==72&&r=="c")return Nc(n,-1)||Rn(n,-1);if(t==46&&!e.shiftKey||Ye&&t==68&&r=="c")return Nc(n,1)||Rn(n,1);if(t==13||t==27)return!0;if(t==37||Ye&&t==66&&r=="c"){let s=t==37?Cc(n,n.state.selection.from)=="ltr"?-1:1:-1;return Sc(n,s,r)||Rn(n,s)}else if(t==39||Ye&&t==70&&r=="c"){let s=t==39?Cc(n,n.state.selection.from)=="ltr"?1:-1:1;return Sc(n,s,r)||Rn(n,s)}else{if(t==38||Ye&&t==80&&r=="c")return Mc(n,-1,r)||Rn(n,-1);if(t==40||Ye&&t==78&&r=="c")return jb(n)||Mc(n,1,r)||Rn(n,1);if(r==(Ye?"m":"c")&&(t==66||t==73||t==89||t==90))return!0}return!1}function Pa(n,e){n.someProp("transformCopied",h=>{e=h(e,n)});let t=[],{content:r,openStart:s,openEnd:i}=e;for(;s>1&&i>1&&r.childCount==1&&r.firstChild.childCount==1;){s--,i--;let h=r.firstChild;t.push(h.type.name,h.attrs!=h.type.defaultAttrs?h.attrs:null),r=h.content}
vendor: 4,529 bytes, lines 130-133
130let o=n.someProp("clipboardSerializer")||Mn.fromSchema(n.state.schema),a=pf(),l=a.createElement("div");l.appendChild(o.serializeFragment(r,{document:a}));let c=l.firstChild,u,d=0;for(;c&&c.nodeType==1&&(u=hf[c.nodeName.toLowerCase()]);){for(let h=u.length-1;h>=0;h--){let m=a.createElement(u[h]);for(;l.firstChild;)m.appendChild(l.firstChild);l.appendChild(m),d++}c=l.firstChild}c&&c.nodeType==1&&c.setAttribute("data-pm-slice",`${s} ${i}${d?` -${d}`:""} ${JSON.stringify(t)}`);let f=n.someProp("clipboardTextSerializer",h=>h(e,n))||e.content.textBetween(0,e.content.size,` 131 132`);return{dom:l,text:f,slice:e}}function cf(n,e,t,r,s){let i=s.parent.type.spec.code,o,a;if(!t&&!e)return null;let l=!!e&&(r||i||!t);if(l){if(n.someProp("transformPastedText",f=>{e=f(e,i||r,n)}),i)return a=new R(C.from(n.state.schema.text(e.replace(/\r\n?/g,` 133`))),0,0),n.someProp("transformPasted",f=>{a=f(a,n,!0)}),a;let d=n.someProp("clipboardTextParser",f=>f(e,s,r,n));if(d)a=d;else{let f=s.marks(),{schema:h}=n.state,m=Mn.fromSchema(h);o=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach(y=>{let g=o.appendChild(document.createElement("p"));y&&g.appendChild(m.serializeNode(h.text(y,f)))})}}else n.someProp("transformPastedHTML",d=>{t=d(t,n)}),o=Hb(t),Vr&&Vb(o);let c=o&&o.querySelector("[data-pm-slice]"),u=c&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(c.getAttribute("data-pm-slice")||"");if(u&&u[3])for(let d=+u[3];d>0;d--){let f=o.firstChild;for(;f&&f.nodeType!=1;)f=f.nextSibling;if(!f)break;o=f}if(a||(a=(n.someProp("clipboardParser")||n.someProp("domParser")||Ft.fromSchema(n.state.schema)).parseSlice(o,{preserveWhitespace:!!(l||u),context:s,ruleFromNode(f){return f.nodeName=="BR"&&!f.nextSibling&&f.parentNode&&!zb.test(f.parentNode.nodeName)?{ignore:!0}:null}})),u)a=Wb(Tc(a,+u[1],+u[2]),u[4]);else if(a=R.maxOpen(Fb(a.content,s),!0),a.openStart||a.openEnd){let d=0,f=0;for(let h=a.content.firstChild;d<a.openStart&&!h.type.spec.isolating;d++,h=h.firstChild);for(let h=a.content.lastChild;f<a.openEnd&&!h.type.spec.isolating;f++,h=h.lastChild);a=Tc(a,d,f)}return n.someProp("transformPasted",d=>{a=d(a,n,l)}),a}const zb=/^(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 Fb(n,e){if(n.childCount<2)return n;for(let t=e.depth;t>=0;t--){let s=e.node(t).contentMatchAt(e.index(t)),i,o=[];if(n.forEach(a=>{if(!o)return;let l=s.findWrapping(a.type),c;if(!l)return o=null;if(c=o.length&&i.length&&df(l,i,a,o[o.length-1],0))o[o.length-1]=c;else{o.length&&(o[o.length-1]=ff(o[o.length-1],i.length));let u=uf(a,l);o.push(u),s=s.matchType(u.type),i=l}}),o)return C.from(o)}return n}function uf(n,e,t=0){for(let r=e.length-1;r>=t;r--)n=e[r].create(null,C.from(n));return n}function df(n,e,t,r,s){if(s<n.length&&s<e.length&&n[s]==e[s]){let i=df(n,e,t,r.lastChild,s+1);if(i)return r.copy(r.content.replaceChild(r.childCount-1,i));if(r.contentMatchAt(r.childCount).matchType(s==n.length-1?t.type:n[s+1]))return r.copy(r.content.append(C.from(uf(t,n,s+1))))}}function ff(n,e){if(e==0)return n;let t=n.content.replaceChild(n.childCount-1,ff(n.lastChild,e-1)),r=n.contentMatchAt(n.childCount).fillBefore(C.empty,!0);return n.copy(t.append(r))}function Ko(n,e,t,r,s,i){let o=e<0?n.firstChild:n.lastChild,a=o.content;return n.childCount>1&&(i=0),s<r-1&&(a=Ko(a,e,t,r,s+1,i)),s>=t&&(a=e<0?o.contentMatchAt(0).fillBefore(a,i<=s).append(a):a.append(o.contentMatchAt(o.childCount).fillBefore(C.empty,!0))),n.replaceChild(e<0?0:n.childCount-1,o.copy(a))}function Tc(n,e,t){return e<n.openStart&&(n=new R(Ko(n.content,-1,e,n.openStart,0,n.openEnd),e,n.openEnd)),t<n.openEnd&&(n=new R(Ko(n.content,1,t,n.openEnd,0,0),n.openStart,t)),n}const hf={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 Ac=null;function pf(){return Ac||(Ac=document.implementation.createHTMLDocument("title"))}let lo=null;function $b(n){let e=window.trustedTypes;return e?(lo||(lo=e.defaultPolicy||e.createPolicy("ProseMirrorClipboard",{createHTML:t=>t})),lo.createHTML(n)):n}function Hb(n){let e=/^(\s*<meta [^>]*>)*/.exec(n);e&&(n=n.slice(e[0].length));let t=pf().createElement("div"),r=/<([a-z][^>\s]+)/i.exec(n),s;if((s=r&&hf[r[1].toLowerCase()])&&(n=s.map(i=>"<"+i+">").join("")+n+s.map(i=>"</"+i+">").reverse().join("")),t.innerHTML=$b(n),s)for(let i=0;i<s.length;i++)t=t.querySelector(s[i])||t;return t}function Vb(n){let e=n.querySelectorAll(Ee?"span:not([class]):not
133([style])":"span.Apple-converted-space");for(let t=0;t<e.length;t++){let r=e[t];r.childNodes.length==1&&r.textContent=="Â "&&r.parentNode&&r.parentNode.replaceChild(n.ownerDocument.createTextNode(" "),r)}}function Wb(n,e){if(!n.size)return n;let t=n.content.firstChild.type.schema,r;try{r=JSON.parse(e)}catch{return n}let{content:s,openStart:i,openEnd:o}=n;for(let a=r.length-2;a>=0;a-=2){let l=t.nodes[r[a]];if(!l||l.hasRequiredAttrs())break;s=C.from(l.create(r[a+1],s)),i++,o++}return new R(s,i,o)}const je={},Le={},Ub={touchstart:!0,touchmove:!0};class qb{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.badSafariComposition=!1,this.compositionPendingChanges=0,this.domChangeCount=0,this.eventHandlers=Object.create(null),this.hideSelectionGuard=null}}function Kb(n){for(let e in je){let t=je[e];n.dom.addEventListener(e,n.input.eventHandlers[e]=r=>{Yb(n,r)&&!ja(n,r)&&(n.editable||!(r.type in Le))&&t(n,r)},Ub[e]?{passive:!0}:void 0)}Oe&&n.dom.addEventListener("input",()=>null),Jo(n)}function zt(n,e){n.input.lastSelectionOrigin=e,n.input.lastSelectionTime=Date.now()}function Jb(n){n.domObserver.stop();for(let e in n.input.eventHandlers)n.dom.removeEventListener(e,n.input.eventHandlers[e]);clearTimeout(n.input.composingTimeout),clearTimeout(n.input.lastIOSEnterFallbackTimeout)}function Jo(n){n.someProp("handleDOMEvents",e=>{for(let t in e)n.input.eventHandlers[t]||n.dom.addEventListener(t,n.input.eventHandlers[t]=r=>ja(n,r))})}function ja(n,e){return n.someProp("handleDOMEvents",t=>{let r=t[e.type];return r?r(n,e)||e.defaultPrevented:!1})}function Yb(n,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let t=e.target;t!=n.dom;t=t.parentNode)if(!t||t.nodeType==11||t.pmViewDesc&&t.pmViewDesc.stopEvent(e))return!1;return!0}function Gb(n,e){!ja(n,e)&&je[e.type]&&(n.editable||!(e.type in Le))&&je[e.type](n,e)}Le.keydown=(n,e)=>{let t=e;if(n.input.shiftKey=t.keyCode==16||t.shiftKey,!gf(n,t)&&(n.input.lastKeyCode=t.keyCode,n.input.lastKeyCodeTime=Date.now(),!(kt&&Ee&&t.keyCode==13)))if(t.keyCode!=229&&n.domObserver.forceFlush(),qn&&t.keyCode==13&&!t.ctrlKey&&!t.altKey&&!t.metaKey){let r=Date.now();n.input.lastIOSEnter=r,n.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{n.input.lastIOSEnter==r&&(n.someProp("handleKeyDown",s=>s(n,ln(13,"Enter"))),n.input.lastIOSEnter=0)},200)}else n.someProp("handleKeyDown",r=>r(n,t))||Bb(n,t)?t.preventDefault():zt(n,"key")};Le.keyup=(n,e)=>{e.keyCode==16&&(n.input.shiftKey=!1)};Le.keypress=(n,e)=>{let t=e;if(gf(n,t)||!t.charCode||t.ctrlKey&&!t.altKey||Ye&&t.metaKey)return;if(n.someProp("handleKeyPress",s=>s(n,t))){t.preventDefault();return}let r=n.state.selection;if(!(r instanceof $)||!r.$from.sameParent(r.$to)){let s=String.fromCharCode(t.charCode),i=()=>n.state.tr.insertText(s).scrollIntoView();!/[\r\n]/.test(s)&&!n.someProp("handleTextInput",o=>o(n,r.$from.pos,r.$to.pos,s,i))&&n.dispatch(i()),t.preventDefault()}};function Ci(n){return{left:n.clientX,top:n.clientY}}function Xb(n,e){let t=e.x-n.clientX,r=e.y-n.clientY;return t*t+r*r<100}function La(n,e,t,r,s){if(r==-1)return!1;let i=n.state.doc.resolve(r);for(let o=i.depth+1;o>0;o--)if(n.someProp(e,a=>o>i.depth?a(n,t,i.nodeAfter,i.before(o),s,!0):a(n,t,i.node(o),i.before(o),s,!1)))return!0;return!1}function zn(n,e,t){if(n.focused||n.focus(),n.state.selection.eq(e))return;let r=n.state.tr.setSelection(e);r.setMeta("pointer",!0),n.dispatch(r)}function Qb(n,e){if(e==-1)return!1;let t=n.state.doc.resolve(e),r=t.nodeAfter;return r&&r.isAtom&&L.isSelectable(r)?(zn(n,new L(t)),!0):!1}function Zb(n,e){if(e==-1)return!1;let t=n.state.selection,r,s;t instanceof L&&(r=t.node);let i=n.state.doc.resolve(e);for(let o=i.depth+1;o>0;o--){let a=o>i.depth?i.nodeAfter:i.node(o);if(L.isSelectable(a)){r&&t.$from.depth>0&&o>=t.$from.depth&&i.before(t.$from.depth+1)==t.$from.pos?s=i.before(t.$from.depth):s=i.before(o);break}}return s!=null?(zn(n,L.create(n.state.doc,s)),!0):!1}function ev(n,e,t,r,s){return La(n,"handleClickOn",e,t,r)||n.someProp("handleClick",i=>i(n,e,r))||(s?Zb(n,t):Qb(n,t))}function tv(n,e,t,r){return La(n,"handleDoubleClickOn",e,t,r)||n.someProp("handleDoubleClick",
vendor: 5,635 bytes, line 133
133s=>s(n,e,r))}function nv(n,e,t,r){return La(n,"handleTripleClickOn",e,t,r)||n.someProp("handleTripleClick",s=>s(n,e,r))||rv(n,t,r)}function rv(n,e,t){if(t.button!=0)return!1;let r=n.state.doc;if(e==-1)return r.inlineContent?(zn(n,$.create(r,0,r.content.size)),!0):!1;let s=r.resolve(e);for(let i=s.depth+1;i>0;i--){let o=i>s.depth?s.nodeAfter:s.node(i),a=s.before(i);if(o.inlineContent)zn(n,$.create(r,a+1,a+1+o.content.size));else if(L.isSelectable(o))zn(n,L.create(r,a));else continue;return!0}}function Ba(n){return Rs(n)}const mf=Ye?"metaKey":"ctrlKey";je.mousedown=(n,e)=>{let t=e;n.input.shiftKey=t.shiftKey;let r=Ba(n),s=Date.now(),i="singleClick";s-n.input.lastClick.time<500&&Xb(t,n.input.lastClick)&&!t[mf]&&n.input.lastClick.button==t.button&&(n.input.lastClick.type=="singleClick"?i="doubleClick":n.input.lastClick.type=="doubleClick"&&(i="tripleClick")),n.input.lastClick={time:s,x:t.clientX,y:t.clientY,type:i,button:t.button};let o=n.posAtCoords(Ci(t));o&&(i=="singleClick"?(n.input.mouseDown&&n.input.mouseDown.done(),n.input.mouseDown=new sv(n,o,t,!!r)):(i=="doubleClick"?tv:nv)(n,o.pos,o.inside,t)?t.preventDefault():zt(n,"pointer"))};class sv{constructor(e,t,r,s){this.view=e,this.pos=t,this.event=r,this.flushed=s,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=e.state.doc,this.selectNode=!!r[mf],this.allowDefault=r.shiftKey;let i,o;if(t.inside>-1)i=e.state.doc.nodeAt(t.inside),o=t.inside;else{let u=e.state.doc.resolve(t.pos);i=u.parent,o=u.depth?u.before():0}const a=s?null:r.target,l=a?e.docView.nearestDesc(a,!0):null;this.target=l&&l.nodeDOM.nodeType==1?l.nodeDOM:null;let{selection:c}=e.state;r.button==0&&(i.type.spec.draggable&&i.type.spec.selectable!==!1||c instanceof L&&c.from<=o&&c.to>o)&&(this.mightDrag={node:i,pos:o,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&Qe&&!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)),zt(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(()=>wt(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(Ci(e))),this.updateAllowDefault(e),this.allowDefault||!t?zt(this.view,"pointer"):ev(this.view,t.pos,t.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||Oe&&this.mightDrag&&!this.mightDrag.node.isAtom||Ee&&!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)?(zn(this.view,W.near(this.view.state.doc.resolve(t.pos))),e.preventDefault()):zt(this.view,"pointer")}move(e){this.updateAllowDefault(e),zt(this.view,"pointer"),e.buttons==0&&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)}}je.touchstart=n=>{n.input.lastTouch=Date.now(),Ba(n),zt(n,"pointer")};je.touchmove=n=>{n.input.lastTouch=Date.now(),zt(n,"pointer")};je.contextmenu=n=>Ba(n);function gf(n,e){return n.composing?!0:Oe&&Math.abs(e.timeStamp-n.input.compositionEndedAt)<500?(n.input.compositionEndedAt=-2e8,!0):!1}const iv=kt?5e3:-1;Le.compositionstart=Le.compositionupdate=n=>{if(!n.composing){n.domObserver.flush();let{state:e}=n,t=e.selection.$to;if(e.selection instanceof $&&(e.storedMarks||!t.textOffset&&t.parentOffset&&t.nodeBefore.marks.some(r=>r.type.spec.inclusive===!1)||Ee&&qd&&ov(n)))n.markCursor=n.state.storedMarks||t.marks(),Rs(n,!0),n.markCursor=null;else if(Rs(n,!e.selection.empty),Qe&&e.selection.empty&&t.parentOffset&&!t.textOffset&&t.nodeBefore.marks.length){let r=n.domSelectionRange();for(let s=r.focusNode,i=r.focusOffset;s&&s.nodeType==1&&i!=0;){let o=i<0?s.lastChild:s.childNodes[i-1];if(!o)break;if(o.nodeType==3){let a=n.domSelection();a&&a.collapse(o,o.nodeValue.length);break}else s=o,i=-1}}n.input.composing=!0}yf(n,iv)};function ov(n){let{focusNode:e,focusOffset:t}=n.domSelectionRange();if(!e||e.nodeType!=1||t>=e.childNodes.length)return!1;let r=e.childNodes[t];return r.nodeType==1&&r.contentEditable=="false"}Le.compositionend=(n,e)=>{n.composing&&(n.input.composing=!1,n.input.compositionEndedAt=e.timeStamp,n.input.compositionPendingChanges=n.domObserver.pendingRecords().length?n.input.compositionID:0,n.input.compositionNode=null,n.input.badSafariComposition?n.domObserver.forceFlush():n.input.compositionPendingChanges&&Promise.resolve().then(()=>n.domObserver.flush()),n.input.compositionID++,yf(n,20))};function yf(n,e){clearTimeout(n.input.composingTimeout),e>-1&&(n.input.composingTimeout=setTimeout(()=>Rs(n),e))}function bf(n){for(n.composing&&(n.input.composing=!1,n.input.compositionEndedAt=lv());n.input.compositionNodes.length>0;)n.input.compositionNodes.pop().markParentsDirty()}function av(n){let e=n.domSelectionRange();if(!e.focusNode)return null;
vendor: 4,581 bytes, line 133
133let t=Z0(e.focusNode,e.focusOffset),r=eb(e.focusNode,e.focusOffset);if(t&&r&&t!=r){let s=r.pmViewDesc,i=n.domObserver.lastChangedTextNode;if(t==i||r==i)return i;if(!s||!s.isText(r.nodeValue))return r;if(n.input.compositionNode==r){let o=t.pmViewDesc;if(!(!o||!o.isText(t.nodeValue)))return r}}return t||r}function lv(){let n=document.createEvent("Event");return n.initEvent("event",!0,!0),n.timeStamp}function Rs(n,e=!1){if(!(kt&&n.domObserver.flushingSoon>=0)){if(n.domObserver.forceFlush(),bf(n),e||n.docView&&n.docView.dirty){let t=_a(n),r=n.state.selection;return t&&!t.eq(r)?n.dispatch(n.state.tr.setSelection(t)):(n.markCursor||e)&&!r.$from.node(r.$from.sharedDepth(r.to)).inlineContent?n.dispatch(n.state.tr.deleteSelection()):n.updateState(n.state),!0}return!1}}function cv(n,e){if(!n.dom.parentNode)return;let t=n.dom.parentNode.appendChild(document.createElement("div"));t.appendChild(e),t.style.cssText="position: fixed; left: -10000px; top: 10px";let r=getSelection(),s=document.createRange();s.selectNodeContents(e),n.dom.blur(),r.removeAllRanges(),r.addRange(s),setTimeout(()=>{t.parentNode&&t.parentNode.removeChild(t),n.focus()},50)}const Or=We&&$t<15||qn&&sb<604;je.copy=Le.cut=(n,e)=>{let t=e,r=n.state.selection,s=t.type=="cut";if(r.empty)return;let i=Or?null:t.clipboardData,o=r.content(),{dom:a,text:l}=Pa(n,o);i?(t.preventDefault(),i.clearData(),i.setData("text/html",a.innerHTML),i.setData("text/plain",l)):cv(n,a),s&&n.dispatch(n.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function uv(n){return n.openStart==0&&n.openEnd==0&&n.content.childCount==1?n.content.firstChild:null}function dv(n,e){if(!n.dom.parentNode)return;let t=n.input.shiftKey||n.state.selection.$from.parent.type.spec.code,r=n.dom.parentNode.appendChild(document.createElement(t?"textarea":"div"));t||(r.contentEditable="true"),r.style.cssText="position: fixed; left: -10000px; top: 10px",r.focus();let s=n.input.shiftKey&&n.input.lastKeyCode!=45;setTimeout(()=>{n.focus(),r.parentNode&&r.parentNode.removeChild(r),t?Dr(n,r.value,null,s,e):Dr(n,r.textContent,r.innerHTML,s,e)},50)}function Dr(n,e,t,r,s){let i=cf(n,e,t,r,n.state.selection.$from);if(n.someProp("handlePaste",l=>l(n,s,i||R.empty)))return!0;if(!i)return!1;let o=uv(i),a=o?n.state.tr.replaceSelectionWith(o,r):n.state.tr.replaceSelection(i);return n.dispatch(a.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function vf(n){let e=n.getData("text/plain")||n.getData("Text");if(e)return e;let t=n.getData("text/uri-list");return t?t.replace(/\r?\n/g," "):""}Le.paste=(n,e)=>{let t=e;if(n.composing&&!kt)return;let r=Or?null:t.clipboardData,s=n.input.shiftKey&&n.input.lastKeyCode!=45;r&&Dr(n,vf(r),r.getData("text/html"),s,t)?t.preventDefault():dv(n,t)};class xf{constructor(e,t,r){this.slice=e,this.move=t,this.node=r}}const fv=Ye?"altKey":"ctrlKey";function kf(n,e){let t;return n.someProp("dragCopies",r=>{t=t||r(e)}),t!=null?!t:!e[fv]}je.dragstart=(n,e)=>{let t=e,r=n.input.mouseDown;if(r&&r.done(),!t.dataTransfer)return;let s=n.state.selection,i=s.empty?null:n.posAtCoords(Ci(t)),o;if(!(i&&i.pos>=s.from&&i.pos<=(s instanceof L?s.to-1:s.to))){if(r&&r.mightDrag)o=L.create(n.state.doc,r.mightDrag.pos);else if(t.target&&t.target.nodeType==1){let d=n.docView.nearestDesc(t.target,!0);d&&d.node.type.spec.draggable&&d!=n.docView&&(o=L.create(n.state.doc,d.posBefore))}}let a=(o||n.state.selection).content(),{dom:l,text:c,slice:u}=Pa(n,a);(!t.dataTransfer.files.length||!Ee||Ud>120)&&t.dataTransfer.clearData(),t.dataTransfer.setData(Or?"Text":"text/html",l.innerHTML),t.dataTransfer.effectAllowed="copyMove",Or||t.dataTransfer.setData("text/plain",c),n.dragging=new xf(u,kf(n,t),o)};je.dragend=n=>{let e=n.dragging;window.setTimeout(()=>{n.dragging==e&&(n.dragging=null)},50)};Le.dragover=Le.dragenter=(n,e)=>e.preventDefault();Le.drop=(n,e)=>{try{hv(n,e,n.dragging)}finally{n.dragging=null}};function hv(n,e,t){if(!e.dataTransfer)return;let r=n.posAtCoords(Ci(e));if(!r)return;let s=n.state.doc.resolve(r.pos),i=t&&t.slice;i?n.someProp("transformPasted",h=>{i=h(i,n,!1)}):i=cf(n,vf(e.dataTransfer),Or?null:e.dataTransfer.getData("text/html"),!1,s);let o=!!(t&&kf(n,e));if(n.someProp("handleDrop",h=>h(n,e,i||R.empty,o))){e.preventDefault();return}if(!i)return;e.preventDefault();let a=i?Od(n.state.doc,s.pos,i):s.pos;a==null&&(a=s.pos);let l=n.state.tr;if(o){let{node:h}=t;h?h.replace(l):l.deleteSelection()}let c=l.mapping.map(a),u=i.openStart==0&&i.openEnd==0&&i.content.childCount==1,d=l.doc;if(u?l.replaceRangeWith(c,c,i.content.firstChild):l.replaceRange(c,c,i),l.doc.eq(
vendor: 9,264 bytes, line 133
133d))return;let f=l.doc.resolve(c);if(u&&L.isSelectable(i.content.firstChild)&&f.nodeAfter&&f.nodeAfter.sameMarkup(i.content.firstChild))l.setSelection(new L(f));else{let h=l.mapping.map(a);l.mapping.maps[l.mapping.maps.length-1].forEach((m,y,g,v)=>h=v),l.setSelection(Ia(n,f,l.doc.resolve(h)))}n.focus(),n.dispatch(l.setMeta("uiEvent","drop"))}je.focus=n=>{n.input.lastFocus=Date.now(),n.focused||(n.domObserver.stop(),n.dom.classList.add("ProseMirror-focused"),n.domObserver.start(),n.focused=!0,setTimeout(()=>{n.docView&&n.hasFocus()&&!n.domObserver.currentSelection.eq(n.domSelectionRange())&&wt(n)},20))};je.blur=(n,e)=>{let t=e;n.focused&&(n.domObserver.stop(),n.dom.classList.remove("ProseMirror-focused"),n.domObserver.start(),t.relatedTarget&&n.dom.contains(t.relatedTarget)&&n.domObserver.currentSelection.clear(),n.focused=!1)};je.beforeinput=(n,e)=>{if(Ee&&kt&&e.inputType=="deleteContentBackward"){n.domObserver.flushSoon();let{domChangeCount:r}=n.input;setTimeout(()=>{if(n.input.domChangeCount!=r||(n.dom.blur(),n.focus(),n.someProp("handleKeyDown",i=>i(n,ln(8,"Backspace")))))return;let{$cursor:s}=n.state.selection;s&&s.pos>0&&n.dispatch(n.state.tr.delete(s.pos-1,s.pos).scrollIntoView())},50)}};for(let n in Le)je[n]=Le[n];function Rr(n,e){if(n==e)return!0;for(let t in n)if(n[t]!==e[t])return!1;for(let t in e)if(!(t in n))return!1;return!0}class _s{constructor(e,t){this.toDOM=e,this.spec=t||gn,this.side=this.spec.side||0}map(e,t,r,s){let{pos:i,deleted:o}=e.mapResult(t.from+s,this.side<0?-1:1);return o?null:new Pe(i-r,i-r,this)}valid(){return!0}eq(e){return this==e||e instanceof _s&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&Rr(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class Vt{constructor(e,t){this.attrs=e,this.spec=t||gn}map(e,t,r,s){let i=e.map(t.from+s,this.spec.inclusiveStart?-1:1)-r,o=e.map(t.to+s,this.spec.inclusiveEnd?1:-1)-r;return i>=o?null:new Pe(i,o,this)}valid(e,t){return t.from<t.to}eq(e){return this==e||e instanceof Vt&&Rr(this.attrs,e.attrs)&&Rr(this.spec,e.spec)}static is(e){return e.type instanceof Vt}destroy(){}}class za{constructor(e,t){this.attrs=e,this.spec=t||gn}map(e,t,r,s){let i=e.mapResult(t.from+s,1);if(i.deleted)return null;let o=e.mapResult(t.to+s,-1);return o.deleted||o.pos<=i.pos?null:new Pe(i.pos-r,o.pos-r,this)}valid(e,t){let{index:r,offset:s}=e.content.findIndex(t.from),i;return s==t.from&&!(i=e.child(r)).isText&&s+i.nodeSize==t.to}eq(e){return this==e||e instanceof za&&Rr(this.attrs,e.attrs)&&Rr(this.spec,e.spec)}destroy(){}}class Pe{constructor(e,t,r){this.from=e,this.to=t,this.type=r}copy(e,t){return new Pe(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,r){return this.type.map(e,this,t,r)}static widget(e,t,r){return new Pe(e,e,new _s(t,r))}static inline(e,t,r,s){return new Pe(e,t,new Vt(r,s))}static node(e,t,r,s){return new Pe(e,t,new za(r,s))}get spec(){return this.type.spec}get inline(){return this.type instanceof Vt}get widget(){return this.type instanceof _s}}const In=[],gn={};class ie{constructor(e,t){this.local=e.length?e:In,this.children=t.length?t:In}static create(e,t){return t.length?Is(t,e,0,gn):Ae}find(e,t,r){let s=[];return this.findInner(e??0,t??1e9,s,0,r),s}findInner(e,t,r,s,i){for(let o=0;o<this.local.length;o++){let a=this.local[o];a.from<=t&&a.to>=e&&(!i||i(a.spec))&&r.push(a.copy(a.from+s,a.to+s))}for(let o=0;o<this.children.length;o+=3)if(this.children[o]<t&&this.children[o+1]>e){let a=this.children[o]+1;this.children[o+2].findInner(e-a,t-a,r,s+a,i)}}map(e,t,r){return this==Ae||e.maps.length==0?this:this.mapInner(e,t,0,0,r||gn)}mapInner(e,t,r,s,i){let o;for(let a=0;a<this.local.length;a++){let l=this.local[a].map(e,r,s);l&&l.type.valid(t,l)?(o||(o=[])).push(l):i.onRemove&&i.onRemove(this.local[a].spec)}return this.children.length?pv(this.children,o||[],e,t,r,s,i):o?new ie(o.sort(yn),In):Ae}add(e,t){return t.length?this==Ae?ie.create(e,t):this.addInner(e,t,0):this}addInner(e,t,r){let s,i=0;e.forEach((a,l)=>{let c=l+r,u;if(u=Sf(t,a,c)){for(s||(s=this.children.slice());i<s.length&&s[i]<l;)i+=3;s[i]==l?s[i+2]=s[i+2].addInner(a,u,c+1):s.splice(i,0,l,l+a.nodeSize,Is(u,a,c+1,gn)),i+=3}});let o=wf(i?Cf(t):t,-r);for(let a=0;a<o.length;a++)o[a].type.valid(e,o[a])||o.splice(a--,1);return new ie(o.length?this.local.concat(o).sort(yn):this.local,s||this.children)}remove(e){return e.length==0||this==Ae?this:this.removeInner(e,0)}removeInner(e,t){let r=this.children,s=this.local;for(let i=0;i<r.length;i+=3){let o,a=r[i]+t,l=r[i+1]+t;for(let u=0,d;u<e.length;u++)(d=e[u])&&d.from>a&&d.to<l&&(e[u]=null,(o||(o=[])).push(d));if(!o)continue;r==this.children&&(r=this.children.slice());let c=r[i+2].removeInner(o,a+1);c!=Ae?r[i+2]=c:(r.splice(i,3),i-=3)}if(s.length){for(let i=0,o;i<e.length;i++)if(o=e[i])for(let a=0;a<s.length;a++)s[a].eq(o,t)&&(s==this.local&&(s=this.local.slice()),s.splice(a--,1))}return r==this.children&&s==this.local?this:s.length||r.length?new ie(s,r):Ae}forChild(e,t){if(this==Ae)return this;if(t.isLeaf)return ie.empty;let r,s;for(let a=0;a<this.children.length;a+=3)if(this.children[a]>=e){this.children[a]==e&&(r=this.children[a+2]);break}let i=e+1,o=i+t.content.size;for(let a=0;a<this.local.length;a++){let l=this.local[a];if(l.from<o&&l.to>i&&l.type instanceof Vt){let c=Math.max(i,l.from)-i,u=Math.min(o,l.to)-i;c<u&&(s||(s=[])).push(l.copy(c,u))}}if(s){let a=new ie(s.sort(yn),In);return r?new Pt([a,r]):a}return r||Ae}eq(e){if(this==e)return!0;if(!(e instanceof ie)||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 Fa(this.localsInner(e))}localsInner(e){if(this==Ae)return In;if(e.inlineContent||!this.local.some(Vt.is))return this.local;let t=[];for(let r=0;r<this.local.length;r++)this.local[r].type instanceof Vt||t.push(this.local[r]);return t}forEachSet(e){e(this)}}ie.empty=new ie([],[]);ie.removeOverlap=Fa;const Ae=ie.empty;class Pt{constructor(e){this.members=e}map(e,t){const r=this.members.map(s=>s.map(e,t,gn));return Pt.from(r)}forChild(e,t){if(t.isLeaf)return ie.empty;let r=[];for(let s=0;s<this.members.length;s++){let i=this.members[s].forChild(e,t);i!=Ae&&(i instanceof Pt?r=r.concat(i.members):r.push(i))}return Pt.from(r)}eq(e){if(!(e instanceof Pt)||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,r=!0;for(let s=0;s<this.members.length;s++){let i=this.members[s].localsInner(e);if(i.length)if(!t)t=i;else{r&&(t=t.slice(),r=!1);for(let o=0;o<i.length;o++)t.push(i[o])}}return t?Fa(r?t:t.sort(yn)):In}static from(e){switch(e.length){case 0:return Ae;case 1:return e[0];default:return new Pt(e.every(t=>t instanceof ie)?e:e.reduce((t,r)=>t.concat(r instanceof ie?r:r.members),[]))}}forEachSet(e){for(let t=0;t<this.members.length;t++)this.members[t].forEachSet(e)}}function pv(n,e,t,r,s,i,o){let a=n.slice();for(let c=0,u=i;c<t.maps.length;c++){let d=0;t.maps[c].forEach((f,h,m,y)=>{let g=y-m-(h-f);for(let v=0;v<a.length;v+=3){let x=a[v+1];if(x<0||f>x+u-d)continue;let N=a[v]+u-d;h>=N?a[v+1]=f<=N?-2:-1:f>=u&&g&&(a[v]+=g,a[v+1]+=g)}d+=g}),u=t.maps[c].map(u,-1)}let l=!1;for(let c=0;c<a.length;c+=3)if(a[c+1]<0){if(a[c+1]==-2){l=!0,a[c+1]=-1;continue}let u=t.map(n[c]+i),d=u-s;if(d<0||d>=r.content.size){l=!0;continue}let f=t.map(n[c+1]+i,-1),h=f-s,{index:m,offset:y}=r.content.findIndex(d),g=r.maybeChild(m);if(g&&y==d&&y+g.nodeSize==h){let v=a[c+2].mapInner(t,g,u+1,n[c]+i+1,o);v!=Ae?(a[c]=d,a[c+1]=h,a[c+2]=v):(a[c+1]=-2,l=!0)}else l=!0}if(l){let c=mv(a,n,e,t,s,i,o),u=Is(c,r,0,o);e=u.local;for(let d=0;d<a.length;d+=3)a[d+1]<0&&(a.splice(d,3),d-=3);for(let d=0,f=0;d<u.children.length;d+=3){let h=u.children[d];for(;f<a.length&&a[f]<h;)f+=3;a.splice(f,0,u.children[d],u.children[d+1],u.children[d+2])}}return new ie(e.sort(yn),a)}function wf(n,e){if(!e||!n.length)return n;let t=[];for(let r=0;r<n.length;r++){let s=n[r];t.push(new Pe(s.from+e,s.to+e,s.type))}return t}function mv(n,e,t,r,s,i,o){function a(l,c){for(let u=0;u<l.local.length;u++){let d=l.local[u].map(r,s,c);d?t.push(d):o.onRemove&&o.onRemove(l.local[u].spec)}for(let u=0;u<l.children.length;u+=3)a(l.children[u+2],l.children[u]+c+1)}for(let l=0;l<n.length;l+=3)n[l+1]==-1&&a(n[l+2],e[l]+i+1);return t}function Sf(n,e,t){if(e.isLeaf)return null;let r=t+e.nodeSize,s=null;for(let i=0,o;i<n.length;i++)(o=n[i])&&o.from>t&&o.to<r&&((s||(s=[])).push(o),n[i]=null);return s}function Cf(n){let e=[];for(let t=0;t<n.length;t++)n[t]!=null&&e.push(n[t]);return e}function Is(n,e,t,r){let s=[],i=!1;e.forEach((a,l)=>{let c=Sf(n,a,l+t);if(c){i=!0;let u=Is(c,a,t+l+1,r);u!=Ae&&s.push(l,l+a.nodeSize,u)}});let o=wf(i?Cf(n):n,-t).sort(yn);for(let a=0;a<o.length;a++)o[a].type.valid(e,o[a])||(r.onRemove&&r.onRemove(o[a].spec),o.splice(a--,1));return o.length||s.length?new ie(o,s):Ae}function yn(n,e){return n.from-e.from||n.to-e.to}function Fa(n){let e=n;for(let t=0;t<e.length-1;t++){let r=e[t];if(r.from!=r.to)for(let s=t+1;
vendor: 10,616 bytes, line 133
133s<e.length;s++){let i=e[s];if(i.from==r.from){i.to!=r.to&&(e==n&&(e=n.slice()),e[s]=i.copy(i.from,r.to),Oc(e,s+1,i.copy(r.to,i.to)));continue}else{i.from<r.to&&(e==n&&(e=n.slice()),e[t]=r.copy(r.from,i.from),Oc(e,s,r.copy(i.from,r.to)));break}}}return e}function Oc(n,e,t){for(;e<n.length&&yn(t,n[e])>0;)e++;n.splice(e,0,t)}function co(n){let e=[];return n.someProp("decorations",t=>{let r=t(n.state);r&&r!=Ae&&e.push(r)}),n.cursorWrapper&&e.push(ie.create(n.state.doc,[n.cursorWrapper.deco])),Pt.from(e)}const gv={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},yv=We&&$t<=11;class bv{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 vv{constructor(e,t){this.view=e,this.handleDOMChange=t,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new bv,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.lastChangedTextNode=null,this.observer=window.MutationObserver&&new window.MutationObserver(r=>{for(let s=0;s<r.length;s++)this.queue.push(r[s]);We&&$t<=11&&r.some(s=>s.type=="childList"&&s.removedNodes.length||s.type=="characterData"&&s.oldValue.length>s.target.nodeValue.length)?this.flushSoon():Oe&&e.composing&&r.some(s=>s.type=="childList"&&s.target.nodeName=="TR")?(e.input.badSafariComposition=!0,this.flushSoon()):this.flush()}),yv&&(this.onCharData=r=>{this.queue.push({target:r.target,type:"characterData",oldValue:r.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,gv)),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(wc(this.view)){if(this.suppressingSelectionUpdates)return wt(this.view);if(We&&$t<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&wn(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=new Set,r;for(let i=e.focusNode;i;i=Un(i))t.add(i);for(let i=e.anchorNode;i;i=Un(i))if(t.has(i)){r=i;break}let s=r&&this.view.docView.nearestDesc(r);if(s&&s.ignoreMutation({type:"selection",target:r.nodeType==3?r.parentNode:r}))return this.setCurSelection(),!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 r=e.domSelectionRange(),s=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(r)&&wc(e)&&!this.ignoreSelectionChange(r),i=-1,o=-1,a=!1,l=[];if(e.editable)for(let u=0;u<t.length;u++){let d=this.registerMutation(t[u],l);d&&(i=i<0?d.from:Math.min(d.from,i),o=o<0?d.to:Math.max(d.to,o),d.typeOver&&(a=!0))}if(l.some(u=>u.nodeName=="BR")&&(e.input.lastKeyCode==8||e.input.lastKeyCode==46)){for(let u of l)if(u.nodeName=="BR"&&u.parentNode){let d=u.nextSibling;for(;d&&d.nodeType==1;){if(d.contentEditable=="false"){u.parentNode.removeChild(u);break}d=d.firstChild}}}else if(Qe&&l.length){let u=l.filter(d=>d.nodeName=="BR");if(u.length==2){let[d,f]=u;d.parentNode&&d.parentNode.parentNode==f.parentNode?f.remove():d.remove()}else{let{focusNode:d}=this.currentSelection;for(let f of u){let h=f.parentNode;h&&h.nodeName=="LI"&&(!d||wv(e,d)!=h)&&f.remove()}}}let c=null;i<0&&s&&e.input.lastFocus>Date.now()-200&&Math.max(e.input.lastTouch,e.input.lastClick.time)<Date.now()-300&&wi(r)&&(c=_a(e))&&c.eq(W.near(e.state.doc.resolve(0),1))?(e.input.lastFocus=0,wt(e),this.currentSelection.set(r),e.scrollToSelection()):(i>-1||s)&&(i>-1&&(e.docView.markDirty(i,o),xv(e)),e.input.badSafariComposition&&(e.input.badSafariComposition=!1,Sv(e,l)),this.handleDOMChange(i,o,a,l),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(r)||wt(e),this.currentSelection.set(r))}registerMutation(e,t){if(t.indexOf(e.target)>-1)return null;let r=this.view.docView.nearestDesc(e.target);if(e.type=="attributes"&&(r==this.view.docView||e.attributeName=="contenteditable"||e.attributeName=="style"&&!e.oldValue&&!e.target.getAttribute("style"))||!r||r.ignoreMutation(e))return null;if(e.type=="childList"){for(let u=0;u<e.addedNodes.length;u++){let d=e.addedNodes[u];t.push(d),d.nodeType==3&&(this.lastChangedTextNode=d)}if(r.contentDOM&&r.contentDOM!=r.dom&&!r.contentDOM.contains(e.target))return{from:r.posBefore,to:r.posAfter};let s=e.previousSibling,i=e.nextSibling;if(We&&$t<=11&&e.addedNodes.length)for(let u=0;u<e.addedNodes.length;u++){let{previousSibling:d,nextSibling:f}=e.addedNodes[u];(!d||Array.prototype.indexOf.call(e.addedNodes,d)<0)&&(s=d),(!f||Array.prototype.indexOf.call(e.addedNodes,f)<0)&&(i=f)}let o=s&&s.parentNode==e.target?Me(s)+1:0,a=r.localPosFromDOM(e.target,o,-1),l=i&&i.parentNode==e.target?Me(i):e.target.childNodes.length,c=r.localPosFromDOM(e.target,l,1);return{from:a,to:c}}else return e.type=="attributes"?{from:r.posAtStart-r.border,to:r.posAtEnd+r.border}:(this.lastChangedTextNode=e.target,{from:r.posAtStart,to:r.posAtEnd,typeOver:e.target.nodeValue==e.oldValue})}}let Dc=new WeakMap,Rc=!1;function xv(n){if(!Dc.has(n)&&(Dc.set(n,null),["normal","nowrap","pre-line"].indexOf(getComputedStyle(n.dom).whiteSpace)!==-1)){if(n.requiresGeckoHackNode=Qe,Rc)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."),Rc=!0}}function _c(n,e){let t=e.startContainer,r=e.startOffset,s=e.endContainer,i=e.endOffset,o=n.domAtPos(n.state.selection.anchor);return wn(o.node,o.offset,s,i)&&([t,r,s,i]=[s,i,t,r]),{anchorNode:t,anchorOffset:r,focusNode:s,focusOffset:i}}function kv(n,e){if(e.getComposedRanges){let s=e.getComposedRanges(n.root)[0];if(s)return _c(n,s)}let t;function r(s){s.preventDefault(),s.stopImmediatePropagation(),t=s.getTargetRanges()[0]}return n.dom.addEventListener("beforeinput",r,!0),document.execCommand("indent"),n.dom.removeEventListener("beforeinput",r,!0),t?_c(n,t):null}function wv(n,e){for(let t=e.parentNode;t&&t!=n.dom;t=t.parentNode){let r=n.docView.nearestDesc(t,!0);if(r&&r.node.isBlock)return t}return null}function Sv(n,e){var t;let{focusNode:r,focusOffset:s}=n.domSelectionRange();for(let i of e)if(((t=i.parentNode)===null||t===void 0?void 0:t.nodeName)=="TR"){let o=i.nextSibling;for(;o&&o.nodeName!="TD"&&o.nodeName!="TH";)o=o.nextSibling;if(o){let a=o;for(;;){let l=a.firstChild;if(!l||l.nodeType!=1||l.contentEditable=="false"||/^(BR|IMG)$/.test(l.nodeName))break;a=l}a.insertBefore(i,a.firstChild),r==i&&n.domSelection().collapse(i,s)}else i.parentNode.removeChild(i)}}function Cv(n,e,t){let{node:r,fromOffset:s,toOffset:i,from:o,to:a}=n.docView.parseRange(e,t),l=n.domSelectionRange(),c,u=l.anchorNode;if(u&&n.dom.contains(u.nodeType==1?u:u.parentNode)&&(c=[{node:u,offset:l.anchorOffset}],wi(l)||c.push({node:l.focusNode,offset:l.focusOffset})),Ee&&n.input.lastKeyCode===8)for(let g=i;g>s;g--){let v=r.childNodes[g-1],x=v.pmViewDesc;if(v.nodeName=="BR"&&!x){i=g;break}if(!x||x.size)break}let d=n.state.doc,f=n.someProp("domParser")||Ft.fromSchema(n.state.schema),h=d.resolve(o),m=null,y=f.parse(r,{topNode:h.parent,topMatch:h.parent.contentMatchAt(h.index()),topOpen:!0,from:s,to:i,preserveWhitespace:h.parent.type.whitespace=="pre"?"full":!0,findPositions:c,ruleFromNode:Mv,context:h});if(c&&c[0].pos!=null){let g=c[0].pos,v=c[1]&&c[1].pos;v==null&&(v=g),m={anchor:g+o,head:v+o}}return{doc:y,sel:m,from:o,to:a}}function Mv(n){let e=n.pmViewDesc;if(e)return e.parseRule();if(n.nodeName=="BR"&&n.parentNode){if(Oe&&/^(ul|ol)$/i.test(n.parentNode.nodeName)){let t=document.createElement("div");return t.appendChild(document.createElement("li")),{skip:t}}else if(n.parentNode.lastChild==n||Oe&&/^(tr|table)$/i.test(n.parentNode.nodeName))return{ignore:!0}}else if(n.nodeName=="IMG"&&n.getAttribute("mark-placeholder"))return{ignore:!0};return null}const Nv=/^(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 Ev(n,e,t,r,s){let i=n.input.compositionPendingChanges||(n.composing?n.input.compositionID:0);if(n.input.compositionPendingChanges=0,e<0){let M=n.input.lastSelectionTime>Date.now()-50?n.input.lastSelectionOrigin:null,B=_a(n,M);if(B&&!n.state.selection.eq(B)){if(Ee&&kt&&n.input.lastKeyCode===13&&Date.now()-100<n.input.lastKeyCodeTime&&n.someProp("handleKeyDown",re=>re(n,ln(13,"Enter"))))return;let U=n.state.tr.setSelection(B);M=="pointer"?U.setMeta("pointer",!0):M=="key"&&U.scrollIntoView(),i&&U.setMeta("composition",i),n.dispatch(U)}return}let o=n.state.doc.resolve(e),a=o.sharedDepth(t);e=o.before(a+1),t=n.state.doc.resolve(t).after(a+1);let l=n.state.selection,c=Cv(n,e,t),u=n.state.doc,d=u.slice(c.from,c.to),f,h;n.input.lastKeyCode===8&&Date.now()-100<n.input.lastKeyCodeTime?(f=n.state.selection.to,h="end"):(f=n.state.selection.from,h="start"),n.input.lastKeyCode=null;let m=Ov(d.content,c.doc.content,c.from,f,h);if(m&&n.input.domChangeCount++,(qn&&n.input.lastIOSEnter>Date.now()-225||kt)&&s.some(M=>M.nodeType==1&&!Nv.test(M.nodeName))&&(!m||m.endA>=m.endB)&&n.someProp("handleKeyDown",M=>
vendor: 4,301 bytes, line 133
133M(n,ln(13,"Enter")))){n.input.lastIOSEnter=0;return}if(!m)if(r&&l instanceof $&&!l.empty&&l.$head.sameParent(l.$anchor)&&!n.composing&&!(c.sel&&c.sel.anchor!=c.sel.head))m={start:l.from,endA:l.to,endB:l.to};else{if(c.sel){let M=Ic(n,n.state.doc,c.sel);if(M&&!M.eq(n.state.selection)){let B=n.state.tr.setSelection(M);i&&B.setMeta("composition",i),n.dispatch(B)}}return}n.state.selection.from<n.state.selection.to&&m.start==m.endB&&n.state.selection instanceof $&&(m.start>n.state.selection.from&&m.start<=n.state.selection.from+2&&n.state.selection.from>=c.from?m.start=n.state.selection.from:m.endA<n.state.selection.to&&m.endA>=n.state.selection.to-2&&n.state.selection.to<=c.to&&(m.endB+=n.state.selection.to-m.endA,m.endA=n.state.selection.to)),We&&$t<=11&&m.endB==m.start+1&&m.endA==m.start&&m.start>c.from&&c.doc.textBetween(m.start-c.from-1,m.start-c.from+1)==" Â "&&(m.start--,m.endA--,m.endB--);let y=c.doc.resolveNoCache(m.start-c.from),g=c.doc.resolveNoCache(m.endB-c.from),v=u.resolve(m.start),x=y.sameParent(g)&&y.parent.inlineContent&&v.end()>=m.endA;if((qn&&n.input.lastIOSEnter>Date.now()-225&&(!x||s.some(M=>M.nodeName=="DIV"||M.nodeName=="P"))||!x&&y.pos<c.doc.content.size&&(!y.sameParent(g)||!y.parent.inlineContent)&&y.pos<g.pos&&!/\S/.test(c.doc.textBetween(y.pos,g.pos,"","")))&&n.someProp("handleKeyDown",M=>M(n,ln(13,"Enter")))){n.input.lastIOSEnter=0;return}if(n.state.selection.anchor>m.start&&Av(u,m.start,m.endA,y,g)&&n.someProp("handleKeyDown",M=>M(n,ln(8,"Backspace")))){kt&&Ee&&n.domObserver.suppressSelectionUpdates();return}Ee&&m.endB==m.start&&(n.input.lastChromeDelete=Date.now()),kt&&!x&&y.start()!=g.start()&&g.parentOffset==0&&y.depth==g.depth&&c.sel&&c.sel.anchor==c.sel.head&&c.sel.head==m.endA&&(m.endB-=2,g=c.doc.resolveNoCache(m.endB-c.from),setTimeout(()=>{n.someProp("handleKeyDown",function(M){return M(n,ln(13,"Enter"))})},20));let N=m.start,A=m.endA,S=M=>{let B=M||n.state.tr.replace(N,A,c.doc.slice(m.start-c.from,m.endB-c.from));if(c.sel){let U=Ic(n,B.doc,c.sel);U&&!(Ee&&n.composing&&U.empty&&(m.start!=m.endB||n.input.lastChromeDelete<Date.now()-100)&&(U.head==N||U.head==B.mapping.map(A)-1)||We&&U.empty&&U.head==N)&&B.setSelection(U)}return i&&B.setMeta("composition",i),B.scrollIntoView()},O;if(x)if(y.pos==g.pos){We&&$t<=11&&y.parentOffset==0&&(n.domObserver.suppressSelectionUpdates(),setTimeout(()=>wt(n),20));let M=S(n.state.tr.delete(N,A)),B=u.resolve(m.start).marksAcross(u.resolve(m.endA));B&&M.ensureMarks(B),n.dispatch(M)}else if(m.endA==m.endB&&(O=Tv(y.parent.content.cut(y.parentOffset,g.parentOffset),v.parent.content.cut(v.parentOffset,m.endA-v.start())))){let M=S(n.state.tr);O.type=="add"?M.addMark(N,A,O.mark):M.removeMark(N,A,O.mark),n.dispatch(M)}else if(y.parent.child(y.index()).isText&&y.index()==g.index()-(g.textOffset?0:1)){let M=y.parent.textBetween(y.parentOffset,g.parentOffset),B=()=>S(n.state.tr.insertText(M,N,A));n.someProp("handleTextInput",U=>U(n,N,A,M,B))||n.dispatch(B())}else n.dispatch(S());else n.dispatch(S())}function Ic(n,e,t){return Math.max(t.anchor,t.head)>e.content.size?null:Ia(n,e.resolve(t.anchor),e.resolve(t.head))}function Tv(n,e){let t=n.firstChild.marks,r=e.firstChild.marks,s=t,i=r,o,a,l;for(let u=0;u<r.length;u++)s=r[u].removeFromSet(s);for(let u=0;u<t.length;u++)i=t[u].removeFromSet(i);if(s.length==1&&i.length==0)a=s[0],o="add",l=u=>u.mark(a.addToSet(u.marks));else if(s.length==0&&i.length==1)a=i[0],o="remove",l=u=>u.mark(a.removeFromSet(u.marks));else return null;let c=[];for(let u=0;u<e.childCount;u++)c.push(l(e.child(u)));if(C.from(c).eq(n))return{mark:a,type:o}}function Av(n,e,t,r,s){if(t-e<=s.pos-r.pos||uo(r,!0,!1)<s.pos)return!1;let i=n.resolve(e);if(!r.parent.isTextblock){let a=i.nodeAfter;return a!=null&&t==e+a.nodeSize}if(i.parentOffset<i.parent.content.size||!i.parent.isTextblock)return!1;let o=n.resolve(uo(i,!0,!0));return!o.parent.isTextblock||o.pos>t||uo(o,!0,!1)<t?!1:r.parent.content.cut(r.parentOffset).eq(o.parent.content)}function uo(n,e,t){let r=n.depth,s=e?n.end():n.pos;for(;r>0&&(e||n.indexAfter(r)==n.node(r).childCount);)r--,s++,e=!1;if(t){let i=n.node(r).maybeChild(n.indexAfter(r));for(;i&&!i.isLeaf;)i=i.firstChild,s++}return s}function Ov(n,e,t,r,s){let i=n.findDiffStart(e,t);if(i==null)return null;let{a:o,b:a}=n.findDiffEnd(e,t+n.size,t+e.size);
vendor: 4,448 bytes, line 133
133if(s=="end"){let l=Math.max(0,i-Math.min(o,a));r-=o+l-i}if(o<i&&n.size<e.size){let l=r<=i&&r>=o?i-r:0;i-=l,i&&i<e.size&&Pc(e.textBetween(i-1,i+1))&&(i+=l?1:-1),a=i+(a-o),o=i}else if(a<i){let l=r<=i&&r>=a?i-r:0;i-=l,i&&i<n.size&&Pc(n.textBetween(i-1,i+1))&&(i+=l?1:-1),o=i+(o-a),a=i}return{start:i,endA:o,endB:a}}function Pc(n){if(n.length!=2)return!1;let e=n.charCodeAt(0),t=n.charCodeAt(1);return e>=56320&&e<=57343&&t>=55296&&t<=56319}class Mf{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 qb,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=t,this.state=t.state,this.directPlugins=t.plugins||[],this.directPlugins.forEach(Fc),this.dispatch=this.dispatch.bind(this),this.dom=e&&e.mount||document.createElement("div"),e&&(e.appendChild?e.appendChild(this.dom):typeof e=="function"?e(this.dom):e.mount&&(this.mounted=!0)),this.editable=Bc(this),Lc(this),this.nodeViews=zc(this),this.docView=gc(this.state.doc,jc(this),co(this),this.dom,this),this.domObserver=new vv(this,(r,s,i,o)=>Ev(this,r,s,i,o)),this.domObserver.start(),Kb(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&&Jo(this);let t=this._props;this._props=e,e.plugins&&(e.plugins.forEach(Fc),this.directPlugins=e.plugins),this.updateStateInner(e.state,t)}setProps(e){let t={};for(let r in this._props)t[r]=this._props[r];t.state=this.state;for(let r in e)t[r]=e[r];this.update(t)}updateState(e){this.updateStateInner(e,this._props)}updateStateInner(e,t){var r;let s=this.state,i=!1,o=!1;e.storedMarks&&this.composing&&(bf(this),o=!0),this.state=e;let a=s.plugins!=e.plugins||this._props.plugins!=t.plugins;if(a||this._props.plugins!=t.plugins||this._props.nodeViews!=t.nodeViews){let h=zc(this);Rv(h,this.nodeViews)&&(this.nodeViews=h,i=!0)}(a||t.handleDOMEvents!=this._props.handleDOMEvents)&&Jo(this),this.editable=Bc(this),Lc(this);let l=co(this),c=jc(this),u=s.plugins!=e.plugins&&!s.doc.eq(e.doc)?"reset":e.scrollToSelection>s.scrollToSelection?"to selection":"preserve",d=i||!this.docView.matchesNode(e.doc,c,l);(d||!e.selection.eq(s.selection))&&(o=!0);let f=u=="preserve"&&o&&this.dom.style.overflowAnchor==null&&ab(this);if(o){this.domObserver.stop();let h=d&&(We||Ee)&&!this.composing&&!s.selection.empty&&!e.selection.empty&&Dv(s.selection,e.selection);if(d){let m=Ee?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=av(this)),(i||!this.docView.update(e.doc,c,l,this))&&(this.docView.updateOuterDeco(c),this.docView.destroy(),this.docView=gc(e.doc,c,l,this.dom,this)),m&&(!this.trackWrites||!this.dom.contains(this.trackWrites))&&(h=!0)}h||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&Db(this))?wt(this,h):(of(this,e.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(s),!((r=this.dragging)===null||r===void 0)&&r.node&&!s.doc.eq(e.doc)&&this.updateDraggedNode(this.dragging,s),u=="reset"?this.dom.scrollTop=0:u=="to selection"?this.scrollToSelection():f&&lb(f)}scrollToSelection(){let e=this.domSelectionRange().focusNode;if(!(!e||!this.dom.contains(e.nodeType==1?e:e.parentNode))){if(!this.someProp("handleScrollToSelection",t=>t(this)))if(this.state.selection instanceof L){let t=this.docView.domAfterPos(this.state.selection.from);t.nodeType==1&&uc(this,t.getBoundingClientRect(),e)}else uc(this,this.coordsAtPos(this.state.selection.head,1),e)}}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){this.prevDirectPlugins=this.directPlugins,this.destroyPluginViews();for(let t=0;t<this.directPlugins.length;t++){let r=this.directPlugins[t];r.spec.view&&this.pluginViews.push(r.spec.view(this))}for(let t=0;t<this.state.plugins.length;t++){let r=this.state.plugins[t];r.spec.view&&this.pluginViews.push(r.spec.view(this))}}else for(let t=0;t<this.pluginViews.length;t++){let r=this.pluginViews[t];r.update&&r.update(this,e)}}updateDraggedNode(e,t){let r=e.node,s=-1;
vendor: 4,875 bytes, line 133
133if(r.from<this.state.doc.content.size&&this.state.doc.nodeAt(r.from)==r.node)s=r.from;else{let i=r.from+(this.state.doc.content.size-t.doc.content.size);(i>0&&i<this.state.doc.content.size&&this.state.doc.nodeAt(i))==r.node&&(s=i)}this.dragging=new xf(e.slice,e.move,s<0?void 0:L.create(this.state.doc,s))}someProp(e,t){let r=this._props&&this._props[e],s;if(r!=null&&(s=t?t(r):r))return s;for(let o=0;o<this.directPlugins.length;o++){let a=this.directPlugins[o].props[e];if(a!=null&&(s=t?t(a):a))return s}let i=this.state.plugins;if(i)for(let o=0;o<i.length;o++){let a=i[o].props[e];if(a!=null&&(s=t?t(a):a))return s}}hasFocus(){if(We){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(e.contentEditable=="false")return!1;e=e.parentElement}return!0}return this.root.activeElement==this.dom}focus(){this.domObserver.stop(),this.editable&&cb(this.dom),wt(this),this.domObserver.start()}get root(){let e=this._root;if(e==null){for(let t=this.dom.parentNode;t;t=t.parentNode)if(t.nodeType==9||t.nodeType==11&&t.host)return t.getSelection||(Object.getPrototypeOf(t).getSelection=()=>t.ownerDocument.getSelection()),this._root=t}return e||document}updateRoot(){this._root=null}posAtCoords(e){return pb(this,e)}coordsAtPos(e,t=1){return Xd(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,r=-1){let s=this.docView.posFromDOM(e,t,r);if(s==null)throw new RangeError("DOM position not inside the editor");return s}endOfTextblock(e,t){return vb(this,t||this.state,e)}pasteHTML(e,t){return Dr(this,"",e,!1,t||new ClipboardEvent("paste"))}pasteText(e,t){return Dr(this,e,null,!0,t||new ClipboardEvent("paste"))}serializeForClipboard(e){return Pa(this,e)}destroy(){this.docView&&(Jb(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],co(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,X0())}get isDestroyed(){return this.docView==null}dispatchEvent(e){return Gb(this,e)}domSelectionRange(){let e=this.domSelection();return e?Oe&&this.root.nodeType===11&&nb(this.dom.ownerDocument)==this.dom&&kv(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}Mf.prototype.dispatch=function(n){let e=this._props.dispatchTransaction;e?e.call(this,n):this.updateState(this.state.apply(n))};function jc(n){let e=Object.create(null);return e.class="ProseMirror",e.contenteditable=String(n.editable),n.someProp("attributes",t=>{if(typeof t=="function"&&(t=t(n.state)),t)for(let r in t)r=="class"?e.class+=" "+t[r]:r=="style"?e.style=(e.style?e.style+";":"")+t[r]:!e[r]&&r!="contenteditable"&&r!="nodeName"&&(e[r]=String(t[r]))}),e.translate||(e.translate="no"),[Pe.node(0,n.state.doc.content.size,e)]}function Lc(n){if(n.markCursor){let e=document.createElement("img");e.className="ProseMirror-separator",e.setAttribute("mark-placeholder","true"),e.setAttribute("alt",""),n.cursorWrapper={dom:e,deco:Pe.widget(n.state.selection.from,e,{raw:!0,marks:n.markCursor})}}else n.cursorWrapper=null}function Bc(n){return!n.someProp("editable",e=>e(n.state)===!1)}function Dv(n,e){let t=Math.min(n.$anchor.sharedDepth(n.head),e.$anchor.sharedDepth(e.head));return n.$anchor.start(t)!=e.$anchor.start(t)}function zc(n){let e=Object.create(null);function t(r){for(let s in r)Object.prototype.hasOwnProperty.call(e,s)||(e[s]=r[s])}return n.someProp("nodeViews",t),n.someProp("markViews",t),e}function Rv(n,e){let t=0,r=0;for(let s in n){if(n[s]!=e[s])return!0;t++}for(let s in e)r++;return t!=r}function Fc(n){if(n.spec.state||n.spec.filterTransaction||n.spec.appendTransaction)throw new RangeError("Plugins passed directly to the view must not have a state component")}var Ut={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:"'"},Ps={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},_v=typeof navigator<"u"&&/Mac/.test(navigator.platform),Iv=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var Ne=0;Ne<10;Ne++)Ut[48+Ne]=Ut[96+Ne]=String(Ne);for(var Ne=1;Ne<=24;
vendor: 4,691 bytes, line 133
133Ne++)Ut[Ne+111]="F"+Ne;for(var Ne=65;Ne<=90;Ne++)Ut[Ne]=String.fromCharCode(Ne+32),Ps[Ne]=String.fromCharCode(Ne);for(var fo in Ut)Ps.hasOwnProperty(fo)||(Ps[fo]=Ut[fo]);function Pv(n){var e=_v&&n.metaKey&&n.shiftKey&&!n.ctrlKey&&!n.altKey||Iv&&n.shiftKey&&n.key&&n.key.length==1||n.key=="Unidentified",t=!e&&n.key||(n.shiftKey?Ps:Ut)[n.keyCode]||n.key||"Unidentified";return t=="Esc"&&(t="Escape"),t=="Del"&&(t="Delete"),t=="Left"&&(t="ArrowLeft"),t=="Up"&&(t="ArrowUp"),t=="Right"&&(t="ArrowRight"),t=="Down"&&(t="ArrowDown"),t}const jv=typeof navigator<"u"&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),Lv=typeof navigator<"u"&&/Win/.test(navigator.platform);function Bv(n){let e=n.split(/-(?!$)/),t=e[e.length-1];t=="Space"&&(t=" ");let r,s,i,o;for(let a=0;a<e.length-1;a++){let l=e[a];if(/^(cmd|meta|m)$/i.test(l))o=!0;else if(/^a(lt)?$/i.test(l))r=!0;else if(/^(c|ctrl|control)$/i.test(l))s=!0;else if(/^s(hift)?$/i.test(l))i=!0;else if(/^mod$/i.test(l))jv?o=!0:s=!0;else throw new Error("Unrecognized modifier name: "+l)}return r&&(t="Alt-"+t),s&&(t="Ctrl-"+t),o&&(t="Meta-"+t),i&&(t="Shift-"+t),t}function zv(n){let e=Object.create(null);for(let t in n)e[Bv(t)]=n[t];return e}function ho(n,e,t=!0){return e.altKey&&(n="Alt-"+n),e.ctrlKey&&(n="Ctrl-"+n),e.metaKey&&(n="Meta-"+n),t&&e.shiftKey&&(n="Shift-"+n),n}function Fv(n){return new ae({props:{handleKeyDown:Nf(n)}})}function Nf(n){let e=zv(n);return function(t,r){let s=Pv(r),i,o=e[ho(s,r)];if(o&&o(t.state,t.dispatch,t))return!0;if(s.length==1&&s!=" "){if(r.shiftKey){let a=e[ho(s,r,!1)];if(a&&a(t.state,t.dispatch,t))return!0}if((r.altKey||r.metaKey||r.ctrlKey)&&!(Lv&&r.ctrlKey&&r.altKey)&&(i=Ut[r.keyCode])&&i!=s){let a=e[ho(i,r)];if(a&&a(t.state,t.dispatch,t))return!0}}return!1}}var $v=Object.defineProperty,$a=(n,e)=>{for(var t in e)$v(n,t,{get:e[t],enumerable:!0})};function Mi(n){const{state:e,transaction:t}=n;let{selection:r}=t,{doc:s}=t,{storedMarks:i}=t;return{...e,apply:e.apply.bind(e),applyTransaction:e.applyTransaction.bind(e),plugins:e.plugins,schema:e.schema,reconfigure:e.reconfigure.bind(e),toJSON:e.toJSON.bind(e),get storedMarks(){return i},get selection(){return r},get doc(){return s},get tr(){return r=t.selection,s=t.doc,i=t.storedMarks,t}}}var Ni=class{constructor(n){this.editor=n.editor,this.rawCommands=this.editor.extensionManager.commands,this.customState=n.state}get hasCustomState(){return!!this.customState}get state(){return this.customState||this.editor.state}get commands(){const{rawCommands:n,editor:e,state:t}=this,{view:r}=e,{tr:s}=t,i=this.buildProps(s);return Object.fromEntries(Object.entries(n).map(([o,a])=>[o,(...c)=>{const u=a(...c)(i);return!s.getMeta("preventDispatch")&&!this.hasCustomState&&r.dispatch(s),u}]))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(n,e=!0){const{rawCommands:t,editor:r,state:s}=this,{view:i}=r,o=[],a=!!n,l=n||s.tr,c=()=>(!a&&e&&!l.getMeta("preventDispatch")&&!this.hasCustomState&&i.dispatch(l),o.every(d=>d===!0)),u={...Object.fromEntries(Object.entries(t).map(([d,f])=>[d,(...m)=>{const y=this.buildProps(l,e),g=f(...m)(y);return o.push(g),u}])),run:c};return u}createCan(n){const{rawCommands:e,state:t}=this,r=!1,s=n||t.tr,i=this.buildProps(s,r);return{...Object.fromEntries(Object.entries(e).map(([a,l])=>[a,(...c)=>l(...c)({...i,dispatch:void 0})])),chain:()=>this.createChain(s,r)}}buildProps(n,e=!0){const{rawCommands:t,editor:r,state:s}=this,{view:i}=r,o={tr:n,editor:r,view:i,state:Mi({state:s,transaction:n}),dispatch:e?()=>{}:void 0,chain:()=>this.createChain(n,e),can:()=>this.createCan(n),get commands(){return Object.fromEntries(Object.entries(t).map(([a,l])=>[a,(...c)=>l(...c)(o)]))}};return o}},Ef={};$a(Ef,{blur:()=>Hv,clearContent:()=>Vv,clearNodes:()=>Wv,command:()=>Uv,createParagraphNear:()=>qv,cut:()=>Kv,deleteCurrentNode:()=>Jv,deleteNode:()=>Yv,deleteRange:()=>Gv,deleteSelection:()=>Xv,enter:()=>Qv,exitCode:()=>Zv,extendMarkRange:()=>ex,first:()=>tx,focus:()=>rx,forEach:()=>sx,insertContent:()=>ix,insertContentAt:()=>lx,joinBackward:()=>dx,joinDown:()=>ux,joinForward:()=>fx,joinItemBackward:()=>hx,joinItemForward:()=>px,joinTextblockBackward:()=>mx,joinTextblockForward:()=>gx,joinUp:()=>cx,keyboardShortcut:()=>bx,lift:()=>vx,liftEmptyBlock:()=>xx,liftListItem:()=>kx,newlineInCode:()=>wx,resetAttributes:()=>Sx,scrollIntoView:()=>Cx,selectAll:()=>Mx,selectNodeBackward:()=>Nx,selectNodeForward:()=>Ex,selectParentNode:()=>Tx,selectTextblockEnd:()=>Ax,selectTextblockStart:()=>Ox,setContent:()=>Dx,setMark:()=>Qx,setMeta:()=>Zx,setNode:()=>e1,setNodeSelection:()=>t1,setTextDirection:()=>n1,setTextSelection:()=>r1,sinkListItem:()=>s1,splitBlock:()=>i1,splitListItem:()=>
vendor: 12,332 bytes, line 133
133o1,toggleList:()=>l1,toggleMark:()=>c1,toggleNode:()=>u1,toggleWrap:()=>d1,undoInputRule:()=>f1,unsetAllMarks:()=>h1,unsetMark:()=>p1,unsetTextDirection:()=>m1,updateAttributes:()=>g1,wrapIn:()=>y1,wrapInList:()=>b1});var Hv=()=>({editor:n,view:e})=>(requestAnimationFrame(()=>{var t;n.isDestroyed||(e.dom.blur(),(t=window==null?void 0:window.getSelection())==null||t.removeAllRanges())}),!0),Vv=(n=!0)=>({commands:e})=>e.setContent("",{emitUpdate:n}),Wv=()=>({state:n,tr:e,dispatch:t})=>{const{selection:r}=e,{ranges:s}=r;return t&&s.forEach(({$from:i,$to:o})=>{n.doc.nodesBetween(i.pos,o.pos,(a,l)=>{if(a.type.isText)return;const{doc:c,mapping:u}=e,d=c.resolve(u.map(l)),f=c.resolve(u.map(l+a.nodeSize)),h=d.blockRange(f);if(!h)return;const m=Gn(h);if(a.type.isTextblock){const{defaultType:y}=d.parent.contentMatchAt(d.index());e.setNodeMarkup(h.start,y)}(m||m===0)&&e.lift(h,m)})}),!0},Uv=n=>e=>n(e),qv=()=>({state:n,dispatch:e})=>L0(n,e),Kv=(n,e)=>({editor:t,tr:r})=>{const{state:s}=t,i=s.doc.slice(n.from,n.to);r.deleteRange(n.from,n.to);const o=r.mapping.map(e);return r.insert(o,i.content),r.setSelection(new $(r.doc.resolve(Math.max(o-1,0)))),!0},Jv=()=>({tr:n,dispatch:e})=>{const{selection:t}=n,r=t.$anchor.node();if(r.content.size>0)return!1;const s=n.selection.$anchor;for(let i=s.depth;i>0;i-=1)if(s.node(i).type===r.type){if(e){const a=s.before(i),l=s.after(i);n.delete(a,l).scrollIntoView()}return!0}return!1};function ye(n,e){if(typeof n=="string"){if(!e.nodes[n])throw Error(`There is no node type named '${n}'. Maybe you forgot to add the extension?`);return e.nodes[n]}return n}var Yv=n=>({tr:e,state:t,dispatch:r})=>{const s=ye(n,t.schema),i=e.selection.$anchor;for(let o=i.depth;o>0;o-=1)if(i.node(o).type===s){if(r){const l=i.before(o),c=i.after(o);e.delete(l,c).scrollIntoView()}return!0}return!1},Gv=n=>({tr:e,dispatch:t})=>{const{from:r,to:s}=n;return t&&e.delete(r,s),!0},Xv=()=>({state:n,dispatch:e})=>M0(n,e),Qv=()=>({commands:n})=>n.keyboardShortcut("Enter"),Zv=()=>({state:n,dispatch:e})=>j0(n,e);function Ha(n){return Object.prototype.toString.call(n)==="[object RegExp]"}function js(n,e,t={strict:!0}){const r=Object.keys(e);return r.length?r.every(s=>t.strict?e[s]===n[s]:Ha(e[s])?e[s].test(n[s]):e[s]===n[s]):!0}function Tf(n,e,t={}){return n.find(r=>r.type===e&&js(Object.fromEntries(Object.keys(t).map(s=>[s,r.attrs[s]])),t))}function $c(n,e,t={}){return!!Tf(n,e,t)}function Va(n,e,t){if(!n||!e)return;let r=n.parent.childAfter(n.parentOffset);if((!r.node||!r.node.marks.some(c=>c.type===e))&&(r=n.parent.childBefore(n.parentOffset)),!r.node||!r.node.marks.some(c=>c.type===e))return;if(!t){const c=r.node.marks.find(u=>u.type===e);c&&(t=c.attrs)}if(!Tf([...r.node.marks],e,t))return;let i=r.index,o=n.start()+r.offset,a=i+1,l=o+r.node.nodeSize;for(;i>0&&$c([...n.parent.child(i-1).marks],e,t);)i-=1,o-=n.parent.child(i).nodeSize;for(;a<n.parent.childCount&&$c([...n.parent.child(a).marks],e,t);)l+=n.parent.child(a).nodeSize,a+=1;return{from:o,to:l}}function Ct(n,e){if(typeof n=="string"){if(!e.marks[n])throw Error(`There is no mark type named '${n}'. Maybe you forgot to add the extension?`);return e.marks[n]}return n}var ex=(n,e)=>({tr:t,state:r,dispatch:s})=>{const i=Ct(n,r.schema),{doc:o,selection:a}=t,{$from:l,from:c,to:u}=a;if(s){const d=Va(l,i,e);if(d&&d.from<=c&&d.to>=u){const f=$.create(o,d.from,d.to);t.setSelection(f)}}return!0},tx=n=>e=>{const t=typeof n=="function"?n(e):n;for(let r=0;r<t.length;r+=1)if(t[r](e))return!0;return!1};function Af(n){return n instanceof $}function dn(n=0,e=0,t=0){return Math.min(Math.max(n,e),t)}function Of(n,e=null){if(!e)return null;const t=W.atStart(n),r=W.atEnd(n);if(e==="start"||e===!0)return t;if(e==="end")return r;const s=t.from,i=r.to;return e==="all"?$.create(n,dn(0,s,i),dn(n.content.size,s,i)):$.create(n,dn(e,s,i),dn(e,s,i))}function Hc(){return navigator.platform==="Android"||/android/i.test(navigator.userAgent)}function Ls(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}function nx(){return typeof navigator<"u"?/^((?!chrome|android).)*safari/i.test(navigator.userAgent):!1}var rx=(n=null,e={})=>({editor:t,view:r,tr:s,dispatch:i})=>{e={scrollIntoView:!0,...e};const o=()=>{(Ls()||Hc())&&r.dom.focus(),nx()&&!Ls()&&!Hc()&&r.dom.focus({preventScroll:!0}),requestAnimationFrame(()=>{t.isDestroyed||(r.focus(),e!=null&&e.scrollIntoView&&t.commands.scrollIntoView())})};try{if(r.hasFocus()&&n===null||n===!1)return!0}catch{return!1}if(i&&n===null&&!Af(t.state.selection))return o(),!0;const a=Of(s.doc,n)||t.state.selection,l=t.state.selection.eq(a);return i&&(l||s.setSelection(a),l&&s.storedMarks&&s.setStoredMarks(s.storedMarks),o()),!0},sx=(n,e)=>t=>n.every((r,s)=>e(r,{...t,index:s})),ix=(n,e)=>({tr:t,commands:r})=>r.insertContentAt({from:t.selection.from,to:t.selection.to},n,e),Df=n=>{const e=n.childNodes;for(let t=e.length-1;t>=0;t-=1){const r=e[t];r.nodeType===3&&r.nodeValue&&/^(\n\s\s|\n)$/.test(r.nodeValue)?n.removeChild(r):r.nodeType===1&&Df(r)}return n};function ns(n){if(typeof window>"u")throw new Error("[tiptap error]: there is no window object available, so this function cannot be used");const e=`<body>${n}</body>`,t=new window.DOMParser().parseFromString(e,"text/html").body;return Df(t)}function _r(n,e,t){if(n instanceof rt||n instanceof C)return n;t={slice:!0,parseOptions:{},...t};const r=typeof n=="object"&&n!==null,s=typeof n=="string";if(r)try{if(Array.isArray(n)&&n.length>0)return C.fromArray(n.map(a=>e.nodeFromJSON(a)));const o=e.nodeFromJSON(n);return t.errorOnInvalidContent&&o.check(),o}catch(i){if(t.errorOnInvalidContent)throw new Error("[tiptap error]: Invalid JSON content",{cause:i});return console.warn("[tiptap warn]: Invalid content.","Passed value:",n,"Error:",i),_r("",e,t)}if(s){if(t.errorOnInvalidContent){let o=!1,a="";const l=new vd({topNode:e.spec.topNode,marks:e.spec.marks,nodes:e.spec.nodes.append({__tiptap__private__unknown__catch__all__node:{content:"inline*",group:"block",parseDOM:[{tag:"*",getAttrs:c=>(o=!0,a=typeof c=="string"?c:c.outerHTML,null)}]}})});if(t.slice?Ft.fromSchema(l).parseSlice(ns(n),t.parseOptions):Ft.fromSchema(l).parse(ns(n),t.parseOptions),t.errorOnInvalidContent&&o)throw new Error("[tiptap error]: Invalid HTML content",{cause:new Error(`Invalid element found: ${a}`)})}const i=Ft.fromSchema(e);return t.slice?i.parseSlice(ns(n),t.parseOptions).content:i.parse(ns(n),t.parseOptions)}return _r("",e,t)}function ox(n,e,t){const r=n.steps.length-1;if(r<e)return;const s=n.steps[r];if(!(s instanceof me||s instanceof xe))return;const i=n.mapping.maps[r];let o=0;i.forEach((a,l,c,u)=>{o===0&&(o=u)}),n.setSelection(W.near(n.doc.resolve(o),t))}var ax=n=>!("type"in n),lx=(n,e,t)=>({tr:r,dispatch:s,editor:i})=>{var o;if(s){t={parseOptions:i.options.parseOptions,updateSelection:!0,applyInputRules:!1,applyPasteRules:!1,...t};let a;const l=g=>{i.emit("contentError",{editor:i,error:g,disableCollaboration:()=>{"collaboration"in i.storage&&typeof i.storage.collaboration=="object"&&i.storage.collaboration&&(i.storage.collaboration.isDisabled=!0)}})},c={preserveWhitespace:"full",...t.parseOptions};if(!t.errorOnInvalidContent&&!i.options.enableContentCheck&&i.options.emitContentError)try{_r(e,i.schema,{parseOptions:c,errorOnInvalidContent:!0})}catch(g){l(g)}try{a=_r(e,i.schema,{parseOptions:c,errorOnInvalidContent:(o=t.errorOnInvalidContent)!=null?o:i.options.enableContentCheck})}catch(g){return l(g),!1}let{from:u,to:d}=typeof n=="number"?{from:n,to:n}:{from:n.from,to:n.to},f=!0,h=!0;if((ax(a)?a:[a]).forEach(g=>{g.check(),f=f?g.isText&&g.marks.length===0:!1,h=h?g.isBlock:!1}),u===d&&h){const{parent:g}=r.doc.resolve(u);g.isTextblock&&!g.type.spec.code&&!g.childCount&&(u-=1,d+=1)}let y;if(f){if(Array.isArray(e))y=e.map(g=>g.text||"").join("");else if(e instanceof C){let g="";e.forEach(v=>{v.text&&(g+=v.text)}),y=g}else typeof e=="object"&&e&&e.text?y=e.text:y=e;r.insertText(y,u,d)}else{y=a;const g=r.doc.resolve(u),v=g.node(),x=g.parentOffset===0,N=v.isText||v.isTextblock,A=v.content.size>0;x&&N&&A&&h&&(u=Math.max(0,u-1)),r.replaceWith(u,d,y)}t.updateSelection&&ox(r,r.steps.length-1,-1),t.applyInputRules&&r.setMeta("applyInputRules",{from:u,text:y}),t.applyPasteRules&&r.setMeta("applyPasteRules",{from:u,text:y})}return!0},cx=()=>({state:n,dispatch:e})=>R0(n,e),ux=()=>({state:n,dispatch:e})=>_0(n,e),dx=()=>({state:n,dispatch:e})=>N0(n,e),fx=()=>({state:n,dispatch:e})=>O0(n,e),hx=()=>({state:n,dispatch:e,tr:t})=>{try{const r=vi(n.doc,n.selection.$from.pos,-1);return r==null?!1:(t.join(r,2),e&&e(t),!0)}catch{return!1}},px=()=>({state:n,dispatch:e,tr:t})=>{try{const r=vi(n.doc,n.selection.$from.pos,1);return r==null?!1:(t.join(r,2),e&&e(t),!0)}catch{return!1}},mx=()=>({state:n,dispatch:e})=>E0(n,e),gx=()=>({state:n,dispatch:e})=>T0(n,e);function Rf(){return typeof navigator<"u"?/Mac/.test(navigator.platform):!1}function yx(n){const e=n.split(/-(?!$)/);let t=e[e.length-1];t==="Space"&&(t=" ");let r,s,i,o;for(let a=0;a<e.length-1;a+=1){const l=e[a];if(/^(cmd|meta|m)$/i.test(l))o=!0;else if(/^a(lt)?$/i.test(l))r=!0;else if(/^(c|ctrl|control)$/i.test(l))s=!0;else if(/^s(hift)?$/i.test(l))i=!0;else if(/^mod$/i.test(l))Ls()||Rf()?o=!0:s=!0;else throw new Error(`Unrecognized modifier name: ${l}`)}return r&&(t=`Alt-${t}`),s&&(t=`Ctrl-${t}`),o&&(t=`Meta-${t}`),i&&(t=`Shift-${t}`),t}var bx=n=>({editor:e,view:t,tr:r,dispatch:s})=>{const i=yx(n).split(/-(?!$)/),o=i.find(c=>!["Alt","Ctrl","Meta","Shift"].includes(c)),a=new KeyboardEvent("keydown",{key:o==="Space"?" ":o,altKey:i.includes("Alt"),ctrlKey:i.includes("Ctrl"),metaKey:i.includes("Meta"),shiftKey:i.includes("Shift"),bubbles:!0,cancelable:!0}),l=e.captureTransaction(()=>{t.someProp("handleKeyDown",c=>c(t,a))});return l==null||l.steps.forEach(c=>{const u=c.map(r.mapping);u&&s&&r.maybeStep(u)}),!0};function qt(n,e,t={}){const{from:r,to:s,empty:i}=n.selection,o=e?ye(e,n.schema):null,a=[];n.doc.nodesBetween(r,s,(d,f)=>{if(d.isText)return;const h=Math.max(r,f),m=Math.min(s,f+d.nodeSize);a.push({node:d,from:h,to:m})});const l=s-r,c=a.filter(d=>o?o.name===d.node.type.name:!0).filter(d=>js(d.node.attrs,t,{strict:!1}));return i?!!c.length:c.reduce((d,f)=>d+f.to-f.from,0)>=l}var vx=(n,e={})=>({state:t,dispatch:r})=>{const s=ye(n,t.schema);return qt(t,s,e)?I0(t,r):!1},xx=()=>({state:n,dispatch:e})=>B0(n,e),kx=n=>({state:e,dispatch:t})=>{const r=ye(n,e.schema);return K0(r)(e,t)},wx=()=>({state:n,dispatch:e})=>P0(n,e);function Ei(n,e){return e.nodes[n]?"node":e.marks[n]?"mark":null}function Vc(n,e){const t=typeof e=="string"?[e]:e;return Object.keys(n).reduce((r,s)=>(t.includes(s)||(r[s]=n[s]),r),{})}var Sx=(n,e)=>({tr:t,state:r,dispatch:s})=>{let i=null,o=null;const a=Ei(typeof n=="string"?n:n.name,r.schema);if(!a)return!1;a==="node"&&(i=ye(n,r.schema)),a==="mark"&&(o=Ct(n,r.schema));let l=!1;return t.selection.ranges.forEach(c=>{r.doc.nodesBetween(c.$from.pos,c.$to.pos,(u,d)=>{i&&i===u.type&&(l=!0,s&&t.setNodeMarkup(d,void 0,Vc(u.attrs,e))),o&&u.marks.length&&u.marks.forEach(f=>{o===f.type&&(l=!0,s&&t.addMark(d,d+u.nodeSize,o.create(Vc(f.attrs,e))))})})}),l},Cx=()=>({tr:n,dispatch:e})=>(e&&n.scrollIntoView(),!0),Mx=()=>({tr:n,dispatch:e})=>{if(e){const t=new Xe(n.doc);n.setSelection(t)}return!0},Nx=()=>({state:n,dispatch:e})=>A0(n,e),Ex=()=>({state:n,dispatch:e})=>D0(n,e),Tx=()=>({state:n,dispatch:e})=>z0(n,e),Ax=()=>({state:n,dispatch:e})=>H0(n,e),Ox=()=>({state:n,dispatch:e})=>$0(n,e);function Yo(n,e,t={},r={}){return _r(n,e,{slice:!1,parseOptions:t,errorOnInvalidContent:r.errorOnInvalidContent})}var Dx=(n,{errorOnInvalidContent:e,emitUpdate:t=!0,parseOptions:r={}}={})=>({editor:s,tr:i,dispatch:o,commands:a})=>{const{doc:l}=i;if(r.preserveWhitespace!=="full"){const c=Yo(n,s.schema,r,{errorOnInvalidContent:e??s.options.enableContentCheck});return o&&i.replaceWith(0,l.content.size,c).setMeta("preventUpdate",!t),!0}return o&&i.setMeta("preventUpdate",!t),a.insertContentAt({from:0,to:l.content.size},n,{parseOptions:r,errorOnInvalidContent:e??s.options.enableContentCheck})};function _f(n,e){const t=Ct(e,n.schema),{from:r,to:s,empty:i}=n.selection,o=[];i?(n.storedMarks&&o.push(...n.storedMarks),o.push(...n.selection.$head.marks())):n.doc.nodesBetween(r,s,l=>{o.push(...l.marks)});const a=o.find(l=>
133l.type.name===t.name);return a?{...a.attrs}:{}}function If(n,e){const t=new Pd(n);return e.forEach(r=>{r.steps.forEach(s=>{t.step(s)})}),t}function Rx(n){for(let e=0;e<n.edgeCount;e+=1){const{type:t}=n.edge(e);if(t.isTextblock&&!t.hasRequiredAttrs())return t}return null}function _x(n,e,t){const r=[];return n.nodesBetween(e.from,e.to,(s,i)=>{t(s)&&r.push({node:s,pos:i})}),r}function Ix(n,e){for(let t=n.depth;t>0;t-=1){const r=n.node(t);if(e(r))return{pos:t>0?n.before(t):0,start:n.start(t),depth:t,node:r}}}function Ti(n){return e=>Ix(e.$from,n)}function P(n,e,t){return n.config[e]===void 0&&n.parent?P(n.parent,e,t):typeof n.config[e]=="function"?n.config[e].bind({...t,parent:n.parent?P(n.parent,e,t):null}):n.config[e]}function Wa(n){return n.map(e=>{const t={name:e.name,options:e.options,storage:e.storage},r=P(e,"addExtensions",t);return r?[e,...Wa(r())]:e}).flat(10)}function Ua(n,e){const t=Mn.fromSchema(e).serializeFragment(n),s=document.implementation.createHTMLDocument().createElement("div");return s.appendChild(t),s.innerHTML}function Pf(n){return typeof n=="function"}function J(n,e=void 0,...t){return Pf(n)?e?n.bind(e)(...t):n(...t):n}function Px(n={}){return Object.keys(n).length===0&&n.constructor===Object}function Kn(n){const e=n.filter(s=>s.type==="extension"),t=n.filter(s=>s.type==="node"),r=n.filter(s=>s.type==="mark");return{baseExtensions:e,nodeExtensions:t,markExtensions:r}}function jf(n){const e=[],{nodeExtensions:t,markExtensions:r}=Kn(n),s=[...t,...r],i={default:null,validate:void 0,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1},o=t.filter(c=>c.name!=="text").map(c=>c.name),a=r.map(c=>c.name),l=[...o,...a];return n.forEach(c=>{const u={name:c.name,options:c.options,storage:c.storage,extensions:s},d=P(c,"addGlobalAttributes",u);if(!d)return;d().forEach(h=>{let m;Array.isArray(h.types)?m=h.types:h.types==="*"?m=l:h.types==="nodes"?m=o:h.types==="marks"?m=a:m=[],m.forEach(y=>{Object.entries(h.attributes).forEach(([g,v])=>{e.push({type:y,name:g,attribute:{...i,...v}})})})})}),s.forEach(c=>{const u={name:c.name,options:c.options,storage:c.storage},d=P(c,"addAttributes",u);if(!d)return;const f=d();Object.entries(f).forEach(([h,m])=>{const y={...i,...m};typeof(y==null?void 0:y.default)=="function"&&(y.default=y.default()),y!=null&&y.isRequired&&(y==null?void 0:y.default)===void 0&&delete y.default,e.push({type:c.name,name:h,attribute:y})})}),e}function jx(n){const e=[];let t="",r=!1,s=!1,i=0;const o=n.length;for(let a=0;a<o;a+=1){const l=n[a];if(l==="'"&&!s){r=!r,t+=l;continue}if(l==='"'&&!r){s=!s,t+=l;continue}if(!r&&!s){if(l==="("){i+=1,t+=l;continue}if(l===")"&&i>0){i-=1,t+=l;continue}if(l===";"&&i===0){e.push(t),t="";continue}}t+=l}return t&&e.push(t),e}function Wc(n){const e=[],t=jx(n||""),r=t.length;for(let s=0;s<r;s+=1){const i=t[s],o=i.indexOf(":");if(o===-1)continue;const a=i.slice(0,o).trim(),l=i.slice(o+1).trim();a&&l&&e.push([a,l])}return e}function fe(...n){return n.filter(e=>!!e).reduce((e,t)=>{const r={...e};return Object.entries(t).forEach(([s,i])=>{if(!r[s]){r[s]=i;return}if(s==="class"){const a=i?String(i).split(" "):[],l=r[s]?r[s].split(" "):[],c=a.filter(u=>!l.includes(u));r[s]=[...l,...c].join(" ")}else if(s==="style"){const a=new Map([...Wc(r[s]),...Wc(i)]);r[s]=Array.from(a.entries()).map(([l,c])=>`${l}: ${c}`).join("; ")}else r[s]=i}),r},{})}function Ir(n,e){return e.filter(t=>t.type===n.type.name).filter(t=>t.attribute.rendered).map(t=>t.attribute.renderHTML?t.attribute.renderHTML(n.attrs)||{}:{[t.name]:n.attrs[t.name]}).reduce((t,r)=>fe(t,r),{})}function Lx(n){return typeof n!="string"?n:n.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(n):n==="true"?!0:n==="false"?!1:n}function Uc(n,e){return"style"in n?n:{...n,getAttrs:t=>{const r=n.getAttrs?n.getAttrs(t):n.attrs;if(r===!1)return!1;const s=e.reduce((i,o)=>{const a=o.attribute.parseHTML?o.attribute.parseHTML(t):Lx(t.getAttribute(o.name));return a==null?i:{...i,[o.name]:a}},{});return{...r,...s}}}}function qc(n){return Object.fromEntries(Object.entries(n).filter(([e,t])=>e==="attrs"&&Px(t)?!1:t!=null))}function Kc(n){var e,t;const r={};return!((e=n==null?void 0:n.attribute)!=null&&e.isRequired)&&"default"in((n==null?void 0:n.attribute)||{})&&(r.default=n.attribute.default),((t=n==null?void 0:n.attribute)==null?void 0:t.validate)!==void 0&&(r.validate=n.attribute.validate),[n.name,r]}function Bx(n,e){var t;const r=jf(n),{nodeExtensions:s,markExtensions:i}=Kn(n),o=(t=s.find(c=>P(c,"topNode")))==null?void 0:t.name,a=Object.fromEntries(s.map(c=>{const u=r.filter(v=>v.type===c.name),d={name:c.name,options:c.options,storage:c.storage,editor:e},f=n.reduce((v,x)=>{const N=P(x,"extendNodeSchema",d);return{...v,...N?N(c):{}}},{}),h=qc({...f,content:J(P(c,"content",d)),marks:J(P(c,"marks",d)),group:J(P(c,"group",d)),inline:J(P(c,"inline",d)),atom:J(P(c,"atom",d)),selectable:J(P(c,"selectable",d)),draggable:J(P(c,"draggable",d)),c
vendor: 48,949 bytes, lines 133-208
133ode:J(P(c,"code",d)),whitespace:J(P(c,"whitespace",d)),linebreakReplacement:J(P(c,"linebreakReplacement",d)),defining:J(P(c,"defining",d)),isolating:J(P(c,"isolating",d)),attrs:Object.fromEntries(u.map(Kc))}),m=J(P(c,"parseHTML",d));m&&(h.parseDOM=m.map(v=>Uc(v,u)));const y=P(c,"renderHTML",d);y&&(h.toDOM=v=>y({node:v,HTMLAttributes:Ir(v,u)}));const g=P(c,"renderText",d);return g&&(h.toText=g),[c.name,h]})),l=Object.fromEntries(i.map(c=>{const u=r.filter(g=>g.type===c.name),d={name:c.name,options:c.options,storage:c.storage,editor:e},f=n.reduce((g,v)=>{const x=P(v,"extendMarkSchema",d);return{...g,...x?x(c):{}}},{}),h=qc({...f,inclusive:J(P(c,"inclusive",d)),excludes:J(P(c,"excludes",d)),group:J(P(c,"group",d)),spanning:J(P(c,"spanning",d)),code:J(P(c,"code",d)),attrs:Object.fromEntries(u.map(Kc))}),m=J(P(c,"parseHTML",d));m&&(h.parseDOM=m.map(g=>Uc(g,u)));const y=P(c,"renderHTML",d);return y&&(h.toDOM=g=>y({mark:g,HTMLAttributes:Ir(g,u)})),[c.name,h]}));return new vd({topNode:o,nodes:a,marks:l})}function zx(n){const e=n.filter((t,r)=>n.indexOf(t)!==r);return Array.from(new Set(e))}function yr(n){return n.sort((t,r)=>{const s=P(t,"priority")||100,i=P(r,"priority")||100;return s>i?-1:s<i?1:0})}function Lf(n){const e=yr(Wa(n)),t=zx(e.map(r=>r.name));return t.length&&console.warn(`[tiptap warn]: Duplicate extension names found: [${t.map(r=>`'${r}'`).join(", ")}]. This can lead to issues.`),e}function Bf(n,e,t){const{from:r,to:s}=e,{blockSeparator:i=` 134 135`,textSerializers:o={}}=t||{};let a="";return n.nodesBetween(r,s,(l,c,u,d)=>{var f;l.isBlock&&c>r&&(a+=i);const h=o==null?void 0:o[l.type.name];if(h)return u&&(a+=h({node:l,pos:c,parent:u,index:d,range:e})),!1;l.isText&&(a+=(f=l==null?void 0:l.text)==null?void 0:f.slice(Math.max(r,c)-c,s-c))}),a}function Fx(n,e){const t={from:0,to:n.content.size};return Bf(n,t,e)}function zf(n){return Object.fromEntries(Object.entries(n.nodes).filter(([,e])=>e.spec.toText).map(([e,t])=>[e,t.spec.toText]))}function $x(n,e){const t=ye(e,n.schema),{from:r,to:s}=n.selection,i=[];n.doc.nodesBetween(r,s,a=>{i.push(a)});const o=i.reverse().find(a=>a.type.name===t.name);return o?{...o.attrs}:{}}function Ff(n,e){const t=Ei(typeof e=="string"?e:e.name,n.schema);return t==="node"?$x(n,e):t==="mark"?_f(n,e):{}}function Hx(n,e=JSON.stringify){const t={};return n.filter(r=>{const s=e(r);return Object.prototype.hasOwnProperty.call(t,s)?!1:t[s]=!0})}function Vx(n){const e=Hx(n);return e.length===1?e:e.filter((t,r)=>!e.filter((i,o)=>o!==r).some(i=>t.oldRange.from>=i.oldRange.from&&t.oldRange.to<=i.oldRange.to&&t.newRange.from>=i.newRange.from&&t.newRange.to<=i.newRange.to))}function $f(n){const{mapping:e,steps:t}=n,r=[];return e.maps.forEach((s,i)=>{const o=[];if(s.ranges.length)s.forEach((a,l)=>{o.push({from:a,to:l})});else{const{from:a,to:l}=t[i];if(a===void 0||l===void 0)return;o.push({from:a,to:l})}o.forEach(({from:a,to:l})=>{const c=e.slice(i).map(a,-1),u=e.slice(i).map(l),d=e.invert().map(c,-1),f=e.invert().map(u);r.push({oldRange:{from:d,to:f},newRange:{from:c,to:u}})})}),Vx(r)}function qa(n,e,t){const r=[];return n===e?t.resolve(n).marks().forEach(s=>{const i=t.resolve(n),o=Va(i,s.type);o&&r.push({mark:s,...o})}):t.nodesBetween(n,e,(s,i)=>{!s||(s==null?void 0:s.nodeSize)===void 0||r.push(...s.marks.map(o=>({from:i,to:i+s.nodeSize,mark:o})))}),r}var Wx=(n,e,t,r=20)=>{const s=n.doc.resolve(t);let i=r,o=null;for(;i>0&&o===null;){const a=s.node(i);(a==null?void 0:a.type.name)===e?o=a:i-=1}return[o,i]};function rr(n,e){return e.nodes[n]||e.marks[n]||null}function bs(n,e,t){return Object.fromEntries(Object.entries(t).filter(([r])=>{const s=n.find(i=>i.type===e&&i.name===r);return s?s.attribute.keepOnSplit:!1}))}var Ux=(n,e=500)=>{let t="";const r=n.parentOffset;return n.parent.nodesBetween(Math.max(0,r-e),r,(s,i,o,a)=>{var l,c;const u=((c=(l=s.type.spec).toText)==null?void 0:c.call(l,{node:s,pos:i,parent:o,index:a}))||s.textContent||"%leaf%";t+=s.isAtom&&!s.isText?u:u.slice(0,Math.max(0,r-i))}),t};function Go(n,e,t={}){const{empty:r,ranges:s}=n.selection,i=e?Ct(e,n.schema):null;if(r)return!!(n.storedMarks||n.selection.$from.marks()).filter(d=>i?i.name===d.type.name:!0).find(d=>js(d.attrs,t,{strict:!1}));let o=0;const a=[];if(s.forEach(({$from:d,$to:f})=>{const h=d.pos,m=f.pos;n.doc.nodesBetween(h,m,(y,g)=>{if(i&&y.inlineContent&&!y.type.allowsMarkType(i))return!1;if(!y.isText&&!y.marks.length)return;const v=Math.max(h,g),x=Math.min(m,g+y.nodeSize),N=x-v;o+=N,a.push(...y.marks.map(A=>({mark:A,from:v,to:x})))})}),o===0)return!1;const l=a.filter(d=>i?i.name===d.mark.type.name:!0).filter(d=>js(d.mark.attrs,t,{strict:!1})).reduce((d,f)=>d+f.to-f.from,0),c=a.filter(d=>i?d.mark.type!==i&&d.mark.type.excludes(i):!0).reduce((d,f)=>d+f.to-f.from,0);return(l>0?l+c:l)>=o}function qx(n,e,t={}){if(!e)return qt(n,null,t)||Go(n,null,t);const r=Ei(e,n.schema);return r==="node"?qt(n,e,t):r==="mark"?Go(n,e,t):!1}var Kx=(n,e)=>{const{$from:t,$to:r,$anchor:s}=n.selection;if(e){const i=Ti(a=>a.type.name===e)(n.selection);if(!i)return!1;const o=n.doc.resolve(i.pos+1);return s.pos+1===o.end()}return!(r.parentOffset<r.parent.nodeSize-2||t.pos!==r.pos)},Jx=n=>{const{$from:e,$to:t}=n.selection;return!(e.parentOffset>0||e.pos!==t.pos)};function Jc(n,e){return Array.isArray(e)?e.some(t=>(typeof t=="string"?t:t.name)===n.name):e}function po(n,e){const{nodeExtensions:t}=Kn(e),r=t.find(o=>o.name===n);if(!r)return!1;const s={name:r.name,options:r.options,storage:r.storage},i=J(P(r,"group",s));return typeof i!="string"?!1:i.split(" ").includes("list")}function Ai(n,{checkChildren:e=!0,ignoreWhitespace:t=!1}={}){var r;if(t){if(n.type.name==="hardBreak")return!0;if(n.isText)return!/\S/.test((r=n.text)!=null?r:"")}if(n.isText)return!n.text;if(n.isAtom||n.isLeaf)return!1;if(n.content.childCount===0)return!0;if(e){let s=!0;return n.content.forEach(i=>{s!==!1&&(Ai(i,{ignoreWhitespace:t,checkChildren:e})||(s=!1))}),s}return!1}function Hf(n){return n instanceof L}var Vf=class Wf{constructor(e){this.position=e}static fromJSON(e){return new Wf(e.position)}toJSON(){return{position:this.position}}};function Yx(n,e){const t=e.mapping.mapResult(n.position);return{position:new Vf(t.pos),mapResult:t}}function Gx(n){return new Vf(n)}function Xx(n,e,t){var r;const{selection:s}=e;let i=null;if(Af(s)&&(i=s.$cursor),i){const a=(r=n.storedMarks)!=null?r:i.marks();return i.parent.type.allowsMarkType(t)&&(!!t.isInSet(a)||!a.some(c=>c.type.excludes(t)))}const{ranges:o}=s;return o.some(({$from:a,$to:l})=>{let c=a.depth===0?n.doc.inlineContent&&n.doc.type.allowsMarkType(t):!1;return n.doc.nodesBetween(a.pos,l.pos,(u,d,f)=>{if(c)return!1;if(u.isInline){const h=!f||f.type.allowsMarkType(t),m=!!t.isInSet(u.marks)||!u.marks.some(y=>y.type.excludes(t));c=h&&m}return!c}),c})}var Qx=(n,e={})=>({tr:t,state:r,dispatch:s})=>{const{selection:i}=t,{empty:o,ranges:a}=i,l=Ct(n,r.schema);if(s)if(o){const c=_f(r,l);t.addStoredMark(l.create({...c,...e}))}else a.forEach(c=>{const u=c.$from.pos,d=c.$to.pos;r.doc.nodesBetween(u,d,(f,h)=>{const m=Math.max(h,u),y=Math.min(h+f.nodeSize,d);f.marks.find(v=>v.type===l)?f.marks.forEach(v=>{l===v.type&&t.addMark(m,y,l.create({...v.attrs,...e}))}):t.addMark(m,y,l.create(e))})});return Xx(r,t,l)},Zx=(n,e)=>({tr:t})=>(t.setMeta(n,e),!0),e1=(n,e={})=>({state:t,dispatch:r,chain:s})=>{const i=ye(n,t.schema);let o;return t.selection.$anchor.sameParent(t.selection.$head)&&(o=t.selection.$anchor.parent.attrs),i.isTextblock?s().command(({commands:a})=>ac(i,{...o,...e})(t)?!0:a.clearNodes()).command(({state:a})=>ac(i,{...o,...e})(a,r)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},t1=n=>({tr:e,dispatch:t})=>{if(t){const{doc:r}=e,s=dn(n,0,r.content.size),i=L.create(r,s);e.setSelection(i)}return!0},n1=(n,e)=>({tr:t,state:r,dispatch:s})=>{const{selection:i}=r;let o,a;return typeof e=="number"?(o=e,a=e):e&&"from"in e&&"to"in e?(o=e.from,a=e.to):(o=i.from,a=i.to),s&&t.doc.nodesBetween(o,a,(l,c)=>{l.isText||t.setNodeMarkup(c,void 0,{...l.attrs,dir:n})}),!0},r1=n=>({tr:e,dispatch:t})=>{if(t){const{doc:r}=e,{from:s,to:i}=typeof n=="number"?{from:n,to:n}:n,o=$.atStart(r).from,a=$.atEnd(r).to,l=dn(s,o,a),c=dn(i,o,a),u=$.create(r,l,c);e.setSelection(u)}return!0},s1=n=>({state:e,dispatch:t})=>{const r=ye(n,e.schema);return G0(r)(e,t)};function Yc(n,e){const t=n.storedMarks||n.selection.$to.parentOffset&&n.selection.$from.marks();if(t){const r=t.filter(s=>e==null?void 0:e.includes(s.type.name));n.tr.ensureMarks(r)}}var i1=({keepMarks:n=!0}={})=>({tr:e,state:t,dispatch:r,editor:s})=>{const{selection:i,doc:o}=e,{$from:a,$to:l}=i,c=s.extensionManager.attributes,u=bs(c,a.node().type.name,a.node().attrs);if(i instanceof L&&i.node.isBlock)return!a.parentOffset||!Ln(o,a.pos)?!1:(r&&(n&&Yc(t,s.extensionManager.splittableMarks),e.split(a.pos).scrollIntoView()),!0);if(!a.parent.isBlock)return!1;const d=l.parentOffset===l.parent.content.size,f=a.depth===0?void 0:Rx(a.node(-1).contentMatchAt(a.indexAfter(-1)));let h=d&&f?[{type:f,attrs:u}]:void 0,m=Ln(e.doc,e.mapping.map(a.pos),1,h);if(!h&&!m&&Ln(e.doc,e.mapping.map(a.pos),1,f?[{type:f}]:void 0)&&(m=!0,h=f?[{type:f,attrs:u}]:void 0),r){if(m&&(i instanceof $&&e.deleteSelection(),e.split(e.mapping.map(a.pos),1,h),f&&!d&&!a.parentOffset&&a.parent.type!==f)){const y=e.mapping.map(a.before()),g=e.doc.resolve(y);a.node(-1).canReplaceWith(g.index(),g.index()+1,f)&&e.setNodeMarkup(e.mapping.map(a.before()),f)}n&&Yc(t,s.extensionManager.splittableMarks),e.scrollIntoView()}return m},o1=(n,e={})=>({tr:t,state:r,dispatch:s,editor:i})=>{var o;const a=ye(n,r.schema),{$from:l,$to:c}=r.selection,u=r.selection.node;if(u&&u.isBlock||l.depth<2||!l.sameParent(c))return!1;const d=l.node(-1);if(d.type!==a)return!1;const f=i.extensionManager.attributes;if(l.parent.content.size===0&&l.node(-1).childCount===l.indexAfter(-1)){if(l.depth===2||l.node(-3).type!==a||l.index(-2)!==l.node(-2).childCount-1)return!1;if(s){let v=C.empty;const x=l.index(-1)?1:l.index(-2)?2:3;for(let B=l.depth-x;B>=l.depth-3;B-=1)v=C.from(l.node(B).copy(v));const N=l.indexAfter(-1)<l.node(-2).childCount?1:l.indexAfter(-2)<l.node(-3).childCount?2:3,A={...bs(f,l.node().type.name,l.node().attrs),...e},S=((o=a.contentMatch.defaultType)==null?void 0:o.createAndFill(A))||void 0;v=v.append(C.from(a.createAndFill(null,S)||void 0));const O=l.before(l.depth-(x-1));t.replace(O,l.after(-N),new R(v,4-x,0));let M=-1;t.doc.nodesBetween(O,t.doc.content.size,(B,U)=>{if(M>-1)return!1;B.isTextblock&&B.content.size===0&&(M=U+1)}),M>-1&&t.setSelection($.near(t.doc.resolve(M))),t.scrollIntoView()}return!0}const h=c.pos===l.end()?d.contentMatchAt(0).defaultType:null,m={...bs(f,d.type.name,d.attrs),...e},y={...bs(f,l.node().type.name,l.node().attrs),...e};t.delete(l.pos,c.pos);const g=h?[{type:a,attrs:m},{type:h,attrs:y}]:[{type:a,attrs:m}];if(!Ln(t.doc,l.pos,2))return!1;if(s){const{selection:v,storedMarks:x}=r,{splittableMarks:N}=i.extensionManager,A=x||v.$to.parentOffset&&v.$from.marks();if(t.split(l.pos,2,g).scrollIntoView(),!A||!s)return!0;const S=A.filter(O=>N.includes(O.type.name));t.ensureMarks(S)}return!0},mo=(n,e)=>{const t=Ti(o=>o.type===e)(n.selection);if(!t)return!0;const r=n.doc.resolve(Math.max(0,t.pos-1)).before(t.depth);if(r===void 0)return!0;const s=n.doc.nodeAt(r);return t.node.type===(s==null?void 0:s.type)&&Jt(n.doc,t.pos)&&n.join(t.pos),!0},go=(n,e)=>{const t=Ti(o=>o.type===e)(n.selection);if(!t)return!0;const r=n.doc.resolve(t.start).after(t.depth);if(r===void 0)return!0;const s=n.doc.nodeAt(r);return t.node.type===(s==null?void 0:s.type)&&Jt(n.doc,r)&&n.join(r),!0};function a1(n){const e=n.doc,t=e.firstChild;if(!t)return null;const r=e.resolve(1),s=e.resolve(t.nodeSize-1);return $.between(r,s)}var l1=(n,e,t,r={})=>({editor:s,tr:i,state:o,dispatch:a,chain:l,commands:c,can:u})=>{const{extensions:d,splittableMarks:f}=s.extensionManager,h=ye(n,o.schema),m=ye(e,o.schema),{selection:y,storedMarks:g}=o,{$from:v,$to:x}=y,N=v.blockRange(x),A=g||y.$to.parentOffset&&y.$from.marks();if(!N)return!1;const S=Ti(le=>po(le.type.name,d))(y),O=y.from===0&&y.to===o.doc.content.size,M=o.doc.content.content,B=M.length===1?M[0]:null,U=O&&B&&po(B.type.name,d)?{node:B,pos:0,depth:0}:null,re=S??U,we=!!S&&N.depth>=1&&N.depth-S.depth<=1,ne=!!U;if((we||ne)&&re){if(re.node.type===h)return O&&ne?l().command(({tr:le,dispatch:D})=>{const j=a1(le);return j?(le.setSelection(j),D&&D(le),!0):!1}).liftListItem(m).run():c.liftListItem(m);if(po(re.node.type.name,d)&&h.validContent(re.node.content))return l().command(()=>(i.setNodeMarkup(re.pos,h),!0)).command(()=>mo(i,h)).command(()=>go(i,h)).run()}return!t||!A||!a?l().command(()=>u().wrapInList(h,r)?!0:c.clearNodes()).wrapInList(h,r).command(()=>mo(i,h)).command(()=>go(i,h)).run():l().command(()=>{const le=u().wrapInList(h,r),D=A.filter(j=>f.includes(j.type.name));return i.ensureMarks(D),le?!0:c.clearNodes()}).wrapInList(h,r).command(()=>mo(i,h)).command(()=>go(i,h)).run()},c1=(n,e={},t={})=>({state:r,commands:s})=>{const{extendEmptyMarkRange:i=!1}=t,o=Ct(n,r.schema);return Go(r,o,e)?s.unsetMark(o,{extendEmptyMarkRange:i}):s.setMark(o,e)},u1=(n,e,t={})=>({state:r,commands:s})=>{const i=ye(n,r.schema),o=ye(e,r.schema),a=qt(r,i,t);let l;return r.selection.$anchor.sameParent(r.selection.$head)&&(l=r.selection.$anchor.parent.attrs),a?s.setNode(o,l):s.setNode(i,{...l,...t})},d1=(n,e={})=>({state:t,commands:r})=>{const s=ye(n,t.schema);return qt(t,s,e)?r.lift(s):r.wrapIn(s,e)},f1=()=>({state:n,dispatch:e})=>{const t=n.plugins;for(let r=0;r<t.length;r+=1){const s=t[r];let i;if(s.spec.isInputRules&&(i=s.getState(n))){if(e){const o=n.tr,a=i.transform;for(let l=a.steps.length-1;l>=0;l-=1)o.step(a.steps[l].invert(a.docs[l]));if(i.text){const l=o.doc.resolve(i.from).marks();o.replaceWith(i.from,i.to,n.schema.text(i.text,l))}else o.delete(i.from,i.to)}return!0}}return!1},h1=()=>({tr:n,dispatch:e})=>{const{selection:t}=n,{empty:r,ranges:s}=t;return r||e&&s.forEach(i=>{n.removeMark(i.$from.pos,i.$to.pos)}),!0},p1=(n,e={})=>({tr:t,state:r,dispatch:s})=>{var i;const{extendEmptyMarkRange:o=!1}=e,{selection:a}=t,l=Ct(n,r.schema),{$from:c,empty:u,ranges:d}=a;if(!s)return!0;if(u&&o){let{from:f,to:h}=a;const m=(i=c.marks().find(g=>g.type===l))==null?void 0:i.attrs,y=Va(c,l,m);y&&(f=y.from,h=y.to),t.removeMark(f,h,l)}else d.forEach(f=>{t.removeMark(f.$from.pos,f.$to.pos,l)});return t.removeStoredMark(l),!0},m1=n=>({tr:e,state:t,dispatch:r})=>{const{selection:s}=t;let i,o;return typeof n=="number"?(i=n,o=n):n&&"from"in n&&"to"in n?(i=n.from,o=n.to):(i=s.from,o=s.to),r&&e.doc.nodesBetween(i,o,(a,l)=>{if(a.isText)return;const c={...a.attrs};delete c.dir,e.setNodeMarkup(l,void 0,c)}),!0},g1=(n,e={})=>({tr:t,state:r,dispatch:s})=>{let i=null,o=null;const a=Ei(typeof n=="string"?n:n.name,r.schema);if(!a)return!1;a==="node"&&(i=ye(n,r.schema)),a==="mark"&&(o=Ct(n,r.schema));let l=!1;return t.selection.ranges.forEach(c=>{const u=c.$from.pos,d=c.$to.pos;let f,h,m,y;t.selection.empty?r.doc.nodesBetween(u,d,(g,v)=>{i&&i===g.type&&(l=!0,m=Math.max(v,u),y=Math.min(v+g.nodeSize,d),f=v,h=g)}):r.doc.nodesBetween(u,d,(g,v)=>{v<u&&i&&i===g.type&&(l=!0,m=Math.max(v,u),y=Math.min(v+g.nodeSize,d),f=v,h=g),v>=u&&v<=d&&(i&&i===g.type&&(l=!0,s&&t.setNodeMarkup(v,void 0,{...g.attrs,...e})),o&&g.marks.length&&g.marks.forEach(x=>{if(o===x.type&&(l=!0,s)){const N=Math.max(v,u),A=Math.min(v+g.nodeSize,d);t.addMark(N,A,o.create({...x.attrs,...e}))}}))}),h&&(f!==void 0&&s&&t.setNodeMarkup(f,void 0,{...h.attrs,...e}),o&&h.marks.length&&h.marks.forEach(g=>{o===g.type&&s&&t.addMark(m,y,o.create({...g.attrs,...e}))}))}),l},y1=(n,e={})=>({state:t,dispatch:r})=>{const s=ye(n,t.schema);return V0(s,e)(t,r)},b1=(n,e={})=>({state:t,dispatch:r})=>{const s=ye(n,t.schema);return W0(s,e)(t,r)},v1=class{constructor(){this.callbacks={}}on(n,e){return this.callbacks[n]||(this.callbacks[n]=[]),this.callbacks[n].push(e),this}emit(n,...e){const t=this.callbacks[n];return t&&t.forEach(r=>r.apply(this,e)),this}off(n,e){const t=this.callbacks[n];return t&&(e?this.callbacks[n]=t.filter(r=>r!==e):delete this.callbacks[n]),this}once(n,e){const t=(...r)=>{this.off(n,t),e.apply(this,r)};return this.on(n,t)}removeAllListeners(){this.callbacks={}}},Oi=class{constructor(n){var e;this.find=n.find,this.handler=n.handler,this.undoable=(e=n.undoable)!=null?e:!0}},x1=(n,e)=>{if(Ha(e))return e.exec(n);const t=e(n);if(!t)return null;const r=[t.text];return r.index=t.index,r.input=n,r.data=t.data,t.replaceWith&&(t.text.includes(t.replaceWith)||console.warn('[tiptap warn]: "inputRuleMatch.replaceWith" must be part of "inputRuleMatch.text".'),r.push(t.replaceWith)),r};function rs(n){var e;const{editor:t,from:r,to:s,text:i,rules:o,plugin:a}=n,{view:l}=t;if(l.composing)return!1;const c=l.state.doc.resolve(r);if(c.parent.type.spec.code||(e=c.nodeBefore||c.nodeAfter)!=null&&e.marks.find(f=>f.type.spec.code))return!1;let u=!1;const d=Ux(c)+i;return o.forEach(f=>{if(u)return;const h=x1(d,f.find);if(!h)return;const m=l.state.tr,y=Mi({state:l.state,transaction:m}),g={from:r-(h[0].length-i.length),to:s},{commands:v,chain:x,can:N}=new Ni({editor:t,state:y});f.handler({state:y,range:g,match:h,commands:v,chain:x,can:N})===null||!m.steps.length||(f.undoable&&m.setMeta(a,{transform:m,from:r,to:s,text:i}),l.dispatch(m),u=!0)}),u}function k1(n){const{editor:e,rules:t}=n,r=new ae({state:{init(){return null},apply(s,i,o){const a=s.getMeta(r);if(a)return a;const l=s.getMeta("applyInputRules");return!!l&&setTimeout(()=>{let{text:u}=l;typeof u=="string"?u=u:u=Ua(C.from(u),o.schema);const{from:d}=l,f=d+u.length;rs({editor:e,from:d,to:f,text:u,rules:t,plugin:r})}),s.selectionSet||s.docChanged?null:i}},props:{handleTextInput(s,i,o,a){return rs({editor:e,from:i,to:o,text:a,rules:t,plugin:r})},handleDOMEvents:{compositionend:s=>(setTimeout(()=>{const{$cursor:i}=s.state.selection;i&&rs({editor:e,from:i.pos,to:i.pos,text:"",rules:t,plugin:r})}),!1)},handleKeyDown(s,i){if(i.key!=="Enter")return!1;const{$cursor:o}=s.state.selection;return o?rs({editor:e,from:o.pos,to:o.pos,text:` 136`,rules:t,plugin:r}):!1}},isInputRules:!0});return r}function w1(n){return Object.prototype.toString.call(n).slice(8,-1)}function ss(n){return w1(n)!=="Object"?!1:n.constructor===Object&&Object.getPrototypeOf(n)===Object.prototype}function Uf(n,e){const t={...n};return ss(n)&&ss(e)&&Object.keys(e).forEach(r=>{ss(e[r])&&ss(n[r])?t[r]=Uf(n[r],e[r]):t[r]=e[r]}),t}var Ka=class{constructor(n={}){this.type="extendable",this.parent=null,this.child=null,this.name="",this.config={name:this.name},this.config={...this.config,...n},this.name=this.config.name}get options(){return{...J(P(this,"addOptions",{name:this.name}))||{}}}get storage(){return{...J(P(this,"addStorage",{name:this.name,options:this.options}))||{}}}configure(n={}){const e=this.extend({...this.config,addOptions:()=>Uf(this.options,n)});return e.name=this.name,e.parent=this.parent,e}extend(n={}){const e=new this.constructor({...this.config,...n});return e.parent=this,this.child=e,e.name="name"in n?n.name:e.parent.name,e}},Nn=class qf extends Ka{constructor(){super(...arguments),this.type="mark"}static create(e={}){const t=typeof e=="function"?e():e;return new qf(t)}static handleExit({editor:e,mark:t}){const{tr:r}=e.state,s=e.state.selection.$from;if(s.pos===s.end()){const o=s.marks();if(!!!o.find(c=>(c==null?void 0:c.type.name)===t.name))return!1;const l=o.find(c=>(c==null?void 0:c.type.name)===t.name);return l&&r.removeStoredMark(l),r.insertText(" ",s.pos),e.view.dispatch(r),!0}return!1}configure(e){return super.configure(e)}extend(e){const t=typeof e=="function"?e():e;return super.extend(t)}};function S1(n){return typeof n=="number"}var Kf=class{constructor(n){this.find=n.find,this.handler=n.handler}},C1=(n,e,t)=>{if(Ha(e))return[...n.matchAll(e)];const r=e(n,t);return r?r.map(s=>{const i=[s.text];return i.index=s.index,i.input=n,i.data=s.data,s.replaceWith&&(s.text.includes(s.replaceWith)||console.warn('[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".'),i.push(s.replaceWith)),i}):[]};function M1(n){const{editor:e,state:t,from:r,to:s,rule:i,pasteEvent:o,dropEvent:a}=n,{commands:l,chain:c,can:u}=new Ni({editor:e,state:t}),d=[];return t.doc.nodesBetween(r,s,(h,m)=>{var y,g,v,x,N;if((g=(y=h.type)==null?void 0:y.spec)!=null&&g.code||!(h.isText||h.isTextblock||h.isInline))return;const A=(N=(x=(v=h.content)==null?void 0:v.size)!=null?x:h.nodeSize)!=null?N:0,S=Math.max(r,m),O=Math.min(s,m+A);if(S>=O)return;const M=h.isText?h.text||"":h.textBetween(S-m,O-m,void 0,"");C1(M,i.find,o).forEach(U=>{if(U.index===void 0)return;const re=S+U.index+1,we=re+U[0].length,ne={from:t.tr.mapping.map(re),to:t.tr.mapping.map(we)},le=i.handler({state:t,range:ne,match:U,commands:l,chain:c,can:u,pasteEvent:o,dropEvent:a});d.push(le)})}),d.every(h=>h!==null)}var is=null,N1=n=>{var e;const t=new ClipboardEvent("paste",{clipboardData:new DataTransfer});return(e=t.clipboardData)==null||e.setData("text/html",n),t};function E1(n){const{editor:e,rules:t}=n;let r=null,s=!1,i=!1,o=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,a;try{a=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{a=null}const l=({state:u,from:d,to:f,rule:h,pasteEvt:m})=>{const y=u.tr,g=Mi({state:u,transaction:y});if(!(!M1({editor:e,state:g,from:Math.max(d-1,0),to:f.b-1,rule:h,pasteEvent:m,dropEvent:a})||!y.steps.length)){try{a=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{a=null}return o=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,y}};return t.map(u=>new ae({view(d){const f=m=>{var y;r=(y=d.dom.parentElement)!=null&&y.contains(m.target)?d.dom.parentElement:null,r&&(is=e)},h=()=>{is&&(is=null)};return window.addEventListener("dragstart",f),window.addEventListener("dragend",h),{destroy(){window.removeEventListener("dragstart",f),window.removeEventListener("dragend",h)}}},props:{handleDOMEvents:{drop:(d,f)=>{if(i=r===d.dom.parentElement,a=f,!i){const h=is;h!=null&&h.isEditable&&setTimeout(()=>{const m=h.state.selection;m&&h.commands.deleteRange({from:m.from,to:m.to})},10)}return!1},paste:(d,f)=>{var h;const m=(h=f.clipboardData)==null?void 0:h.getData("text/html");return o=f,s=!!(m!=null&&m.includes("data-pm-slice")),!1}}},appendTransaction:(d,f,h)=>{const m=d[0],y=m.getMeta("uiEvent")==="paste"&&!s,g=m.getMeta("uiEvent")==="drop"&&!i,v=m.getMeta("applyPasteRules"),x=!!v;if(!y&&!g&&!x)return;if(x){let{text:S}=v;typeof S=="string"?S=S:S=Ua(C.from(S),h.schema);const{from:O}=v,M=O+S.length,B=N1(S);return l({rule:u,state:h,from:O,to:{b:M},pasteEvt:B})}const N=f.doc.content.findDiffStart(h.doc.content),A=f.doc.content.findDiffEnd(h.doc.content);if(!(!S1(N)||!A||N===A.b))return l({rule:u,state:h,from:N,to:A,pasteEvt:o})}}))}var Di=class{constructor(n,e){this.splittableMarks=[],this.editor=e,this.baseExtensions=n,this.extensions=Lf(n),this.schema=Bx(this.extensions,e),this.setupExtensions()}get commands(){return this.extensions.reduce((n,e)=>{const t={name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:this.editor,type:rr(e.name,this.schema)},r=P(e,"addCommands",t);return r?{...n,...r()}:n},{})}get plugins(){const{editor:n}=this;return yr([...this.extensions].reverse()).flatMap(r=>{const s={name:r.name,options:r.options,storage:this.editor.extensionStorage[r.name],editor:n,type:rr(r.name,this.schema)},i=[],o=P(r,"addKeyboardShortcuts",s);let a={};if(r.type==="mark"&&P(r,"exitable",s)&&(a.ArrowRight=()=>Nn.handleExit({editor:n,mark:r})),o){const f=Object.fromEntries(Object.entries(o()).map(([h,m])=>[h,()=>m({editor:n})]));a={...a,...f}}const l=Fv(a);i.push(l);const c=P(r,"addInputRules",s);if(Jc(r,n.options.enableInputRules)&&c){const f=c();if(f&&f.length){const h=k1({editor:n,rules:f}),m=Array.isArray(h)?h:[h];i.push(...m)}}const u=P(r,"addPasteRules",s);if(Jc(r,n.options.enablePasteRules)&&u){const f=u();if(f&&f.length){const h=E1({editor:n,rules:f});i.push(...h)}}const d=P(r,"addProseMirrorPlugins",s);if(d){const f=d();i.push(...f)}return i})}get attributes(){return jf(this.extensions)}get nodeViews(){const{editor:n}=this,{nodeExtensions:e}=Kn(this.extensions);return Object.fromEntries(e.filter(t=>!!P(t,"addNodeView")).map(t=>{const r=this.attributes.filter(l=>l.type===t.name),s={name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:n,type:ye(t.name,this.schema)},i=P(t,"addNodeView",s);if(!i)return[];const o=i();if(!o)return[];const a=(l,c,u,d,f)=>{const h=Ir(l,r);return o({node:l,view:c,getPos:u,decorations:d,innerDecorations:f,editor:n,extension:t,HTMLAttributes:h})};return[t.name,a]}))}dispatchTransaction(n){const{editor:e}=this;return yr([...this.extensions].reverse()).reduceRight((r,s)=>{const i={name:s.name,options:s.options,storage:this.editor.extensionStorage[s.name],editor:e,type:rr(s.name,this.schema)},o=P(s,"dispatchTransaction",i);return o?a=>{o.call(i,{transaction:a,next:r})}:r},n)}transformPastedHTML(n){const{editor:e}=this;return yr([...this.extensions]).reduce((r,s)=>{const i={name:s.name,options:s.options,storage:this.editor.extensionStorage[s.name],editor:e,type:rr(s.name,this.schema)},o=P(s,"transformPastedHTML",i);return o?(a,l)=>{const c=r(a,l);return o.call(i,c)}:r},n||(r=>r))}get markViews(){const{editor:n}=this,{markExtensions:e}=Kn(this.extensions);return Object.fromEntries(e.filter(t=>!!P(t,"addMarkView")).map(t=>{const r=this.attributes.filter(a=>a.type===t.name),s={name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:n,type:Ct(t.name,this.schema)},i=P(t,"addMarkView",s);if(!i)return[];const o=(a,l,c)=>{const u=Ir(a,r);return i()({mark:a,view:l,inline:c,editor:n,extension:t,HTMLAttributes:u,updateAttributes:d=>{$1(a,n,d)}})};return[t.name,o]}))}setupExtensions(){const n=this.extensions;this.editor.extensionStorage=Object.fromEntries(n.map(e=>[e.name,e.storage])),n.forEach(e=>{var t;const r={name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:this.editor,type:rr(e.name,this.schema)};e.type==="mark"&&((t=J(P(e,"keepOnSplit",r)))==null||t)&&this.splittableMarks.push(e.name);const s=P(e,"onBeforeCreate",r),i=P(e,"onCreate",r),o=P(e,"onUpdate",r),a=P(e,"onSelectionUpdate",r),l=P(e,"onTransaction",r),c=P(e,"onFocus",r),u=P(e,"onBlur",r),d=P(e,"onDestroy",r);s&&this.editor.on("beforeCreate",s),i&&this.editor.on("create",i),o&&this.editor.on("update",o),a&&this.editor.on("selectionUpdate",a),l&&this.editor.on("transaction",l),c&&this.editor.on("focus",c),u&&this.editor.on("blur",u),d&&this.editor.on("destroy",d)})}};Di.resolve=Lf;Di.sort=yr;Di.flatten=Wa;var T1={};$a(T1,{ClipboardTextSerializer:()=>Yf,Commands:()=>Gf,Delete:()=>Xf,Drop:()=>Qf,Editable:()=>Zf,FocusEvents:()=>th,Keymap:()=>nh,Paste:()=>rh,Tabindex:()=>sh,TextDirection:()=>ih,focusEventsPluginKey:()=>eh});var pe=class Jf extends Ka{constructor(){super(...arguments),this.type="extension"}static create(e={}){const t=typeof e=="function"?e():e;return new Jf(t)}configure(e){return super.configure(e)}extend(e){const t=typeof e=="function"?e():e;return super.extend(t)}},Yf=pe.create({name:"clipboardTextSerializer",addOptions(){return{blockSeparator:void 0}},addProseMirrorPlugins(){return[new ae({key:new ve("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{const{editor:n}=this,{state:e,schema:t}=n,{doc:r,selection:s}=e,{ranges:i}=s,o=Math.min(...i.map(u=>u.$from.pos)),a=Math.max(...i.map(u=>u.$to.pos)),l=zf(t);return Bf(r,{from:o,to:a},{...this.options.blockSeparator!==void 0?{blockSeparator:this.options.blockSeparator}:{},textSerializers:l})}}})]}}),Gf=pe.create({name:"commands",addCommands(){return{...Ef}}}),Xf=pe.create({name:"delete",onUpdate({transaction:n,appendedTransactions:e}){var t,r,s;const i=()=>{var o,a,l,c;if((c=(l=(a=(o=this.editor.options.coreExtensionOptions)==null?void 0:o.delete)==null?void 0:a.filterTransaction)==null?void 0:l.call(a,n))!=null?c:n.getMeta("y-sync$"))return;const u=If(n.before,[n,...e]);$f(u).forEach(h=>{u.mapping.mapResult(h.oldRange.from).deletedAfter&&u.mapping.mapResult(h.oldRange.to).deletedBefore&&u.before.nodesBetween(h.oldRange.from,h.oldRange.to,(m,y)=>{const g=y+m.nodeSize-2,v=h.oldRange.from<=y&&g<=h.oldRange.to;this.editor.emit("delete",{type:"node",node:m,from:y,to:g,newFrom:u.mapping.map(y),newTo:u.mapping.map(g),deletedRange:h.oldRange,newRange:h.newRange,partial:!v,editor:this.editor,transaction:n,combinedTransform:u})})});const f=u.mapping;u.steps.forEach((h,m)=>{var y,g;if(h instanceof nt){const v=f.slice(m).map(h.from,-1),x=f.slice(m).map(h.to),N=f.invert().map(v,-1),A=f.invert().map(x),S=v>0?(y=u.doc.nodeAt(v-1))==null?void 0:y.marks.some(M=>M.eq(h.mark)):!1,O=(g=u.doc.nodeAt(x))==null?void 0:g.marks.some(M=>M.eq(h.mark));this.editor.emit("delete",{type:"mark",mark:h.mark,from:h.from,to:h.to,deletedRange:{from:N,to:A},newRange:{from:v,to:x},partial:!!(O||S),editor:this.editor,transaction:n,combinedTransform:u})}})};(s=(r=(t=this.editor.options.coreExtensionOptions)==null?void 0:t.delete)==null?void 0:r.async)==null||s?setTimeout(i,0):i()}}),Qf=pe.create({name:"drop",addProseMirrorPlugins(){return[new ae({key:new ve("tiptapDrop"),props:{handleDrop:(n,e,t,r)=>{this.editor.emit("drop",{editor:this.editor,event:e,slice:t,moved:r})}}})]}}),Zf=pe.create({name:"editable",addProseMirrorPlugins(){return[new ae({key:new ve("editable"),props:{editable:()=>this.editor.options.editable}})]}}),eh=new ve("focusEvents"),th=pe.create({name:"focusEvents",addProseMirrorPlugins(){const{editor:n}=this;return[new ae({key:eh,props:{handleDOMEvents:{focus:(e,t)=>{n.isFocused=!0;const r=n.state.tr.setMeta("focus",{event:t}).setMeta("addToHistory",!1);return e.dispatch(r),!1},blur:(e,t)=>{n.isFocused=!1;const r=n.state.tr.setMeta("blur",{event:t}).setMeta("addToHistory",!1);return e.dispatch(r),!1}}}})]}}),nh=pe.create({name:"keymap",addKeyboardShortcuts(){const n=()=>this.editor.commands.first(({commands:o})=>[()=>o.undoInputRule(),()=>o.command(({tr:a})=>{const{selection:l,doc:c}=a,{empty:u,$anchor:d}=l,{pos:f,parent:h}=d,m=d.parent.isTextblock&&f>0?a.doc.resolve(f-1):d,y=m.parent.type.spec.isolating,g=d.pos-d.parentOffset,v=y&&m.parent.childCount===1?g===d.pos:W.atStart(c).from===f;return!u||!h.type.isTextblock||h.textContent.length||!v||v&&d.parent.type.name==="paragraph"?!1:o.clearNodes()}),()=>o.deleteSelection(),()=>o.joinBackward(),()=>o.selectNodeBackward()]),e=()=>this.editor.commands.first(({commands:o})=>[()=>o.deleteSelection(),()=>o.deleteCurrentNode(),()=>o.joinForward(),()=>o.selectNodeForward()]),r={Enter:()=>this.editor.commands.first(({commands:o})=>[()=>o.newlineInCode(),()=>o.createParagraphNear(),()=>o.liftEmptyBlock(),()=>o.splitBlock()]),"Mod-Enter":()=>this.editor.commands.exitCode(),Backspace:n,"Mod-Backspace":n,"Shift-Backspace":n,Delete:e,"Mod-Delete":e,"Mod-a":()=>this.editor.commands.selectAll()},s={...r},i={...r,"Ctrl-h":n,"Alt-Backspace":n,"Ctrl-d":e,"Ctrl-Alt-Backspace":e,"Alt-Delete":e,"Alt-d":e,"Ctrl-a":()=>this.editor.commands.selectTextblockStart(),"Ctrl-e":()=>this.editor.commands.selectTextblockEnd()};return Ls()||Rf()?i:s},addProseMirrorPlugins(){return[new ae({key:new ve("clearDocument"),appendTransaction:(n,e,t)=>{if(n.some(y=>y.getMeta("composition")))return;const r=n.some(y=>y.docChanged)&&!e.doc.eq(t.doc),s=n.some(y=>y.getMeta("preventClearDocument"));if(!r||s)return;const{empty:i,from:o,to:a}=e.selection,l=W.atStart(e.doc).from,c=W.atEnd(e.doc).to;if(i||!(o===l&&a===c)||!Ai(t.doc))return;const f=t.tr,h=Mi({state:t,transaction:f}),{commands:m}=new Ni({editor:this.editor,state:h});if(m.clearNodes(),!!f.steps.length)return f}})]}}),rh=pe.create({name:"paste",addProseMirrorPlugins(){return[new ae({key:new ve("tiptapPaste"),props:{handlePaste:(n,e,t)=>{this.editor.emit("paste",{editor:this.editor,event:e,slice:t})}}})]}}),sh=pe.create({name:"tabindex",addProseMirrorPlugins(){return[new ae({key:new ve("tabindex"),props:{attributes:()=>this.editor.isEditable?{tabindex:"0"}:{}}})]}}),ih=pe.create({name:"textDirection",addOptions(){return{direction:void 0}},addGlobalAttributes(){if(!this.options.direction)return[];const{nodeExtensions:n}=Kn(this.extensions);return[{types:n.filter(e=>e.name!=="text").map(e=>e.name),attributes:{dir:{default:this.options.direction,parseHTML:e=>{const t=e.getAttribute("dir");return t&&(t==="ltr"||t==="rtl"||t==="auto")?t:this.options.direction},renderHTML:e=>e.dir?{dir:e.dir}:{}}}}]},addProseMirrorPlugins(){return[new ae({key:new ve("textDirection"),props:{attributes:()=>{const n=this.options.direction;return n?{dir:n}:{}}}})]}}),A1=class dr{constructor(e,t,r=!1,s=null){this.currentNode=null,this.actualDepth=null,this.isBlock=r,this.resolvedPos=e,this.editor=t,this.currentNode=s}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(e=this.actualDepth)!=null?e:this.resolvedPos.depth}get pos(){return this.resolvedPos.pos}get content(){return this.node.content}set content(e){let t=this.from,r=this.to;if(this.isBlock){if(this.content.size===0){console.error(`You canât set content on a block node. Tried to set content on ${this.name} at ${this.pos}`);return}t=this.from+1,r=this.to-1}this.editor.commands.insertContentAt({from:t,to:r},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(this.depth===0)return null;const e=this.resolvedPos.start(this.resolvedPos.depth-1),t=this.resolvedPos.doc.resolve(e);return new dr(t,this.editor)}get before(){let e=this.resolvedPos.doc.resolve(this.from-(this.isBlock?1:2));return e.depth!==this.depth&&(e=this.resolvedPos.doc.resolve(this.from-3)),new dr(e,this.editor)}get after(){let e=this.resolvedPos.doc.resolve(this.to+(this.isBlock?2:1));return e.depth!==this.depth&&(e=this.resolvedPos.doc.resolve(this.to+3)),new dr(e,this.editor)}get children(){const e=[];return this.node.content.forEach((t,r)=>{const s=t.isBlock&&!t.isTextblock,i=t.isAtom&&!t.isText,o=t.isInline,a=this.pos+r+(i?0:1);if(a<0||a>this.resolvedPos.doc.nodeSize-2)return;const l=this.resolvedPos.doc.resolve(a);if(!s&&!o&&l.depth<=this.depth)return;const c=new dr(l,this.editor,s,s||o?t:null);s&&(c.actualDepth=this.depth+1),e.push(c)}),e}get firstChild(){return this.children[0]||null}get lastChild(){const e=this.children;return e[e.length-1]||null}closest(e,t={}){let r=null,s=this.parent;for(;s&&!r;){if(s.node.type.name===e)if(Object.keys(t).length>0){const i=s.node.attrs,o=Object.keys(t);for(let a=0;a<o.length;a+=1){const l=o[a];if(i[l]!==t[l])break}}else r=s;s=s.parent}return r}querySelector(e,t={}){return this.querySelectorAll(e,t,!0)[0]||null}querySelectorAll(e,t={},r=!1){let s=[];if(!this.children||this.children.length===0)return s;const i=Object.keys(t);return this.children.forEach(o=>{r&&s.length>0||(o.node.type.name===e&&i.every(l=>t[l]===o.node.attrs[l])&&s.push(o),!(r&&s.length>0)&&(s=s.concat(o.querySelectorAll(e,t,r))))}),s}setAttribute(e){const{tr:t}=this.editor.state;t.setNodeMarkup(this.from,void 0,{...this.node.attrs,...e}),this.editor.view.dispatch(t)}},O1=`.ProseMirror { 137 position: relative; 138} 139 140.ProseMirror { 141 word-wrap: break-word; 142 white-space: pre-wrap; 143 white-space: break-spaces; 144 -webkit-font-variant-ligatures: none; 145 font-variant-ligatures: none; 146 font-feature-settings: "liga" 0; /* the above doesn't seem to work in Edge */ 147} 148 149.ProseMirror [contenteditable="false"] { 150 white-space: normal; 151} 152 153.ProseMirror [contenteditable="false"] [contenteditable="true"] { 154 white-space: pre-wrap; 155} 156 157.ProseMirror pre { 158 white-space: pre-wrap; 159} 160 161img.ProseMirror-separator { 162 display: inline !important; 163 border: none !important; 164 margin: 0 !important; 165 width: 0 !important; 166 height: 0 !important; 167} 168 169.ProseMirror-gapcursor { 170 display: none; 171 pointer-events: none; 172 position: absolute; 173 margin: 0; 174} 175 176.ProseMirror-gapcursor:after { 177 content: ""; 178 display: block; 179 position: absolute; 180 top: -2px; 181 width: 20px; 182 border-top: 1px solid black; 183 animation: ProseMirror-cursor-blink 1.1s steps(2, start) infinite; 184} 185 186@keyframes ProseMirror-cursor-blink { 187 to { 188 visibility: hidden; 189 } 190} 191 192.ProseMirror-hideselection *::selection { 193 background: transparent; 194} 195 196.ProseMirror-hideselection *::-moz-selection { 197 background: transparent; 198} 199 200.ProseMirror-hideselection * { 201 caret-color: transparent; 202} 203 204.ProseMirror-focused .ProseMirror-gapcursor { 205 display: block; 206}`;function D1(n,e,t){const r=document.querySelector("style[data-tiptap-style]");if(r!==null)return r;const s=document.createElement("style");return e&&s.setAttribute("nonce",e),s.setAttribute("data-tiptap-style",""),s.innerHTML=n,document.getElementsByTagName("head")[0].appendChild(s),s}var R1=class extends v1{constructor(n={}){super(),this.css=null,this.className="tiptap",this.editorView=null,this.isFocused=!1,this.isInitialized=!1,this.extensionStorage={},this.instanceId=Math.random().toString(36).slice(2,9),this.options={element:typeof document<"u"?document.createElement("div"):null,content:"",injectCSS:!0,injectNonce:void 0,extensions:[],autofocus:!1,editable:!0,textDirection:void 0,editorProps:{},parseOptions:{},coreExtensionOptions:{},enableInputRules:!0,enablePasteRules:!0,enableCoreExtensions:!0,enableContentCheck:!1,emitContentError:!1,onBeforeCreate:()=>null,onCreate:()=>null,onMount:()=>null,onUnmount:()=>null,onUpdate:()=>null,onSelectionUpdate:()=>null,onTransaction:()=>null,onFocus:()=>null,onBlur:()=>null,onDestroy:()=>null,onContentError:({error:r})=>{throw r},onPaste:()=>null,onDrop:()=>null,onDelete:()=>null,enableExtensionDispatchTransaction:!0},this.isCapturingTransaction=!1,this.capturedTransaction=null,this.utils={getUpdatedPosition:Yx,createMappablePosition:Gx},this.setOptions(n),this.createExtensionManager(),this.createCommandManager(),this.createSchema(),this.on("beforeCreate",this.options.onBeforeCreate),this.emit("beforeCreate",{editor:this}),this.on("mount",this.options.onMount),this.on("unmount",this.options.onUnmount),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:r,slice:s,moved:i})=>this.options.onDrop(r,s,i)),this.on("paste",({event:r,slice:s})=>this.options.onPaste(r,s)),this.on("delete",this.options.onDelete);const e=this.createDoc(),t=Of(e,this.options.autofocus);this.editorState=jn.create({doc:e,schema:this.schema,selection:t||void 0}),this.options.element&&this.mount(this.options.element)}mount(n){if(typeof document>"u")throw new Error("[tiptap error]: The editor cannot be mounted because there is no 'document' defined in this environment.");this.createView(n),this.emit("mount",{editor:this}),this.css&&!document.head.contains(this.css)&&document.head.appendChild(this.css),window.setTimeout(()=>{this.isDestroyed||(this.options.autofocus!==!1&&this.options.autofocus!==null&&this.commands.focus(this.options.autofocus),this.emit("create",{editor:this}),this.isInitialized=!0)},0)}unmount(){if(this.editorView){const n=this.editorView.dom;n!=null&&n.editor&&delete n.editor,this.editorView.destroy()}if(this.editorView=null,this.isInitialized=!1,this.css&&!document.querySelectorAll(`.${this.className}`).length)try{typeof this.css.remove=="function"?this.css.remove():this.css.parentNode&&this.css.parentNode.removeChild(this.css)}catch(n){console.warn("Failed to remove CSS element:",n)}this.css=null,this.emit("unmount",{editor:this})}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&&typeof document<"u"&&(this.css=D1(O1,this.options.injectNonce))}setOptions(n={}){this.options={...this.options,...n},!(!this.editorView||!this.state||this.isDestroyed)&&(this.options.editorProps&&this.view.setProps(this.options.editorProps),this.view.updateState(this.state))}setEditable(n,e=!0){this.setOptions({editable:n}),e&&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:n=>{this.editorState=n},dispatch:n=>{this.dispatchTransaction(n)},composing:!1,dragging:null,editable:!0,isDestroyed:!1},{get:(n,e)=>{if(this.editorView)return this.editorView[e];if(e==="state")return this.editorState;if(e in n)return Reflect.get(n,e);throw new Error(`[tiptap error]: The editor view is not available. Cannot access view['${e}']. The editor may not be mounted yet.`)}})}get state(){return this.editorView&&(this.editorState=this.view.state),this.editorState}registerPlugin(n,e){const t=Pf(e)?e(n,[...this.state.plugins]):[...this.state.plugins,n],r=this.state.reconfigure({plugins:t});return this.view.updateState(r),r}unregisterPlugin(n){if(this.isDestroyed)return;const e=this.state.plugins;let t=e;if([].concat(n).forEach(s=>{const i=typeof s=="string"?`${s}$`:s.key;t=t.filter(o=>!o.key.startsWith(i))}),e.length===t.length)return;const r=this.state.reconfigure({plugins:t});return this.view.updateState(r),r}createExtensionManager(){var n,e;const r=[...this.options.enableCoreExtensions?[Zf,Yf.configure({blockSeparator:(e=(n=this.options.coreExtensionOptions)==null?void 0:n.clipboardTextSerializer)==null?void 0:e.blockSeparator}),Gf,th,nh,sh,Qf,rh,Xf,ih.configure({direction:this.options.textDirection})].filter(s=>typeof this.options.enableCoreExtensions=="object"?this.options.enableCoreExtensions[s.name]!==!1:!0):[],...this.options.extensions].filter(s=>["extension","node","mark"].includes(s==null?void 0:s.type));this.extensionManager=new Di(r,this)}createCommandManager(){this.commandManager=new Ni({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createDoc(){let n;try{n=Yo(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:this.options.enableContentCheck})}catch(e){if(!(e instanceof Error)||!["[tiptap error]: Invalid JSON content","[tiptap error]: Invalid HTML content"].includes(e.message))throw e;this.emit("contentError",{editor:this,error:e,disableCollaboration:()=>{"collaboration"in this.storage&&typeof this.storage.collaboration=="object"&&this.storage.collaboration&&(this.storage.collaboration.isDisabled=!0),this.options.extensions=this.options.extensions.filter(t=>t.name!=="collaboration"),this.createExtensionManager()}}),n=Yo(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:!1})}return n}createView(n){const{editorProps:e,enableExtensionDispatchTransaction:t}=this.options,r=e.dispatchTransaction||this.dispatchTransaction.bind(this),s=t?this.extensionManager.dispatchTransaction(r):r,i=e.transformPastedHTML,o=this.extensionManager.transformPastedHTML(i);this.editorView=new Mf(n,{...e,attributes:{role:"textbox",...e==null?void 0:e.attributes},dispatchTransaction:s,transformPastedHTML:o,state:this.editorState,markViews:this.extensionManager.markViews,nodeViews:this.extensionManager.nodeViews});const a=this.state.reconfigure({plugins:this.extensionManager.plugins});this.view.updateState(a),this.prependClass(),this.injectCSS();const l=this.view.dom;l.editor=this}createNodeViews(){this.view.isDestroyed||this.view.setProps({markViews:this.extensionManager.markViews,nodeViews:this.extensionManager.nodeViews})}prependClass(){this.view.dom.className=`${this.className} ${this.view.dom.className}`}captureTransaction(n){this.isCapturingTransaction=!0,n(),this.isCapturingTransaction=!1;const e=this.capturedTransaction;return this.capturedTransaction=null,e}dispatchTransaction(n){if(this.view.isDestroyed)return;if(this.isCapturingTransaction){if(!this.capturedTransaction){this.capturedTransaction=n;return}n.steps.forEach(c=>{var u;return(u=this.capturedTransaction)==null?void 0:u.step(c)});return}const{state:e,transactions:t}=this.state.applyTransaction(n),r=!this.state.selection.eq(e.selection),s=t.includes(n),i=this.state;if(this.emit("beforeTransaction",{editor:this,transaction:n,nextState:e}),!s)return;this.view.updateState(e),this.emit("transaction",{editor:this,transaction:n,appendedTransactions:t.slice(1)}),r&&this.emit("selectionUpdate",{editor:this,transaction:n});const o=t.findLast(c=>c.getMeta("focus")||c.getMeta("blur")),a=o==null?void 0:o.getMeta("focus"),l=o==null?void 0:o.getMeta("blur");a&&this.emit("focus",{editor:this,event:a.event,transaction:o}),l&&this.emit("blur",{editor:this,event:l.event,transaction:o}),!(n.getMeta("preventUpdate")||!t.some(c=>c.docChanged)||i.doc.eq(e.doc))&&this.emit("update",{editor:this,transaction:n,appendedTransactions:t.slice(1)})}getAttributes(n){return Ff(this.state,n)}isActive(n,e){const t=typeof n=="string"?n:null,r=typeof n=="string"?e:n;return qx(this.state,t,r)}getJSON(){return this.state.doc.toJSON()}getHTML(){return Ua(this.state.doc.content,this.schema)}getText(n){const{blockSeparator:e=` 207 208`,textSerializers:t={}}=n||{};return Fx(this.state.doc,{blockSeparator:e,textSerializers:{...zf(this.schema),...t}})}get isEmpty(){return Ai(this.state.doc)}destroy(){this.emit("destroy"),this.unmount(),this.removeAllListeners()}get isDestroyed(){var n,e;return(e=(n=this.editorView)==null?void 0:n.isDestroyed)!=null?e:!0}$node(n,e){var t;return((t=this.$doc)==null?void 0:t.querySelector(n,e))||null}$nodes(n,e){var t;return((t=this.$doc)==null?void 0:t.querySelectorAll(n,e))||null}$pos(n){const e=this.state.doc.resolve(n);return new A1(e,this)}get $doc(){return this.$pos(0)}};function Jn(n){return new Oi({find:n.find,handler:({state:e,range:t,match:r})=>{const s=J(n.getAttributes,void 0,r);if(s===!1||s===null)return null;const{tr:i}=e,o=r[r.length-1],a=r[0];if(o){const l=a.search(/\S/),c=t.from+a.indexOf(o),u=c+o.length;if(qa(t.from,t.to,e.doc).filter(h=>h.mark.type.excluded.find(y=>y===n.type&&y!==h.mark.type)).filter(h=>h.to>c).length)return null;u<t.to&&i.delete(u,t.to),c>t.from&&i.delete(t.from+l,c);const f=t.from+l+o.length;i.addMark(t.from+l,f,n.type.create(s||{})),i.removeStoredMark(n.type)}},undoable:n.undoable})}function oh(n){return new Oi({find:n.find,handler:({state:e,range:t,match:r})=>{const s=J(n.getAttributes,void 0,r)||{},{tr:i}=e,o=t.from;let a=t.to;const l=n.type.create(s);if(r[1]){const c=r[0].lastIndexOf(r[1]);let u=o+c;u>a?u=a:a=u+r[1].length;const d=r[0][r[0].length-1];i.insertText(d,o+r[0].length-1),i.replaceWith(u,a,l)}else if(r[0]){const c=n.type.isInline?o:o-1;i.insert(c,n.type.create(s)).delete(i.mapping.map(o),i.mapping.map(a))}i.scrollIntoView()},undoable:n.undoable})}function Xo(n){return new Oi({find:n.find,handler:({state:e,range:t,match:r})=>{const s=e.doc.resolve(t.from),i=J(n.getAttributes,void 0,r)||{};if(!s.node(-1).canReplaceWith(s.index(-1),s.indexAfter(-1),n.type))return null;e.tr.delete(t.from,t.to).setBlockType(t.from,t.from,n.type,i)},undoable:n.undoable})}function Yn(n){return new Oi({find:n.find,handler:({state:e,range:t,match:r,chain:s})=>{const i=J(n.getAttributes,void 0,r)||{},o=e.tr.delete(t.from,t.to),l=o.doc.resolve(t.from).blockRange(),c=l&&Ta(l,n.type,i);if(!c)return null;if(o.wrap(l,c),n.keepMarks&&n.editor){const{selection:d,storedMarks:f}=e,{splittableMarks:h}=n.editor.extensionManager,m=f||d.$to.parentOffset&&d.$from.marks();if(m){const y=m.filter(g=>h.includes(g.type.name));o.ensureMarks(y)}}if(n.keepAttributes){const d=n.type.name==="bulletList"||n.type.name==="orderedList"?"listItem":"taskList";s().updateAttributes(d,i).run()}const u=o.doc.resolve(t.from-1).nodeBefore;u&&u.type===n.type&&Jt(o.doc,t.from-1)&&(!n.joinPredicate||n.joinPredicate(r,u))&&o.join(t.from-1)},undoable:n.undoable})}var _1=n=>"touches"in n,I1=class{constructor(n){this.directions=["bottom-left","bottom-right","top-left","top-right"],this.minSize={height:8,width:8},this.preserveAspectRatio=!1,this.classNames={container:"",wrapper:"",handle:"",resizing:""},this.initialWidth=0,this.initialHeight=0,this.aspectRatio=1,this.isResizing=!1,this.activeHandle=null,this.startX=0,this.startY=0,this.startWidth=0,this.startHeight=0,this.isShiftKeyPressed=!1,this.lastEditableState=void 0,this.handleMap=new Map,this.handleMouseMove=a=>{if(!this.isResizing||!this.activeHandle)return;const l=a.clientX-this.startX,c=a.clientY-this.startY;this.handleResize(l,c)},this.handleTouchMove=a=>{if(!this.isResizing||!this.activeHandle)return;const l=a.touches[0];if(!l)return;const c=l.clientX-this.startX,u=l.clientY-this.startY;this.handleResize(c,u)},this.handleMouseUp=()=>
208{if(!this.isResizing)return;const a=this.element.offsetWidth,l=this.element.offsetHeight;this.onCommit(a,l),this.isResizing=!1,this.activeHandle=null,this.container.dataset.resizeState="false",this.classNames.resizing&&this.container.classList.remove(this.classNames.resizing),document.removeEventListener("mousemove",this.handleMouseMove),document.removeEventListener("mouseup",this.handleMouseUp),document.removeEventListener("keydown",this.handleKeyDown),document.removeEventListener("keyup",this.handleKeyUp)},this.handleKeyDown=a=>{a.key==="Shift"&&(this.isShiftKeyPressed=!0)},this.handleKeyUp=a=>{a.key==="Shift"&&(this.isShiftKeyPressed=!1)};var e,t,r,s,i,o;this.node=n.node,this.editor=n.editor,this.element=n.element,this.contentElement=n.contentElement,this.getPos=n.getPos,this.onResize=n.onResize,this.onCommit=n.onCommit,this.onUpdate=n.onUpdate,(e=n.options)!=null&&e.min&&(this.minSize={...this.minSize,...n.options.min}),(t=n.options)!=null&&t.max&&(this.maxSize=n.options.max),(r=n==null?void 0:n.options)!=null&&r.directions&&(this.directions=n.options.directions),(s=n.options)!=null&&s.preserveAspectRatio&&(this.preserveAspectRatio=n.options.preserveAspectRatio),(i=n.options)!=null&&i.className&&(this.classNames={container:n.options.className.container||"",wrapper:n.options.className.wrapper||"",handle:n.options.className.handle||"",resizing:n.options.className.resizing||""}),(o=n.options)!=null&&o.createCustomHandle&&(this.createCustomHandle=n.options.createCustomHandle),this.wrapper=this.createWrapper(),this.container=this.createContainer(),this.applyInitialSize(),this.attachHandles(),this.editor.on("update",this.handleEditorUpdate.bind(this))}get dom(){return this.container}get contentDOM(){var n;return(n=this.contentElement)!=null?n:null}handleEditorUpdate(){const n=this.editor.isEditable;n!==this.lastEditableState&&(this.lastEditableState=n,n?n&&this.handleMap.size===0&&this.attachHandles():this.removeHandles())}update(n,e,t){return n.type!==this.node.type?!1:(this.node=n,this.onUpdate?this.onUpdate(n,e,t):!0)}destroy(){this.isResizing&&(this.container.dataset.resizeState="false",this.classNames.resizing&&this.container.classList.remove(this.classNames.resizing),document.removeEventListener("mousemove",this.handleMouseMove),document.removeEventListener("mouseup",this.handleMouseUp),document.removeEventListener("keydown",this.handleKeyDown),document.removeEventListener("keyup",this.handleKeyUp),this.isResizing=!1,this.activeHandle=null),this.editor.off("update",this.handleEditorUpdate.bind(this)),this.container.remove()}createContainer(){const n=document.createElement("div");return n.dataset.resizeContainer="",n.dataset.node=this.node.type.name,n.style.display=this.node.type.isInline?"inline-flex":"flex",this.classNames.container&&(n.className=this.classNames.container),n.appendChild(this.wrapper),n}createWrapper(){const n=document.createElement("div");return n.style.position="relative",n.style.display="block",n.dataset.resizeWrapper="",this.classNames.wrapper&&(n.className=this.classNames.wrapper),n.appendChild(this.element),n}createHandle(n){const e=document.createElement("div");return e.dataset.resizeHandle=n,e.style.position="absolute",this.classNames.handle&&(e.className=this.classNames.handle),e}positionHandle(n,e){const t=e.includes("top"),r=e.includes("bottom"),s=e.includes("left"),i=e.includes("right");t&&(n.style.top="0"),r&&(n.style.bottom="0"),s&&(n.style.left="0"),i&&(n.style.right="0"),(e==="top"||e==="bottom")&&(n.style.left="0",n.style.right="0"),(e==="left"||e==="right")&&(n.style.top="0",n.style.bottom="0")}attachHandles(){this.directions.forEach(n=>{let e;this.createCustomHandle?e=this.createCustomHandle(n):e=this.createHandle(n),e instanceof HTMLElement||(console.warn(`[ResizableNodeView] createCustomHandle("${n}") did not return an HTMLElement. Falling back to default handle.`),e=this.createHandle(n)),this.createCustomHandle||this.positionHandle(e,n),e.addEventListener("mousedown",t=>this.handleResizeStart(t,n)),e.addEventListener("touchstart",t=>this.handleResizeStart(t,n)),this.handleMap.set(n,e),this.wrapper.appendChild(e)})}
208removeHandles(){this.handleMap.forEach(n=>n.remove()),this.handleMap.clear()}applyInitialSize(){const n=this.node.attrs.width,e=this.node.attrs.height;n?(this.element.style.width=`${n}px`,this.initialWidth=n):this.initialWidth=this.element.offsetWidth,e?(this.element.style.height=`${e}px`,this.initialHeight=e):this.initialHeight=this.element.offsetHeight,this.initialWidth>0&&this.initialHeight>0&&(this.aspectRatio=this.initialWidth/this.initialHeight)}handleResizeStart(n,e){n.preventDefault(),n.stopPropagation(),this.isResizing=!0,this.activeHandle=e,_1(n)?(this.startX=n.touches[0].clientX,this.startY=n.touches[0].clientY):(this.startX=n.clientX,this.startY=n.clientY),this.startWidth=this.element.offsetWidth,this.startHeight=this.element.offsetHeight,this.startWidth>0&&this.startHeight>0&&(this.aspectRatio=this.startWidth/this.startHeight),this.getPos(),this.container.dataset.resizeState="true",this.classNames.resizing&&this.container.classList.add(this.classNames.resizing),document.addEventListener("mousemove",this.handleMouseMove),document.addEventListener("touchmove",this.handleTouchMove),document.addEventListener("mouseup",this.handleMouseUp),document.addEventListener("keydown",this.handleKeyDown),document.addEventListener("keyup",this.handleKeyUp)}handleResize(n,e){if(!this.activeHandle)return;const t=this.preserveAspectRatio||this.isShiftKeyPressed,{width:r,height:s}=this.calculateNewDimensions(this.activeHandle,n,e),i=this.applyConstraints(r,s,t);this.element.style.width=`${i.width}px`,this.element.style.height=`${i.height}px`,this.onResize&&this.onResize(i.width,i.height)}calculateNewDimensions(n,e,t){let r=this.startWidth,s=this.startHeight;const i=n.includes("right"),o=n.includes("left"),a=n.includes("bottom"),l=n.includes("top");return i?r=this.startWidth+e:o&&(r=this.startWidth-e),a?s=this.startHeight+t:l&&(s=this.startHeight-t),(n==="right"||n==="left")&&(r=this.startWidth+(i?e:-e)),(n==="top"||n==="bottom")&&(s=this.startHeight+(a?t:-t)),this.preserveAspectRatio||this.isShiftKeyPressed?this.applyAspectRatio(r,s,n):{width:r,height:s}}applyConstraints(n,e,t){var r,s,i,o;if(!t){let c=Math.max(this.minSize.width,n),u=Math.max(this.minSize.height,e);return(r=this.maxSize)!=null&&r.width&&(c=Math.min(this.maxSize.width,c)),(s=this.maxSize)!=null&&s.height&&(u=Math.min(this.maxSize.height,u)),{width:c,height:u}}let a=n,l=e;return a<this.minSize.width&&(a=this.minSize.width,l=a/this.aspectRatio),l<this.minSize.height&&(l=this.minSize.height,a=l*this.aspectRatio),(i=this.maxSize)!=null&&i.width&&a>this.maxSize.width&&(a=this.maxSize.width,l=a/this.aspectRatio),(o=this.maxSize)!=null&&o.height&&l>this.maxSize.height&&(l=this.maxSize.height,a=l*this.aspectRatio),{width:a,height:l}}applyAspectRatio(n,e,t){const r=t==="left"||t==="right",s=t==="top"||t==="bottom";return r?{width:n,height:n/this.aspectRatio}:s?{width:e*this.aspectRatio,height:e}:{width:n,height:n/this.aspectRatio}}};function P1(n,e){const{selection:t}=n,{$from:r}=t;if(t instanceof L){const i=r.index();return r.parent.canReplaceWith(i,i+1,e)}let s=r.depth;for(;s>=0;){const i=r.index(s);if(r.node(s).contentMatchAt(i).matchType(e))return!0;s-=1}return!1}var j1={};$a(j1,{createAtomBlockMarkdownSpec:()=>ah,createBlockMarkdownSpec:()=>L1,createInlineMarkdownSpec:()=>F1,parseAttributes:()=>Ja,parseIndentedBlocks:()=>Qo,renderNestedMarkdownContent:()=>Ga,serializeAttributes:()=>Ya});function Ja(n){if(!(n!=null&&n.trim()))return{};const e={},t=[],r=n.replace(/["']([^"']*)["']/g,c=>(t.push(c),`__QUOTED_${t.length-1}__`)),s=r.match(/(?:^|\s)\.([a-zA-Z][\w-]*)/g);if(s){const c=s.map(u=>u.trim().slice(1));e.class=c.join(" ")}const i=r.match(/(?:^|\s)#([a-zA-Z][\w-]*)/);i&&(e.id=i[1]);const o=/([a-zA-Z][\w-]*)\s*=\s*(__QUOTED_\d+__)/g;Array.from(r.matchAll(o)).forEach(([,c,u])=>{var d;const f=parseInt(((d=u.match(/__QUOTED_(\d+)__/))==null?void 0:d[1])||"0",10),h=t[f];h&&(e[c]=h.slice(1,-1))});const l=r.replace(/(?:^|\s)\.([a-zA-Z][\w-]*)/g,"").replace(/(?:^|\s)#([a-zA-Z][\w-]*)/g,"").replace(/([a-zA-Z][\w-]*)\s*=\s*__QUOTED_\d+__/g,"").trim();
vendor: 5,011 bytes, lines 208-218
208return l&&l.split(/\s+/).filter(Boolean).forEach(u=>{u.match(/^[a-zA-Z][\w-]*$/)&&(e[u]=!0)}),e}function Ya(n){if(!n||Object.keys(n).length===0)return"";const e=[];return n.class&&String(n.class).split(/\s+/).filter(Boolean).forEach(r=>e.push(`.${r}`)),n.id&&e.push(`#${n.id}`),Object.entries(n).forEach(([t,r])=>{t==="class"||t==="id"||(r===!0?e.push(t):r!==!1&&r!=null&&e.push(`${t}="${String(r)}"`))}),e.join(" ")}function ah(n){const{nodeName:e,name:t,parseAttributes:r=Ja,serializeAttributes:s=Ya,defaultAttributes:i={},requiredAttributes:o=[],allowedAttributes:a}=n,l=t||e,c=u=>{if(!a)return u;const d={};return a.forEach(f=>{f in u&&(d[f]=u[f])}),d};return{parseMarkdown:(u,d)=>{const f={...i,...u.attributes};return d.createNode(e,f,[])},markdownTokenizer:{name:e,level:"block",start(u){var d;const f=new RegExp(`^:::${l}(?:\\s|$)`,"m"),h=(d=u.match(f))==null?void 0:d.index;return h!==void 0?h:-1},tokenize(u,d,f){const h=new RegExp(`^:::${l}(?:\\s+\\{([^}]*)\\})?\\s*:::(?:\\n|$)`),m=u.match(h);if(!m)return;const y=m[1]||"",g=r(y);if(!o.find(x=>!(x in g)))return{type:e,raw:m[0],attributes:g}}},renderMarkdown:u=>{const d=c(u.attrs||{}),f=s(d),h=f?` {${f}}`:"";return`:::${l}${h} :::`}}}function L1(n){const{nodeName:e,name:t,getContent:r,parseAttributes:s=Ja,serializeAttributes:i=Ya,defaultAttributes:o={},content:a="block",allowedAttributes:l}=n,c=t||e,u=d=>{if(!l)return d;const f={};return l.forEach(h=>{h in d&&(f[h]=d[h])}),f};return{parseMarkdown:(d,f)=>{let h;if(r){const y=r(d);h=typeof y=="string"?[{type:"text",text:y}]:y}else a==="block"?h=f.parseChildren(d.tokens||[]):h=f.parseInline(d.tokens||[]);const m={...o,...d.attributes};return f.createNode(e,m,h)},markdownTokenizer:{name:e,level:"block",start(d){var f;const h=new RegExp(`^:::${c}`,"m"),m=(f=d.match(h))==null?void 0:f.index;return m!==void 0?m:-1},tokenize(d,f,h){var m;const y=new RegExp(`^:::${c}(?:\\s+\\{([^}]*)\\})?\\s*\\n`),g=d.match(y);if(!g)return;const[v,x=""]=g,N=s(x);let A=1;const S=v.length;let O="";const M=/^:::([\w-]*)(\s.*)?/gm,B=d.slice(S);for(M.lastIndex=0;;){const U=M.exec(B);if(U===null)break;const re=U.index,we=U[1];if(!((m=U[2])!=null&&m.endsWith(":::"))){if(we)A+=1;else if(A-=1,A===0){const ne=B.slice(0,re);O=ne.trim();const le=d.slice(0,S+re+U[0].length);let D=[];if(O)if(a==="block")for(D=h.blockTokens(ne),D.forEach(j=>{j.text&&(!j.tokens||j.tokens.length===0)&&(j.tokens=h.inlineTokens(j.text))});D.length>0;){const j=D[D.length-1];if(j.type==="paragraph"&&(!j.text||j.text.trim()===""))D.pop();else break}else D=h.inlineTokens(O);return{type:e,raw:le,attributes:N,content:O,tokens:D}}}}}},renderMarkdown:(d,f)=>{const h=u(d.attrs||{}),m=i(h),y=m?` {${m}}`:"",g=f.renderChildren(d.content||[],` 209 210`);return`:::${c}${y} 211 212${g} 213 214:::`}}}function B1(n){if(!n.trim())return{};const e={},t=/(\w+)=(?:"([^"]*)"|'([^']*)')/g;let r=t.exec(n);for(;r!==null;){const[,s,i,o]=r;e[s]=i||o,r=t.exec(n)}return e}function z1(n){return Object.entries(n).filter(([,e])=>e!=null).map(([e,t])=>`${e}="${t}"`).join(" ")}function F1(n){const{nodeName:e,name:t,getContent:r,parseAttributes:s=B1,serializeAttributes:i=z1,defaultAttributes:o={},selfClosing:a=!1,allowedAttributes:l}=n,c=t||e,u=f=>{if(!l)return f;const h={};return l.forEach(m=>{const y=typeof m=="string"?m:m.name,g=typeof m=="string"?void 0:m.skipIfDefault;if(y in f){const v=f[y];if(g!==void 0&&v===g)return;h[y]=v}}),h},d=c.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return{parseMarkdown:(f,h)=>{const m={...o,...f.attributes};if(a)return h.createNode(e,m);const y=r?r(f):f.content||"";return y?h.createNode(e,m,[h.createTextNode(y)]):h.createNode(e,m,[])},markdownTokenizer:{name:e,level:"inline",start(f){const h=a?new RegExp(`\\[${d}\\s*[^\\]]*\\]`):new RegExp(`\\[${d}\\s*[^\\]]*\\][\\s\\S]*?\\[\\/${d}\\]`),m=f.match(h),y=m==null?void 0:m.index;return y!==void 0?y:-1},tokenize(f,h,m){const y=a?new RegExp(`^\\[${d}\\s*([^\\]]*)\\]`):new RegExp(`^\\[${d}\\s*([^\\]]*)\\]([\\s\\S]*?)\\[\\/${d}\\]`),g=f.match(y);if(!g)return;let v="",x="";if(a){const[,A]=g;x=A}else{const[,A,S]=g;x=A,v=S||""}const N=s(x.trim());return{type:e,raw:g[0],content:v.trim(),attributes:N}}},renderMarkdown:f=>{let h="";r?h=r(f):f.content&&f.content.length>0&&(h=f.content.filter(v=>v.type==="text").map(v=>v.text).join(""));const m=u(f.attrs||{}),y=i(m),g=y?` ${y}`:"";return a?`[${c}${g}]`:`[${c}${g}]${h}[/${c}]`}}}function Qo(n,e,t){var r,s,i,o;const a=n.split(` 215`),l=[];let c="",u=0;const d=e.baseIndentSize||2;for(;u<a.length;){const f=a[u],h=f.match(e.itemPattern);if(!h){if(l.length>0)break;if(f.trim()===""){u+=1,c=`${c}${f} 216`;continue}else return}const m=e.extractItemData(h),{indentLevel:y,mainContent:g}=m;c=`${c}${f} 217`;const v=[g];for(u+=1;u<a.length;){const S=a[u];if(S.trim()===""){const M=a.slice(u+1).findIndex(re=>re.trim()!=="");if(M===-1)break;if((((s=(r=a[u+1+M].match(/^(\s*)/))==null?void 0:r[1])==null?void 0:s.length)||0)>y){v.push(S),c=`${c}${S} 218`,u+=1;continue}else break}if((((o=(i=S.match(/^(\s*)/))==null?void 0:i[1])==null?void 0:o.length)||0)>
218y)v.push(S),c=`${c}${S} 219`,u+=1;else break}let x;const N=v.slice(1);if(N.length>0){const S=N.map(O=>O.slice(y+d)).join(` 220`);S.trim()&&(e.customNestedParser?x=e.customNestedParser(S):x=t.blockTokens(S))}const A=e.createToken(m,x);l.push(A)}if(l.length!==0)return{items:l,raw:c}}function Ga(n,e,t,r){if(!n||!Array.isArray(n.content))return"";const s=typeof t=="function"?t(r):t,[i,...o]=n.content,a=e.renderChildren([i]);let l=`${s}${a}`;return o&&o.length>0&&o.forEach((c,u)=>{var d,f;const h=(f=(d=e.renderChild)==null?void 0:d.call(e,c,u+1))!=null?f:e.renderChildren([c]);if(h!=null){const m=h.split(` 221`).map(y=>y?e.indent(y):e.indent("")).join(` 222`);l+=c.type==="paragraph"?` 223 224${m}`:` 225${m}`}}),l}function $1(n,e,t={}){const{state:r}=e,{doc:s,tr:i}=r,o=n;s.descendants((a,l)=>{const c=i.mapping.map(l),u=i.mapping.map(l)+a.nodeSize;let d=null;if(a.marks.forEach(h=>{if(h!==o)return!1;d=h}),!d)return;let f=!1;if(Object.keys(t).forEach(h=>{t[h]!==d.attrs[h]&&(f=!0)}),f){const h=n.type.create({...n.attrs,...t});i.removeMark(c,u,n.type),i.addMark(c,u,h)}}),i.docChanged&&e.view.dispatch(i)}
225var Be=class lh extends Ka{constructor(){super(...arguments),this.type="node"}static create(e={}){const t=typeof e=="function"?e():e;return new lh(t)}configure(e){return super.configure(e)}extend(e){const t=typeof e=="function"?e():e;return super.extend(t)}};function Cn(n){return new Kf({find:n.find,handler:({state:e,range:t,match:r,pasteEvent:s})=>{const i=J(n.getAttributes,void 0,r,s);if(i===!1||i===null)return null;const{tr:o}=e,a=r[r.length-1],l=r[0];let c=t.to;if(a){const u=l.search(/\S/),d=t.from+l.indexOf(a),f=d+a.length;if(qa(t.from,t.to,e.doc).filter(y=>y.mark.type.excluded.find(v=>v===n.type&&v!==y.mark.type)).filter(y=>y.to>d).length)return null;f<t.to&&o.delete(f,t.to),d>t.from&&o.delete(t.from+u,d),c=t.from+u+a.length,o.addMark(t.from+u,c,n.type.create(i||{})),r.index!==void 0&&r.input!==void 0&&r.index+r[0].length>=r.input.length||o.removeStoredMark(n.type)}}})}function H1(n){return new Kf({find:n.find,handler({match:e,chain:t,range:r,pasteEvent:s}){const i=J(n.getAttributes,void 0,e,s),o=J(n.getContent,void 0,i);if(i===!1||i===null)return null;const a={type:n.type.name,attrs:i};o&&(a.content=o),e.input&&t().deleteRange(r).insertContentAt(r.from,a)}})}const{getOwnPropertyNames:V1,getOwnPropertySymbols:W1}=Object,{hasOwnProperty:U1}=Object.prototype;function yo(n,e){return function(r,s,i){return n(r,s,i)&&e(r,s,i)}}function as(n){return function(t,r,s){if(!t||!r||typeof t!="object"||typeof r!="object")return n(t,r,s);const{cache:i}=s,o=i.get(t),a=i.get(r);if(o&&a)return o===r&&a===t;i.set(t,r),i.set(r,t);const l=n(t,r,s);return i.delete(t),i.delete(r),l}}function q1(n){return n!=null?n[Symbol.toStringTag]:void 0}function Gc(n){return V1(n).concat(W1(n))}const K1=Object.hasOwn||((n,e)=>U1.call(n,e));function En(n,e){return n===e||!n&&!e&&n!==n&&e!==e}const J1="__v",Y1="__o",G1="_owner",{getOwnPropertyDescriptor:Xc,keys:Qc}=Object;function X1(n,e){return n.byteLength===e.byteLength&&Bs(new Uint8Array(n),new Uint8Array(e))}function Q1(n,e,t){let r=n.length;if(e.length!==r)return!1;for(;r-- >0;)if(!t.equals(n[r],e[r],r,r,n,e,t))return!1;return!0}function Z1(n,e){return n.byteLength===e.byteLength&&Bs(new Uint8Array(n.buffer,n.byteOffset,n.byteLength),new Uint8Array(e.buffer,e.byteOffset,e.byteLength))}function ek(n,e){return En(n.getTime(),e.getTime())}function tk(n,e){return n.name===e.name&&n.message===e.message&&n.cause===e.cause&&n.stack===e.stack}function nk(n,e){return n===e}function Zc(n,e,t){const r=n.size;if(r!==e.size)return!1;if(!r)return!0;const s=new Array(r),i=n.entries();let o,a,l=0;for(;(o=i.next())&&!o.done;){const c=e.entries();let u=!1,d=0;for(;(a=c.next())&&!a.done;){if(s[d]){d++;continue}const f=o.value,h=a.value;if(t.equals(f[0],h[0],l,d,n,e,t)&&t.equals(f[1],h[1],f[0],h[0],n,e,t)){u=s[d]=!0;break}d++}if(!u)return!1;l++}return!0}const rk=En;function sk(n,e,t){const r=Qc(n);let s=r.length;if(Qc(e).length!==s)return!1;for(;s-- >0;)if(!ch(n,e,t,r[s]))return!1;return!0}function sr(n,e,t){const r=Gc(n);let s=r.length;if(Gc(e).length!==s)return!1;let i,o,a;for(;s-- >0;)if(i=r[s],!ch(n,e,t,i)||(o=Xc(n,i),a=Xc(e,i),(o||a)&&(!o||!a||o.configurable!==a.configurable||o.enumerable!==a.enumerable||o.writable!==a.writable)))return!1;return!0}function ik(n,e){return En(n.valueOf(),e.valueOf())}function ok(n,e){return n.source===e.source&&n.flags===e.flags}function eu(n,e,t){const r=n.size;if(r!==e.size)return!1;if(!r)return!0;const s=new Array(r),i=n.values();let o,a;for(;(o=i.next())&&!o.done;){const l=e.values();let c=!1,u=0;for(;(a=l.next())&&!a.done;){if(!s[u]&&t.equals(o.value,a.value,o.value,a.value,n,e,t)){c=s[u]=!0;break}u++}if(!c)return!1}return!0}function Bs(n,e){let t=n.byteLength;if(e.byteLength!==t||n.byteOffset!==e.byteOffset)return!1;for(;t-- >0;)if(n[t]!==e[t])return!1;return!0}function ak(n,e){return n.hostname===e.hostname&&n.pathname===e.pathname&&n.protocol===e.protocol&&n.port===e.port&&n.hash===e.hash&&n.username===e.username&&n.password===e.password}function ch(n,e,t,r){return(r===G1||r===Y1||r===J1)&&(n.$$typeof||e.$$typeof)?!0:K1(e,r)&&t.equals(n[r],e[r],r,r,n,e,t)}const lk="[object ArrayBuffer]",ck="[object Arguments]",uk="[object Boolean]",dk="[object DataView]",fk="[object Date]",hk="[object Error]",pk="[object Map]",mk="[object Number]",gk="[object Object]",yk="[object RegExp]",bk="[object Set]",vk="[object String]",xk={"[object Int8Array]":!0,"[object Uint8Array]":!0,"[object Uint8ClampedArray]":!0,"[object Int16Array]":!0,"[object Uint16Array]":!0,"[object Int32Array]":!0,"[object Uint32Array]":!0,"[object Float16Array]":!0,"[object Float32Array]":!0,"[object Float64Array
225]":!0,"[object BigInt64Array]":!0,"[object BigUint64Array]":!0},kk="[object URL]",wk=Object.prototype.toString;function Sk({areArrayBuffersEqual:n,areArraysEqual:e,areDataViewsEqual:t,areDatesEqual:r,areErrorsEqual:s,areFunctionsEqual:i,areMapsEqual:o,areNumbersEqual:a,areObjectsEqual:l,arePrimitiveWrappersEqual:c,areRegExpsEqual:u,areSetsEqual:d,areTypedArraysEqual:f,areUrlsEqual:h,unknownTagComparators:m}){return function(g,v,x){if(g===v)return!0;if(g==null||v==null)return!1;const N=typeof g;if(N!==typeof v)return!1;if(N!=="object")return N==="number"?a(g,v,x):N==="function"?i(g,v,x):!1;const A=g.constructor;if(A!==v.constructor)return!1;if(A===Object)return l(g,v,x);if(Array.isArray(g))return e(g,v,x);if(A===Date)return r(g,v,x);if(A===RegExp)return u(g,v,x);if(A===Map)return o(g,v,x);if(A===Set)return d(g,v,x);const S=wk.call(g);if(S===fk)return r(g,v,x);if(S===yk)return u(g,v,x);if(S===pk)return o(g,v,x);if(S===bk)return d(g,v,x);if(S===gk)return typeof g.then!="function"&&typeof v.then!="function"&&l(g,v,x);if(S===kk)return h(g,v,x);if(S===hk)return s(g,v,x);if(S===ck)return l(g,v,x);if(xk[S])return f(g,v,x);if(S===lk)return n(g,v,x);if(S===dk)return t(g,v,x);if(S===uk||S===mk||S===vk)return c(g,v,x);if(m){let O=m[S];if(!O){const M=q1(g);M&&(O=m[M])}if(O)return O(g,v,x)}return!1}}function Ck({circular:n,createCustomConfig:e,strict:t}){let r={areArrayBuffersEqual:X1,areArraysEqual:t?sr:Q1,areDataViewsEqual:Z1,areDatesEqual:ek,areErrorsEqual:tk,areFunctionsEqual:nk,areMapsEqual:t?yo(Zc,sr):Zc,areNumbersEqual:rk,areObjectsEqual:t?sr:sk,arePrimitiveWrappersEqual:ik,areRegExpsEqual:ok,areSetsEqual:t?yo(eu,sr):eu,areTypedArraysEqual:t?yo(Bs,sr):Bs,areUrlsEqual:ak,unknownTagComparators:void 0};if(e&&(r=Object.assign({},r,e(r))),n){const s=as(r.areArraysEqual),i=as(r.areMapsEqual),o=as(r.areObjectsEqual),a=as(r.areSetsEqual);r=Object.assign({},r,{areArraysEqual:s,areMapsEqual:i,areObjectsEqual:o,areSetsEqual:a})}return r}function Mk(n){return function(e,t,r,s,i,o,a){return n(e,t,a)}}function Nk({circular:n,comparator:e,createState:t,equals:r,strict:s}){if(t)return function(a,l){const{cache:c=n?new WeakMap:void 0,meta:u}=t();return e(a,l,{cache:c,equals:r,meta:u,strict:s})};if(n)return function(a,l){return e(a,l,{cache:new WeakMap,equals:r,meta:void 0,strict:s})};const i={cache:void 0,equals:r,meta:void 0,strict:s};return function(a,l){return e(a,l,i)}}const Ek=Gt();Gt({strict:!0});Gt({circular:!0});Gt({circular:!0,strict:!0});Gt({createInternalComparator:()=>En});Gt({strict:!0,createInternalComparator:()=>En});Gt({circular:!0,createInternalComparator:()=>En});Gt({circular:!0,createInternalComparator:()=>En,strict:!0});function Gt(n={}){const{circular:e=!1,createInternalComparator:t,createState:r,strict:s=!1}=n,i=Ck(n),o=Sk(i),a=t?t(o):Mk(o);return Nk({circular:e,comparator:o,createState:r,equals:a,strict:s})}var uh={exports:{}},dh={};/** 226 * @license React 227 * use-sync-external-store-shim/with-selector.production.js 228 * 229 * Copyright (c) Meta Platforms, Inc. and affiliates. 230 * 231 * This source code is licensed under the MIT license found in the 232 * LICENSE file in the root directory of this source tree. 233 */var Ri=w,Tk=Ma;function Ak(n,e){return n===e&&(n!==0||1/n===1/e)||n!==n&&e!==e}var Ok=typeof Object.is=="function"?Object.is:Ak,Dk=Tk.useSyncExternalStore,Rk=Ri.useRef,_k=Ri.useEffect,Ik=Ri.useMemo,Pk=Ri.useDebugValue;dh.useSyncExternalStoreWithSelector=function(n,e,t,r,s){var i=Rk(null);if(i.current===null){var o={hasValue:!1,value:null};i.current=o}else o=i.current;i=Ik(function(){function l(h){if(!c){if(c=!0,u=h,h=r(h),s!==void 0&&o.hasValue){var m=o.value;if(s(m,h))return d=m}return d=h}if(m=d,Ok(u,h))return m;var y=r(h);return s!==void 0&&s(m,y)?(u=h,m):(u=h,d=y)}var c=!1,u,d,f=t===void 0?null:t;return[function(){return l(e())},f===null?void 0:function(){return l(f())}]},[e,t,r,s]);var a=Dk(n,i[0],i[1]);return _k(function(){o.hasValue=!0,o.value=a},[a]),Pk(a),a};uh.exports=dh;var jk=uh.exports,Lk=(...n)=>e=>{n.forEach(t=>{typeof t=="function"?t(e):t&&(t.current=e)})},Bk=({contentComponent:n})=>{const e=Ma.useSyncExternalStore(n.subscribe,n.getSnapshot,n.getServerSnapshot);return p.jsx(p.Fragment,{children:Object.values(e)})};function zk(){const n=new Set;let e={};return{subscribe(t){return n.add(t),()=>{n.delete(t)}},getSnapshot(){return e},getServerSnapshot(){return e},setRenderer(t,r){e={...e,[t]:jp.createPortal(r.reactElement,r.element,t)}
233,n.forEach(s=>s())},removeRenderer(t){const r={...e};delete r[t],e=r,n.forEach(s=>s())}}}var Fk=class extends vn.Component{constructor(n){super(n),this.editorContentRef=vn.createRef()}componentDidMount(){this.init()}componentDidUpdate(){this.init()}init(){var n;const e=this.props.editor;if(e&&!e.isDestroyed&&((n=e.view.dom)!=null&&n.parentNode)){if(e.contentComponent)return;const t=this.editorContentRef.current;t.append(...e.view.dom.parentNode.childNodes),e.setOptions({element:t}),e.contentComponent=zk(),e.createNodeViews(),e.isEditorContentInitialized=!0,this.forceUpdate()}}componentWillUnmount(){var n;const e=this.props.editor;if(e){e.isEditorContentInitialized=!1,e.isDestroyed||e.view.setProps({nodeViews:{}}),e.contentComponent=null;try{if(!((n=e.view.dom)!=null&&n.parentNode))return;const t=document.createElement("div");t.append(...e.view.dom.parentNode.childNodes),e.setOptions({element:t})}catch{}}}render(){const{editor:n,innerRef:e,...t}=this.props;return p.jsxs(p.Fragment,{children:[p.jsx("div",{ref:Lk(e,this.editorContentRef),...t}),(n==null?void 0:n.contentComponent)&&p.jsx(Bk,{contentComponent:n.contentComponent})]})}},$k=w.forwardRef((n,e)=>{const t=vn.useMemo(()=>Math.floor(Math.random()*4294967295).toString(),[n.editor]);return vn.createElement(Fk,{key:t,innerRef:e,...n})}),fh=vn.memo($k),Hk=typeof window<"u"?w.useLayoutEffect:w.useEffect,Vk=class{constructor(n){this.transactionNumber=0,this.lastTransactionNumber=0,this.subscribers=new Set,this.editor=n,this.lastSnapshot={editor:n,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.lastSnapshot:(this.lastTransactionNumber=this.transactionNumber,this.lastSnapshot={editor:this.editor,transactionNumber:this.transactionNumber},this.lastSnapshot)}getServerSnapshot(){return{editor:null,transactionNumber:0}}subscribe(n){return this.subscribers.add(n),()=>{this.subscribers.delete(n)}}watch(n){if(this.editor=n,this.editor){const e=()=>{this.transactionNumber+=1,this.subscribers.forEach(r=>r())},t=this.editor;return t.on("transaction",e),()=>{t.off("transaction",e)}}}};function Wk(n){var e;const[t]=w.useState(()=>new Vk(n.editor)),r=jk.useSyncExternalStoreWithSelector(t.subscribe,t.getSnapshot,t.getServerSnapshot,n.selector,(e=n.equalityFn)!=null?e:Ek);return Hk(()=>t.watch(n.editor),[n.editor,t]),w.useDebugValue(r),r}var Uk=!1,Zo=typeof window>"u",qk=Zo||!!(typeof window<"u"&&window.next),Kk=class hh{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(t=>t())}getInitialEditor(){if(this.options.current.immediatelyRender===void 0)return Zo||qk?null:this.createEditor();if(this.options.current.immediatelyRender&&Zo&&Uk)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:(...r)=>{var s,i;return(i=(s=this.options.current).onBeforeCreate)==null?void 0:i.call(s,...r)},onBlur:(...r)=>{var s,i;return(i=(s=this.options.current).onBlur)==null?void 0:i.call(s,...r)},onCreate:(...r)=>{var s,i;return(i=(s=this.options.current).onCreate)==null?void 0:i.call(s,...r)},onDestroy:(...r)=>{var s,i;return(i=(s=this.options.current).onDestroy)==null?void 0:i.call(s,...r)},onFocus:(...r)=>{var s,i;return(i=(s=this.options.current).onFocus)==null?void 0:i.call(s,...r)},onSelectionUpdate:(...r)=>{var s,i;return(i=(s=this.options.current).onSelectionUpdate)==null?void 0:i.call(s,...r)},onTransaction:(...r)=>{var s,i;return(i=(s=this.options.current).onTransaction)==null?void 0:i.call(s,...r)}
233,onUpdate:(...r)=>{var s,i;return(i=(s=this.options.current).onUpdate)==null?void 0:i.call(s,...r)},onContentError:(...r)=>{var s,i;return(i=(s=this.options.current).onContentError)==null?void 0:i.call(s,...r)},onDrop:(...r)=>{var s,i;return(i=(s=this.options.current).onDrop)==null?void 0:i.call(s,...r)},onPaste:(...r)=>{var s,i;return(i=(s=this.options.current).onPaste)==null?void 0:i.call(s,...r)},onDelete:(...r)=>{var s,i;return(i=(s=this.options.current).onDelete)==null?void 0:i.call(s,...r)}};return new R1(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(r=>["onCreate","onBeforeCreate","onDestroy","onUpdate","onTransaction","onFocus","onBlur","onSelectionUpdate","onContentError","onDrop","onPaste"].includes(r)?!0:r==="extensions"&&e.extensions&&t.extensions?e.extensions.length!==t.extensions.length?!1:e.extensions.every((s,i)=>{var o;return s===((o=t.extensions)==null?void 0:o[i])}):e[r]===t[r])}onRender(e){return()=>(this.isComponentMounted=!0,clearTimeout(this.scheduledDestructionTimeout),this.editor&&!this.editor.isDestroyed&&e.length===0?hh.compareOptions(this.options.current,this.editor.options)||this.editor.setOptions({...this.options.current,editable:this.editor.isEditable}):this.refreshEditorInstance(e),()=>{this.isComponentMounted=!1,this.scheduleDestroy()})}refreshEditorInstance(e){if(this.editor&&!this.editor.isDestroyed){if(this.previousDeps===null){this.previousDeps=e;return}if(this.previousDeps.length===e.length&&this.previousDeps.every((r,s)=>r===e[s]))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(()=>{if(this.isComponentMounted&&this.instanceId===e){t&&t.setOptions(this.options.current);return}t&&!t.isDestroyed&&(t.destroy(),this.instanceId===e&&this.setEditor(null))},1)}};function Jk(n={},e=[]){const t=w.useRef(n);t.current=n;const[r]=w.useState(()=>new Kk(t)),s=Ma.useSyncExternalStore(r.subscribe,r.getEditor,r.getServerSnapshot);return w.useDebugValue(s),w.useEffect(r.onRender(e)),Wk({editor:s,selector:({transactionNumber:i})=>n.shouldRerenderOnTransaction===!1||n.shouldRerenderOnTransaction===void 0?null:n.immediatelyRender&&i===0?0:i+1}),s}var ph=w.createContext({editor:null});ph.Consumer;var Yk=w.createContext({onDragStart:()=>{},nodeViewContentChildren:void 0,nodeViewContentRef:()=>{}}),Gk=()=>w.useContext(Yk);vn.forwardRef((n,e)=>{const{onDragStart:t}=Gk(),r=n.as||"div";return p.jsx(r,{...n,ref:e,"data-node-view-wrapper":"",onDragStart:t,style:{whiteSpace:"normal",...n.style}})});vn.createContext({markViewContentRef:()=>{}});var Xa=w.createContext({get editor(){throw new Error("useTiptap must be used within a <Tiptap> provider")}});Xa.displayName="TiptapContext";var Xk=()=>w.useContext(Xa);function mh({editor:n,instance:e,children:t}){const r=n??e;if(!r)throw new Error("Tiptap: An editor instance is required. Pass a non-null `editor` prop.");const s=w.useMemo(()=>({editor:r}),[r]),i=w.useMemo(()=>({editor:r}),[r]);return p.jsx(ph.Provider,{value:i,children:p.jsx(Xa.Provider,{value:s,children:t})})}mh.displayName="Tiptap";function gh({...n}){const{editor:e}=Xk();return p.jsx(fh,{editor:e,...n})}gh.displayName="Tiptap.Content";Object.assign(mh,{Content:gh});var zs=(n,e)=>{if(n==="slot")return 0;if(n instanceof Function)return n(e);const{children:t,...r}=e??{};if(n==="svg")throw new Error("SVG elements are not supported in the JSX syntax, use the array syntax instead");return[n,r,t]},Qk=/^\s*>\s$/,Zk=Be.create({name:"blockquote",addOptions(){return{HTMLAttributes:{}}},content:"block+",group:"block",defining:!0,parseHTML(){return[{tag:"blockquote"}]},renderHTML({HTMLAttributes:n}){return zs("blockquote",{...fe(this.options.HTMLAttributes,n),children:zs("slot",{})})},parseMarkdown:(n,e)=>{var t;const r=(t=e.parseBlockChildren)!=null?t:e.parseChildren;return e.createNode("blockquote",void 0,r(n.tokens||[]))},renderMarkdown:(n,e)=>{if(!n.content)return"";const t=">",r=[];return n.content.forEach((s,i)=>{var o,a;const u=((a=(o=e.renderChild)==null?void 0:o.call(e,s,i))!=null?a:e.renderChildren([s])).split(` 234`).map(d=>d.trim()===""?t:`${t} ${d}`);r.push(u.join(` 235`))}),r.join(` 236${t} 237`)},addCommands(){return{setBlockquote:()=>({commands:n})=>n.wrapIn(this.name),toggleBlockquote:()=>({commands:n})=>n.toggleWrap(this.name),unsetBlockquote:()=>({commands:n})=>n.lift(this.name)}}
vendor: 1,291 bytes, line 237
237,addKeyboardShortcuts(){return{"Mod-Shift-b":()=>this.editor.commands.toggleBlockquote()}},addInputRules(){return[Yn({find:Qk,type:this.type})]}}),ew=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,tw=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,nw=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,rw=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,sw=Nn.create({name:"bold",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"strong"},{tag:"b",getAttrs:n=>n.style.fontWeight!=="normal"&&null},{style:"font-weight=400",clearMark:n=>n.type.name===this.name},{style:"font-weight",getAttrs:n=>/^(bold(er)?|[5-9]\d{2,})$/.test(n)&&null}]},renderHTML({HTMLAttributes:n}){return zs("strong",{...fe(this.options.HTMLAttributes,n),children:zs("slot",{})})},markdownTokenName:"strong",parseMarkdown:(n,e)=>e.applyMark("bold",e.parseInline(n.tokens||[])),markdownOptions:{htmlReopen:{open:"<strong>",close:"</strong>"}},renderMarkdown:(n,e)=>`**${e.renderChildren(n)}**`,addCommands(){return{setBold:()=>({commands:n})=>n.setMark(this.name),toggleBold:()=>({commands:n})=>n.toggleMark(this.name),unsetBold:()=>({commands:n})=>n.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-b":()=>this.editor.commands.toggleBold(),"Mod-B":()=>this.editor.commands.toggleBold()}}
vendor: 7,847 bytes, lines 237-258
237,addInputRules(){return[Jn({find:ew,type:this.type}),Jn({find:nw,type:this.type})]},addPasteRules(){return[Cn({find:tw,type:this.type}),Cn({find:rw,type:this.type})]}}),iw=/(^|[^`])`([^`]+)`(?!`)$/,ow=/(^|[^`])`([^`]+)`(?!`)/g,aw=Nn.create({name:"code",addOptions(){return{HTMLAttributes:{}}},excludes:"_",code:!0,exitable:!0,parseHTML(){return[{tag:"code"}]},renderHTML({HTMLAttributes:n}){return["code",fe(this.options.HTMLAttributes,n),0]},markdownTokenName:"codespan",parseMarkdown:(n,e)=>e.applyMark("code",[{type:"text",text:n.text||""}]),renderMarkdown:(n,e)=>n.content?`\`${e.renderChildren(n.content)}\``:"",addCommands(){return{setCode:()=>({commands:n})=>n.setMark(this.name),toggleCode:()=>({commands:n})=>n.toggleMark(this.name),unsetCode:()=>({commands:n})=>n.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-e":()=>this.editor.commands.toggleCode()}},addInputRules(){return[Jn({find:iw,type:this.type})]},addPasteRules(){return[Cn({find:ow,type:this.type})]}}),bo=4,lw=/^```([a-z]+)?[\s\n]$/,cw=/^~~~([a-z]+)?[\s\n]$/,uw=Be.create({name:"codeBlock",addOptions(){return{languageClassPrefix:"language-",exitOnTripleEnter:!0,exitOnArrowDown:!0,defaultLanguage:null,enableTabIndentation:!1,tabSize:bo,HTMLAttributes:{}}},content:"text*",marks:"",group:"block",code:!0,defining:!0,addAttributes(){return{language:{default:this.options.defaultLanguage,parseHTML:n=>{var e;const{languageClassPrefix:t}=this.options;if(!t)return null;const i=[...((e=n.firstElementChild)==null?void 0:e.classList)||[]].filter(o=>o.startsWith(t)).map(o=>o.replace(t,""))[0];return i||null},rendered:!1}}},parseHTML(){return[{tag:"pre",preserveWhitespace:"full"}]},renderHTML({node:n,HTMLAttributes:e}){return["pre",fe(this.options.HTMLAttributes,e),["code",{class:n.attrs.language?this.options.languageClassPrefix+n.attrs.language:null},0]]},markdownTokenName:"code",parseMarkdown:(n,e)=>{var t,r;return((t=n.raw)==null?void 0:t.startsWith("```"))===!1&&((r=n.raw)==null?void 0:r.startsWith("~~~"))===!1&&n.codeBlockStyle!=="indented"?[]:e.createNode("codeBlock",{language:n.lang||null},n.text?[e.createTextNode(n.text)]:[])},renderMarkdown:(n,e)=>{var t;let r="";const s=((t=n.attrs)==null?void 0:t.language)||"";return n.content?r=[`\`\`\`${s}`,e.renderChildren(n.content),"```"].join(` 238`):r=`\`\`\`${s} 239 240\`\`\``,r},addCommands(){return{setCodeBlock:n=>({commands:e})=>e.setNode(this.name,n),toggleCodeBlock:n=>({commands:e})=>e.toggleNode(this.name,"paragraph",n)}},addKeyboardShortcuts(){return{"Mod-Alt-c":()=>this.editor.commands.toggleCodeBlock(),Backspace:()=>{const{empty:n,$anchor:e}=this.editor.state.selection,t=e.pos===1;return!n||e.parent.type.name!==this.name?!1:t||!e.parent.textContent.length?this.editor.commands.clearNodes():!1},Tab:({editor:n})=>{var e;if(!this.options.enableTabIndentation)return!1;const t=(e=this.options.tabSize)!=null?e:bo,{state:r}=n,{selection:s}=r,{$from:i,empty:o}=s;if(i.parent.type!==this.type)return!1;const a=" ".repeat(t);return o?n.commands.insertContent(a):n.commands.command(({tr:l})=>{const{from:c,to:u}=s,h=r.doc.textBetween(c,u,` 241`,` 242`).split(` 243`).map(m=>a+m).join(` 244`);return l.replaceWith(c,u,r.schema.text(h)),!0})},"Shift-Tab":({editor:n})=>{var e;if(!this.options.enableTabIndentation)return!1;const t=(e=this.options.tabSize)!=null?e:bo,{state:r}=n,{selection:s}=r,{$from:i,empty:o}=s;return i.parent.type!==this.type?!1:o?n.commands.command(({tr:a})=>{var l;const{pos:c}=i,u=i.start(),d=i.end(),h=r.doc.textBetween(u,d,` 245`,` 246`).split(` 247`);let m=0,y=0;const g=c-u;for(let O=0;O<h.length;O+=1){if(y+h[O].length>=g){m=O;break}y+=h[O].length+1}const x=((l=h[m].match(/^ */))==null?void 0:l[0])||"",N=Math.min(x.length,t);if(N===0)return!0;let A=u;for(let O=0;O<m;O+=1)A+=h[O].length+1;return a.delete(A,A+N),c-A<=N&&a.setSelection($.create(a.doc,A)),!0}):n.commands.command(({tr:a})=>{const{from:l,to:c}=s,f=r.doc.textBetween(l,c,` 248`,` 249`).split(` 250`).map(h=>{var m;const y=((m=h.match(/^ */))==null?void 0:m[0])||"",g=Math.min(y.length,t);return h.slice(g)}).join(` 251`);return a.replaceWith(l,c,r.schema.text(f)),!0})},Enter:({editor:n})=>{if(!this.options.exitOnTripleEnter)return!1;const{state:e}=n,{selection:t}=e,{$from:r,empty:s}=t;if(!s||r.parent.type!==this.type)return!1;const i=r.parentOffset===r.parent.nodeSize-2,o=r.parent.textContent.endsWith(` 252 253`);return!i||!o?!1:n.chain().command(({tr:a})=>(a.delete(r.pos-2,r.pos),!0)).exitCode().run()},ArrowDown:({editor:n})=>{if(!this.options.exitOnArrowDown)return!1;const{state:e}=n,{selection:t,doc:r}=e,{$from:s,empty:i}=t;if(!i||s.parent.type!==this.type||!(s.parentOffset===s.parent.nodeSize-2))return!1;const a=s.after();return a===void 0?!1:r.nodeAt(a)?n.commands.command(({tr:c})=>(c.setSelection(W.near(r.resolve(a))),!0)):n.commands.exitCode()}}},addInputRules(){return[Xo({find:lw,type:this.type,getAttributes:n=>({language:n[1]})}),Xo({find:cw,type:this.type,getAttributes:n=>({language:n[1]})})]},addProseMirrorPlugins(){return[new ae({key:new ve("codeBlockVSCodeHandler"),props:{handlePaste:(n,e)=>{if(!e.clipboardData||this.editor.isActive(this.type.name))return!1;const t=e.clipboardData.getData("text/plain"),r=e.clipboardData.getData("vscode-editor-data"),s=r?JSON.parse(r):void 0,i=s==null?void 0:s.mode;if(!t||!i)return!1;const{tr:o,schema:a}=n.state,l=a.text(t.replace(/\r\n?/g,` 254`));return o.replaceSelectionWith(this.type.create({language:i},l)),o.selection.$from.parent.type!==this.type&&o.setSelection($.near(o.doc.resolve(Math.max(0,o.selection.from-2)))),o.setMeta("paste",!0),n.dispatch(o),!0}}})]}}),dw=Be.create({name:"doc",topNode:!0,content:"block+",renderMarkdown:(n,e)=>n.content?e.renderChildren(n.content,` 255 256`):""}),fw=Be.create({name:"hardBreak",markdownTokenName:"br",addOptions(){return{keepMarks:!0,HTMLAttributes:{}}},inline:!0,group:"inline",selectable:!1,linebreakReplacement:!0,parseHTML(){return[{tag:"br"}]},renderHTML({HTMLAttributes:n}){return["br",fe(this.options.HTMLAttributes,n)]},renderText(){return` 257`},renderMarkdown:()=>` 258`,parseMarkdown:()=>({type:"hardBreak"}),addCommands(){return{setHardBreak:()=>({commands:n,chain:e,state:t,editor:r})=>n.first([()=>n.exitCode(),()=>n.command(()=>{const{selection:s,storedMarks:i}=t;if(s.$from.parent.type.spec.isolating)return!1;const{keepMarks:o}=this.options,{splittableMarks:a}=r.extensionManager,l=i||s.$to.parentOffset&&s.$from.marks();return e().insertContent({type:this.name}).command(({tr:c,dispatch:u})=>{if(u&&l&&o){const d=l.filter(f=>a.includes(f.type.name));c.ensureMarks(d)}return!0}).run()})])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}}),hw=Be.create({name:"heading",addOptions(){return{levels:[1,2,3,4,5,6],HTMLAttributes:{}}},content:"inline*",group:"block",defining:!0,addAttributes(){return{level:{default:1,rendered:!1}}},parseHTML(){return this.options.levels.map(n=>({tag:`h${n}`,attrs:{level:n}}))},renderHTML({node:n,HTMLAttributes:e}){return[`h${this.options.levels.includes(n.attrs.level)?n.attrs.level:this.options.levels[0]}`,fe(this.options.HTMLAttributes,e),0]},parseMarkdown:(n,e)=>e.createNode("heading",{level:n.depth||1},e.parseInline(n.tokens||[])),renderMarkdown:(n,e)=>{var t;const r=(t=n.attrs)!=null&&t.level?parseInt(n.attrs.level,10):1,s="#".repeat(r);return n.content?`${s} ${e.renderChildren(n.content)}`:""},addCommands(){return{setHeading:n=>({commands:e})=>this.options.levels.includes(n.level)?e.setNode(this.name,n):!1,toggleHeading:n=>({commands:e})=>this.options.levels.includes(n.level)?e.toggleNode(this.name,"paragraph",n):!1}},addKeyboardShortcuts(){return this.options.levels.reduce((n,e)=>({...n,[`Mod-Alt-${e}`]:()=>this.editor.commands.toggleHeading({level:e})}),{})},addInputRules(){return this.options.levels.map(n=>Xo({find:new RegExp(`^(#{${Math.min(...this.options.levels)},${n}}
258)\\s$`),type:this.type,getAttributes:{level:n}}))}}),pw=Be.create({name:"horizontalRule",addOptions(){return{HTMLAttributes:{},nextNodeType:"paragraph"}},group:"block",parseHTML(){return[{tag:"hr"}]},renderHTML({HTMLAttributes:n}){return["hr",fe(this.options.HTMLAttributes,n)]},markdownTokenName:"hr",parseMarkdown:(n,e)=>e.createNode("horizontalRule"),renderMarkdown:()=>"---",addCommands(){return{setHorizontalRule:()=>({chain:n,state:e})=>{if(!P1(e,e.schema.nodes[this.name]))return!1;const{selection:t}=e,{$to:r}=t,s=n();return Hf(t)?s.insertContentAt(r.pos,{type:this.name}):s.insertContent({type:this.name}),s.command(({state:i,tr:o,dispatch:a})=>{if(a){const{$to:l}=o.selection,c=l.end();if(l.nodeAfter)l.nodeAfter.isTextblock?o.setSelection($.create(o.doc,l.pos+1)):l.nodeAfter.isBlock?o.setSelection(L.create(o.doc,l.pos)):o.setSelection($.create(o.doc,l.pos));else{const u=i.schema.nodes[this.options.nextNodeType]||l.parent.type.contentMatch.defaultType,d=u==null?void 0:u.create();d&&(o.insert(c,d),o.setSelection($.create(o.doc,c+1)))}o.scrollIntoView()}return!0}).run()}}},addInputRules(){return[oh({find:/^(?:---|â-|___\s|\*\*\*\s)$/,type:this.t
vendor: 1,046 bytes, line 258
258ype})]}}),mw=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,gw=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,yw=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,bw=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,vw=Nn.create({name:"italic",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"em"},{tag:"i",getAttrs:n=>n.style.fontStyle!=="normal"&&null},{style:"font-style=normal",clearMark:n=>n.type.name===this.name},{style:"font-style=italic"}]},renderHTML({HTMLAttributes:n}){return["em",fe(this.options.HTMLAttributes,n),0]},addCommands(){return{setItalic:()=>({commands:n})=>n.setMark(this.name),toggleItalic:()=>({commands:n})=>n.toggleMark(this.name),unsetItalic:()=>({commands:n})=>n.unsetMark(this.name)}},markdownTokenName:"em",parseMarkdown:(n,e)=>e.applyMark("italic",e.parseInline(n.tokens||[])),markdownOptions:{htmlReopen:{open:"<em>",close:"</em>"}},renderMarkdown:(n,e)=>`*${e.renderChildren(n)}*`,addKeyboardShortcuts(){return{"Mod-i":()=>this.editor.commands.toggleItalic(),"Mod-I":()=>this.editor.commands.toggleItalic()}}
258,addInputRules(){return[Jn({find:mw,type:this.type}),Jn({find:yw,type:this.type})]},addPasteRules(){return[Cn({find:gw,type:this.type}),Cn({find:bw,type:this.type})]}});const xw="aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dad1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3nlop4pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2o0dyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3nd0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rckmsd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0axi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0stone5umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp3ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5mögensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2olterskluwer11odside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yac
258hts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2",kw="ελ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",ea="numeric",ta="ascii",na="alpha",br="asciinumeric",fr="alphanumeric",ra="domain",yh="emoji",ww="scheme",Sw="slashscheme",vo="whitespace";function Cw(n,e){return n in e||(e[n]=[]),e[n]}function fn(n,e,t){e[ea]&&(e[br]=!0,e[fr]=!0),e[ta]&&(e[br]=!0,e[na]=!0),e[br]&&(e[fr]=!0),e[na]&&(e[fr]=!0),e[fr]&&(e[ra]=!0),e[yh]&&(e[ra]=!0);for(const r in e){const s=Cw(r,t);s.indexOf(n)<0&&s.push(n)}}function Mw(n,e){const t={};for(const r in e)e[r].indexOf(n)>=0&&(t[r]=!0);return t}function $e(n=null){this.j={},this.jr=[],this.jd=null,this.t=n}$e.groups={};$e.prototype={accepts(){return!!this.t},go(n){const e=this,t=e.j[n];if(t)return t;for(let r=0;r<e.jr.length;r++){const s=e.jr[r][0],i=e.jr[r][1];if(i&&s.test(n))return i}return e.jd},has(n,e=!1){return e?n in this.j:!!this.go(n)},ta(n,e,t,r){for(let s=0;s<n.length;s++)this.tt(n[s],e,t,r)},tr(n,e,t,r){r=r||$e.groups;let s;return e&&e.j?s=e:(s=new $e(e),t&&r&&fn(e,t,r)),this.jr.push([n,s]),s},ts(n,e,t,r){let s=this;const i=n.length;if(!i)return s;for(let o=0;o<i-1;o++)s=s.tt(n[o]);return s.tt(n[i-1],e,t,r)},tt(n,e,t,r){r=r||$e.groups;const s=this;if(e&&e.j)return s.j[n]=e,e;const i=e;let o,a=s.go(n);if(a?(o=new $e,Object.assign(o.j,a.j),o.jr.push.apply(o.jr,a.jr),o.jd=a.jd,o.t=a.t):o=new $e,
vendor: 13,527 bytes, lines 258-262
258i){if(r)if(o.t&&typeof o.t=="string"){const l=Object.assign(Mw(o.t,r),t);fn(i,l,r)}else t&&fn(i,t,r);o.t=i}return s.j[n]=o,o}};const V=(n,e,t,r,s)=>n.ta(e,t,r,s),ce=(n,e,t,r,s)=>n.tr(e,t,r,s),tu=(n,e,t,r,s)=>n.ts(e,t,r,s),E=(n,e,t,r,s)=>n.tt(e,t,r,s),bt="WORD",sa="UWORD",bh="ASCIINUMERICAL",vh="ALPHANUMERICAL",Pr="LOCALHOST",ia="TLD",oa="UTLD",vs="SCHEME",Pn="SLASH_SCHEME",Qa="NUM",aa="WS",Za="NL",vr="OPENBRACE",xr="CLOSEBRACE",Fs="OPENBRACKET",$s="CLOSEBRACKET",Hs="OPENPAREN",Vs="CLOSEPAREN",Ws="OPENANGLEBRACKET",Us="CLOSEANGLEBRACKET",qs="FULLWIDTHLEFTPAREN",Ks="FULLWIDTHRIGHTPAREN",Js="LEFTCORNERBRACKET",Ys="RIGHTCORNERBRACKET",Gs="LEFTWHITECORNERBRACKET",Xs="RIGHTWHITECORNERBRACKET",Qs="FULLWIDTHLESSTHAN",Zs="FULLWIDTHGREATERTHAN",ei="AMPERSAND",ti="APOSTROPHE",ni="ASTERISK",_t="AT",ri="BACKSLASH",si="BACKTICK",ii="CARET",jt="COLON",el="COMMA",oi="DOLLAR",at="DOT",ai="EQUALS",tl="EXCLAMATION",Je="HYPHEN",kr="PERCENT",li="PIPE",ci="PLUS",ui="POUND",wr="QUERY",nl="QUOTE",xh="FULLWIDTHMIDDLEDOT",rl="SEMI",lt="SLASH",Sr="TILDE",di="UNDERSCORE",kh="EMOJI",fi="SYM";var wh=Object.freeze({__proto__:null,ALPHANUMERICAL:vh,AMPERSAND:ei,APOSTROPHE:ti,ASCIINUMERICAL:bh,ASTERISK:ni,AT:_t,BACKSLASH:ri,BACKTICK:si,CARET:ii,CLOSEANGLEBRACKET:Us,CLOSEBRACE:xr,CLOSEBRACKET:$s,CLOSEPAREN:Vs,COLON:jt,COMMA:el,DOLLAR:oi,DOT:at,EMOJI:kh,EQUALS:ai,EXCLAMATION:tl,FULLWIDTHGREATERTHAN:Zs,FULLWIDTHLEFTPAREN:qs,FULLWIDTHLESSTHAN:Qs,FULLWIDTHMIDDLEDOT:xh,FULLWIDTHRIGHTPAREN:Ks,HYPHEN:Je,LEFTCORNERBRACKET:Js,LEFTWHITECORNERBRACKET:Gs,LOCALHOST:Pr,NL:Za,NUM:Qa,OPENANGLEBRACKET:Ws,OPENBRACE:vr,OPENBRACKET:Fs,OPENPAREN:Hs,PERCENT:kr,PIPE:li,PLUS:ci,POUND:ui,QUERY:wr,QUOTE:nl,RIGHTCORNERBRACKET:Ys,RIGHTWHITECORNERBRACKET:Xs,SCHEME:vs,SEMI:rl,SLASH:lt,SLASH_SCHEME:Pn,SYM:fi,TILDE:Sr,TLD:ia,UNDERSCORE:di,UTLD:oa,UWORD:sa,WORD:bt,WS:aa});const gt=/[a-z]/,ir=new RegExp("\\p{L}","u"),xo=new RegExp("\\p{Emoji}","u"),yt=/\d/,ko=/\s/,nu="\r",wo=` 259`,Nw="ï¸",Ew="â",So="";let ls=null,cs=null;function Tw(n=[]){const e={};$e.groups=e;const t=new $e;ls==null&&(ls=ru(xw)),cs==null&&(cs=ru(kw)),E(t,"'",ti),E(t,"{",vr),E(t,"}",xr),E(t,"[",Fs),E(t,"]",$s),E(t,"(",Hs),E(t,")",Vs),E(t,"<",Ws),E(t,">",Us),E(t,"ï¼",qs),E(t,"ï¼",Ks),E(t,"ã",Js),E(t,"ã",Ys),E(t,"ã",Gs),E(t,"ã",Xs),E(t,"ï¼",Qs),E(t,"ï¼",Zs),E(t,"&",ei),E(t,"*",ni),E(t,"@",_t),E(t,"`",si),E(t,"^",ii),E(t,":",jt),E(t,",",el),E(t,"$",oi),E(t,".",at),E(t,"=",ai),E(t,"!",tl),E(t,"-",Je),E(t,"%",kr),E(t,"|",li),E(t,"+",ci),E(t,"#",ui),E(t,"?",wr),E(t,'"',nl),E(t,"/",lt),E(t,";",rl),E(t,"~",Sr),E(t,"_",di),E(t,"\\",ri),E(t,"ã»",xh);const r=ce(t,yt,Qa,{[ea]:!0});ce(r,yt,r);const s=ce(r,gt,bh,{[br]:!0}),i=ce(r,ir,vh,{[fr]:!0}),o=ce(t,gt,bt,{[ta]:!0});ce(o,yt,s),ce(o,gt,o),ce(s,yt,s),ce(s,gt,s);const a=ce(t,ir,sa,{[na]:!0});ce(a,gt),ce(a,yt,i),ce(a,ir,a),ce(i,yt,i),ce(i,gt),ce(i,ir,i);const l=E(t,wo,Za,{[vo]:!0}),c=E(t,nu,aa,{[vo]:!0}),u=ce(t,ko,aa,{[vo]:!0});E(t,So,u),E(c,wo,l),E(c,So,u),ce(c,ko,u),E(u,nu),E(u,wo),ce(u,ko,u),E(u,So,u);const d=ce(t,xo,kh,{[yh]:!0});E(d,"#"),ce(d,xo,d),E(d,Nw,d);const f=E(d,Ew);E(f,"#"),ce(f,xo,d);const h=[[gt,o],[yt,s]],m=[[gt,null],[ir,a],[yt,i]];for(let y=0;y<ls.length;y++)Et(t,ls[y],ia,bt,h);for(let y=0;y<cs.length;y++)Et(t,cs[y],oa,sa,m);fn(ia,{tld:!0,ascii:!0},e),fn(oa,{utld:!0,alpha:!0},e),Et(t,"file",vs,bt,h),Et(t,"mailto",vs,bt,h),Et(t,"http",Pn,bt,h),Et(t,"https",Pn,bt,h),Et(t,"ftp",Pn,bt,h),Et(t,"ftps",Pn,bt,h),fn(vs,{scheme:!0,ascii:!0},e),fn(Pn,{slashscheme:!0,ascii:!0},e),n=n.sort((y,g)=>y[0]>g[0]?1:-1);for(let y=0;y<n.length;y++){const g=n[y][0],x=n[y][1]?{[ww]:!0}:{[Sw]:!0};g.indexOf("-")>=0?x[ra]=!0:gt.test(g)?yt.test(g)?x[br]=!0:x[ta]=!0:x[ea]=!0,tu(t,g,g,x)}return tu(t,"localhost",Pr,{ascii:!0}),t.jd=new $e(fi),{start:t,tokens:Object.assign({groups:e},wh)}}function Sh(n,e){const t=Aw(e.replace(/[A-Z]/g,a=>a.toLowerCase())),r=t.length,s=[];let i=0,o=0;for(;o<r;){let a=n,l=null,c=0,u=null,d=-1,f=-1;for(;o<r&&(l=a.go(t[o]));)a=l,a.accepts()?(d=0,f=0,u=a):d>=0&&(d+=t[o].length,f++),c+=t[o].length,i+=t[o].length,o++;i-=d,o-=f,c-=d,s.push({t:u.t,v:e.slice(i-c,i),s:i-c,e:i})}return s}function Aw(n){const e=[],t=n.length;let r=0;for(;r<t;){let s=n.charCodeAt(r),i,o=s<55296||s>56319||r+1===t||(i=n.charCodeAt(r+1))<56320||i>57343?n[r]:n.slice(r,r+2);e.push(o),r+=o.length}return e}function Et(n,e,t,r,s){let i;const o=e.length;for(let a=0;a<o-1;a++){const l=e[a];n.j[l]?i=n.j[l]:(i=new $e(r),i.jr=s.slice(),n.j[l]=i),n=i}return i=new $e(t),i.jr=s.slice(),n.j[e[o-1]]=i,i}function ru(n){const e=[],t=[];let r=0,s="0123456789";for(;r<n.length;){let i=0;for(;s.indexOf(n[r+i])>=0;)i++;if(i>0){e.push(t.join(""));for(let o=parseInt(n.substring(r,r+i),10);o>0;o--)t.pop();r+=i}else t.push(n[r]),r++}return e}const jr={defaultProtocol:"http",events:null,format:su,formatHref:su,nl2br:!1,tagName:"a",target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function sl(n,e=null){let t=Object.assign({},jr);n&&(t=Object.assign(t,n instanceof sl?n.o:n));const r=t.ignoreTags,s=[];for(let i=0;i<r.length;i++)s.push(r[i].toUpperCase());this.o=t,e&&(this.defaultRender=e),this.ignoreTags=s}sl.prototype={o:jr,ignoreTags:[],defaultRender(n){return n},check(n){return this.get("validate",n.toString(),n)},get(n,e,t){const r=e!=null;let s=this.o[n];return s&&(typeof s=="object"?(s=t.t in s?s[t.t]:jr[n],typeof s=="function"&&r&&(s=s(e,t))):typeof s=="function"&&r&&(s=s(e,t.t,t)),s)},getObj(n,e,t){let r=this.o[n];return typeof r=="function"&&e!=null&&(r=r(e,t.t,t)),r},render(n){const e=n.render(this);return(this.get("render",null,n)||this.defaultRender)(e,n.t,n)}};function su(n){return n}function Ch(n,e){this.t="token",this.v=n,this.tk=e}Ch.prototype={isLink:!1,toString(){return this.v},toHref(n){return this.toString()},toFormattedString(n){const e=this.toString(),t=n.get("truncate",e,this),r=n.get("format",e,this);return t&&r.length>t?r.substring(0,t)+"â¦":r},toFormattedHref(n){return n.get("formatHref",this.toHref(n.get("defaultProtocol")),this)},startIndex(){return this.tk[0].s},endIndex(){return this.tk[this.tk.length-1].e},toObject(n=jr.defaultProtocol){return{type:this.t,value:this.toString(),isLink:this.isLink,href:this.toHref(n),start:this.startIndex(),end:this.endIndex()}},toFormattedObject(n){return{type:this.t,value:this.toFormattedString(n),isLink:this.isLink,href:this.toFormattedHref(n),start:this.startIndex(),end:this.endIndex()}},validate(n){return n.get("validate",this.toString(),this)},render(n){const e=this,t=this.toHref(n.get("defaultProtocol")),r=n.get("formatHref",t,this),s=n.get("tagName",t,e),i=this.toFormattedString(n),o={},a=n.get("className",t,e),l=n.get("target",t,e),c=n.get("rel",t,e),u=n.getObj("attributes",t,e),d=n.getObj("events",t,e);return o.href=r,a&&(o.class=a),l&&(o.target=l),c&&(o.rel=c),u&&Object.assign(o,u),{tagName:s,attributes:o,content:i,eventListeners:d}}};function _i(n,e){class t extends Ch{constructor(s,i){super(s,i),this.t=n}}for(const r in e)t.prototype[r]=e[r];return t.t=n,t}const iu=_i("email",{isLink:!0,toHref(){return"mailto:"+this.toString()}}),ou=_i("text"),Ow=_i("nl"),us=_i("url",{isLink:!0,toHref(n=jr.defaultProtocol){return this.hasProtocol()?this.v:`${n}://${this.v}`},hasProtocol(){const n=this.tk;return n.length>=2&&n[0].t!==Pr&&n[1].t===jt}}),Ke=n=>new $e(n);function Dw({groups:n}){const e=n.domain.concat([ei,ni,_t,ri,si,ii,oi,ai,Je,Qa,kr,li,ci,ui,lt,fi,Sr,di]),t=[ti,jt,el,at,tl,kr,wr,nl,rl,Ws,Us,vr,xr,$s,Fs,Hs,Vs,qs,Ks,Js,Ys,Gs,Xs,Qs,Zs],r=[ei,ti,ni,ri,si,ii,oi,ai,Je,vr,xr,kr,li,ci,ui,wr,lt,fi,Sr,di],s=Ke(),i=E(s,Sr);V(i,r,i),V(i,n.domain,i);const o=Ke(),a=Ke(),l=Ke();V(s,n.domain,o),V(s,n.scheme,a),V(s,n.slashscheme,l),V(o,r,i),V(o,n.domain,o);const c=E(o,_t);E(i,_t,c),E(a,_t,c),E(l,_t,c);const u=E(i,at);V(u,r,i),V(u,n.domain,i);const d=Ke();V(c,n.domain,d),V(d,n.domain,d);const f=E(d,at);V(f,n.domain,d);const h=Ke(iu);V(f,n.tld,h),V(f,n.utld,h),E(c,Pr,h);const m=E(d,Je);E(m,Je,m),V(m,n.domain,d),V(h,n.domain,d),E(h,at,f),E(h,Je,m);const y=E(h,jt);V(y,n.numeric,iu);const g=E(o,Je),v=E(o,at);E(g,Je,g),V(g,n.domain,o),V(v,r,i),V(v,n.domain,o);const x=Ke(us);V(v,n.tld,x),V(v,n.utld,x),V(x,n.domain,o),V(x,r,i),E(x,at,v),E(x,Je,g),E(x,_t,c);const N=E(x,jt),A=Ke(us);V(N,n.numeric,A);const S=Ke(us),O=Ke();V(S,e,S),V(S,t,O),V(O,e,S),V(O,t,O),E(x,lt,S),E(A,lt,S);const M=E(a,jt),B=E(l,jt),U=E(B,lt),re=E(U,lt);V(a,n.domain,o),E(a,at,v),E(a,Je,g),V(l,n.domain,o),E(l,at,v),E(l,Je,g),V(M,n.domain,S),E(M,lt,S),E(M,wr,S),V(re,n.domain,S),V(re,e,S),E(re,lt,S);const we=[[vr,xr],[Fs,$s],[Hs,Vs],[Ws,Us],[qs,Ks],[Js,Ys],[Gs,Xs],[Qs,Zs]];for(let ne=0;ne<we.length;ne++){const[le,D]=we[ne],j=E(S,le);E(O,le,j),E(j,D,S);const et=Ke(us);V(j,e,et);const _=Ke();V(j,t),V(et,e,et),V(et,t,_),V(_,e,et),V(_,t,_),E(et,D,S),E(_,D,S)}return E(s,Pr,x),E(s,Za,Ow),{start:s,tokens:wh}}function Rw(n,e,t){let r=t.length,s=0,i=[],o=[];for(;s<r;){let a=n,l=null,c=null,u=0,d=null,f=-1;for(;s<r&&!(l=a.go(t[s].t));)o.push(t[s++]);for(;s<r&&(c=l||a.go(t[s].t));)l=null,a=c,a.accepts()?(f=0,d=a):f>=0&&f++,s++,u++;if(f<0)s-=u,s<r&&(o.push(t[s]),s++);else{o.length>0&&(i.push(Co(ou,e,o)),o=[]),s-=f,u-=f;const h=d.t,m=t.slice(s-u,s);i.push(Co(h,e,m))}}return o.length>0&&i.push(Co(ou,e,o)),i}function Co(n,e,t){const r=t[0].s,s=t[t.length-1].e,i=e.slice(r,s);return new n(i,t)}const _w=typeof console<"u"&&console&&console.warn||(()=>{}),Iw="until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.",ee={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1};function Pw(){return $e.groups={},ee.scanner=null,ee.parser=null,ee.tokenQueue=[],ee.pluginQueue=[],ee.customSchemes=[],ee.initialized=!1,ee}function au(n,e=!1){if(ee.initialized&&_w(`linkifyjs: already initialized - will not register custom scheme "${n}" ${Iw}`),!/^[0-9a-z]+(-[0-9a-z]+)*$/.test(n))throw new Error(`linkifyjs: incorrect scheme format. 2601. Must only contain digits, lowercase ASCII letters or "-" 2612. Cannot start or end with "-" 2623. "-" cannot repeat`);ee.customSchemes.push([n,e])}function jw(){ee.scanner=Tw(ee.customSchemes);for(let n=0;n<ee.tokenQueue.length;n++)ee.tokenQueue[n][1]({scanner:ee.scanner});ee.parser=Dw(ee.scanner.tokens);for(let n=0;n<ee.pluginQueue.length;n++)ee.pluginQueue[n][1]({scanner:ee.scanner,parser:ee.parser});return ee.initialized=!0,ee}function il(n){return ee.initialized||jw(),Rw(ee.parser.start,n,Sh(ee.scanner.start,n))}il.scan=Sh;function Mh(n,e=null,t=null){if(e&&typeof e=="object"){if(t)throw Error(`linkifyjs: Invalid link type ${e}; must be a string`);t=e,e=null}const r=new sl(t),s=il(n),i=[];for(let o=0;o<s.length;o++){const a=s[o];a.isLink&&(!e||a.t===e)&&r.check(a)&&i.push(a.toFormattedObject(r))}return i}var ol="[\0-  áá â-\u2029âã]",Lw=new RegExp(ol),Bw=new RegExp(`${ol}$`),zw=new RegExp(ol,"g");function Fw(n){return n.length===1?n[0].isLink:n.length===3&&n[1].isLink?["()","[]"].includes(n[0].value+n[2].value):!1}function $w(n){return new ae({key:new ve("autolink"),appendTransaction:(e,t,r)=>{const s=e.some(c=>c.docChanged)&&!t.doc.eq(r.doc),i=e.some(c=>c.getMeta("preventAutolink"));if(!s||i)return;const{tr:o}=r,a=If(t.doc,[...e]);if($f(a).forEach(({newRange:c})=>{const u=_x(r.doc,c,h=>h.isTextblock);let d,f;if(u.length>1)d=u[0],f=r.doc.textBetween(d.pos,d.pos+d.node.nodeSize,void 0," ");else if(u.length){const h=r.doc.textBetween(c.from,c.to," "," ");if(!Bw.test(h))return;d=u[0],f=r.doc.textBetween(d.pos,c.to,void 0," ")}if(d&&f){const h=f.split(Lw).filter(Boolean);if(h.length<=0)return!1;const m=h[h.length-1],y=d.pos+f.lastIndexOf(m);if(!m)return!1;const g=il(m).map(v=>v.toObject(n.defaultProtocol));if(!Fw(g))return!1;g.filter(v=>v.isLink).map(v=>({...v,from:y+v.start+1,to:y+v.end+1})).filter(v=>r.schema.marks.code?!r.doc.rangeHasMark(v.from,v.to,r.schema.marks.code):!0).filter(v=>n.validate(v.value)).filter(v=>n.shouldAutoLink(v.value)).forEach(v=>{qa(v.from,v.to,r.doc).some(x=>x.mark.type===n.type)||o.addMark(v.from,v.to,n.type.create({href:v.href}))})}}),!!o.steps.length)return o}})}function Hw(n){return new ae({key:new ve("handleClickLink"),props:{handleClick:(e,t,r)=>{var s,i;if(r.button!==0||!e.editable)return!1;let o=null;if(r.target instanceof HTMLAnchorElement)o=r.target;else{const l=r.target;if(!l)return!1;const c=n.editor.view.dom;o=l.closest("a"),o&&!c.contains(o)&&(o=null)}if(!o)return!1;let a=!1;if(n.enableClickSelection&&(a=n.editor.commands.extendMarkRange(n.type.name)),n.openOnClick){const l=Ff(e.state,n.type.name),c=(s=o.href)!=null?s:l.href,u=(i=o.target)!=null?i:l.target;c&&(window.open(c,u),a=!0)}return a}}})}function Vw(n){return new ae({key:new ve("handlePasteLink"),props:{handlePaste:(e,t,r)=>{const{shouldAutoLink:s}=n,{state:i}=e,{selection:o}=i,{empty:a}=o;if(a)return!1;let l="";r.content.forEach(u=>{l+=u.textContent});const c=Mh(l,{defaultProtocol:n.defaultProtocol}).find(u=>u.isLink&&u.value===l);return!l||!c||s!==void 0&&!s(c.value)?!1:n.editor.commands.setMark(n.type,{href:c.href})}}})}function sn(n,e){const t=["http","https","ftp","ftps","mailto","tel","callto","sms","cid","xmpp"];return e&&e.forEach(r=>{const s=typeof r=="string"?r:r.scheme;s&&t.push(s)}),!n||n.replace(zw,"").match(new RegExp(`^(?:(?:${t.join("|")}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`,"i"))}var Nh=Nn.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 `val
262idate` option is deprecated. Rename to the `shouldAutoLink` option instead.")),this.options.protocols.forEach(n=>{if(typeof n=="string"){au(n);return}au(n.scheme,n.optionalSlashes)})},onDestroy(){Pw()},inclusive(){return this.options.autolink},addOptions(){return{openOnClick:!0,enableClickSelection:!1,linkOnPaste:!0,autolink:!0,protocols:[],defaultProtocol:"http",HTMLAttributes:{target:"_blank",rel:"noopener noreferrer nofollow",class:null},isAllowedUri:(n,e)=>!!sn(n,e.protocols),validate:n=>!!n,shouldAutoLink:n=>{const e=/^[a-z][a-z0-9+.-]*:\/\//i.test(n),t=/^[a-z][a-z0-9+.-]*:/i.test(n);if(e||t&&!n.includes("@"))return!0;const s=(n.includes("@")?n.split("@").pop():n).split(/[/?#:]/)[0];return!(/^\d{1,3}(\.\d{1,3}){3}$/.test(s)||!/\./.test(s))}}},addAttributes(){return{href:{default:null,parseHTML(n){return n.getAttribute("href")}},target:{default:this.options.HTMLAttributes.target},rel:{default:this.options.HTMLAttributes.rel},class:{default:this.options.HTMLAttributes.class},title:{default:null}}},parseHTML(){return[{tag:"a[href]",getAttrs:n=>{const e=n.getAttribute("href");return!e||!this.options.isAllowedUri(e,{defaultValidate:t=>!!sn(t,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:null}}]},renderHTML({HTMLAttributes:n}){return this.options.isAllowedUri(n.href,{defaultValidate:e=>!!sn(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?["a",fe(this.options.HTMLAttributes,n),0]:["a",fe(this.options.HTMLAttributes,{...n,href:""}),0]},markdownTokenName:"link",parseMarkdown:(n,e)=>e.applyMark("link",e.parseInline(n.tokens||[]),{href:n.href,title:n.title||null}),renderMarkdown:(n,e)=>{var t,r,s,i;const o=(r=(t=n.attrs)==null?void 0:t.href)!=null?r:"",a=(i=(s=n.attrs)==null?void 0:s.title)!=null?i:"",l=e.renderChildren(n);return a?`[${l}](${o} "${a}")`:`[${l}](${o})`},addCommands(){return{setLink:n=>({chain:e})=>{const{href:t}=n;return this.options.isAllowedUri(t,{defaultValidate:r=>!!sn(r,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?e().setMark(this.name,n).setMeta("preventAutolink",!0).run():!1},toggleLink:n=>({chain:e})=>{const{href:t}=n||{};return t&&!this.options.isAllowedUri(t,{defaultValidate:r=>!!sn(r,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:e().toggleMark(this.name,n,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()},unsetLink:()=>({chain:n})=>n().unsetMark(this.name,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()}},addPasteRules(){return[Cn({find:n=>{const e=[];if(n){const{protocols:t,defaultProtocol:r}=this.options,s=Mh(n).filter(i=>i.isLink&&this.options.isAllowedUri(i.value,{defaultValidate:o=>!!sn(o,t),protocols:t,defaultProtocol:r}));s.length&&s.forEach(i=>{this.options.shouldAutoLink(i.value)&&e.push({text:i.value,data:{href:i.href},index:i.start})})}return e}
vendor: 12,985 bytes, lines 262-271
262,type:this.type,getAttributes:n=>{var e;return{href:(e=n.data)==null?void 0:e.href}}})]},addProseMirrorPlugins(){const n=[],{protocols:e,defaultProtocol:t}=this.options;return this.options.autolink&&n.push($w({type:this.type,defaultProtocol:this.options.defaultProtocol,validate:r=>this.options.isAllowedUri(r,{defaultValidate:s=>!!sn(s,e),protocols:e,defaultProtocol:t}),shouldAutoLink:this.options.shouldAutoLink})),n.push(Hw({type:this.type,editor:this.editor,openOnClick:this.options.openOnClick==="whenNotEditable"?!0:this.options.openOnClick,enableClickSelection:this.options.enableClickSelection})),this.options.linkOnPaste&&n.push(Vw({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type,shouldAutoLink:this.options.shouldAutoLink})),n}}),Ww=Nh,Uw=Object.defineProperty,qw=(n,e)=>{for(var t in e)Uw(n,t,{get:e[t],enumerable:!0})},Kw="listItem",lu="textStyle",cu=/^\s*([-+*])\s$/,Eh=Be.create({name:"bulletList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:"ul"}]},renderHTML({HTMLAttributes:n}){return["ul",fe(this.options.HTMLAttributes,n),0]},markdownTokenName:"list",parseMarkdown:(n,e)=>n.type!=="list"||n.ordered?[]:{type:"bulletList",content:n.items?e.parseChildren(n.items):[]},renderMarkdown:(n,e)=>n.content?e.renderChildren(n.content,` 263`):"",markdownOptions:{indentsContent:!0},addCommands(){return{toggleBulletList:()=>({commands:n,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(Kw,this.editor.getAttributes(lu)).run():n.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let n=Yn({find:cu,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(n=Yn({find:cu,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(lu),editor:this.editor})),[n]}}),Th=Be.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:n}){return["li",fe(this.options.HTMLAttributes,n),0]},markdownTokenName:"list_item",parseMarkdown:(n,e)=>{var t;if(n.type!=="list_item")return[];const r=(t=e.parseBlockChildren)!=null?t:e.parseChildren;let s=[];if(n.tokens&&n.tokens.length>0)if(n.tokens.some(o=>o.type==="paragraph"))s=r(n.tokens);else{const o=n.tokens[0];if(o&&o.type==="text"&&o.tokens&&o.tokens.length>0){if(s=[{type:"paragraph",content:e.parseInline(o.tokens)}],n.tokens.length>1){const l=n.tokens.slice(1),c=r(l);s.push(...c)}}else s=r(n.tokens)}return s.length===0&&(s=[{type:"paragraph",content:[]}]),{type:"listItem",content:s}},renderMarkdown:(n,e,t)=>Ga(n,e,r=>{var s,i;return r.parentType==="bulletList"?"- ":r.parentType==="orderedList"?`${(((i=(s=r.meta)==null?void 0:s.parentAttrs)==null?void 0:i.start)||1)+r.index}. `:"- "},t),addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)}}}),Jw={};qw(Jw,{findListItemPos:()=>Ur,getNextListDepth:()=>al,handleBackspace:()=>la,handleDelete:()=>ca,hasListBefore:()=>Ah,hasListItemAfter:()=>Yw,hasListItemBefore:()=>Oh,listItemHasSubList:()=>Dh,nextListIsDeeper:()=>Rh,nextListIsHigher:()=>_h});var Ur=(n,e)=>{const{$from:t}=e.selection,r=ye(n,e.schema);let s=null,i=t.depth,o=t.pos,a=null;for(;i>0&&a===null;)s=t.node(i),s.type===r?a=i:(i-=1,o-=1);return a===null?null:{$pos:e.doc.resolve(o),depth:a}},al=(n,e)=>{const t=Ur(n,e);if(!t)return!1;const[,r]=Wx(e,n,t.$pos.pos+4);return r},Ah=(n,e,t)=>{const{$anchor:r}=n.selection,s=Math.max(0,r.pos-2),i=n.doc.resolve(s).node();return!(!i||!t.includes(i.type.name))},Oh=(n,e)=>{var t;const{$anchor:r}=e.selection,s=e.doc.resolve(r.pos-2);return!(s.index()===0||((t=s.nodeBefore)==null?void 0:t.type.name)!==n)},Dh=(n,e,t)=>{if(!t)return!1;const r=ye(n,e.schema);let s=!1;return t.descendants(i=>{i.type===r&&(s=!0)}),s},la=(n,e,t)=>{if(n.commands.undoInputRule())return!0;if(n.state.selection.from!==n.state.selection.to)return!1;if(!qt(n.state,e)&&Ah(n.state,e,t)){const{$anchor:a}=n.state.selection,l=n.state.doc.resolve(a.before()-1),c=[];l.node().descendants((f,h)=>{f.type.name===e&&c.push({node:f,pos:h})});const u=c.at(-1);if(!u)return!1;const d=n.state.doc.resolve(l.start()+u.pos+1);return n.chain().cut({from:a.start()-1,to:a.end()+1},d.end()).joinForward().run()}if(!qt(n.state,e)||!Jx(n.state))return!1;const r=Ur(e,n.state);if(!r)return!1;const i=n.state.doc.resolve(r.$pos.pos-2).node(r.depth),o=Dh(e,n.state,i);return Oh(e,n.state)&&!o?n.commands.joinItemBackward():n.chain().liftListItem(e).run()},Rh=(n,e)=>{const t=al(n,e),r=Ur(n,e);return!r||!t?!1:t>r.depth},_h=(n,e)=>{const t=al(n,e),r=Ur(n,e);return!r||!t?!1:t<r.depth},ca=(n,e)=>{if(!qt(n.state,e)||!Kx(n.state,e))return!1;const{selection:t}=n.state,{$from:r,$to:s}=t;return!t.empty&&r.sameParent(s)?!1:Rh(e,n.state)?n.chain().focus(n.state.selection.from+4).lift(e).joinBackward().run():_h(e,n.state)?n.chain().joinForward().joinBackward().run():n.commands.joinItemForward()},Yw=(n,e)=>{var t;const{$anchor:r}=e.selection,s=e.doc.resolve(r.pos-r.parentOffset-2);return!(s.index()===s.parent.childCount-1||((t=s.nodeAfter)==null?void 0:t.type.name)!==n)},Ih=pe.create({name:"listKeymap",addOptions(){return{listTypes:[{itemName:"listItem",wrapperNames:["bulletList","orderedList"]},{itemName:"taskItem",wrapperNames:["taskList"]}]}},addKeyboardShortcuts(){return{Delete:({editor:n})=>{let e=!1;return this.options.listTypes.forEach(({itemName:t})=>{n.state.schema.nodes[t]!==void 0&&ca(n,t)&&(e=!0)}),e},"Mod-Delete":({editor:n})=>{let e=!1;return this.options.listTypes.forEach(({itemName:t})=>{n.state.schema.nodes[t]!==void 0&&ca(n,t)&&(e=!0)}),e},Backspace:({editor:n})=>{let e=!1;return this.options.listTypes.forEach(({itemName:t,wrapperNames:r})=>{n.state.schema.nodes[t]!==void 0&&la(n,t,r)&&(e=!0)}),e},"Mod-Backspace":({editor:n})=>{let e=!1;return this.options.listTypes.forEach(({itemName:t,wrapperNames:r})=>{n.state.schema.nodes[t]!==void 0&&la(n,t,r)&&(e=!0)}),e}}}}),uu=/^(\s*)(\d+)\.\s+(.*)$/,Gw=/^\s/;function Xw(n){const e=n.trimStart();return/^[-+*]\s+/.test(e)||/^\d+\.\s+/.test(e)||/^>\s?/.test(e)||/^```/.test(e)||/^~~~/.test(e)}function Qw(n){const e=[],t=[];let r=!1;return n.forEach(s=>{if(r){t.push(s);return}if(s.trim()===""){r=!0,t.push(s);return}if(e.length>0&&Xw(s)){r=!0,t.push(s);return}e.push(s)}),{paragraphLines:e,blockLines:t}}function Zw(n){const e=[];let t=0,r=0;for(;t<n.length;){const s=n[t],i=s.match(uu);if(!i)break;const[,o,a,l]=i,c=o.length,u=[l];let d=t+1;const f=[s];let h=!1;for(;d<n.length;){const m=n[d];if(m.match(uu))break;if(m.trim()==="")f.push(m),u.push(""),h=!0,d+=1;else if(m.match(Gw))f.push(m),u.push(m.slice(c+2)),d+=1;else{if(h)break;f.push(m),u.push(m),d+=1}}e.push({indent:c,number:parseInt(a,10),content:u.join(` 264`).trim(),contentLines:u,raw:f.join(` 265`)}),r=d,t=d}return[e,r]}function Ph(n,e,t){const r=[];let s=0;for(;s<n.length;){const i=n[s];if(i.indent===e){const{paragraphLines:o,blockLines:a}=Qw(i.contentLines),l=o.join(` 266`).trim(),c=[];l&&c.push({type:"paragraph",raw:l,tokens:t.inlineTokens(l)});const u=a.join(` 267`).trim();if(u){const h=t.blockTokens(u);c.push(...h)}let d=s+1;const f=[];for(;d<n.length&&n[d].indent>e;)f.push(n[d]),d+=1;if(f.length>0){const h=Math.min(...f.map(y=>y.indent)),m=Ph(f,h,t);c.push({type:"list",ordered:!0,start:f[0].number,items:m,raw:f.map(y=>y.raw).join(` 268`)})}r.push({type:"list_item",raw:i.raw,tokens:c}),s=d}else s+=1}return r}function eS(n,e){return n.map(t=>{if(t.type!=="list_item")return e.parseChildren([t])[0];const r=[];return t.tokens&&t.tokens.length>0&&t.tokens.forEach(s=>{if(s.type==="paragraph"||s.type==="list"||s.type==="blockquote"||s.type==="code")r.push(...e.parseChildren([s]));else if(s.type==="text"&&s.tokens){const i=e.parseChildren([s]);r.push({type:"paragraph",content:i})}else{const i=e.parseChildren([s]);i.length>0&&r.push(...i)}}),{type:"listItem",content:r}})}var tS="listItem",du="textStyle",fu=/^(\d+)\.\s$/,jh=Be.create({name:"orderedList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},addAttributes(){return{start:{default:1,parseHTML:n=>n.hasAttribute("start")?parseInt(n.getAttribute("start")||"",10):1},type:{default:null,parseHTML:n=>n.getAttribute("type")}}},parseHTML(){return[{tag:"ol"}]},renderHTML({HTMLAttributes:n}){const{start:e,...t}=n;return e===1?["ol",fe(this.options.HTMLAttributes,t),0]:["ol",fe(this.options.HTMLAttributes,n),0]},markdownTokenName:"list",parseMarkdown:(n,e)=>{if(n.type!=="list"||!n.ordered)return[];const t=n.start||1,r=n.items?eS(n.items,e):[];return t!==1?{type:"orderedList",attrs:{start:t},content:r}:{type:"orderedList",content:r}},renderMarkdown:(n,e)=>n.content?e.renderChildren(n.content,` 269`):"",markdownTokenizer:{name:"orderedList",level:"block",start:n=>{const e=n.match(/^(\s*)(\d+)\.\s+/),t=e==null?void 0:e.index;return t!==void 0?t:-1},tokenize:(n,e,t)=>{var r;const s=n.split(` 270`),[i,o]=Zw(s);if(i.length===0)return;const a=Ph(i,0,t);return a.length===0?void 0:{type:"list",ordered:!0,start:((r=i[0])==null?void 0:r.number)||1,items:a,raw:s.slice(0,o).join(` 271`)}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleOrderedList:()=>({commands:n,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(tS,this.editor.getAttributes(du)).run():n.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let n=Yn({find:fu,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)&&(n=Yn({find:fu,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes(du)}),joinPredicate:(e,t)=>t.childCount+t.attrs.start===+e[1],editor:this.editor})),[n]}}),nS=/^\s*(\[([( |x])?\])\s$/,rS=Be.create({name:"taskItem",addOptions(){return{nested:!1,HTMLAttributes:{},taskListTypeName:"taskList",a11y:void 0}},content(){return this.options.nested?"paragraph block*":"paragraph+"},defining:!0,addAttributes(){return{checked:{default:!1,keepOnSplit:!1,parseHTML:n=>{const e=n.getAttribute("data-checked");return e===""||e==="true"},renderHTML:n=>({"data-checked":n.checked})}}},parseHTML(){return[{tag:`li[data-type="${this.name}"]`,priority:51}]},renderHTML({node:n,HTMLAttributes:e}){return["li",fe(this.options.HTMLAttributes,e,{"data-type":this.name}),["label",["input",{type:"checkbox",checked:n.attrs.checked?"checked":null}],["span"]],["div",0]]},parseMarkdown:(n,e)=>{const t=[];if(n.tokens&&n.tokens.length>0?t.push(e.createNode("paragraph",{},e.parseInline(n.tokens))):n.text?t.push(e.createNode("paragraph",{},[e.createNode("text",{text:n.text})])):t.push(e.createNode("paragraph",{},[])),n.nestedTokens&&n.nestedTokens.length>0){const r=e.parseChildren(n.nestedTokens);t.push(...r)}return e.createNode("taskItem",{checked:n.checked||!1},t)},renderMarkdown:(n,e)=>{var t;const s=`- [${(t=n.attrs)!=null&&t.checked?"x":" "}] `;return Ga(n,e,s)},addKeyboardShortcuts(){const n={Enter:()=>this.editor.commands.splitListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)};return this.options.nested?{...n,Tab:()=>this.editor.commands.sinkListItem(this.name)}:n},addNodeView(){return({node:n,HTMLAttributes:e,getPos:t,editor:r})=>{const s=document.createElement("li"),i=document.createElement("label"),o=document.createElement("span"),a=document.createElement("input"),l=document.createElement("div"),c=d=>{var f,h;a.ariaLabel=((h=(f=this.options.a11y)==null?void 0:f.checkboxLabel)==null?void 0:h.call(f,d,a.checked))||`Task item checkbox for ${d.textContent||"empty task item"}`};c(n),i.contentEditable="false",a.type="checkbox",a.addEventListener("mousedown",d=>d.preventDefault()),a.addEventListener("change",d=>{if(!r.isEditable&&!this.options.onReadOnlyChecked){a.checked=!a.checked;return}const{checked:f}=d.target;r.isEditable&&typeof t=="function"&&r.chain().focus(void 0,{scrollIntoView:!1}).command(({tr:h})=>{const m=t();if(typeof m!="number")return!1;const y=h.doc.nodeAt(m);return h.setNodeMarkup(m,void 0,{...y==null?void 0:y.attrs,checked:f}),!0}).run(),!r.isEditable&&this.options.onReadOnlyChecked&&(this.options.onReadOnlyChecked(n,f)||(a.checked=!a.checked))}
vendor: 10,055 bytes, lines 271-272
271),Object.entries(this.options.HTMLAttributes).forEach(([d,f])=>{s.setAttribute(d,f)}),s.dataset.checked=n.attrs.checked,a.checked=n.attrs.checked,i.append(a,o),s.append(i,l),Object.entries(e).forEach(([d,f])=>{s.setAttribute(d,f)});let u=new Set(Object.keys(e));return{dom:s,contentDOM:l,update:d=>{if(d.type!==this.type)return!1;s.dataset.checked=d.attrs.checked,a.checked=d.attrs.checked,c(d);const f=r.extensionManager.attributes,h=Ir(d,f),m=new Set(Object.keys(h)),y=this.options.HTMLAttributes;return u.forEach(g=>{m.has(g)||(g in y?s.setAttribute(g,y[g]):s.removeAttribute(g))}),Object.entries(h).forEach(([g,v])=>{v==null?g in y?s.setAttribute(g,y[g]):s.removeAttribute(g):s.setAttribute(g,v)}),u=m,!0}}}},addInputRules(){return[Yn({find:nS,type:this.type,getAttributes:n=>({checked:n[n.length-1]==="x"})})]}}),sS=Be.create({name:"taskList",addOptions(){return{itemTypeName:"taskItem",HTMLAttributes:{}}},group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:`ul[data-type="${this.name}"]`,priority:51}]},renderHTML({HTMLAttributes:n}){return["ul",fe(this.options.HTMLAttributes,n,{"data-type":this.name}),0]},parseMarkdown:(n,e)=>e.createNode("taskList",{},e.parseChildren(n.items||[])),renderMarkdown:(n,e)=>n.content?e.renderChildren(n.content,` 272`):"",markdownTokenizer:{name:"taskList",level:"block",start(n){var e;const t=(e=n.match(/^\s*[-+*]\s+\[([ xX])\]\s+/))==null?void 0:e.index;return t!==void 0?t:-1},tokenize(n,e,t){const r=i=>{const o=Qo(i,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:a=>({indentLevel:a[1].length,mainContent:a[4],checked:a[3].toLowerCase()==="x"}),createToken:(a,l)=>({type:"taskItem",raw:"",mainContent:a.mainContent,indentLevel:a.indentLevel,checked:a.checked,text:a.mainContent,tokens:t.inlineTokens(a.mainContent),nestedTokens:l}),customNestedParser:r},t);return o?[{type:"taskList",raw:o.raw,items:o.items}]:t.blockTokens(i)},s=Qo(n,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:i=>({indentLevel:i[1].length,mainContent:i[4],checked:i[3].toLowerCase()==="x"}),createToken:(i,o)=>({type:"taskItem",raw:"",mainContent:i.mainContent,indentLevel:i.indentLevel,checked:i.checked,text:i.mainContent,tokens:t.inlineTokens(i.mainContent),nestedTokens:o}),customNestedParser:r},t);if(s)return{type:"taskList",raw:s.raw,items:s.items}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleTaskList:()=>({commands:n})=>n.toggleList(this.name,this.options.itemTypeName)}},addKeyboardShortcuts(){return{"Mod-Shift-9":()=>this.editor.commands.toggleTaskList()}}});pe.create({name:"listKit",addExtensions(){const n=[];return this.options.bulletList!==!1&&n.push(Eh.configure(this.options.bulletList)),this.options.listItem!==!1&&n.push(Th.configure(this.options.listItem)),this.options.listKeymap!==!1&&n.push(Ih.configure(this.options.listKeymap)),this.options.orderedList!==!1&&n.push(jh.configure(this.options.orderedList)),this.options.taskItem!==!1&&n.push(rS.configure(this.options.taskItem)),this.options.taskList!==!1&&n.push(sS.configure(this.options.taskList)),n}});var ds=" ",Mo="Â ",iS=Be.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:n}){return["p",fe(this.options.HTMLAttributes,n),0]},parseMarkdown:(n,e)=>{const t=n.tokens||[];if(t.length===1&&t[0].type==="image")return e.parseChildren([t[0]]);const r=e.parseInline(t);return t.length===1&&t[0].type==="text"&&(t[0].raw===ds||t[0].text===ds||t[0].raw===Mo||t[0].text===Mo)&&r.length===1&&r[0].type==="text"&&(r[0].text===ds||r[0].text===Mo)?e.createNode("paragraph",void 0,[]):e.createNode("paragraph",void 0,r)},renderMarkdown:(n,e,t)=>{var r,s;if(!n)return"";const i=Array.isArray(n.content)?n.content:[];if(i.length===0){const o=Array.isArray((r=t==null?void 0:t.previousNode)==null?void 0:r.content)?t.previousNode.content:[];return((s=t==null?void 0:t.previousNode)==null?void 0:s.type)==="paragraph"&&o.length===0?ds:""}return e.renderChildren(i)},addCommands(){return{setParagraph:()=>({commands:n})=>n.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),oS=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,aS=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,lS=Nn.create({name:"strike",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"s"},{tag:"del"},{tag:"strike"},{style:"text-decoration",consuming:!1,getAttrs:n=>n.includes("line-through")?{}:!1}]},renderHTML({HTMLAttributes:n}){return["s",fe(this.options.HTMLAttributes,n),0]},markdownTokenName:"del",parseMarkdown:(n,e)=>e.applyMark("strike",e.parseInline(n.tokens||[])),renderMarkdown:(n,e)=>`~~${e.renderChildren(n)}~~`,addCommands(){return{setStrike:()=>({commands:n})=>n.setMark(this.name),toggleStrike:()=>({commands:n})=>n.toggleMark(this.name),unsetStrike:()=>({commands:n})=>n.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-s":()=>this.editor.commands.toggleStrike()}},addInputRules(){return[Jn({find:oS,type:this.type})]},addPasteRules(){return[Cn({find:aS,type:this.type})]}}),cS=Be.create({name:"text",group:"inline",parseMarkdown:n=>({type:"text",text:n.text||""}),renderMarkdown:n=>n.text||""}),uS=Nn.create({name:"underline",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"u"},{style:"text-decoration",consuming:!1,getAttrs:n=>n.includes("underline")?{}:!1}]},renderHTML({HTMLAttributes:n}){return["u",fe(this.options.HTMLAttributes,n),0]},parseMarkdown(n,e){return e.applyMark(this.name||"underline",e.parseInline(n.tokens||[]))},renderMarkdown(n,e){return`++${e.renderChildren(n)}++`},markdownTokenizer:{name:"underline",level:"inline",start(n){return n.indexOf("++")},tokenize(n,e,t){const s=/^(\+\+)([\s\S]+?)(\+\+)/.exec(n);if(!s)return;const i=s[2].trim();return{type:"underline",raw:s[0],text:i,tokens:t.inlineTokens(i)}}},addCommands(){return{setUnderline:()=>({commands:n})=>n.setMark(this.name),toggleUnderline:()=>({commands:n})=>n.toggleMark(this.name),unsetUnderline:()=>({commands:n})=>n.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-u":()=>this.editor.commands.toggleUnderline(),"Mod-U":()=>this.editor.commands.toggleUnderline()}}});function dS(n={}){return new ae({view(e){return new fS(e,n)}})}class fS{constructor(e,t){var r;this.editorView=e,this.cursorPos=null,this.element=null,this.timeout=-1,this.width=(r=t.width)!==null&&r!==void 0?r:1,this.color=t.color===!1?void 0:t.color||"black",this.class=t.class,this.handlers=["dragover","dragend","drop","dragleave"].map(s=>{let i=o=>{this[s](o)};return e.dom.addEventListener(s,i),{name:s,handler:i}})}destroy(){this.handlers.forEach(({name:e,handler:t})=>this.editorView.dom.removeEventListener(e,t))}update(e,t){this.cursorPos!=null&&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,e==null?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())}updateOverlay(){let e=this.editorView.state.doc.resolve(this.cursorPos),t=!e.parent.inlineContent,r,s=this.editorView.dom,i=s.getBoundingClientRect(),o=i.width/s.offsetWidth,a=i.height/s.offsetHeight;if(t){let d=e.nodeBefore,f=e.nodeAfter;if(d||f){let h=this.editorView.nodeDOM(this.cursorPos-(d?d.nodeSize:0));if(h){let m=h.getBoundingClientRect(),y=d?m.bottom:m.top;d&&f&&(y=(y+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let g=this.width/2*a;r={left:m.left,right:m.right,top:y-g,bottom:y+g}}}}if(!r){let d=this.editorView.coordsAtPos(this.cursorPos),f=this.width/2*o;r={left:d.left-f,right:d.left+f,top:d.top,bottom:d.bottom}}let l=this.editorView.dom.offsetParent;this.element||(this.element=l.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",t),this.element.classList.toggle("prosemirror-dropcursor-inline",!t);let c,u;if(!l||l==document.body&&getComputedStyle(l).position=="static")c=-pageXOffset,u=-pageYOffset;else{let d=l.getBoundingClientRect(),f=d.width/l.offsetWidth,h=d.height/l.offsetHeight;c=d.left-l.scrollLeft*f,u=d.top-l.scrollTop*h}this.element.style.left=(r.left-c)/o+"px",this.element.style.top=(r.top-u)/a+"px",this.element.style.width=(r.right-r.left)/o+"px",this.element.style.height=(r.bottom-r.top)/a+"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}),r=t&&t.inside>=0&&this.editorView.state.doc.nodeAt(t.inside),s=r&&r.type.spec.disableDropCursor,i=typeof s=="function"?s(this.editorView,t,e):s;if(t&&!i){let o=t.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let a=Od(this.editorView.state.doc,o,this.editorView.dragging.slice);a!=null&&(o=a)}this.setCursor(o),this.scheduleRemoval(5e3)}}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(e){this.editorView.dom.contains(e.relatedTarget)||this.setCursor(null)}}class ue extends W{constructor(e){super(e,e)}map(e,t){let r=e.resolve(t.map(this.head));return ue.valid(r)?new ue(r):W.near(r)}content(){return R.empty}eq(e){return e instanceof ue&&e.head==this.head}toJSON(){return{type:"gapcursor",pos:this.head}}static fromJSON(e,t){if(typeof t.pos!="number")throw new RangeError("Invalid input for GapCursor.fromJSON");return new ue(e.resolve(t.pos))}getBookmark(){return new ll(this.anchor)}static valid(e){let t=e.parent;if(t.inlineContent||!hS(e)||!pS(e))return!1;let r=t.type.spec.allowGapCursor;if(r!=null)return r;let s=t.contentMatchAt(e.index()).defaultType;return s&&s.isTextblock}static findGapCursorFrom(e,t,r=!1){e:for(;;){if(!r&&ue.valid(e))return e;let s=e.pos,i=null;for(let o=e.depth;;o--){let a=e.node(o);if(t>
vendor: 16,644 bytes, line 272
2720?e.indexAfter(o)<a.childCount:e.index(o)>0){i=a.child(t>0?e.indexAfter(o):e.index(o)-1);break}else if(o==0)return null;s+=t;let l=e.doc.resolve(s);if(ue.valid(l))return l}for(;;){let o=t>0?i.firstChild:i.lastChild;if(!o){if(i.isAtom&&!i.isText&&!L.isSelectable(i)){e=e.doc.resolve(s+i.nodeSize*t),r=!1;continue e}break}i=o,s+=t;let a=e.doc.resolve(s);if(ue.valid(a))return a}return null}}}ue.prototype.visible=!1;ue.findFrom=ue.findGapCursorFrom;W.jsonID("gapcursor",ue);class ll{constructor(e){this.pos=e}map(e){return new ll(e.map(this.pos))}resolve(e){let t=e.resolve(this.pos);return ue.valid(t)?new ue(t):W.near(t)}}function Lh(n){return n.isAtom||n.spec.isolating||n.spec.createGapCursor}function hS(n){for(let e=n.depth;e>=0;e--){let t=n.index(e),r=n.node(e);if(t==0){if(r.type.spec.isolating)return!0;continue}for(let s=r.child(t-1);;s=s.lastChild){if(s.childCount==0&&!s.inlineContent||Lh(s.type))return!0;if(s.inlineContent)return!1}}return!0}function pS(n){for(let e=n.depth;e>=0;e--){let t=n.indexAfter(e),r=n.node(e);if(t==r.childCount){if(r.type.spec.isolating)return!0;continue}for(let s=r.child(t);;s=s.firstChild){if(s.childCount==0&&!s.inlineContent||Lh(s.type))return!0;if(s.inlineContent)return!1}}return!0}function mS(){return new ae({props:{decorations:vS,createSelectionBetween(n,e,t){return e.pos==t.pos&&ue.valid(t)?new ue(t):null},handleClick:yS,handleKeyDown:gS,handleDOMEvents:{beforeinput:bS}}})}const gS=Nf({ArrowLeft:fs("horiz",-1),ArrowRight:fs("horiz",1),ArrowUp:fs("vert",-1),ArrowDown:fs("vert",1)});function fs(n,e){const t=n=="vert"?e>0?"down":"up":e>0?"right":"left";return function(r,s,i){let o=r.selection,a=e>0?o.$to:o.$from,l=o.empty;if(o instanceof $){if(!i.endOfTextblock(t)||a.depth==0)return!1;l=!1,a=r.doc.resolve(e>0?a.after():a.before())}let c=ue.findGapCursorFrom(a,e,l);return c?(s&&s(r.tr.setSelection(new ue(c))),!0):!1}}function yS(n,e,t){if(!n||!n.editable)return!1;let r=n.state.doc.resolve(e);if(!ue.valid(r))return!1;let s=n.posAtCoords({left:t.clientX,top:t.clientY});return s&&s.inside>-1&&L.isSelectable(n.state.doc.nodeAt(s.inside))?!1:(n.dispatch(n.state.tr.setSelection(new ue(r))),!0)}function bS(n,e){if(e.inputType!="insertCompositionText"||!(n.state.selection instanceof ue))return!1;let{$from:t}=n.state.selection,r=t.parent.contentMatchAt(t.index()).findWrapping(n.state.schema.nodes.text);if(!r)return!1;let s=C.empty;for(let o=r.length-1;o>=0;o--)s=C.from(r[o].createAndFill(null,s));let i=n.state.tr.replace(t.pos,t.pos,new R(s,0,0));return i.setSelection($.near(i.doc.resolve(t.pos+1))),n.dispatch(i),!1}function vS(n){if(!(n.selection instanceof ue))return null;let e=document.createElement("div");return e.className="ProseMirror-gapcursor",ie.create(n.doc,[Pe.widget(n.selection.head,e,{key:"gapcursor"})])}var hi=200,ke=function(){};ke.prototype.append=function(e){return e.length?(e=ke.from(e),!this.length&&e||e.length<hi&&this.leafAppend(e)||this.length<hi&&e.leafPrepend(this)||this.appendInner(e)):this};ke.prototype.prepend=function(e){return e.length?ke.from(e).append(this):this};ke.prototype.appendInner=function(e){return new xS(this,e)};ke.prototype.slice=function(e,t){return e===void 0&&(e=0),t===void 0&&(t=this.length),e>=t?ke.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,t))};ke.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)};ke.prototype.forEach=function(e,t,r){t===void 0&&(t=0),r===void 0&&(r=this.length),t<=r?this.forEachInner(e,t,r,0):this.forEachInvertedInner(e,t,r,0)};ke.prototype.map=function(e,t,r){t===void 0&&(t=0),r===void 0&&(r=this.length);var s=[];return this.forEach(function(i,o){return s.push(e(i,o))},t,r),s};ke.from=function(e){return e instanceof ke?e:e&&e.length?new Bh(e):ke.empty};var Bh=function(n){function e(r){n.call(this),this.values=r}n&&(e.__proto__=n),e.prototype=Object.create(n&&n.prototype),e.prototype.constructor=e;var t={length:{configurable:!0},depth:{configurable:!0}};return e.prototype.flatten=function(){return this.values},e.prototype.sliceInner=function(s,i){return s==0&&i==this.length?this:new e(this.values.slice(s,i))},e.prototype.getInner=function(s){return this.values[s]},e.prototype.forEachInner=function(s,i,o,a){for(var l=i;l<o;l++)if(s(this.values[l],a+l)===!1)return!1},e.prototype.forEachInvertedInner=function(s,i,o,a){for(var l=i-1;l>=o;l--)if(s(this.values[l],a+l)===!1)return!1},e.prototype.leafAppend=function(s){if(this.length+s.length<=hi)return new e(this.values.concat(s.flatten()))},e.prototype.leafPrepend=function(s){if(this.length+s.length<=hi)return new e(s.flatten().concat(this.values))},t.length.get=function(){return this.values.length},t.depth.get=function(){return 0},Object.defineProperties(e.prototype,t),e}(ke);ke.empty=new Bh([]);var xS=function(n){function e(t,r){n.call(this),this.left=t,this.right=r,this.length=t.length+r.length,this.depth=Math.max(t.depth,r.depth)+1}return n&&(e.__proto__=n),e.prototype=Object.create(n&&n.prototype),e.prototype.constructor=e,e.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},e.prototype.getInner=function(r){return r<this.left.length?this.left.get(r):this.right.get(r-this.left.length)},e.prototype.forEachInner=function(r,s,i,o){var a=this.left.length;if(s<a&&this.left.forEachInner(r,s,Math.min(i,a),o)===!1||i>a&&this.right.forEachInner(r,Math.max(s-a,0),Math.min(this.length,i)-a,o+a)===!1)return!1},e.prototype.forEachInvertedInner=function(r,s,i,o){var a=this.left.length;if(s>a&&this.right.forEachInvertedInner(r,s-a,Math.max(i,a)-a,o+a)===!1||i<a&&this.left.forEachInvertedInner(r,Math.min(s,a),i,o)===!1)return!1},e.prototype.sliceInner=function(r,s){if(r==0&&s==this.length)return this;var i=this.left.length;return s<=i?this.left.slice(r,s):r>=i?this.right.slice(r-i,s-i):this.left.slice(r,i).append(this.right.slice(0,s-i))},e.prototype.leafAppend=function(r){var s=this.right.leafAppend(r);if(s)return new e(this.left,s)},e.prototype.leafPrepend=function(r){var s=this.left.leafPrepend(r);if(s)return new e(s,this.right)},e.prototype.appendInner=function(r){return this.left.depth>=Math.max(this.right.depth,r.depth)+1?new e(this.left,new e(this.right,r)):new e(this,r)},e}(ke);const kS=500;class tt{constructor(e,t){this.items=e,this.eventCount=t}popEvent(e,t){if(this.eventCount==0)return null;let r=this.items.length;for(;;r--)if(this.items.get(r-1).selection){--r;break}let s,i;t&&(s=this.remapping(r,this.items.length),i=s.maps.length);let o=e.tr,a,l,c=[],u=[];return this.items.forEach((d,f)=>{if(!d.step){s||(s=this.remapping(r,f+1),i=s.maps.length),i--,u.push(d);return}if(s){u.push(new ct(d.map));let h=d.step.map(s.slice(i)),m;h&&o.maybeStep(h).doc&&(m=o.mapping.maps[o.mapping.maps.length-1],c.push(new ct(m,void 0,void 0,c.length+u.length))),i--,m&&s.appendMap(m,i)}else o.maybeStep(d.step);if(d.selection)return a=s?d.selection.map(s.slice(i)):d.selection,l=new tt(this.items.slice(0,r).append(u.reverse().concat(c)),this.eventCount-1),!1},this.items.length,0),{remaining:l,transform:o,selection:a}}addTransform(e,t,r,s){let i=[],o=this.eventCount,a=this.items,l=!s&&a.length?a.get(a.length-1):null;for(let u=0;u<e.steps.length;u++){let d=e.steps[u].invert(e.docs[u]),f=new ct(e.mapping.maps[u],d,t),h;(h=l&&l.merge(f))&&(f=h,u?i.pop():a=a.slice(0,a.length-1)),i.push(f),t&&(o++,t=void 0),s||(l=f)}let c=o-r.depth;return c>SS&&(a=wS(a,c),o-=c),new tt(a.append(i),o)}remapping(e,t){let r=new Tr;return this.items.forEach((s,i)=>{let o=s.mirrorOffset!=null&&i-s.mirrorOffset>=e?r.maps.length-s.mirrorOffset:void 0;r.appendMap(s.map,o)},e,t),r}addMaps(e){return this.eventCount==0?this:new tt(this.items.append(e.map(t=>new ct(t))),this.eventCount)}rebased(e,t){if(!this.eventCount)return this;let r=[],s=Math.max(0,this.items.length-t),i=e.mapping,o=e.steps.length,a=this.eventCount;this.items.forEach(f=>{f.selection&&a--},s);let l=t;this.items.forEach(f=>{let h=i.getMirror(--l);if(h==null)return;o=Math.min(o,h);let m=i.maps[h];if(f.step){let y=e.steps[h].invert(e.docs[h]),g=f.selection&&f.selection.map(i.slice(l+1,h));g&&a++,r.push(new ct(m,y,g))}else r.push(new ct(m))},s);let c=[];for(let f=t;f<o;f++)c.push(new ct(i.maps[f]));let u=this.items.slice(0,s).append(c).append(r),d=new tt(u,a);return d.emptyItemCount()>kS&&(d=d.compress(this.items.length-r.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),r=t.maps.length,s=[],i=0;return this.items.forEach((o,a)=>{if(a>=e)s.push(o),o.selection&&i++;else if(o.step){let l=o.step.map(t.slice(r)),c=l&&l.getMap();if(r--,c&&t.appendMap(c,r),l){let u=o.selection&&o.selection.map(t.slice(r));u&&i++;let d=new ct(c.invert(),l,u),f,h=s.length-1;(f=s.length&&s[h].merge(d))?s[h]=f:s.push(d)}}else o.map&&r--},this.items.length,0),new tt(ke.from(s.reverse()),i)}}tt.empty=new tt(ke.empty,0);function wS(n,e){let t;return n.forEach((r,s)=>{if(r.selection&&e--==0)return t=s,!1}),n.slice(t)}class ct{constructor(e,t,r,s){this.map=e,this.step=t,this.selection=r,this.mirrorOffset=s}merge(e){if(this.step&&e.step&&!e.selection){let t=e.step.merge(this.step);if(t)return new ct(t.getMap().invert(),t,this.selection)}}}class It{constructor(e,t,r,s,i){this.done=e,this.undone=t,this.prevRanges=r,this.prevTime=s,this.prevComposition=i}}const SS=20;function CS(n,e,t,r){let s=t.getMeta(bn),i;if(s)return s.historyState;t.getMeta(ES)&&(n=new It(n.done,n.undone,null,0,-1));let o=t.getMeta("appendedTransaction");if(t.steps.length==0)return n;if(o&&o.getMeta(bn))return o.getMeta(bn).redo?new It(n.done.addTransform(t,void 0,r,xs(e)),n.undone,hu(t.mapping.maps),n.prevTime,n.prevComposition):new It(n.done,n.undone.addTransform(t,void 0,r,xs(e)),null,n.prevTime,n.prevComposition);if(t.getMeta("addToHistory")!==!1&&!(o&&o.getMeta("addToHistory")===!1)){let a=t.getMeta("composition"),l=n.prevTime==0||!o&&n.prevComposition!=a&&(n.prevTime<(t.time||0)-r.newGroupDelay||!MS(t,n.prevRanges)),c=o?No(n.prevRanges,t.mapping):hu(t.mapping.maps);return new It(n.done.addTransform(t,l?e.selection.getBookmark():void 0,r,xs(e)),tt.empty,c,t.time,a??n.prevComposition)}else return(i=t.getMeta("rebased"))?new It(n.done.rebased(t,i),n.undone.rebased(t,i),No(n.prevRanges,t.mapping),n.prevTime,n.prevComposition):new It(n.done.addMaps(t.mapping.maps),n.undone.addMaps(t.mapping.maps),No(n.prevRanges,t.mapping),n.prevTime,n.prevComposition)}function MS(n,e){if(!e)return!1;if(!n.docChanged)return!0;let t=!1;return n.mapping.maps[0].forEach((r,s)=>{for(let i=0;i<e.length;i+=2)r<=e[i+1]&&s>=e[i]&&(t=!0)}),t}function hu(n){let e=[];for(let t=n.length-1;t>=0&&e.length==0;t--)n[t].forEach((r,s,i,o)=>e.push(i,o));return e}function No(n,e){if(!n)return null;let t=[];for(let r=0;r<n.length;r+=2){let s=e.map(n[r],1),i=e.map(n[r+1],-1);s<=i&&t.push(s,i)}return t}function NS(n,e,t){let r=xs(e),s=bn.get(e).spec.config,i=(t?n.undone:n.done).popEvent(e,r);if(!i)return null;let o=i.selection.resolve(i.transform.doc),a=(t?n.done:n.undone).addTransform(i.transform,e.selection.getBookmark(),s,r),l=new It(t?a:i.remaining,t?i.remaining:a,null,0,-1);return i.transform.setSelection(o).setMeta(bn,{redo:t,historyState:l})}let Eo=!1,pu=null;function xs(n){let e=n.plugins;if(pu!=e){Eo=!1,pu=e;for(let t=0;t<e.length;t++)if(e[t].spec.historyPreserveItems){Eo=!0;break}}return Eo}const bn=new ve("history"),ES=new ve("closeHistory");function TS(n={}){return n={depth:n.depth||100,newGroupDelay:n.newGroupDelay||500},new ae({key:bn,state:{init(){return new It(tt.empty,tt.empty,null,0,-1)},apply(e,t,r){return CS(t,r,e,n)}},config:n,props:{handleDOMEvents:{beforeinput(e,t){let r=t.inputType,s=r=="historyUndo"?Fh:r=="historyRedo"?$h:null;return!s||!e.editable?!1:(t.preventDefault(),s(e.state,e.dispatch))}}}})}function zh(n,e){return(t,r)=>{let s=bn.getState(t);if(!s||(n?s.undone:s.done).eventCount==0)return!1;if(r){let i=NS(s,t,n);i&&r(e?i.scrollIntoView():i)}return!0}}const Fh=zh(!1,!0),$h=zh(!0,!0);pe.create({name:"characterCount",addOptions(){return{limit:null,mode:"textSize",textCounter:n=>n.length,wordCounter:n=>n.split(" ").filter(e=>e!=="").length}},addStorage(){return{characters:()=>0,words:()=>0}},onBeforeCreate(){this.storage.characters=n=>{const e=(n==null?void 0:n.node)||this.editor.state.doc;if(((n==null?void 0:n.mode)||this.options.mode)==="textSize"){const r=e.textBetween(0,e.content.size,void 0," ");return this.options.textCounter(r)}return e.nodeSize},this.storage.words=n=>{const e=(n==null?void 0:n.node)||this.editor.state.doc,t=e.textBetween(0,e.content.size," "," ");return this.options.wordCounter(t)}},addProseMirrorPlugins(){let n=!1;return[new ae({key:new ve("characterCount"),appendTransaction:(e,t,r)=>{if(n)return;const s=this.options.limit;if(s==null||s===0){n=!0;return}const i=this.storage.characters({node:r.doc});if(i>s){const o=i-s,a=0,l=o;console.warn(`[CharacterCount] Initial content exceeded limit of ${s} characters. Content was automatically trimmed.`);const c=r.tr.deleteRange(a,l);return n=!0,c}n=!0},filterTransaction:(e,t)=>{const r=this.options.limit;if(!e.docChanged||r===0||r===null||r===void 0)return!0;const s=this.storage.characters({node:t.doc}),i=this.storage.characters({node:e.doc});if(i<=r||s>r&&i>r&&i<=s)return!0;if(s>r&&i>r&&i>s||!e.getMeta("paste"))return!1;const a=e.selection.$head.pos,l=i-r,c=a-l,u=a;return e.deleteRange(c,u),!(this.storage.characters({node:e.doc})>r)}})]}});var AS=pe.create({name:"dropCursor",addOptions(){return{color:"currentColor",width:1,class:void 0}},addProseMirrorPlugins(){return[dS(this.options)]}});pe.create({name:"focus",addOptions(){return{className:"has-focus",mode:"all"}},addProseMirrorPlugins(){return[new ae({key:new ve("focus"),props:{decorations:({doc:n,selection:e})=>{const{isEditable:t,isFocused:r}=this.editor,{anchor:s}=e,i=[];if(!t||!r)return ie.create(n,[]);let o=0;this.options.mode==="deepest"&&n.descendants((l,c)=>{if(l.isText)return;if(!(s>=c&&s<=c+l.nodeSize-1))return!1;o+=1});let a=0;return n.descendants((l,c)=>{if(l.isText||!(s>=c&&s<=c+l.nodeSize-1))return!1;if(a+=1,this.options.mode==="deepest"&&o-a>0||this.options.mode==="shallowest"&&a>1)return this.options.mode==="deepest";i.push(Pe.node(c,c+l.nodeSize,{class:this.options.className}))}),ie.create(n,i)}}})]}});var OS=pe.create({name:"gapCursor",addProseMirrorPlugins(){return[mS()]},extendNodeSchema(n){var e;const t={name:n.name,options:n.options,storage:n.storage};return{allowGapCursor:(e=J(P(n,"allowGapCursor",t)))!=null?e:null}}}),mu="placeholder";function DS(n){return n.replace(/\s+/g,"-").replace(/[^a-zA-Z0-9-]/g,"").replace(/^[0-9-]+/,"").replace(/^-+/,"").toLowerCase()}var RS=pe.create({name:"placeholder",addOptions(){return{emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",dataAttribute:mu,placeholder:"Write something â¦",showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){const n=this.options.dataAttribute?`data-${DS(this.options.dataAttribute)}`:`data-${mu}`;return[new ae({key:new ve("placeholder"),props:{decorations:({doc:e,selection:t})=>{const r=this.editor.isEditable||!this.options.showOnlyWhenEditable,{anchor:s}=t,i=[];if(!r)return null;const o=this.editor.isEmpty;return e.descendants((a,l)=>{const c=s>=l&&s<=l+a.nodeSize,u=!a.isLeaf&&Ai(a);if(!a.type.isTextblock)return this.options.includeChildren;if((c||!this.options.showOnlyCurrent)&&u){const d=[this.options.emptyNodeClass];o&&d.push(this.options.emptyEditorClass);const f=Pe.node(l,l+a.nodeSize,{class:d.join(" "),[n]:typeof this.options.placeholder=="function"?this.options.placeholder({editor:this.editor,node:a,pos:l,hasAnchor:c}):this.options.placeholder});i.push(f)}return this.options.includeChildren}),ie.create(e,i)}}})]}});pe.create({name:"selection",addOptions(){return{className:"selection"}},addProseMirrorPlugins(){const{editor:n,options:e}=this;return[new ae({key:new ve("selection"),props:{decorations(t){return t.selection.empty||n.isFocused||!n.isEditable||Hf(t.selection)||n.view.dragging?null:ie.create(t.doc,[Pe.inline(t.selection.from,t.selection.to,{class:e.className})])}}})]}});var _S="skipTrailingNode";function gu({types:n,node:e}){return e&&Array.isArray(n)&&n.includes(e.type)||(e==null?void 0:e.type)===n}var IS=pe.create({name:"trailingNode",addOptions(){return{node:void 0,notAfter:[]}},addProseMirrorPlugins(){var n;const e=new ve(this.name),t=this.options.node||((n=this.editor.schema.topNodeType.contentMatch.defaultType)==null?void 0:n.name)||"paragraph",r=Object.entries(this.editor.schema.nodes).map(([,s])=>s).filter(s=>(this.options.notAfter||[]).concat(t).includes(s.name));return[new ae({key:e,appendTransaction:(s,i,o)=>{const{doc:a,tr:l,schema:c}
272=o,u=e.getState(o),d=a.content.size,f=c.nodes[t];if(!s.some(h=>h.getMeta(_S))&&u)return l.insert(d,f.create())},state:{init:(s,i)=>{const o=i.tr.doc.lastChild;return!gu({node:o,types:r})},apply:(s,i)=>{if(!s.docChanged||s.getMeta("__uniqueIDTransaction"))return i;const o=s.doc.lastChild;return!gu({node:o,types:r})}}})]}}),PS=pe.create({name:"undoRedo",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:n,dispatch:e})=>Fh(n,e),redo:()=>({state:n,dispatch:e})=>$h(n,e)}},addProseMirrorPlugins(){return[TS(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()}}}),jS=pe.create({name:"starterKit",addExtensions(){var n,e,t,r;const s=[];return this.options.bold!==!1&&s.push(sw.configure(this.options.bold)),this.options.blockquote!==!1&&s.push(Zk.configure(this.options.blockquote)),this.options.bulletList!==!1&&s.push(Eh.configure(this.options.bulletList)),this.options.code!==!1&&s.push(aw.configure(this.options.code)),this.options.codeBlock!==!1&&s.push(uw.configure(this.options.codeBlock)),this.options.document!==!1&&s.push(dw.configure(this.options.document)),this.options.dropcursor!==!1&&s.push(AS.configure(this.options.dropcursor)),this.options.gapcursor!==!1&&s.push(OS.configure(this.options.gapcursor)),this.options.hardBreak!==!1&&s.push(fw.configure(this.options.hardBreak)),this.options.heading!==!1&&s.push(hw.configure(this.options.heading)),this.options.undoRedo!==!1&&s.push(PS.configure(this.options.undoRedo)),this.options.horizontalRule!==!1&&s.push(pw.configure(this.options.horizontalRule)),this.options.italic!==!1&&s.push(vw.configure(this.options.italic)),this.options.listItem!==!1&&s.push(Th.configure(this.options.listItem)),this.options.listKeymap!==!1&&s.push(Ih.configure((n=this.options)==null?void 0:n.listKeymap)),this.options.link!==!1&&s.push(Nh.configure((e=this.options)==null?void 0:e.link)),this.options.orderedList!==!1&&s.push(jh.configure(this.options.orderedList)),this.options.paragraph!==!1&&s.push(iS.configure(this.options.paragraph)),this.options.strike!==!1&&s.push(lS.configure(this.options.strike)),this.options.text!==!1&&s.push(cS.configure(this.options.text)),this.options.underline!==!1&&s.push(uS.configure((t=this.options)==null?void 0:t.underline)),this.options.trailingNode!==!1&&s.push(IS.configure((r=this.options)==null?void 0:r.trailingNode)),s}}),LS=jS,BS=/(?:^|\s)(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/,zS=Be.create({name:"image",addOptions(){return{inline:!1,allowBase64:!1,HTMLAttributes:{},resize:!1}},inline(){return this.options.inline},group(){return this.options.inline?"inline":"block"},draggable:!0,addAttributes(){return{src:{default:null},alt:{default:null},title:{default:null},width:{default:null},height:{default:null}}},parseHTML(){return[{tag:this.options.allowBase64?"img[src]":'img[src]:not([src^="data:"])'}]},renderHTML({HTMLAttributes:n}){return["img",fe(this.options.HTMLAttributes,n)]},parseMarkdown:(n,e)=>e.createNode("image",{src:n.href,title:n.title,alt:n.text}),renderMarkdown:n=>{var e,t,r,s,i,o;const a=(t=(e=n.attrs)==null?void 0:e.src)!=null?t:"",l=(s=(r=n.attrs)==null?void 0:r.alt)!=null?s:"",c=(o=(i=n.attrs)==null?void 0:i.title)!=null?o:"";return c?``:``},addNodeView(){if(!this.options.resize||!this.options.resize.enabled||typeof document>"u")return null;const{directions:n,minWidth:e,minHeight:t,alwaysPreserveAspectRatio:r}=this.options.resize;return({node:s,getPos:i,HTMLAttributes:o,editor:a})=>{const l=document.createElement("img");Object.entries(o).forEach(([d,f])=>{if(f!=null)switch(d){case"width":case"height":break;default:l.setAttribute(d,f);break}}),l.src=o.src;const c=new I1({element:l,editor:a,node:s,getPos:i,onResize:(d,f)=>{l.style.width=`${d}px`,l.style.height=`${f}px`},onCommit:(d,f)=>{const h=i();h!==void 0&&this.editor.chain().setNodeSelection(h).updateAttributes(this.name,{width:d,height:f}).run()},onUpdate:(d,f,h)=>d.type===s.type,options:{directions:n,min:{width:e,height:t},preserveAspectRatio:r===!0}}),u=c.dom;return u.style.visibility="hidden",u.style.pointerEvents="none",l.onload=()=>{u.style.visibility="",u.style.pointerEvents=""},c}},addCommands(){return{setImage:n=>({commands:e})=>e.insertContent({type:this.name,attrs:n})}}
272,addInputRules(){return[oh({find:BS,type:this.type,getAttributes:n=>{const[,,e,t,r]=n;return{src:t,alt:e,title:r}}})]}}),FS=zS,$S=/^((?:https?:)?\/\/)?((?:www|m|music)\.)?((?:youtube\.com|youtu\.be|youtube-nocookie\.com))(\/(?:[\w-]+\?v=|embed\/|v\/)?)([\w-]+)(\S+)?$/,HS=/^((?:https?:)?\/\/)?((?:www|m|music)\.)?((?:youtube\.com|youtu\.be|youtube-nocookie\.com))(\/(?:[\w-]+\?v=|embed\/|v\/)?)([\w-]+)(\S+)?$/g,Hh=n=>n.match($S),yu=(n,e)=>e?"https://www.youtube-nocookie.com/embed/videoseries?list=":n?"https://www.youtube-nocookie.com/embed/":"https://www.youtube.com/embed/",VS=n=>{const{url:e,allowFullscreen:t,autoplay:r,ccLanguage:s,ccLoadPolicy:i,controls:o,disableKBcontrols:a,enableIFrameApi:l,endTime:c,interfaceLanguage:u,ivLoadPolicy:d,loop:f,modestBranding:h,nocookie:m,origin:y,playlist:g,progressBarColor:v,startAt:x,rel:N}=n;if(!Hh(e))return null;if(e.includes("/embed/"))return e;if(e.includes("youtu.be")){const B=e.split("/").pop();return B?`${yu(m)}${B}`:null}const S=/(?:(v|list)=|shorts\/)([-\w]+)/gm.exec(e);if(!S||!S[2])return null;let O=`${yu(m,S[1]==="list")}${S[2]}`;const M=[];return t===!1&&M.push("fs=0"),r&&M.push("autoplay=1"),s&&M.push(`cc_lang_pref=${s}`),i&&M.push("cc_load_policy=1"),o||M.push("controls=0"),a&&M.push("disablekb=1"),l&&M.push("enablejsapi=1"),c&&M.push(`end=${c}`),u&&M.push(`hl=${u}`),d&&M.push(`iv_load_policy=${d}`),f&&M.push("loop=1"),h&&M.push("modestbranding=1"),y&&M.push(`origin=${y}`),g&&M.push(`playlist=${g}`),x&&M.push(`start=${x}`),v&&M.push(`color=${v}`),N!==void 0&&M.push(`rel=${N}`),M.length&&(O+=`${S[1]==="list"?"&":"?"}${M.join("&")}`),O},WS=Be.create({name:"youtube",addOptions(){return{addPasteHandler:!0,allowFullscreen:!0,autoplay:!1,ccLanguage:void 0,ccLoadPolicy:void 0,controls:!0,disableKBcontrols:!1,enableIFrameApi:!1,endTime:0,height:480,interfaceLanguage:void 0,ivLoadPolicy:0,loop:!1,modestBranding:!1,HTMLAttributes:{},inline:!1,nocookie:!1,origin:"",playlist:"",progressBarColor:void 0,width:640,rel:1}},inline(){return this.options.inline},group(){return this.options.inline?"inline":"block"},draggable:!0,addAttributes(){return{src:{default:null},start:{default:0},width:{default:this.options.width},height:{default:this.options.height}}},parseHTML(){return[{tag:"div[data-youtube-video] iframe"}]},addCommands(){return{setYoutubeVideo:n=>({commands:e})=>Hh(n.src)?e.insertContent({type:this.name,attrs:n}):!1}},addPasteRules(){return this.options.addPasteHandler?[H1({find:HS,type:this.t
272ype,getAttributes:n=>({src:n.input})})]:[]},renderHTML({HTMLAttributes:n}){const e=VS({url:n.src,allowFullscreen:this.options.allowFullscreen,autoplay:this.options.autoplay,ccLanguage:this.options.ccLanguage,ccLoadPolicy:this.options.ccLoadPolicy,controls:this.options.controls,disableKBcontrols:this.options.disableKBcontrols,enableIFrameApi:this.options.enableIFrameApi,endTime:this.options.endTime,interfaceLanguage:this.options.interfaceLanguage,ivLoadPolicy:this.options.ivLoadPolicy,loop:this.options.loop,modestBranding:this.options.modestBranding,nocookie:this.options.nocookie,origin:this.options.origin,playlist:this.options.playlist,progressBarColor:this.options.progressBarColor,startAt:n.start||0,rel:this.options.rel});return n.src=e,["div",{"data-youtube-video":""},["iframe",fe(this.options.HTMLAttributes,{width:this.options.width,height:this.options.height,allowfullscreen:this.options.allowFullscreen,autoplay:this.options.autoplay,ccLanguage:this.options.ccLanguage,ccLoadPolicy:this.options.ccLoadPolicy,disableKBcontrols:this.options.disableKBcontrols,enableIFrameApi:this.options.enableIFrameApi,endTime:this.options.endTime,interfaceLanguage:this.options.interfaceLanguage,ivLoadPolicy:this.options.ivLoadPolicy,loop:this.options.loop,modestBranding:this.options.modestBranding,origin:this.options.origin,playlist:this.options.playlist,progressBarColor:this.options.progressBarColor,rel:this.options.rel},n)]]},...ah({nodeName:"youtube",allowedAttributes:["src","width","height","start"]})}),US=WS,qS=RS;const bu=n=>n?/<\/?[a-z][\s\S]*>/i.test(n)?n:n.split(/\n{2,}/).map(t=>`<p>${t.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/\n/g,"<br />")}</p>`).join(""):"",KS=({editor:n,onImageUpload:e,uploading:t})=>{const r=()=>{const o=n.getAttributes("link").href,a=window.prompt("URL eingeben",o||"https://");if(a!==null){if(a===""){n.chain().focus().extendMarkRange("link").unsetLink().run();return}n.chain().focus().extendMarkRange("link").setLink({href:a,target:"_blank"}).run()}},s=()=>{const o=window.prompt("YouTube URL einfügen");o&&n.commands.setYoutubeVideo({src:o,width:640,height:360})},i=o=>te("h-8 w-8 inline-flex items-center justify-center text-foreground/70 hover:text-foreground hover:bg-surface-high transition-colors",o&&"bg-surface-high text-foreground");return p.jsxs("div",{className:"flex flex-wrap items-center gap-0.5 border-b border-border bg-surface-low p-1",children:[p.jsx("button",{type:"button",className:i(n.isActive("bold")),onClick:()=>n.chain().focus().toggleBold().run(),title:"Fett",children:p.jsx(em,{className:"h-4 w-4"})}),p.jsx("button",{type:"button",className:i(n.isActive("italic")),onClick:()=>n.chain().focus().toggleItalic().run(),title:"Kursiv",children:p.jsx(am,{className:"h-4 w-4"})}),p.jsx("button",{type:"button",className:i(n.isActive("strike")),onClick:()=>n.chain().focus().toggleStrike().run(),title:"Durchgestrichen",children:p.jsx(pm,{className:"h-4 w-4"})}),p.jsx("span",{className:"mx-1 h-5 w-px bg-border"}),p.jsx("button",{type:"button",className:i(n.isActive("heading",{level:2})),onClick:()=>n.chain().focus().toggleHeading({level:2}).run(),title:"Ãberschrift 2",children:p.jsx(rm,{className:"h-4 w-4"})}),p.jsx("button",{type:"button",className:i(n.isActive("heading",{level:3})),onClick:()=>n.chain().focus().toggleHeading({level:3}).run(),title:"Ãberschrift 3",children:p.jsx(sm,{className:"h-4 w-4"})}),p.jsx("span",{className:"mx-1 h-5 w-px bg-border"}),p.jsx("button",{type:"button",className:i(n.isActive("bulletList")),onClick:()=>n.chain().focus().toggleBulletList().run(),title:"Aufzählung",children:p.jsx(um,{className:"h-4 w-4"})}),p.jsx("button",{type:"button",className:i(n.isActive("orderedList")),onClick:()=>n.chain().focus().toggleOrderedList().run(),title:"Nummerierte Liste",children:p.jsx(cm,{className:"h-4 w-4"})}),p.jsx("button",{type:"button",className:i(n.isActive("blockquote")),onClick:()=>n.chain().focus().toggleBlockquote().run(),title:"Zitat",children:p.jsx(fm,{className:"h-4 w-4"})}),p.jsx("button",{type:"button",className:i(!1),onClick:()=>n.chain().focus().setHorizontalRule().run(),title:"Trennlinie",children:p.jsx(dm,{className:"h-4 w-4"})}),p.jsx("span",{className:"mx-1 h-5 w-px bg-border"}),p.jsx("button",{type:"button",className:i(n.isActive("link")),onClick:r,title:"Link",children:p.jsx(lm,{className:"h-4 w-4"})}),p.jsx("button",{type:"button",className:i(!1),onClick:e,disabled:t,title:"Bild hochladen",children:t?p.jsx(Ss,{className:"h-4 w-4 animate-spin"}):p.jsx(om,{className:"h-4 w-4"})}),p.jsx("button",{type:"button",className:i(!1),onClick:s,title:"YouTube einbetten",children:p.jsx(ym,{className:"h-4 w-4"})}),p.jsx("span",{className:"mx-1 h-5 w-px bg-border"}),p.jsx("button",{type:"button",className:i(!1),onClick:()=>
272n.chain().focus().undo().run(),disabled:!n.can().undo(),title:"Rückgängig",children:p.jsx(mm,{className:"h-4 w-4"})}),p.jsx("button",{type:"button",className:i(!1),onClick:()=>n.chain().focus().redo().run(),disabled:!n.can().redo(),title:"Wiederholen",children:p.jsx(hm,{className:"h-4 w-4"})})]})};function JS({value:n,onChange:e,placeholder:t}){const r=w.useRef(null),[s,i]=w.useState(!1),o=Jk({extensions:[LS,FS.configure({HTMLAttributes:{class:"rounded-none my-4 max-w-full h-auto"}}),Ww.configure({openOnClick:!1,autolink:!0,HTMLAttributes:{rel:"noopener noreferrer",target:"_blank"}}),US.configure({controls:!0,nocookie:!0,HTMLAttributes:{class:"w-full aspect-video my-4"}}),qS.configure({placeholder:t||"Beschreibung eingeben..."})],content:bu(n),editorProps:{attributes:{class:"prose prose-invert max-w-none min-h-[180px] px-3 py-2 focus:outline-none prose-headings:font-display prose-headings:uppercase prose-a:text-venue-kantine prose-img:rounded-none"}},onUpdate:({editor:c})=>{const u=c.getHTML();e(u==="<p></p>"?"":u)}});w.useEffect(()=>{if(!o)return;const c=o.getHTML(),u=bu(n);u&&u!==c?o.commands.setContent(u,{emitUpdate:!1}):!n&&c!=="<p></p>"&&o.commands.setContent("",{emitUpdate:!1})},[o,n]);const a=w.useCallback(()=>{var c;(c=r.current)==null||c.click()},[]),l=async c=>{if(!(!c||!o)){if(!c.type.startsWith("image/")){Y.error("Nur Bilddateien erlaubt");return}if(c.size>10*1024*1024){Y.error("Datei zu groà (max. 10MB)");return}i(!0);try{const u=c.name.split(".").pop(),d=`event-content/${Date.now()}-${Math.random().toString(36).slice(2,8)}.${u}`,{data:f,error:h}=await Q.storage.from("event-images").upload(d,c,{cacheControl:"3600",upsert:!1});if(h)throw h;const{data:m}=Q.storage.from("event-images").getPublicUrl(f.path);o.chain().focus().setImage({src:m.publicUrl,alt:c.name}).run(),Y.success("Bild eingefügt")}catch(u){Y.error(u.message||"Upload fehlgeschlagen")}finally{i(!1),r.current&&(r.current.value="")}}};return o?p.jsxs("div",{className:"border border-input bg-background",children:[p.jsx(KS,{editor:o,onImageUpload:a,uploading:s}),p.jsx(fh,{editor:o}),p.jsx("input",{ref:r,type:"file",accept:"image/*",className:"hidden",onChange:c=>{var d;const u=(d=c.target.files)==null?void 0:d[0];u&&l(u)}})]}):null}const YS=Lp("inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground hover:bg-primary/80",secondary:"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",destructive:"border-transparent bg-destructive text-destructive-foreground hover:bg-destructive/80",outline:"text-foreground"}},defaultVariants:{variant:"default"}});function To({className:n,variant:e,...t}){return p.jsx("div",{className:te(YS({variant:e}),n),...t})}var Ii="Checkbox",[GS,fC]=vu(Ii),[XS,cl]=GS(Ii);function QS(n){const{__scopeCheckbox:e,checked:t,children:r,defaultChecked:s,disabled:i,form:o,name:a,onCheckedChange:l,required:c,value:u="on",internal_do_not_use_render:d}=n,[f,h]=wu({prop:t,defaultProp:s??!1,onChange:l,caller:Ii}),[m,y]=w.useState(null),[g,v]=w.useState(null),x=w.useRef(!1),N=m?!!o||!!m.closest("form"):!0,A={checked:f,disabled:i,setChecked:h,control:m,setControl:y,name:a,form:o,value:u,hasConsumerStoppedPropagationRef:x,required:c,defaultChecked:Wt(s)?!1:s,isFormControl:N,bubbleInput:g,setBubbleInput:v};return p.jsx(XS,{scope:e,...A,children:ZS(d)?d(A):r})}var Vh="CheckboxTrigger",Wh=w.forwardRef(({__scopeCheckbox:n,onKeyDown:e,onClick:t,...r},s)=>{const{control:i,value:o,disabled:a,checked:l,required:c,setControl:u,setChecked:d,hasConsumerStoppedPropagationRef:f,isFormControl:h,bubbleInput:m}=cl(Vh,n),y=pi(s,u),g=w.useRef(l);return w.useEffect(()=>{const v=i==null?void 0:i.form;if(v){const x=()=>d(g.current);return v.addEventListener("reset",x),()=>v.removeEventListener("reset",x)}},[i,d]),p.jsx(Lr.button,{type:"button",role:"checkbox","aria-checked":Wt(l)?"mixed":l,"aria-required":c,"data-state":Yh(l),"data-disabled":a?"":void 0,disabled:a,value:o,...r,ref:y,onKeyDown:hn(e,v=>{v.key==="Enter"&&v.preventDefault()}),onClick:hn(t,v=>{d(x=>Wt(x)?!0:!x),m&&h&&(f.current=v.isPropagationStopped(),f.current||v.stopPropagation())})})});Wh.displayName=Vh;var ul=w.forwardRef((n,e)=>{const{__scopeCheckbox:t,name:r,checked:s,defaultChecked:i,required:o,disabled:a,value:l,onCheckedChange:c,form:u,...d}=n;return p.jsx(QS,{__scopeCheckbox:t,checked:s,defaultChecked:i,disabled:a,required:o,onCheckedChange:c,name:r,form:u,value:l,internal_do_not_use_render:({isFormControl:f})=>p.jsxs(p.Fragment,{children:[p.jsx(Wh,{...d,ref:e,__scopeCheckbox:t}),f&&p.jsx(Jh,{__scopeCheckbox:t})]})})});ul.displayName=Ii;var Uh="CheckboxIndicator",qh=w.forwardRef((n,e)=>{const{__scopeCheckbox:t,forceMount:r,...s}=n,i=cl(Uh,t);return p.jsx(ua,{present:r||Wt(i.checked)||i.checked===!0,children:p.jsx(Lr.span,{"data-state":Yh(i.checked),"data-disabled":i.disabled?"":void 0,...s,ref:e,style:{pointerEvents:"none",...n.style}})})});qh.displayName=Uh;var Kh="CheckboxBubbleInput",Jh=w.forwardRef(({__scopeCheckbox:n,...e},t)=>{const{control:r,hasConsumerStoppedPropagationRef:s,checked:i,defaultChecked:o,required:a,disabled:l,name:c,value:u,form:d,bubbleInput:f,setBubbleInput:h}=cl(Kh,n),m=pi(t,h),y=Bp(i),g=zp(r);w.useEffect(()=>{const x=f;if(!x)return;const N=window.HTMLInputElement.prototype,S=Object.getOwnPropertyDescriptor(N,"checked").set,O=!s.current;if(y!==i&&S){const M=new Event("click",{bubbles:O});x.indeterminate=Wt(i),S.call(x,Wt(i)?!1:i),x.dispatchEvent(M)}},[f,y,i,s]);const v=w.useRef(Wt(i)?!1:i);return p.jsx(Lr.input,{type:"checkbox","aria-hidden":!0,defaultChecked:o??v.current,required:a,disabled:l,name:c,value:u,form:d,...e,tabIndex:-1,ref:m,style:{...e.style,...g,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})});Jh.displayName=Kh;function ZS(n){return typeof n=="function"}function Wt(n){return n==="indeterminate"}function Yh(n){return Wt(n)?"indeterminate":n?"checked":"unchecked"}const ks=w.forwardRef(({className:n,...e},t)=>p.jsx(ul,{ref:t,className:te("peer h-4 w-4 shrink-0 rounded-sm border border-primary ring-offset-background data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",n),...e,children:p.jsx(qh,{className:te("flex items-center justify-center text-current"),children:p.jsx(Nu,{className:"h-4 w-4"})})}));ks.displayName=ul.displayName;const hs={draft:"Entwurf",scheduled:"Geplant",published:"Veröffentlicht",cancelled:"Abgesagt",postponed:"Verschoben",moved:"Verlegt",sold_out:"Ausverkauft"},eC={draft:"bg-muted text-muted-foreground",scheduled:"bg-blue-100 text-blue-800",published:"bg-green-100 text-green-800",cancelled:"bg-red-100 text-red-800",postponed:"bg-yellow-100 text-yellow-800",moved:"bg-orange-100 text-orange-800",sold_out:"bg-accent/20 text-accent"},Tt=n=>{if(!n)return"";const e=new Date(n),t=e.getFullYear(),r=String(e.getMonth()+1).padStart(2,"0"),s=String(e.getDate()).padStart(2,"0");return`${t}-${r}-${s}`},At=n=>{if(!n)return"";const e=new Date(n);return`${String(e.getHours()).padStart(2,"0")}
272:${String(e.getMinutes()).padStart(2,"0")}`},Ot=(n,e)=>{if(!n||!e)return null;const[t,r,s]=n.split("-").map(Number),[i,o]=e.split(":").map(Number);return new Date(t,(r||1)-1,s||1,i||0,o||0,0,0).toISOString()},Ao=()=>({title:"",subtitle:"",slug:"",status:"",start_datetime:"",doors_datetime:null,end_datetime:null,publish_at:null,venue_id:null,price_presale:"",price_boxoffice:"",prices:[{label:"VVK:",amount:""},{label:"Abendkasse:",amount:""}],ticket_url:"",external_event_url:"",description:"",hero_image_url:"",hero_image_mode:"contain",gallery_images:[],seo_title:"",seo_description:"",og_image_url:"",hide_from_newest_slider:!1,moved_note:null});function tC({embedded:n=!1,editSlug:e=null,onClose:t,onSaved:r}={}){const[s,i]=w.useState([]),[o,a]=w.useState([]),[l,c]=w.useState([]),[u,d]=w.useState([]),[f,h]=w.useState([]),[m,y]=w.useState([]),[g,v]=w.useState([]),[x,N]=w.useState({}),[A,S]=w.useState({}),[O,M]=w.useState(""),[B,U]=w.useState(!0),[re,we]=w.useState(!1),[ne,le]=w.useState(null),[D,j]=w.useState(Ao()),[et,_]=w.useState(!1),[I,ze]=w.useState({state:"idle"}),Xt=w.useRef(null),[ot,dl]=w.useState(""),[Qt,fl]=w.useState("all"),[Tn,hl]=w.useState("upcoming"),[Xn,pl]=w.useState("all"),[Qn,ml]=w.useState("all"),[Zn,gl]=w.useState("all"),[qr,Gh]=w.useState("start_datetime"),[Kr,yl]=w.useState("asc"),[Jr,Xh]=w.useState(""),[Qh,bl]=w.useState(!1),[Zh,vl]=w.useState(!1),[An,ep]=w.useState(100),[tp,er]=w.useState(1),[xl,np]=Fp(),kl=w.useRef(null);w.useEffect(()=>{Pi()},[]);const Pi=async()=>{U(!0);const b=1e3,k=[];let T=0,K=null;for(;;){const{data:X,error:H}=await Q.from("events").select("*").order("start_datetime",{ascending:!1}).range(T,T+b-1);if(H){K=H;break}if(!X||X.length===0||(k.push(...X),X.length<b))break;T+=b}const q=async(X,H,ht)=>{const Fi=[];let $i=0;for(;;){let Hi=Q.from(X).select(H).range($i,$i+b-1);ht&&(Hi=Hi.order(ht,{ascending:!0}));const{data:yp,error:Tl}=await Hi;if(Tl)return{data:Fi,error:Tl};const Al=yp||[];if(Fi.push(...Al),Al.length<b)break;$i+=b}return{data:Fi,error:null}},[F,Se,he,Re,qe]=await Promise.all([Q.from("venues").select("*").order("name"),Q.from("promoters").select("*").order("name"),Q.from("genres").select("*").order("name"),q("event_venues","event_id, venue_id, created_at","created_at"),q("event_promoters","event_id, promoter_id")]);if(K?Y.error("Fehler beim Laden der Events"):i(k),F.error||a(F.data||[]),Se.error||c(Se.data||[]),he.error||y(he.data||[]),!Re.error){const X={};for(const H of Re.data||[])X[H.event_id]||(X[H.event_id]=[]),X[H.event_id].includes(H.venue_id)||X[H.event_id].push(H.venue_id);N(X)}if(!qe.error){const X={};for(const H of qe.data||[])X[H.event_id]||(X[H.event_id]=[]),X[H.event_id].includes(H.promoter_id)||X[H.event_id].push(H.promoter_id);S(X)}U(!1);const ft=n?e:xl.get("edit");if(ft&&kl.current!==ft){const X=k.find(H=>H.slug===ft);if(X){if(kl.current=ft,Sl(X),!n){const H=new URLSearchParams(xl);H.delete("edit"),np(H,{replace:!0})}}else n&&(Y.error("Event nicht gefunden"),t==null||t())}},ji=b=>b.toLowerCase().replace(/[äöüÃ]/g,k=>({ä:"ae",ö:"oe",ü:"ue",Ã:"ss"})[k]||k).replace(/[^a-z0-9]+/g,"-").replace(/(^-|-$)/g,""),rp=()=>{const b=D.start_datetime?new Date(D.start_datetime):new Date,k=isNaN(b.getTime())?new Date().getFullYear():b.getFullYear();return String(k)},wl=async b=>{const k=ne==null?void 0:ne.id,T=rp(),K=async F=>{let Se=Q.from("events").select("id").eq("slug",F).limit(1);k&&(Se=Se.neq("id",k));const{data:he,error:Re}=await Se;return Re?(console.error("Slug check failed",Re),!1):((he==null?void 0:he.length)??0)>0},q=[b,`${b}-${T}`];for(let F=2;F<=50;F++)q.push(`${b}-${T}-${F}`);for(const F of q)if(!await K(F))return F;return`${b}-${T}-${Date.now()}`},sp=async b=>{const k=ji(b);if(!k){ze({state:"idle"});return}ze({state:"checking"});const T=await wl(k);ze(T===k?{state:"available"}:{state:"taken",suggestion:T})},Li=b=>{Xt.current&&clearTimeout(Xt.current),Xt.current=setTimeout(()=>{sp(b)},350)},ip=b=>{j(k=>{const T=ne?k.slug:ji(b);return ne||Li(T),{...k,title:b,slug:T}})},op=b=>{j(k=>({...k,slug:b})),Li(b)},ap=async b=>{var k,T;if(b.preventDefault(),!(D.subtitle||"").trim()){Y.error("Bitte einen Untertitel eintragen.");return}if(f.length===0){Y.error("Bitte mindestens eine Venue auswählen.");return}if(!D.status){Y.error("Bitte einen Status auswählen.");return}if(!D.start_datetime){Y.error("Bitte ein Veranstaltungsdatum eintragen.");return}if(u.length===0){Y.error("Bitte mindestens einen Veranstalter auswählen.");return}
272if(g.length===0){Y.error("Bitte mindestens ein Genre auswählen.");return}_(!0);try{const K=ji(D.slug||"");if(!K){Y.error("Slug darf nicht leer sein."),_(!1);return}const q=await wl(K);if(q!==K){j(H=>({...H,slug:q})),ze({state:"available"}),Y.error(`Slug "${K}" ist bereits vergeben. Vorschlag eingesetzt: "${q}". Bitte prüfen und erneut speichern.`),_(!1);return}K!==D.slug&&(D.slug=K);const F=(D.prices||[]).filter(H=>H.label&&H.label.trim()||H.amount&&H.amount.trim()),Se={...D,moved_note:D.status==="moved"&&(D.moved_note??"").trim()||null,prices:F,price_presale:((k=F[0])==null?void 0:k.amount)||null,price_boxoffice:((T=F[1])==null?void 0:T.amount)||null,venue_id:f[0]||null};let he;if(ne){const{error:H}=await Q.from("events").update(Se).eq("id",ne.id);if(H)throw H;he=ne.id,Y.success("Event aktualisiert")}else{const{data:H,error:ht}=await Q.from("events").insert(Se).select("id").single();if(ht)throw ht;he=H.id,Y.success("Event erstellt")}const{error:Re}=await Q.from("event_venues").delete().eq("event_id",he);if(Re)throw Re;const{error:qe}=await Q.from("event_venues").insert(f.map(H=>({event_id:he,venue_id:H})));if(qe)throw qe;const{error:ft}=await Q.from("event_promoters").delete().eq("event_id",he);if(ft)throw ft;if(u.length>0){const{error:H}=await Q.from("event_promoters").insert(u.map(ht=>({event_id:he,promoter_id:ht})));if(H)throw H}const{error:X}=await Q.from("event_genres").delete().eq("event_id",he);if(X)throw X;if(g.length>0){const{error:H}=await Q.from("event_genres").insert(g.map(ht=>({event_id:he,genre_id:ht})));if(H)throw H}we(!1),le(null),j(Ao()),d([]),h([]),v([]),ze({state:"idle"}),r==null||r(),n?t==null||t():Pi()}catch(K){Y.error(K.message||"Fehler beim Speichern")}finally{_(!1)}},Sl=async b=>{le(b),ze({state:"idle"}),j({title:b.title,subtitle:b.subtitle||"",slug:b.slug,status:b.status,start_datetime:b.start_datetime,doors_datetime:b.doors_datetime,end_datetime:b.end_datetime,publish_at:b.publish_at??null,venue_id:b.venue_id,price_presale:b.price_presale||"",price_boxoffice:b.price_boxoffice||"",prices:Rl(b),ticket_url:b.ticket_url||"",external_event_url:b.external_event_url||"",description:b.description||"",hero_image_url:b.hero_image_url||"",hero_image_mode:b.hero_image_mode||"contain",gallery_images:b.gallery_images||[],seo_title:b.seo_title||"",seo_description:b.seo_description||"",og_image_url:b.og_image_url||"",hide_from_newest_slider:b.hide_from_newest_slider??!1,moved_note:b.moved_note??""});const[k,T,K]=await Promise.all([Q.from("event_promoters").select("promoter_id").eq("event_id",b.id),Q.from("event_venues").select("venue_id").eq("event_id",b.id),Q.from("event_genres").select("genre_id").eq("event_id",b.id)]);d((k.data||[]).map(F=>F.promoter_id));const q=(T.data||[]).map(F=>F.venue_id);h(q.length>0?q:b.venue_id?[b.venue_id]:[]),v((K.data||[]).map(F=>F.genre_id)),we(!0)},lp=async b=>{if(!confirm("Event wirklich löschen?"))return;const{error:k}=await Q.from("events").delete().eq("id",b);k?Y.error("Fehler beim Löschen"):(Y.success("Event gelöscht"),Pi())},cp=async b=>{const[k,T,K]=await Promise.all([Q.from("event_promoters").select("promoter_id").eq("event_id",b.id),Q.from("event_venues").select("venue_id").eq("event_id",b.id),Q.from("event_genres").select("genre_id").eq("event_id",b.id)]);le(null),j({title:`${b.title} (Kopie)`,subtitle:b.subtitle||"",slug:`${b.slug}-kopie`,status:"draft",start_datetime:b.start_datetime,doors_datetime:b.doors_datetime,end_datetime:b.end_datetime,publish_at:null,venue_id:b.venue_id,price_presale:b.price_presale||"",price_boxoffice:b.price_boxoffice||"",prices:Rl(b),ticket_url:b.ticket_url||"",external_event_url:b.external_event_url||"",description:b.description||"",hero_image_url:b.hero_image_url||"",hero_image_mode:b.hero_image_mode||"contain",gallery_images:b.gallery_images||[],seo_title:b.seo_title||"",seo_description:b.seo_description||"",og_image_url:b.og_image_url||"",hide_from_newest_slider:b.hide_from_newest_slider??!1,moved_note:b.moved_note??""});const q=(T.data||[]).map(F=>F.venue_id);d((k.data||[]).map(F=>F.promoter_id)),h(q.length>0?q:b.venue_id?[b.venue_id]:[]),v((K.data||[]).map(F=>F.genre_id)),ze({state:"idle"}),Li(`${b.slug}-kopie`),we(!0),Y.info("Kopie als Entwurf vorbereitet â Datum anpassen und speichern.")},up=()=>{le(null),j(Ao()),d([]),h([]),v([]),ze({state:"idle"}),we(!0)},Cl=b=>{d(k=>k.includes(b)?k.filter(T=>T!==b):[...k,b])},Ml=b=>{h(k=>k.includes(b)?k.filter(T=>T!==b):[...k,b])},Nl=b=>{v(k=>k.includes(b)?k.filter(T=>T!==b):[...k,b])},Bi=b=>{var k;return b&&((k=o.find(T=>T.id===b))==null?void 0:k.name)||"-"},dp=b=>{const k=x[b.id];if(!k||k.length===0)return Bi(b.venue_id);const K=(b.venue_id?[b.venue_id,...k.filter(q=>q!==b.venue_id)]:k).map(q=>{var F;return(F=o.find(Se=>Se.id===q))==null?void 0:F.name}).filter(q=>!!q);return K.length>0?Array.from(new Set(K)).join(" · "):"-"},El=Date.now(),zi=s.filter(b=>{const k=b.title.toLowerCase().includes(ot.toLowerCase())||b.slug.toLowerCase().includes(ot.toLowerCase()),T=Qt==="all"||b.status===Qt,K=x[b.id]||(b.venue_id?[b.venue_id]:[]),q=Xn==="all"||K.includes(Xn),F=Qn==="all"||(A[b.id]||[]).includes(Qn),Se=new Date(b.start_datetime).getTime(),he=Tn==="all"||Tn==="upcoming"&&Se>=El||Tn==="past"&&Se<El,Re=Zn==="all"||new Date(b.start_datetime).getMonth()+1===parseInt(Zn);return k&&T&&q&&F&&he&&Re}).sort((b,k)=>{let T=0;switch(qr){case"title":T=b.title.localeCompare(k.title);break;case"start_datetime":T=new Date(b.start_datetime).getTime()-new Date(k.start_datetime).getTime();break;case"venue":T=Bi(b.venue_id).localeCompare(Bi(k.venue_id));break;case"status":T=b.status.localeCompare(k.status);break}return Kr==="asc"?T:-T}),fp=!!ot||Qt!=="all"||Xn!=="all"||Qn!=="all"||Zn!=="all"||Tn!=="all",hp=()=>{dl(""),fl("all"),pl("all"),ml("all"),gl("all"),hl("all")},pp=[{value:"all",label:"Alle Monate"},{value:"1",label:"Januar"},{value:"2",label:"Februar"},{value:"3",label:"März"},{value:"4",label:"April"},{value:"5",label:"Mai"},{value:"6",label:"Juni"},{value:"7",label:"Juli"},{value:"8",label:"August"},{value:"9",label:"September"},{value:"10",label:"Oktober"},{value:"11",label:"November"},{value:"12",label:"Dezember"}],Yr=b=>{qr===b?yl(Kr==="asc"?"desc":"asc"):(Gh(b),yl("asc"))},Gr=({column:b})=>qr!==b?p.jsx(Qp,{className:"h-4 w-4 ml-1 opacity-50"}):Kr==="asc"?p.jsx(Zp,{className:"h-4 w-4 ml-1"}):p.jsx(Xp,{className:"h-4 w-4 ml-1"}),tr=zi.length,Zt=Math.max(1,Math.ceil(tr/An)),On=Math.min(tp,Zt),Xr=(On-1)*An,mp=Math.min(Xr+An,tr),gp=zi.slice(Xr,Xr+An);w.useEffect(()=>{er(1)},[ot,Qt,Tn,Xn,Qn,Zn,qr,Kr,An]);const Te={title:!(D.title||"").trim(),slug:!(D.slug||"").trim(),subtitle:!(D.subtitle||"").trim(),status:!D.status,start_datetime:!D.start_datetime,venues:f.length===0,promoters:u.length===0,genres:g.length===0},Mt=b=>b?"text-destructive":"",Nt=b=>b?"border-destructive focus-visible:ring-destructive":"";return p.jsxs("div",{className:n?"":"space-y-6",children:[!n&&p.jsxs("div",{className:"flex flex-col sm:flex-row justify-between items-start sm:items-center gap-4",children:[p.jsx("h2",{className:"heading-card text-foreground whitespace-nowrap",children:"Events verwalten"}),p.jsxs("div",{className:"relative w-full sm:flex-1 sm:max-w-md",children:[p.jsx(Vi,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground pointer-events-none"}),p.jsx(_e,{placeholder:"Event suchen...",value:ot,onChange:b=>dl(b.target.value),className:"pl-9"})]}),p.jsx("div",{className:"flex flex-wrap items-center gap-2",children:p.jsxs(be,{variant:"accent",onClick:up,children:[p.jsx(Wi,{className:"h-4 w-4 mr-2"}),"Neues Event"]})})]}),p.jsx($p,{open:re,onOpenChange:b=>{we(b),!b&&n&&(t==null||t())},children:p.jsxs(Hp,{className:"max-w-3xl max-h-[90vh] overflow-y-auto",children:[p.jsx(Vp,{children:p.jsx(Wp,{className:"font-display text-2xl",children:ne?"Event bearbeiten":"Neues Event"})}),p.jsxs("form",{onSubmit:ap,className:"space-y-4",children:[p.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[p.jsxs("div",{className:"space-y-2",children:[p.jsx(se,{htmlFor:"title",className:Mt(Te.title),children:"Titel *"}),p.jsx(_e,{id:"title",value:D.title,onChange:b=>ip(b.target.value),required:!0,className:Nt(Te.title)})]}),p.jsxs("div",{className:"space-y-2",children:[p.jsx(se,{htmlFor:"slug",className:Mt(Te.slug),children:"Slug *"}),p.jsx(_e,{id:"slug",value:D.slug,onChange:b=>op(b.target.value),required:!0,className:Nt(Te.slug)}),I.state==="checking"&&p.jsx("p",{className:"text-xs text-muted-foreground",children:"Prüfe Verfügbarkeitâ¦"}),I.state==="available"&&p.jsx("p",{className:"text-xs text-green-600",children:"â Slug ist verfügbar"}),I.state==="taken"&&p.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[p.jsxs("p",{className:"text-xs text-destructive",children:["â Slug bereits vergeben â Vorschlag:"," ",p.jsx("code",{className:"px-1 py-0.5 rounded bg-muted",children:I.suggestion})]}),p.jsx(be,{type:"button",size:"sm",variant:"outline",onClick:()=>{const b=I.suggestion;j(k=>({...k,slug:b})),ze({state:"available"})},children:"Vorschlag übernehmen"})]})]}),p.jsxs("div",{className:"space-y-2",children:[p.jsx(se,{htmlFor:"subtitle",className:Mt(Te.subtitle),children:"Untertitel *"}),p.jsx(_e,{id:"subtitle",value:D.subtitle||"",onChange:b=>j(k=>({...k,subtitle:b.target.value})),placeholder:"z.B. Support: XYZ · Tour 2026",required:!0,className:Nt(Te.subtitle)})]})]}),p.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[p.jsxs("div",{className:"space-y-2",children:[p.jsx(se,{htmlFor:"status",className:Mt(Te.status),children:"Status *"}),p.jsxs(en,{value:D.status||void 0,onValueChange:b=>j(k=>({...k,status:b,publish_at:b==="scheduled"?k.publish_at:null,moved_note:b==="moved"?k.moved_note??"":null})),children:[p.jsx(tn,{className:Nt(Te.status),children:p.jsx(nn,{placeholder:"Status auswählenâ¦"})}),p.jsx(rn,{className:"bg-background",children:Object.entries(hs).map(([b,k])=>p.jsx(Fe,{value:b,children:k},b))})]}),D.status==="moved"&&p.jsxs("div",{className:"space-y-1 pt-2",children:[p.jsx(se,{htmlFor:"moved_note",className:"text-xs",children:"Zusatz zur Verlegung"}),p.jsx(_e,{id:"moved_note",value:D.moved_note??"",onChange:b=>j(k=>({...k,moved_note:b.target.value})),placeholder:"z. B. ins Luxor"}),p.jsx("p",{className:"text-xs text-muted-foreground",children:"Wird in den Listen als ââ Verlegt ins Luxor ââ angezeigt."})]}),D.status==="scheduled"&&p.jsxs("div",{className:"grid grid-cols-2 gap-2 pt-2",children:[p.jsxs("div",{className:"space-y-1",children:[p.jsx(se,{htmlFor:"publish_date",className:"text-xs",children:"Veröffentlichen am"}),p.jsx(ms,{id:"publish_date",value:Tt(D.publish_at),onChange:b=>{const k=At(D.publish_at)||"09:00";j(T=>({...T,publish_at:b?Ot(b,k):null}))}})]}),p.jsxs("div",{className:"space-y-1",children:[p.jsx(se,{htmlFor:"publish_time",className:"text-xs",children:"Uhrzeit"}),p.jsx(ar,{id:"publish_time",value:At(D.publish_at)||"09:00",onChange:b=>{const k=Tt(D.publish_at)||Tt(new Date().toISOString());j(T=>({...T,publish_at:Ot(k,b)}))}})]}),D.publish_at&&new Date(D.publish_at)<=new Date&&p.jsx("p",{className:"col-span-2 text-xs text-destructive",children:"Zeitpunkt liegt in der Vergangenheit â Event wird beim nächsten Cron-Lauf sofort live geschaltet."})]}),p.jsxs("div",{className:"flex items-start gap-2 pt-2",children:[p.jsx(ks,{id:"hide_from_newest_slider",checked:!!D.hide_from_newest_slider,onCheckedChange:b=>j(k=>({...k,hide_from_newest_slider:b===!0}))}),p.jsx("div",{className:"space-y-0.5",children:p.jsx(se,{htmlFor:"hide_from_newest_slider",className:"text-sm font-normal cursor-pointer",children:'Nicht im Slider âNeu im Programm" auf der Startseite anzeigen'})})]})]}),p.jsxs("div",{className:"space-y-2",children:[p.jsx(se,{htmlFor:"event_date",className:Mt(Te.start_datetime),children:"Veranstaltungsdatum *"}),p.jsx(ms,{id:"event_date",value:Tt(D.start_datetime),onChange:b=>
272{if(!b)return;const k=At(D.start_datetime)||"20:00",T=At(D.doors_datetime)||"19:00";j(K=>({...K,start_datetime:Ot(b,k)||K.start_datetime,doors_datetime:Ot(b,T)}))},required:!0,className:Nt(Te.start_datetime)})]})]}),p.jsxs("div",{className:"space-y-2",children:[p.jsx(se,{className:Mt(Te.venues),children:"Venues *"}),o.length===0?p.jsx("p",{className:"text-xs text-muted-foreground",children:'Noch keine Venues angelegt. Lege im Tab âVenues" welche an.'}):p.jsxs(p.Fragment,{children:[f.length>0&&p.jsx("div",{className:"flex flex-wrap gap-2 mb-2",children:f.map(b=>{const k=o.find(T=>T.id===b);return k?p.jsxs(To,{variant:"secondary",className:"gap-1 pr-1",children:[k.name,p.jsx("button",{type:"button",onClick:()=>Ml(b),className:"ml-1 rounded-sm hover:bg-foreground/10 p-0.5","aria-label":`${k.name} entfernen`,children:p.jsx(or,{className:"h-3 w-3"})})]},b):null})}),p.jsxs(ga,{children:[p.jsx(ya,{asChild:!0,children:p.jsxs(be,{type:"button",variant:"outline",className:`w-full justify-between font-normal ${Nt(Te.venues)}`,children:[p.jsx("span",{className:"text-muted-foreground",children:f.length===0?"Venue(s) auswählen â¦":`${f.length} ausgewählt`}),p.jsx(Jp,{className:"h-4 w-4 opacity-50"})]})}),p.jsx(gi,{className:"w-[--radix-popover-trigger-width] p-1",align:"start",children:p.jsx("div",{className:"max-h-60 overflow-y-auto",children:o.map(b=>{const k=f.includes(b.id);return p.jsxs("button",{type:"button",onClick:()=>Ml(b.id),className:"flex w-full items-center gap-2 px-2 py-1.5 text-left text-sm hover:bg-foreground
272/5",children:[p.jsx("span",{className:"flex h-4 w-4 items-center justify-center border border-foreground/30",children:k&&p.jsx(Nu,{className:"h-3 w-3"})}),p.jsx("span",{children:b.name})]},b.id)})})})]}),p.jsx("p",{className:"text-xs text-muted-foreground",children:"Mindestens eine Venue auswählen. Die erste ausgewählte ist das primäre Venue (bestimmt Farbe und Adresse)."})]})]}),p.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[p.jsxs("div",{className:"space-y-2",children:[p.jsx(se,{htmlFor:"doors_time",children:"Einlass"}),p.jsx(ar,{id:"doors_time",value:At(D.doors_datetime),onChange:b=>{const k=Tt(D.start_datetime);j(T=>({...T,doors_datetime:b&&k?Ot(k,b):null}))}})]}),p.jsxs("div",{className:"space-y-2",children:[p.jsx(se,{htmlFor:"start_time",children:"Beginn *"}),p.jsx(ar,{id:"start_time",value:At(D.start_datetime),onChange:b=>{const k=Tt(D.start_datetime);if(!b||!k)return;const T=Ot(k,b);T&&j(K=>({...K,start_datetime:T}))},required:!0})]})]}),p.jsxs("div",{className:"space-y-2",children:[p.jsx(se,{htmlFor:"end_datetime",children:"Ende (optional, kann anderer Tag sein)"}),p.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[p.jsx(ms,{id:"end_datetime",value:Tt(D.end_datetime||""),onChange:b=>{const k=At(D.end_datetime||"")||"23:00";j(T=>({...T,end_datetime:b?Ot(b,k):null}))}}),p.jsx(ar,{id:"end_time",value:At(D.end_datetime||""),onChange:b=>{const k=Tt(D.end_datetime||"");j(T=>({...T,end_datetime:b&&k?Ot(k,b):T.end_datetime}))}})]})]}),p.jsxs("div",{className:"space-y-2",children:[p.jsx(se,{className:Mt(Te.promoters),children:"Veranstalter *"}),l.length===0?p.jsx("p",{className:"text-xs text-muted-foreground",children:'Noch keine Veranstalter angelegt. Lege im Tab âVeranstalter" welche an.'}):p.jsxs(p.Fragment,{children:[u.length>0&&p.jsx("div",{className:"flex flex-wrap gap-2 mb-2",children:u.map(b=>{const k=l.find(T=>T.id===b);return k?p.jsxs(To,{variant:"secondary",className:"gap-1 pr-1",children:[k.name,p.jsx("button",{type:"button",onClick:()=>
272Cl(b),className:"ml-1 rounded-sm hover:bg-foreground/10 p-0.5","aria-label":`${k.name} entfernen`,children:p.jsx(or,{className:"h-3 w-3"})})]},b):null})}),p.jsxs("div",{className:"relative mb-2",children:[p.jsx(Vi,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),p.jsx(_e,{placeholder:"Veranstalter suchen...",value:Jr,onChange:b=>Xh(b.target.value),onFocus:()=>bl(!0),onBlur:()=>setTimeout(()=>bl(!1),150),className:`pl-9 ${Nt(Te.promoters)}`})]}),(Qh||Jr.trim().length>0)&&p.jsx("div",{className:"border border-foreground/15 max-h-44 overflow-y-auto p-2 space-y-1",children:(()=>{const b=Jr.trim().toLowerCase(),k=b?l.filter(T=>T.name.toLowerCase().includes(b)):l;return k.length===0?p.jsxs("p",{className:"px-2 py-1.5 text-xs text-muted-foreground",children:["Keine Veranstalter gefunden für â",Jr,'".']}):k.map(T=>p.jsxs("label",{className:"flex items-center gap-2 px-2 py-1.5 hover:bg-foreground/5 cursor-pointer text-sm",children:[p.jsx(ks,{checked:u.includes(T.id),onCheckedChange:()=>Cl(T.id)}),p.jsx("span",{children:T.name})]},T.id))})()})]})]}),p.jsxs("div",{className:"space-y-2",children:[p.jsx(se,{className:Mt(Te.genres),children:"Genres *"}),m.length===0?p.jsx("p",{className:"text-xs text-muted-foreground",children:"Noch keine Genres angelegt."}):p.jsxs(p.Fragment,{children:[g.length>0&&p.jsx("div",{className:"flex flex-wrap gap-2 mb-2",children:g.map(b=>{const k=m.find(T=>T.id===b);return k?p.jsxs(To,{variant:"secondary",className:"gap-1 pr-1",children:[k.name,p.jsx("button",{type:"button",onClick:()=>
272Nl(b),className:"ml-1 rounded-sm hover:bg-foreground/10 p-0.5","aria-label":`${k.name} entfernen`,children:p.jsx(or,{className:"h-3 w-3"})})]},b):null})}),p.jsxs("div",{className:"relative mb-2",children:[p.jsx(Vi,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),p.jsx(_e,{placeholder:"Genre suchen...",value:O,onChange:b=>M(b.target.value),onFocus:()=>vl(!0),onBlur:()=>setTimeout(()=>vl(!1),150),className:`pl-9 ${Nt(Te.genres)}`})]}),(Zh||O.trim().length>0)&&p.jsx("div",{className:"border border-foreground/15 max-h-44 overflow-y-auto p-2 space-y-1",children:(()=>{const b=O.trim(),k=b.toLowerCase(),T=k?m.filter(F=>F.name.toLowerCase().includes(k)):m,K=k.length>0&&m.some(F=>F.name.toLowerCase()===k),q=T.map(F=>p.jsxs("label",{className:"flex items-center gap-2 px-2 py-1.5 hover:bg-foreground/5 cursor-pointer text-sm",children:[p.jsx(ks,{checked:g.includes(F.id),onCheckedChange:()=>Nl(F.id)}),p.jsx("span",{children:F.name})]},F.id));return T.length===0&&q.push(p.jsxs("p",{className:"px-2 py-1.5 text-xs text-muted-foreground",children:["Keine Genres gefunden für â",b,'".']},"empty")),b.length>0&&!K&&q.push(p.jsxs("button",{type:"button",onMouseDown:F=>F.preventDefault(),onClick:async()=>{const F=b,Se=F.toLowerCase().replace(/[äöüÃ]/g,qe=>({ä:"ae",ö:"oe",ü:"ue",Ã:"ss"})[qe]||qe).replace(/[^a-z0-9]+/g,"-").replace(/(^-|-$)/g,"");if(!Se){Y.error("Ungültiger Genre-Name.");return}const{data:he,error:Re}=await Q.from("genres").insert({name:F,slug:Se}).select().single();if(Re||!he){Y.error((Re==null?void 0:Re.message)||"Genre konnte nicht angelegt werden.");return}y(qe=>[...qe,he].sort((ft,X)=>ft.name.localeCompare(X.name))),v(qe=>[...qe,he.id]),M(""),Y.success(`Genre â${F}" angelegt.`)},className:"w-full flex items-center gap-2 px-2 py-1.5 text-sm text-primary hover:bg-foreground
272/5 text-left",children:[p.jsx(Wi,{className:"h-4 w-4"}),p.jsxs("span",{children:["Genre â",b,'" anlegen']})]},"create")),q})()})]})]}),p.jsxs("div",{className:"space-y-3",children:[p.jsxs("div",{className:"flex items-center justify-between",children:[p.jsx(se,{children:"Preise"}),p.jsxs(be,{type:"button",variant:"outline",size:"sm",onClick:()=>j(b=>({...b,prices:[...b.prices||[],{label:"",amount:""}]})),children:[p.jsx(Wi,{className:"h-4 w-4 mr-1"}),"Preis hinzufügen"]})]}),(D.prices||[]).length===0&&p.jsx("p",{className:"text-sm text-muted-foreground",children:'Noch keine Preise. Z.B. âVorverkauf â 25 â¬", âVIP â 80 â¬", âBundle 2 Tickets â 45 â¬".'}),p.jsx("div",{className:"space-y-2",children:(D.prices||[]).map((b,k)=>p.jsxs("div",{className:"grid grid-cols-[1fr_140px_auto] gap-2 items-center",children:[p.jsx(_e,{value:b.label,placeholder:"Bezeichnung (z.B. Vorverkauf, VIP, Bundle)",onChange:T=>j(K=>{const q=[...K.prices||[]];return q[k]={...q[k],label:T.target.value},{...K,prices:q}})}),p.jsx(_e,{value:b.amount,placeholder:"z.B. 25 â¬",onChange:T=>j(K=>{const q=[...K.prices||[]];return q[k]={...q[k],amount:T.target.value},{...K,prices:q}})}),p.jsx(be,{type:"button",variant:"ghost",size:"icon",onClick:()=>j(T=>({...T,prices:(T.prices||[]).filter((K,q)=>q!==k)})),"aria-label":"Preis entfernen",children:p.jsx(_l,{className:"h-4 w-4"})})]},k))})]}),p.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[p.jsxs("div",{className:"space-y-2",children:[p.jsx(se,{htmlFor:"ticket_url",children:"Ticket-URL"}),p.jsx(_e,{id:"ticket_url",type:"url",value:D.ticket_url||"",onChange:b=>j(k=>({...k,ticket_url:b.target.value}))})]}),p.jsxs("div",{className:"space-y-2",children:[p.jsx(se,{htmlFor:"external_event_url",children:"Externe Event-URL"}),p.jsx(_e,{id:"external_event_url",type:"url",value:D.external_event_url||"",onChange:b=>j(k=>({...k,external_event_url:b.target.value}))})]})]}),p.jsxs("div",{className:"space-y-2",children:[p.jsx(se,{htmlFor:"description",children:"Beschreibung"}),p.jsx(JS,{value:D.description||"",onChange:b=>j(k=>({...k,description:b})),placeholder:"Beschreibung, Bilder, YouTube-Videos..."})]}),p.jsxs("div",{className:"space-y-4",children:[p.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[p.jsx($l,{label:"Hero-Bild",value:D.hero_image_url||"",onChange:b=>j(k=>({...k,hero_image_url:b})),bucket:"event-images",folder:"hero"}),p.jsx($l,{label:"OG-Image (Social Media)",value:D.og_image_url||"",onChange:b=>j(k=>({...k,og_image_url:b})),bucket:"event-images",folder:"og"})]}),p.jsxs("div",{className:"space-y-2",children:[p.jsx(se,{children:"Hero-Bild Anzeige"}),p.jsxs(en,{value:D.hero_image_mode||"contain",onValueChange:b=>j(k=>({...k,hero_image_mode:b})),children:[p.jsx(tn,{className:"w-full sm:w-[200px]",children:p.jsx(nn,{})}),p.jsxs(rn,{className:"bg-background",children:[p.jsx(Fe,{value:"contain",children:"Vollständig (contain)"}),p.jsx(Fe,{value:"cover",children:"Bildschirmfüllend (cover)"})]})]}),p.jsx("p",{className:"text-xs text-muted-foreground",children:'"Contain" zeigt das gesamte Bild, "Cover" füllt den Bereich aus.'})]})]}),p.jsxs("div",{className:"space-y-2",children:[p.jsx(se,{htmlFor:"seo_title",children:"SEO Titel"}),p.jsx(_e,{id:"seo_title",value:D.seo_title||"",onChange:b=>j(k=>({...k,seo_title:b.target.value}))})]}),p.jsxs("div",{className:"space-y-2",children:[p.jsx(se,{htmlFor:"seo_description",children:"SEO Beschreibung"}),p.jsx(qp,{id:"seo_description",value:D.seo_description||"",onChange:b=>j(k=>({...k,seo_description:b.target.value})),rows:2})]}),p.jsxs("div",{className:"flex justify-end gap-3 pt-4",children:[p.jsx(be,{type:"button",variant:"outline",onClick:()=>we(!1),children:"Abbrechen"}),p.jsxs(be,{type:"submit",variant:"accent",disabled:et,children:[et&&p.jsx(Ss,{className:"h-4 w-4 mr-2 animate-spin"}),ne?"Speichern":"Erstellen"]})]})]})]})}),!n&&p.jsxs(p.Fragment,{children:[p.jsxs("div",{className:"flex flex-col gap-3",children:[p.jsxs("div",{className:"flex flex-col lg:flex-row gap-2",children:[p.jsx("div",{className:"flex bg-card overflow-hidden",children:[{value:"upcoming",label:"Kommend",icon:Mu},{value:"past",label:"Vergangen",icon:Yp},{value:"all",label:"Alle",icon:Oo}].map(b=>{const k=Tn===b.value,T=b.icon;return p.jsxs("button",{type:"button",onClick:()=>hl(b.value),className:`px-4 h-10 text-xs font-bold uppercase transition-colors flex items-center gap-2 ${k?"bg-venue-kantine text-venue-kantine-foreground":"text-foreground
272/70 hover:text-foreground hover:bg-card/60"}`,style:{letterSpacing:"0.14em"},children:[p.jsx(T,{className:"h-3.5 w-3.5"}),p.jsx("span",{className:"hidden sm:inline",children:b.label})]},b.value)})}),p.jsxs(en,{value:Xn,onValueChange:pl,children:[p.jsx(tn,{className:"w-full sm:w-[170px]",children:p.jsx(nn,{placeholder:"Location"})}),p.jsxs(rn,{className:"bg-popover",children:[p.jsx(Fe,{value:"all",children:"Alle Locations"}),o.map(b=>p.jsx(Fe,{value:b.id,children:b.name},b.id))]})]}),p.jsxs(en,{value:Qn,onValueChange:ml,children:[p.jsx(tn,{className:"w-full sm:w-[190px]",children:p.jsx(nn,{placeholder:"Veranstalter"})}),p.jsxs(rn,{className:"bg-popover",children:[p.jsx(Fe,{value:"all",children:"Alle Veranstalter"}),l.map(b=>p.jsx(Fe,{value:b.id,children:b.name},b.id))]})]}),p.jsxs(en,{value:Qt,onValueChange:b=>fl(b),children:[p.jsx(tn,{className:"w-full sm:w-[160px]",children:p.jsx(nn,{placeholder:"Status"})}),p.jsxs(rn,{className:"bg-popover",children:[p.jsx(Fe,{value:"all",children:"Alle Status"}),Object.entries(hs).map(([b,k])=>p.jsx(Fe,{value:b,children:k},b))]})]}),p.jsxs(en,{value:Zn,onValueChange:gl,children:[p.jsxs(tn,{className:"w-full sm:w-[160px]",children:[p.jsx(Oo,{className:"h-4 w-4 mr-2"}),p.jsx(nn,{placeholder:"Monat"})]}),p.jsx(rn,{className:"bg-popover",children:pp.map(b=>p.jsx(Fe,{value:b.value,children:b.label},b.value))})]}),fp&&p.jsxs(be,{variant:"ghost",onClick:hp,className:"h-10 text-muted-foreground hover:text-foreground",children:[p.jsx(or,{className:"h-4 w-4 mr-1"}),"Zurücksetzen"]})]}),p.jsxs("div",{className:"flex flex-wrap items-center gap-3 text-xs text-muted-foreground",children:[p.jsx("span",{children:tr===0?"Keine Events gefunden":`${Xr+1}â${mp} von ${tr} ${tr===1?"Event":"Events"}`}),p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx("span",{children:"Pro Seite:"}),p.jsxs(en,{value:String(An),onValueChange:b=>ep(Number(b)),children:[p.jsx(tn,{className:"h-8 w-[80px]",children:p.jsx(nn,{})}),p.jsxs(rn,{className:"bg-popover",children:[p.jsx(Fe,{value:"25",children:"25"}),p.jsx(Fe,{value:"50",children:"50"}),p.jsx(Fe,{value:"100",children:"100"}),p.jsx(Fe,{value:"200",children:"200"})]})]})]})]})]}),B?p.jsx("div",{className:"flex justify-center py-12",children:p.jsx(Ss,{className:"h-8 w-8 animate-spin text-muted-foreground"})}):s.length===0?p.jsx("div",{className:"text-center py-12 text-muted-foreground",children:"Noch keine Events vorhanden."}):zi.length===0?p.jsxs("div",{className:"text-center py-12 text-muted-foreground",children:['Keine Events gefunden für "',ot,'"',Qt!=="all"&&` mit Status "${hs[Qt]}"`,"."]}):p.jsx("div",{className:"border rounded-lg overflow-x-auto",children:p.jsxs(Au,{children:[p.jsx(Ou,{children:p.jsxs(_o,{children:[p.jsx(on,{className:"w-16",children:"Bild"}),p.jsx(on,{children:p.jsxs("button",{className:"flex items-center hover:text-foreground transition-colors",onClick:()=>Yr("title"),children:["Titel",p.jsx(Gr,{column:"title"})]})}),p.jsx(on,{children:p.jsxs("button",{className:"flex items-center hover:text-foreground transition-colors",onClick:()=>Yr("start_datetime"),children:["Datum",p.jsx(Gr,{column:"start_datetime"})]})}),p.jsx(on,{children:p.jsxs("button",{className:"flex items-center hover:text-foreground transition-colors",onClick:()=>Yr("venue"),children:["Venue",p.jsx(Gr,{column:"venue"})]})}),p.jsx(on,{children:p.jsxs("button",{className:"flex items-center hover:text-foreground transition-colors",onClick:()=>Yr("status"),children:["Status",p.jsx(Gr,{column:"status"})]})}),p.jsx(on,{className:"text-right",children:"Aktionen"})]})}),p.jsx(Du,{children:gp.map(b=>p.jsxs(_o,{children:[p.jsx(an,{children:b.hero_image_url?p.jsx("img",{src:b.hero_image_url,alt:b.title,className:"w-12 h-12 object-cover rounded"}):p.jsx("div",{className:"w-12 h-12 bg-muted rounded flex items-center justify-center",children:p.jsx(im,{className:"h-5 w-5 text-muted-foreground"})})}),p.jsx(an,{className:"font-medium",children:b.title}),p.jsx(an,{className:"text-muted-foreground whitespace-nowrap",children:St(new Date(b.start_datetime),"dd.MM.yyyy HH:mm",{locale:Cu})}),p.jsx(an,{children:dp(b)}),p.jsx(an,{children:p.jsx("span",{className:`inline-flex items-center px-2 py-0.5 text-xs font-medium rounded ${eC[b.status]}`,children:hs[b.status]})}),p.jsx(an,{className:"text-right",children:p.jsxs("div",{className:"flex justify-end gap-2",children:[p.jsx(be,{variant:"ghost",size:"icon",asChild:!0,title:"Eventseite öffnen",children:p.jsx("a",{href:`/events/${b.slug}`,target:"_blank",rel:"noopener noreferrer",children:p.jsx(Gp,{className:"h-4 w-4"})})}),p.jsx(be,{variant:"ghost",size:"icon",onClick:()=>Sl(b),title:"Bearbeiten",children:p.jsx(Up,{className:"h-4 w-4"})}),p.jsx(be,{variant:"ghost",size:"icon",onClick:()=>cp(b),title:"Duplizieren",children:p.jsx(nm,{className:"h-4 w-4"})}),p.jsx(be,{variant:"ghost",size:"icon",onClick:()=>lp(b.id),children:p.jsx(_l,{className:"h-4 w-4"})})]})})]},b.id))})]})}),!B&&Zt>1&&p.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3 pt-2",children:[p.jsxs("div",{className:"text-xs text-muted-foreground",children:["Seite ",On," von ",Zt]}),p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx(be,{variant:"outline",size:"sm",onClick:()=>er(1),disabled:On===1,children:"Erste"}),p.jsx(be,{variant:"outline",size:"sm",onClick:()=>er(b=>Math.max(1,b-1)),disabled:On===1,children:"Zurück"}),p.jsx(be,{variant:"outline",size:"sm",onClick:()=>er(b=>Math.min(Zt,b+1)),disabled:On===Zt,children:"Weiter"}),p.jsx(be,{variant:"outline",size:"sm",onClick:()=>er(Zt),disabled:On===Zt,children:"Letzte"})]})]})]})]})}const hC=Object.freeze(Object.defineProperty({__proto__:null,EventManager:tC},Symbol.toStringTag,{value:"Module"}));
272export{Zp as A,ks as C,tC as E,$l as I,Wi as P,JS as R,Au as T,st as a,Ou as b,_o as c,on as d,Du as e,an as f,im as g,_l as h,Xp as i,ga as j,ya as k,gi as l,Zu as m,hC as n,Ui as s};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.