@iclips/ui 1.4.7 → 1.4.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/ui/combobox.d.ts.map +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +341 -322
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"combobox.d.ts","sourceRoot":"","sources":["../../../src/components/ui/combobox.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAO/B,MAAM,WAAW,cAAc;IAC7B,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,MAAM,WAAW,aAAa;IAC5B;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IAEd;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf;;OAEG;IACH,OAAO,EAAE,cAAc,EAAE,CAAC;CAC3B;AAED,MAAM,WAAW,aAAa;IAC5B;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf;;OAEG;IACH,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAExC;;;OAGG;IACH,OAAO,CAAC,EAAE,cAAc,EAAE,CAAC;IAE3B;;;OAGG;IACH,MAAM,CAAC,EAAE,aAAa,EAAE,CAAC;IAEzB;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB;;OAEG;IACH,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAE3B;;OAEG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IAEtB;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB;;OAEG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAElB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB;;OAEG;IACH,YAAY,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAE/B;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB;;OAEG;IACH,KAAK,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,KAAK,CAAC;IAEnC;;OAEG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IAEpB;;OAEG;IACH,QAAQ,CAAC,EAAE,CAAC,MAAM,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,KAAK,OAAO,CAAC;CACpE;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,wBAAgB,QAAQ,CAAC,EACvB,KAAK,EACL,aAAa,EACb,OAAO,EACP,MAAM,EACN,WAA6B,EAC7B,iBAA+B,EAC/B,YAA4C,EAC5C,QAAgB,EAChB,OAAe,EACf,SAAS,EACT,YAAY,EACZ,SAAmB,EACnB,KAAe,EACf,SAAiB,EACjB,QAAQ,GACT,EAAE,aAAa,
|
|
1
|
+
{"version":3,"file":"combobox.d.ts","sourceRoot":"","sources":["../../../src/components/ui/combobox.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAO/B,MAAM,WAAW,cAAc;IAC7B,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,MAAM,WAAW,aAAa;IAC5B;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IAEd;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf;;OAEG;IACH,OAAO,EAAE,cAAc,EAAE,CAAC;CAC3B;AAED,MAAM,WAAW,aAAa;IAC5B;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf;;OAEG;IACH,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAExC;;;OAGG;IACH,OAAO,CAAC,EAAE,cAAc,EAAE,CAAC;IAE3B;;;OAGG;IACH,MAAM,CAAC,EAAE,aAAa,EAAE,CAAC;IAEzB;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB;;OAEG;IACH,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAE3B;;OAEG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IAEtB;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB;;OAEG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAElB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB;;OAEG;IACH,YAAY,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAE/B;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB;;OAEG;IACH,KAAK,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,KAAK,CAAC;IAEnC;;OAEG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IAEpB;;OAEG;IACH,QAAQ,CAAC,EAAE,CAAC,MAAM,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,KAAK,OAAO,CAAC;CACpE;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,wBAAgB,QAAQ,CAAC,EACvB,KAAK,EACL,aAAa,EACb,OAAO,EACP,MAAM,EACN,WAA6B,EAC7B,iBAA+B,EAC/B,YAA4C,EAC5C,QAAgB,EAChB,OAAe,EACf,SAAS,EACT,YAAY,EACZ,SAAmB,EACnB,KAAe,EACf,SAAiB,EACjB,QAAQ,GACT,EAAE,aAAa,qBAkOf"}
|
package/dist/index.cjs
CHANGED
|
@@ -4,7 +4,7 @@ ${n.map(([a,s])=>{var f;const o=((f=s.theme)==null?void 0:f[r])||s.color;return
|
|
|
4
4
|
`)}
|
|
5
5
|
}
|
|
6
6
|
`).join(`
|
|
7
|
-
`)}}):null},cC=vd.Tooltip;function dC({active:t,payload:e=[],className:n,indicator:r="dot",hideLabel:i=!1,hideIndicator:a=!1,label:s,labelFormatter:o,labelClassName:f,formatter:c,color:d,nameKey:u,labelKey:h}){const{config:p}=$1(),m=k.useMemo(()=>{var x;if(i||!(e!=null&&e.length))return null;const[b]=e,w=`${h||(b==null?void 0:b.dataKey)||(b==null?void 0:b.name)||"value"}`,v=xc(p,b,w),C=!h&&typeof s=="string"?((x=p[s])==null?void 0:x.label)||s:v==null?void 0:v.label;return o?l.jsx("div",{className:y("font-medium",f),children:o(C,e)}):C?l.jsx("div",{className:y("font-medium",f),children:C}):null},[s,o,e,i,f,p,h]);if(!t||!(e!=null&&e.length))return null;const g=e.length===1&&r!=="dot";return l.jsxs("div",{className:y("border-border/50 bg-background grid min-w-[8rem] items-start gap-1.5 rounded-lg border px-2.5 py-1.5 text-xs shadow-xl",n),children:[g?null:m,l.jsx("div",{className:"grid gap-1.5",children:e.map((b,w)=>{const v=`${u||b.name||b.dataKey||"value"}`,C=xc(p,b,v),x=d||b.payload.fill||b.color;return l.jsx("div",{className:y("[&>svg]:text-muted-foreground flex w-full flex-wrap items-stretch gap-2 [&>svg]:h-2.5 [&>svg]:w-2.5",r==="dot"&&"items-center"),children:c&&(b==null?void 0:b.value)!==void 0&&b.name?c(b.value,b.name,b,w,b.payload):l.jsxs(l.Fragment,{children:[C!=null&&C.icon?l.jsx(C.icon,{}):!a&&l.jsx("div",{className:y("shrink-0 rounded-[2px] border-(--color-border) bg-(--color-bg)",{"h-2.5 w-2.5":r==="dot","w-1":r==="line","w-0 border-[1.5px] border-dashed bg-transparent":r==="dashed","my-0.5":g&&r==="dashed"}),style:{"--color-bg":x,"--color-border":x}}),l.jsxs("div",{className:y("flex flex-1 justify-between leading-none",g?"items-end":"items-center"),children:[l.jsxs("div",{className:"grid gap-1.5",children:[g?m:null,l.jsx("span",{className:"text-muted-foreground",children:(C==null?void 0:C.label)||b.name})]}),b.value&&l.jsx("span",{className:"text-foreground font-mono font-medium tabular-nums",children:b.value.toLocaleString()})]})]})},b.dataKey)})})]})}const uC=vd.Legend;function hC({className:t,hideIcon:e=!1,payload:n,verticalAlign:r="bottom",nameKey:i}){const{config:a}=$1();return n!=null&&n.length?l.jsx("div",{className:y("flex items-center justify-center gap-4",r==="top"?"pb-3":"pt-3",t),children:n.map(s=>{const o=`${i||s.dataKey||"value"}`,f=xc(a,s,o);return l.jsxs("div",{className:y("[&>svg]:text-muted-foreground flex items-center gap-1.5 [&>svg]:h-3 [&>svg]:w-3"),children:[f!=null&&f.icon&&!e?l.jsx(f.icon,{}):l.jsx("div",{className:"h-2 w-2 shrink-0 rounded-[2px]",style:{backgroundColor:s.color}}),f==null?void 0:f.label]},s.value)})}):null}function xc(t,e,n){if(typeof e!="object"||e===null)return;const r="payload"in e&&typeof e.payload=="object"&&e.payload!==null?e.payload:void 0;let i=n;return n in e&&typeof e[n]=="string"?i=e[n]:r&&n in r&&typeof r[n]=="string"&&(i=r[n]),i in t?t[i]:t[n]}function em({...t}){return l.jsx(Cd.Root,{"data-slot":"collapsible",...t})}function tm({...t}){return l.jsx(Cd.CollapsibleTrigger,{"data-slot":"collapsible-trigger",...t})}function nm({...t}){return l.jsx(Cd.CollapsibleContent,{"data-slot":"collapsible-content",...t})}function pC({value:t="#7F26BF",onChange:e,label:n,className:r,disabled:i=!1}){const[a,s]=M.useState(t),[o,f]=M.useState(!1);k.useEffect(()=>{s(t)},[t]);const c=u=>{s(u),e==null||e(u)},d=u=>{let h=u.target.value;h=h.replace("#",""),h=h.replace(/[^0-9A-Fa-f]/g,""),h.length>6&&(h=h.slice(0,6));const p="#"+h;s(p),h.length===6&&(e==null||e(p))};return l.jsxs("div",{className:y("space-y-2",r),children:[n&&l.jsx(Ue,{children:n}),l.jsxs("div",{className:"flex gap-2",children:[l.jsxs(Ye,{open:o,onOpenChange:f,children:[l.jsx(Pe,{asChild:!0,children:l.jsx(B,{type:"button",variant:"outline",className:"w-12 h-10 p-0 border-2",style:{backgroundColor:a},disabled:i,"aria-label":"Selecionar cor",children:l.jsx("span",{className:"sr-only",children:"Selecionar cor"})})}),l.jsx(Be,{className:"w-64 p-3",align:"start",children:l.jsxs("div",{className:"space-y-3",children:[l.jsx(o4.HexColorPicker,{color:a,onChange:c,style:{width:"100%"}}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(Ue,{className:"text-xs",children:"Código Hexadecimal"}),l.jsxs("div",{className:"flex gap-2",children:[l.jsxs("div",{className:"relative flex-1",children:[l.jsx("span",{className:"absolute left-3 top-1/2 -translate-y-1/2 text-sm text-muted-foreground",children:"#"}),l.jsx($e,{value:a.replace("#","").toUpperCase(),onChange:d,className:"pl-7 font-mono text-sm",placeholder:"7F26BF",maxLength:6})]}),l.jsx("div",{className:"w-10 h-10 rounded border-2",style:{backgroundColor:a}})]})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(Ue,{className:"text-xs",children:"Cores Rápidas"}),l.jsx("div",{className:"grid grid-cols-8 gap-1",children:["#7F26BF","#5B158C","#420F66","#0086E6","#0053A6","#003066","#24B347","#007F2A","#004D19","#FAB325","#E6960B","#CC7C04","#F26924","#E64D0B","#BF3000","#F22435","#CC0A1A","#99000D","#000000","#697280","#C5CDD9","#FFFFFF"].map(u=>l.jsx("button",{type:"button",className:y("w-6 h-6 rounded border transition-all hover:scale-110",a.toLowerCase()===u.toLowerCase()?"border-2 border-primary ring-2 ring-primary/20":"border-border"),style:{backgroundColor:u},onClick:()=>c(u),title:u},u))})]})]})})]}),l.jsxs("div",{className:"relative flex-1",children:[l.jsx("span",{className:"absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground",children:"#"}),l.jsx($e,{value:a.replace("#","").toUpperCase(),onChange:d,className:"pl-8 font-mono",placeholder:"7F26BF",disabled:i,maxLength:6})]})]})]})}function mC({value:t,onValueChange:e,options:n,groups:r,placeholder:i="Selecionar...",searchPlaceholder:a="Buscar...",emptyMessage:s="Nenhum resultado encontrado",disabled:o=!1,loading:f=!1,className:c,popoverWidth:d,maxHeight:u="300px",align:h="start",clearable:p=!1,filterFn:m}){var W;const[g,b]=k.useState(!1),[w,v]=k.useState(""),C=k.useRef(null),L=m||((T,H)=>{const R=H.toLowerCase();return T.label.toLowerCase().includes(R)||T.value.toLowerCase().includes(R)}),j=k.useMemo(()=>n?w?n.filter(T=>L(T,w)):n:[],[n,w,L]),N=k.useMemo(()=>{if(!r)return;if(!w)return r;const T=w.toLowerCase();return r.map(H=>H.label.toLowerCase().includes(T)?H:{...H,options:H.options.filter(R=>L(R,w))}).filter(H=>H.options.length>0||H.label.toLowerCase().includes(T))},[r,w,L]),A=k.useMemo(()=>r?r.flatMap(T=>[...T.value?[{value:T.value,label:T.label}]:[],...T.options]):n??[],[n,r]).find(T=>T.value===t),E=r?((N==null?void 0:N.length)??0)>0:j.length>0,P=T=>{b(T),T||v("")},V=T=>{t===T&&p?e==null||e(""):e==null||e(T),b(!1)};return l.jsxs(Ye,{open:g,onOpenChange:P,children:[l.jsx(Pe,{asChild:!0,children:l.jsxs(B,{ref:C,variant:"outline",role:"combobox","aria-expanded":g,className:y("w-full justify-between font-normal",!t&&"text-muted-foreground",c),disabled:o||f,children:[l.jsx("span",{className:"truncate",children:f?"Carregando...":A?A.label:i}),l.jsx(S.ChevronsUpDown,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),l.jsx(Be,{className:"overflow-hidden p-0",style:{width:d||((W=C.current)==null?void 0:W.offsetWidth)||"auto"},align:h,children:l.jsxs("div",{className:"flex flex-col overflow-hidden",children:[l.jsxs("div",{className:"flex items-center border-b px-3",children:[l.jsx(S.Search,{className:"mr-2 h-4 w-4 shrink-0 opacity-50"}),l.jsx($e,{placeholder:a,value:w,onChange:T=>v(T.target.value),className:"h-11 border-0 focus-visible:ring-0 focus-visible:ring-offset-0",autoFocus:!0})]}),l.jsx("div",{className:"overflow-y-auto overflow-x-hidden overscroll-contain [&::-webkit-scrollbar]:w-2.5 [&::-webkit-scrollbar-track]:bg-transparent [&::-webkit-scrollbar-thumb]:rounded-full [&::-webkit-scrollbar-thumb]:bg-primary/30 [&::-webkit-scrollbar-thumb:hover]:bg-primary/50",style:{maxHeight:u},onWheel:T=>T.stopPropagation(),onTouchMove:T=>T.stopPropagation(),children:l.jsx("div",{className:"p-1",children:E?r?N==null?void 0:N.map(T=>l.jsxs("div",{children:[T.value?l.jsxs(B,{variant:"ghost",className:y("w-full justify-start font-semibold uppercase",t===T.value&&"bg-accent"),onClick:()=>V(T.value),children:[l.jsx(S.Check,{className:y("mr-2 h-4 w-4",t===T.value?"opacity-100":"opacity-0")}),l.jsx("span",{className:"truncate",children:T.label})]}):l.jsx("div",{className:"px-2 py-1.5 text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:T.label}),T.options.map(H=>l.jsxs(B,{variant:"ghost",className:y("w-full justify-start pl-8 font-normal",t===H.value&&"bg-accent"),onClick:()=>V(H.value),disabled:H.disabled,children:[l.jsx(S.Check,{className:y("mr-2 h-4 w-4",t===H.value?"opacity-100":"opacity-0")}),l.jsx("span",{className:"truncate",children:H.label})]},H.value))]},T.value??T.label)):j.map(T=>l.jsxs(B,{variant:"ghost",className:y("w-full justify-start font-normal",t===T.value&&"bg-accent"),onClick:()=>V(T.value),disabled:T.disabled,children:[l.jsx(S.Check,{className:y("mr-2 h-4 w-4",t===T.value?"opacity-100":"opacity-0")}),l.jsx("span",{className:"truncate",children:T.label})]},T.value)):l.jsx("div",{className:"py-6 text-center text-sm text-muted-foreground",children:s})})})]})})]})}function ds({...t}){return l.jsx(ge.Root,{"data-slot":"dialog",...t})}function gC({...t}){return l.jsx(ge.Trigger,{"data-slot":"dialog-trigger",...t})}function bC({...t}){return l.jsx(ge.Portal,{"data-slot":"dialog-portal",...t})}function xC({...t}){return l.jsx(ge.Close,{"data-slot":"dialog-close",...t})}const rm=k.forwardRef(({className:t,...e},n)=>l.jsx(ge.Overlay,{ref:n,"data-slot":"dialog-overlay",className:y("data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50",t),...e}));rm.displayName=ge.Overlay.displayName;function us({className:t,children:e,...n}){return l.jsxs(bC,{"data-slot":"dialog-portal",children:[l.jsx(rm,{}),l.jsxs(ge.Content,{"data-slot":"dialog-content",className:y("bg-background 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 fixed top-[50%] left-[50%] z-50 flex flex-col w-full max-w-[calc(100%-2rem)] max-h-[calc(100svh-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border p-6 shadow-lg duration-200 sm:max-w-lg",t),...n,children:[e,l.jsxs(ge.Close,{className:"ring-offset-background focus:ring-ring data-[state=open]:bg-accent data-[state=open]:text-muted-foreground absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",children:[l.jsx(S.XIcon,{}),l.jsx("span",{className:"sr-only",children:"Close"})]})]})]})}function hs({className:t,...e}){return l.jsx("div",{"data-slot":"dialog-header",className:y("flex flex-col gap-2 text-center sm:text-left",t),...e})}function Al({className:t,...e}){return l.jsx("div",{"data-slot":"dialog-footer",className:y("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",t),...e})}function ps({className:t,...e}){return l.jsx(ge.Title,{"data-slot":"dialog-title",className:y("text-lg leading-[1.2] font-semibold",t),...e})}function ms({className:t,...e}){return l.jsx(ge.Description,{"data-slot":"dialog-description",className:y("text-muted-foreground text-sm leading-relaxed",t),...e})}function im({className:t,...e}){return l.jsx(Jr.Command,{"data-slot":"command",className:y("bg-popover text-popover-foreground flex h-full w-full flex-col overflow-hidden rounded-md",t),...e})}function wC({title:t="Command Palette",description:e="Search for a command to run...",children:n,...r}){return l.jsxs(ds,{...r,children:[l.jsxs(hs,{className:"sr-only",children:[l.jsx(ps,{children:t}),l.jsx(ms,{children:e})]}),l.jsx(us,{className:"overflow-hidden p-0",children:l.jsx(im,{className:"[&_[cmdk-group-heading]]:text-muted-foreground **:data-[slot=command-input-wrapper]:h-12 [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group]]:px-2 [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 [&_[cmdk-input-wrapper]_svg]:h-5 [&_[cmdk-input-wrapper]_svg]:w-5 [&_[cmdk-input]]:h-12 [&_[cmdk-item]]:px-2 [&_[cmdk-item]]:py-3 [&_[cmdk-item]_svg]:h-5 [&_[cmdk-item]_svg]:w-5",children:n})})]})}function yC({className:t,...e}){return l.jsxs("div",{"data-slot":"command-input-wrapper",className:"flex h-9 items-center gap-2 border-b px-3",children:[l.jsx(S.SearchIcon,{className:"size-4 shrink-0 opacity-50"}),l.jsx(Jr.Command.Input,{"data-slot":"command-input",className:y("placeholder:text-muted-foreground flex h-10 w-full rounded-md bg-transparent py-3 text-sm outline-hidden disabled:cursor-not-allowed disabled:opacity-50",t),...e})]})}function vC({className:t,...e}){return l.jsx(Jr.Command.List,{"data-slot":"command-list",className:y("max-h-[300px] scroll-py-1 overflow-x-hidden overflow-y-auto",t),...e})}function CC({...t}){return l.jsx(Jr.Command.Empty,{"data-slot":"command-empty",className:"py-6 text-center text-sm",...t})}function MC({className:t,...e}){return l.jsx(Jr.Command.Group,{"data-slot":"command-group",className:y("text-foreground [&_[cmdk-group-heading]]:text-muted-foreground overflow-hidden p-1 [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-semibold",t),...e})}function jC({className:t,...e}){return l.jsx(Jr.Command.Separator,{"data-slot":"command-separator",className:y("bg-border -mx-1 h-px",t),...e})}function LC({className:t,...e}){return l.jsx(Jr.Command.Item,{"data-slot":"command-item",className:y("data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",t),...e})}function NC({className:t,...e}){return l.jsx("span",{"data-slot":"command-shortcut",className:y("text-muted-foreground ml-auto text-xs tracking-widest",t),...e})}function Dt({delayDuration:t=0,...e}){return l.jsx(wi.Provider,{"data-slot":"tooltip-provider",delayDuration:t,...e})}function st({...t}){return l.jsx(Dt,{children:l.jsx(wi.Root,{"data-slot":"tooltip",...t})})}function ot({...t}){return l.jsx(wi.Trigger,{"data-slot":"tooltip-trigger",...t})}function lt({className:t,sideOffset:e=0,children:n,...r}){return l.jsx(wi.Portal,{children:l.jsxs(wi.Content,{"data-slot":"tooltip-content",sideOffset:e,className:y("bg-primary text-primary-foreground animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-fit origin-(--radix-tooltip-content-transform-origin) rounded-md px-3 py-1.5 text-xs text-balance",t),...r,children:[n,l.jsx(wi.Arrow,{className:"bg-primary fill-primary z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px]"})]})})}function Gn({className:t,orientation:e="horizontal",decorative:n=!0,...r}){return l.jsx(S4.Root,{"data-slot":"separator-root",decorative:n,orientation:e,className:y("bg-border shrink-0 data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-px",t),...r})}function Ge(t){this.content=t}Ge.prototype={constructor:Ge,find:function(t){for(var e=0;e<this.content.length;e+=2)if(this.content[e]===t)return e;return-1},get:function(t){var e=this.find(t);return e==-1?void 0:this.content[e+1]},update:function(t,e,n){var r=n&&n!=t?this.remove(n):this,i=r.find(t),a=r.content.slice();return i==-1?a.push(n||t,e):(a[i+1]=e,n&&(a[i]=n)),new Ge(a)},remove:function(t){var e=this.find(t);if(e==-1)return this;var n=this.content.slice();return n.splice(e,2),new Ge(n)},addToStart:function(t,e){return new Ge([t,e].concat(this.remove(t).content))},addToEnd:function(t,e){var n=this.remove(t).content.slice();return n.push(t,e),new Ge(n)},addBefore:function(t,e,n){var r=this.remove(e),i=r.content.slice(),a=r.find(t);return i.splice(a==-1?i.length:a,0,e,n),new Ge(i)},forEach:function(t){for(var e=0;e<this.content.length;e+=2)t(this.content[e],this.content[e+1])},prepend:function(t){return t=Ge.from(t),t.size?new Ge(t.content.concat(this.subtract(t).content)):this},append:function(t){return t=Ge.from(t),t.size?new Ge(this.subtract(t).content.concat(t.content)):this},subtract:function(t){var e=this;t=Ge.from(t);for(var n=0;n<t.content.length;n+=2)e=e.remove(t.content[n]);return e},toObject:function(){var t={};return this.forEach(function(e,n){t[e]=n}),t},get size(){return this.content.length>>1}};Ge.from=function(t){if(t instanceof Ge)return t;var e=[];if(t)for(var n in t)e.push(n,t[n]);return new Ge(e)};function am(t,e,n){for(let r=0;;r++){if(r==t.childCount||r==e.childCount)return t.childCount==e.childCount?null:n;let i=t.child(r),a=e.child(r);if(i==a){n+=i.nodeSize;continue}if(!i.sameMarkup(a))return n;if(i.isText&&i.text!=a.text){let s=i.text,o=a.text,f=0;for(;s[f]==o[f];f++)n++;return f&&f<s.length&&f<o.length&&lm(s.charCodeAt(f-1))&&om(s.charCodeAt(f))&&n--,n}if(i.content.size||a.content.size){let s=am(i.content,a.content,n+1);if(s!=null)return s}n+=i.nodeSize}}function sm(t,e,n,r){for(let i=t.childCount,a=e.childCount;;){if(i==0||a==0)return i==a?null:{a:n,b:r};let s=t.child(--i),o=e.child(--a),f=s.nodeSize;if(s==o){n-=f,r-=f;continue}if(!s.sameMarkup(o))return{a:n,b:r};if(s.isText&&s.text!=o.text){let c=s.text,d=o.text,u=c.length,h=d.length;for(;u>0&&h>0&&c[u-1]==d[h-1];)u--,h--,n--,r--;return u&&h&&u<c.length&&lm(c.charCodeAt(u-1))&&om(c.charCodeAt(u))&&(n++,r++),{a:n,b:r}}if(s.content.size||o.content.size){let c=sm(s.content,o.content,n-1,r-1);if(c)return c}n-=f,r-=f}}function om(t){return t>=56320&&t<57344}function lm(t){return t>=55296&&t<56320}class z{constructor(e,n){if(this.content=e,this.size=n||0,n==null)for(let r=0;r<e.length;r++)this.size+=e[r].nodeSize}nodesBetween(e,n,r,i=0,a){for(let s=0,o=0;o<n;s++){let f=this.content[s],c=o+f.nodeSize;if(c>e&&r(f,i+o,a||null,s)!==!1&&f.content.size){let d=o+1;f.nodesBetween(Math.max(0,e-d),Math.min(f.content.size,n-d),r,i+d)}o=c}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,n,r,i){let a="",s=!0;return this.nodesBetween(e,n,(o,f)=>{let c=o.isText?o.text.slice(Math.max(e,f)-f,n-f):o.isLeaf?i?typeof i=="function"?i(o):i:o.type.spec.leafText?o.type.spec.leafText(o):"":"";o.isBlock&&(o.isLeaf&&c||o.isTextblock)&&r&&(s?s=!1:a+=r),a+=c},0),a}append(e){if(!e.size)return this;if(!this.size)return e;let n=this.lastChild,r=e.firstChild,i=this.content.slice(),a=0;for(n.isText&&n.sameMarkup(r)&&(i[i.length-1]=n.withText(n.text+r.text),a=1);a<e.content.length;a++)i.push(e.content[a]);return new z(i,this.size+e.size)}cut(e,n=this.size){if(e==0&&n==this.size)return this;let r=[],i=0;if(n>e)for(let a=0,s=0;s<n;a++){let o=this.content[a],f=s+o.nodeSize;f>e&&((s<e||f>n)&&(o.isText?o=o.cut(Math.max(0,e-s),Math.min(o.text.length,n-s)):o=o.cut(Math.max(0,e-s-1),Math.min(o.content.size,n-s-1))),r.push(o),i+=o.nodeSize),s=f}return new z(r,i)}cutByIndex(e,n){return e==n?z.empty:e==0&&n==this.content.length?this:new z(this.content.slice(e,n))}replaceChild(e,n){let r=this.content[e];if(r==n)return this;let i=this.content.slice(),a=this.size+n.nodeSize-r.nodeSize;return i[e]=n,new z(i,a)}addToStart(e){return new z([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new z(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let n=0;n<this.content.length;n++)if(!this.content[n].eq(e.content[n]))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 n=this.content[e];if(!n)throw new RangeError("Index "+e+" out of range for "+this);return n}maybeChild(e){return this.content[e]||null}forEach(e){for(let n=0,r=0;n<this.content.length;n++){let i=this.content[n];e(i,r,n),r+=i.nodeSize}}findDiffStart(e,n=0){return am(this,e,n)}findDiffEnd(e,n=this.size,r=e.size){return sm(this,e,n,r)}findIndex(e){if(e==0)return Vs(0,e);if(e==this.size)return Vs(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let n=0,r=0;;n++){let i=this.child(n),a=r+i.nodeSize;if(a>=e)return a==e?Vs(n+1,a):Vs(n,r);r=a}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,n){if(!n)return z.empty;if(!Array.isArray(n))throw new RangeError("Invalid input for Fragment.fromJSON");return z.fromArray(n.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return z.empty;let n,r=0;for(let i=0;i<e.length;i++){let a=e[i];r+=a.nodeSize,i&&a.isText&&e[i-1].sameMarkup(a)?(n||(n=e.slice(0,i)),n[n.length-1]=a.withText(n[n.length-1].text+a.text)):n&&n.push(a)}return new z(n||e,r)}static from(e){if(!e)return z.empty;if(e instanceof z)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new z([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}z.empty=new z([],0);const Lf={index:0,offset:0};function Vs(t,e){return Lf.index=t,Lf.offset=e,Lf}function No(t,e){if(t===e)return!0;if(!(t&&typeof t=="object")||!(e&&typeof e=="object"))return!1;let n=Array.isArray(t);if(Array.isArray(e)!=n)return!1;if(n){if(t.length!=e.length)return!1;for(let r=0;r<t.length;r++)if(!No(t[r],e[r]))return!1}else{for(let r in t)if(!(r in e)||!No(t[r],e[r]))return!1;for(let r in e)if(!(r in t))return!1}return!0}let Ce=class wc{constructor(e,n){this.type=e,this.attrs=n}addToSet(e){let n,r=!1;for(let i=0;i<e.length;i++){let a=e[i];if(this.eq(a))return e;if(this.type.excludes(a.type))n||(n=e.slice(0,i));else{if(a.type.excludes(this.type))return e;!r&&a.type.rank>this.type.rank&&(n||(n=e.slice(0,i)),n.push(this),r=!0),n&&n.push(a)}}return n||(n=e.slice()),r||n.push(this),n}removeFromSet(e){for(let n=0;n<e.length;n++)if(this.eq(e[n]))return e.slice(0,n).concat(e.slice(n+1));return e}isInSet(e){for(let n=0;n<e.length;n++)if(this.eq(e[n]))return!0;return!1}eq(e){return this==e||this.type==e.type&&No(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let n in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,n){if(!n)throw new RangeError("Invalid input for Mark.fromJSON");let r=e.marks[n.type];if(!r)throw new RangeError(`There is no mark type ${n.type} in this schema`);let i=r.create(n.attrs);return r.checkAttrs(i.attrs),i}static sameSet(e,n){if(e==n)return!0;if(e.length!=n.length)return!1;for(let r=0;r<e.length;r++)if(!e[r].eq(n[r]))return!1;return!0}static setFrom(e){if(!e||Array.isArray(e)&&e.length==0)return wc.none;if(e instanceof wc)return[e];let n=e.slice();return n.sort((r,i)=>r.type.rank-i.type.rank),n}};Ce.none=[];class Pa extends Error{}class K{constructor(e,n,r){this.content=e,this.openStart=n,this.openEnd=r}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,n){let r=cm(this.content,e+this.openStart,n,this.openStart+1,this.openEnd+1);return r&&new K(r,this.openStart,this.openEnd)}removeBetween(e,n){return new K(fm(this.content,e+this.openStart,n+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,n){if(!n)return K.empty;let r=n.openStart||0,i=n.openEnd||0;if(typeof r!="number"||typeof i!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new K(z.fromJSON(e,n.content),r,i)}static maxOpen(e,n=!0){let r=0,i=0;for(let a=e.firstChild;a&&!a.isLeaf&&(n||!a.type.spec.isolating);a=a.firstChild)r++;for(let a=e.lastChild;a&&!a.isLeaf&&(n||!a.type.spec.isolating);a=a.lastChild)i++;return new K(e,r,i)}}K.empty=new K(z.empty,0,0);function fm(t,e,n){let{index:r,offset:i}=t.findIndex(e),a=t.maybeChild(r),{index:s,offset:o}=t.findIndex(n);if(i==e||a.isText){if(o!=n&&!t.child(s).isText)throw new RangeError("Removing non-flat range");return t.cut(0,e).append(t.cut(n))}if(r!=s)throw new RangeError("Removing non-flat range");return t.replaceChild(r,a.copy(fm(a.content,e-i-1,n-i-1)))}function cm(t,e,n,r,i,a){let{index:s,offset:o}=t.findIndex(e),f=t.maybeChild(s);if(o==e||f.isText)return a&&r<=0&&i<=0&&!a.canReplace(s,s,n)?null:t.cut(0,e).append(n).append(t.cut(e));let c=cm(f.content,e-o-1,n,s==0?r-1:0,s==t.childCount-1?i-1:0,f);return c&&t.replaceChild(s,f.copy(c))}function SC(t,e,n){if(n.openStart>t.depth)throw new Pa("Inserted content deeper than insertion position");if(t.depth-n.openStart!=e.depth-n.openEnd)throw new Pa("Inconsistent open depths");return dm(t,e,n,0)}function dm(t,e,n,r){let i=t.index(r),a=t.node(r);if(i==e.index(r)&&r<t.depth-n.openStart){let s=dm(t,e,n,r+1);return a.copy(a.content.replaceChild(i,s))}else if(n.content.size)if(!n.openStart&&!n.openEnd&&t.depth==r&&e.depth==r){let s=t.parent,o=s.content;return Dr(s,o.cut(0,t.parentOffset).append(n.content).append(o.cut(e.parentOffset)))}else{let{start:s,end:o}=kC(n,t);return Dr(a,hm(t,s,o,e,r))}else return Dr(a,So(t,e,r))}function um(t,e){if(!e.type.compatibleContent(t.type))throw new Pa("Cannot join "+e.type.name+" onto "+t.type.name)}function yc(t,e,n){let r=t.node(n);return um(r,e.node(n)),r}function Tr(t,e){let n=e.length-1;n>=0&&t.isText&&t.sameMarkup(e[n])?e[n]=t.withText(e[n].text+t.text):e.push(t)}function ba(t,e,n,r){let i=(e||t).node(n),a=0,s=e?e.index(n):i.childCount;t&&(a=t.index(n),t.depth>n?a++:t.textOffset&&(Tr(t.nodeAfter,r),a++));for(let o=a;o<s;o++)Tr(i.child(o),r);e&&e.depth==n&&e.textOffset&&Tr(e.nodeBefore,r)}function Dr(t,e){if(!t.type.validContent(e))throw new Pa("Invalid content for node "+t.type.name);return t.copy(e)}function hm(t,e,n,r,i){let a=t.depth>i&&yc(t,e,i+1),s=r.depth>i&&yc(n,r,i+1),o=[];return ba(null,t,i,o),a&&s&&e.index(i)==n.index(i)?(um(a,s),Tr(Dr(a,hm(t,e,n,r,i+1)),o)):(a&&Tr(Dr(a,So(t,e,i+1)),o),ba(e,n,i,o),s&&Tr(Dr(s,So(n,r,i+1)),o)),ba(r,null,i,o),new z(o)}function So(t,e,n){let r=[];if(ba(null,t,n,r),t.depth>n){let i=yc(t,e,n+1);Tr(Dr(i,So(t,e,n+1)),r)}return ba(e,null,n,r),new z(r)}function kC(t,e){let n=e.depth-t.openStart,i=e.node(n).copy(t.content);for(let a=n-1;a>=0;a--)i=e.node(a).copy(z.from(i));return{start:i.resolveNoCache(t.openStart+n),end:i.resolveNoCache(i.content.size-t.openEnd-n)}}class Ba{constructor(e,n,r){this.pos=e,this.path=n,this.parentOffset=r,this.depth=n.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,n=this.index(this.depth);if(n==e.childCount)return null;let r=this.pos-this.path[this.path.length-1],i=e.child(n);return r?e.child(n).cut(r):i}get nodeBefore(){let e=this.index(this.depth),n=this.pos-this.path[this.path.length-1];return n?this.parent.child(e).cut(0,n):e==0?null:this.parent.child(e-1)}posAtIndex(e,n){n=this.resolveDepth(n);let r=this.path[n*3],i=n==0?0:this.path[n*3-1]+1;for(let a=0;a<e;a++)i+=r.child(a).nodeSize;return i}marks(){let e=this.parent,n=this.index();if(e.content.size==0)return Ce.none;if(this.textOffset)return e.child(n).marks;let r=e.maybeChild(n-1),i=e.maybeChild(n);if(!r){let o=r;r=i,i=o}let a=r.marks;for(var s=0;s<a.length;s++)a[s].type.spec.inclusive===!1&&(!i||!a[s].isInSet(i.marks))&&(a=a[s--].removeFromSet(a));return a}marksAcross(e){let n=this.parent.maybeChild(this.index());if(!n||!n.isInline)return null;let r=n.marks,i=e.parent.maybeChild(e.index());for(var a=0;a<r.length;a++)r[a].type.spec.inclusive===!1&&(!i||!r[a].isInSet(i.marks))&&(r=r[a--].removeFromSet(r));return r}sharedDepth(e){for(let n=this.depth;n>0;n--)if(this.start(n)<=e&&this.end(n)>=e)return n;return 0}blockRange(e=this,n){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)&&(!n||n(this.node(r))))return new ko(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 n=1;n<=this.depth;n++)e+=(e?"/":"")+this.node(n).type.name+"_"+this.index(n-1);return e+":"+this.parentOffset}static resolve(e,n){if(!(n>=0&&n<=e.content.size))throw new RangeError("Position "+n+" out of range");let r=[],i=0,a=n;for(let s=e;;){let{index:o,offset:f}=s.content.findIndex(a),c=a-f;if(r.push(s,o,i+f),!c||(s=s.child(o),s.isText))break;a=c-1,i+=f+1}return new Ba(n,r,a)}static resolveCached(e,n){let r=Sh.get(e);if(r)for(let a=0;a<r.elts.length;a++){let s=r.elts[a];if(s.pos==n)return s}else Sh.set(e,r=new IC);let i=r.elts[r.i]=Ba.resolve(e,n);return r.i=(r.i+1)%AC,i}}class IC{constructor(){this.elts=[],this.i=0}}const AC=12,Sh=new WeakMap;class ko{constructor(e,n,r){this.$from=e,this.$to=n,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 EC=Object.create(null);let kn=class vc{constructor(e,n,r,i=Ce.none){this.type=e,this.attrs=n,this.marks=i,this.content=r||z.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,n,r,i=0){this.content.nodesBetween(e,n,r,i,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,n,r,i){return this.content.textBetween(e,n,r,i)}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,n,r){return this.type==e&&No(this.attrs,n||e.defaultAttrs||EC)&&Ce.sameSet(this.marks,r||Ce.none)}copy(e=null){return e==this.content?this:new vc(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new vc(this.type,this.attrs,this.content,e)}cut(e,n=this.content.size){return e==0&&n==this.content.size?this:this.copy(this.content.cut(e,n))}slice(e,n=this.content.size,r=!1){if(e==n)return K.empty;let i=this.resolve(e),a=this.resolve(n),s=r?0:i.sharedDepth(n),o=i.start(s),c=i.node(s).content.cut(i.pos-o,a.pos-o);return new K(c,i.depth-s,a.depth-s)}replace(e,n,r){return SC(this.resolve(e),this.resolve(n),r)}nodeAt(e){for(let n=this;;){let{index:r,offset:i}=n.content.findIndex(e);if(n=n.maybeChild(r),!n)return null;if(i==e||n.isText)return n;e-=i+1}}childAfter(e){let{index:n,offset:r}=this.content.findIndex(e);return{node:this.content.maybeChild(n),index:n,offset:r}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:n,offset:r}=this.content.findIndex(e);if(r<e)return{node:this.content.child(n),index:n,offset:r};let i=this.content.child(n-1);return{node:i,index:n-1,offset:r-i.nodeSize}}resolve(e){return Ba.resolveCached(this,e)}resolveNoCache(e){return Ba.resolve(this,e)}rangeHasMark(e,n,r){let i=!1;return n>e&&this.nodesBetween(e,n,a=>(r.isInSet(a.marks)&&(i=!0),!i)),i}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()+")"),pm(this.marks,e)}contentMatchAt(e){let n=this.type.contentMatch.matchFragment(this.content,0,e);if(!n)throw new Error("Called contentMatchAt on a node with invalid content");return n}canReplace(e,n,r=z.empty,i=0,a=r.childCount){let s=this.contentMatchAt(e).matchFragment(r,i,a),o=s&&s.matchFragment(this.content,n);if(!o||!o.validEnd)return!1;for(let f=i;f<a;f++)if(!this.type.allowsMarks(r.child(f).marks))return!1;return!0}canReplaceWith(e,n,r,i){if(i&&!this.type.allowsMarks(i))return!1;let a=this.contentMatchAt(e).matchType(r),s=a&&a.matchFragment(this.content,n);return s?s.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=Ce.none;for(let n=0;n<this.marks.length;n++){let r=this.marks[n];r.type.checkAttrs(r.attrs),e=r.addToSet(e)}if(!Ce.sameSet(e,this.marks))throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(n=>n.type.name)}`);this.content.forEach(n=>n.check())}toJSON(){let e={type:this.type.name};for(let n 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(n=>n.toJSON())),e}static fromJSON(e,n){if(!n)throw new RangeError("Invalid input for Node.fromJSON");let r;if(n.marks){if(!Array.isArray(n.marks))throw new RangeError("Invalid mark data for Node.fromJSON");r=n.marks.map(e.markFromJSON)}if(n.type=="text"){if(typeof n.text!="string")throw new RangeError("Invalid text node in JSON");return e.text(n.text,r)}let i=z.fromJSON(e,n.content),a=e.nodeType(n.type).create(n.attrs,i,r);return a.type.checkAttrs(a.attrs),a}};kn.prototype.text=void 0;class Io extends kn{constructor(e,n,r,i){if(super(e,n,null,i),!r)throw new RangeError("Empty text nodes are not allowed");this.text=r}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):pm(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,n){return this.text.slice(e,n)}get nodeSize(){return this.text.length}mark(e){return e==this.marks?this:new Io(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new Io(this.type,this.attrs,e,this.marks)}cut(e=0,n=this.text.length){return e==0&&n==this.text.length?this:this.withText(this.text.slice(e,n))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}}function pm(t,e){for(let n=t.length-1;n>=0;n--)e=t[n].type.name+"("+e+")";return e}class Fr{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,n){let r=new TC(e,n);if(r.next==null)return Fr.empty;let i=mm(r);r.next&&r.err("Unexpected trailing text");let a=FC(BC(i));return VC(a,r),a}matchType(e){for(let n=0;n<this.next.length;n++)if(this.next[n].type==e)return this.next[n].next;return null}matchFragment(e,n=0,r=e.childCount){let i=this;for(let a=n;i&&a<r;a++)i=i.matchType(e.child(a).type);return i}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:n}=this.next[e];if(!(n.isText||n.hasRequiredAttrs()))return n}return null}compatible(e){for(let n=0;n<this.next.length;n++)for(let r=0;r<e.next.length;r++)if(this.next[n].type==e.next[r].type)return!0;return!1}fillBefore(e,n=!1,r=0){let i=[this];function a(s,o){let f=s.matchFragment(e,r);if(f&&(!n||f.validEnd))return z.from(o.map(c=>c.createAndFill()));for(let c=0;c<s.next.length;c++){let{type:d,next:u}=s.next[c];if(!(d.isText||d.hasRequiredAttrs())&&i.indexOf(u)==-1){i.push(u);let h=a(u,o.concat(d));if(h)return h}}return null}return a(this,[])}findWrapping(e){for(let r=0;r<this.wrapCache.length;r+=2)if(this.wrapCache[r]==e)return this.wrapCache[r+1];let n=this.computeWrapping(e);return this.wrapCache.push(e,n),n}computeWrapping(e){let n=Object.create(null),r=[{match:this,type:null,via:null}];for(;r.length;){let i=r.shift(),a=i.match;if(a.matchType(e)){let s=[];for(let o=i;o.type;o=o.via)s.push(o.type);return s.reverse()}for(let s=0;s<a.next.length;s++){let{type:o,next:f}=a.next[s];!o.isLeaf&&!o.hasRequiredAttrs()&&!(o.name in n)&&(!i.type||f.validEnd)&&(r.push({match:o.contentMatch,type:o,via:i}),n[o.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 n(r){e.push(r);for(let i=0;i<r.next.length;i++)e.indexOf(r.next[i].next)==-1&&n(r.next[i].next)}return n(this),e.map((r,i)=>{let a=i+(r.validEnd?"*":" ")+" ";for(let s=0;s<r.next.length;s++)a+=(s?", ":"")+r.next[s].type.name+"->"+e.indexOf(r.next[s].next);return a}).join(`
|
|
7
|
+
`)}}):null},cC=vd.Tooltip;function dC({active:t,payload:e=[],className:n,indicator:r="dot",hideLabel:i=!1,hideIndicator:a=!1,label:s,labelFormatter:o,labelClassName:f,formatter:c,color:d,nameKey:u,labelKey:h}){const{config:p}=$1(),m=k.useMemo(()=>{var x;if(i||!(e!=null&&e.length))return null;const[b]=e,w=`${h||(b==null?void 0:b.dataKey)||(b==null?void 0:b.name)||"value"}`,v=xc(p,b,w),C=!h&&typeof s=="string"?((x=p[s])==null?void 0:x.label)||s:v==null?void 0:v.label;return o?l.jsx("div",{className:y("font-medium",f),children:o(C,e)}):C?l.jsx("div",{className:y("font-medium",f),children:C}):null},[s,o,e,i,f,p,h]);if(!t||!(e!=null&&e.length))return null;const g=e.length===1&&r!=="dot";return l.jsxs("div",{className:y("border-border/50 bg-background grid min-w-[8rem] items-start gap-1.5 rounded-lg border px-2.5 py-1.5 text-xs shadow-xl",n),children:[g?null:m,l.jsx("div",{className:"grid gap-1.5",children:e.map((b,w)=>{const v=`${u||b.name||b.dataKey||"value"}`,C=xc(p,b,v),x=d||b.payload.fill||b.color;return l.jsx("div",{className:y("[&>svg]:text-muted-foreground flex w-full flex-wrap items-stretch gap-2 [&>svg]:h-2.5 [&>svg]:w-2.5",r==="dot"&&"items-center"),children:c&&(b==null?void 0:b.value)!==void 0&&b.name?c(b.value,b.name,b,w,b.payload):l.jsxs(l.Fragment,{children:[C!=null&&C.icon?l.jsx(C.icon,{}):!a&&l.jsx("div",{className:y("shrink-0 rounded-[2px] border-(--color-border) bg-(--color-bg)",{"h-2.5 w-2.5":r==="dot","w-1":r==="line","w-0 border-[1.5px] border-dashed bg-transparent":r==="dashed","my-0.5":g&&r==="dashed"}),style:{"--color-bg":x,"--color-border":x}}),l.jsxs("div",{className:y("flex flex-1 justify-between leading-none",g?"items-end":"items-center"),children:[l.jsxs("div",{className:"grid gap-1.5",children:[g?m:null,l.jsx("span",{className:"text-muted-foreground",children:(C==null?void 0:C.label)||b.name})]}),b.value&&l.jsx("span",{className:"text-foreground font-mono font-medium tabular-nums",children:b.value.toLocaleString()})]})]})},b.dataKey)})})]})}const uC=vd.Legend;function hC({className:t,hideIcon:e=!1,payload:n,verticalAlign:r="bottom",nameKey:i}){const{config:a}=$1();return n!=null&&n.length?l.jsx("div",{className:y("flex items-center justify-center gap-4",r==="top"?"pb-3":"pt-3",t),children:n.map(s=>{const o=`${i||s.dataKey||"value"}`,f=xc(a,s,o);return l.jsxs("div",{className:y("[&>svg]:text-muted-foreground flex items-center gap-1.5 [&>svg]:h-3 [&>svg]:w-3"),children:[f!=null&&f.icon&&!e?l.jsx(f.icon,{}):l.jsx("div",{className:"h-2 w-2 shrink-0 rounded-[2px]",style:{backgroundColor:s.color}}),f==null?void 0:f.label]},s.value)})}):null}function xc(t,e,n){if(typeof e!="object"||e===null)return;const r="payload"in e&&typeof e.payload=="object"&&e.payload!==null?e.payload:void 0;let i=n;return n in e&&typeof e[n]=="string"?i=e[n]:r&&n in r&&typeof r[n]=="string"&&(i=r[n]),i in t?t[i]:t[n]}function em({...t}){return l.jsx(Cd.Root,{"data-slot":"collapsible",...t})}function tm({...t}){return l.jsx(Cd.CollapsibleTrigger,{"data-slot":"collapsible-trigger",...t})}function nm({...t}){return l.jsx(Cd.CollapsibleContent,{"data-slot":"collapsible-content",...t})}function pC({value:t="#7F26BF",onChange:e,label:n,className:r,disabled:i=!1}){const[a,s]=M.useState(t),[o,f]=M.useState(!1);k.useEffect(()=>{s(t)},[t]);const c=u=>{s(u),e==null||e(u)},d=u=>{let h=u.target.value;h=h.replace("#",""),h=h.replace(/[^0-9A-Fa-f]/g,""),h.length>6&&(h=h.slice(0,6));const p="#"+h;s(p),h.length===6&&(e==null||e(p))};return l.jsxs("div",{className:y("space-y-2",r),children:[n&&l.jsx(Ue,{children:n}),l.jsxs("div",{className:"flex gap-2",children:[l.jsxs(Ye,{open:o,onOpenChange:f,children:[l.jsx(Pe,{asChild:!0,children:l.jsx(B,{type:"button",variant:"outline",className:"w-12 h-10 p-0 border-2",style:{backgroundColor:a},disabled:i,"aria-label":"Selecionar cor",children:l.jsx("span",{className:"sr-only",children:"Selecionar cor"})})}),l.jsx(Be,{className:"w-64 p-3",align:"start",children:l.jsxs("div",{className:"space-y-3",children:[l.jsx(o4.HexColorPicker,{color:a,onChange:c,style:{width:"100%"}}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(Ue,{className:"text-xs",children:"Código Hexadecimal"}),l.jsxs("div",{className:"flex gap-2",children:[l.jsxs("div",{className:"relative flex-1",children:[l.jsx("span",{className:"absolute left-3 top-1/2 -translate-y-1/2 text-sm text-muted-foreground",children:"#"}),l.jsx($e,{value:a.replace("#","").toUpperCase(),onChange:d,className:"pl-7 font-mono text-sm",placeholder:"7F26BF",maxLength:6})]}),l.jsx("div",{className:"w-10 h-10 rounded border-2",style:{backgroundColor:a}})]})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(Ue,{className:"text-xs",children:"Cores Rápidas"}),l.jsx("div",{className:"grid grid-cols-8 gap-1",children:["#7F26BF","#5B158C","#420F66","#0086E6","#0053A6","#003066","#24B347","#007F2A","#004D19","#FAB325","#E6960B","#CC7C04","#F26924","#E64D0B","#BF3000","#F22435","#CC0A1A","#99000D","#000000","#697280","#C5CDD9","#FFFFFF"].map(u=>l.jsx("button",{type:"button",className:y("w-6 h-6 rounded border transition-all hover:scale-110",a.toLowerCase()===u.toLowerCase()?"border-2 border-primary ring-2 ring-primary/20":"border-border"),style:{backgroundColor:u},onClick:()=>c(u),title:u},u))})]})]})})]}),l.jsxs("div",{className:"relative flex-1",children:[l.jsx("span",{className:"absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground",children:"#"}),l.jsx($e,{value:a.replace("#","").toUpperCase(),onChange:d,className:"pl-8 font-mono",placeholder:"7F26BF",disabled:i,maxLength:6})]})]})]})}function mC({value:t,onValueChange:e,options:n,groups:r,placeholder:i="Selecionar...",searchPlaceholder:a="Buscar...",emptyMessage:s="Nenhum resultado encontrado",disabled:o=!1,loading:f=!1,className:c,popoverWidth:d,maxHeight:u="300px",align:h="start",clearable:p=!1,filterFn:m}){var W;const[g,b]=k.useState(!1),[w,v]=k.useState(""),C=k.useRef(null),L=m||((T,H)=>{const R=H.toLowerCase();return T.label.toLowerCase().includes(R)||T.value.toLowerCase().includes(R)}),j=k.useMemo(()=>n?w?n.filter(T=>L(T,w)):n:[],[n,w,L]),N=k.useMemo(()=>{if(!r)return;if(!w)return r;const T=w.toLowerCase();return r.map(H=>H.label.toLowerCase().includes(T)?H:{...H,options:H.options.filter(R=>L(R,w))}).filter(H=>H.options.length>0||H.label.toLowerCase().includes(T))},[r,w,L]),A=k.useMemo(()=>r?r.flatMap(T=>[...T.value?[{value:T.value,label:T.label}]:[],...T.options]):n??[],[n,r]).find(T=>T.value===t),E=r?((N==null?void 0:N.length)??0)>0:j.length>0,P=T=>{b(T),T||v("")},V=T=>{t===T&&p?e==null||e(""):e==null||e(T),b(!1)};return l.jsxs(Ye,{open:g,onOpenChange:P,children:[l.jsx(Pe,{asChild:!0,children:l.jsxs(B,{ref:C,variant:"outline",role:"combobox","aria-expanded":g,className:y("w-full justify-between font-normal",!t&&"text-muted-foreground",c),disabled:o||f,children:[l.jsx("span",{className:"truncate",children:f?"Carregando...":A?A.label:i}),l.jsx(S.ChevronsUpDown,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),l.jsx(Be,{className:"overflow-hidden p-0",style:{width:d||((W=C.current)==null?void 0:W.offsetWidth)||"auto"},align:h,children:l.jsxs("div",{className:"flex flex-col overflow-hidden",children:[l.jsxs("div",{className:"flex items-center border-b px-3",children:[l.jsx(S.Search,{className:"mr-2 h-4 w-4 shrink-0 opacity-50"}),l.jsx($e,{placeholder:a,value:w,onChange:T=>v(T.target.value),className:"h-11 border-0 focus-visible:ring-0 focus-visible:ring-offset-0",autoFocus:!0})]}),l.jsx("div",{className:"overflow-y-auto overflow-x-hidden overscroll-contain [&::-webkit-scrollbar]:w-2.5 [&::-webkit-scrollbar-track]:bg-transparent [&::-webkit-scrollbar-thumb]:rounded-full [&::-webkit-scrollbar-thumb]:bg-primary/30 [&::-webkit-scrollbar-thumb:hover]:bg-primary/50",style:{maxHeight:u},onWheel:T=>T.stopPropagation(),onTouchMove:T=>T.stopPropagation(),children:l.jsx("div",{className:"p-1",children:E?r?N==null?void 0:N.map((T,H)=>l.jsxs("div",{className:y(H>0&&"mt-1.5 border-t border-border pt-1.5"),children:[T.value?l.jsxs("button",{type:"button",onClick:()=>V(T.value),className:y("flex w-full items-center justify-between gap-2 rounded-sm px-2 py-1.5 text-sm","font-semibold uppercase tracking-wide","transition-colors duration-100 hover:bg-accent hover:text-accent-foreground",t===T.value&&"bg-accent"),children:[l.jsx("span",{className:"truncate",children:T.label}),l.jsx(S.Check,{className:y("h-4 w-4 shrink-0",t===T.value?"opacity-100":"opacity-0")})]}):l.jsx("div",{className:"px-2 py-1.5 text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:T.label}),T.options.map(R=>l.jsxs("button",{type:"button",onClick:()=>V(R.value),disabled:R.disabled,className:y("flex w-full items-center justify-between gap-2 rounded-sm py-1.5 pl-6 pr-2 text-sm","transition-colors duration-100 hover:bg-accent hover:text-accent-foreground","disabled:pointer-events-none disabled:opacity-50",t===R.value&&"bg-accent"),children:[l.jsx("span",{className:"truncate",children:R.label}),l.jsx(S.Check,{className:y("h-4 w-4 shrink-0",t===R.value?"opacity-100":"opacity-0")})]},R.value))]},T.value??T.label)):j.map(T=>l.jsxs(B,{variant:"ghost",className:y("w-full justify-start font-normal",t===T.value&&"bg-accent"),onClick:()=>V(T.value),disabled:T.disabled,children:[l.jsx(S.Check,{className:y("mr-2 h-4 w-4",t===T.value?"opacity-100":"opacity-0")}),l.jsx("span",{className:"truncate",children:T.label})]},T.value)):l.jsx("div",{className:"py-6 text-center text-sm text-muted-foreground",children:s})})})]})})]})}function ds({...t}){return l.jsx(ge.Root,{"data-slot":"dialog",...t})}function gC({...t}){return l.jsx(ge.Trigger,{"data-slot":"dialog-trigger",...t})}function bC({...t}){return l.jsx(ge.Portal,{"data-slot":"dialog-portal",...t})}function xC({...t}){return l.jsx(ge.Close,{"data-slot":"dialog-close",...t})}const rm=k.forwardRef(({className:t,...e},n)=>l.jsx(ge.Overlay,{ref:n,"data-slot":"dialog-overlay",className:y("data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50",t),...e}));rm.displayName=ge.Overlay.displayName;function us({className:t,children:e,...n}){return l.jsxs(bC,{"data-slot":"dialog-portal",children:[l.jsx(rm,{}),l.jsxs(ge.Content,{"data-slot":"dialog-content",className:y("bg-background 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 fixed top-[50%] left-[50%] z-50 flex flex-col w-full max-w-[calc(100%-2rem)] max-h-[calc(100svh-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border p-6 shadow-lg duration-200 sm:max-w-lg",t),...n,children:[e,l.jsxs(ge.Close,{className:"ring-offset-background focus:ring-ring data-[state=open]:bg-accent data-[state=open]:text-muted-foreground absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",children:[l.jsx(S.XIcon,{}),l.jsx("span",{className:"sr-only",children:"Close"})]})]})]})}function hs({className:t,...e}){return l.jsx("div",{"data-slot":"dialog-header",className:y("flex flex-col gap-2 text-center sm:text-left",t),...e})}function Al({className:t,...e}){return l.jsx("div",{"data-slot":"dialog-footer",className:y("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",t),...e})}function ps({className:t,...e}){return l.jsx(ge.Title,{"data-slot":"dialog-title",className:y("text-lg leading-[1.2] font-semibold",t),...e})}function ms({className:t,...e}){return l.jsx(ge.Description,{"data-slot":"dialog-description",className:y("text-muted-foreground text-sm leading-relaxed",t),...e})}function im({className:t,...e}){return l.jsx(Jr.Command,{"data-slot":"command",className:y("bg-popover text-popover-foreground flex h-full w-full flex-col overflow-hidden rounded-md",t),...e})}function wC({title:t="Command Palette",description:e="Search for a command to run...",children:n,...r}){return l.jsxs(ds,{...r,children:[l.jsxs(hs,{className:"sr-only",children:[l.jsx(ps,{children:t}),l.jsx(ms,{children:e})]}),l.jsx(us,{className:"overflow-hidden p-0",children:l.jsx(im,{className:"[&_[cmdk-group-heading]]:text-muted-foreground **:data-[slot=command-input-wrapper]:h-12 [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group]]:px-2 [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 [&_[cmdk-input-wrapper]_svg]:h-5 [&_[cmdk-input-wrapper]_svg]:w-5 [&_[cmdk-input]]:h-12 [&_[cmdk-item]]:px-2 [&_[cmdk-item]]:py-3 [&_[cmdk-item]_svg]:h-5 [&_[cmdk-item]_svg]:w-5",children:n})})]})}function yC({className:t,...e}){return l.jsxs("div",{"data-slot":"command-input-wrapper",className:"flex h-9 items-center gap-2 border-b px-3",children:[l.jsx(S.SearchIcon,{className:"size-4 shrink-0 opacity-50"}),l.jsx(Jr.Command.Input,{"data-slot":"command-input",className:y("placeholder:text-muted-foreground flex h-10 w-full rounded-md bg-transparent py-3 text-sm outline-hidden disabled:cursor-not-allowed disabled:opacity-50",t),...e})]})}function vC({className:t,...e}){return l.jsx(Jr.Command.List,{"data-slot":"command-list",className:y("max-h-[300px] scroll-py-1 overflow-x-hidden overflow-y-auto",t),...e})}function CC({...t}){return l.jsx(Jr.Command.Empty,{"data-slot":"command-empty",className:"py-6 text-center text-sm",...t})}function MC({className:t,...e}){return l.jsx(Jr.Command.Group,{"data-slot":"command-group",className:y("text-foreground [&_[cmdk-group-heading]]:text-muted-foreground overflow-hidden p-1 [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-semibold",t),...e})}function jC({className:t,...e}){return l.jsx(Jr.Command.Separator,{"data-slot":"command-separator",className:y("bg-border -mx-1 h-px",t),...e})}function LC({className:t,...e}){return l.jsx(Jr.Command.Item,{"data-slot":"command-item",className:y("data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",t),...e})}function NC({className:t,...e}){return l.jsx("span",{"data-slot":"command-shortcut",className:y("text-muted-foreground ml-auto text-xs tracking-widest",t),...e})}function Dt({delayDuration:t=0,...e}){return l.jsx(wi.Provider,{"data-slot":"tooltip-provider",delayDuration:t,...e})}function st({...t}){return l.jsx(Dt,{children:l.jsx(wi.Root,{"data-slot":"tooltip",...t})})}function ot({...t}){return l.jsx(wi.Trigger,{"data-slot":"tooltip-trigger",...t})}function lt({className:t,sideOffset:e=0,children:n,...r}){return l.jsx(wi.Portal,{children:l.jsxs(wi.Content,{"data-slot":"tooltip-content",sideOffset:e,className:y("bg-primary text-primary-foreground animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-fit origin-(--radix-tooltip-content-transform-origin) rounded-md px-3 py-1.5 text-xs text-balance",t),...r,children:[n,l.jsx(wi.Arrow,{className:"bg-primary fill-primary z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px]"})]})})}function Gn({className:t,orientation:e="horizontal",decorative:n=!0,...r}){return l.jsx(S4.Root,{"data-slot":"separator-root",decorative:n,orientation:e,className:y("bg-border shrink-0 data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-px",t),...r})}function Ge(t){this.content=t}Ge.prototype={constructor:Ge,find:function(t){for(var e=0;e<this.content.length;e+=2)if(this.content[e]===t)return e;return-1},get:function(t){var e=this.find(t);return e==-1?void 0:this.content[e+1]},update:function(t,e,n){var r=n&&n!=t?this.remove(n):this,i=r.find(t),a=r.content.slice();return i==-1?a.push(n||t,e):(a[i+1]=e,n&&(a[i]=n)),new Ge(a)},remove:function(t){var e=this.find(t);if(e==-1)return this;var n=this.content.slice();return n.splice(e,2),new Ge(n)},addToStart:function(t,e){return new Ge([t,e].concat(this.remove(t).content))},addToEnd:function(t,e){var n=this.remove(t).content.slice();return n.push(t,e),new Ge(n)},addBefore:function(t,e,n){var r=this.remove(e),i=r.content.slice(),a=r.find(t);return i.splice(a==-1?i.length:a,0,e,n),new Ge(i)},forEach:function(t){for(var e=0;e<this.content.length;e+=2)t(this.content[e],this.content[e+1])},prepend:function(t){return t=Ge.from(t),t.size?new Ge(t.content.concat(this.subtract(t).content)):this},append:function(t){return t=Ge.from(t),t.size?new Ge(this.subtract(t).content.concat(t.content)):this},subtract:function(t){var e=this;t=Ge.from(t);for(var n=0;n<t.content.length;n+=2)e=e.remove(t.content[n]);return e},toObject:function(){var t={};return this.forEach(function(e,n){t[e]=n}),t},get size(){return this.content.length>>1}};Ge.from=function(t){if(t instanceof Ge)return t;var e=[];if(t)for(var n in t)e.push(n,t[n]);return new Ge(e)};function am(t,e,n){for(let r=0;;r++){if(r==t.childCount||r==e.childCount)return t.childCount==e.childCount?null:n;let i=t.child(r),a=e.child(r);if(i==a){n+=i.nodeSize;continue}if(!i.sameMarkup(a))return n;if(i.isText&&i.text!=a.text){let s=i.text,o=a.text,f=0;for(;s[f]==o[f];f++)n++;return f&&f<s.length&&f<o.length&&lm(s.charCodeAt(f-1))&&om(s.charCodeAt(f))&&n--,n}if(i.content.size||a.content.size){let s=am(i.content,a.content,n+1);if(s!=null)return s}n+=i.nodeSize}}function sm(t,e,n,r){for(let i=t.childCount,a=e.childCount;;){if(i==0||a==0)return i==a?null:{a:n,b:r};let s=t.child(--i),o=e.child(--a),f=s.nodeSize;if(s==o){n-=f,r-=f;continue}if(!s.sameMarkup(o))return{a:n,b:r};if(s.isText&&s.text!=o.text){let c=s.text,d=o.text,u=c.length,h=d.length;for(;u>0&&h>0&&c[u-1]==d[h-1];)u--,h--,n--,r--;return u&&h&&u<c.length&&lm(c.charCodeAt(u-1))&&om(c.charCodeAt(u))&&(n++,r++),{a:n,b:r}}if(s.content.size||o.content.size){let c=sm(s.content,o.content,n-1,r-1);if(c)return c}n-=f,r-=f}}function om(t){return t>=56320&&t<57344}function lm(t){return t>=55296&&t<56320}class z{constructor(e,n){if(this.content=e,this.size=n||0,n==null)for(let r=0;r<e.length;r++)this.size+=e[r].nodeSize}nodesBetween(e,n,r,i=0,a){for(let s=0,o=0;o<n;s++){let f=this.content[s],c=o+f.nodeSize;if(c>e&&r(f,i+o,a||null,s)!==!1&&f.content.size){let d=o+1;f.nodesBetween(Math.max(0,e-d),Math.min(f.content.size,n-d),r,i+d)}o=c}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,n,r,i){let a="",s=!0;return this.nodesBetween(e,n,(o,f)=>{let c=o.isText?o.text.slice(Math.max(e,f)-f,n-f):o.isLeaf?i?typeof i=="function"?i(o):i:o.type.spec.leafText?o.type.spec.leafText(o):"":"";o.isBlock&&(o.isLeaf&&c||o.isTextblock)&&r&&(s?s=!1:a+=r),a+=c},0),a}append(e){if(!e.size)return this;if(!this.size)return e;let n=this.lastChild,r=e.firstChild,i=this.content.slice(),a=0;for(n.isText&&n.sameMarkup(r)&&(i[i.length-1]=n.withText(n.text+r.text),a=1);a<e.content.length;a++)i.push(e.content[a]);return new z(i,this.size+e.size)}cut(e,n=this.size){if(e==0&&n==this.size)return this;let r=[],i=0;if(n>e)for(let a=0,s=0;s<n;a++){let o=this.content[a],f=s+o.nodeSize;f>e&&((s<e||f>n)&&(o.isText?o=o.cut(Math.max(0,e-s),Math.min(o.text.length,n-s)):o=o.cut(Math.max(0,e-s-1),Math.min(o.content.size,n-s-1))),r.push(o),i+=o.nodeSize),s=f}return new z(r,i)}cutByIndex(e,n){return e==n?z.empty:e==0&&n==this.content.length?this:new z(this.content.slice(e,n))}replaceChild(e,n){let r=this.content[e];if(r==n)return this;let i=this.content.slice(),a=this.size+n.nodeSize-r.nodeSize;return i[e]=n,new z(i,a)}addToStart(e){return new z([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new z(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let n=0;n<this.content.length;n++)if(!this.content[n].eq(e.content[n]))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 n=this.content[e];if(!n)throw new RangeError("Index "+e+" out of range for "+this);return n}maybeChild(e){return this.content[e]||null}forEach(e){for(let n=0,r=0;n<this.content.length;n++){let i=this.content[n];e(i,r,n),r+=i.nodeSize}}findDiffStart(e,n=0){return am(this,e,n)}findDiffEnd(e,n=this.size,r=e.size){return sm(this,e,n,r)}findIndex(e){if(e==0)return Vs(0,e);if(e==this.size)return Vs(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let n=0,r=0;;n++){let i=this.child(n),a=r+i.nodeSize;if(a>=e)return a==e?Vs(n+1,a):Vs(n,r);r=a}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,n){if(!n)return z.empty;if(!Array.isArray(n))throw new RangeError("Invalid input for Fragment.fromJSON");return z.fromArray(n.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return z.empty;let n,r=0;for(let i=0;i<e.length;i++){let a=e[i];r+=a.nodeSize,i&&a.isText&&e[i-1].sameMarkup(a)?(n||(n=e.slice(0,i)),n[n.length-1]=a.withText(n[n.length-1].text+a.text)):n&&n.push(a)}return new z(n||e,r)}static from(e){if(!e)return z.empty;if(e instanceof z)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new z([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}z.empty=new z([],0);const Lf={index:0,offset:0};function Vs(t,e){return Lf.index=t,Lf.offset=e,Lf}function No(t,e){if(t===e)return!0;if(!(t&&typeof t=="object")||!(e&&typeof e=="object"))return!1;let n=Array.isArray(t);if(Array.isArray(e)!=n)return!1;if(n){if(t.length!=e.length)return!1;for(let r=0;r<t.length;r++)if(!No(t[r],e[r]))return!1}else{for(let r in t)if(!(r in e)||!No(t[r],e[r]))return!1;for(let r in e)if(!(r in t))return!1}return!0}let Ce=class wc{constructor(e,n){this.type=e,this.attrs=n}addToSet(e){let n,r=!1;for(let i=0;i<e.length;i++){let a=e[i];if(this.eq(a))return e;if(this.type.excludes(a.type))n||(n=e.slice(0,i));else{if(a.type.excludes(this.type))return e;!r&&a.type.rank>this.type.rank&&(n||(n=e.slice(0,i)),n.push(this),r=!0),n&&n.push(a)}}return n||(n=e.slice()),r||n.push(this),n}removeFromSet(e){for(let n=0;n<e.length;n++)if(this.eq(e[n]))return e.slice(0,n).concat(e.slice(n+1));return e}isInSet(e){for(let n=0;n<e.length;n++)if(this.eq(e[n]))return!0;return!1}eq(e){return this==e||this.type==e.type&&No(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let n in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,n){if(!n)throw new RangeError("Invalid input for Mark.fromJSON");let r=e.marks[n.type];if(!r)throw new RangeError(`There is no mark type ${n.type} in this schema`);let i=r.create(n.attrs);return r.checkAttrs(i.attrs),i}static sameSet(e,n){if(e==n)return!0;if(e.length!=n.length)return!1;for(let r=0;r<e.length;r++)if(!e[r].eq(n[r]))return!1;return!0}static setFrom(e){if(!e||Array.isArray(e)&&e.length==0)return wc.none;if(e instanceof wc)return[e];let n=e.slice();return n.sort((r,i)=>r.type.rank-i.type.rank),n}};Ce.none=[];class Pa extends Error{}class K{constructor(e,n,r){this.content=e,this.openStart=n,this.openEnd=r}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,n){let r=cm(this.content,e+this.openStart,n,this.openStart+1,this.openEnd+1);return r&&new K(r,this.openStart,this.openEnd)}removeBetween(e,n){return new K(fm(this.content,e+this.openStart,n+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,n){if(!n)return K.empty;let r=n.openStart||0,i=n.openEnd||0;if(typeof r!="number"||typeof i!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new K(z.fromJSON(e,n.content),r,i)}static maxOpen(e,n=!0){let r=0,i=0;for(let a=e.firstChild;a&&!a.isLeaf&&(n||!a.type.spec.isolating);a=a.firstChild)r++;for(let a=e.lastChild;a&&!a.isLeaf&&(n||!a.type.spec.isolating);a=a.lastChild)i++;return new K(e,r,i)}}K.empty=new K(z.empty,0,0);function fm(t,e,n){let{index:r,offset:i}=t.findIndex(e),a=t.maybeChild(r),{index:s,offset:o}=t.findIndex(n);if(i==e||a.isText){if(o!=n&&!t.child(s).isText)throw new RangeError("Removing non-flat range");return t.cut(0,e).append(t.cut(n))}if(r!=s)throw new RangeError("Removing non-flat range");return t.replaceChild(r,a.copy(fm(a.content,e-i-1,n-i-1)))}function cm(t,e,n,r,i,a){let{index:s,offset:o}=t.findIndex(e),f=t.maybeChild(s);if(o==e||f.isText)return a&&r<=0&&i<=0&&!a.canReplace(s,s,n)?null:t.cut(0,e).append(n).append(t.cut(e));let c=cm(f.content,e-o-1,n,s==0?r-1:0,s==t.childCount-1?i-1:0,f);return c&&t.replaceChild(s,f.copy(c))}function SC(t,e,n){if(n.openStart>t.depth)throw new Pa("Inserted content deeper than insertion position");if(t.depth-n.openStart!=e.depth-n.openEnd)throw new Pa("Inconsistent open depths");return dm(t,e,n,0)}function dm(t,e,n,r){let i=t.index(r),a=t.node(r);if(i==e.index(r)&&r<t.depth-n.openStart){let s=dm(t,e,n,r+1);return a.copy(a.content.replaceChild(i,s))}else if(n.content.size)if(!n.openStart&&!n.openEnd&&t.depth==r&&e.depth==r){let s=t.parent,o=s.content;return Dr(s,o.cut(0,t.parentOffset).append(n.content).append(o.cut(e.parentOffset)))}else{let{start:s,end:o}=kC(n,t);return Dr(a,hm(t,s,o,e,r))}else return Dr(a,So(t,e,r))}function um(t,e){if(!e.type.compatibleContent(t.type))throw new Pa("Cannot join "+e.type.name+" onto "+t.type.name)}function yc(t,e,n){let r=t.node(n);return um(r,e.node(n)),r}function Tr(t,e){let n=e.length-1;n>=0&&t.isText&&t.sameMarkup(e[n])?e[n]=t.withText(e[n].text+t.text):e.push(t)}function ba(t,e,n,r){let i=(e||t).node(n),a=0,s=e?e.index(n):i.childCount;t&&(a=t.index(n),t.depth>n?a++:t.textOffset&&(Tr(t.nodeAfter,r),a++));for(let o=a;o<s;o++)Tr(i.child(o),r);e&&e.depth==n&&e.textOffset&&Tr(e.nodeBefore,r)}function Dr(t,e){if(!t.type.validContent(e))throw new Pa("Invalid content for node "+t.type.name);return t.copy(e)}function hm(t,e,n,r,i){let a=t.depth>i&&yc(t,e,i+1),s=r.depth>i&&yc(n,r,i+1),o=[];return ba(null,t,i,o),a&&s&&e.index(i)==n.index(i)?(um(a,s),Tr(Dr(a,hm(t,e,n,r,i+1)),o)):(a&&Tr(Dr(a,So(t,e,i+1)),o),ba(e,n,i,o),s&&Tr(Dr(s,So(n,r,i+1)),o)),ba(r,null,i,o),new z(o)}function So(t,e,n){let r=[];if(ba(null,t,n,r),t.depth>n){let i=yc(t,e,n+1);Tr(Dr(i,So(t,e,n+1)),r)}return ba(e,null,n,r),new z(r)}function kC(t,e){let n=e.depth-t.openStart,i=e.node(n).copy(t.content);for(let a=n-1;a>=0;a--)i=e.node(a).copy(z.from(i));return{start:i.resolveNoCache(t.openStart+n),end:i.resolveNoCache(i.content.size-t.openEnd-n)}}class Ba{constructor(e,n,r){this.pos=e,this.path=n,this.parentOffset=r,this.depth=n.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,n=this.index(this.depth);if(n==e.childCount)return null;let r=this.pos-this.path[this.path.length-1],i=e.child(n);return r?e.child(n).cut(r):i}get nodeBefore(){let e=this.index(this.depth),n=this.pos-this.path[this.path.length-1];return n?this.parent.child(e).cut(0,n):e==0?null:this.parent.child(e-1)}posAtIndex(e,n){n=this.resolveDepth(n);let r=this.path[n*3],i=n==0?0:this.path[n*3-1]+1;for(let a=0;a<e;a++)i+=r.child(a).nodeSize;return i}marks(){let e=this.parent,n=this.index();if(e.content.size==0)return Ce.none;if(this.textOffset)return e.child(n).marks;let r=e.maybeChild(n-1),i=e.maybeChild(n);if(!r){let o=r;r=i,i=o}let a=r.marks;for(var s=0;s<a.length;s++)a[s].type.spec.inclusive===!1&&(!i||!a[s].isInSet(i.marks))&&(a=a[s--].removeFromSet(a));return a}marksAcross(e){let n=this.parent.maybeChild(this.index());if(!n||!n.isInline)return null;let r=n.marks,i=e.parent.maybeChild(e.index());for(var a=0;a<r.length;a++)r[a].type.spec.inclusive===!1&&(!i||!r[a].isInSet(i.marks))&&(r=r[a--].removeFromSet(r));return r}sharedDepth(e){for(let n=this.depth;n>0;n--)if(this.start(n)<=e&&this.end(n)>=e)return n;return 0}blockRange(e=this,n){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)&&(!n||n(this.node(r))))return new ko(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 n=1;n<=this.depth;n++)e+=(e?"/":"")+this.node(n).type.name+"_"+this.index(n-1);return e+":"+this.parentOffset}static resolve(e,n){if(!(n>=0&&n<=e.content.size))throw new RangeError("Position "+n+" out of range");let r=[],i=0,a=n;for(let s=e;;){let{index:o,offset:f}=s.content.findIndex(a),c=a-f;if(r.push(s,o,i+f),!c||(s=s.child(o),s.isText))break;a=c-1,i+=f+1}return new Ba(n,r,a)}static resolveCached(e,n){let r=Sh.get(e);if(r)for(let a=0;a<r.elts.length;a++){let s=r.elts[a];if(s.pos==n)return s}else Sh.set(e,r=new IC);let i=r.elts[r.i]=Ba.resolve(e,n);return r.i=(r.i+1)%AC,i}}class IC{constructor(){this.elts=[],this.i=0}}const AC=12,Sh=new WeakMap;class ko{constructor(e,n,r){this.$from=e,this.$to=n,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 EC=Object.create(null);let kn=class vc{constructor(e,n,r,i=Ce.none){this.type=e,this.attrs=n,this.marks=i,this.content=r||z.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,n,r,i=0){this.content.nodesBetween(e,n,r,i,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,n,r,i){return this.content.textBetween(e,n,r,i)}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,n,r){return this.type==e&&No(this.attrs,n||e.defaultAttrs||EC)&&Ce.sameSet(this.marks,r||Ce.none)}copy(e=null){return e==this.content?this:new vc(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new vc(this.type,this.attrs,this.content,e)}cut(e,n=this.content.size){return e==0&&n==this.content.size?this:this.copy(this.content.cut(e,n))}slice(e,n=this.content.size,r=!1){if(e==n)return K.empty;let i=this.resolve(e),a=this.resolve(n),s=r?0:i.sharedDepth(n),o=i.start(s),c=i.node(s).content.cut(i.pos-o,a.pos-o);return new K(c,i.depth-s,a.depth-s)}replace(e,n,r){return SC(this.resolve(e),this.resolve(n),r)}nodeAt(e){for(let n=this;;){let{index:r,offset:i}=n.content.findIndex(e);if(n=n.maybeChild(r),!n)return null;if(i==e||n.isText)return n;e-=i+1}}childAfter(e){let{index:n,offset:r}=this.content.findIndex(e);return{node:this.content.maybeChild(n),index:n,offset:r}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:n,offset:r}=this.content.findIndex(e);if(r<e)return{node:this.content.child(n),index:n,offset:r};let i=this.content.child(n-1);return{node:i,index:n-1,offset:r-i.nodeSize}}resolve(e){return Ba.resolveCached(this,e)}resolveNoCache(e){return Ba.resolve(this,e)}rangeHasMark(e,n,r){let i=!1;return n>e&&this.nodesBetween(e,n,a=>(r.isInSet(a.marks)&&(i=!0),!i)),i}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()+")"),pm(this.marks,e)}contentMatchAt(e){let n=this.type.contentMatch.matchFragment(this.content,0,e);if(!n)throw new Error("Called contentMatchAt on a node with invalid content");return n}canReplace(e,n,r=z.empty,i=0,a=r.childCount){let s=this.contentMatchAt(e).matchFragment(r,i,a),o=s&&s.matchFragment(this.content,n);if(!o||!o.validEnd)return!1;for(let f=i;f<a;f++)if(!this.type.allowsMarks(r.child(f).marks))return!1;return!0}canReplaceWith(e,n,r,i){if(i&&!this.type.allowsMarks(i))return!1;let a=this.contentMatchAt(e).matchType(r),s=a&&a.matchFragment(this.content,n);return s?s.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=Ce.none;for(let n=0;n<this.marks.length;n++){let r=this.marks[n];r.type.checkAttrs(r.attrs),e=r.addToSet(e)}if(!Ce.sameSet(e,this.marks))throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(n=>n.type.name)}`);this.content.forEach(n=>n.check())}toJSON(){let e={type:this.type.name};for(let n 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(n=>n.toJSON())),e}static fromJSON(e,n){if(!n)throw new RangeError("Invalid input for Node.fromJSON");let r;if(n.marks){if(!Array.isArray(n.marks))throw new RangeError("Invalid mark data for Node.fromJSON");r=n.marks.map(e.markFromJSON)}if(n.type=="text"){if(typeof n.text!="string")throw new RangeError("Invalid text node in JSON");return e.text(n.text,r)}let i=z.fromJSON(e,n.content),a=e.nodeType(n.type).create(n.attrs,i,r);return a.type.checkAttrs(a.attrs),a}};kn.prototype.text=void 0;class Io extends kn{constructor(e,n,r,i){if(super(e,n,null,i),!r)throw new RangeError("Empty text nodes are not allowed");this.text=r}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):pm(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,n){return this.text.slice(e,n)}get nodeSize(){return this.text.length}mark(e){return e==this.marks?this:new Io(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new Io(this.type,this.attrs,e,this.marks)}cut(e=0,n=this.text.length){return e==0&&n==this.text.length?this:this.withText(this.text.slice(e,n))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}}function pm(t,e){for(let n=t.length-1;n>=0;n--)e=t[n].type.name+"("+e+")";return e}class Fr{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,n){let r=new TC(e,n);if(r.next==null)return Fr.empty;let i=mm(r);r.next&&r.err("Unexpected trailing text");let a=FC(BC(i));return VC(a,r),a}matchType(e){for(let n=0;n<this.next.length;n++)if(this.next[n].type==e)return this.next[n].next;return null}matchFragment(e,n=0,r=e.childCount){let i=this;for(let a=n;i&&a<r;a++)i=i.matchType(e.child(a).type);return i}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:n}=this.next[e];if(!(n.isText||n.hasRequiredAttrs()))return n}return null}compatible(e){for(let n=0;n<this.next.length;n++)for(let r=0;r<e.next.length;r++)if(this.next[n].type==e.next[r].type)return!0;return!1}fillBefore(e,n=!1,r=0){let i=[this];function a(s,o){let f=s.matchFragment(e,r);if(f&&(!n||f.validEnd))return z.from(o.map(c=>c.createAndFill()));for(let c=0;c<s.next.length;c++){let{type:d,next:u}=s.next[c];if(!(d.isText||d.hasRequiredAttrs())&&i.indexOf(u)==-1){i.push(u);let h=a(u,o.concat(d));if(h)return h}}return null}return a(this,[])}findWrapping(e){for(let r=0;r<this.wrapCache.length;r+=2)if(this.wrapCache[r]==e)return this.wrapCache[r+1];let n=this.computeWrapping(e);return this.wrapCache.push(e,n),n}computeWrapping(e){let n=Object.create(null),r=[{match:this,type:null,via:null}];for(;r.length;){let i=r.shift(),a=i.match;if(a.matchType(e)){let s=[];for(let o=i;o.type;o=o.via)s.push(o.type);return s.reverse()}for(let s=0;s<a.next.length;s++){let{type:o,next:f}=a.next[s];!o.isLeaf&&!o.hasRequiredAttrs()&&!(o.name in n)&&(!i.type||f.validEnd)&&(r.push({match:o.contentMatch,type:o,via:i}),n[o.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 n(r){e.push(r);for(let i=0;i<r.next.length;i++)e.indexOf(r.next[i].next)==-1&&n(r.next[i].next)}return n(this),e.map((r,i)=>{let a=i+(r.validEnd?"*":" ")+" ";for(let s=0;s<r.next.length;s++)a+=(s?", ":"")+r.next[s].type.name+"->"+e.indexOf(r.next[s].next);return a}).join(`
|
|
8
8
|
`)}}Fr.empty=new Fr(!0);class TC{constructor(e,n){this.string=e,this.nodeTypes=n,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 mm(t){let e=[];do e.push(DC(t));while(t.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function DC(t){let e=[];do e.push(RC(t));while(t.next&&t.next!=")"&&t.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function RC(t){let e=PC(t);for(;;)if(t.eat("+"))e={type:"plus",expr:e};else if(t.eat("*"))e={type:"star",expr:e};else if(t.eat("?"))e={type:"opt",expr:e};else if(t.eat("{"))e=OC(t,e);else break;return e}function kh(t){/\D/.test(t.next)&&t.err("Expected number, got '"+t.next+"'");let e=Number(t.next);return t.pos++,e}function OC(t,e){let n=kh(t),r=n;return t.eat(",")&&(t.next!="}"?r=kh(t):r=-1),t.eat("}")||t.err("Unclosed braced range"),{type:"range",min:n,max:r,expr:e}}function zC(t,e){let n=t.nodeTypes,r=n[e];if(r)return[r];let i=[];for(let a in n){let s=n[a];s.isInGroup(e)&&i.push(s)}return i.length==0&&t.err("No node type or group '"+e+"' found"),i}function PC(t){if(t.eat("(")){let e=mm(t);return t.eat(")")||t.err("Missing closing paren"),e}else if(/\W/.test(t.next))t.err("Unexpected token '"+t.next+"'");else{let e=zC(t,t.next).map(n=>(t.inline==null?t.inline=n.isInline:t.inline!=n.isInline&&t.err("Mixing inline and block content"),{type:"name",value:n}));return t.pos++,e.length==1?e[0]:{type:"choice",exprs:e}}}function BC(t){let e=[[]];return i(a(t,0),n()),e;function n(){return e.push([])-1}function r(s,o,f){let c={term:f,to:o};return e[s].push(c),c}function i(s,o){s.forEach(f=>f.to=o)}function a(s,o){if(s.type=="choice")return s.exprs.reduce((f,c)=>f.concat(a(c,o)),[]);if(s.type=="seq")for(let f=0;;f++){let c=a(s.exprs[f],o);if(f==s.exprs.length-1)return c;i(c,o=n())}else if(s.type=="star"){let f=n();return r(o,f),i(a(s.expr,f),f),[r(f)]}else if(s.type=="plus"){let f=n();return i(a(s.expr,o),f),i(a(s.expr,f),f),[r(f)]}else{if(s.type=="opt")return[r(o)].concat(a(s.expr,o));if(s.type=="range"){let f=o;for(let c=0;c<s.min;c++){let d=n();i(a(s.expr,f),d),f=d}if(s.max==-1)i(a(s.expr,f),f);else for(let c=s.min;c<s.max;c++){let d=n();r(f,d),i(a(s.expr,f),d),f=d}return[r(f)]}else{if(s.type=="name")return[r(o,void 0,s.value)];throw new Error("Unknown expr type")}}}}function gm(t,e){return e-t}function Ih(t,e){let n=[];return r(e),n.sort(gm);function r(i){let a=t[i];if(a.length==1&&!a[0].term)return r(a[0].to);n.push(i);for(let s=0;s<a.length;s++){let{term:o,to:f}=a[s];!o&&n.indexOf(f)==-1&&r(f)}}}function FC(t){let e=Object.create(null);return n(Ih(t,0));function n(r){let i=[];r.forEach(s=>{t[s].forEach(({term:o,to:f})=>{if(!o)return;let c;for(let d=0;d<i.length;d++)i[d][0]==o&&(c=i[d][1]);Ih(t,f).forEach(d=>{c||i.push([o,c=[]]),c.indexOf(d)==-1&&c.push(d)})})});let a=e[r.join(",")]=new Fr(r.indexOf(t.length-1)>-1);for(let s=0;s<i.length;s++){let o=i[s][1].sort(gm);a.next.push({type:i[s][0],next:e[o.join(",")]||n(o)})}return a}}function VC(t,e){for(let n=0,r=[t];n<r.length;n++){let i=r[n],a=!i.validEnd,s=[];for(let o=0;o<i.next.length;o++){let{type:f,next:c}=i.next[o];s.push(f.name),a&&!(f.isText||f.hasRequiredAttrs())&&(a=!1),r.indexOf(c)==-1&&r.push(c)}a&&e.err("Only non-generatable nodes ("+s.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}function bm(t){let e=Object.create(null);for(let n in t){let r=t[n];if(!r.hasDefault)return null;e[n]=r.default}return e}function xm(t,e){let n=Object.create(null);for(let r in t){let i=e&&e[r];if(i===void 0){let a=t[r];if(a.hasDefault)i=a.default;else throw new RangeError("No value supplied for attribute "+r)}n[r]=i}return n}function wm(t,e,n,r){for(let i in e)if(!(i in t))throw new RangeError(`Unsupported attribute ${i} for ${n} of type ${r}`);for(let i in t)t[i].validate&&t[i].validate(e[i])}function ym(t,e){let n=Object.create(null);if(e)for(let r in e)n[r]=new YC(t,r,e[r]);return n}let Ah=class vm{constructor(e,n,r){this.name=e,this.schema=n,this.spec=r,this.markSet=null,this.groups=r.group?r.group.split(" "):[],this.attrs=ym(e,r.attrs),this.defaultAttrs=bm(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==Fr.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:xm(this.attrs,e)}create(e=null,n,r){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new kn(this,this.computeAttrs(e),z.from(n),Ce.setFrom(r))}createChecked(e=null,n,r){return n=z.from(n),this.checkContent(n),new kn(this,this.computeAttrs(e),n,Ce.setFrom(r))}createAndFill(e=null,n,r){if(e=this.computeAttrs(e),n=z.from(n),n.size){let s=this.contentMatch.fillBefore(n);if(!s)return null;n=s.append(n)}let i=this.contentMatch.matchFragment(n),a=i&&i.fillBefore(z.empty,!0);return a?new kn(this,e,n.append(a),Ce.setFrom(r)):null}validContent(e){let n=this.contentMatch.matchFragment(e);if(!n||!n.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){wm(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 n=0;n<e.length;n++)if(!this.allowsMarkType(e[n].type))return!1;return!0}allowedMarks(e){if(this.markSet==null)return e;let n;for(let r=0;r<e.length;r++)this.allowsMarkType(e[r].type)?n&&n.push(e[r]):n||(n=e.slice(0,r));return n?n.length?n:Ce.none:e}static compile(e,n){let r=Object.create(null);e.forEach((a,s)=>r[a]=new vm(a,n,s));let i=n.spec.topNode||"doc";if(!r[i])throw new RangeError("Schema is missing its top node type ('"+i+"')");if(!r.text)throw new RangeError("Every schema needs a 'text' type");for(let a in r.text.attrs)throw new RangeError("The text node type should not have attributes");return r}};function UC(t,e,n){let r=n.split("|");return i=>{let a=i===null?"null":typeof i;if(r.indexOf(a)<0)throw new RangeError(`Expected value of type ${r} for attribute ${e} on type ${t}, got ${a}`)}}class YC{constructor(e,n,r){this.hasDefault=Object.prototype.hasOwnProperty.call(r,"default"),this.default=r.default,this.validate=typeof r.validate=="string"?UC(e,n,r.validate):r.validate}get isRequired(){return!this.hasDefault}}class El{constructor(e,n,r,i){this.name=e,this.rank=n,this.schema=r,this.spec=i,this.attrs=ym(e,i.attrs),this.excluded=null;let a=bm(this.attrs);this.instance=a?new Ce(this,a):null}create(e=null){return!e&&this.instance?this.instance:new Ce(this,xm(this.attrs,e))}static compile(e,n){let r=Object.create(null),i=0;return e.forEach((a,s)=>r[a]=new El(a,i++,n,s)),r}removeFromSet(e){for(var n=0;n<e.length;n++)e[n].type==this&&(e=e.slice(0,n).concat(e.slice(n+1)),n--);return e}isInSet(e){for(let n=0;n<e.length;n++)if(e[n].type==this)return e[n]}checkAttrs(e){wm(this.attrs,e,"mark",this.name)}excludes(e){return this.excluded.indexOf(e)>-1}}class Cm{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let n=this.spec={};for(let i in e)n[i]=e[i];n.nodes=Ge.from(e.nodes),n.marks=Ge.from(e.marks||{}),this.nodes=Ah.compile(this.spec.nodes,this),this.marks=El.compile(this.spec.marks,this);let r=Object.create(null);for(let i in this.nodes){if(i in this.marks)throw new RangeError(i+" can not be both a node and a mark");let a=this.nodes[i],s=a.spec.content||"",o=a.spec.marks;if(a.contentMatch=r[s]||(r[s]=Fr.parse(s,this.nodes)),a.inlineContent=a.contentMatch.inlineContent,a.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!a.isInline||!a.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=a}a.markSet=o=="_"?null:o?Eh(this,o.split(" ")):o==""||!a.inlineContent?[]:null}for(let i in this.marks){let a=this.marks[i],s=a.spec.excludes;a.excluded=s==null?[a]:s==""?[]:Eh(this,s.split(" "))}this.nodeFromJSON=i=>kn.fromJSON(this,i),this.markFromJSON=i=>Ce.fromJSON(this,i),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(e,n=null,r,i){if(typeof e=="string")e=this.nodeType(e);else if(e instanceof Ah){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(n,r,i)}text(e,n){let r=this.nodes.text;return new Io(r,r.defaultAttrs,e,Ce.setFrom(n))}mark(e,n){return typeof e=="string"&&(e=this.marks[e]),e.create(n)}nodeType(e){let n=this.nodes[e];if(!n)throw new RangeError("Unknown node type: "+e);return n}}function Eh(t,e){let n=[];for(let r=0;r<e.length;r++){let i=e[r],a=t.marks[i],s=a;if(a)n.push(a);else for(let o in t.marks){let f=t.marks[o];(i=="_"||f.spec.group&&f.spec.group.split(" ").indexOf(i)>-1)&&n.push(s=f)}if(!s)throw new SyntaxError("Unknown mark type: '"+e[r]+"'")}return n}function WC(t){return t.tag!=null}function HC(t){return t.style!=null}class Zn{constructor(e,n){this.schema=e,this.rules=n,this.tags=[],this.styles=[];let r=this.matchedStyles=[];n.forEach(i=>{if(WC(i))this.tags.push(i);else if(HC(i)){let a=/[^=]*/.exec(i.style)[0];r.indexOf(a)<0&&r.push(a),this.styles.push(i)}}),this.normalizeLists=!this.tags.some(i=>{if(!/^(ul|ol)\b/.test(i.tag)||!i.node)return!1;let a=e.nodes[i.node];return a.contentMatch.matchType(a)})}parse(e,n={}){let r=new Dh(this,n,!1);return r.addAll(e,Ce.none,n.from,n.to),r.finish()}parseSlice(e,n={}){let r=new Dh(this,n,!0);return r.addAll(e,Ce.none,n.from,n.to),K.maxOpen(r.finish())}matchTag(e,n,r){for(let i=r?this.tags.indexOf(r)+1:0;i<this.tags.length;i++){let a=this.tags[i];if(JC(e,a.tag)&&(a.namespace===void 0||e.namespaceURI==a.namespace)&&(!a.context||n.matchesContext(a.context))){if(a.getAttrs){let s=a.getAttrs(e);if(s===!1)continue;a.attrs=s||void 0}return a}}}matchStyle(e,n,r,i){for(let a=i?this.styles.indexOf(i)+1:0;a<this.styles.length;a++){let s=this.styles[a],o=s.style;if(!(o.indexOf(e)!=0||s.context&&!r.matchesContext(s.context)||o.length>e.length&&(o.charCodeAt(e.length)!=61||o.slice(e.length+1)!=n))){if(s.getAttrs){let f=s.getAttrs(n);if(f===!1)continue;s.attrs=f||void 0}return s}}}static schemaRules(e){let n=[];function r(i){let a=i.priority==null?50:i.priority,s=0;for(;s<n.length;s++){let o=n[s];if((o.priority==null?50:o.priority)<a)break}n.splice(s,0,i)}for(let i in e.marks){let a=e.marks[i].spec.parseDOM;a&&a.forEach(s=>{r(s=Rh(s)),s.mark||s.ignore||s.clearMark||(s.mark=i)})}for(let i in e.nodes){let a=e.nodes[i].spec.parseDOM;a&&a.forEach(s=>{r(s=Rh(s)),s.node||s.ignore||s.mark||(s.node=i)})}return n}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new Zn(e,Zn.schemaRules(e)))}}const Mm={address:!0,article:!0,aside:!0,blockquote:!0,body:!0,canvas:!0,dd:!0,div:!0,dl:!0,fieldset:!0,figcaption:!0,figure:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,li:!0,noscript:!0,ol:!0,output:!0,p:!0,pre:!0,section:!0,table:!0,tfoot:!0,ul:!0},QC={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},jm={ol:!0,ul:!0},Fa=1,Cc=2,xa=4;function Th(t,e,n){return e!=null?(e?Fa:0)|(e==="full"?Cc:0):t&&t.whitespace=="pre"?Fa|Cc:n&~xa}class Us{constructor(e,n,r,i,a,s){this.type=e,this.attrs=n,this.marks=r,this.solid=i,this.options=s,this.content=[],this.activeMarks=Ce.none,this.match=a||(s&xa?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let n=this.type.contentMatch.fillBefore(z.from(e));if(n)this.match=this.type.contentMatch.matchFragment(n);else{let r=this.type.contentMatch,i;return(i=r.findWrapping(e.type))?(this.match=r,i):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&Fa)){let r=this.content[this.content.length-1],i;if(r&&r.isText&&(i=/[ \t\r\n\u000c]+$/.exec(r.text))){let a=r;r.text.length==i[0].length?this.content.pop():this.content[this.content.length-1]=a.withText(a.text.slice(0,a.text.length-i[0].length))}}let n=z.from(this.content);return!e&&this.match&&(n=n.append(this.match.fillBefore(z.empty,!0))),this.type?this.type.create(this.attrs,n,this.marks):n}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!Mm.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class Dh{constructor(e,n,r){this.parser=e,this.options=n,this.isOpen=r,this.open=0,this.localPreserveWS=!1;let i=n.topNode,a,s=Th(null,n.preserveWhitespace,0)|(r?xa:0);i?a=new Us(i.type,i.attrs,Ce.none,!0,n.topMatch||i.type.contentMatch,s):r?a=new Us(null,null,Ce.none,!0,null,s):a=new Us(e.schema.topNodeType,null,Ce.none,!0,null,s),this.nodes=[a],this.find=n.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e,n){e.nodeType==3?this.addTextNode(e,n):e.nodeType==1&&this.addElement(e,n)}addTextNode(e,n){let r=e.nodeValue,i=this.top,a=i.options&Cc?"full":this.localPreserveWS||(i.options&Fa)>0,{schema:s}=this.parser;if(a==="full"||i.inlineContext(e)||/[^ \t\r\n\u000c]/.test(r)){if(a)if(a==="full")r=r.replace(/\r\n?/g,`
|
|
9
9
|
`);else if(s.linebreakReplacement&&/[\r\n]/.test(r)&&this.top.findWrapping(s.linebreakReplacement.create())){let o=r.split(/\r?\n|\r/);for(let f=0;f<o.length;f++)f&&this.insertNode(s.linebreakReplacement.create(),n,!0),o[f]&&this.insertNode(s.text(o[f]),n,!/\S/.test(o[f]));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 o=i.content[i.content.length-1],f=e.previousSibling;(!o||f&&f.nodeName=="BR"||o.isText&&/[ \t\r\n\u000c]$/.test(o.text))&&(r=r.slice(1))}r&&this.insertNode(s.text(r),n,!/\S/.test(r)),this.findInText(e)}else this.findInside(e)}addElement(e,n,r){let i=this.localPreserveWS,a=this.top;(e.tagName=="PRE"||/pre/.test(e.style&&e.style.whiteSpace))&&(this.localPreserveWS=!0);let s=e.nodeName.toLowerCase(),o;jm.hasOwnProperty(s)&&this.parser.normalizeLists&&GC(e);let f=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(o=this.parser.matchTag(e,this,r));e:if(f?f.ignore:QC.hasOwnProperty(s))this.findInside(e),this.ignoreFallback(e,n);else if(!f||f.skip||f.closeParent){f&&f.closeParent?this.open=Math.max(0,this.open-1):f&&f.skip.nodeType&&(e=f.skip);let c,d=this.needsBlock;if(Mm.hasOwnProperty(s))a.content.length&&a.content[0].isInline&&this.open&&(this.open--,a=this.top),c=!0,a.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e,n);break e}let u=f&&f.skip?n:this.readStyles(e,n);u&&this.addAll(e,u),c&&this.sync(a),this.needsBlock=d}else{let c=this.readStyles(e,n);c&&this.addElementByRule(e,f,c,f.consuming===!1?o:void 0)}this.localPreserveWS=i}leafFallback(e,n){e.nodeName=="BR"&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode(`
|
|
10
10
|
`),n)}ignoreFallback(e,n){e.nodeName=="BR"&&(!this.top.type||!this.top.type.inlineContent)&&this.findPlace(this.parser.schema.text("-"),n,!0)}readStyles(e,n){let r=e.style;if(r&&r.length)for(let i=0;i<this.parser.matchedStyles.length;i++){let a=this.parser.matchedStyles[i],s=r.getPropertyValue(a);if(s)for(let o=void 0;;){let f=this.parser.matchStyle(a,s,this,o);if(!f)break;if(f.ignore)return null;if(f.clearMark?n=n.filter(c=>!f.clearMark(c)):n=n.concat(this.parser.schema.marks[f.mark].create(f.attrs)),f.consuming===!1)o=f;else break}}return n}addElementByRule(e,n,r,i){let a,s;if(n.node)if(s=this.parser.schema.nodes[n.node],s.isLeaf)this.insertNode(s.create(n.attrs),r,e.nodeName=="BR")||this.leafFallback(e,r);else{let f=this.enter(s,n.attrs||null,r,n.preserveWhitespace);f&&(a=!0,r=f)}else{let f=this.parser.schema.marks[n.mark];r=r.concat(f.create(n.attrs))}let o=this.top;if(s&&s.isLeaf)this.findInside(e);else if(i)this.addElement(e,r,i);else if(n.getContent)this.findInside(e),n.getContent(e,this.parser.schema).forEach(f=>this.insertNode(f,r,!1));else{let f=e;typeof n.contentElement=="string"?f=e.querySelector(n.contentElement):typeof n.contentElement=="function"?f=n.contentElement(e):n.contentElement&&(f=n.contentElement),this.findAround(e,f,!0),this.addAll(f,r),this.findAround(e,f,!1)}a&&this.sync(o)&&this.open--}addAll(e,n,r,i){let a=r||0;for(let s=r?e.childNodes[r]:e.firstChild,o=i==null?null:e.childNodes[i];s!=o;s=s.nextSibling,++a)this.findAtPoint(e,a),this.addDOM(s,n);this.findAtPoint(e,a)}findPlace(e,n,r){let i,a;for(let s=this.open,o=0;s>=0;s--){let f=this.nodes[s],c=f.findWrapping(e);if(c&&(!i||i.length>c.length+o)&&(i=c,a=f,!c.length))break;if(f.solid){if(r)break;o+=2}}if(!i)return null;this.sync(a);for(let s=0;s<i.length;s++)n=this.enterInner(i[s],null,n,!1);return n}insertNode(e,n,r){if(e.isInline&&this.needsBlock&&!this.top.type){let a=this.textblockFromContext();a&&(n=this.enterInner(a,null,n))}let i=this.findPlace(e,n,r);if(i){this.closeExtra();let a=this.top;a.match&&(a.match=a.match.matchType(e.type));let s=Ce.none;for(let o of i.concat(e.marks))(a.type?a.type.allowsMarkType(o.type):Oh(o.type,e.type))&&(s=o.addToSet(s));return a.content.push(e.mark(s)),!0}return!1}enter(e,n,r,i){let a=this.findPlace(e.create(n),r,!1);return a&&(a=this.enterInner(e,n,r,!0,i)),a}enterInner(e,n,r,i=!1,a){this.closeExtra();let s=this.top;s.match=s.match&&s.match.matchType(e);let o=Th(e,a,s.options);s.options&xa&&s.content.length==0&&(o|=xa);let f=Ce.none;return r=r.filter(c=>(s.type?s.type.allowsMarkType(c.type):Oh(c.type,e))?(f=c.addToSet(f),!1):!0),this.nodes.push(new Us(e,n,f,i,null,o)),this.open++,r}closeExtra(e=!1){let n=this.nodes.length-1;if(n>this.open){for(;n>this.open;n--)this.nodes[n-1].content.push(this.nodes[n].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 n=this.open;n>=0;n--){if(this.nodes[n]==e)return this.open=n,!0;this.localPreserveWS&&(this.nodes[n].options|=Fa)}return!1}get currentPos(){this.closeExtra();let e=0;for(let n=this.open;n>=0;n--){let r=this.nodes[n].content;for(let i=r.length-1;i>=0;i--)e+=r[i].nodeSize;n&&e++}return e}findAtPoint(e,n){if(this.find)for(let r=0;r<this.find.length;r++)this.find[r].node==e&&this.find[r].offset==n&&(this.find[r].pos=this.currentPos)}findInside(e){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].pos==null&&e.nodeType==1&&e.contains(this.find[n].node)&&(this.find[n].pos=this.currentPos)}findAround(e,n,r){if(e!=n&&this.find)for(let i=0;i<this.find.length;i++)this.find[i].pos==null&&e.nodeType==1&&e.contains(this.find[i].node)&&n.compareDocumentPosition(this.find[i].node)&(r?2:4)&&(this.find[i].pos=this.currentPos)}findInText(e){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].node==e&&(this.find[n].pos=this.currentPos-(e.nodeValue.length-this.find[n].offset))}matchesContext(e){if(e.indexOf("|")>-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let n=e.split("/"),r=this.options.context,i=!this.isOpen&&(!r||r.parent.type==this.nodes[0].type),a=-(r?r.depth+1:0)+(i?0:1),s=(o,f)=>{for(;o>=0;o--){let c=n[o];if(c==""){if(o==n.length-1||o==0)continue;for(;f>=a;f--)if(s(o-1,f))return!0;return!1}else{let d=f>0||f==0&&i?this.nodes[f].type:r&&f>=a?r.node(f-a).type:null;if(!d||d.name!=c&&!d.isInGroup(c))return!1;f--}}return!0};return s(n.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let n=e.depth;n>=0;n--){let r=e.node(n).contentMatchAt(e.indexAfter(n)).defaultType;if(r&&r.isTextblock&&r.defaultAttrs)return r}for(let n in this.parser.schema.nodes){let r=this.parser.schema.nodes[n];if(r.isTextblock&&r.defaultAttrs)return r}}}function GC(t){for(let e=t.firstChild,n=null;e;e=e.nextSibling){let r=e.nodeType==1?e.nodeName.toLowerCase():null;r&&jm.hasOwnProperty(r)&&n?(n.appendChild(e),e=n):r=="li"?n=e:r&&(n=null)}}function JC(t,e){return(t.matches||t.msMatchesSelector||t.webkitMatchesSelector||t.mozMatchesSelector).call(t,e)}function Rh(t){let e={};for(let n in t)e[n]=t[n];return e}function Oh(t,e){let n=e.schema.nodes;for(let r in n){let i=n[r];if(!i.allowsMarkType(t))continue;let a=[],s=o=>{a.push(o);for(let f=0;f<o.edgeCount;f++){let{type:c,next:d}=o.edge(f);if(c==e||a.indexOf(d)<0&&s(d))return!0}};if(s(i.contentMatch))return!0}}class qr{constructor(e,n){this.nodes=e,this.marks=n}serializeFragment(e,n={},r){r||(r=Ys(n).createDocumentFragment());let i=r,a=[];return e.forEach(s=>{if(a.length||s.marks.length){let o=0,f=0;for(;o<a.length&&f<s.marks.length;){let c=s.marks[f];if(!this.marks[c.type.name]){f++;continue}if(!c.eq(a[o][0])||c.type.spec.spanning===!1)break;o++,f++}for(;o<a.length;)i=a.pop()[1];for(;f<s.marks.length;){let c=s.marks[f++],d=this.serializeMark(c,s.isInline,n);d&&(a.push([c,i]),i.appendChild(d.dom),i=d.contentDOM||d.dom)}}i.appendChild(this.serializeNodeInner(s,n))}),r}serializeNodeInner(e,n){if(e.isText)return Ys(n).createTextNode(e.text);let{dom:r,contentDOM:i}=fo(Ys(n),this.nodes[e.type.name](e),null,e.attrs);if(i){if(e.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(e.content,n,i)}return r}serializeNode(e,n={}){let r=this.serializeNodeInner(e,n);for(let i=e.marks.length-1;i>=0;i--){let a=this.serializeMark(e.marks[i],e.isInline,n);a&&((a.contentDOM||a.dom).appendChild(r),r=a.dom)}return r}serializeMark(e,n,r={}){let i=this.marks[e.type.name];return i&&fo(Ys(r),i(e,n),null,e.attrs)}static renderSpec(e,n,r=null,i){return typeof n=="string"?{dom:e.createTextNode(n)}:fo(e,n,r,i)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new qr(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let n=zh(e.nodes);return n.text||(n.text=r=>r.text),n}static marksFromSchema(e){return zh(e.marks)}}function zh(t){let e={};for(let n in t){let r=t[n].spec.toDOM;r&&(e[n]=r)}return e}function Ys(t){return t.document||window.document}const Ph=new WeakMap;function KC(t){let e=Ph.get(t);return e===void 0&&Ph.set(t,e=qC(t)),e}function qC(t){let e=null;function n(r){if(r&&typeof r=="object")if(Array.isArray(r))if(typeof r[0]=="string")e||(e=[]),e.push(r);else for(let i=0;i<r.length;i++)n(r[i]);else for(let i in r)n(r[i])}return n(t),e}function fo(t,e,n,r){if(e.nodeType==1)return{dom:e};if(e.dom&&e.dom.nodeType==1)return e;let i=e[0],a;if(typeof i!="string")throw new RangeError("Invalid array passed to renderSpec");if(r&&(a=KC(r))&&a.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 s=i.indexOf(" ");s>0&&(n=i.slice(0,s),i=i.slice(s+1));let o,f=n?t.createElementNS(n,i):t.createElement(i),c=e[1],d=1;if(c&&typeof c=="object"&&c.nodeType==null&&!Array.isArray(c)){d=2;for(let u in c)if(c[u]!=null){let h=u.indexOf(" ");h>0?f.setAttributeNS(u.slice(0,h),u.slice(h+1),c[u]):u=="style"&&f.style?f.style.cssText=c[u]:f.setAttribute(u,c[u])}}for(let u=d;u<e.length;u++){let h=e[u];if(h===0){if(u<e.length-1||u>d)throw new RangeError("Content hole must be the only child of its parent node");return{dom:f,contentDOM:f}}else if(typeof h=="string")f.appendChild(t.createTextNode(h));else{let{dom:p,contentDOM:m}=fo(t,h,n,r);if(f.appendChild(p),m){if(o)throw new RangeError("Multiple content holes");o=m}}}return{dom:f,contentDOM:o}}const Lm=65535,Nm=Math.pow(2,16);function ZC(t,e){return t+e*Nm}function Bh(t){return t&Lm}function XC(t){return(t-(t&Lm))/Nm}const Sm=1,km=2,co=4,Im=8;class Mc{constructor(e,n,r){this.pos=e,this.delInfo=n,this.recover=r}get deleted(){return(this.delInfo&Im)>0}get deletedBefore(){return(this.delInfo&(Sm|co))>0}get deletedAfter(){return(this.delInfo&(km|co))>0}get deletedAcross(){return(this.delInfo&co)>0}}class yt{constructor(e,n=!1){if(this.ranges=e,this.inverted=n,!e.length&&yt.empty)return yt.empty}recover(e){let n=0,r=Bh(e);if(!this.inverted)for(let i=0;i<r;i++)n+=this.ranges[i*3+2]-this.ranges[i*3+1];return this.ranges[r*3]+n+XC(e)}mapResult(e,n=1){return this._map(e,n,!1)}map(e,n=1){return this._map(e,n,!0)}_map(e,n,r){let i=0,a=this.inverted?2:1,s=this.inverted?1:2;for(let o=0;o<this.ranges.length;o+=3){let f=this.ranges[o]-(this.inverted?i:0);if(f>e)break;let c=this.ranges[o+a],d=this.ranges[o+s],u=f+c;if(e<=u){let h=c?e==f?-1:e==u?1:n:n,p=f+i+(h<0?0:d);if(r)return p;let m=e==(n<0?f:u)?null:ZC(o/3,e-f),g=e==f?km:e==u?Sm:co;return(n<0?e!=f:e!=u)&&(g|=Im),new Mc(p,g,m)}i+=d-c}return r?e+i:new Mc(e+i,0,null)}touches(e,n){let r=0,i=Bh(n),a=this.inverted?2:1,s=this.inverted?1:2;for(let o=0;o<this.ranges.length;o+=3){let f=this.ranges[o]-(this.inverted?r:0);if(f>e)break;let c=this.ranges[o+a],d=f+c;if(e<=d&&o==i*3)return!0;r+=this.ranges[o+s]-c}return!1}forEach(e){let n=this.inverted?2:1,r=this.inverted?1:2;for(let i=0,a=0;i<this.ranges.length;i+=3){let s=this.ranges[i],o=s-(this.inverted?a:0),f=s+(this.inverted?0:a),c=this.ranges[i+n],d=this.ranges[i+r];e(o,o+c,f,f+d),a+=d-c}}invert(){return new yt(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?yt.empty:new yt(e<0?[0,-e,0]:[0,0,e])}}yt.empty=new yt([]);class Va{constructor(e,n,r=0,i=e?e.length:0){this.mirror=n,this.from=r,this.to=i,this._maps=e||[],this.ownData=!(e||n)}get maps(){return this._maps}slice(e=0,n=this.maps.length){return new Va(this._maps,this.mirror,e,n)}appendMap(e,n){this.ownData||(this._maps=this._maps.slice(),this.mirror=this.mirror&&this.mirror.slice(),this.ownData=!0),this.to=this._maps.push(e),n!=null&&this.setMirror(this._maps.length-1,n)}appendMapping(e){for(let n=0,r=this._maps.length;n<e._maps.length;n++){let i=e.getMirror(n);this.appendMap(e._maps[n],i!=null&&i<n?r+i:void 0)}}getMirror(e){if(this.mirror){for(let n=0;n<this.mirror.length;n++)if(this.mirror[n]==e)return this.mirror[n+(n%2?-1:1)]}}setMirror(e,n){this.mirror||(this.mirror=[]),this.mirror.push(e,n)}appendMappingInverted(e){for(let n=e.maps.length-1,r=this._maps.length+e._maps.length;n>=0;n--){let i=e.getMirror(n);this.appendMap(e._maps[n].invert(),i!=null&&i>n?r-i-1:void 0)}}invert(){let e=new Va;return e.appendMappingInverted(this),e}map(e,n=1){if(this.mirror)return this._map(e,n,!0);for(let r=this.from;r<this.to;r++)e=this._maps[r].map(e,n);return e}mapResult(e,n=1){return this._map(e,n,!1)}_map(e,n,r){let i=0;for(let a=this.from;a<this.to;a++){let s=this._maps[a],o=s.mapResult(e,n);if(o.recover!=null){let f=this.getMirror(a);if(f!=null&&f>a&&f<this.to){a=f,e=this._maps[f].recover(o.recover);continue}}i|=o.delInfo,e=o.pos}return r?e:new Mc(e,i,null)}}const Nf=Object.create(null);class rt{getMap(){return yt.empty}merge(e){return null}static fromJSON(e,n){if(!n||!n.stepType)throw new RangeError("Invalid input for Step.fromJSON");let r=Nf[n.stepType];if(!r)throw new RangeError(`No step type ${n.stepType} defined`);return r.fromJSON(e,n)}static jsonID(e,n){if(e in Nf)throw new RangeError("Duplicate use of step JSON ID "+e);return Nf[e]=n,n.prototype.jsonID=e,n}}class Oe{constructor(e,n){this.doc=e,this.failed=n}static ok(e){return new Oe(e,null)}static fail(e){return new Oe(null,e)}static fromReplace(e,n,r,i){try{return Oe.ok(e.replace(n,r,i))}catch(a){if(a instanceof Pa)return Oe.fail(a.message);throw a}}}function Ad(t,e,n){let r=[];for(let i=0;i<t.childCount;i++){let a=t.child(i);a.content.size&&(a=a.copy(Ad(a.content,e,a))),a.isInline&&(a=e(a,n,i)),r.push(a)}return z.fromArray(r)}class Jn extends rt{constructor(e,n,r){super(),this.from=e,this.to=n,this.mark=r}apply(e){let n=e.slice(this.from,this.to),r=e.resolve(this.from),i=r.node(r.sharedDepth(this.to)),a=new K(Ad(n.content,(s,o)=>!s.isAtom||!o.type.allowsMarkType(this.mark.type)?s:s.mark(this.mark.addToSet(s.marks)),i),n.openStart,n.openEnd);return Oe.fromReplace(e,this.from,this.to,a)}invert(){return new qt(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new Jn(n.pos,r.pos,this.mark)}merge(e){return e instanceof Jn&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Jn(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,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new Jn(n.from,n.to,e.markFromJSON(n.mark))}}rt.jsonID("addMark",Jn);class qt extends rt{constructor(e,n,r){super(),this.from=e,this.to=n,this.mark=r}apply(e){let n=e.slice(this.from,this.to),r=new K(Ad(n.content,i=>i.mark(this.mark.removeFromSet(i.marks)),e),n.openStart,n.openEnd);return Oe.fromReplace(e,this.from,this.to,r)}invert(){return new Jn(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new qt(n.pos,r.pos,this.mark)}merge(e){return e instanceof qt&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new qt(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,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new qt(n.from,n.to,e.markFromJSON(n.mark))}}rt.jsonID("removeMark",qt);class Kn extends rt{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return Oe.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.addToSet(n.marks));return Oe.fromReplace(e,this.pos,this.pos+1,new K(z.from(r),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);if(n){let r=this.mark.addToSet(n.marks);if(r.length==n.marks.length){for(let i=0;i<n.marks.length;i++)if(!n.marks[i].isInSet(r))return new Kn(this.pos,n.marks[i]);return new Kn(this.pos,this.mark)}}return new Vr(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new Kn(n.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new Kn(n.pos,e.markFromJSON(n.mark))}}rt.jsonID("addNodeMark",Kn);class Vr extends rt{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return Oe.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.removeFromSet(n.marks));return Oe.fromReplace(e,this.pos,this.pos+1,new K(z.from(r),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);return!n||!this.mark.isInSet(n.marks)?this:new Kn(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new Vr(n.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new Vr(n.pos,e.markFromJSON(n.mark))}}rt.jsonID("removeNodeMark",Vr);class De extends rt{constructor(e,n,r,i=!1){super(),this.from=e,this.to=n,this.slice=r,this.structure=i}apply(e){return this.structure&&jc(e,this.from,this.to)?Oe.fail("Structure replace would overwrite content"):Oe.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new yt([this.from,this.to-this.from,this.slice.size])}invert(e){return new De(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let n=e.mapResult(this.to,-1),r=this.from==this.to&&De.MAP_BIAS<0?n:e.mapResult(this.from,1);return r.deletedAcross&&n.deletedAcross?null:new De(r.pos,Math.max(r.pos,n.pos),this.slice,this.structure)}merge(e){if(!(e instanceof De)||e.structure||this.structure)return null;if(this.from+this.slice.size==e.from&&!this.slice.openEnd&&!e.slice.openStart){let n=this.slice.size+e.slice.size==0?K.empty:new K(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new De(this.from,this.to+(e.to-e.from),n,this.structure)}else if(e.to==this.from&&!this.slice.openStart&&!e.slice.openEnd){let n=this.slice.size+e.slice.size==0?K.empty:new K(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new De(e.from,this.to,n,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,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new De(n.from,n.to,K.fromJSON(e,n.slice),!!n.structure)}}De.MAP_BIAS=1;rt.jsonID("replace",De);class He extends rt{constructor(e,n,r,i,a,s,o=!1){super(),this.from=e,this.to=n,this.gapFrom=r,this.gapTo=i,this.slice=a,this.insert=s,this.structure=o}apply(e){if(this.structure&&(jc(e,this.from,this.gapFrom)||jc(e,this.gapTo,this.to)))return Oe.fail("Structure gap-replace would overwrite content");let n=e.slice(this.gapFrom,this.gapTo);if(n.openStart||n.openEnd)return Oe.fail("Gap is not a flat range");let r=this.slice.insertAt(this.insert,n.content);return r?Oe.fromReplace(e,this.from,this.to,r):Oe.fail("Content does not fit in gap")}getMap(){return new yt([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(e){let n=this.gapTo-this.gapFrom;return new He(this.from,this.from+this.slice.size+n,this.from+this.insert,this.from+this.insert+n,e.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1),i=this.from==this.gapFrom?n.pos:e.map(this.gapFrom,-1),a=this.to==this.gapTo?r.pos:e.map(this.gapTo,1);return n.deletedAcross&&r.deletedAcross||i<n.pos||a>r.pos?null:new He(n.pos,r.pos,i,a,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,n){if(typeof n.from!="number"||typeof n.to!="number"||typeof n.gapFrom!="number"||typeof n.gapTo!="number"||typeof n.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new He(n.from,n.to,n.gapFrom,n.gapTo,K.fromJSON(e,n.slice),n.insert,!!n.structure)}}rt.jsonID("replaceAround",He);function jc(t,e,n){let r=t.resolve(e),i=n-e,a=r.depth;for(;i>0&&a>0&&r.indexAfter(a)==r.node(a).childCount;)a--,i--;if(i>0){let s=r.node(a).maybeChild(r.indexAfter(a));for(;i>0;){if(!s||s.isLeaf)return!0;s=s.firstChild,i--}}return!1}function _C(t,e,n,r){let i=[],a=[],s,o;t.doc.nodesBetween(e,n,(f,c,d)=>{if(!f.isInline)return;let u=f.marks;if(!r.isInSet(u)&&d.type.allowsMarkType(r.type)){let h=Math.max(c,e),p=Math.min(c+f.nodeSize,n),m=r.addToSet(u);for(let g=0;g<u.length;g++)u[g].isInSet(m)||(s&&s.to==h&&s.mark.eq(u[g])?s.to=p:i.push(s=new qt(h,p,u[g])));o&&o.to==h?o.to=p:a.push(o=new Jn(h,p,r))}}),i.forEach(f=>t.step(f)),a.forEach(f=>t.step(f))}function $C(t,e,n,r){let i=[],a=0;t.doc.nodesBetween(e,n,(s,o)=>{if(!s.isInline)return;a++;let f=null;if(r instanceof El){let c=s.marks,d;for(;d=r.isInSet(c);)(f||(f=[])).push(d),c=d.removeFromSet(c)}else r?r.isInSet(s.marks)&&(f=[r]):f=s.marks;if(f&&f.length){let c=Math.min(o+s.nodeSize,n);for(let d=0;d<f.length;d++){let u=f[d],h;for(let p=0;p<i.length;p++){let m=i[p];m.step==a-1&&u.eq(i[p].style)&&(h=m)}h?(h.to=c,h.step=a):i.push({style:u,from:Math.max(o,e),to:c,step:a})}}}),i.forEach(s=>t.step(new qt(s.from,s.to,s.style)))}function Ed(t,e,n,r=n.contentMatch,i=!0){let a=t.doc.nodeAt(e),s=[],o=e+1;for(let f=0;f<a.childCount;f++){let c=a.child(f),d=o+c.nodeSize,u=r.matchType(c.type);if(!u)s.push(new De(o,d,K.empty));else{r=u;for(let h=0;h<c.marks.length;h++)n.allowsMarkType(c.marks[h].type)||t.step(new qt(o,d,c.marks[h]));if(i&&c.isText&&n.whitespace!="pre"){let h,p=/\r?\n|\r/g,m;for(;h=p.exec(c.text);)m||(m=new K(z.from(n.schema.text(" ",n.allowedMarks(c.marks))),0,0)),s.push(new De(o+h.index,o+h.index+h[0].length,m))}}o=d}if(!r.validEnd){let f=r.fillBefore(z.empty,!0);t.replace(o,o,new K(f,0,0))}for(let f=s.length-1;f>=0;f--)t.step(s[f])}function e3(t,e,n){return(e==0||t.canReplace(e,t.childCount))&&(n==t.childCount||t.canReplace(0,n))}function Yi(t){let n=t.parent.content.cutByIndex(t.startIndex,t.endIndex);for(let r=t.depth,i=0,a=0;;--r){let s=t.$from.node(r),o=t.$from.index(r)+i,f=t.$to.indexAfter(r)-a;if(r<t.depth&&s.canReplace(o,f,n))return r;if(r==0||s.type.spec.isolating||!e3(s,o,f))break;o&&(i=1),f<s.childCount&&(a=1)}return null}function t3(t,e,n){let{$from:r,$to:i,depth:a}=e,s=r.before(a+1),o=i.after(a+1),f=s,c=o,d=z.empty,u=0;for(let m=a,g=!1;m>n;m--)g||r.index(m)>0?(g=!0,d=z.from(r.node(m).copy(d)),u++):f--;let h=z.empty,p=0;for(let m=a,g=!1;m>n;m--)g||i.after(m+1)<i.end(m)?(g=!0,h=z.from(i.node(m).copy(h)),p++):c++;t.step(new He(f,c,s,o,new K(d.append(h),u,p),d.size-u,!0))}function Td(t,e,n=null,r=t){let i=n3(t,e),a=i&&r3(r,e);return a?i.map(Fh).concat({type:e,attrs:n}).concat(a.map(Fh)):null}function Fh(t){return{type:t,attrs:null}}function n3(t,e){let{parent:n,startIndex:r,endIndex:i}=t,a=n.contentMatchAt(r).findWrapping(e);if(!a)return null;let s=a.length?a[0]:e;return n.canReplaceWith(r,i,s)?a:null}function r3(t,e){let{parent:n,startIndex:r,endIndex:i}=t,a=n.child(r),s=e.contentMatch.findWrapping(a.type);if(!s)return null;let f=(s.length?s[s.length-1]:e).contentMatch;for(let c=r;f&&c<i;c++)f=f.matchType(n.child(c).type);return!f||!f.validEnd?null:s}function i3(t,e,n){let r=z.empty;for(let s=n.length-1;s>=0;s--){if(r.size){let o=n[s].type.contentMatch.matchFragment(r);if(!o||!o.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}r=z.from(n[s].type.create(n[s].attrs,r))}let i=e.start,a=e.end;t.step(new He(i,a,i,a,new K(r,0,0),n.length,!0))}function a3(t,e,n,r,i){if(!r.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let a=t.steps.length;t.doc.nodesBetween(e,n,(s,o)=>{let f=typeof i=="function"?i(s):i;if(s.isTextblock&&!s.hasMarkup(r,f)&&s3(t.doc,t.mapping.slice(a).map(o),r)){let c=null;if(r.schema.linebreakReplacement){let p=r.whitespace=="pre",m=!!r.contentMatch.matchType(r.schema.linebreakReplacement);p&&!m?c=!1:!p&&m&&(c=!0)}c===!1&&Em(t,s,o,a),Ed(t,t.mapping.slice(a).map(o,1),r,void 0,c===null);let d=t.mapping.slice(a),u=d.map(o,1),h=d.map(o+s.nodeSize,1);return t.step(new He(u,h,u+1,h-1,new K(z.from(r.create(f,null,s.marks)),0,0),1,!0)),c===!0&&Am(t,s,o,a),!1}})}function Am(t,e,n,r){e.forEach((i,a)=>{if(i.isText){let s,o=/\r?\n|\r/g;for(;s=o.exec(i.text);){let f=t.mapping.slice(r).map(n+1+a+s.index);t.replaceWith(f,f+1,e.type.schema.linebreakReplacement.create())}}})}function Em(t,e,n,r){e.forEach((i,a)=>{if(i.type==i.type.schema.linebreakReplacement){let s=t.mapping.slice(r).map(n+1+a);t.replaceWith(s,s+1,e.type.schema.text(`
|