randmarcomps 1.634.0 → 1.635.0

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.
@@ -62064,6 +62064,7 @@ const AlertDialogCancel = React.forwardRef(({ className: e, ...t }, n) => /* @__
62064
62064
  }
62065
62065
  ));
62066
62066
  AlertDialogCancel.displayName = Cancel.displayName;
62067
+ const MOBILE_ASSISTANT_URL = "https://assistant.randmar.io";
62067
62068
  function parseDate(e) {
62068
62069
  if (e == null) return null;
62069
62070
  const t = e instanceof Date ? e : new Date(e);
@@ -62111,8 +62112,8 @@ function RefreshCluster({
62111
62112
  }
62112
62113
  }
62113
62114
  }, [A, d, rt, n, t]);
62114
- return /* @__PURE__ */ jsxs("div", { className: cn("flex flex-wrap items-center justify-end gap-2", c), children: [
62115
- /* @__PURE__ */ jsxs("p", { className: "text-xs text-muted-foreground sm:text-sm", children: [
62115
+ return /* @__PURE__ */ jsxs("div", { className: cn("flex w-full flex-wrap items-center justify-start gap-2 lg:w-auto lg:justify-end", c), children: [
62116
+ /* @__PURE__ */ jsxs("p", { className: "w-full text-xs text-muted-foreground sm:text-sm lg:w-auto", children: [
62116
62117
  "Last refresh:",
62117
62118
  " ",
62118
62119
  /* @__PURE__ */ jsx("span", { className: "font-medium text-foreground", children: formatLastRefresh(ot) })
@@ -62131,12 +62132,34 @@ function RefreshCluster({
62131
62132
  ]
62132
62133
  }
62133
62134
  ),
62135
+ /* @__PURE__ */ jsx(
62136
+ Button$1,
62137
+ {
62138
+ asChild: !0,
62139
+ variant: "default",
62140
+ className: cn("min-h-11 lg:hidden", d && "pointer-events-none opacity-50"),
62141
+ children: /* @__PURE__ */ jsxs(
62142
+ "a",
62143
+ {
62144
+ href: MOBILE_ASSISTANT_URL,
62145
+ target: "_blank",
62146
+ rel: "noopener noreferrer",
62147
+ "aria-disabled": d || void 0,
62148
+ onClick: d ? (at) => at.preventDefault() : void 0,
62149
+ children: [
62150
+ /* @__PURE__ */ jsx(Bot, { className: "h-4 w-4", "aria-hidden": "true" }),
62151
+ /* @__PURE__ */ jsx("span", { children: l })
62152
+ ]
62153
+ }
62154
+ )
62155
+ }
62156
+ ),
62134
62157
  /* @__PURE__ */ jsxs(
62135
62158
  Button$1,
62136
62159
  {
62137
62160
  type: "button",
62138
62161
  variant: "default",
62139
- className: "min-h-11",
62162
+ className: "hidden min-h-11 lg:inline-flex",
62140
62163
  disabled: d,
62141
62164
  onClick: o,
62142
62165
  children: [
@@ -520,7 +520,7 @@ You can add a description to the \`${CONTENT_NAME$2}\` by passing a \`${DESCRIPT
520
520
 
521
521
  Alternatively, you can use your own component as a description by assigning it an \`id\` and passing the same value to the \`aria-describedby\` prop in \`${CONTENT_NAME$2}\`. If the description is confusing or duplicative for sighted users, you can use the \`@radix-ui/react-visually-hidden\` primitive as a wrapper around your description component.
522
522
 
523
- For more information, see https://radix-ui.com/primitives/docs/components/alert-dialog`;return React__namespace.useEffect(()=>{document.getElementById(e.current?.getAttribute("aria-describedby"))||console.warn(t)},[t,e]),null},Root2$1=AlertDialog$1,Trigger2$1=AlertDialogTrigger$1,Portal2=AlertDialogPortal$1,Overlay2=AlertDialogOverlay$1,Content2$1=AlertDialogContent$1,Action=AlertDialogAction$1,Cancel=AlertDialogCancel$1,Title2=AlertDialogTitle$1,Description2=AlertDialogDescription$1;const AlertDialog=Root2$1,AlertDialogTrigger=Trigger2$1,AlertDialogPortal=Portal2,AlertDialogOverlay=React__namespace.forwardRef(({className:e,...t},n)=>jsxRuntime.jsx(Overlay2,{className:cn("fixed inset-0 z-50 bg-foreground/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...t,ref:n}));AlertDialogOverlay.displayName=Overlay2.displayName;const AlertDialogContent=React__namespace.forwardRef(({className:e,...t},n)=>jsxRuntime.jsxs(AlertDialogPortal,{children:[jsxRuntime.jsx(AlertDialogOverlay,{}),jsxRuntime.jsx(Content2$1,{ref:n,className:cn("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",e),...t})]}));AlertDialogContent.displayName=Content2$1.displayName;const AlertDialogHeader=({className:e,...t})=>jsxRuntime.jsx("div",{className:cn("flex flex-col space-y-2 text-center sm:text-left",e),...t});AlertDialogHeader.displayName="AlertDialogHeader";const AlertDialogFooter=({className:e,...t})=>jsxRuntime.jsx("div",{className:cn("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t});AlertDialogFooter.displayName="AlertDialogFooter";const AlertDialogTitle=React__namespace.forwardRef(({className:e,...t},n)=>jsxRuntime.jsx(Title2,{ref:n,className:cn("text-lg font-semibold",e),...t}));AlertDialogTitle.displayName=Title2.displayName;const AlertDialogDescription=React__namespace.forwardRef(({className:e,...t},n)=>jsxRuntime.jsx(Description2,{ref:n,className:cn("text-sm text-muted-foreground",e),...t}));AlertDialogDescription.displayName=Description2.displayName;const AlertDialogAction=React__namespace.forwardRef(({className:e,...t},n)=>jsxRuntime.jsx(Action,{ref:n,className:cn(buttonVariants(),e),...t}));AlertDialogAction.displayName=Action.displayName;const AlertDialogCancel=React__namespace.forwardRef(({className:e,...t},n)=>jsxRuntime.jsx(Cancel,{ref:n,className:cn(buttonVariants({variant:"outline"}),"mt-2 sm:mt-0",e),...t}));AlertDialogCancel.displayName=Cancel.displayName;function parseDate(e){if(e==null)return null;const t=e instanceof Date?e:new Date(e);return Number.isNaN(t.getTime())?null:t}function formatLastRefresh(e){const t=parseDate(e);if(!t)return"Never";const n=new Date;return t.getFullYear()===n.getFullYear()&&t.getMonth()===n.getMonth()&&t.getDate()===n.getDate()?`Today at ${new Intl.DateTimeFormat(void 0,{hour:"numeric",minute:"2-digit",timeZoneName:"short"}).format(t)}`:new Intl.DateTimeFormat(void 0,{month:"short",day:"numeric",year:"numeric",hour:"numeric",minute:"2-digit",timeZoneName:"short"}).format(t)}function RefreshCluster({lastRefreshAt:e,onRefresh:t,onProgressiveRefresh:n,onAssistantClick:s,isRefreshing:a=!1,refreshLabel:o="Refresh",assistantLabel:l="Assistant",className:c,disabled:d=!1}){const[f,R]=React__namespace.useState(!1),[S,te]=React__namespace.useState(e);React__namespace.useEffect(()=>{te(e)},[e]);const A=!!(t||n),rt=a||f,st=e??S,it=React__namespace.useCallback(async()=>{if(!(!A||d||rt)){R(!0);try{n?(await n(!1),await n(!0)):await t?.(),te(new Date)}finally{R(!1)}}},[A,d,rt,n,t]);return jsxRuntime.jsxs("div",{className:cn("flex flex-wrap items-center justify-end gap-2",c),children:[jsxRuntime.jsxs("p",{className:"text-xs text-muted-foreground sm:text-sm",children:["Last refresh:"," ",jsxRuntime.jsx("span",{className:"font-medium text-foreground",children:formatLastRefresh(st)})]}),jsxRuntime.jsxs(Button$1,{type:"button",variant:"outline",className:"min-h-11",disabled:d||rt||!A,onClick:it,children:[rt?jsxRuntime.jsx(LoaderCircle,{className:"h-4 w-4 animate-spin","aria-hidden":"true"}):jsxRuntime.jsx(RefreshCw,{className:"h-4 w-4","aria-hidden":"true"}),jsxRuntime.jsx("span",{children:o})]}),jsxRuntime.jsxs(Button$1,{type:"button",variant:"default",className:"min-h-11",disabled:d,onClick:s,children:[jsxRuntime.jsx(Bot,{className:"h-4 w-4","aria-hidden":"true"}),jsxRuntime.jsx("span",{children:l})]})]})}function DataRefreshAssistantCluster({onAssistantClick:e,assistantPromptOptions:t,onAssistantUnavailable:n,...s}){const a=useOptionalChat(),o=React__namespace.useCallback(()=>{if(e){e();return}if(t){if(!a){n?.();return}a.sendMessageWithClear(t.prompt,t.hiddenPrompt,t.sopID)||n?.();return}n?.()},[t,a,e,n]);return jsxRuntime.jsx(RefreshCluster,{...s,onAssistantClick:o})}const fullBleedClassName="w-full max-w-none w-[100cqw] ml-[calc(50%-50cqw)] mr-[calc(50%-50cqw)]",rowInlinePaddingClassName="px-4 lg:px-6",primaryRowPaddingClassName=`${rowInlinePaddingClassName} py-4`,secondaryRowPaddingClassName=`${rowInlinePaddingClassName} py-3`;function RmPageHeaderBreadcrumbLink({item:e,isCurrent:t}){return!t&&e.href?jsxRuntime.jsx("a",{href:e.href,className:"text-xs font-medium text-muted-foreground underline-offset-4 transition-colors hover:text-foreground hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",children:e.label}):!t&&e.onClick?jsxRuntime.jsx("button",{type:"button",className:"text-xs font-medium text-muted-foreground underline-offset-4 transition-colors hover:text-foreground hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",onClick:e.onClick,children:e.label}):jsxRuntime.jsx("span",{"aria-current":t?"page":void 0,className:cn("text-xs font-medium",t?"text-foreground":"text-muted-foreground"),children:e.label})}function RmPageHeaderBreadcrumbs({items:e}){return e.length===0?null:jsxRuntime.jsx("nav",{"aria-label":"Breadcrumb",className:"w-full",children:jsxRuntime.jsx("ol",{className:"flex flex-wrap items-center gap-1.5",children:e.map((t,n)=>{const s=n===e.length-1,a=t.key??`${String(t.label)}-${n}`;return jsxRuntime.jsxs("li",{className:"inline-flex items-center gap-1.5",children:[jsxRuntime.jsx(RmPageHeaderBreadcrumbLink,{item:t,isCurrent:!!t.current||s}),s?null:jsxRuntime.jsx("span",{"aria-hidden":"true",className:"text-xs text-muted-foreground",children:"/"})]},a)})})})}function RmPageHeader({title:e,subtitle:t,breadcrumbs:n,rightTopActions:s,rightBottomActions:a,secondaryRow:o,sticky:l=!1,stickyClassName:c,className:d,cardClassName:f,contentClassName:R}){const S=!!(s||a),te=jsxRuntime.jsxs("header",{className:cn("w-full border-b border-border bg-background",d),children:[jsxRuntime.jsx("div",{className:cn(primaryRowPaddingClassName,f),children:jsxRuntime.jsxs("div",{className:cn("flex flex-col gap-3 lg:flex-row lg:items-start lg:justify-between",R),children:[jsxRuntime.jsxs("div",{className:"space-y-1",children:[n?.length?jsxRuntime.jsx(RmPageHeaderBreadcrumbs,{items:n}):null,jsxRuntime.jsx("h1",{className:"text-2xl font-semibold leading-tight tracking-tight text-foreground",children:e}),t?jsxRuntime.jsx("p",{className:"text-sm text-muted-foreground",children:t}):null]}),S?jsxRuntime.jsxs("div",{className:"flex w-full flex-col items-start gap-2 lg:w-auto lg:min-w-[16rem] lg:items-end",children:[s?jsxRuntime.jsx("div",{className:"flex w-full flex-wrap items-center justify-start gap-2 lg:justify-end",children:s}):null,a?jsxRuntime.jsx("div",{className:"flex w-full flex-wrap items-center justify-start gap-2 lg:justify-end",children:a}):null]}):null]})}),o?jsxRuntime.jsx("div",{className:"border-t border-border bg-primary/5",children:jsxRuntime.jsx("div",{className:secondaryRowPaddingClassName,children:o})}):null]});return l?jsxRuntime.jsx("div",{className:fullBleedClassName,children:jsxRuntime.jsx("div",{className:cn("sticky top-0 z-20",c),children:te})}):jsxRuntime.jsx("div",{className:fullBleedClassName,children:te})}function PageHeader({title:e,children:t,className:n}){return jsxRuntime.jsx(RmPageHeader,{title:e,rightBottomActions:t?jsxRuntime.jsx("div",{className:"flex shrink-0 flex-wrap items-center gap-2",children:t}):void 0,cardClassName:n})}const PARTNER_PAGE_SHELL_STACK_CLASS_NAME="space-y-8",PARTNER_PAGE_SHELL_CONTENT_CLASS_NAME="px-4 py-4 sm:px-6 sm:py-6";function PartnerPageShell({header:e,children:t,className:n,contentClassName:s,contentProps:a,...o}){return jsxRuntime.jsxs("section",{className:cn(PARTNER_PAGE_SHELL_STACK_CLASS_NAME,n),...o,children:[e,jsxRuntime.jsx("div",{className:cn(PARTNER_PAGE_SHELL_CONTENT_CLASS_NAME,s),...a,children:t})]})}function RmBodyZone({className:e,children:t,...n}){return jsxRuntime.jsx("section",{className:cn("px-4 py-4 sm:px-6 sm:py-6",e),...n,children:t})}function OrderedMap(e){this.content=e}OrderedMap.prototype={constructor:OrderedMap,find:function(e){for(var t=0;t<this.content.length;t+=2)if(this.content[t]===e)return t;return-1},get:function(e){var t=this.find(e);return t==-1?void 0:this.content[t+1]},update:function(e,t,n){var s=n&&n!=e?this.remove(n):this,a=s.find(e),o=s.content.slice();return a==-1?o.push(n||e,t):(o[a+1]=t,n&&(o[a]=n)),new OrderedMap(o)},remove:function(e){var t=this.find(e);if(t==-1)return this;var n=this.content.slice();return n.splice(t,2),new OrderedMap(n)},addToStart:function(e,t){return new OrderedMap([e,t].concat(this.remove(e).content))},addToEnd:function(e,t){var n=this.remove(e).content.slice();return n.push(e,t),new OrderedMap(n)},addBefore:function(e,t,n){var s=this.remove(t),a=s.content.slice(),o=s.find(e);return a.splice(o==-1?a.length:o,0,t,n),new OrderedMap(a)},forEach:function(e){for(var t=0;t<this.content.length;t+=2)e(this.content[t],this.content[t+1])},prepend:function(e){return e=OrderedMap.from(e),e.size?new OrderedMap(e.content.concat(this.subtract(e).content)):this},append:function(e){return e=OrderedMap.from(e),e.size?new OrderedMap(this.subtract(e).content.concat(e.content)):this},subtract:function(e){var t=this;e=OrderedMap.from(e);for(var n=0;n<e.content.length;n+=2)t=t.remove(e.content[n]);return t},toObject:function(){var e={};return this.forEach(function(t,n){e[t]=n}),e},get size(){return this.content.length>>1}},OrderedMap.from=function(e){if(e instanceof OrderedMap)return e;var t=[];if(e)for(var n in e)t.push(n,e[n]);return new OrderedMap(t)};function findDiffStart(e,t,n){for(let s=0;;s++){if(s==e.childCount||s==t.childCount)return e.childCount==t.childCount?null:n;let a=e.child(s),o=t.child(s);if(a==o){n+=a.nodeSize;continue}if(!a.sameMarkup(o))return n;if(a.isText&&a.text!=o.text){for(let l=0;a.text[l]==o.text[l];l++)n++;return n}if(a.content.size||o.content.size){let l=findDiffStart(a.content,o.content,n+1);if(l!=null)return l}n+=a.nodeSize}}function findDiffEnd(e,t,n,s){for(let a=e.childCount,o=t.childCount;;){if(a==0||o==0)return a==o?null:{a:n,b:s};let l=e.child(--a),c=t.child(--o),d=l.nodeSize;if(l==c){n-=d,s-=d;continue}if(!l.sameMarkup(c))return{a:n,b:s};if(l.isText&&l.text!=c.text){let f=0,R=Math.min(l.text.length,c.text.length);for(;f<R&&l.text[l.text.length-f-1]==c.text[c.text.length-f-1];)f++,n--,s--;return{a:n,b:s}}if(l.content.size||c.content.size){let f=findDiffEnd(l.content,c.content,n-1,s-1);if(f)return f}n-=d,s-=d}}class Fragment{constructor(t,n){if(this.content=t,this.size=n||0,n==null)for(let s=0;s<t.length;s++)this.size+=t[s].nodeSize}nodesBetween(t,n,s,a=0,o){for(let l=0,c=0;c<n;l++){let d=this.content[l],f=c+d.nodeSize;if(f>t&&s(d,a+c,o||null,l)!==!1&&d.content.size){let R=c+1;d.nodesBetween(Math.max(0,t-R),Math.min(d.content.size,n-R),s,a+R)}c=f}}descendants(t){this.nodesBetween(0,this.size,t)}textBetween(t,n,s,a){let o="",l=!0;return this.nodesBetween(t,n,(c,d)=>{let f=c.isText?c.text.slice(Math.max(t,d)-d,n-d):c.isLeaf?a?typeof a=="function"?a(c):a:c.type.spec.leafText?c.type.spec.leafText(c):"":"";c.isBlock&&(c.isLeaf&&f||c.isTextblock)&&s&&(l?l=!1:o+=s),o+=f},0),o}append(t){if(!t.size)return this;if(!this.size)return t;let n=this.lastChild,s=t.firstChild,a=this.content.slice(),o=0;for(n.isText&&n.sameMarkup(s)&&(a[a.length-1]=n.withText(n.text+s.text),o=1);o<t.content.length;o++)a.push(t.content[o]);return new Fragment(a,this.size+t.size)}cut(t,n=this.size){if(t==0&&n==this.size)return this;let s=[],a=0;if(n>t)for(let o=0,l=0;l<n;o++){let c=this.content[o],d=l+c.nodeSize;d>t&&((l<t||d>n)&&(c.isText?c=c.cut(Math.max(0,t-l),Math.min(c.text.length,n-l)):c=c.cut(Math.max(0,t-l-1),Math.min(c.content.size,n-l-1))),s.push(c),a+=c.nodeSize),l=d}return new Fragment(s,a)}cutByIndex(t,n){return t==n?Fragment.empty:t==0&&n==this.content.length?this:new Fragment(this.content.slice(t,n))}replaceChild(t,n){let s=this.content[t];if(s==n)return this;let a=this.content.slice(),o=this.size+n.nodeSize-s.nodeSize;return a[t]=n,new Fragment(a,o)}addToStart(t){return new Fragment([t].concat(this.content),this.size+t.nodeSize)}addToEnd(t){return new Fragment(this.content.concat(t),this.size+t.nodeSize)}eq(t){if(this.content.length!=t.content.length)return!1;for(let n=0;n<this.content.length;n++)if(!this.content[n].eq(t.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(t){let n=this.content[t];if(!n)throw new RangeError("Index "+t+" out of range for "+this);return n}maybeChild(t){return this.content[t]||null}forEach(t){for(let n=0,s=0;n<this.content.length;n++){let a=this.content[n];t(a,s,n),s+=a.nodeSize}}findDiffStart(t,n=0){return findDiffStart(this,t,n)}findDiffEnd(t,n=this.size,s=t.size){return findDiffEnd(this,t,n,s)}findIndex(t){if(t==0)return retIndex(0,t);if(t==this.size)return retIndex(this.content.length,t);if(t>this.size||t<0)throw new RangeError(`Position ${t} outside of fragment (${this})`);for(let n=0,s=0;;n++){let a=this.child(n),o=s+a.nodeSize;if(o>=t)return o==t?retIndex(n+1,o):retIndex(n,s);s=o}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(t=>t.toJSON()):null}static fromJSON(t,n){if(!n)return Fragment.empty;if(!Array.isArray(n))throw new RangeError("Invalid input for Fragment.fromJSON");return new Fragment(n.map(t.nodeFromJSON))}static fromArray(t){if(!t.length)return Fragment.empty;let n,s=0;for(let a=0;a<t.length;a++){let o=t[a];s+=o.nodeSize,a&&o.isText&&t[a-1].sameMarkup(o)?(n||(n=t.slice(0,a)),n[n.length-1]=o.withText(n[n.length-1].text+o.text)):n&&n.push(o)}return new Fragment(n||t,s)}static from(t){if(!t)return Fragment.empty;if(t instanceof Fragment)return t;if(Array.isArray(t))return this.fromArray(t);if(t.attrs)return new Fragment([t],t.nodeSize);throw new RangeError("Can not convert "+t+" to a Fragment"+(t.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}Fragment.empty=new Fragment([],0);const found={index:0,offset:0};function retIndex(e,t){return found.index=e,found.offset=t,found}function compareDeep(e,t){if(e===t)return!0;if(!(e&&typeof e=="object")||!(t&&typeof t=="object"))return!1;let n=Array.isArray(e);if(Array.isArray(t)!=n)return!1;if(n){if(e.length!=t.length)return!1;for(let s=0;s<e.length;s++)if(!compareDeep(e[s],t[s]))return!1}else{for(let s in e)if(!(s in t)||!compareDeep(e[s],t[s]))return!1;for(let s in t)if(!(s in e))return!1}return!0}let Mark$1=class Vn{constructor(t,n){this.type=t,this.attrs=n}addToSet(t){let n,s=!1;for(let a=0;a<t.length;a++){let o=t[a];if(this.eq(o))return t;if(this.type.excludes(o.type))n||(n=t.slice(0,a));else{if(o.type.excludes(this.type))return t;!s&&o.type.rank>this.type.rank&&(n||(n=t.slice(0,a)),n.push(this),s=!0),n&&n.push(o)}}return n||(n=t.slice()),s||n.push(this),n}removeFromSet(t){for(let n=0;n<t.length;n++)if(this.eq(t[n]))return t.slice(0,n).concat(t.slice(n+1));return t}isInSet(t){for(let n=0;n<t.length;n++)if(this.eq(t[n]))return!0;return!1}eq(t){return this==t||this.type==t.type&&compareDeep(this.attrs,t.attrs)}toJSON(){let t={type:this.type.name};for(let n in this.attrs){t.attrs=this.attrs;break}return t}static fromJSON(t,n){if(!n)throw new RangeError("Invalid input for Mark.fromJSON");let s=t.marks[n.type];if(!s)throw new RangeError(`There is no mark type ${n.type} in this schema`);let a=s.create(n.attrs);return s.checkAttrs(a.attrs),a}static sameSet(t,n){if(t==n)return!0;if(t.length!=n.length)return!1;for(let s=0;s<t.length;s++)if(!t[s].eq(n[s]))return!1;return!0}static setFrom(t){if(!t||Array.isArray(t)&&t.length==0)return Vn.none;if(t instanceof Vn)return[t];let n=t.slice();return n.sort((s,a)=>s.type.rank-a.type.rank),n}};Mark$1.none=[];class ReplaceError extends Error{}class Slice{constructor(t,n,s){this.content=t,this.openStart=n,this.openEnd=s}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(t,n){let s=insertInto(this.content,t+this.openStart,n);return s&&new Slice(s,this.openStart,this.openEnd)}removeBetween(t,n){return new Slice(removeRange(this.content,t+this.openStart,n+this.openStart),this.openStart,this.openEnd)}eq(t){return this.content.eq(t.content)&&this.openStart==t.openStart&&this.openEnd==t.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let t={content:this.content.toJSON()};return this.openStart>0&&(t.openStart=this.openStart),this.openEnd>0&&(t.openEnd=this.openEnd),t}static fromJSON(t,n){if(!n)return Slice.empty;let s=n.openStart||0,a=n.openEnd||0;if(typeof s!="number"||typeof a!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new Slice(Fragment.fromJSON(t,n.content),s,a)}static maxOpen(t,n=!0){let s=0,a=0;for(let o=t.firstChild;o&&!o.isLeaf&&(n||!o.type.spec.isolating);o=o.firstChild)s++;for(let o=t.lastChild;o&&!o.isLeaf&&(n||!o.type.spec.isolating);o=o.lastChild)a++;return new Slice(t,s,a)}}Slice.empty=new Slice(Fragment.empty,0,0);function removeRange(e,t,n){let{index:s,offset:a}=e.findIndex(t),o=e.maybeChild(s),{index:l,offset:c}=e.findIndex(n);if(a==t||o.isText){if(c!=n&&!e.child(l).isText)throw new RangeError("Removing non-flat range");return e.cut(0,t).append(e.cut(n))}if(s!=l)throw new RangeError("Removing non-flat range");return e.replaceChild(s,o.copy(removeRange(o.content,t-a-1,n-a-1)))}function insertInto(e,t,n,s){let{index:a,offset:o}=e.findIndex(t),l=e.maybeChild(a);if(o==t||l.isText)return s&&!s.canReplace(a,a,n)?null:e.cut(0,t).append(n).append(e.cut(t));let c=insertInto(l.content,t-o-1,n,l);return c&&e.replaceChild(a,l.copy(c))}function replace(e,t,n){if(n.openStart>e.depth)throw new ReplaceError("Inserted content deeper than insertion position");if(e.depth-n.openStart!=t.depth-n.openEnd)throw new ReplaceError("Inconsistent open depths");return replaceOuter(e,t,n,0)}function replaceOuter(e,t,n,s){let a=e.index(s),o=e.node(s);if(a==t.index(s)&&s<e.depth-n.openStart){let l=replaceOuter(e,t,n,s+1);return o.copy(o.content.replaceChild(a,l))}else if(n.content.size)if(!n.openStart&&!n.openEnd&&e.depth==s&&t.depth==s){let l=e.parent,c=l.content;return close(l,c.cut(0,e.parentOffset).append(n.content).append(c.cut(t.parentOffset)))}else{let{start:l,end:c}=prepareSliceForReplace(n,e);return close(o,replaceThreeWay(e,l,c,t,s))}else return close(o,replaceTwoWay(e,t,s))}function checkJoin(e,t){if(!t.type.compatibleContent(e.type))throw new ReplaceError("Cannot join "+t.type.name+" onto "+e.type.name)}function joinable$1(e,t,n){let s=e.node(n);return checkJoin(s,t.node(n)),s}function addNode(e,t){let n=t.length-1;n>=0&&e.isText&&e.sameMarkup(t[n])?t[n]=e.withText(t[n].text+e.text):t.push(e)}function addRange(e,t,n,s){let a=(t||e).node(n),o=0,l=t?t.index(n):a.childCount;e&&(o=e.index(n),e.depth>n?o++:e.textOffset&&(addNode(e.nodeAfter,s),o++));for(let c=o;c<l;c++)addNode(a.child(c),s);t&&t.depth==n&&t.textOffset&&addNode(t.nodeBefore,s)}function close(e,t){return e.type.checkContent(t),e.copy(t)}function replaceThreeWay(e,t,n,s,a){let o=e.depth>a&&joinable$1(e,t,a+1),l=s.depth>a&&joinable$1(n,s,a+1),c=[];return addRange(null,e,a,c),o&&l&&t.index(a)==n.index(a)?(checkJoin(o,l),addNode(close(o,replaceThreeWay(e,t,n,s,a+1)),c)):(o&&addNode(close(o,replaceTwoWay(e,t,a+1)),c),addRange(t,n,a,c),l&&addNode(close(l,replaceTwoWay(n,s,a+1)),c)),addRange(s,null,a,c),new Fragment(c)}function replaceTwoWay(e,t,n){let s=[];if(addRange(null,e,n,s),e.depth>n){let a=joinable$1(e,t,n+1);addNode(close(a,replaceTwoWay(e,t,n+1)),s)}return addRange(t,null,n,s),new Fragment(s)}function prepareSliceForReplace(e,t){let n=t.depth-e.openStart,a=t.node(n).copy(e.content);for(let o=n-1;o>=0;o--)a=t.node(o).copy(Fragment.from(a));return{start:a.resolveNoCache(e.openStart+n),end:a.resolveNoCache(a.content.size-e.openEnd-n)}}class ResolvedPos{constructor(t,n,s){this.pos=t,this.path=n,this.parentOffset=s,this.depth=n.length/3-1}resolveDepth(t){return t==null?this.depth:t<0?this.depth+t:t}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(t){return this.path[this.resolveDepth(t)*3]}index(t){return this.path[this.resolveDepth(t)*3+1]}indexAfter(t){return t=this.resolveDepth(t),this.index(t)+(t==this.depth&&!this.textOffset?0:1)}start(t){return t=this.resolveDepth(t),t==0?0:this.path[t*3-1]+1}end(t){return t=this.resolveDepth(t),this.start(t)+this.node(t).content.size}before(t){if(t=this.resolveDepth(t),!t)throw new RangeError("There is no position before the top-level node");return t==this.depth+1?this.pos:this.path[t*3-1]}after(t){if(t=this.resolveDepth(t),!t)throw new RangeError("There is no position after the top-level node");return t==this.depth+1?this.pos:this.path[t*3-1]+this.path[t*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let t=this.parent,n=this.index(this.depth);if(n==t.childCount)return null;let s=this.pos-this.path[this.path.length-1],a=t.child(n);return s?t.child(n).cut(s):a}get nodeBefore(){let t=this.index(this.depth),n=this.pos-this.path[this.path.length-1];return n?this.parent.child(t).cut(0,n):t==0?null:this.parent.child(t-1)}posAtIndex(t,n){n=this.resolveDepth(n);let s=this.path[n*3],a=n==0?0:this.path[n*3-1]+1;for(let o=0;o<t;o++)a+=s.child(o).nodeSize;return a}marks(){let t=this.parent,n=this.index();if(t.content.size==0)return Mark$1.none;if(this.textOffset)return t.child(n).marks;let s=t.maybeChild(n-1),a=t.maybeChild(n);if(!s){let c=s;s=a,a=c}let o=s.marks;for(var l=0;l<o.length;l++)o[l].type.spec.inclusive===!1&&(!a||!o[l].isInSet(a.marks))&&(o=o[l--].removeFromSet(o));return o}marksAcross(t){let n=this.parent.maybeChild(this.index());if(!n||!n.isInline)return null;let s=n.marks,a=t.parent.maybeChild(t.index());for(var o=0;o<s.length;o++)s[o].type.spec.inclusive===!1&&(!a||!s[o].isInSet(a.marks))&&(s=s[o--].removeFromSet(s));return s}sharedDepth(t){for(let n=this.depth;n>0;n--)if(this.start(n)<=t&&this.end(n)>=t)return n;return 0}blockRange(t=this,n){if(t.pos<this.pos)return t.blockRange(this);for(let s=this.depth-(this.parent.inlineContent||this.pos==t.pos?1:0);s>=0;s--)if(t.pos<=this.end(s)&&(!n||n(this.node(s))))return new NodeRange(this,t,s);return null}sameParent(t){return this.pos-this.parentOffset==t.pos-t.parentOffset}max(t){return t.pos>this.pos?t:this}min(t){return t.pos<this.pos?t:this}toString(){let t="";for(let n=1;n<=this.depth;n++)t+=(t?"/":"")+this.node(n).type.name+"_"+this.index(n-1);return t+":"+this.parentOffset}static resolve(t,n){if(!(n>=0&&n<=t.content.size))throw new RangeError("Position "+n+" out of range");let s=[],a=0,o=n;for(let l=t;;){let{index:c,offset:d}=l.content.findIndex(o),f=o-d;if(s.push(l,c,a+d),!f||(l=l.child(c),l.isText))break;o=f-1,a+=d+1}return new ResolvedPos(n,s,o)}static resolveCached(t,n){let s=resolveCache.get(t);if(s)for(let o=0;o<s.elts.length;o++){let l=s.elts[o];if(l.pos==n)return l}else resolveCache.set(t,s=new ResolveCache);let a=s.elts[s.i]=ResolvedPos.resolve(t,n);return s.i=(s.i+1)%resolveCacheSize,a}}class ResolveCache{constructor(){this.elts=[],this.i=0}}const resolveCacheSize=12,resolveCache=new WeakMap;class NodeRange{constructor(t,n,s){this.$from=t,this.$to=n,this.depth=s}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 emptyAttrs=Object.create(null);let Node$1=class zn{constructor(t,n,s,a=Mark$1.none){this.type=t,this.attrs=n,this.marks=a,this.content=s||Fragment.empty}get children(){return this.content.content}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(t){return this.content.child(t)}maybeChild(t){return this.content.maybeChild(t)}forEach(t){this.content.forEach(t)}nodesBetween(t,n,s,a=0){this.content.nodesBetween(t,n,s,a,this)}descendants(t){this.nodesBetween(0,this.content.size,t)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,"")}textBetween(t,n,s,a){return this.content.textBetween(t,n,s,a)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(t){return this==t||this.sameMarkup(t)&&this.content.eq(t.content)}sameMarkup(t){return this.hasMarkup(t.type,t.attrs,t.marks)}hasMarkup(t,n,s){return this.type==t&&compareDeep(this.attrs,n||t.defaultAttrs||emptyAttrs)&&Mark$1.sameSet(this.marks,s||Mark$1.none)}copy(t=null){return t==this.content?this:new zn(this.type,this.attrs,t,this.marks)}mark(t){return t==this.marks?this:new zn(this.type,this.attrs,this.content,t)}cut(t,n=this.content.size){return t==0&&n==this.content.size?this:this.copy(this.content.cut(t,n))}slice(t,n=this.content.size,s=!1){if(t==n)return Slice.empty;let a=this.resolve(t),o=this.resolve(n),l=s?0:a.sharedDepth(n),c=a.start(l),f=a.node(l).content.cut(a.pos-c,o.pos-c);return new Slice(f,a.depth-l,o.depth-l)}replace(t,n,s){return replace(this.resolve(t),this.resolve(n),s)}nodeAt(t){for(let n=this;;){let{index:s,offset:a}=n.content.findIndex(t);if(n=n.maybeChild(s),!n)return null;if(a==t||n.isText)return n;t-=a+1}}childAfter(t){let{index:n,offset:s}=this.content.findIndex(t);return{node:this.content.maybeChild(n),index:n,offset:s}}childBefore(t){if(t==0)return{node:null,index:0,offset:0};let{index:n,offset:s}=this.content.findIndex(t);if(s<t)return{node:this.content.child(n),index:n,offset:s};let a=this.content.child(n-1);return{node:a,index:n-1,offset:s-a.nodeSize}}resolve(t){return ResolvedPos.resolveCached(this,t)}resolveNoCache(t){return ResolvedPos.resolve(this,t)}rangeHasMark(t,n,s){let a=!1;return n>t&&this.nodesBetween(t,n,o=>(s.isInSet(o.marks)&&(a=!0),!a)),a}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 t=this.type.name;return this.content.size&&(t+="("+this.content.toStringInner()+")"),wrapMarks(this.marks,t)}contentMatchAt(t){let n=this.type.contentMatch.matchFragment(this.content,0,t);if(!n)throw new Error("Called contentMatchAt on a node with invalid content");return n}canReplace(t,n,s=Fragment.empty,a=0,o=s.childCount){let l=this.contentMatchAt(t).matchFragment(s,a,o),c=l&&l.matchFragment(this.content,n);if(!c||!c.validEnd)return!1;for(let d=a;d<o;d++)if(!this.type.allowsMarks(s.child(d).marks))return!1;return!0}canReplaceWith(t,n,s,a){if(a&&!this.type.allowsMarks(a))return!1;let o=this.contentMatchAt(t).matchType(s),l=o&&o.matchFragment(this.content,n);return l?l.validEnd:!1}canAppend(t){return t.content.size?this.canReplace(this.childCount,this.childCount,t.content):this.type.compatibleContent(t.type)}check(){this.type.checkContent(this.content),this.type.checkAttrs(this.attrs);let t=Mark$1.none;for(let n=0;n<this.marks.length;n++){let s=this.marks[n];s.type.checkAttrs(s.attrs),t=s.addToSet(t)}if(!Mark$1.sameSet(t,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 t={type:this.type.name};for(let n in this.attrs){t.attrs=this.attrs;break}return this.content.size&&(t.content=this.content.toJSON()),this.marks.length&&(t.marks=this.marks.map(n=>n.toJSON())),t}static fromJSON(t,n){if(!n)throw new RangeError("Invalid input for Node.fromJSON");let s;if(n.marks){if(!Array.isArray(n.marks))throw new RangeError("Invalid mark data for Node.fromJSON");s=n.marks.map(t.markFromJSON)}if(n.type=="text"){if(typeof n.text!="string")throw new RangeError("Invalid text node in JSON");return t.text(n.text,s)}let a=Fragment.fromJSON(t,n.content),o=t.nodeType(n.type).create(n.attrs,a,s);return o.type.checkAttrs(o.attrs),o}};Node$1.prototype.text=void 0;class TextNode extends Node$1{constructor(t,n,s,a){if(super(t,n,null,a),!s)throw new RangeError("Empty text nodes are not allowed");this.text=s}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):wrapMarks(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(t,n){return this.text.slice(t,n)}get nodeSize(){return this.text.length}mark(t){return t==this.marks?this:new TextNode(this.type,this.attrs,this.text,t)}withText(t){return t==this.text?this:new TextNode(this.type,this.attrs,t,this.marks)}cut(t=0,n=this.text.length){return t==0&&n==this.text.length?this:this.withText(this.text.slice(t,n))}eq(t){return this.sameMarkup(t)&&this.text==t.text}toJSON(){let t=super.toJSON();return t.text=this.text,t}}function wrapMarks(e,t){for(let n=e.length-1;n>=0;n--)t=e[n].type.name+"("+t+")";return t}class ContentMatch{constructor(t){this.validEnd=t,this.next=[],this.wrapCache=[]}static parse(t,n){let s=new TokenStream(t,n);if(s.next==null)return ContentMatch.empty;let a=parseExpr(s);s.next&&s.err("Unexpected trailing text");let o=dfa(nfa(a));return checkForDeadEnds(o,s),o}matchType(t){for(let n=0;n<this.next.length;n++)if(this.next[n].type==t)return this.next[n].next;return null}matchFragment(t,n=0,s=t.childCount){let a=this;for(let o=n;a&&o<s;o++)a=a.matchType(t.child(o).type);return a}get inlineContent(){return this.next.length!=0&&this.next[0].type.isInline}get defaultType(){for(let t=0;t<this.next.length;t++){let{type:n}=this.next[t];if(!(n.isText||n.hasRequiredAttrs()))return n}return null}compatible(t){for(let n=0;n<this.next.length;n++)for(let s=0;s<t.next.length;s++)if(this.next[n].type==t.next[s].type)return!0;return!1}fillBefore(t,n=!1,s=0){let a=[this];function o(l,c){let d=l.matchFragment(t,s);if(d&&(!n||d.validEnd))return Fragment.from(c.map(f=>f.createAndFill()));for(let f=0;f<l.next.length;f++){let{type:R,next:S}=l.next[f];if(!(R.isText||R.hasRequiredAttrs())&&a.indexOf(S)==-1){a.push(S);let te=o(S,c.concat(R));if(te)return te}}return null}return o(this,[])}findWrapping(t){for(let s=0;s<this.wrapCache.length;s+=2)if(this.wrapCache[s]==t)return this.wrapCache[s+1];let n=this.computeWrapping(t);return this.wrapCache.push(t,n),n}computeWrapping(t){let n=Object.create(null),s=[{match:this,type:null,via:null}];for(;s.length;){let a=s.shift(),o=a.match;if(o.matchType(t)){let l=[];for(let c=a;c.type;c=c.via)l.push(c.type);return l.reverse()}for(let l=0;l<o.next.length;l++){let{type:c,next:d}=o.next[l];!c.isLeaf&&!c.hasRequiredAttrs()&&!(c.name in n)&&(!a.type||d.validEnd)&&(s.push({match:c.contentMatch,type:c,via:a}),n[c.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(t){if(t>=this.next.length)throw new RangeError(`There's no ${t}th edge in this content match`);return this.next[t]}toString(){let t=[];function n(s){t.push(s);for(let a=0;a<s.next.length;a++)t.indexOf(s.next[a].next)==-1&&n(s.next[a].next)}return n(this),t.map((s,a)=>{let o=a+(s.validEnd?"*":" ")+" ";for(let l=0;l<s.next.length;l++)o+=(l?", ":"")+s.next[l].type.name+"->"+t.indexOf(s.next[l].next);return o}).join(`
523
+ For more information, see https://radix-ui.com/primitives/docs/components/alert-dialog`;return React__namespace.useEffect(()=>{document.getElementById(e.current?.getAttribute("aria-describedby"))||console.warn(t)},[t,e]),null},Root2$1=AlertDialog$1,Trigger2$1=AlertDialogTrigger$1,Portal2=AlertDialogPortal$1,Overlay2=AlertDialogOverlay$1,Content2$1=AlertDialogContent$1,Action=AlertDialogAction$1,Cancel=AlertDialogCancel$1,Title2=AlertDialogTitle$1,Description2=AlertDialogDescription$1;const AlertDialog=Root2$1,AlertDialogTrigger=Trigger2$1,AlertDialogPortal=Portal2,AlertDialogOverlay=React__namespace.forwardRef(({className:e,...t},n)=>jsxRuntime.jsx(Overlay2,{className:cn("fixed inset-0 z-50 bg-foreground/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...t,ref:n}));AlertDialogOverlay.displayName=Overlay2.displayName;const AlertDialogContent=React__namespace.forwardRef(({className:e,...t},n)=>jsxRuntime.jsxs(AlertDialogPortal,{children:[jsxRuntime.jsx(AlertDialogOverlay,{}),jsxRuntime.jsx(Content2$1,{ref:n,className:cn("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",e),...t})]}));AlertDialogContent.displayName=Content2$1.displayName;const AlertDialogHeader=({className:e,...t})=>jsxRuntime.jsx("div",{className:cn("flex flex-col space-y-2 text-center sm:text-left",e),...t});AlertDialogHeader.displayName="AlertDialogHeader";const AlertDialogFooter=({className:e,...t})=>jsxRuntime.jsx("div",{className:cn("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t});AlertDialogFooter.displayName="AlertDialogFooter";const AlertDialogTitle=React__namespace.forwardRef(({className:e,...t},n)=>jsxRuntime.jsx(Title2,{ref:n,className:cn("text-lg font-semibold",e),...t}));AlertDialogTitle.displayName=Title2.displayName;const AlertDialogDescription=React__namespace.forwardRef(({className:e,...t},n)=>jsxRuntime.jsx(Description2,{ref:n,className:cn("text-sm text-muted-foreground",e),...t}));AlertDialogDescription.displayName=Description2.displayName;const AlertDialogAction=React__namespace.forwardRef(({className:e,...t},n)=>jsxRuntime.jsx(Action,{ref:n,className:cn(buttonVariants(),e),...t}));AlertDialogAction.displayName=Action.displayName;const AlertDialogCancel=React__namespace.forwardRef(({className:e,...t},n)=>jsxRuntime.jsx(Cancel,{ref:n,className:cn(buttonVariants({variant:"outline"}),"mt-2 sm:mt-0",e),...t}));AlertDialogCancel.displayName=Cancel.displayName;const MOBILE_ASSISTANT_URL="https://assistant.randmar.io";function parseDate(e){if(e==null)return null;const t=e instanceof Date?e:new Date(e);return Number.isNaN(t.getTime())?null:t}function formatLastRefresh(e){const t=parseDate(e);if(!t)return"Never";const n=new Date;return t.getFullYear()===n.getFullYear()&&t.getMonth()===n.getMonth()&&t.getDate()===n.getDate()?`Today at ${new Intl.DateTimeFormat(void 0,{hour:"numeric",minute:"2-digit",timeZoneName:"short"}).format(t)}`:new Intl.DateTimeFormat(void 0,{month:"short",day:"numeric",year:"numeric",hour:"numeric",minute:"2-digit",timeZoneName:"short"}).format(t)}function RefreshCluster({lastRefreshAt:e,onRefresh:t,onProgressiveRefresh:n,onAssistantClick:s,isRefreshing:a=!1,refreshLabel:o="Refresh",assistantLabel:l="Assistant",className:c,disabled:d=!1}){const[f,R]=React__namespace.useState(!1),[S,te]=React__namespace.useState(e);React__namespace.useEffect(()=>{te(e)},[e]);const A=!!(t||n),rt=a||f,st=e??S,it=React__namespace.useCallback(async()=>{if(!(!A||d||rt)){R(!0);try{n?(await n(!1),await n(!0)):await t?.(),te(new Date)}finally{R(!1)}}},[A,d,rt,n,t]);return jsxRuntime.jsxs("div",{className:cn("flex w-full flex-wrap items-center justify-start gap-2 lg:w-auto lg:justify-end",c),children:[jsxRuntime.jsxs("p",{className:"w-full text-xs text-muted-foreground sm:text-sm lg:w-auto",children:["Last refresh:"," ",jsxRuntime.jsx("span",{className:"font-medium text-foreground",children:formatLastRefresh(st)})]}),jsxRuntime.jsxs(Button$1,{type:"button",variant:"outline",className:"min-h-11",disabled:d||rt||!A,onClick:it,children:[rt?jsxRuntime.jsx(LoaderCircle,{className:"h-4 w-4 animate-spin","aria-hidden":"true"}):jsxRuntime.jsx(RefreshCw,{className:"h-4 w-4","aria-hidden":"true"}),jsxRuntime.jsx("span",{children:o})]}),jsxRuntime.jsx(Button$1,{asChild:!0,variant:"default",className:cn("min-h-11 lg:hidden",d&&"pointer-events-none opacity-50"),children:jsxRuntime.jsxs("a",{href:MOBILE_ASSISTANT_URL,target:"_blank",rel:"noopener noreferrer","aria-disabled":d||void 0,onClick:d?at=>at.preventDefault():void 0,children:[jsxRuntime.jsx(Bot,{className:"h-4 w-4","aria-hidden":"true"}),jsxRuntime.jsx("span",{children:l})]})}),jsxRuntime.jsxs(Button$1,{type:"button",variant:"default",className:"hidden min-h-11 lg:inline-flex",disabled:d,onClick:s,children:[jsxRuntime.jsx(Bot,{className:"h-4 w-4","aria-hidden":"true"}),jsxRuntime.jsx("span",{children:l})]})]})}function DataRefreshAssistantCluster({onAssistantClick:e,assistantPromptOptions:t,onAssistantUnavailable:n,...s}){const a=useOptionalChat(),o=React__namespace.useCallback(()=>{if(e){e();return}if(t){if(!a){n?.();return}a.sendMessageWithClear(t.prompt,t.hiddenPrompt,t.sopID)||n?.();return}n?.()},[t,a,e,n]);return jsxRuntime.jsx(RefreshCluster,{...s,onAssistantClick:o})}const fullBleedClassName="w-full max-w-none w-[100cqw] ml-[calc(50%-50cqw)] mr-[calc(50%-50cqw)]",rowInlinePaddingClassName="px-4 lg:px-6",primaryRowPaddingClassName=`${rowInlinePaddingClassName} py-4`,secondaryRowPaddingClassName=`${rowInlinePaddingClassName} py-3`;function RmPageHeaderBreadcrumbLink({item:e,isCurrent:t}){return!t&&e.href?jsxRuntime.jsx("a",{href:e.href,className:"text-xs font-medium text-muted-foreground underline-offset-4 transition-colors hover:text-foreground hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",children:e.label}):!t&&e.onClick?jsxRuntime.jsx("button",{type:"button",className:"text-xs font-medium text-muted-foreground underline-offset-4 transition-colors hover:text-foreground hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",onClick:e.onClick,children:e.label}):jsxRuntime.jsx("span",{"aria-current":t?"page":void 0,className:cn("text-xs font-medium",t?"text-foreground":"text-muted-foreground"),children:e.label})}function RmPageHeaderBreadcrumbs({items:e}){return e.length===0?null:jsxRuntime.jsx("nav",{"aria-label":"Breadcrumb",className:"w-full",children:jsxRuntime.jsx("ol",{className:"flex flex-wrap items-center gap-1.5",children:e.map((t,n)=>{const s=n===e.length-1,a=t.key??`${String(t.label)}-${n}`;return jsxRuntime.jsxs("li",{className:"inline-flex items-center gap-1.5",children:[jsxRuntime.jsx(RmPageHeaderBreadcrumbLink,{item:t,isCurrent:!!t.current||s}),s?null:jsxRuntime.jsx("span",{"aria-hidden":"true",className:"text-xs text-muted-foreground",children:"/"})]},a)})})})}function RmPageHeader({title:e,subtitle:t,breadcrumbs:n,rightTopActions:s,rightBottomActions:a,secondaryRow:o,sticky:l=!1,stickyClassName:c,className:d,cardClassName:f,contentClassName:R}){const S=!!(s||a),te=jsxRuntime.jsxs("header",{className:cn("w-full border-b border-border bg-background",d),children:[jsxRuntime.jsx("div",{className:cn(primaryRowPaddingClassName,f),children:jsxRuntime.jsxs("div",{className:cn("flex flex-col gap-3 lg:flex-row lg:items-start lg:justify-between",R),children:[jsxRuntime.jsxs("div",{className:"space-y-1",children:[n?.length?jsxRuntime.jsx(RmPageHeaderBreadcrumbs,{items:n}):null,jsxRuntime.jsx("h1",{className:"text-2xl font-semibold leading-tight tracking-tight text-foreground",children:e}),t?jsxRuntime.jsx("p",{className:"text-sm text-muted-foreground",children:t}):null]}),S?jsxRuntime.jsxs("div",{className:"flex w-full flex-col items-start gap-2 lg:w-auto lg:min-w-[16rem] lg:items-end",children:[s?jsxRuntime.jsx("div",{className:"flex w-full flex-wrap items-center justify-start gap-2 lg:justify-end",children:s}):null,a?jsxRuntime.jsx("div",{className:"flex w-full flex-wrap items-center justify-start gap-2 lg:justify-end",children:a}):null]}):null]})}),o?jsxRuntime.jsx("div",{className:"border-t border-border bg-primary/5",children:jsxRuntime.jsx("div",{className:secondaryRowPaddingClassName,children:o})}):null]});return l?jsxRuntime.jsx("div",{className:fullBleedClassName,children:jsxRuntime.jsx("div",{className:cn("sticky top-0 z-20",c),children:te})}):jsxRuntime.jsx("div",{className:fullBleedClassName,children:te})}function PageHeader({title:e,children:t,className:n}){return jsxRuntime.jsx(RmPageHeader,{title:e,rightBottomActions:t?jsxRuntime.jsx("div",{className:"flex shrink-0 flex-wrap items-center gap-2",children:t}):void 0,cardClassName:n})}const PARTNER_PAGE_SHELL_STACK_CLASS_NAME="space-y-8",PARTNER_PAGE_SHELL_CONTENT_CLASS_NAME="px-4 py-4 sm:px-6 sm:py-6";function PartnerPageShell({header:e,children:t,className:n,contentClassName:s,contentProps:a,...o}){return jsxRuntime.jsxs("section",{className:cn(PARTNER_PAGE_SHELL_STACK_CLASS_NAME,n),...o,children:[e,jsxRuntime.jsx("div",{className:cn(PARTNER_PAGE_SHELL_CONTENT_CLASS_NAME,s),...a,children:t})]})}function RmBodyZone({className:e,children:t,...n}){return jsxRuntime.jsx("section",{className:cn("px-4 py-4 sm:px-6 sm:py-6",e),...n,children:t})}function OrderedMap(e){this.content=e}OrderedMap.prototype={constructor:OrderedMap,find:function(e){for(var t=0;t<this.content.length;t+=2)if(this.content[t]===e)return t;return-1},get:function(e){var t=this.find(e);return t==-1?void 0:this.content[t+1]},update:function(e,t,n){var s=n&&n!=e?this.remove(n):this,a=s.find(e),o=s.content.slice();return a==-1?o.push(n||e,t):(o[a+1]=t,n&&(o[a]=n)),new OrderedMap(o)},remove:function(e){var t=this.find(e);if(t==-1)return this;var n=this.content.slice();return n.splice(t,2),new OrderedMap(n)},addToStart:function(e,t){return new OrderedMap([e,t].concat(this.remove(e).content))},addToEnd:function(e,t){var n=this.remove(e).content.slice();return n.push(e,t),new OrderedMap(n)},addBefore:function(e,t,n){var s=this.remove(t),a=s.content.slice(),o=s.find(e);return a.splice(o==-1?a.length:o,0,t,n),new OrderedMap(a)},forEach:function(e){for(var t=0;t<this.content.length;t+=2)e(this.content[t],this.content[t+1])},prepend:function(e){return e=OrderedMap.from(e),e.size?new OrderedMap(e.content.concat(this.subtract(e).content)):this},append:function(e){return e=OrderedMap.from(e),e.size?new OrderedMap(this.subtract(e).content.concat(e.content)):this},subtract:function(e){var t=this;e=OrderedMap.from(e);for(var n=0;n<e.content.length;n+=2)t=t.remove(e.content[n]);return t},toObject:function(){var e={};return this.forEach(function(t,n){e[t]=n}),e},get size(){return this.content.length>>1}},OrderedMap.from=function(e){if(e instanceof OrderedMap)return e;var t=[];if(e)for(var n in e)t.push(n,e[n]);return new OrderedMap(t)};function findDiffStart(e,t,n){for(let s=0;;s++){if(s==e.childCount||s==t.childCount)return e.childCount==t.childCount?null:n;let a=e.child(s),o=t.child(s);if(a==o){n+=a.nodeSize;continue}if(!a.sameMarkup(o))return n;if(a.isText&&a.text!=o.text){for(let l=0;a.text[l]==o.text[l];l++)n++;return n}if(a.content.size||o.content.size){let l=findDiffStart(a.content,o.content,n+1);if(l!=null)return l}n+=a.nodeSize}}function findDiffEnd(e,t,n,s){for(let a=e.childCount,o=t.childCount;;){if(a==0||o==0)return a==o?null:{a:n,b:s};let l=e.child(--a),c=t.child(--o),d=l.nodeSize;if(l==c){n-=d,s-=d;continue}if(!l.sameMarkup(c))return{a:n,b:s};if(l.isText&&l.text!=c.text){let f=0,R=Math.min(l.text.length,c.text.length);for(;f<R&&l.text[l.text.length-f-1]==c.text[c.text.length-f-1];)f++,n--,s--;return{a:n,b:s}}if(l.content.size||c.content.size){let f=findDiffEnd(l.content,c.content,n-1,s-1);if(f)return f}n-=d,s-=d}}class Fragment{constructor(t,n){if(this.content=t,this.size=n||0,n==null)for(let s=0;s<t.length;s++)this.size+=t[s].nodeSize}nodesBetween(t,n,s,a=0,o){for(let l=0,c=0;c<n;l++){let d=this.content[l],f=c+d.nodeSize;if(f>t&&s(d,a+c,o||null,l)!==!1&&d.content.size){let R=c+1;d.nodesBetween(Math.max(0,t-R),Math.min(d.content.size,n-R),s,a+R)}c=f}}descendants(t){this.nodesBetween(0,this.size,t)}textBetween(t,n,s,a){let o="",l=!0;return this.nodesBetween(t,n,(c,d)=>{let f=c.isText?c.text.slice(Math.max(t,d)-d,n-d):c.isLeaf?a?typeof a=="function"?a(c):a:c.type.spec.leafText?c.type.spec.leafText(c):"":"";c.isBlock&&(c.isLeaf&&f||c.isTextblock)&&s&&(l?l=!1:o+=s),o+=f},0),o}append(t){if(!t.size)return this;if(!this.size)return t;let n=this.lastChild,s=t.firstChild,a=this.content.slice(),o=0;for(n.isText&&n.sameMarkup(s)&&(a[a.length-1]=n.withText(n.text+s.text),o=1);o<t.content.length;o++)a.push(t.content[o]);return new Fragment(a,this.size+t.size)}cut(t,n=this.size){if(t==0&&n==this.size)return this;let s=[],a=0;if(n>t)for(let o=0,l=0;l<n;o++){let c=this.content[o],d=l+c.nodeSize;d>t&&((l<t||d>n)&&(c.isText?c=c.cut(Math.max(0,t-l),Math.min(c.text.length,n-l)):c=c.cut(Math.max(0,t-l-1),Math.min(c.content.size,n-l-1))),s.push(c),a+=c.nodeSize),l=d}return new Fragment(s,a)}cutByIndex(t,n){return t==n?Fragment.empty:t==0&&n==this.content.length?this:new Fragment(this.content.slice(t,n))}replaceChild(t,n){let s=this.content[t];if(s==n)return this;let a=this.content.slice(),o=this.size+n.nodeSize-s.nodeSize;return a[t]=n,new Fragment(a,o)}addToStart(t){return new Fragment([t].concat(this.content),this.size+t.nodeSize)}addToEnd(t){return new Fragment(this.content.concat(t),this.size+t.nodeSize)}eq(t){if(this.content.length!=t.content.length)return!1;for(let n=0;n<this.content.length;n++)if(!this.content[n].eq(t.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(t){let n=this.content[t];if(!n)throw new RangeError("Index "+t+" out of range for "+this);return n}maybeChild(t){return this.content[t]||null}forEach(t){for(let n=0,s=0;n<this.content.length;n++){let a=this.content[n];t(a,s,n),s+=a.nodeSize}}findDiffStart(t,n=0){return findDiffStart(this,t,n)}findDiffEnd(t,n=this.size,s=t.size){return findDiffEnd(this,t,n,s)}findIndex(t){if(t==0)return retIndex(0,t);if(t==this.size)return retIndex(this.content.length,t);if(t>this.size||t<0)throw new RangeError(`Position ${t} outside of fragment (${this})`);for(let n=0,s=0;;n++){let a=this.child(n),o=s+a.nodeSize;if(o>=t)return o==t?retIndex(n+1,o):retIndex(n,s);s=o}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(t=>t.toJSON()):null}static fromJSON(t,n){if(!n)return Fragment.empty;if(!Array.isArray(n))throw new RangeError("Invalid input for Fragment.fromJSON");return new Fragment(n.map(t.nodeFromJSON))}static fromArray(t){if(!t.length)return Fragment.empty;let n,s=0;for(let a=0;a<t.length;a++){let o=t[a];s+=o.nodeSize,a&&o.isText&&t[a-1].sameMarkup(o)?(n||(n=t.slice(0,a)),n[n.length-1]=o.withText(n[n.length-1].text+o.text)):n&&n.push(o)}return new Fragment(n||t,s)}static from(t){if(!t)return Fragment.empty;if(t instanceof Fragment)return t;if(Array.isArray(t))return this.fromArray(t);if(t.attrs)return new Fragment([t],t.nodeSize);throw new RangeError("Can not convert "+t+" to a Fragment"+(t.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}Fragment.empty=new Fragment([],0);const found={index:0,offset:0};function retIndex(e,t){return found.index=e,found.offset=t,found}function compareDeep(e,t){if(e===t)return!0;if(!(e&&typeof e=="object")||!(t&&typeof t=="object"))return!1;let n=Array.isArray(e);if(Array.isArray(t)!=n)return!1;if(n){if(e.length!=t.length)return!1;for(let s=0;s<e.length;s++)if(!compareDeep(e[s],t[s]))return!1}else{for(let s in e)if(!(s in t)||!compareDeep(e[s],t[s]))return!1;for(let s in t)if(!(s in e))return!1}return!0}let Mark$1=class Vn{constructor(t,n){this.type=t,this.attrs=n}addToSet(t){let n,s=!1;for(let a=0;a<t.length;a++){let o=t[a];if(this.eq(o))return t;if(this.type.excludes(o.type))n||(n=t.slice(0,a));else{if(o.type.excludes(this.type))return t;!s&&o.type.rank>this.type.rank&&(n||(n=t.slice(0,a)),n.push(this),s=!0),n&&n.push(o)}}return n||(n=t.slice()),s||n.push(this),n}removeFromSet(t){for(let n=0;n<t.length;n++)if(this.eq(t[n]))return t.slice(0,n).concat(t.slice(n+1));return t}isInSet(t){for(let n=0;n<t.length;n++)if(this.eq(t[n]))return!0;return!1}eq(t){return this==t||this.type==t.type&&compareDeep(this.attrs,t.attrs)}toJSON(){let t={type:this.type.name};for(let n in this.attrs){t.attrs=this.attrs;break}return t}static fromJSON(t,n){if(!n)throw new RangeError("Invalid input for Mark.fromJSON");let s=t.marks[n.type];if(!s)throw new RangeError(`There is no mark type ${n.type} in this schema`);let a=s.create(n.attrs);return s.checkAttrs(a.attrs),a}static sameSet(t,n){if(t==n)return!0;if(t.length!=n.length)return!1;for(let s=0;s<t.length;s++)if(!t[s].eq(n[s]))return!1;return!0}static setFrom(t){if(!t||Array.isArray(t)&&t.length==0)return Vn.none;if(t instanceof Vn)return[t];let n=t.slice();return n.sort((s,a)=>s.type.rank-a.type.rank),n}};Mark$1.none=[];class ReplaceError extends Error{}class Slice{constructor(t,n,s){this.content=t,this.openStart=n,this.openEnd=s}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(t,n){let s=insertInto(this.content,t+this.openStart,n);return s&&new Slice(s,this.openStart,this.openEnd)}removeBetween(t,n){return new Slice(removeRange(this.content,t+this.openStart,n+this.openStart),this.openStart,this.openEnd)}eq(t){return this.content.eq(t.content)&&this.openStart==t.openStart&&this.openEnd==t.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let t={content:this.content.toJSON()};return this.openStart>0&&(t.openStart=this.openStart),this.openEnd>0&&(t.openEnd=this.openEnd),t}static fromJSON(t,n){if(!n)return Slice.empty;let s=n.openStart||0,a=n.openEnd||0;if(typeof s!="number"||typeof a!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new Slice(Fragment.fromJSON(t,n.content),s,a)}static maxOpen(t,n=!0){let s=0,a=0;for(let o=t.firstChild;o&&!o.isLeaf&&(n||!o.type.spec.isolating);o=o.firstChild)s++;for(let o=t.lastChild;o&&!o.isLeaf&&(n||!o.type.spec.isolating);o=o.lastChild)a++;return new Slice(t,s,a)}}Slice.empty=new Slice(Fragment.empty,0,0);function removeRange(e,t,n){let{index:s,offset:a}=e.findIndex(t),o=e.maybeChild(s),{index:l,offset:c}=e.findIndex(n);if(a==t||o.isText){if(c!=n&&!e.child(l).isText)throw new RangeError("Removing non-flat range");return e.cut(0,t).append(e.cut(n))}if(s!=l)throw new RangeError("Removing non-flat range");return e.replaceChild(s,o.copy(removeRange(o.content,t-a-1,n-a-1)))}function insertInto(e,t,n,s){let{index:a,offset:o}=e.findIndex(t),l=e.maybeChild(a);if(o==t||l.isText)return s&&!s.canReplace(a,a,n)?null:e.cut(0,t).append(n).append(e.cut(t));let c=insertInto(l.content,t-o-1,n,l);return c&&e.replaceChild(a,l.copy(c))}function replace(e,t,n){if(n.openStart>e.depth)throw new ReplaceError("Inserted content deeper than insertion position");if(e.depth-n.openStart!=t.depth-n.openEnd)throw new ReplaceError("Inconsistent open depths");return replaceOuter(e,t,n,0)}function replaceOuter(e,t,n,s){let a=e.index(s),o=e.node(s);if(a==t.index(s)&&s<e.depth-n.openStart){let l=replaceOuter(e,t,n,s+1);return o.copy(o.content.replaceChild(a,l))}else if(n.content.size)if(!n.openStart&&!n.openEnd&&e.depth==s&&t.depth==s){let l=e.parent,c=l.content;return close(l,c.cut(0,e.parentOffset).append(n.content).append(c.cut(t.parentOffset)))}else{let{start:l,end:c}=prepareSliceForReplace(n,e);return close(o,replaceThreeWay(e,l,c,t,s))}else return close(o,replaceTwoWay(e,t,s))}function checkJoin(e,t){if(!t.type.compatibleContent(e.type))throw new ReplaceError("Cannot join "+t.type.name+" onto "+e.type.name)}function joinable$1(e,t,n){let s=e.node(n);return checkJoin(s,t.node(n)),s}function addNode(e,t){let n=t.length-1;n>=0&&e.isText&&e.sameMarkup(t[n])?t[n]=e.withText(t[n].text+e.text):t.push(e)}function addRange(e,t,n,s){let a=(t||e).node(n),o=0,l=t?t.index(n):a.childCount;e&&(o=e.index(n),e.depth>n?o++:e.textOffset&&(addNode(e.nodeAfter,s),o++));for(let c=o;c<l;c++)addNode(a.child(c),s);t&&t.depth==n&&t.textOffset&&addNode(t.nodeBefore,s)}function close(e,t){return e.type.checkContent(t),e.copy(t)}function replaceThreeWay(e,t,n,s,a){let o=e.depth>a&&joinable$1(e,t,a+1),l=s.depth>a&&joinable$1(n,s,a+1),c=[];return addRange(null,e,a,c),o&&l&&t.index(a)==n.index(a)?(checkJoin(o,l),addNode(close(o,replaceThreeWay(e,t,n,s,a+1)),c)):(o&&addNode(close(o,replaceTwoWay(e,t,a+1)),c),addRange(t,n,a,c),l&&addNode(close(l,replaceTwoWay(n,s,a+1)),c)),addRange(s,null,a,c),new Fragment(c)}function replaceTwoWay(e,t,n){let s=[];if(addRange(null,e,n,s),e.depth>n){let a=joinable$1(e,t,n+1);addNode(close(a,replaceTwoWay(e,t,n+1)),s)}return addRange(t,null,n,s),new Fragment(s)}function prepareSliceForReplace(e,t){let n=t.depth-e.openStart,a=t.node(n).copy(e.content);for(let o=n-1;o>=0;o--)a=t.node(o).copy(Fragment.from(a));return{start:a.resolveNoCache(e.openStart+n),end:a.resolveNoCache(a.content.size-e.openEnd-n)}}class ResolvedPos{constructor(t,n,s){this.pos=t,this.path=n,this.parentOffset=s,this.depth=n.length/3-1}resolveDepth(t){return t==null?this.depth:t<0?this.depth+t:t}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(t){return this.path[this.resolveDepth(t)*3]}index(t){return this.path[this.resolveDepth(t)*3+1]}indexAfter(t){return t=this.resolveDepth(t),this.index(t)+(t==this.depth&&!this.textOffset?0:1)}start(t){return t=this.resolveDepth(t),t==0?0:this.path[t*3-1]+1}end(t){return t=this.resolveDepth(t),this.start(t)+this.node(t).content.size}before(t){if(t=this.resolveDepth(t),!t)throw new RangeError("There is no position before the top-level node");return t==this.depth+1?this.pos:this.path[t*3-1]}after(t){if(t=this.resolveDepth(t),!t)throw new RangeError("There is no position after the top-level node");return t==this.depth+1?this.pos:this.path[t*3-1]+this.path[t*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let t=this.parent,n=this.index(this.depth);if(n==t.childCount)return null;let s=this.pos-this.path[this.path.length-1],a=t.child(n);return s?t.child(n).cut(s):a}get nodeBefore(){let t=this.index(this.depth),n=this.pos-this.path[this.path.length-1];return n?this.parent.child(t).cut(0,n):t==0?null:this.parent.child(t-1)}posAtIndex(t,n){n=this.resolveDepth(n);let s=this.path[n*3],a=n==0?0:this.path[n*3-1]+1;for(let o=0;o<t;o++)a+=s.child(o).nodeSize;return a}marks(){let t=this.parent,n=this.index();if(t.content.size==0)return Mark$1.none;if(this.textOffset)return t.child(n).marks;let s=t.maybeChild(n-1),a=t.maybeChild(n);if(!s){let c=s;s=a,a=c}let o=s.marks;for(var l=0;l<o.length;l++)o[l].type.spec.inclusive===!1&&(!a||!o[l].isInSet(a.marks))&&(o=o[l--].removeFromSet(o));return o}marksAcross(t){let n=this.parent.maybeChild(this.index());if(!n||!n.isInline)return null;let s=n.marks,a=t.parent.maybeChild(t.index());for(var o=0;o<s.length;o++)s[o].type.spec.inclusive===!1&&(!a||!s[o].isInSet(a.marks))&&(s=s[o--].removeFromSet(s));return s}sharedDepth(t){for(let n=this.depth;n>0;n--)if(this.start(n)<=t&&this.end(n)>=t)return n;return 0}blockRange(t=this,n){if(t.pos<this.pos)return t.blockRange(this);for(let s=this.depth-(this.parent.inlineContent||this.pos==t.pos?1:0);s>=0;s--)if(t.pos<=this.end(s)&&(!n||n(this.node(s))))return new NodeRange(this,t,s);return null}sameParent(t){return this.pos-this.parentOffset==t.pos-t.parentOffset}max(t){return t.pos>this.pos?t:this}min(t){return t.pos<this.pos?t:this}toString(){let t="";for(let n=1;n<=this.depth;n++)t+=(t?"/":"")+this.node(n).type.name+"_"+this.index(n-1);return t+":"+this.parentOffset}static resolve(t,n){if(!(n>=0&&n<=t.content.size))throw new RangeError("Position "+n+" out of range");let s=[],a=0,o=n;for(let l=t;;){let{index:c,offset:d}=l.content.findIndex(o),f=o-d;if(s.push(l,c,a+d),!f||(l=l.child(c),l.isText))break;o=f-1,a+=d+1}return new ResolvedPos(n,s,o)}static resolveCached(t,n){let s=resolveCache.get(t);if(s)for(let o=0;o<s.elts.length;o++){let l=s.elts[o];if(l.pos==n)return l}else resolveCache.set(t,s=new ResolveCache);let a=s.elts[s.i]=ResolvedPos.resolve(t,n);return s.i=(s.i+1)%resolveCacheSize,a}}class ResolveCache{constructor(){this.elts=[],this.i=0}}const resolveCacheSize=12,resolveCache=new WeakMap;class NodeRange{constructor(t,n,s){this.$from=t,this.$to=n,this.depth=s}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 emptyAttrs=Object.create(null);let Node$1=class zn{constructor(t,n,s,a=Mark$1.none){this.type=t,this.attrs=n,this.marks=a,this.content=s||Fragment.empty}get children(){return this.content.content}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(t){return this.content.child(t)}maybeChild(t){return this.content.maybeChild(t)}forEach(t){this.content.forEach(t)}nodesBetween(t,n,s,a=0){this.content.nodesBetween(t,n,s,a,this)}descendants(t){this.nodesBetween(0,this.content.size,t)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,"")}textBetween(t,n,s,a){return this.content.textBetween(t,n,s,a)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(t){return this==t||this.sameMarkup(t)&&this.content.eq(t.content)}sameMarkup(t){return this.hasMarkup(t.type,t.attrs,t.marks)}hasMarkup(t,n,s){return this.type==t&&compareDeep(this.attrs,n||t.defaultAttrs||emptyAttrs)&&Mark$1.sameSet(this.marks,s||Mark$1.none)}copy(t=null){return t==this.content?this:new zn(this.type,this.attrs,t,this.marks)}mark(t){return t==this.marks?this:new zn(this.type,this.attrs,this.content,t)}cut(t,n=this.content.size){return t==0&&n==this.content.size?this:this.copy(this.content.cut(t,n))}slice(t,n=this.content.size,s=!1){if(t==n)return Slice.empty;let a=this.resolve(t),o=this.resolve(n),l=s?0:a.sharedDepth(n),c=a.start(l),f=a.node(l).content.cut(a.pos-c,o.pos-c);return new Slice(f,a.depth-l,o.depth-l)}replace(t,n,s){return replace(this.resolve(t),this.resolve(n),s)}nodeAt(t){for(let n=this;;){let{index:s,offset:a}=n.content.findIndex(t);if(n=n.maybeChild(s),!n)return null;if(a==t||n.isText)return n;t-=a+1}}childAfter(t){let{index:n,offset:s}=this.content.findIndex(t);return{node:this.content.maybeChild(n),index:n,offset:s}}childBefore(t){if(t==0)return{node:null,index:0,offset:0};let{index:n,offset:s}=this.content.findIndex(t);if(s<t)return{node:this.content.child(n),index:n,offset:s};let a=this.content.child(n-1);return{node:a,index:n-1,offset:s-a.nodeSize}}resolve(t){return ResolvedPos.resolveCached(this,t)}resolveNoCache(t){return ResolvedPos.resolve(this,t)}rangeHasMark(t,n,s){let a=!1;return n>t&&this.nodesBetween(t,n,o=>(s.isInSet(o.marks)&&(a=!0),!a)),a}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 t=this.type.name;return this.content.size&&(t+="("+this.content.toStringInner()+")"),wrapMarks(this.marks,t)}contentMatchAt(t){let n=this.type.contentMatch.matchFragment(this.content,0,t);if(!n)throw new Error("Called contentMatchAt on a node with invalid content");return n}canReplace(t,n,s=Fragment.empty,a=0,o=s.childCount){let l=this.contentMatchAt(t).matchFragment(s,a,o),c=l&&l.matchFragment(this.content,n);if(!c||!c.validEnd)return!1;for(let d=a;d<o;d++)if(!this.type.allowsMarks(s.child(d).marks))return!1;return!0}canReplaceWith(t,n,s,a){if(a&&!this.type.allowsMarks(a))return!1;let o=this.contentMatchAt(t).matchType(s),l=o&&o.matchFragment(this.content,n);return l?l.validEnd:!1}canAppend(t){return t.content.size?this.canReplace(this.childCount,this.childCount,t.content):this.type.compatibleContent(t.type)}check(){this.type.checkContent(this.content),this.type.checkAttrs(this.attrs);let t=Mark$1.none;for(let n=0;n<this.marks.length;n++){let s=this.marks[n];s.type.checkAttrs(s.attrs),t=s.addToSet(t)}if(!Mark$1.sameSet(t,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 t={type:this.type.name};for(let n in this.attrs){t.attrs=this.attrs;break}return this.content.size&&(t.content=this.content.toJSON()),this.marks.length&&(t.marks=this.marks.map(n=>n.toJSON())),t}static fromJSON(t,n){if(!n)throw new RangeError("Invalid input for Node.fromJSON");let s;if(n.marks){if(!Array.isArray(n.marks))throw new RangeError("Invalid mark data for Node.fromJSON");s=n.marks.map(t.markFromJSON)}if(n.type=="text"){if(typeof n.text!="string")throw new RangeError("Invalid text node in JSON");return t.text(n.text,s)}let a=Fragment.fromJSON(t,n.content),o=t.nodeType(n.type).create(n.attrs,a,s);return o.type.checkAttrs(o.attrs),o}};Node$1.prototype.text=void 0;class TextNode extends Node$1{constructor(t,n,s,a){if(super(t,n,null,a),!s)throw new RangeError("Empty text nodes are not allowed");this.text=s}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):wrapMarks(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(t,n){return this.text.slice(t,n)}get nodeSize(){return this.text.length}mark(t){return t==this.marks?this:new TextNode(this.type,this.attrs,this.text,t)}withText(t){return t==this.text?this:new TextNode(this.type,this.attrs,t,this.marks)}cut(t=0,n=this.text.length){return t==0&&n==this.text.length?this:this.withText(this.text.slice(t,n))}eq(t){return this.sameMarkup(t)&&this.text==t.text}toJSON(){let t=super.toJSON();return t.text=this.text,t}}function wrapMarks(e,t){for(let n=e.length-1;n>=0;n--)t=e[n].type.name+"("+t+")";return t}class ContentMatch{constructor(t){this.validEnd=t,this.next=[],this.wrapCache=[]}static parse(t,n){let s=new TokenStream(t,n);if(s.next==null)return ContentMatch.empty;let a=parseExpr(s);s.next&&s.err("Unexpected trailing text");let o=dfa(nfa(a));return checkForDeadEnds(o,s),o}matchType(t){for(let n=0;n<this.next.length;n++)if(this.next[n].type==t)return this.next[n].next;return null}matchFragment(t,n=0,s=t.childCount){let a=this;for(let o=n;a&&o<s;o++)a=a.matchType(t.child(o).type);return a}get inlineContent(){return this.next.length!=0&&this.next[0].type.isInline}get defaultType(){for(let t=0;t<this.next.length;t++){let{type:n}=this.next[t];if(!(n.isText||n.hasRequiredAttrs()))return n}return null}compatible(t){for(let n=0;n<this.next.length;n++)for(let s=0;s<t.next.length;s++)if(this.next[n].type==t.next[s].type)return!0;return!1}fillBefore(t,n=!1,s=0){let a=[this];function o(l,c){let d=l.matchFragment(t,s);if(d&&(!n||d.validEnd))return Fragment.from(c.map(f=>f.createAndFill()));for(let f=0;f<l.next.length;f++){let{type:R,next:S}=l.next[f];if(!(R.isText||R.hasRequiredAttrs())&&a.indexOf(S)==-1){a.push(S);let te=o(S,c.concat(R));if(te)return te}}return null}return o(this,[])}findWrapping(t){for(let s=0;s<this.wrapCache.length;s+=2)if(this.wrapCache[s]==t)return this.wrapCache[s+1];let n=this.computeWrapping(t);return this.wrapCache.push(t,n),n}computeWrapping(t){let n=Object.create(null),s=[{match:this,type:null,via:null}];for(;s.length;){let a=s.shift(),o=a.match;if(o.matchType(t)){let l=[];for(let c=a;c.type;c=c.via)l.push(c.type);return l.reverse()}for(let l=0;l<o.next.length;l++){let{type:c,next:d}=o.next[l];!c.isLeaf&&!c.hasRequiredAttrs()&&!(c.name in n)&&(!a.type||d.validEnd)&&(s.push({match:c.contentMatch,type:c,via:a}),n[c.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(t){if(t>=this.next.length)throw new RangeError(`There's no ${t}th edge in this content match`);return this.next[t]}toString(){let t=[];function n(s){t.push(s);for(let a=0;a<s.next.length;a++)t.indexOf(s.next[a].next)==-1&&n(s.next[a].next)}return n(this),t.map((s,a)=>{let o=a+(s.validEnd?"*":" ")+" ";for(let l=0;l<s.next.length;l++)o+=(l?", ":"")+s.next[l].type.name+"->"+t.indexOf(s.next[l].next);return o}).join(`
524
524
  `)}}ContentMatch.empty=new ContentMatch(!0);class TokenStream{constructor(t,n){this.string=t,this.nodeTypes=n,this.inline=null,this.pos=0,this.tokens=t.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(t){return this.next==t&&(this.pos++||!0)}err(t){throw new SyntaxError(t+" (in content expression '"+this.string+"')")}}function parseExpr(e){let t=[];do t.push(parseExprSeq(e));while(e.eat("|"));return t.length==1?t[0]:{type:"choice",exprs:t}}function parseExprSeq(e){let t=[];do t.push(parseExprSubscript(e));while(e.next&&e.next!=")"&&e.next!="|");return t.length==1?t[0]:{type:"seq",exprs:t}}function parseExprSubscript(e){let t=parseExprAtom(e);for(;;)if(e.eat("+"))t={type:"plus",expr:t};else if(e.eat("*"))t={type:"star",expr:t};else if(e.eat("?"))t={type:"opt",expr:t};else if(e.eat("{"))t=parseExprRange(e,t);else break;return t}function parseNum(e){/\D/.test(e.next)&&e.err("Expected number, got '"+e.next+"'");let t=Number(e.next);return e.pos++,t}function parseExprRange(e,t){let n=parseNum(e),s=n;return e.eat(",")&&(e.next!="}"?s=parseNum(e):s=-1),e.eat("}")||e.err("Unclosed braced range"),{type:"range",min:n,max:s,expr:t}}function resolveName(e,t){let n=e.nodeTypes,s=n[t];if(s)return[s];let a=[];for(let o in n){let l=n[o];l.isInGroup(t)&&a.push(l)}return a.length==0&&e.err("No node type or group '"+t+"' found"),a}function parseExprAtom(e){if(e.eat("(")){let t=parseExpr(e);return e.eat(")")||e.err("Missing closing paren"),t}else if(/\W/.test(e.next))e.err("Unexpected token '"+e.next+"'");else{let t=resolveName(e,e.next).map(n=>(e.inline==null?e.inline=n.isInline:e.inline!=n.isInline&&e.err("Mixing inline and block content"),{type:"name",value:n}));return e.pos++,t.length==1?t[0]:{type:"choice",exprs:t}}}function nfa(e){let t=[[]];return a(o(e,0),n()),t;function n(){return t.push([])-1}function s(l,c,d){let f={term:d,to:c};return t[l].push(f),f}function a(l,c){l.forEach(d=>d.to=c)}function o(l,c){if(l.type=="choice")return l.exprs.reduce((d,f)=>d.concat(o(f,c)),[]);if(l.type=="seq")for(let d=0;;d++){let f=o(l.exprs[d],c);if(d==l.exprs.length-1)return f;a(f,c=n())}else if(l.type=="star"){let d=n();return s(c,d),a(o(l.expr,d),d),[s(d)]}else if(l.type=="plus"){let d=n();return a(o(l.expr,c),d),a(o(l.expr,d),d),[s(d)]}else{if(l.type=="opt")return[s(c)].concat(o(l.expr,c));if(l.type=="range"){let d=c;for(let f=0;f<l.min;f++){let R=n();a(o(l.expr,d),R),d=R}if(l.max==-1)a(o(l.expr,d),d);else for(let f=l.min;f<l.max;f++){let R=n();s(d,R),a(o(l.expr,d),R),d=R}return[s(d)]}else{if(l.type=="name")return[s(c,void 0,l.value)];throw new Error("Unknown expr type")}}}}function cmp(e,t){return t-e}function nullFrom(e,t){let n=[];return s(t),n.sort(cmp);function s(a){let o=e[a];if(o.length==1&&!o[0].term)return s(o[0].to);n.push(a);for(let l=0;l<o.length;l++){let{term:c,to:d}=o[l];!c&&n.indexOf(d)==-1&&s(d)}}}function dfa(e){let t=Object.create(null);return n(nullFrom(e,0));function n(s){let a=[];s.forEach(l=>{e[l].forEach(({term:c,to:d})=>{if(!c)return;let f;for(let R=0;R<a.length;R++)a[R][0]==c&&(f=a[R][1]);nullFrom(e,d).forEach(R=>{f||a.push([c,f=[]]),f.indexOf(R)==-1&&f.push(R)})})});let o=t[s.join(",")]=new ContentMatch(s.indexOf(e.length-1)>-1);for(let l=0;l<a.length;l++){let c=a[l][1].sort(cmp);o.next.push({type:a[l][0],next:t[c.join(",")]||n(c)})}return o}}function checkForDeadEnds(e,t){for(let n=0,s=[e];n<s.length;n++){let a=s[n],o=!a.validEnd,l=[];for(let c=0;c<a.next.length;c++){let{type:d,next:f}=a.next[c];l.push(d.name),o&&!(d.isText||d.hasRequiredAttrs())&&(o=!1),s.indexOf(f)==-1&&s.push(f)}o&&t.err("Only non-generatable nodes ("+l.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}function defaultAttrs(e){let t=Object.create(null);for(let n in e){let s=e[n];if(!s.hasDefault)return null;t[n]=s.default}return t}function computeAttrs(e,t){let n=Object.create(null);for(let s in e){let a=t&&t[s];if(a===void 0){let o=e[s];if(o.hasDefault)a=o.default;else throw new RangeError("No value supplied for attribute "+s)}n[s]=a}return n}function checkAttrs(e,t,n,s){for(let a in t)if(!(a in e))throw new RangeError(`Unsupported attribute ${a} for ${n} of type ${a}`);for(let a in e){let o=e[a];o.validate&&o.validate(t[a])}}function initAttrs(e,t){let n=Object.create(null);if(t)for(let s in t)n[s]=new Attribute(e,s,t[s]);return n}let NodeType$1=class Gn{constructor(t,n,s){this.name=t,this.schema=n,this.spec=s,this.markSet=null,this.groups=s.group?s.group.split(" "):[],this.attrs=initAttrs(t,s.attrs),this.defaultAttrs=defaultAttrs(this.attrs),this.contentMatch=null,this.inlineContent=null,this.isBlock=!(s.inline||t=="text"),this.isText=t=="text"}get isInline(){return!this.isBlock}get isTextblock(){return this.isBlock&&this.inlineContent}get isLeaf(){return this.contentMatch==ContentMatch.empty}get isAtom(){return this.isLeaf||!!this.spec.atom}isInGroup(t){return this.groups.indexOf(t)>-1}get whitespace(){return this.spec.whitespace||(this.spec.code?"pre":"normal")}hasRequiredAttrs(){for(let t in this.attrs)if(this.attrs[t].isRequired)return!0;return!1}compatibleContent(t){return this==t||this.contentMatch.compatible(t.contentMatch)}computeAttrs(t){return!t&&this.defaultAttrs?this.defaultAttrs:computeAttrs(this.attrs,t)}create(t=null,n,s){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new Node$1(this,this.computeAttrs(t),Fragment.from(n),Mark$1.setFrom(s))}createChecked(t=null,n,s){return n=Fragment.from(n),this.checkContent(n),new Node$1(this,this.computeAttrs(t),n,Mark$1.setFrom(s))}createAndFill(t=null,n,s){if(t=this.computeAttrs(t),n=Fragment.from(n),n.size){let l=this.contentMatch.fillBefore(n);if(!l)return null;n=l.append(n)}let a=this.contentMatch.matchFragment(n),o=a&&a.fillBefore(Fragment.empty,!0);return o?new Node$1(this,t,n.append(o),Mark$1.setFrom(s)):null}validContent(t){let n=this.contentMatch.matchFragment(t);if(!n||!n.validEnd)return!1;for(let s=0;s<t.childCount;s++)if(!this.allowsMarks(t.child(s).marks))return!1;return!0}checkContent(t){if(!this.validContent(t))throw new RangeError(`Invalid content for node ${this.name}: ${t.toString().slice(0,50)}`)}checkAttrs(t){checkAttrs(this.attrs,t,"node",this.name)}allowsMarkType(t){return this.markSet==null||this.markSet.indexOf(t)>-1}allowsMarks(t){if(this.markSet==null)return!0;for(let n=0;n<t.length;n++)if(!this.allowsMarkType(t[n].type))return!1;return!0}allowedMarks(t){if(this.markSet==null)return t;let n;for(let s=0;s<t.length;s++)this.allowsMarkType(t[s].type)?n&&n.push(t[s]):n||(n=t.slice(0,s));return n?n.length?n:Mark$1.none:t}static compile(t,n){let s=Object.create(null);t.forEach((o,l)=>s[o]=new Gn(o,n,l));let a=n.spec.topNode||"doc";if(!s[a])throw new RangeError("Schema is missing its top node type ('"+a+"')");if(!s.text)throw new RangeError("Every schema needs a 'text' type");for(let o in s.text.attrs)throw new RangeError("The text node type should not have attributes");return s}};function validateType(e,t,n){let s=n.split("|");return a=>{let o=a===null?"null":typeof a;if(s.indexOf(o)<0)throw new RangeError(`Expected value of type ${s} for attribute ${t} on type ${e}, got ${o}`)}}class Attribute{constructor(t,n,s){this.hasDefault=Object.prototype.hasOwnProperty.call(s,"default"),this.default=s.default,this.validate=typeof s.validate=="string"?validateType(t,n,s.validate):s.validate}get isRequired(){return!this.hasDefault}}class MarkType{constructor(t,n,s,a){this.name=t,this.rank=n,this.schema=s,this.spec=a,this.attrs=initAttrs(t,a.attrs),this.excluded=null;let o=defaultAttrs(this.attrs);this.instance=o?new Mark$1(this,o):null}create(t=null){return!t&&this.instance?this.instance:new Mark$1(this,computeAttrs(this.attrs,t))}static compile(t,n){let s=Object.create(null),a=0;return t.forEach((o,l)=>s[o]=new MarkType(o,a++,n,l)),s}removeFromSet(t){for(var n=0;n<t.length;n++)t[n].type==this&&(t=t.slice(0,n).concat(t.slice(n+1)),n--);return t}isInSet(t){for(let n=0;n<t.length;n++)if(t[n].type==this)return t[n]}checkAttrs(t){checkAttrs(this.attrs,t,"mark",this.name)}excludes(t){return this.excluded.indexOf(t)>-1}}class Schema{constructor(t){this.linebreakReplacement=null,this.cached=Object.create(null);let n=this.spec={};for(let a in t)n[a]=t[a];n.nodes=OrderedMap.from(t.nodes),n.marks=OrderedMap.from(t.marks||{}),this.nodes=NodeType$1.compile(this.spec.nodes,this),this.marks=MarkType.compile(this.spec.marks,this);let s=Object.create(null);for(let a in this.nodes){if(a in this.marks)throw new RangeError(a+" can not be both a node and a mark");let o=this.nodes[a],l=o.spec.content||"",c=o.spec.marks;if(o.contentMatch=s[l]||(s[l]=ContentMatch.parse(l,this.nodes)),o.inlineContent=o.contentMatch.inlineContent,o.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!o.isInline||!o.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=o}o.markSet=c=="_"?null:c?gatherMarks(this,c.split(" ")):c==""||!o.inlineContent?[]:null}for(let a in this.marks){let o=this.marks[a],l=o.spec.excludes;o.excluded=l==null?[o]:l==""?[]:gatherMarks(this,l.split(" "))}this.nodeFromJSON=a=>Node$1.fromJSON(this,a),this.markFromJSON=a=>Mark$1.fromJSON(this,a),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(t,n=null,s,a){if(typeof t=="string")t=this.nodeType(t);else if(t instanceof NodeType$1){if(t.schema!=this)throw new RangeError("Node type from different schema used ("+t.name+")")}else throw new RangeError("Invalid node type: "+t);return t.createChecked(n,s,a)}text(t,n){let s=this.nodes.text;return new TextNode(s,s.defaultAttrs,t,Mark$1.setFrom(n))}mark(t,n){return typeof t=="string"&&(t=this.marks[t]),t.create(n)}nodeType(t){let n=this.nodes[t];if(!n)throw new RangeError("Unknown node type: "+t);return n}}function gatherMarks(e,t){let n=[];for(let s=0;s<t.length;s++){let a=t[s],o=e.marks[a],l=o;if(o)n.push(o);else for(let c in e.marks){let d=e.marks[c];(a=="_"||d.spec.group&&d.spec.group.split(" ").indexOf(a)>-1)&&n.push(l=d)}if(!l)throw new SyntaxError("Unknown mark type: '"+t[s]+"'")}return n}function isTagRule(e){return e.tag!=null}function isStyleRule(e){return e.style!=null}class DOMParser{constructor(t,n){this.schema=t,this.rules=n,this.tags=[],this.styles=[];let s=this.matchedStyles=[];n.forEach(a=>{if(isTagRule(a))this.tags.push(a);else if(isStyleRule(a)){let o=/[^=]*/.exec(a.style)[0];s.indexOf(o)<0&&s.push(o),this.styles.push(a)}}),this.normalizeLists=!this.tags.some(a=>{if(!/^(ul|ol)\b/.test(a.tag)||!a.node)return!1;let o=t.nodes[a.node];return o.contentMatch.matchType(o)})}parse(t,n={}){let s=new ParseContext(this,n,!1);return s.addAll(t,Mark$1.none,n.from,n.to),s.finish()}parseSlice(t,n={}){let s=new ParseContext(this,n,!0);return s.addAll(t,Mark$1.none,n.from,n.to),Slice.maxOpen(s.finish())}matchTag(t,n,s){for(let a=s?this.tags.indexOf(s)+1:0;a<this.tags.length;a++){let o=this.tags[a];if(matches(t,o.tag)&&(o.namespace===void 0||t.namespaceURI==o.namespace)&&(!o.context||n.matchesContext(o.context))){if(o.getAttrs){let l=o.getAttrs(t);if(l===!1)continue;o.attrs=l||void 0}return o}}}matchStyle(t,n,s,a){for(let o=a?this.styles.indexOf(a)+1:0;o<this.styles.length;o++){let l=this.styles[o],c=l.style;if(!(c.indexOf(t)!=0||l.context&&!s.matchesContext(l.context)||c.length>t.length&&(c.charCodeAt(t.length)!=61||c.slice(t.length+1)!=n))){if(l.getAttrs){let d=l.getAttrs(n);if(d===!1)continue;l.attrs=d||void 0}return l}}}static schemaRules(t){let n=[];function s(a){let o=a.priority==null?50:a.priority,l=0;for(;l<n.length;l++){let c=n[l];if((c.priority==null?50:c.priority)<o)break}n.splice(l,0,a)}for(let a in t.marks){let o=t.marks[a].spec.parseDOM;o&&o.forEach(l=>{s(l=copy(l)),l.mark||l.ignore||l.clearMark||(l.mark=a)})}for(let a in t.nodes){let o=t.nodes[a].spec.parseDOM;o&&o.forEach(l=>{s(l=copy(l)),l.node||l.ignore||l.mark||(l.node=a)})}return n}static fromSchema(t){return t.cached.domParser||(t.cached.domParser=new DOMParser(t,DOMParser.schemaRules(t)))}}const blockTags={address:!0,article:!0,aside:!0,blockquote:!0,canvas:!0,dd:!0,div:!0,dl:!0,fieldset:!0,figcaption:!0,figure:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,li:!0,noscript:!0,ol:!0,output:!0,p:!0,pre:!0,section:!0,table:!0,tfoot:!0,ul:!0},ignoreTags={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},listTags={ol:!0,ul:!0},OPT_PRESERVE_WS=1,OPT_PRESERVE_WS_FULL=2,OPT_OPEN_LEFT=4;function wsOptionsFor(e,t,n){return t!=null?(t?OPT_PRESERVE_WS:0)|(t==="full"?OPT_PRESERVE_WS_FULL:0):e&&e.whitespace=="pre"?OPT_PRESERVE_WS|OPT_PRESERVE_WS_FULL:n&~OPT_OPEN_LEFT}class NodeContext{constructor(t,n,s,a,o,l){this.type=t,this.attrs=n,this.marks=s,this.solid=a,this.options=l,this.content=[],this.activeMarks=Mark$1.none,this.match=o||(l&OPT_OPEN_LEFT?null:t.contentMatch)}findWrapping(t){if(!this.match){if(!this.type)return[];let n=this.type.contentMatch.fillBefore(Fragment.from(t));if(n)this.match=this.type.contentMatch.matchFragment(n);else{let s=this.type.contentMatch,a;return(a=s.findWrapping(t.type))?(this.match=s,a):null}}return this.match.findWrapping(t.type)}finish(t){if(!(this.options&OPT_PRESERVE_WS)){let s=this.content[this.content.length-1],a;if(s&&s.isText&&(a=/[ \t\r\n\u000c]+$/.exec(s.text))){let o=s;s.text.length==a[0].length?this.content.pop():this.content[this.content.length-1]=o.withText(o.text.slice(0,o.text.length-a[0].length))}}let n=Fragment.from(this.content);return!t&&this.match&&(n=n.append(this.match.fillBefore(Fragment.empty,!0))),this.type?this.type.create(this.attrs,n,this.marks):n}inlineContext(t){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:t.parentNode&&!blockTags.hasOwnProperty(t.parentNode.nodeName.toLowerCase())}}class ParseContext{constructor(t,n,s){this.parser=t,this.options=n,this.isOpen=s,this.open=0,this.localPreserveWS=!1;let a=n.topNode,o,l=wsOptionsFor(null,n.preserveWhitespace,0)|(s?OPT_OPEN_LEFT:0);a?o=new NodeContext(a.type,a.attrs,Mark$1.none,!0,n.topMatch||a.type.contentMatch,l):s?o=new NodeContext(null,null,Mark$1.none,!0,null,l):o=new NodeContext(t.schema.topNodeType,null,Mark$1.none,!0,null,l),this.nodes=[o],this.find=n.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(t,n){t.nodeType==3?this.addTextNode(t,n):t.nodeType==1&&this.addElement(t,n)}addTextNode(t,n){let s=t.nodeValue,a=this.top,o=a.options&OPT_PRESERVE_WS_FULL?"full":this.localPreserveWS||(a.options&OPT_PRESERVE_WS)>0,{schema:l}=this.parser;if(o==="full"||a.inlineContext(t)||/[^ \t\r\n\u000c]/.test(s)){if(o)if(o==="full")s=s.replace(/\r\n?/g,`
525
525
  `);else if(l.linebreakReplacement&&/[\r\n]/.test(s)&&this.top.findWrapping(l.linebreakReplacement.create())){let c=s.split(/\r?\n|\r/);for(let d=0;d<c.length;d++)d&&this.insertNode(l.linebreakReplacement.create(),n,!0),c[d]&&this.insertNode(l.text(c[d]),n,!/\S/.test(c[d]));s=""}else s=s.replace(/\r?\n|\r/g," ");else if(s=s.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(s)&&this.open==this.nodes.length-1){let c=a.content[a.content.length-1],d=t.previousSibling;(!c||d&&d.nodeName=="BR"||c.isText&&/[ \t\r\n\u000c]$/.test(c.text))&&(s=s.slice(1))}s&&this.insertNode(l.text(s),n,!/\S/.test(s)),this.findInText(t)}else this.findInside(t)}addElement(t,n,s){let a=this.localPreserveWS,o=this.top;(t.tagName=="PRE"||/pre/.test(t.style&&t.style.whiteSpace))&&(this.localPreserveWS=!0);let l=t.nodeName.toLowerCase(),c;listTags.hasOwnProperty(l)&&this.parser.normalizeLists&&normalizeList(t);let d=this.options.ruleFromNode&&this.options.ruleFromNode(t)||(c=this.parser.matchTag(t,this,s));e:if(d?d.ignore:ignoreTags.hasOwnProperty(l))this.findInside(t),this.ignoreFallback(t,n);else if(!d||d.skip||d.closeParent){d&&d.closeParent?this.open=Math.max(0,this.open-1):d&&d.skip.nodeType&&(t=d.skip);let f,R=this.needsBlock;if(blockTags.hasOwnProperty(l))o.content.length&&o.content[0].isInline&&this.open&&(this.open--,o=this.top),f=!0,o.type||(this.needsBlock=!0);else if(!t.firstChild){this.leafFallback(t,n);break e}let S=d&&d.skip?n:this.readStyles(t,n);S&&this.addAll(t,S),f&&this.sync(o),this.needsBlock=R}else{let f=this.readStyles(t,n);f&&this.addElementByRule(t,d,f,d.consuming===!1?c:void 0)}this.localPreserveWS=a}leafFallback(t,n){t.nodeName=="BR"&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(t.ownerDocument.createTextNode(`
526
526
  `),n)}ignoreFallback(t,n){t.nodeName=="BR"&&(!this.top.type||!this.top.type.inlineContent)&&this.findPlace(this.parser.schema.text("-"),n,!0)}readStyles(t,n){let s=t.style;if(s&&s.length)for(let a=0;a<this.parser.matchedStyles.length;a++){let o=this.parser.matchedStyles[a],l=s.getPropertyValue(o);if(l)for(let c=void 0;;){let d=this.parser.matchStyle(o,l,this,c);if(!d)break;if(d.ignore)return null;if(d.clearMark?n=n.filter(f=>!d.clearMark(f)):n=n.concat(this.parser.schema.marks[d.mark].create(d.attrs)),d.consuming===!1)c=d;else break}}return n}addElementByRule(t,n,s,a){let o,l;if(n.node)if(l=this.parser.schema.nodes[n.node],l.isLeaf)this.insertNode(l.create(n.attrs),s,t.nodeName=="BR")||this.leafFallback(t,s);else{let d=this.enter(l,n.attrs||null,s,n.preserveWhitespace);d&&(o=!0,s=d)}else{let d=this.parser.schema.marks[n.mark];s=s.concat(d.create(n.attrs))}let c=this.top;if(l&&l.isLeaf)this.findInside(t);else if(a)this.addElement(t,s,a);else if(n.getContent)this.findInside(t),n.getContent(t,this.parser.schema).forEach(d=>this.insertNode(d,s,!1));else{let d=t;typeof n.contentElement=="string"?d=t.querySelector(n.contentElement):typeof n.contentElement=="function"?d=n.contentElement(t):n.contentElement&&(d=n.contentElement),this.findAround(t,d,!0),this.addAll(d,s),this.findAround(t,d,!1)}o&&this.sync(c)&&this.open--}addAll(t,n,s,a){let o=s||0;for(let l=s?t.childNodes[s]:t.firstChild,c=a==null?null:t.childNodes[a];l!=c;l=l.nextSibling,++o)this.findAtPoint(t,o),this.addDOM(l,n);this.findAtPoint(t,o)}findPlace(t,n,s){let a,o;for(let l=this.open,c=0;l>=0;l--){let d=this.nodes[l],f=d.findWrapping(t);if(f&&(!a||a.length>f.length+c)&&(a=f,o=d,!f.length))break;if(d.solid){if(s)break;c+=2}}if(!a)return null;this.sync(o);for(let l=0;l<a.length;l++)n=this.enterInner(a[l],null,n,!1);return n}insertNode(t,n,s){if(t.isInline&&this.needsBlock&&!this.top.type){let o=this.textblockFromContext();o&&(n=this.enterInner(o,null,n))}let a=this.findPlace(t,n,s);if(a){this.closeExtra();let o=this.top;o.match&&(o.match=o.match.matchType(t.type));let l=Mark$1.none;for(let c of a.concat(t.marks))(o.type?o.type.allowsMarkType(c.type):markMayApply(c.type,t.type))&&(l=c.addToSet(l));return o.content.push(t.mark(l)),!0}return!1}enter(t,n,s,a){let o=this.findPlace(t.create(n),s,!1);return o&&(o=this.enterInner(t,n,s,!0,a)),o}enterInner(t,n,s,a=!1,o){this.closeExtra();let l=this.top;l.match=l.match&&l.match.matchType(t);let c=wsOptionsFor(t,o,l.options);l.options&OPT_OPEN_LEFT&&l.content.length==0&&(c|=OPT_OPEN_LEFT);let d=Mark$1.none;return s=s.filter(f=>(l.type?l.type.allowsMarkType(f.type):markMayApply(f.type,t))?(d=f.addToSet(d),!1):!0),this.nodes.push(new NodeContext(t,n,d,a,null,c)),this.open++,s}closeExtra(t=!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(t));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(t){for(let n=this.open;n>=0;n--){if(this.nodes[n]==t)return this.open=n,!0;this.localPreserveWS&&(this.nodes[n].options|=OPT_PRESERVE_WS)}return!1}get currentPos(){this.closeExtra();let t=0;for(let n=this.open;n>=0;n--){let s=this.nodes[n].content;for(let a=s.length-1;a>=0;a--)t+=s[a].nodeSize;n&&t++}return t}findAtPoint(t,n){if(this.find)for(let s=0;s<this.find.length;s++)this.find[s].node==t&&this.find[s].offset==n&&(this.find[s].pos=this.currentPos)}findInside(t){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].pos==null&&t.nodeType==1&&t.contains(this.find[n].node)&&(this.find[n].pos=this.currentPos)}findAround(t,n,s){if(t!=n&&this.find)for(let a=0;a<this.find.length;a++)this.find[a].pos==null&&t.nodeType==1&&t.contains(this.find[a].node)&&n.compareDocumentPosition(this.find[a].node)&(s?2:4)&&(this.find[a].pos=this.currentPos)}findInText(t){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].node==t&&(this.find[n].pos=this.currentPos-(t.nodeValue.length-this.find[n].offset))}matchesContext(t){if(t.indexOf("|")>-1)return t.split(/\s*\|\s*/).some(this.matchesContext,this);let n=t.split("/"),s=this.options.context,a=!this.isOpen&&(!s||s.parent.type==this.nodes[0].type),o=-(s?s.depth+1:0)+(a?0:1),l=(c,d)=>{for(;c>=0;c--){let f=n[c];if(f==""){if(c==n.length-1||c==0)continue;for(;d>=o;d--)if(l(c-1,d))return!0;return!1}else{let R=d>0||d==0&&a?this.nodes[d].type:s&&d>=o?s.node(d-o).type:null;if(!R||R.name!=f&&!R.isInGroup(f))return!1;d--}}return!0};return l(n.length-1,this.open)}textblockFromContext(){let t=this.options.context;if(t)for(let n=t.depth;n>=0;n--){let s=t.node(n).contentMatchAt(t.indexAfter(n)).defaultType;if(s&&s.isTextblock&&s.defaultAttrs)return s}for(let n in this.parser.schema.nodes){let s=this.parser.schema.nodes[n];if(s.isTextblock&&s.defaultAttrs)return s}}}function normalizeList(e){for(let t=e.firstChild,n=null;t;t=t.nextSibling){let s=t.nodeType==1?t.nodeName.toLowerCase():null;s&&listTags.hasOwnProperty(s)&&n?(n.appendChild(t),t=n):s=="li"?n=t:s&&(n=null)}}function matches(e,t){return(e.matches||e.msMatchesSelector||e.webkitMatchesSelector||e.mozMatchesSelector).call(e,t)}function copy(e){let t={};for(let n in e)t[n]=e[n];return t}function markMayApply(e,t){let n=t.schema.nodes;for(let s in n){let a=n[s];if(!a.allowsMarkType(e))continue;let o=[],l=c=>{o.push(c);for(let d=0;d<c.edgeCount;d++){let{type:f,next:R}=c.edge(d);if(f==t||o.indexOf(R)<0&&l(R))return!0}};if(l(a.contentMatch))return!0}}class DOMSerializer{constructor(t,n){this.nodes=t,this.marks=n}serializeFragment(t,n={},s){s||(s=doc$1(n).createDocumentFragment());let a=s,o=[];return t.forEach(l=>{if(o.length||l.marks.length){let c=0,d=0;for(;c<o.length&&d<l.marks.length;){let f=l.marks[d];if(!this.marks[f.type.name]){d++;continue}if(!f.eq(o[c][0])||f.type.spec.spanning===!1)break;c++,d++}for(;c<o.length;)a=o.pop()[1];for(;d<l.marks.length;){let f=l.marks[d++],R=this.serializeMark(f,l.isInline,n);R&&(o.push([f,a]),a.appendChild(R.dom),a=R.contentDOM||R.dom)}}a.appendChild(this.serializeNodeInner(l,n))}),s}serializeNodeInner(t,n){let{dom:s,contentDOM:a}=renderSpec(doc$1(n),this.nodes[t.type.name](t),null,t.attrs);if(a){if(t.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(t.content,n,a)}return s}serializeNode(t,n={}){let s=this.serializeNodeInner(t,n);for(let a=t.marks.length-1;a>=0;a--){let o=this.serializeMark(t.marks[a],t.isInline,n);o&&((o.contentDOM||o.dom).appendChild(s),s=o.dom)}return s}serializeMark(t,n,s={}){let a=this.marks[t.type.name];return a&&renderSpec(doc$1(s),a(t,n),null,t.attrs)}static renderSpec(t,n,s=null,a){return renderSpec(t,n,s,a)}static fromSchema(t){return t.cached.domSerializer||(t.cached.domSerializer=new DOMSerializer(this.nodesFromSchema(t),this.marksFromSchema(t)))}static nodesFromSchema(t){let n=gatherToDOM(t.nodes);return n.text||(n.text=s=>s.text),n}static marksFromSchema(t){return gatherToDOM(t.marks)}}function gatherToDOM(e){let t={};for(let n in e){let s=e[n].spec.toDOM;s&&(t[n]=s)}return t}function doc$1(e){return e.document||window.document}const suspiciousAttributeCache=new WeakMap;function suspiciousAttributes(e){let t=suspiciousAttributeCache.get(e);return t===void 0&&suspiciousAttributeCache.set(e,t=suspiciousAttributesInner(e)),t}function suspiciousAttributesInner(e){let t=null;function n(s){if(s&&typeof s=="object")if(Array.isArray(s))if(typeof s[0]=="string")t||(t=[]),t.push(s);else for(let a=0;a<s.length;a++)n(s[a]);else for(let a in s)n(s[a])}return n(e),t}function renderSpec(e,t,n,s){if(typeof t=="string")return{dom:e.createTextNode(t)};if(t.nodeType!=null)return{dom:t};if(t.dom&&t.dom.nodeType!=null)return t;let a=t[0],o;if(typeof a!="string")throw new RangeError("Invalid array passed to renderSpec");if(s&&(o=suspiciousAttributes(s))&&o.indexOf(t)>-1)throw new RangeError("Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.");let l=a.indexOf(" ");l>0&&(n=a.slice(0,l),a=a.slice(l+1));let c,d=n?e.createElementNS(n,a):e.createElement(a),f=t[1],R=1;if(f&&typeof f=="object"&&f.nodeType==null&&!Array.isArray(f)){R=2;for(let S in f)if(f[S]!=null){let te=S.indexOf(" ");te>0?d.setAttributeNS(S.slice(0,te),S.slice(te+1),f[S]):S=="style"&&d.style?d.style.cssText=f[S]:d.setAttribute(S,f[S])}}for(let S=R;S<t.length;S++){let te=t[S];if(te===0){if(S<t.length-1||S>R)throw new RangeError("Content hole must be the only child of its parent node");return{dom:d,contentDOM:d}}else{let{dom:A,contentDOM:rt}=renderSpec(e,te,n,s);if(d.appendChild(A),rt){if(c)throw new RangeError("Multiple content holes");c=rt}}}return{dom:d,contentDOM:c}}const lower16=65535,factor16=Math.pow(2,16);function makeRecover(e,t){return e+t*factor16}function recoverIndex(e){return e&lower16}function recoverOffset(e){return(e-(e&lower16))/factor16}const DEL_BEFORE=1,DEL_AFTER=2,DEL_ACROSS=4,DEL_SIDE=8;class MapResult{constructor(t,n,s){this.pos=t,this.delInfo=n,this.recover=s}get deleted(){return(this.delInfo&DEL_SIDE)>0}get deletedBefore(){return(this.delInfo&(DEL_BEFORE|DEL_ACROSS))>0}get deletedAfter(){return(this.delInfo&(DEL_AFTER|DEL_ACROSS))>0}get deletedAcross(){return(this.delInfo&DEL_ACROSS)>0}}class StepMap{constructor(t,n=!1){if(this.ranges=t,this.inverted=n,!t.length&&StepMap.empty)return StepMap.empty}recover(t){let n=0,s=recoverIndex(t);if(!this.inverted)for(let a=0;a<s;a++)n+=this.ranges[a*3+2]-this.ranges[a*3+1];return this.ranges[s*3]+n+recoverOffset(t)}mapResult(t,n=1){return this._map(t,n,!1)}map(t,n=1){return this._map(t,n,!0)}_map(t,n,s){let a=0,o=this.inverted?2:1,l=this.inverted?1:2;for(let c=0;c<this.ranges.length;c+=3){let d=this.ranges[c]-(this.inverted?a:0);if(d>t)break;let f=this.ranges[c+o],R=this.ranges[c+l],S=d+f;if(t<=S){let te=f?t==d?-1:t==S?1:n:n,A=d+a+(te<0?0:R);if(s)return A;let rt=t==(n<0?d:S)?null:makeRecover(c/3,t-d),st=t==d?DEL_AFTER:t==S?DEL_BEFORE:DEL_ACROSS;return(n<0?t!=d:t!=S)&&(st|=DEL_SIDE),new MapResult(A,st,rt)}a+=R-f}return s?t+a:new MapResult(t+a,0,null)}touches(t,n){let s=0,a=recoverIndex(n),o=this.inverted?2:1,l=this.inverted?1:2;for(let c=0;c<this.ranges.length;c+=3){let d=this.ranges[c]-(this.inverted?s:0);if(d>t)break;let f=this.ranges[c+o],R=d+f;if(t<=R&&c==a*3)return!0;s+=this.ranges[c+l]-f}return!1}forEach(t){let n=this.inverted?2:1,s=this.inverted?1:2;for(let a=0,o=0;a<this.ranges.length;a+=3){let l=this.ranges[a],c=l-(this.inverted?o:0),d=l+(this.inverted?0:o),f=this.ranges[a+n],R=this.ranges[a+s];t(c,c+f,d,d+R),o+=R-f}}invert(){return new StepMap(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(t){return t==0?StepMap.empty:new StepMap(t<0?[0,-t,0]:[0,0,t])}}StepMap.empty=new StepMap([]);class Mapping{constructor(t,n,s=0,a=t?t.length:0){this.mirror=n,this.from=s,this.to=a,this._maps=t||[],this.ownData=!(t||n)}get maps(){return this._maps}slice(t=0,n=this.maps.length){return new Mapping(this._maps,this.mirror,t,n)}appendMap(t,n){this.ownData||(this._maps=this._maps.slice(),this.mirror=this.mirror&&this.mirror.slice(),this.ownData=!0),this.to=this._maps.push(t),n!=null&&this.setMirror(this._maps.length-1,n)}appendMapping(t){for(let n=0,s=this._maps.length;n<t._maps.length;n++){let a=t.getMirror(n);this.appendMap(t._maps[n],a!=null&&a<n?s+a:void 0)}}getMirror(t){if(this.mirror){for(let n=0;n<this.mirror.length;n++)if(this.mirror[n]==t)return this.mirror[n+(n%2?-1:1)]}}setMirror(t,n){this.mirror||(this.mirror=[]),this.mirror.push(t,n)}appendMappingInverted(t){for(let n=t.maps.length-1,s=this._maps.length+t._maps.length;n>=0;n--){let a=t.getMirror(n);this.appendMap(t._maps[n].invert(),a!=null&&a>n?s-a-1:void 0)}}invert(){let t=new Mapping;return t.appendMappingInverted(this),t}map(t,n=1){if(this.mirror)return this._map(t,n,!0);for(let s=this.from;s<this.to;s++)t=this._maps[s].map(t,n);return t}mapResult(t,n=1){return this._map(t,n,!1)}_map(t,n,s){let a=0;for(let o=this.from;o<this.to;o++){let l=this._maps[o],c=l.mapResult(t,n);if(c.recover!=null){let d=this.getMirror(o);if(d!=null&&d>o&&d<this.to){o=d,t=this._maps[d].recover(c.recover);continue}}a|=c.delInfo,t=c.pos}return s?t:new MapResult(t,a,null)}}const stepsByID=Object.create(null);class Step{getMap(){return StepMap.empty}merge(t){return null}static fromJSON(t,n){if(!n||!n.stepType)throw new RangeError("Invalid input for Step.fromJSON");let s=stepsByID[n.stepType];if(!s)throw new RangeError(`No step type ${n.stepType} defined`);return s.fromJSON(t,n)}static jsonID(t,n){if(t in stepsByID)throw new RangeError("Duplicate use of step JSON ID "+t);return stepsByID[t]=n,n.prototype.jsonID=t,n}}class StepResult{constructor(t,n){this.doc=t,this.failed=n}static ok(t){return new StepResult(t,null)}static fail(t){return new StepResult(null,t)}static fromReplace(t,n,s,a){try{return StepResult.ok(t.replace(n,s,a))}catch(o){if(o instanceof ReplaceError)return StepResult.fail(o.message);throw o}}}function mapFragment(e,t,n){let s=[];for(let a=0;a<e.childCount;a++){let o=e.child(a);o.content.size&&(o=o.copy(mapFragment(o.content,t,o))),o.isInline&&(o=t(o,n,a)),s.push(o)}return Fragment.fromArray(s)}class AddMarkStep extends Step{constructor(t,n,s){super(),this.from=t,this.to=n,this.mark=s}apply(t){let n=t.slice(this.from,this.to),s=t.resolve(this.from),a=s.node(s.sharedDepth(this.to)),o=new Slice(mapFragment(n.content,(l,c)=>!l.isAtom||!c.type.allowsMarkType(this.mark.type)?l:l.mark(this.mark.addToSet(l.marks)),a),n.openStart,n.openEnd);return StepResult.fromReplace(t,this.from,this.to,o)}invert(){return new RemoveMarkStep(this.from,this.to,this.mark)}map(t){let n=t.mapResult(this.from,1),s=t.mapResult(this.to,-1);return n.deleted&&s.deleted||n.pos>=s.pos?null:new AddMarkStep(n.pos,s.pos,this.mark)}merge(t){return t instanceof AddMarkStep&&t.mark.eq(this.mark)&&this.from<=t.to&&this.to>=t.from?new AddMarkStep(Math.min(this.from,t.from),Math.max(this.to,t.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(t,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new AddMarkStep(n.from,n.to,t.markFromJSON(n.mark))}}Step.jsonID("addMark",AddMarkStep);class RemoveMarkStep extends Step{constructor(t,n,s){super(),this.from=t,this.to=n,this.mark=s}apply(t){let n=t.slice(this.from,this.to),s=new Slice(mapFragment(n.content,a=>a.mark(this.mark.removeFromSet(a.marks)),t),n.openStart,n.openEnd);return StepResult.fromReplace(t,this.from,this.to,s)}invert(){return new AddMarkStep(this.from,this.to,this.mark)}map(t){let n=t.mapResult(this.from,1),s=t.mapResult(this.to,-1);return n.deleted&&s.deleted||n.pos>=s.pos?null:new RemoveMarkStep(n.pos,s.pos,this.mark)}merge(t){return t instanceof RemoveMarkStep&&t.mark.eq(this.mark)&&this.from<=t.to&&this.to>=t.from?new RemoveMarkStep(Math.min(this.from,t.from),Math.max(this.to,t.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(t,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new RemoveMarkStep(n.from,n.to,t.markFromJSON(n.mark))}}Step.jsonID("removeMark",RemoveMarkStep);class AddNodeMarkStep extends Step{constructor(t,n){super(),this.pos=t,this.mark=n}apply(t){let n=t.nodeAt(this.pos);if(!n)return StepResult.fail("No node at mark step's position");let s=n.type.create(n.attrs,null,this.mark.addToSet(n.marks));return StepResult.fromReplace(t,this.pos,this.pos+1,new Slice(Fragment.from(s),0,n.isLeaf?0:1))}invert(t){let n=t.nodeAt(this.pos);if(n){let s=this.mark.addToSet(n.marks);if(s.length==n.marks.length){for(let a=0;a<n.marks.length;a++)if(!n.marks[a].isInSet(s))return new AddNodeMarkStep(this.pos,n.marks[a]);return new AddNodeMarkStep(this.pos,this.mark)}}return new RemoveNodeMarkStep(this.pos,this.mark)}map(t){let n=t.mapResult(this.pos,1);return n.deletedAfter?null:new AddNodeMarkStep(n.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(t,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new AddNodeMarkStep(n.pos,t.markFromJSON(n.mark))}}Step.jsonID("addNodeMark",AddNodeMarkStep);class RemoveNodeMarkStep extends Step{constructor(t,n){super(),this.pos=t,this.mark=n}apply(t){let n=t.nodeAt(this.pos);if(!n)return StepResult.fail("No node at mark step's position");let s=n.type.create(n.attrs,null,this.mark.removeFromSet(n.marks));return StepResult.fromReplace(t,this.pos,this.pos+1,new Slice(Fragment.from(s),0,n.isLeaf?0:1))}invert(t){let n=t.nodeAt(this.pos);return!n||!this.mark.isInSet(n.marks)?this:new AddNodeMarkStep(this.pos,this.mark)}map(t){let n=t.mapResult(this.pos,1);return n.deletedAfter?null:new RemoveNodeMarkStep(n.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(t,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new RemoveNodeMarkStep(n.pos,t.markFromJSON(n.mark))}}Step.jsonID("removeNodeMark",RemoveNodeMarkStep);class ReplaceStep extends Step{constructor(t,n,s,a=!1){super(),this.from=t,this.to=n,this.slice=s,this.structure=a}apply(t){return this.structure&&contentBetween(t,this.from,this.to)?StepResult.fail("Structure replace would overwrite content"):StepResult.fromReplace(t,this.from,this.to,this.slice)}getMap(){return new StepMap([this.from,this.to-this.from,this.slice.size])}invert(t){return new ReplaceStep(this.from,this.from+this.slice.size,t.slice(this.from,this.to))}map(t){let n=t.mapResult(this.to,-1),s=this.from==this.to&&ReplaceStep.MAP_BIAS<0?n:t.mapResult(this.from,1);return s.deletedAcross&&n.deletedAcross?null:new ReplaceStep(s.pos,Math.max(s.pos,n.pos),this.slice,this.structure)}merge(t){if(!(t instanceof ReplaceStep)||t.structure||this.structure)return null;if(this.from+this.slice.size==t.from&&!this.slice.openEnd&&!t.slice.openStart){let n=this.slice.size+t.slice.size==0?Slice.empty:new Slice(this.slice.content.append(t.slice.content),this.slice.openStart,t.slice.openEnd);return new ReplaceStep(this.from,this.to+(t.to-t.from),n,this.structure)}else if(t.to==this.from&&!this.slice.openStart&&!t.slice.openEnd){let n=this.slice.size+t.slice.size==0?Slice.empty:new Slice(t.slice.content.append(this.slice.content),t.slice.openStart,this.slice.openEnd);return new ReplaceStep(t.from,this.to,n,this.structure)}else return null}toJSON(){let t={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(t.slice=this.slice.toJSON()),this.structure&&(t.structure=!0),t}static fromJSON(t,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new ReplaceStep(n.from,n.to,Slice.fromJSON(t,n.slice),!!n.structure)}}ReplaceStep.MAP_BIAS=1,Step.jsonID("replace",ReplaceStep);class ReplaceAroundStep extends Step{constructor(t,n,s,a,o,l,c=!1){super(),this.from=t,this.to=n,this.gapFrom=s,this.gapTo=a,this.slice=o,this.insert=l,this.structure=c}apply(t){if(this.structure&&(contentBetween(t,this.from,this.gapFrom)||contentBetween(t,this.gapTo,this.to)))return StepResult.fail("Structure gap-replace would overwrite content");let n=t.slice(this.gapFrom,this.gapTo);if(n.openStart||n.openEnd)return StepResult.fail("Gap is not a flat range");let s=this.slice.insertAt(this.insert,n.content);return s?StepResult.fromReplace(t,this.from,this.to,s):StepResult.fail("Content does not fit in gap")}getMap(){return new StepMap([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(t){let n=this.gapTo-this.gapFrom;return new ReplaceAroundStep(this.from,this.from+this.slice.size+n,this.from+this.insert,this.from+this.insert+n,t.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(t){let n=t.mapResult(this.from,1),s=t.mapResult(this.to,-1),a=this.from==this.gapFrom?n.pos:t.map(this.gapFrom,-1),o=this.to==this.gapTo?s.pos:t.map(this.gapTo,1);return n.deletedAcross&&s.deletedAcross||a<n.pos||o>s.pos?null:new ReplaceAroundStep(n.pos,s.pos,a,o,this.slice,this.insert,this.structure)}toJSON(){let t={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(t.slice=this.slice.toJSON()),this.structure&&(t.structure=!0),t}static fromJSON(t,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 ReplaceAroundStep(n.from,n.to,n.gapFrom,n.gapTo,Slice.fromJSON(t,n.slice),n.insert,!!n.structure)}}Step.jsonID("replaceAround",ReplaceAroundStep);function contentBetween(e,t,n){let s=e.resolve(t),a=n-t,o=s.depth;for(;a>0&&o>0&&s.indexAfter(o)==s.node(o).childCount;)o--,a--;if(a>0){let l=s.node(o).maybeChild(s.indexAfter(o));for(;a>0;){if(!l||l.isLeaf)return!0;l=l.firstChild,a--}}return!1}function addMark(e,t,n,s){let a=[],o=[],l,c;e.doc.nodesBetween(t,n,(d,f,R)=>{if(!d.isInline)return;let S=d.marks;if(!s.isInSet(S)&&R.type.allowsMarkType(s.type)){let te=Math.max(f,t),A=Math.min(f+d.nodeSize,n),rt=s.addToSet(S);for(let st=0;st<S.length;st++)S[st].isInSet(rt)||(l&&l.to==te&&l.mark.eq(S[st])?l.to=A:a.push(l=new RemoveMarkStep(te,A,S[st])));c&&c.to==te?c.to=A:o.push(c=new AddMarkStep(te,A,s))}}),a.forEach(d=>e.step(d)),o.forEach(d=>e.step(d))}function removeMark(e,t,n,s){let a=[],o=0;e.doc.nodesBetween(t,n,(l,c)=>{if(!l.isInline)return;o++;let d=null;if(s instanceof MarkType){let f=l.marks,R;for(;R=s.isInSet(f);)(d||(d=[])).push(R),f=R.removeFromSet(f)}else s?s.isInSet(l.marks)&&(d=[s]):d=l.marks;if(d&&d.length){let f=Math.min(c+l.nodeSize,n);for(let R=0;R<d.length;R++){let S=d[R],te;for(let A=0;A<a.length;A++){let rt=a[A];rt.step==o-1&&S.eq(a[A].style)&&(te=rt)}te?(te.to=f,te.step=o):a.push({style:S,from:Math.max(c,t),to:f,step:o})}}}),a.forEach(l=>e.step(new RemoveMarkStep(l.from,l.to,l.style)))}function clearIncompatible(e,t,n,s=n.contentMatch,a=!0){let o=e.doc.nodeAt(t),l=[],c=t+1;for(let d=0;d<o.childCount;d++){let f=o.child(d),R=c+f.nodeSize,S=s.matchType(f.type);if(!S)l.push(new ReplaceStep(c,R,Slice.empty));else{s=S;for(let te=0;te<f.marks.length;te++)n.allowsMarkType(f.marks[te].type)||e.step(new RemoveMarkStep(c,R,f.marks[te]));if(a&&f.isText&&n.whitespace!="pre"){let te,A=/\r?\n|\r/g,rt;for(;te=A.exec(f.text);)rt||(rt=new Slice(Fragment.from(n.schema.text(" ",n.allowedMarks(f.marks))),0,0)),l.push(new ReplaceStep(c+te.index,c+te.index+te[0].length,rt))}}c=R}if(!s.validEnd){let d=s.fillBefore(Fragment.empty,!0);e.replace(c,c,new Slice(d,0,0))}for(let d=l.length-1;d>=0;d--)e.step(l[d])}function canCut(e,t,n){return(t==0||e.canReplace(t,e.childCount))&&(n==e.childCount||e.canReplace(0,n))}function liftTarget(e){let n=e.parent.content.cutByIndex(e.startIndex,e.endIndex);for(let s=e.depth,a=0,o=0;;--s){let l=e.$from.node(s),c=e.$from.index(s)+a,d=e.$to.indexAfter(s)-o;if(s<e.depth&&l.canReplace(c,d,n))return s;if(s==0||l.type.spec.isolating||!canCut(l,c,d))break;c&&(a=1),d<l.childCount&&(o=1)}return null}function lift$2(e,t,n){let{$from:s,$to:a,depth:o}=t,l=s.before(o+1),c=a.after(o+1),d=l,f=c,R=Fragment.empty,S=0;for(let rt=o,st=!1;rt>n;rt--)st||s.index(rt)>0?(st=!0,R=Fragment.from(s.node(rt).copy(R)),S++):d--;let te=Fragment.empty,A=0;for(let rt=o,st=!1;rt>n;rt--)st||a.after(rt+1)<a.end(rt)?(st=!0,te=Fragment.from(a.node(rt).copy(te)),A++):f++;e.step(new ReplaceAroundStep(d,f,l,c,new Slice(R.append(te),S,A),R.size-S,!0))}function findWrapping(e,t,n=null,s=e){let a=findWrappingOutside(e,t),o=a&&findWrappingInside(s,t);return o?a.map(withAttrs).concat({type:t,attrs:n}).concat(o.map(withAttrs)):null}function withAttrs(e){return{type:e,attrs:null}}function findWrappingOutside(e,t){let{parent:n,startIndex:s,endIndex:a}=e,o=n.contentMatchAt(s).findWrapping(t);if(!o)return null;let l=o.length?o[0]:t;return n.canReplaceWith(s,a,l)?o:null}function findWrappingInside(e,t){let{parent:n,startIndex:s,endIndex:a}=e,o=n.child(s),l=t.contentMatch.findWrapping(o.type);if(!l)return null;let d=(l.length?l[l.length-1]:t).contentMatch;for(let f=s;d&&f<a;f++)d=d.matchType(n.child(f).type);return!d||!d.validEnd?null:l}function wrap(e,t,n){let s=Fragment.empty;for(let l=n.length-1;l>=0;l--){if(s.size){let c=n[l].type.contentMatch.matchFragment(s);if(!c||!c.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}s=Fragment.from(n[l].type.create(n[l].attrs,s))}let a=t.start,o=t.end;e.step(new ReplaceAroundStep(a,o,a,o,new Slice(s,0,0),n.length,!0))}function setBlockType$1(e,t,n,s,a){if(!s.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let o=e.steps.length;e.doc.nodesBetween(t,n,(l,c)=>{let d=typeof a=="function"?a(l):a;if(l.isTextblock&&!l.hasMarkup(s,d)&&canChangeType(e.doc,e.mapping.slice(o).map(c),s)){let f=null;if(s.schema.linebreakReplacement){let A=s.whitespace=="pre",rt=!!s.contentMatch.matchType(s.schema.linebreakReplacement);A&&!rt?f=!1:!A&&rt&&(f=!0)}f===!1&&replaceLinebreaks(e,l,c,o),clearIncompatible(e,e.mapping.slice(o).map(c,1),s,void 0,f===null);let R=e.mapping.slice(o),S=R.map(c,1),te=R.map(c+l.nodeSize,1);return e.step(new ReplaceAroundStep(S,te,S+1,te-1,new Slice(Fragment.from(s.create(d,null,l.marks)),0,0),1,!0)),f===!0&&replaceNewlines(e,l,c,o),!1}})}function replaceNewlines(e,t,n,s){t.forEach((a,o)=>{if(a.isText){let l,c=/\r?\n|\r/g;for(;l=c.exec(a.text);){let d=e.mapping.slice(s).map(n+1+o+l.index);e.replaceWith(d,d+1,t.type.schema.linebreakReplacement.create())}}})}function replaceLinebreaks(e,t,n,s){t.forEach((a,o)=>{if(a.type==a.type.schema.linebreakReplacement){let l=e.mapping.slice(s).map(n+1+o);e.replaceWith(l,l+1,t.type.schema.text(`
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "randmarcomps",
3
3
  "private": false,
4
- "version": "1.634.0",
4
+ "version": "1.635.0",
5
5
  "description": "The UI library enabling speed and consistency in Randmar frontends.",
6
6
  "type": "module",
7
7
  "files": [