@nine-lab/nine-ux 0.1.266 → 0.1.267

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/nine-ux.js CHANGED
@@ -5,7 +5,7 @@ var Qi = (r) => {
5
5
  var Sa = (r, e, t) => e in r ? xa(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t;
6
6
  var V = (r, e, t) => Sa(r, typeof e != "symbol" ? e + "" : e, t), Ir = (r, e, t) => e.has(r) || Qi("Cannot " + t);
7
7
  var k = (r, e, t) => (Ir(r, e, "read from private field"), t ? t.call(r) : e.get(r)), C = (r, e, t) => e.has(r) ? Qi("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(r) : e.set(r, t), P = (r, e, t, n) => (Ir(r, e, "write to private field"), n ? n.call(r, t) : e.set(r, t), t), D = (r, e, t) => (Ir(r, e, "access private method"), t);
8
- import { nine as Ke, nineAlertPopup as wa, nineConfirmPopup as Ca, trace as Ma } from "@nine-lab/nine-util";
8
+ import { nine as Ke, nineAlertPopup as wa, nineConfirmPopup as Ca, trace as Ma } from "@ninebone/util";
9
9
  import Ta from "ninegrid2";
10
10
  const Ea = typeof window < "u" && window.nine ? window.nine : Ke;
11
11
  var sn, on, ei;
@@ -14083,7 +14083,7 @@ Ti = function() {
14083
14083
  const t = ti.getComponentCssPath("nineEditor.css"), n = t ? `@import "${t}";` : "";
14084
14084
  this.shadowRoot.innerHTML = `
14085
14085
  <style>
14086
- @import "https://cdn.jsdelivr.net/npm/@nine-lab/nine-ux@0.1.266/dist/css/nineEditor.css";
14086
+ @import "https://cdn.jsdelivr.net/npm/@nine-lab/nine-ux@0.1.267/dist/css/nineEditor.css";
14087
14087
  ${n}
14088
14088
  </style>
14089
14089
 
@@ -14209,7 +14209,7 @@ class $p extends HTMLElement {
14209
14209
  const t = Ke.cssPath ? `@import "${Ke.cssPath}/nineCollapse.css";` : "", n = document.createElement("template");
14210
14210
  n.innerHTML = `
14211
14211
  <style>
14212
- @import "https://cdn.jsdelivr.net/npm/@nine-lab/nine-ux@0.1.266/dist/css/nineCollapse.css";
14212
+ @import "https://cdn.jsdelivr.net/npm/@nine-lab/nine-ux@0.1.267/dist/css/nineCollapse.css";
14213
14213
  ${t}
14214
14214
  </style>
14215
14215
 
@@ -14331,7 +14331,7 @@ vt = new WeakMap(), Ot = new WeakMap(), xe = new WeakSet(), ua = async function(
14331
14331
  const t = this.getAttribute("lang") || "Bash", n = this.getAttribute("code") || this.textContent.trim() || "", i = this.getAttribute("css-path");
14332
14332
  k(this, Ot).innerHTML = `
14333
14333
  <style>
14334
- @import "https://cdn.jsdelivr.net/npm/@nine-lab/nine-ux@0.1.266/dist/css/nine-code-block.css";
14334
+ @import "https://cdn.jsdelivr.net/npm/@nine-lab/nine-ux@0.1.267/dist/css/nine-code-block.css";
14335
14335
  ${i ? `@import "${i}";` : ""}
14336
14336
  </style>
14337
14337
 
@@ -14370,7 +14370,7 @@ class Vp extends HTMLElement {
14370
14370
  const t = Ke.cssPath ? `@import "${Ke.cssPath}/nineTab.css";` : "";
14371
14371
  this.shadowRoot.innerHTML = `
14372
14372
  <style>
14373
- @import "https://cdn.jsdelivr.net/npm/@nine-lab/nine-ux@0.1.266/dist/css/nineTab.css";
14373
+ @import "https://cdn.jsdelivr.net/npm/@nine-lab/nine-ux@0.1.267/dist/css/nineTab.css";
14374
14374
  ${t}
14375
14375
  </style>
14376
14376
 
@@ -14679,7 +14679,7 @@ class Jp extends Wp {
14679
14679
  const t = this.getAttribute("caption"), n = this.getAttribute("max-column"), i = ((a = this.getAttribute("rows-height")) == null ? void 0 : a.replace(/,/g, " ")) || "", s = nine.cssPath ? `@import "${nine.cssPath}/ninePanel.css";` : "", o = document.createElement("template");
14680
14680
  o.innerHTML = `
14681
14681
  <style>
14682
- @import "https://cdn.jsdelivr.net/npm/@nine-lab/nine-ux@0.1.266/dist/css/ninePanel.css";
14682
+ @import "https://cdn.jsdelivr.net/npm/@nine-lab/nine-ux@0.1.267/dist/css/ninePanel.css";
14683
14683
  ${s}
14684
14684
  </style>
14685
14685
 
@@ -14762,7 +14762,7 @@ class Kp extends HTMLElement {
14762
14762
  const n = nine.cssPath ? `@import "${nine.cssPath}/nineMenu.css";` : "";
14763
14763
  this.shadowRoot.innerHTML = `
14764
14764
  <style>
14765
- @import "https://cdn.jsdelivr.net/npm/@nine-lab/nine-ux@0.1.266/dist/css/nineMenu.css";
14765
+ @import "https://cdn.jsdelivr.net/npm/@nine-lab/nine-ux@0.1.267/dist/css/nineMenu.css";
14766
14766
  ${n}
14767
14767
 
14768
14768
  :host {
@@ -14998,7 +14998,7 @@ class Xp extends HTMLElement {
14998
14998
  const i = Ke.cssPath ? `@import "${Ke.cssPath}/nineNav.css";` : "", s = document.createElement("template");
14999
14999
  s.innerHTML = `
15000
15000
  <style>
15001
- @import "https://cdn.jsdelivr.net/npm/@nine-lab/nine-ux@0.1.266/dist/css/nineNav.css";
15001
+ @import "https://cdn.jsdelivr.net/npm/@nine-lab/nine-ux@0.1.267/dist/css/nineNav.css";
15002
15002
  ${i}
15003
15003
  </style>
15004
15004
 
@@ -1,4 +1,4 @@
1
- (function(O,B){typeof exports=="object"&&typeof module<"u"?B(require("@nine-lab/nine-util"),require("ninegrid2")):typeof define=="function"&&define.amd?define(["@nine-lab/nine-util","ninegrid2"],B):(O=typeof globalThis<"u"?globalThis:O||self,B(O.nine,O.ninegrid$1))})(this,function(O,B){"use strict";var Bp=Object.defineProperty;var ca=O=>{throw TypeError(O)};var zp=(O,B,q)=>B in O?Bp(O,B,{enumerable:!0,configurable:!0,writable:!0,value:q}):O[B]=q;var _=(O,B,q)=>zp(O,typeof B!="symbol"?B+"":B,q),Ji=(O,B,q)=>B.has(O)||ca("Cannot "+q);var k=(O,B,q)=>(Ji(O,B,"read from private field"),q?q.call(O):B.get(O)),M=(O,B,q)=>B.has(O)?ca("Cannot add the same private member more than once"):B instanceof WeakSet?B.add(O):B.set(O,q),L=(O,B,q,Nn)=>(Ji(O,B,"write to private field"),Nn?Nn.call(O,q):B.set(O,q),q),R=(O,B,q)=>(Ji(O,B,"access private method"),q);var ln,an,Ki,cn,gt,dn,he,vn,Ui,_i,un,gr,ae,hn,fn,fe,Zi,ua,ha,fa,pa,ce,pn,yr,br,Pt,Lt,Me,ma,On,ga,kr,yt,Qi,ya,xr,mn,bt,gn,pe,An,es,ts,yn,Sr,wr,Bt,zt,kt,Mr,bn,kn,xn,Cr,xt,Tr,Er,ba,vr,Or,Ar,ka,Nr,Dr,Rr,xa,Sn,Be,$t,wn,Ir,Pr,Sa,me,Mn,Cn,Tn,En,Lr;const q=typeof window<"u"&&window.nine?window.nine:O.nine;class Nn{constructor(){M(this,an);M(this,ln,"")}get cssPath(){var e;return((e=q.config.ux)==null?void 0:e.cssPath)||k(this,ln)}set cssPath(e){L(this,ln,e)}alert(e,t="Alert"){return R(this,an,Ki).call(this,"alert",e,t,"classic")}confirm(e,t="Confirm"){return R(this,an,Ki).call(this,"confirm",e,t,"classic")}getComponentCssPath(e){const t=this.cssPath;return t?`${t.endsWith("/")?t:t+"/"}${e}`:null}}ln=new WeakMap,an=new WeakSet,Ki=function(e,t,n,i){const s={class:i,animation:"fade-in"},o=e==="alert"?O.nineAlertPopup:O.nineConfirmPopup;let l=!1;const a={rgb:()=>(s.class="rgb",a),classic:()=>(s.class="classic",a),fade:()=>(s.animation="fade",a),zoom:()=>(s.animation="zoom",a),up:()=>(s.animation="moveUp",a),down:()=>(s.animation="moveDown",a),left:()=>(s.animation="moveLeft",a),right:()=>(s.animation="moveRight",a),shake:()=>(s.animation="shake",a),run:()=>(s.animation="roadRunner",a),then:(c,d)=>(l=!0,o[e](t,n,s).then(c,d))};return Promise.resolve().then(()=>{l||(l=!0,o[e](t,n,s))}),a};const Br=new Nn;class wa extends HTMLElement{constructor(){super();M(this,he);_(this,"originContents");M(this,cn,!1);M(this,gt);M(this,dn,!1);_(this,"getData",()=>{const t={};return R(this,he,vn).call(this).forEach(n=>{const i=n.name;if(!i)return;let s;if(n.tagName==="INPUT"&&n.type==="checkbox"){let o=n.getAttribute("true-value")||"Y",l=n.getAttribute("false-value")||"N";s=n.checked?o:l}else n.tagName==="INPUT"&&n.type,s=n.value;t[i]?(Array.isArray(t[i])||(t[i]=[t[i]]),t[i].push(s)):t[i]=s}),t});_(this,"clearData",(t={})=>{R(this,he,_i).call(this),R(this,he,vn).call(this).forEach(n=>{const i=n.name;if(!i)return;const s=t&&t[i]!==void 0?t[i]:"";R(this,he,Ui).call(this,n,s)}),this.changed=!1});_(this,"setData",t=>{if(!t||typeof t!="object")return;R(this,he,_i).call(this);let n=!1;R(this,he,vn).call(this).forEach(i=>{const s=i.name;!s||!t.hasOwnProperty(s)||R(this,he,Ui).call(this,i,t[s])&&(n=!0)}),n&&(this.changed=!0)});_(this,"initData",t=>{this.clearData(t),this.changed=!1});M(this,un,t=>{this.changed=!0});M(this,gr,()=>{for(const t of this.attributes)t.name.startsWith("css-")&&this.style.setProperty(t.name.substring(4),t.value);this.originContents=this.innerHTML.trim(),this.innerHTML="",this.shadowRoot&&this.tagName.toLowerCase()==="nx-div"&&(this.shadowRoot.innerHTML=this.originContents)})}connectedCallback(){return k(this,cn)?!1:(this.getAttribute("use-shadow")!=="false"&&!this.shadowRoot?(this.attachShadow({mode:"open"}),L(this,gt,this.shadowRoot)):L(this,gt,this),k(this,gr).call(this),L(this,cn,!0),!0)}get changed(){return k(this,dn)}set changed(t){const n=!!t;L(this,dn,n);const i=this.closest(".detail-wrapper");if(i){const s=i.querySelector("nx-title2");s&&(s.changed=n)}}get root(){return k(this,gt)||this}}cn=new WeakMap,gt=new WeakMap,dn=new WeakMap,he=new WeakSet,vn=function(){return ninegrid.querySelectorAll("input[name], textarea[name], select[name], nx-editor[name]",k(this,gt))},Ui=function(t,n){const i=t.tagName.toUpperCase(),s=t.type;let o=!1;if(["INPUT","TEXTAREA","SELECT","NX-EDITOR"].includes(i))if(s==="checkbox"){const l=t.getAttribute("true-value")||"Y",a=String(l)===String(n);t.checked!==a&&(o=!0),t.checked=a}else if(s==="radio"){const l=String(t.value)===String(n);t.checked!==l&&(o=!0),t.checked=l}else t.value!==n&&(o=!0),t.value=n;else t.textContent!==n&&(o=!0),t.textContent=n;return o},_i=function(){R(this,he,vn).call(this).forEach(t=>{t.removeEventListener("input",k(this,un)),t.addEventListener("input",k(this,un))})},un=new WeakMap,gr=new WeakMap;function G(r){this.content=r}G.prototype={constructor:G,find:function(r){for(var e=0;e<this.content.length;e+=2)if(this.content[e]===r)return e;return-1},get:function(r){var e=this.find(r);return e==-1?void 0:this.content[e+1]},update:function(r,e,t){var n=t&&t!=r?this.remove(t):this,i=n.find(r),s=n.content.slice();return i==-1?s.push(t||r,e):(s[i+1]=e,t&&(s[i]=t)),new G(s)},remove:function(r){var e=this.find(r);if(e==-1)return this;var t=this.content.slice();return t.splice(e,2),new G(t)},addToStart:function(r,e){return new G([r,e].concat(this.remove(r).content))},addToEnd:function(r,e){var t=this.remove(r).content.slice();return t.push(r,e),new G(t)},addBefore:function(r,e,t){var n=this.remove(e),i=n.content.slice(),s=n.find(r);return i.splice(s==-1?i.length:s,0,e,t),new G(i)},forEach:function(r){for(var e=0;e<this.content.length;e+=2)r(this.content[e],this.content[e+1])},prepend:function(r){return r=G.from(r),r.size?new G(r.content.concat(this.subtract(r).content)):this},append:function(r){return r=G.from(r),r.size?new G(this.subtract(r).content.concat(r.content)):this},subtract:function(r){var e=this;r=G.from(r);for(var t=0;t<r.content.length;t+=2)e=e.remove(r.content[t]);return e},toObject:function(){var r={};return this.forEach(function(e,t){r[e]=t}),r},get size(){return this.content.length>>1}},G.from=function(r){if(r instanceof G)return r;var e=[];if(r)for(var t in r)e.push(t,r[t]);return new G(e)};function ns(r,e,t){for(let n=0;;n++){if(n==r.childCount||n==e.childCount)return r.childCount==e.childCount?null:t;let i=r.child(n),s=e.child(n);if(i==s){t+=i.nodeSize;continue}if(!i.sameMarkup(s))return t;if(i.isText&&i.text!=s.text){for(let o=0;i.text[o]==s.text[o];o++)t++;return t}if(i.content.size||s.content.size){let o=ns(i.content,s.content,t+1);if(o!=null)return o}t+=i.nodeSize}}function rs(r,e,t,n){for(let i=r.childCount,s=e.childCount;;){if(i==0||s==0)return i==s?null:{a:t,b:n};let o=r.child(--i),l=e.child(--s),a=o.nodeSize;if(o==l){t-=a,n-=a;continue}if(!o.sameMarkup(l))return{a:t,b:n};if(o.isText&&o.text!=l.text){let c=0,d=Math.min(o.text.length,l.text.length);for(;c<d&&o.text[o.text.length-c-1]==l.text[l.text.length-c-1];)c++,t--,n--;return{a:t,b:n}}if(o.content.size||l.content.size){let c=rs(o.content,l.content,t-1,n-1);if(c)return c}t-=a,n-=a}}class b{constructor(e,t){if(this.content=e,this.size=t||0,t==null)for(let n=0;n<e.length;n++)this.size+=e[n].nodeSize}nodesBetween(e,t,n,i=0,s){for(let o=0,l=0;l<t;o++){let a=this.content[o],c=l+a.nodeSize;if(c>e&&n(a,i+l,s||null,o)!==!1&&a.content.size){let d=l+1;a.nodesBetween(Math.max(0,e-d),Math.min(a.content.size,t-d),n,i+d)}l=c}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,t,n,i){let s="",o=!0;return this.nodesBetween(e,t,(l,a)=>{let c=l.isText?l.text.slice(Math.max(e,a)-a,t-a):l.isLeaf?i?typeof i=="function"?i(l):i:l.type.spec.leafText?l.type.spec.leafText(l):"":"";l.isBlock&&(l.isLeaf&&c||l.isTextblock)&&n&&(o?o=!1:s+=n),s+=c},0),s}append(e){if(!e.size)return this;if(!this.size)return e;let t=this.lastChild,n=e.firstChild,i=this.content.slice(),s=0;for(t.isText&&t.sameMarkup(n)&&(i[i.length-1]=t.withText(t.text+n.text),s=1);s<e.content.length;s++)i.push(e.content[s]);return new b(i,this.size+e.size)}cut(e,t=this.size){if(e==0&&t==this.size)return this;let n=[],i=0;if(t>e)for(let s=0,o=0;o<t;s++){let l=this.content[s],a=o+l.nodeSize;a>e&&((o<e||a>t)&&(l.isText?l=l.cut(Math.max(0,e-o),Math.min(l.text.length,t-o)):l=l.cut(Math.max(0,e-o-1),Math.min(l.content.size,t-o-1))),n.push(l),i+=l.nodeSize),o=a}return new b(n,i)}cutByIndex(e,t){return e==t?b.empty:e==0&&t==this.content.length?this:new b(this.content.slice(e,t))}replaceChild(e,t){let n=this.content[e];if(n==t)return this;let i=this.content.slice(),s=this.size+t.nodeSize-n.nodeSize;return i[e]=t,new b(i,s)}addToStart(e){return new b([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new b(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let t=0;t<this.content.length;t++)if(!this.content[t].eq(e.content[t]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(e){let t=this.content[e];if(!t)throw new RangeError("Index "+e+" out of range for "+this);return t}maybeChild(e){return this.content[e]||null}forEach(e){for(let t=0,n=0;t<this.content.length;t++){let i=this.content[t];e(i,n,t),n+=i.nodeSize}}findDiffStart(e,t=0){return ns(this,e,t)}findDiffEnd(e,t=this.size,n=e.size){return rs(this,e,t,n)}findIndex(e){if(e==0)return Dn(0,e);if(e==this.size)return Dn(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let t=0,n=0;;t++){let i=this.child(t),s=n+i.nodeSize;if(s>=e)return s==e?Dn(t+1,s):Dn(t,n);n=s}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,t){if(!t)return b.empty;if(!Array.isArray(t))throw new RangeError("Invalid input for Fragment.fromJSON");return new b(t.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return b.empty;let t,n=0;for(let i=0;i<e.length;i++){let s=e[i];n+=s.nodeSize,i&&s.isText&&e[i-1].sameMarkup(s)?(t||(t=e.slice(0,i)),t[t.length-1]=s.withText(t[t.length-1].text+s.text)):t&&t.push(s)}return new b(t||e,n)}static from(e){if(!e)return b.empty;if(e instanceof b)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new b([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}b.empty=new b([],0);const zr={index:0,offset:0};function Dn(r,e){return zr.index=r,zr.offset=e,zr}function Rn(r,e){if(r===e)return!0;if(!(r&&typeof r=="object")||!(e&&typeof e=="object"))return!1;let t=Array.isArray(r);if(Array.isArray(e)!=t)return!1;if(t){if(r.length!=e.length)return!1;for(let n=0;n<r.length;n++)if(!Rn(r[n],e[n]))return!1}else{for(let n in r)if(!(n in e)||!Rn(r[n],e[n]))return!1;for(let n in e)if(!(n in r))return!1}return!0}let z=class Gi{constructor(e,t){this.type=e,this.attrs=t}addToSet(e){let t,n=!1;for(let i=0;i<e.length;i++){let s=e[i];if(this.eq(s))return e;if(this.type.excludes(s.type))t||(t=e.slice(0,i));else{if(s.type.excludes(this.type))return e;!n&&s.type.rank>this.type.rank&&(t||(t=e.slice(0,i)),t.push(this),n=!0),t&&t.push(s)}}return t||(t=e.slice()),n||t.push(this),t}removeFromSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return e.slice(0,t).concat(e.slice(t+1));return e}isInSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return!0;return!1}eq(e){return this==e||this.type==e.type&&Rn(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,t){if(!t)throw new RangeError("Invalid input for Mark.fromJSON");let n=e.marks[t.type];if(!n)throw new RangeError(`There is no mark type ${t.type} in this schema`);let i=n.create(t.attrs);return n.checkAttrs(i.attrs),i}static sameSet(e,t){if(e==t)return!0;if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(!e[n].eq(t[n]))return!1;return!0}static setFrom(e){if(!e||Array.isArray(e)&&e.length==0)return Gi.none;if(e instanceof Gi)return[e];let t=e.slice();return t.sort((n,i)=>n.type.rank-i.type.rank),t}};z.none=[];class In extends Error{}class S{constructor(e,t,n){this.content=e,this.openStart=t,this.openEnd=n}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,t){let n=ss(this.content,e+this.openStart,t);return n&&new S(n,this.openStart,this.openEnd)}removeBetween(e,t){return new S(is(this.content,e+this.openStart,t+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(e,t){if(!t)return S.empty;let n=t.openStart||0,i=t.openEnd||0;if(typeof n!="number"||typeof i!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new S(b.fromJSON(e,t.content),n,i)}static maxOpen(e,t=!0){let n=0,i=0;for(let s=e.firstChild;s&&!s.isLeaf&&(t||!s.type.spec.isolating);s=s.firstChild)n++;for(let s=e.lastChild;s&&!s.isLeaf&&(t||!s.type.spec.isolating);s=s.lastChild)i++;return new S(e,n,i)}}S.empty=new S(b.empty,0,0);function is(r,e,t){let{index:n,offset:i}=r.findIndex(e),s=r.maybeChild(n),{index:o,offset:l}=r.findIndex(t);if(i==e||s.isText){if(l!=t&&!r.child(o).isText)throw new RangeError("Removing non-flat range");return r.cut(0,e).append(r.cut(t))}if(n!=o)throw new RangeError("Removing non-flat range");return r.replaceChild(n,s.copy(is(s.content,e-i-1,t-i-1)))}function ss(r,e,t,n){let{index:i,offset:s}=r.findIndex(e),o=r.maybeChild(i);if(s==e||o.isText)return n&&!n.canReplace(i,i,t)?null:r.cut(0,e).append(t).append(r.cut(e));let l=ss(o.content,e-s-1,t,o);return l&&r.replaceChild(i,o.copy(l))}function Ma(r,e,t){if(t.openStart>r.depth)throw new In("Inserted content deeper than insertion position");if(r.depth-t.openStart!=e.depth-t.openEnd)throw new In("Inconsistent open depths");return ls(r,e,t,0)}function ls(r,e,t,n){let i=r.index(n),s=r.node(n);if(i==e.index(n)&&n<r.depth-t.openStart){let o=ls(r,e,t,n+1);return s.copy(s.content.replaceChild(i,o))}else if(t.content.size)if(!t.openStart&&!t.openEnd&&r.depth==n&&e.depth==n){let o=r.parent,l=o.content;return et(o,l.cut(0,r.parentOffset).append(t.content).append(l.cut(e.parentOffset)))}else{let{start:o,end:l}=Ca(t,r);return et(s,cs(r,o,l,e,n))}else return et(s,Pn(r,e,n))}function as(r,e){if(!e.type.compatibleContent(r.type))throw new In("Cannot join "+e.type.name+" onto "+r.type.name)}function $r(r,e,t){let n=r.node(t);return as(n,e.node(t)),n}function Qe(r,e){let t=e.length-1;t>=0&&r.isText&&r.sameMarkup(e[t])?e[t]=r.withText(e[t].text+r.text):e.push(r)}function Ft(r,e,t,n){let i=(e||r).node(t),s=0,o=e?e.index(t):i.childCount;r&&(s=r.index(t),r.depth>t?s++:r.textOffset&&(Qe(r.nodeAfter,n),s++));for(let l=s;l<o;l++)Qe(i.child(l),n);e&&e.depth==t&&e.textOffset&&Qe(e.nodeBefore,n)}function et(r,e){return r.type.checkContent(e),r.copy(e)}function cs(r,e,t,n,i){let s=r.depth>i&&$r(r,e,i+1),o=n.depth>i&&$r(t,n,i+1),l=[];return Ft(null,r,i,l),s&&o&&e.index(i)==t.index(i)?(as(s,o),Qe(et(s,cs(r,e,t,n,i+1)),l)):(s&&Qe(et(s,Pn(r,e,i+1)),l),Ft(e,t,i,l),o&&Qe(et(o,Pn(t,n,i+1)),l)),Ft(n,null,i,l),new b(l)}function Pn(r,e,t){let n=[];if(Ft(null,r,t,n),r.depth>t){let i=$r(r,e,t+1);Qe(et(i,Pn(r,e,t+1)),n)}return Ft(e,null,t,n),new b(n)}function Ca(r,e){let t=e.depth-r.openStart,i=e.node(t).copy(r.content);for(let s=t-1;s>=0;s--)i=e.node(s).copy(b.from(i));return{start:i.resolveNoCache(r.openStart+t),end:i.resolveNoCache(i.content.size-r.openEnd-t)}}class Ht{constructor(e,t,n){this.pos=e,this.path=t,this.parentOffset=n,this.depth=t.length/3-1}resolveDepth(e){return e==null?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[this.resolveDepth(e)*3]}index(e){return this.path[this.resolveDepth(e)*3+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e==this.depth&&!this.textOffset?0:1)}start(e){return e=this.resolveDepth(e),e==0?0:this.path[e*3-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position before the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]}after(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position after the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]+this.path[e*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,t=this.index(this.depth);if(t==e.childCount)return null;let n=this.pos-this.path[this.path.length-1],i=e.child(t);return n?e.child(t).cut(n):i}get nodeBefore(){let e=this.index(this.depth),t=this.pos-this.path[this.path.length-1];return t?this.parent.child(e).cut(0,t):e==0?null:this.parent.child(e-1)}posAtIndex(e,t){t=this.resolveDepth(t);let n=this.path[t*3],i=t==0?0:this.path[t*3-1]+1;for(let s=0;s<e;s++)i+=n.child(s).nodeSize;return i}marks(){let e=this.parent,t=this.index();if(e.content.size==0)return z.none;if(this.textOffset)return e.child(t).marks;let n=e.maybeChild(t-1),i=e.maybeChild(t);if(!n){let l=n;n=i,i=l}let s=n.marks;for(var o=0;o<s.length;o++)s[o].type.spec.inclusive===!1&&(!i||!s[o].isInSet(i.marks))&&(s=s[o--].removeFromSet(s));return s}marksAcross(e){let t=this.parent.maybeChild(this.index());if(!t||!t.isInline)return null;let n=t.marks,i=e.parent.maybeChild(e.index());for(var s=0;s<n.length;s++)n[s].type.spec.inclusive===!1&&(!i||!n[s].isInSet(i.marks))&&(n=n[s--].removeFromSet(n));return n}sharedDepth(e){for(let t=this.depth;t>0;t--)if(this.start(t)<=e&&this.end(t)>=e)return t;return 0}blockRange(e=this,t){if(e.pos<this.pos)return e.blockRange(this);for(let n=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);n>=0;n--)if(e.pos<=this.end(n)&&(!t||t(this.node(n))))return new Ln(this,e,n);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos<this.pos?e:this}toString(){let e="";for(let t=1;t<=this.depth;t++)e+=(e?"/":"")+this.node(t).type.name+"_"+this.index(t-1);return e+":"+this.parentOffset}static resolve(e,t){if(!(t>=0&&t<=e.content.size))throw new RangeError("Position "+t+" out of range");let n=[],i=0,s=t;for(let o=e;;){let{index:l,offset:a}=o.content.findIndex(s),c=s-a;if(n.push(o,l,i+a),!c||(o=o.child(l),o.isText))break;s=c-1,i+=a+1}return new Ht(t,n,s)}static resolveCached(e,t){let n=ds.get(e);if(n)for(let s=0;s<n.elts.length;s++){let o=n.elts[s];if(o.pos==t)return o}else ds.set(e,n=new Ta);let i=n.elts[n.i]=Ht.resolve(e,t);return n.i=(n.i+1)%Ea,i}}class Ta{constructor(){this.elts=[],this.i=0}}const Ea=12,ds=new WeakMap;class Ln{constructor(e,t,n){this.$from=e,this.$to=t,this.depth=n}get start(){return this.$from.before(this.depth+1)}get end(){return this.$to.after(this.depth+1)}get parent(){return this.$from.node(this.depth)}get startIndex(){return this.$from.index(this.depth)}get endIndex(){return this.$to.indexAfter(this.depth)}}const va=Object.create(null);let ze=class Yi{constructor(e,t,n,i=z.none){this.type=e,this.attrs=t,this.marks=i,this.content=n||b.empty}get children(){return this.content.content}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(e){return this.content.child(e)}maybeChild(e){return this.content.maybeChild(e)}forEach(e){this.content.forEach(e)}nodesBetween(e,t,n,i=0){this.content.nodesBetween(e,t,n,i,this)}descendants(e){this.nodesBetween(0,this.content.size,e)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,"")}textBetween(e,t,n,i){return this.content.textBetween(e,t,n,i)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(e){return this==e||this.sameMarkup(e)&&this.content.eq(e.content)}sameMarkup(e){return this.hasMarkup(e.type,e.attrs,e.marks)}hasMarkup(e,t,n){return this.type==e&&Rn(this.attrs,t||e.defaultAttrs||va)&&z.sameSet(this.marks,n||z.none)}copy(e=null){return e==this.content?this:new Yi(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new Yi(this.type,this.attrs,this.content,e)}cut(e,t=this.content.size){return e==0&&t==this.content.size?this:this.copy(this.content.cut(e,t))}slice(e,t=this.content.size,n=!1){if(e==t)return S.empty;let i=this.resolve(e),s=this.resolve(t),o=n?0:i.sharedDepth(t),l=i.start(o),c=i.node(o).content.cut(i.pos-l,s.pos-l);return new S(c,i.depth-o,s.depth-o)}replace(e,t,n){return Ma(this.resolve(e),this.resolve(t),n)}nodeAt(e){for(let t=this;;){let{index:n,offset:i}=t.content.findIndex(e);if(t=t.maybeChild(n),!t)return null;if(i==e||t.isText)return t;e-=i+1}}childAfter(e){let{index:t,offset:n}=this.content.findIndex(e);return{node:this.content.maybeChild(t),index:t,offset:n}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:t,offset:n}=this.content.findIndex(e);if(n<e)return{node:this.content.child(t),index:t,offset:n};let i=this.content.child(t-1);return{node:i,index:t-1,offset:n-i.nodeSize}}resolve(e){return Ht.resolveCached(this,e)}resolveNoCache(e){return Ht.resolve(this,e)}rangeHasMark(e,t,n){let i=!1;return t>e&&this.nodesBetween(e,t,s=>(n.isInSet(s.marks)&&(i=!0),!i)),i}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let e=this.type.name;return this.content.size&&(e+="("+this.content.toStringInner()+")"),us(this.marks,e)}contentMatchAt(e){let t=this.type.contentMatch.matchFragment(this.content,0,e);if(!t)throw new Error("Called contentMatchAt on a node with invalid content");return t}canReplace(e,t,n=b.empty,i=0,s=n.childCount){let o=this.contentMatchAt(e).matchFragment(n,i,s),l=o&&o.matchFragment(this.content,t);if(!l||!l.validEnd)return!1;for(let a=i;a<s;a++)if(!this.type.allowsMarks(n.child(a).marks))return!1;return!0}canReplaceWith(e,t,n,i){if(i&&!this.type.allowsMarks(i))return!1;let s=this.contentMatchAt(e).matchType(n),o=s&&s.matchFragment(this.content,t);return o?o.validEnd:!1}canAppend(e){return e.content.size?this.canReplace(this.childCount,this.childCount,e.content):this.type.compatibleContent(e.type)}check(){this.type.checkContent(this.content),this.type.checkAttrs(this.attrs);let e=z.none;for(let t=0;t<this.marks.length;t++){let n=this.marks[t];n.type.checkAttrs(n.attrs),e=n.addToSet(e)}if(!z.sameSet(e,this.marks))throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(t=>t.type.name)}`);this.content.forEach(t=>t.check())}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(t=>t.toJSON())),e}static fromJSON(e,t){if(!t)throw new RangeError("Invalid input for Node.fromJSON");let n;if(t.marks){if(!Array.isArray(t.marks))throw new RangeError("Invalid mark data for Node.fromJSON");n=t.marks.map(e.markFromJSON)}if(t.type=="text"){if(typeof t.text!="string")throw new RangeError("Invalid text node in JSON");return e.text(t.text,n)}let i=b.fromJSON(e,t.content),s=e.nodeType(t.type).create(t.attrs,i,n);return s.type.checkAttrs(s.attrs),s}};ze.prototype.text=void 0;class Bn extends ze{constructor(e,t,n,i){if(super(e,t,null,i),!n)throw new RangeError("Empty text nodes are not allowed");this.text=n}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):us(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,t){return this.text.slice(e,t)}get nodeSize(){return this.text.length}mark(e){return e==this.marks?this:new Bn(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new Bn(this.type,this.attrs,e,this.marks)}cut(e=0,t=this.text.length){return e==0&&t==this.text.length?this:this.withText(this.text.slice(e,t))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}}function us(r,e){for(let t=r.length-1;t>=0;t--)e=r[t].type.name+"("+e+")";return e}class tt{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,t){let n=new Oa(e,t);if(n.next==null)return tt.empty;let i=hs(n);n.next&&n.err("Unexpected trailing text");let s=La(Pa(i));return Ba(s,n),s}matchType(e){for(let t=0;t<this.next.length;t++)if(this.next[t].type==e)return this.next[t].next;return null}matchFragment(e,t=0,n=e.childCount){let i=this;for(let s=t;i&&s<n;s++)i=i.matchType(e.child(s).type);return i}get inlineContent(){return this.next.length!=0&&this.next[0].type.isInline}get defaultType(){for(let e=0;e<this.next.length;e++){let{type:t}=this.next[e];if(!(t.isText||t.hasRequiredAttrs()))return t}return null}compatible(e){for(let t=0;t<this.next.length;t++)for(let n=0;n<e.next.length;n++)if(this.next[t].type==e.next[n].type)return!0;return!1}fillBefore(e,t=!1,n=0){let i=[this];function s(o,l){let a=o.matchFragment(e,n);if(a&&(!t||a.validEnd))return b.from(l.map(c=>c.createAndFill()));for(let c=0;c<o.next.length;c++){let{type:d,next:u}=o.next[c];if(!(d.isText||d.hasRequiredAttrs())&&i.indexOf(u)==-1){i.push(u);let h=s(u,l.concat(d));if(h)return h}}return null}return s(this,[])}findWrapping(e){for(let n=0;n<this.wrapCache.length;n+=2)if(this.wrapCache[n]==e)return this.wrapCache[n+1];let t=this.computeWrapping(e);return this.wrapCache.push(e,t),t}computeWrapping(e){let t=Object.create(null),n=[{match:this,type:null,via:null}];for(;n.length;){let i=n.shift(),s=i.match;if(s.matchType(e)){let o=[];for(let l=i;l.type;l=l.via)o.push(l.type);return o.reverse()}for(let o=0;o<s.next.length;o++){let{type:l,next:a}=s.next[o];!l.isLeaf&&!l.hasRequiredAttrs()&&!(l.name in t)&&(!i.type||a.validEnd)&&(n.push({match:l.contentMatch,type:l,via:i}),t[l.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw new RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function t(n){e.push(n);for(let i=0;i<n.next.length;i++)e.indexOf(n.next[i].next)==-1&&t(n.next[i].next)}return t(this),e.map((n,i)=>{let s=i+(n.validEnd?"*":" ")+" ";for(let o=0;o<n.next.length;o++)s+=(o?", ":"")+n.next[o].type.name+"->"+e.indexOf(n.next[o].next);return s}).join(`
1
+ (function(O,B){typeof exports=="object"&&typeof module<"u"?B(require("@ninebone/util"),require("ninegrid2")):typeof define=="function"&&define.amd?define(["@ninebone/util","ninegrid2"],B):(O=typeof globalThis<"u"?globalThis:O||self,B(O.nine,O.ninegrid$1))})(this,function(O,B){"use strict";var Bp=Object.defineProperty;var ca=O=>{throw TypeError(O)};var zp=(O,B,q)=>B in O?Bp(O,B,{enumerable:!0,configurable:!0,writable:!0,value:q}):O[B]=q;var _=(O,B,q)=>zp(O,typeof B!="symbol"?B+"":B,q),Ji=(O,B,q)=>B.has(O)||ca("Cannot "+q);var k=(O,B,q)=>(Ji(O,B,"read from private field"),q?q.call(O):B.get(O)),M=(O,B,q)=>B.has(O)?ca("Cannot add the same private member more than once"):B instanceof WeakSet?B.add(O):B.set(O,q),L=(O,B,q,Nn)=>(Ji(O,B,"write to private field"),Nn?Nn.call(O,q):B.set(O,q),q),R=(O,B,q)=>(Ji(O,B,"access private method"),q);var ln,an,Ki,cn,gt,dn,he,vn,Ui,_i,un,gr,ae,hn,fn,fe,Zi,ua,ha,fa,pa,ce,pn,yr,br,Pt,Lt,Me,ma,On,ga,kr,yt,Qi,ya,xr,mn,bt,gn,pe,An,es,ts,yn,Sr,wr,Bt,zt,kt,Mr,bn,kn,xn,Cr,xt,Tr,Er,ba,vr,Or,Ar,ka,Nr,Dr,Rr,xa,Sn,Be,$t,wn,Ir,Pr,Sa,me,Mn,Cn,Tn,En,Lr;const q=typeof window<"u"&&window.nine?window.nine:O.nine;class Nn{constructor(){M(this,an);M(this,ln,"")}get cssPath(){var e;return((e=q.config.ux)==null?void 0:e.cssPath)||k(this,ln)}set cssPath(e){L(this,ln,e)}alert(e,t="Alert"){return R(this,an,Ki).call(this,"alert",e,t,"classic")}confirm(e,t="Confirm"){return R(this,an,Ki).call(this,"confirm",e,t,"classic")}getComponentCssPath(e){const t=this.cssPath;return t?`${t.endsWith("/")?t:t+"/"}${e}`:null}}ln=new WeakMap,an=new WeakSet,Ki=function(e,t,n,i){const s={class:i,animation:"fade-in"},o=e==="alert"?O.nineAlertPopup:O.nineConfirmPopup;let l=!1;const a={rgb:()=>(s.class="rgb",a),classic:()=>(s.class="classic",a),fade:()=>(s.animation="fade",a),zoom:()=>(s.animation="zoom",a),up:()=>(s.animation="moveUp",a),down:()=>(s.animation="moveDown",a),left:()=>(s.animation="moveLeft",a),right:()=>(s.animation="moveRight",a),shake:()=>(s.animation="shake",a),run:()=>(s.animation="roadRunner",a),then:(c,d)=>(l=!0,o[e](t,n,s).then(c,d))};return Promise.resolve().then(()=>{l||(l=!0,o[e](t,n,s))}),a};const Br=new Nn;class wa extends HTMLElement{constructor(){super();M(this,he);_(this,"originContents");M(this,cn,!1);M(this,gt);M(this,dn,!1);_(this,"getData",()=>{const t={};return R(this,he,vn).call(this).forEach(n=>{const i=n.name;if(!i)return;let s;if(n.tagName==="INPUT"&&n.type==="checkbox"){let o=n.getAttribute("true-value")||"Y",l=n.getAttribute("false-value")||"N";s=n.checked?o:l}else n.tagName==="INPUT"&&n.type,s=n.value;t[i]?(Array.isArray(t[i])||(t[i]=[t[i]]),t[i].push(s)):t[i]=s}),t});_(this,"clearData",(t={})=>{R(this,he,_i).call(this),R(this,he,vn).call(this).forEach(n=>{const i=n.name;if(!i)return;const s=t&&t[i]!==void 0?t[i]:"";R(this,he,Ui).call(this,n,s)}),this.changed=!1});_(this,"setData",t=>{if(!t||typeof t!="object")return;R(this,he,_i).call(this);let n=!1;R(this,he,vn).call(this).forEach(i=>{const s=i.name;!s||!t.hasOwnProperty(s)||R(this,he,Ui).call(this,i,t[s])&&(n=!0)}),n&&(this.changed=!0)});_(this,"initData",t=>{this.clearData(t),this.changed=!1});M(this,un,t=>{this.changed=!0});M(this,gr,()=>{for(const t of this.attributes)t.name.startsWith("css-")&&this.style.setProperty(t.name.substring(4),t.value);this.originContents=this.innerHTML.trim(),this.innerHTML="",this.shadowRoot&&this.tagName.toLowerCase()==="nx-div"&&(this.shadowRoot.innerHTML=this.originContents)})}connectedCallback(){return k(this,cn)?!1:(this.getAttribute("use-shadow")!=="false"&&!this.shadowRoot?(this.attachShadow({mode:"open"}),L(this,gt,this.shadowRoot)):L(this,gt,this),k(this,gr).call(this),L(this,cn,!0),!0)}get changed(){return k(this,dn)}set changed(t){const n=!!t;L(this,dn,n);const i=this.closest(".detail-wrapper");if(i){const s=i.querySelector("nx-title2");s&&(s.changed=n)}}get root(){return k(this,gt)||this}}cn=new WeakMap,gt=new WeakMap,dn=new WeakMap,he=new WeakSet,vn=function(){return ninegrid.querySelectorAll("input[name], textarea[name], select[name], nx-editor[name]",k(this,gt))},Ui=function(t,n){const i=t.tagName.toUpperCase(),s=t.type;let o=!1;if(["INPUT","TEXTAREA","SELECT","NX-EDITOR"].includes(i))if(s==="checkbox"){const l=t.getAttribute("true-value")||"Y",a=String(l)===String(n);t.checked!==a&&(o=!0),t.checked=a}else if(s==="radio"){const l=String(t.value)===String(n);t.checked!==l&&(o=!0),t.checked=l}else t.value!==n&&(o=!0),t.value=n;else t.textContent!==n&&(o=!0),t.textContent=n;return o},_i=function(){R(this,he,vn).call(this).forEach(t=>{t.removeEventListener("input",k(this,un)),t.addEventListener("input",k(this,un))})},un=new WeakMap,gr=new WeakMap;function G(r){this.content=r}G.prototype={constructor:G,find:function(r){for(var e=0;e<this.content.length;e+=2)if(this.content[e]===r)return e;return-1},get:function(r){var e=this.find(r);return e==-1?void 0:this.content[e+1]},update:function(r,e,t){var n=t&&t!=r?this.remove(t):this,i=n.find(r),s=n.content.slice();return i==-1?s.push(t||r,e):(s[i+1]=e,t&&(s[i]=t)),new G(s)},remove:function(r){var e=this.find(r);if(e==-1)return this;var t=this.content.slice();return t.splice(e,2),new G(t)},addToStart:function(r,e){return new G([r,e].concat(this.remove(r).content))},addToEnd:function(r,e){var t=this.remove(r).content.slice();return t.push(r,e),new G(t)},addBefore:function(r,e,t){var n=this.remove(e),i=n.content.slice(),s=n.find(r);return i.splice(s==-1?i.length:s,0,e,t),new G(i)},forEach:function(r){for(var e=0;e<this.content.length;e+=2)r(this.content[e],this.content[e+1])},prepend:function(r){return r=G.from(r),r.size?new G(r.content.concat(this.subtract(r).content)):this},append:function(r){return r=G.from(r),r.size?new G(this.subtract(r).content.concat(r.content)):this},subtract:function(r){var e=this;r=G.from(r);for(var t=0;t<r.content.length;t+=2)e=e.remove(r.content[t]);return e},toObject:function(){var r={};return this.forEach(function(e,t){r[e]=t}),r},get size(){return this.content.length>>1}},G.from=function(r){if(r instanceof G)return r;var e=[];if(r)for(var t in r)e.push(t,r[t]);return new G(e)};function ns(r,e,t){for(let n=0;;n++){if(n==r.childCount||n==e.childCount)return r.childCount==e.childCount?null:t;let i=r.child(n),s=e.child(n);if(i==s){t+=i.nodeSize;continue}if(!i.sameMarkup(s))return t;if(i.isText&&i.text!=s.text){for(let o=0;i.text[o]==s.text[o];o++)t++;return t}if(i.content.size||s.content.size){let o=ns(i.content,s.content,t+1);if(o!=null)return o}t+=i.nodeSize}}function rs(r,e,t,n){for(let i=r.childCount,s=e.childCount;;){if(i==0||s==0)return i==s?null:{a:t,b:n};let o=r.child(--i),l=e.child(--s),a=o.nodeSize;if(o==l){t-=a,n-=a;continue}if(!o.sameMarkup(l))return{a:t,b:n};if(o.isText&&o.text!=l.text){let c=0,d=Math.min(o.text.length,l.text.length);for(;c<d&&o.text[o.text.length-c-1]==l.text[l.text.length-c-1];)c++,t--,n--;return{a:t,b:n}}if(o.content.size||l.content.size){let c=rs(o.content,l.content,t-1,n-1);if(c)return c}t-=a,n-=a}}class b{constructor(e,t){if(this.content=e,this.size=t||0,t==null)for(let n=0;n<e.length;n++)this.size+=e[n].nodeSize}nodesBetween(e,t,n,i=0,s){for(let o=0,l=0;l<t;o++){let a=this.content[o],c=l+a.nodeSize;if(c>e&&n(a,i+l,s||null,o)!==!1&&a.content.size){let d=l+1;a.nodesBetween(Math.max(0,e-d),Math.min(a.content.size,t-d),n,i+d)}l=c}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,t,n,i){let s="",o=!0;return this.nodesBetween(e,t,(l,a)=>{let c=l.isText?l.text.slice(Math.max(e,a)-a,t-a):l.isLeaf?i?typeof i=="function"?i(l):i:l.type.spec.leafText?l.type.spec.leafText(l):"":"";l.isBlock&&(l.isLeaf&&c||l.isTextblock)&&n&&(o?o=!1:s+=n),s+=c},0),s}append(e){if(!e.size)return this;if(!this.size)return e;let t=this.lastChild,n=e.firstChild,i=this.content.slice(),s=0;for(t.isText&&t.sameMarkup(n)&&(i[i.length-1]=t.withText(t.text+n.text),s=1);s<e.content.length;s++)i.push(e.content[s]);return new b(i,this.size+e.size)}cut(e,t=this.size){if(e==0&&t==this.size)return this;let n=[],i=0;if(t>e)for(let s=0,o=0;o<t;s++){let l=this.content[s],a=o+l.nodeSize;a>e&&((o<e||a>t)&&(l.isText?l=l.cut(Math.max(0,e-o),Math.min(l.text.length,t-o)):l=l.cut(Math.max(0,e-o-1),Math.min(l.content.size,t-o-1))),n.push(l),i+=l.nodeSize),o=a}return new b(n,i)}cutByIndex(e,t){return e==t?b.empty:e==0&&t==this.content.length?this:new b(this.content.slice(e,t))}replaceChild(e,t){let n=this.content[e];if(n==t)return this;let i=this.content.slice(),s=this.size+t.nodeSize-n.nodeSize;return i[e]=t,new b(i,s)}addToStart(e){return new b([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new b(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let t=0;t<this.content.length;t++)if(!this.content[t].eq(e.content[t]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(e){let t=this.content[e];if(!t)throw new RangeError("Index "+e+" out of range for "+this);return t}maybeChild(e){return this.content[e]||null}forEach(e){for(let t=0,n=0;t<this.content.length;t++){let i=this.content[t];e(i,n,t),n+=i.nodeSize}}findDiffStart(e,t=0){return ns(this,e,t)}findDiffEnd(e,t=this.size,n=e.size){return rs(this,e,t,n)}findIndex(e){if(e==0)return Dn(0,e);if(e==this.size)return Dn(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let t=0,n=0;;t++){let i=this.child(t),s=n+i.nodeSize;if(s>=e)return s==e?Dn(t+1,s):Dn(t,n);n=s}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,t){if(!t)return b.empty;if(!Array.isArray(t))throw new RangeError("Invalid input for Fragment.fromJSON");return new b(t.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return b.empty;let t,n=0;for(let i=0;i<e.length;i++){let s=e[i];n+=s.nodeSize,i&&s.isText&&e[i-1].sameMarkup(s)?(t||(t=e.slice(0,i)),t[t.length-1]=s.withText(t[t.length-1].text+s.text)):t&&t.push(s)}return new b(t||e,n)}static from(e){if(!e)return b.empty;if(e instanceof b)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new b([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}b.empty=new b([],0);const zr={index:0,offset:0};function Dn(r,e){return zr.index=r,zr.offset=e,zr}function Rn(r,e){if(r===e)return!0;if(!(r&&typeof r=="object")||!(e&&typeof e=="object"))return!1;let t=Array.isArray(r);if(Array.isArray(e)!=t)return!1;if(t){if(r.length!=e.length)return!1;for(let n=0;n<r.length;n++)if(!Rn(r[n],e[n]))return!1}else{for(let n in r)if(!(n in e)||!Rn(r[n],e[n]))return!1;for(let n in e)if(!(n in r))return!1}return!0}let z=class Gi{constructor(e,t){this.type=e,this.attrs=t}addToSet(e){let t,n=!1;for(let i=0;i<e.length;i++){let s=e[i];if(this.eq(s))return e;if(this.type.excludes(s.type))t||(t=e.slice(0,i));else{if(s.type.excludes(this.type))return e;!n&&s.type.rank>this.type.rank&&(t||(t=e.slice(0,i)),t.push(this),n=!0),t&&t.push(s)}}return t||(t=e.slice()),n||t.push(this),t}removeFromSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return e.slice(0,t).concat(e.slice(t+1));return e}isInSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return!0;return!1}eq(e){return this==e||this.type==e.type&&Rn(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,t){if(!t)throw new RangeError("Invalid input for Mark.fromJSON");let n=e.marks[t.type];if(!n)throw new RangeError(`There is no mark type ${t.type} in this schema`);let i=n.create(t.attrs);return n.checkAttrs(i.attrs),i}static sameSet(e,t){if(e==t)return!0;if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(!e[n].eq(t[n]))return!1;return!0}static setFrom(e){if(!e||Array.isArray(e)&&e.length==0)return Gi.none;if(e instanceof Gi)return[e];let t=e.slice();return t.sort((n,i)=>n.type.rank-i.type.rank),t}};z.none=[];class In extends Error{}class S{constructor(e,t,n){this.content=e,this.openStart=t,this.openEnd=n}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,t){let n=ss(this.content,e+this.openStart,t);return n&&new S(n,this.openStart,this.openEnd)}removeBetween(e,t){return new S(is(this.content,e+this.openStart,t+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(e,t){if(!t)return S.empty;let n=t.openStart||0,i=t.openEnd||0;if(typeof n!="number"||typeof i!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new S(b.fromJSON(e,t.content),n,i)}static maxOpen(e,t=!0){let n=0,i=0;for(let s=e.firstChild;s&&!s.isLeaf&&(t||!s.type.spec.isolating);s=s.firstChild)n++;for(let s=e.lastChild;s&&!s.isLeaf&&(t||!s.type.spec.isolating);s=s.lastChild)i++;return new S(e,n,i)}}S.empty=new S(b.empty,0,0);function is(r,e,t){let{index:n,offset:i}=r.findIndex(e),s=r.maybeChild(n),{index:o,offset:l}=r.findIndex(t);if(i==e||s.isText){if(l!=t&&!r.child(o).isText)throw new RangeError("Removing non-flat range");return r.cut(0,e).append(r.cut(t))}if(n!=o)throw new RangeError("Removing non-flat range");return r.replaceChild(n,s.copy(is(s.content,e-i-1,t-i-1)))}function ss(r,e,t,n){let{index:i,offset:s}=r.findIndex(e),o=r.maybeChild(i);if(s==e||o.isText)return n&&!n.canReplace(i,i,t)?null:r.cut(0,e).append(t).append(r.cut(e));let l=ss(o.content,e-s-1,t,o);return l&&r.replaceChild(i,o.copy(l))}function Ma(r,e,t){if(t.openStart>r.depth)throw new In("Inserted content deeper than insertion position");if(r.depth-t.openStart!=e.depth-t.openEnd)throw new In("Inconsistent open depths");return ls(r,e,t,0)}function ls(r,e,t,n){let i=r.index(n),s=r.node(n);if(i==e.index(n)&&n<r.depth-t.openStart){let o=ls(r,e,t,n+1);return s.copy(s.content.replaceChild(i,o))}else if(t.content.size)if(!t.openStart&&!t.openEnd&&r.depth==n&&e.depth==n){let o=r.parent,l=o.content;return et(o,l.cut(0,r.parentOffset).append(t.content).append(l.cut(e.parentOffset)))}else{let{start:o,end:l}=Ca(t,r);return et(s,cs(r,o,l,e,n))}else return et(s,Pn(r,e,n))}function as(r,e){if(!e.type.compatibleContent(r.type))throw new In("Cannot join "+e.type.name+" onto "+r.type.name)}function $r(r,e,t){let n=r.node(t);return as(n,e.node(t)),n}function Qe(r,e){let t=e.length-1;t>=0&&r.isText&&r.sameMarkup(e[t])?e[t]=r.withText(e[t].text+r.text):e.push(r)}function Ft(r,e,t,n){let i=(e||r).node(t),s=0,o=e?e.index(t):i.childCount;r&&(s=r.index(t),r.depth>t?s++:r.textOffset&&(Qe(r.nodeAfter,n),s++));for(let l=s;l<o;l++)Qe(i.child(l),n);e&&e.depth==t&&e.textOffset&&Qe(e.nodeBefore,n)}function et(r,e){return r.type.checkContent(e),r.copy(e)}function cs(r,e,t,n,i){let s=r.depth>i&&$r(r,e,i+1),o=n.depth>i&&$r(t,n,i+1),l=[];return Ft(null,r,i,l),s&&o&&e.index(i)==t.index(i)?(as(s,o),Qe(et(s,cs(r,e,t,n,i+1)),l)):(s&&Qe(et(s,Pn(r,e,i+1)),l),Ft(e,t,i,l),o&&Qe(et(o,Pn(t,n,i+1)),l)),Ft(n,null,i,l),new b(l)}function Pn(r,e,t){let n=[];if(Ft(null,r,t,n),r.depth>t){let i=$r(r,e,t+1);Qe(et(i,Pn(r,e,t+1)),n)}return Ft(e,null,t,n),new b(n)}function Ca(r,e){let t=e.depth-r.openStart,i=e.node(t).copy(r.content);for(let s=t-1;s>=0;s--)i=e.node(s).copy(b.from(i));return{start:i.resolveNoCache(r.openStart+t),end:i.resolveNoCache(i.content.size-r.openEnd-t)}}class Ht{constructor(e,t,n){this.pos=e,this.path=t,this.parentOffset=n,this.depth=t.length/3-1}resolveDepth(e){return e==null?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[this.resolveDepth(e)*3]}index(e){return this.path[this.resolveDepth(e)*3+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e==this.depth&&!this.textOffset?0:1)}start(e){return e=this.resolveDepth(e),e==0?0:this.path[e*3-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position before the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]}after(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position after the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]+this.path[e*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,t=this.index(this.depth);if(t==e.childCount)return null;let n=this.pos-this.path[this.path.length-1],i=e.child(t);return n?e.child(t).cut(n):i}get nodeBefore(){let e=this.index(this.depth),t=this.pos-this.path[this.path.length-1];return t?this.parent.child(e).cut(0,t):e==0?null:this.parent.child(e-1)}posAtIndex(e,t){t=this.resolveDepth(t);let n=this.path[t*3],i=t==0?0:this.path[t*3-1]+1;for(let s=0;s<e;s++)i+=n.child(s).nodeSize;return i}marks(){let e=this.parent,t=this.index();if(e.content.size==0)return z.none;if(this.textOffset)return e.child(t).marks;let n=e.maybeChild(t-1),i=e.maybeChild(t);if(!n){let l=n;n=i,i=l}let s=n.marks;for(var o=0;o<s.length;o++)s[o].type.spec.inclusive===!1&&(!i||!s[o].isInSet(i.marks))&&(s=s[o--].removeFromSet(s));return s}marksAcross(e){let t=this.parent.maybeChild(this.index());if(!t||!t.isInline)return null;let n=t.marks,i=e.parent.maybeChild(e.index());for(var s=0;s<n.length;s++)n[s].type.spec.inclusive===!1&&(!i||!n[s].isInSet(i.marks))&&(n=n[s--].removeFromSet(n));return n}sharedDepth(e){for(let t=this.depth;t>0;t--)if(this.start(t)<=e&&this.end(t)>=e)return t;return 0}blockRange(e=this,t){if(e.pos<this.pos)return e.blockRange(this);for(let n=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);n>=0;n--)if(e.pos<=this.end(n)&&(!t||t(this.node(n))))return new Ln(this,e,n);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos<this.pos?e:this}toString(){let e="";for(let t=1;t<=this.depth;t++)e+=(e?"/":"")+this.node(t).type.name+"_"+this.index(t-1);return e+":"+this.parentOffset}static resolve(e,t){if(!(t>=0&&t<=e.content.size))throw new RangeError("Position "+t+" out of range");let n=[],i=0,s=t;for(let o=e;;){let{index:l,offset:a}=o.content.findIndex(s),c=s-a;if(n.push(o,l,i+a),!c||(o=o.child(l),o.isText))break;s=c-1,i+=a+1}return new Ht(t,n,s)}static resolveCached(e,t){let n=ds.get(e);if(n)for(let s=0;s<n.elts.length;s++){let o=n.elts[s];if(o.pos==t)return o}else ds.set(e,n=new Ta);let i=n.elts[n.i]=Ht.resolve(e,t);return n.i=(n.i+1)%Ea,i}}class Ta{constructor(){this.elts=[],this.i=0}}const Ea=12,ds=new WeakMap;class Ln{constructor(e,t,n){this.$from=e,this.$to=t,this.depth=n}get start(){return this.$from.before(this.depth+1)}get end(){return this.$to.after(this.depth+1)}get parent(){return this.$from.node(this.depth)}get startIndex(){return this.$from.index(this.depth)}get endIndex(){return this.$to.indexAfter(this.depth)}}const va=Object.create(null);let ze=class Yi{constructor(e,t,n,i=z.none){this.type=e,this.attrs=t,this.marks=i,this.content=n||b.empty}get children(){return this.content.content}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(e){return this.content.child(e)}maybeChild(e){return this.content.maybeChild(e)}forEach(e){this.content.forEach(e)}nodesBetween(e,t,n,i=0){this.content.nodesBetween(e,t,n,i,this)}descendants(e){this.nodesBetween(0,this.content.size,e)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,"")}textBetween(e,t,n,i){return this.content.textBetween(e,t,n,i)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(e){return this==e||this.sameMarkup(e)&&this.content.eq(e.content)}sameMarkup(e){return this.hasMarkup(e.type,e.attrs,e.marks)}hasMarkup(e,t,n){return this.type==e&&Rn(this.attrs,t||e.defaultAttrs||va)&&z.sameSet(this.marks,n||z.none)}copy(e=null){return e==this.content?this:new Yi(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new Yi(this.type,this.attrs,this.content,e)}cut(e,t=this.content.size){return e==0&&t==this.content.size?this:this.copy(this.content.cut(e,t))}slice(e,t=this.content.size,n=!1){if(e==t)return S.empty;let i=this.resolve(e),s=this.resolve(t),o=n?0:i.sharedDepth(t),l=i.start(o),c=i.node(o).content.cut(i.pos-l,s.pos-l);return new S(c,i.depth-o,s.depth-o)}replace(e,t,n){return Ma(this.resolve(e),this.resolve(t),n)}nodeAt(e){for(let t=this;;){let{index:n,offset:i}=t.content.findIndex(e);if(t=t.maybeChild(n),!t)return null;if(i==e||t.isText)return t;e-=i+1}}childAfter(e){let{index:t,offset:n}=this.content.findIndex(e);return{node:this.content.maybeChild(t),index:t,offset:n}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:t,offset:n}=this.content.findIndex(e);if(n<e)return{node:this.content.child(t),index:t,offset:n};let i=this.content.child(t-1);return{node:i,index:t-1,offset:n-i.nodeSize}}resolve(e){return Ht.resolveCached(this,e)}resolveNoCache(e){return Ht.resolve(this,e)}rangeHasMark(e,t,n){let i=!1;return t>e&&this.nodesBetween(e,t,s=>(n.isInSet(s.marks)&&(i=!0),!i)),i}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let e=this.type.name;return this.content.size&&(e+="("+this.content.toStringInner()+")"),us(this.marks,e)}contentMatchAt(e){let t=this.type.contentMatch.matchFragment(this.content,0,e);if(!t)throw new Error("Called contentMatchAt on a node with invalid content");return t}canReplace(e,t,n=b.empty,i=0,s=n.childCount){let o=this.contentMatchAt(e).matchFragment(n,i,s),l=o&&o.matchFragment(this.content,t);if(!l||!l.validEnd)return!1;for(let a=i;a<s;a++)if(!this.type.allowsMarks(n.child(a).marks))return!1;return!0}canReplaceWith(e,t,n,i){if(i&&!this.type.allowsMarks(i))return!1;let s=this.contentMatchAt(e).matchType(n),o=s&&s.matchFragment(this.content,t);return o?o.validEnd:!1}canAppend(e){return e.content.size?this.canReplace(this.childCount,this.childCount,e.content):this.type.compatibleContent(e.type)}check(){this.type.checkContent(this.content),this.type.checkAttrs(this.attrs);let e=z.none;for(let t=0;t<this.marks.length;t++){let n=this.marks[t];n.type.checkAttrs(n.attrs),e=n.addToSet(e)}if(!z.sameSet(e,this.marks))throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(t=>t.type.name)}`);this.content.forEach(t=>t.check())}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(t=>t.toJSON())),e}static fromJSON(e,t){if(!t)throw new RangeError("Invalid input for Node.fromJSON");let n;if(t.marks){if(!Array.isArray(t.marks))throw new RangeError("Invalid mark data for Node.fromJSON");n=t.marks.map(e.markFromJSON)}if(t.type=="text"){if(typeof t.text!="string")throw new RangeError("Invalid text node in JSON");return e.text(t.text,n)}let i=b.fromJSON(e,t.content),s=e.nodeType(t.type).create(t.attrs,i,n);return s.type.checkAttrs(s.attrs),s}};ze.prototype.text=void 0;class Bn extends ze{constructor(e,t,n,i){if(super(e,t,null,i),!n)throw new RangeError("Empty text nodes are not allowed");this.text=n}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):us(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,t){return this.text.slice(e,t)}get nodeSize(){return this.text.length}mark(e){return e==this.marks?this:new Bn(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new Bn(this.type,this.attrs,e,this.marks)}cut(e=0,t=this.text.length){return e==0&&t==this.text.length?this:this.withText(this.text.slice(e,t))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}}function us(r,e){for(let t=r.length-1;t>=0;t--)e=r[t].type.name+"("+e+")";return e}class tt{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,t){let n=new Oa(e,t);if(n.next==null)return tt.empty;let i=hs(n);n.next&&n.err("Unexpected trailing text");let s=La(Pa(i));return Ba(s,n),s}matchType(e){for(let t=0;t<this.next.length;t++)if(this.next[t].type==e)return this.next[t].next;return null}matchFragment(e,t=0,n=e.childCount){let i=this;for(let s=t;i&&s<n;s++)i=i.matchType(e.child(s).type);return i}get inlineContent(){return this.next.length!=0&&this.next[0].type.isInline}get defaultType(){for(let e=0;e<this.next.length;e++){let{type:t}=this.next[e];if(!(t.isText||t.hasRequiredAttrs()))return t}return null}compatible(e){for(let t=0;t<this.next.length;t++)for(let n=0;n<e.next.length;n++)if(this.next[t].type==e.next[n].type)return!0;return!1}fillBefore(e,t=!1,n=0){let i=[this];function s(o,l){let a=o.matchFragment(e,n);if(a&&(!t||a.validEnd))return b.from(l.map(c=>c.createAndFill()));for(let c=0;c<o.next.length;c++){let{type:d,next:u}=o.next[c];if(!(d.isText||d.hasRequiredAttrs())&&i.indexOf(u)==-1){i.push(u);let h=s(u,l.concat(d));if(h)return h}}return null}return s(this,[])}findWrapping(e){for(let n=0;n<this.wrapCache.length;n+=2)if(this.wrapCache[n]==e)return this.wrapCache[n+1];let t=this.computeWrapping(e);return this.wrapCache.push(e,t),t}computeWrapping(e){let t=Object.create(null),n=[{match:this,type:null,via:null}];for(;n.length;){let i=n.shift(),s=i.match;if(s.matchType(e)){let o=[];for(let l=i;l.type;l=l.via)o.push(l.type);return o.reverse()}for(let o=0;o<s.next.length;o++){let{type:l,next:a}=s.next[o];!l.isLeaf&&!l.hasRequiredAttrs()&&!(l.name in t)&&(!i.type||a.validEnd)&&(n.push({match:l.contentMatch,type:l,via:i}),t[l.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw new RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function t(n){e.push(n);for(let i=0;i<n.next.length;i++)e.indexOf(n.next[i].next)==-1&&t(n.next[i].next)}return t(this),e.map((n,i)=>{let s=i+(n.validEnd?"*":" ")+" ";for(let o=0;o<n.next.length;o++)s+=(o?", ":"")+n.next[o].type.name+"->"+e.indexOf(n.next[o].next);return s}).join(`
2
2
  `)}}tt.empty=new tt(!0);class Oa{constructor(e,t){this.string=e,this.nodeTypes=t,this.inline=null,this.pos=0,this.tokens=e.split(/\s*(?=\b|\W|$)/),this.tokens[this.tokens.length-1]==""&&this.tokens.pop(),this.tokens[0]==""&&this.tokens.shift()}get next(){return this.tokens[this.pos]}eat(e){return this.next==e&&(this.pos++||!0)}err(e){throw new SyntaxError(e+" (in content expression '"+this.string+"')")}}function hs(r){let e=[];do e.push(Aa(r));while(r.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function Aa(r){let e=[];do e.push(Na(r));while(r.next&&r.next!=")"&&r.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function Na(r){let e=Ia(r);for(;;)if(r.eat("+"))e={type:"plus",expr:e};else if(r.eat("*"))e={type:"star",expr:e};else if(r.eat("?"))e={type:"opt",expr:e};else if(r.eat("{"))e=Da(r,e);else break;return e}function fs(r){/\D/.test(r.next)&&r.err("Expected number, got '"+r.next+"'");let e=Number(r.next);return r.pos++,e}function Da(r,e){let t=fs(r),n=t;return r.eat(",")&&(r.next!="}"?n=fs(r):n=-1),r.eat("}")||r.err("Unclosed braced range"),{type:"range",min:t,max:n,expr:e}}function Ra(r,e){let t=r.nodeTypes,n=t[e];if(n)return[n];let i=[];for(let s in t){let o=t[s];o.isInGroup(e)&&i.push(o)}return i.length==0&&r.err("No node type or group '"+e+"' found"),i}function Ia(r){if(r.eat("(")){let e=hs(r);return r.eat(")")||r.err("Missing closing paren"),e}else if(/\W/.test(r.next))r.err("Unexpected token '"+r.next+"'");else{let e=Ra(r,r.next).map(t=>(r.inline==null?r.inline=t.isInline:r.inline!=t.isInline&&r.err("Mixing inline and block content"),{type:"name",value:t}));return r.pos++,e.length==1?e[0]:{type:"choice",exprs:e}}}function Pa(r){let e=[[]];return i(s(r,0),t()),e;function t(){return e.push([])-1}function n(o,l,a){let c={term:a,to:l};return e[o].push(c),c}function i(o,l){o.forEach(a=>a.to=l)}function s(o,l){if(o.type=="choice")return o.exprs.reduce((a,c)=>a.concat(s(c,l)),[]);if(o.type=="seq")for(let a=0;;a++){let c=s(o.exprs[a],l);if(a==o.exprs.length-1)return c;i(c,l=t())}else if(o.type=="star"){let a=t();return n(l,a),i(s(o.expr,a),a),[n(a)]}else if(o.type=="plus"){let a=t();return i(s(o.expr,l),a),i(s(o.expr,a),a),[n(a)]}else{if(o.type=="opt")return[n(l)].concat(s(o.expr,l));if(o.type=="range"){let a=l;for(let c=0;c<o.min;c++){let d=t();i(s(o.expr,a),d),a=d}if(o.max==-1)i(s(o.expr,a),a);else for(let c=o.min;c<o.max;c++){let d=t();n(a,d),i(s(o.expr,a),d),a=d}return[n(a)]}else{if(o.type=="name")return[n(l,void 0,o.value)];throw new Error("Unknown expr type")}}}}function ps(r,e){return e-r}function ms(r,e){let t=[];return n(e),t.sort(ps);function n(i){let s=r[i];if(s.length==1&&!s[0].term)return n(s[0].to);t.push(i);for(let o=0;o<s.length;o++){let{term:l,to:a}=s[o];!l&&t.indexOf(a)==-1&&n(a)}}}function La(r){let e=Object.create(null);return t(ms(r,0));function t(n){let i=[];n.forEach(o=>{r[o].forEach(({term:l,to:a})=>{if(!l)return;let c;for(let d=0;d<i.length;d++)i[d][0]==l&&(c=i[d][1]);ms(r,a).forEach(d=>{c||i.push([l,c=[]]),c.indexOf(d)==-1&&c.push(d)})})});let s=e[n.join(",")]=new tt(n.indexOf(r.length-1)>-1);for(let o=0;o<i.length;o++){let l=i[o][1].sort(ps);s.next.push({type:i[o][0],next:e[l.join(",")]||t(l)})}return s}}function Ba(r,e){for(let t=0,n=[r];t<n.length;t++){let i=n[t],s=!i.validEnd,o=[];for(let l=0;l<i.next.length;l++){let{type:a,next:c}=i.next[l];o.push(a.name),s&&!(a.isText||a.hasRequiredAttrs())&&(s=!1),n.indexOf(c)==-1&&n.push(c)}s&&e.err("Only non-generatable nodes ("+o.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}function gs(r){let e=Object.create(null);for(let t in r){let n=r[t];if(!n.hasDefault)return null;e[t]=n.default}return e}function ys(r,e){let t=Object.create(null);for(let n in r){let i=e&&e[n];if(i===void 0){let s=r[n];if(s.hasDefault)i=s.default;else throw new RangeError("No value supplied for attribute "+n)}t[n]=i}return t}function bs(r,e,t,n){for(let i in e)if(!(i in r))throw new RangeError(`Unsupported attribute ${i} for ${t} of type ${i}`);for(let i in r){let s=r[i];s.validate&&s.validate(e[i])}}function ks(r,e){let t=Object.create(null);if(e)for(let n in e)t[n]=new $a(r,n,e[n]);return t}let xs=class da{constructor(e,t,n){this.name=e,this.schema=t,this.spec=n,this.markSet=null,this.groups=n.group?n.group.split(" "):[],this.attrs=ks(e,n.attrs),this.defaultAttrs=gs(this.attrs),this.contentMatch=null,this.inlineContent=null,this.isBlock=!(n.inline||e=="text"),this.isText=e=="text"}get isInline(){return!this.isBlock}get isTextblock(){return this.isBlock&&this.inlineContent}get isLeaf(){return this.contentMatch==tt.empty}get isAtom(){return this.isLeaf||!!this.spec.atom}isInGroup(e){return this.groups.indexOf(e)>-1}get whitespace(){return this.spec.whitespace||(this.spec.code?"pre":"normal")}hasRequiredAttrs(){for(let e in this.attrs)if(this.attrs[e].isRequired)return!0;return!1}compatibleContent(e){return this==e||this.contentMatch.compatible(e.contentMatch)}computeAttrs(e){return!e&&this.defaultAttrs?this.defaultAttrs:ys(this.attrs,e)}create(e=null,t,n){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new ze(this,this.computeAttrs(e),b.from(t),z.setFrom(n))}createChecked(e=null,t,n){return t=b.from(t),this.checkContent(t),new ze(this,this.computeAttrs(e),t,z.setFrom(n))}createAndFill(e=null,t,n){if(e=this.computeAttrs(e),t=b.from(t),t.size){let o=this.contentMatch.fillBefore(t);if(!o)return null;t=o.append(t)}let i=this.contentMatch.matchFragment(t),s=i&&i.fillBefore(b.empty,!0);return s?new ze(this,e,t.append(s),z.setFrom(n)):null}validContent(e){let t=this.contentMatch.matchFragment(e);if(!t||!t.validEnd)return!1;for(let n=0;n<e.childCount;n++)if(!this.allowsMarks(e.child(n).marks))return!1;return!0}checkContent(e){if(!this.validContent(e))throw new RangeError(`Invalid content for node ${this.name}: ${e.toString().slice(0,50)}`)}checkAttrs(e){bs(this.attrs,e,"node",this.name)}allowsMarkType(e){return this.markSet==null||this.markSet.indexOf(e)>-1}allowsMarks(e){if(this.markSet==null)return!0;for(let t=0;t<e.length;t++)if(!this.allowsMarkType(e[t].type))return!1;return!0}allowedMarks(e){if(this.markSet==null)return e;let t;for(let n=0;n<e.length;n++)this.allowsMarkType(e[n].type)?t&&t.push(e[n]):t||(t=e.slice(0,n));return t?t.length?t:z.none:e}static compile(e,t){let n=Object.create(null);e.forEach((s,o)=>n[s]=new da(s,t,o));let i=t.spec.topNode||"doc";if(!n[i])throw new RangeError("Schema is missing its top node type ('"+i+"')");if(!n.text)throw new RangeError("Every schema needs a 'text' type");for(let s in n.text.attrs)throw new RangeError("The text node type should not have attributes");return n}};function za(r,e,t){let n=t.split("|");return i=>{let s=i===null?"null":typeof i;if(n.indexOf(s)<0)throw new RangeError(`Expected value of type ${n} for attribute ${e} on type ${r}, got ${s}`)}}class $a{constructor(e,t,n){this.hasDefault=Object.prototype.hasOwnProperty.call(n,"default"),this.default=n.default,this.validate=typeof n.validate=="string"?za(e,t,n.validate):n.validate}get isRequired(){return!this.hasDefault}}class zn{constructor(e,t,n,i){this.name=e,this.rank=t,this.schema=n,this.spec=i,this.attrs=ks(e,i.attrs),this.excluded=null;let s=gs(this.attrs);this.instance=s?new z(this,s):null}create(e=null){return!e&&this.instance?this.instance:new z(this,ys(this.attrs,e))}static compile(e,t){let n=Object.create(null),i=0;return e.forEach((s,o)=>n[s]=new zn(s,i++,t,o)),n}removeFromSet(e){for(var t=0;t<e.length;t++)e[t].type==this&&(e=e.slice(0,t).concat(e.slice(t+1)),t--);return e}isInSet(e){for(let t=0;t<e.length;t++)if(e[t].type==this)return e[t]}checkAttrs(e){bs(this.attrs,e,"mark",this.name)}excludes(e){return this.excluded.indexOf(e)>-1}}class Ss{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let t=this.spec={};for(let i in e)t[i]=e[i];t.nodes=G.from(e.nodes),t.marks=G.from(e.marks||{}),this.nodes=xs.compile(this.spec.nodes,this),this.marks=zn.compile(this.spec.marks,this);let n=Object.create(null);for(let i in this.nodes){if(i in this.marks)throw new RangeError(i+" can not be both a node and a mark");let s=this.nodes[i],o=s.spec.content||"",l=s.spec.marks;if(s.contentMatch=n[o]||(n[o]=tt.parse(o,this.nodes)),s.inlineContent=s.contentMatch.inlineContent,s.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!s.isInline||!s.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=s}s.markSet=l=="_"?null:l?ws(this,l.split(" ")):l==""||!s.inlineContent?[]:null}for(let i in this.marks){let s=this.marks[i],o=s.spec.excludes;s.excluded=o==null?[s]:o==""?[]:ws(this,o.split(" "))}this.nodeFromJSON=i=>ze.fromJSON(this,i),this.markFromJSON=i=>z.fromJSON(this,i),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(e,t=null,n,i){if(typeof e=="string")e=this.nodeType(e);else if(e instanceof xs){if(e.schema!=this)throw new RangeError("Node type from different schema used ("+e.name+")")}else throw new RangeError("Invalid node type: "+e);return e.createChecked(t,n,i)}text(e,t){let n=this.nodes.text;return new Bn(n,n.defaultAttrs,e,z.setFrom(t))}mark(e,t){return typeof e=="string"&&(e=this.marks[e]),e.create(t)}nodeType(e){let t=this.nodes[e];if(!t)throw new RangeError("Unknown node type: "+e);return t}}function ws(r,e){let t=[];for(let n=0;n<e.length;n++){let i=e[n],s=r.marks[i],o=s;if(s)t.push(s);else for(let l in r.marks){let a=r.marks[l];(i=="_"||a.spec.group&&a.spec.group.split(" ").indexOf(i)>-1)&&t.push(o=a)}if(!o)throw new SyntaxError("Unknown mark type: '"+e[n]+"'")}return t}function Fa(r){return r.tag!=null}function Ha(r){return r.style!=null}class $e{constructor(e,t){this.schema=e,this.rules=t,this.tags=[],this.styles=[];let n=this.matchedStyles=[];t.forEach(i=>{if(Fa(i))this.tags.push(i);else if(Ha(i)){let s=/[^=]*/.exec(i.style)[0];n.indexOf(s)<0&&n.push(s),this.styles.push(i)}}),this.normalizeLists=!this.tags.some(i=>{if(!/^(ul|ol)\b/.test(i.tag)||!i.node)return!1;let s=e.nodes[i.node];return s.contentMatch.matchType(s)})}parse(e,t={}){let n=new Es(this,t,!1);return n.addAll(e,z.none,t.from,t.to),n.finish()}parseSlice(e,t={}){let n=new Es(this,t,!0);return n.addAll(e,z.none,t.from,t.to),S.maxOpen(n.finish())}matchTag(e,t,n){for(let i=n?this.tags.indexOf(n)+1:0;i<this.tags.length;i++){let s=this.tags[i];if(Wa(e,s.tag)&&(s.namespace===void 0||e.namespaceURI==s.namespace)&&(!s.context||t.matchesContext(s.context))){if(s.getAttrs){let o=s.getAttrs(e);if(o===!1)continue;s.attrs=o||void 0}return s}}}matchStyle(e,t,n,i){for(let s=i?this.styles.indexOf(i)+1:0;s<this.styles.length;s++){let o=this.styles[s],l=o.style;if(!(l.indexOf(e)!=0||o.context&&!n.matchesContext(o.context)||l.length>e.length&&(l.charCodeAt(e.length)!=61||l.slice(e.length+1)!=t))){if(o.getAttrs){let a=o.getAttrs(t);if(a===!1)continue;o.attrs=a||void 0}return o}}}static schemaRules(e){let t=[];function n(i){let s=i.priority==null?50:i.priority,o=0;for(;o<t.length;o++){let l=t[o];if((l.priority==null?50:l.priority)<s)break}t.splice(o,0,i)}for(let i in e.marks){let s=e.marks[i].spec.parseDOM;s&&s.forEach(o=>{n(o=vs(o)),o.mark||o.ignore||o.clearMark||(o.mark=i)})}for(let i in e.nodes){let s=e.nodes[i].spec.parseDOM;s&&s.forEach(o=>{n(o=vs(o)),o.node||o.ignore||o.mark||(o.node=i)})}return t}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new $e(e,$e.schemaRules(e)))}}const Ms={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},Va={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},Cs={ol:!0,ul:!0},Vt=1,Fr=2,qt=4;function Ts(r,e,t){return e!=null?(e?Vt:0)|(e==="full"?Fr:0):r&&r.whitespace=="pre"?Vt|Fr:t&~qt}class $n{constructor(e,t,n,i,s,o){this.type=e,this.attrs=t,this.marks=n,this.solid=i,this.options=o,this.content=[],this.activeMarks=z.none,this.match=s||(o&qt?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let t=this.type.contentMatch.fillBefore(b.from(e));if(t)this.match=this.type.contentMatch.matchFragment(t);else{let n=this.type.contentMatch,i;return(i=n.findWrapping(e.type))?(this.match=n,i):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&Vt)){let n=this.content[this.content.length-1],i;if(n&&n.isText&&(i=/[ \t\r\n\u000c]+$/.exec(n.text))){let s=n;n.text.length==i[0].length?this.content.pop():this.content[this.content.length-1]=s.withText(s.text.slice(0,s.text.length-i[0].length))}}let t=b.from(this.content);return!e&&this.match&&(t=t.append(this.match.fillBefore(b.empty,!0))),this.type?this.type.create(this.attrs,t,this.marks):t}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!Ms.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class Es{constructor(e,t,n){this.parser=e,this.options=t,this.isOpen=n,this.open=0,this.localPreserveWS=!1;let i=t.topNode,s,o=Ts(null,t.preserveWhitespace,0)|(n?qt:0);i?s=new $n(i.type,i.attrs,z.none,!0,t.topMatch||i.type.contentMatch,o):n?s=new $n(null,null,z.none,!0,null,o):s=new $n(e.schema.topNodeType,null,z.none,!0,null,o),this.nodes=[s],this.find=t.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e,t){e.nodeType==3?this.addTextNode(e,t):e.nodeType==1&&this.addElement(e,t)}addTextNode(e,t){let n=e.nodeValue,i=this.top,s=i.options&Fr?"full":this.localPreserveWS||(i.options&Vt)>0,{schema:o}=this.parser;if(s==="full"||i.inlineContext(e)||/[^ \t\r\n\u000c]/.test(n)){if(s)if(s==="full")n=n.replace(/\r\n?/g,`
3
3
  `);else if(o.linebreakReplacement&&/[\r\n]/.test(n)&&this.top.findWrapping(o.linebreakReplacement.create())){let l=n.split(/\r?\n|\r/);for(let a=0;a<l.length;a++)a&&this.insertNode(o.linebreakReplacement.create(),t,!0),l[a]&&this.insertNode(o.text(l[a]),t,!/\S/.test(l[a]));n=""}else n=n.replace(/\r?\n|\r/g," ");else if(n=n.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(n)&&this.open==this.nodes.length-1){let l=i.content[i.content.length-1],a=e.previousSibling;(!l||a&&a.nodeName=="BR"||l.isText&&/[ \t\r\n\u000c]$/.test(l.text))&&(n=n.slice(1))}n&&this.insertNode(o.text(n),t,!/\S/.test(n)),this.findInText(e)}else this.findInside(e)}addElement(e,t,n){let i=this.localPreserveWS,s=this.top;(e.tagName=="PRE"||/pre/.test(e.style&&e.style.whiteSpace))&&(this.localPreserveWS=!0);let o=e.nodeName.toLowerCase(),l;Cs.hasOwnProperty(o)&&this.parser.normalizeLists&&qa(e);let a=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(l=this.parser.matchTag(e,this,n));e:if(a?a.ignore:Va.hasOwnProperty(o))this.findInside(e),this.ignoreFallback(e,t);else if(!a||a.skip||a.closeParent){a&&a.closeParent?this.open=Math.max(0,this.open-1):a&&a.skip.nodeType&&(e=a.skip);let c,d=this.needsBlock;if(Ms.hasOwnProperty(o))s.content.length&&s.content[0].isInline&&this.open&&(this.open--,s=this.top),c=!0,s.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e,t);break e}let u=a&&a.skip?t:this.readStyles(e,t);u&&this.addAll(e,u),c&&this.sync(s),this.needsBlock=d}else{let c=this.readStyles(e,t);c&&this.addElementByRule(e,a,c,a.consuming===!1?l:void 0)}this.localPreserveWS=i}leafFallback(e,t){e.nodeName=="BR"&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode(`
4
4
  `),t)}ignoreFallback(e,t){e.nodeName=="BR"&&(!this.top.type||!this.top.type.inlineContent)&&this.findPlace(this.parser.schema.text("-"),t,!0)}readStyles(e,t){let n=e.style;if(n&&n.length)for(let i=0;i<this.parser.matchedStyles.length;i++){let s=this.parser.matchedStyles[i],o=n.getPropertyValue(s);if(o)for(let l=void 0;;){let a=this.parser.matchStyle(s,o,this,l);if(!a)break;if(a.ignore)return null;if(a.clearMark?t=t.filter(c=>!a.clearMark(c)):t=t.concat(this.parser.schema.marks[a.mark].create(a.attrs)),a.consuming===!1)l=a;else break}}return t}addElementByRule(e,t,n,i){let s,o;if(t.node)if(o=this.parser.schema.nodes[t.node],o.isLeaf)this.insertNode(o.create(t.attrs),n,e.nodeName=="BR")||this.leafFallback(e,n);else{let a=this.enter(o,t.attrs||null,n,t.preserveWhitespace);a&&(s=!0,n=a)}else{let a=this.parser.schema.marks[t.mark];n=n.concat(a.create(t.attrs))}let l=this.top;if(o&&o.isLeaf)this.findInside(e);else if(i)this.addElement(e,n,i);else if(t.getContent)this.findInside(e),t.getContent(e,this.parser.schema).forEach(a=>this.insertNode(a,n,!1));else{let a=e;typeof t.contentElement=="string"?a=e.querySelector(t.contentElement):typeof t.contentElement=="function"?a=t.contentElement(e):t.contentElement&&(a=t.contentElement),this.findAround(e,a,!0),this.addAll(a,n),this.findAround(e,a,!1)}s&&this.sync(l)&&this.open--}addAll(e,t,n,i){let s=n||0;for(let o=n?e.childNodes[n]:e.firstChild,l=i==null?null:e.childNodes[i];o!=l;o=o.nextSibling,++s)this.findAtPoint(e,s),this.addDOM(o,t);this.findAtPoint(e,s)}findPlace(e,t,n){let i,s;for(let o=this.open,l=0;o>=0;o--){let a=this.nodes[o],c=a.findWrapping(e);if(c&&(!i||i.length>c.length+l)&&(i=c,s=a,!c.length))break;if(a.solid){if(n)break;l+=2}}if(!i)return null;this.sync(s);for(let o=0;o<i.length;o++)t=this.enterInner(i[o],null,t,!1);return t}insertNode(e,t,n){if(e.isInline&&this.needsBlock&&!this.top.type){let s=this.textblockFromContext();s&&(t=this.enterInner(s,null,t))}let i=this.findPlace(e,t,n);if(i){this.closeExtra();let s=this.top;s.match&&(s.match=s.match.matchType(e.type));let o=z.none;for(let l of i.concat(e.marks))(s.type?s.type.allowsMarkType(l.type):Os(l.type,e.type))&&(o=l.addToSet(o));return s.content.push(e.mark(o)),!0}return!1}enter(e,t,n,i){let s=this.findPlace(e.create(t),n,!1);return s&&(s=this.enterInner(e,t,n,!0,i)),s}enterInner(e,t,n,i=!1,s){this.closeExtra();let o=this.top;o.match=o.match&&o.match.matchType(e);let l=Ts(e,s,o.options);o.options&qt&&o.content.length==0&&(l|=qt);let a=z.none;return n=n.filter(c=>(o.type?o.type.allowsMarkType(c.type):Os(c.type,e))?(a=c.addToSet(a),!1):!0),this.nodes.push(new $n(e,t,a,i,null,l)),this.open++,n}closeExtra(e=!1){let t=this.nodes.length-1;if(t>this.open){for(;t>this.open;t--)this.nodes[t-1].content.push(this.nodes[t].finish(e));this.nodes.length=this.open+1}}finish(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(!!(this.isOpen||this.options.topOpen))}sync(e){for(let t=this.open;t>=0;t--){if(this.nodes[t]==e)return this.open=t,!0;this.localPreserveWS&&(this.nodes[t].options|=Vt)}return!1}get currentPos(){this.closeExtra();let e=0;for(let t=this.open;t>=0;t--){let n=this.nodes[t].content;for(let i=n.length-1;i>=0;i--)e+=n[i].nodeSize;t&&e++}return e}findAtPoint(e,t){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].node==e&&this.find[n].offset==t&&(this.find[n].pos=this.currentPos)}findInside(e){if(this.find)for(let t=0;t<this.find.length;t++)this.find[t].pos==null&&e.nodeType==1&&e.contains(this.find[t].node)&&(this.find[t].pos=this.currentPos)}findAround(e,t,n){if(e!=t&&this.find)for(let i=0;i<this.find.length;i++)this.find[i].pos==null&&e.nodeType==1&&e.contains(this.find[i].node)&&t.compareDocumentPosition(this.find[i].node)&(n?2:4)&&(this.find[i].pos=this.currentPos)}findInText(e){if(this.find)for(let t=0;t<this.find.length;t++)this.find[t].node==e&&(this.find[t].pos=this.currentPos-(e.nodeValue.length-this.find[t].offset))}matchesContext(e){if(e.indexOf("|")>-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let t=e.split("/"),n=this.options.context,i=!this.isOpen&&(!n||n.parent.type==this.nodes[0].type),s=-(n?n.depth+1:0)+(i?0:1),o=(l,a)=>{for(;l>=0;l--){let c=t[l];if(c==""){if(l==t.length-1||l==0)continue;for(;a>=s;a--)if(o(l-1,a))return!0;return!1}else{let d=a>0||a==0&&i?this.nodes[a].type:n&&a>=s?n.node(a-s).type:null;if(!d||d.name!=c&&!d.isInGroup(c))return!1;a--}}return!0};return o(t.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let t=e.depth;t>=0;t--){let n=e.node(t).contentMatchAt(e.indexAfter(t)).defaultType;if(n&&n.isTextblock&&n.defaultAttrs)return n}for(let t in this.parser.schema.nodes){let n=this.parser.schema.nodes[t];if(n.isTextblock&&n.defaultAttrs)return n}}}function qa(r){for(let e=r.firstChild,t=null;e;e=e.nextSibling){let n=e.nodeType==1?e.nodeName.toLowerCase():null;n&&Cs.hasOwnProperty(n)&&t?(t.appendChild(e),e=t):n=="li"?t=e:n&&(t=null)}}function Wa(r,e){return(r.matches||r.msMatchesSelector||r.webkitMatchesSelector||r.mozMatchesSelector).call(r,e)}function vs(r){let e={};for(let t in r)e[t]=r[t];return e}function Os(r,e){let t=e.schema.nodes;for(let n in t){let i=t[n];if(!i.allowsMarkType(r))continue;let s=[],o=l=>{s.push(l);for(let a=0;a<l.edgeCount;a++){let{type:c,next:d}=l.edge(a);if(c==e||s.indexOf(d)<0&&o(d))return!0}};if(o(i.contentMatch))return!0}}class nt{constructor(e,t){this.nodes=e,this.marks=t}serializeFragment(e,t={},n){n||(n=Hr(t).createDocumentFragment());let i=n,s=[];return e.forEach(o=>{if(s.length||o.marks.length){let l=0,a=0;for(;l<s.length&&a<o.marks.length;){let c=o.marks[a];if(!this.marks[c.type.name]){a++;continue}if(!c.eq(s[l][0])||c.type.spec.spanning===!1)break;l++,a++}for(;l<s.length;)i=s.pop()[1];for(;a<o.marks.length;){let c=o.marks[a++],d=this.serializeMark(c,o.isInline,t);d&&(s.push([c,i]),i.appendChild(d.dom),i=d.contentDOM||d.dom)}}i.appendChild(this.serializeNodeInner(o,t))}),n}serializeNodeInner(e,t){let{dom:n,contentDOM:i}=Fn(Hr(t),this.nodes[e.type.name](e),null,e.attrs);if(i){if(e.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(e.content,t,i)}return n}serializeNode(e,t={}){let n=this.serializeNodeInner(e,t);for(let i=e.marks.length-1;i>=0;i--){let s=this.serializeMark(e.marks[i],e.isInline,t);s&&((s.contentDOM||s.dom).appendChild(n),n=s.dom)}return n}serializeMark(e,t,n={}){let i=this.marks[e.type.name];return i&&Fn(Hr(n),i(e,t),null,e.attrs)}static renderSpec(e,t,n=null,i){return Fn(e,t,n,i)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new nt(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let t=As(e.nodes);return t.text||(t.text=n=>n.text),t}static marksFromSchema(e){return As(e.marks)}}function As(r){let e={};for(let t in r){let n=r[t].spec.toDOM;n&&(e[t]=n)}return e}function Hr(r){return r.document||window.document}const Ns=new WeakMap;function ja(r){let e=Ns.get(r);return e===void 0&&Ns.set(r,e=Ja(r)),e}function Ja(r){let e=null;function t(n){if(n&&typeof n=="object")if(Array.isArray(n))if(typeof n[0]=="string")e||(e=[]),e.push(n);else for(let i=0;i<n.length;i++)t(n[i]);else for(let i in n)t(n[i])}return t(r),e}function Fn(r,e,t,n){if(typeof e=="string")return{dom:r.createTextNode(e)};if(e.nodeType!=null)return{dom:e};if(e.dom&&e.dom.nodeType!=null)return e;let i=e[0],s;if(typeof i!="string")throw new RangeError("Invalid array passed to renderSpec");if(n&&(s=ja(n))&&s.indexOf(e)>-1)throw new RangeError("Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.");let o=i.indexOf(" ");o>0&&(t=i.slice(0,o),i=i.slice(o+1));let l,a=t?r.createElementNS(t,i):r.createElement(i),c=e[1],d=1;if(c&&typeof c=="object"&&c.nodeType==null&&!Array.isArray(c)){d=2;for(let u in c)if(c[u]!=null){let h=u.indexOf(" ");h>0?a.setAttributeNS(u.slice(0,h),u.slice(h+1),c[u]):u=="style"&&a.style?a.style.cssText=c[u]:a.setAttribute(u,c[u])}}for(let u=d;u<e.length;u++){let h=e[u];if(h===0){if(u<e.length-1||u>d)throw new RangeError("Content hole must be the only child of its parent node");return{dom:a,contentDOM:a}}else{let{dom:f,contentDOM:p}=Fn(r,h,t,n);if(a.appendChild(f),p){if(l)throw new RangeError("Multiple content holes");l=p}}}return{dom:a,contentDOM:l}}const Ds=65535,Rs=Math.pow(2,16);function Ka(r,e){return r+e*Rs}function Is(r){return r&Ds}function Ua(r){return(r-(r&Ds))/Rs}const Ps=1,Ls=2,Hn=4,Bs=8;class Vr{constructor(e,t,n){this.pos=e,this.delInfo=t,this.recover=n}get deleted(){return(this.delInfo&Bs)>0}get deletedBefore(){return(this.delInfo&(Ps|Hn))>0}get deletedAfter(){return(this.delInfo&(Ls|Hn))>0}get deletedAcross(){return(this.delInfo&Hn)>0}}class de{constructor(e,t=!1){if(this.ranges=e,this.inverted=t,!e.length&&de.empty)return de.empty}recover(e){let t=0,n=Is(e);if(!this.inverted)for(let i=0;i<n;i++)t+=this.ranges[i*3+2]-this.ranges[i*3+1];return this.ranges[n*3]+t+Ua(e)}mapResult(e,t=1){return this._map(e,t,!1)}map(e,t=1){return this._map(e,t,!0)}_map(e,t,n){let i=0,s=this.inverted?2:1,o=this.inverted?1:2;for(let l=0;l<this.ranges.length;l+=3){let a=this.ranges[l]-(this.inverted?i:0);if(a>e)break;let c=this.ranges[l+s],d=this.ranges[l+o],u=a+c;if(e<=u){let h=c?e==a?-1:e==u?1:t:t,f=a+i+(h<0?0:d);if(n)return f;let p=e==(t<0?a:u)?null:Ka(l/3,e-a),m=e==a?Ls:e==u?Ps:Hn;return(t<0?e!=a:e!=u)&&(m|=Bs),new Vr(f,m,p)}i+=d-c}return n?e+i:new Vr(e+i,0,null)}touches(e,t){let n=0,i=Is(t),s=this.inverted?2:1,o=this.inverted?1:2;for(let l=0;l<this.ranges.length;l+=3){let a=this.ranges[l]-(this.inverted?n:0);if(a>e)break;let c=this.ranges[l+s],d=a+c;if(e<=d&&l==i*3)return!0;n+=this.ranges[l+o]-c}return!1}forEach(e){let t=this.inverted?2:1,n=this.inverted?1:2;for(let i=0,s=0;i<this.ranges.length;i+=3){let o=this.ranges[i],l=o-(this.inverted?s:0),a=o+(this.inverted?0:s),c=this.ranges[i+t],d=this.ranges[i+n];e(l,l+c,a,a+d),s+=d-c}}invert(){return new de(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?de.empty:new de(e<0?[0,-e,0]:[0,0,e])}}de.empty=new de([]);class Wt{constructor(e,t,n=0,i=e?e.length:0){this.mirror=t,this.from=n,this.to=i,this._maps=e||[],this.ownData=!(e||t)}get maps(){return this._maps}slice(e=0,t=this.maps.length){return new Wt(this._maps,this.mirror,e,t)}appendMap(e,t){this.ownData||(this._maps=this._maps.slice(),this.mirror=this.mirror&&this.mirror.slice(),this.ownData=!0),this.to=this._maps.push(e),t!=null&&this.setMirror(this._maps.length-1,t)}appendMapping(e){for(let t=0,n=this._maps.length;t<e._maps.length;t++){let i=e.getMirror(t);this.appendMap(e._maps[t],i!=null&&i<t?n+i:void 0)}}getMirror(e){if(this.mirror){for(let t=0;t<this.mirror.length;t++)if(this.mirror[t]==e)return this.mirror[t+(t%2?-1:1)]}}setMirror(e,t){this.mirror||(this.mirror=[]),this.mirror.push(e,t)}appendMappingInverted(e){for(let t=e.maps.length-1,n=this._maps.length+e._maps.length;t>=0;t--){let i=e.getMirror(t);this.appendMap(e._maps[t].invert(),i!=null&&i>t?n-i-1:void 0)}}invert(){let e=new Wt;return e.appendMappingInverted(this),e}map(e,t=1){if(this.mirror)return this._map(e,t,!0);for(let n=this.from;n<this.to;n++)e=this._maps[n].map(e,t);return e}mapResult(e,t=1){return this._map(e,t,!1)}_map(e,t,n){let i=0;for(let s=this.from;s<this.to;s++){let o=this._maps[s],l=o.mapResult(e,t);if(l.recover!=null){let a=this.getMirror(s);if(a!=null&&a>s&&a<this.to){s=a,e=this._maps[a].recover(l.recover);continue}}i|=l.delInfo,e=l.pos}return n?e:new Vr(e,i,null)}}const qr=Object.create(null);class ee{getMap(){return de.empty}merge(e){return null}static fromJSON(e,t){if(!t||!t.stepType)throw new RangeError("Invalid input for Step.fromJSON");let n=qr[t.stepType];if(!n)throw new RangeError(`No step type ${t.stepType} defined`);return n.fromJSON(e,t)}static jsonID(e,t){if(e in qr)throw new RangeError("Duplicate use of step JSON ID "+e);return qr[e]=t,t.prototype.jsonID=e,t}}class H{constructor(e,t){this.doc=e,this.failed=t}static ok(e){return new H(e,null)}static fail(e){return new H(null,e)}static fromReplace(e,t,n,i){try{return H.ok(e.replace(t,n,i))}catch(s){if(s instanceof In)return H.fail(s.message);throw s}}}function Wr(r,e,t){let n=[];for(let i=0;i<r.childCount;i++){let s=r.child(i);s.content.size&&(s=s.copy(Wr(s.content,e,s))),s.isInline&&(s=e(s,t,i)),n.push(s)}return b.fromArray(n)}class Fe extends ee{constructor(e,t,n){super(),this.from=e,this.to=t,this.mark=n}apply(e){let t=e.slice(this.from,this.to),n=e.resolve(this.from),i=n.node(n.sharedDepth(this.to)),s=new S(Wr(t.content,(o,l)=>!o.isAtom||!l.type.allowsMarkType(this.mark.type)?o:o.mark(this.mark.addToSet(o.marks)),i),t.openStart,t.openEnd);return H.fromReplace(e,this.from,this.to,s)}invert(){return new Ce(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),n=e.mapResult(this.to,-1);return t.deleted&&n.deleted||t.pos>=n.pos?null:new Fe(t.pos,n.pos,this.mark)}merge(e){return e instanceof Fe&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Fe(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new Fe(t.from,t.to,e.markFromJSON(t.mark))}}ee.jsonID("addMark",Fe);class Ce extends ee{constructor(e,t,n){super(),this.from=e,this.to=t,this.mark=n}apply(e){let t=e.slice(this.from,this.to),n=new S(Wr(t.content,i=>i.mark(this.mark.removeFromSet(i.marks)),e),t.openStart,t.openEnd);return H.fromReplace(e,this.from,this.to,n)}invert(){return new Fe(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),n=e.mapResult(this.to,-1);return t.deleted&&n.deleted||t.pos>=n.pos?null:new Ce(t.pos,n.pos,this.mark)}merge(e){return e instanceof Ce&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Ce(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new Ce(t.from,t.to,e.markFromJSON(t.mark))}}ee.jsonID("removeMark",Ce);class He extends ee{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return H.fail("No node at mark step's position");let n=t.type.create(t.attrs,null,this.mark.addToSet(t.marks));return H.fromReplace(e,this.pos,this.pos+1,new S(b.from(n),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);if(t){let n=this.mark.addToSet(t.marks);if(n.length==t.marks.length){for(let i=0;i<t.marks.length;i++)if(!t.marks[i].isInSet(n))return new He(this.pos,t.marks[i]);return new He(this.pos,this.mark)}}return new rt(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new He(t.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,t){if(typeof t.pos!="number")throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new He(t.pos,e.markFromJSON(t.mark))}}ee.jsonID("addNodeMark",He);class rt extends ee{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return H.fail("No node at mark step's position");let n=t.type.create(t.attrs,null,this.mark.removeFromSet(t.marks));return H.fromReplace(e,this.pos,this.pos+1,new S(b.from(n),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);return!t||!this.mark.isInSet(t.marks)?this:new He(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new rt(t.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,t){if(typeof t.pos!="number")throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new rt(t.pos,e.markFromJSON(t.mark))}}ee.jsonID("removeNodeMark",rt);class V extends ee{constructor(e,t,n,i=!1){super(),this.from=e,this.to=t,this.slice=n,this.structure=i}apply(e){return this.structure&&jr(e,this.from,this.to)?H.fail("Structure replace would overwrite content"):H.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new de([this.from,this.to-this.from,this.slice.size])}invert(e){return new V(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let t=e.mapResult(this.to,-1),n=this.from==this.to&&V.MAP_BIAS<0?t:e.mapResult(this.from,1);return n.deletedAcross&&t.deletedAcross?null:new V(n.pos,Math.max(n.pos,t.pos),this.slice,this.structure)}merge(e){if(!(e instanceof V)||e.structure||this.structure)return null;if(this.from+this.slice.size==e.from&&!this.slice.openEnd&&!e.slice.openStart){let t=this.slice.size+e.slice.size==0?S.empty:new S(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new V(this.from,this.to+(e.to-e.from),t,this.structure)}else if(e.to==this.from&&!this.slice.openStart&&!e.slice.openEnd){let t=this.slice.size+e.slice.size==0?S.empty:new S(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new V(e.from,this.to,t,this.structure)}else return null}toJSON(){let e={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new V(t.from,t.to,S.fromJSON(e,t.slice),!!t.structure)}}V.MAP_BIAS=1,ee.jsonID("replace",V);class j extends ee{constructor(e,t,n,i,s,o,l=!1){super(),this.from=e,this.to=t,this.gapFrom=n,this.gapTo=i,this.slice=s,this.insert=o,this.structure=l}apply(e){if(this.structure&&(jr(e,this.from,this.gapFrom)||jr(e,this.gapTo,this.to)))return H.fail("Structure gap-replace would overwrite content");let t=e.slice(this.gapFrom,this.gapTo);if(t.openStart||t.openEnd)return H.fail("Gap is not a flat range");let n=this.slice.insertAt(this.insert,t.content);return n?H.fromReplace(e,this.from,this.to,n):H.fail("Content does not fit in gap")}getMap(){return new de([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(e){let t=this.gapTo-this.gapFrom;return new j(this.from,this.from+this.slice.size+t,this.from+this.insert,this.from+this.insert+t,e.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(e){let t=e.mapResult(this.from,1),n=e.mapResult(this.to,-1),i=this.from==this.gapFrom?t.pos:e.map(this.gapFrom,-1),s=this.to==this.gapTo?n.pos:e.map(this.gapTo,1);return t.deletedAcross&&n.deletedAcross||i<t.pos||s>n.pos?null:new j(t.pos,n.pos,i,s,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number"||typeof t.gapFrom!="number"||typeof t.gapTo!="number"||typeof t.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new j(t.from,t.to,t.gapFrom,t.gapTo,S.fromJSON(e,t.slice),t.insert,!!t.structure)}}ee.jsonID("replaceAround",j);function jr(r,e,t){let n=r.resolve(e),i=t-e,s=n.depth;for(;i>0&&s>0&&n.indexAfter(s)==n.node(s).childCount;)s--,i--;if(i>0){let o=n.node(s).maybeChild(n.indexAfter(s));for(;i>0;){if(!o||o.isLeaf)return!0;o=o.firstChild,i--}}return!1}function _a(r,e,t,n){let i=[],s=[],o,l;r.doc.nodesBetween(e,t,(a,c,d)=>{if(!a.isInline)return;let u=a.marks;if(!n.isInSet(u)&&d.type.allowsMarkType(n.type)){let h=Math.max(c,e),f=Math.min(c+a.nodeSize,t),p=n.addToSet(u);for(let m=0;m<u.length;m++)u[m].isInSet(p)||(o&&o.to==h&&o.mark.eq(u[m])?o.to=f:i.push(o=new Ce(h,f,u[m])));l&&l.to==h?l.to=f:s.push(l=new Fe(h,f,n))}}),i.forEach(a=>r.step(a)),s.forEach(a=>r.step(a))}function Ga(r,e,t,n){let i=[],s=0;r.doc.nodesBetween(e,t,(o,l)=>{if(!o.isInline)return;s++;let a=null;if(n instanceof zn){let c=o.marks,d;for(;d=n.isInSet(c);)(a||(a=[])).push(d),c=d.removeFromSet(c)}else n?n.isInSet(o.marks)&&(a=[n]):a=o.marks;if(a&&a.length){let c=Math.min(l+o.nodeSize,t);for(let d=0;d<a.length;d++){let u=a[d],h;for(let f=0;f<i.length;f++){let p=i[f];p.step==s-1&&u.eq(i[f].style)&&(h=p)}h?(h.to=c,h.step=s):i.push({style:u,from:Math.max(l,e),to:c,step:s})}}}),i.forEach(o=>r.step(new Ce(o.from,o.to,o.style)))}function Jr(r,e,t,n=t.contentMatch,i=!0){let s=r.doc.nodeAt(e),o=[],l=e+1;for(let a=0;a<s.childCount;a++){let c=s.child(a),d=l+c.nodeSize,u=n.matchType(c.type);if(!u)o.push(new V(l,d,S.empty));else{n=u;for(let h=0;h<c.marks.length;h++)t.allowsMarkType(c.marks[h].type)||r.step(new Ce(l,d,c.marks[h]));if(i&&c.isText&&t.whitespace!="pre"){let h,f=/\r?\n|\r/g,p;for(;h=f.exec(c.text);)p||(p=new S(b.from(t.schema.text(" ",t.allowedMarks(c.marks))),0,0)),o.push(new V(l+h.index,l+h.index+h[0].length,p))}}l=d}if(!n.validEnd){let a=n.fillBefore(b.empty,!0);r.replace(l,l,new S(a,0,0))}for(let a=o.length-1;a>=0;a--)r.step(o[a])}function Ya(r,e,t){return(e==0||r.canReplace(e,r.childCount))&&(t==r.childCount||r.canReplace(0,t))}function St(r){let t=r.parent.content.cutByIndex(r.startIndex,r.endIndex);for(let n=r.depth,i=0,s=0;;--n){let o=r.$from.node(n),l=r.$from.index(n)+i,a=r.$to.indexAfter(n)-s;if(n<r.depth&&o.canReplace(l,a,t))return n;if(n==0||o.type.spec.isolating||!Ya(o,l,a))break;l&&(i=1),a<o.childCount&&(s=1)}return null}function Xa(r,e,t){let{$from:n,$to:i,depth:s}=e,o=n.before(s+1),l=i.after(s+1),a=o,c=l,d=b.empty,u=0;for(let p=s,m=!1;p>t;p--)m||n.index(p)>0?(m=!0,d=b.from(n.node(p).copy(d)),u++):a--;let h=b.empty,f=0;for(let p=s,m=!1;p>t;p--)m||i.after(p+1)<i.end(p)?(m=!0,h=b.from(i.node(p).copy(h)),f++):c++;r.step(new j(a,c,o,l,new S(d.append(h),u,f),d.size-u,!0))}function Kr(r,e,t=null,n=r){let i=Za(r,e),s=i&&Qa(n,e);return s?i.map(zs).concat({type:e,attrs:t}).concat(s.map(zs)):null}function zs(r){return{type:r,attrs:null}}function Za(r,e){let{parent:t,startIndex:n,endIndex:i}=r,s=t.contentMatchAt(n).findWrapping(e);if(!s)return null;let o=s.length?s[0]:e;return t.canReplaceWith(n,i,o)?s:null}function Qa(r,e){let{parent:t,startIndex:n,endIndex:i}=r,s=t.child(n),o=e.contentMatch.findWrapping(s.type);if(!o)return null;let a=(o.length?o[o.length-1]:e).contentMatch;for(let c=n;a&&c<i;c++)a=a.matchType(t.child(c).type);return!a||!a.validEnd?null:o}function ec(r,e,t){let n=b.empty;for(let o=t.length-1;o>=0;o--){if(n.size){let l=t[o].type.contentMatch.matchFragment(n);if(!l||!l.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}n=b.from(t[o].type.create(t[o].attrs,n))}let i=e.start,s=e.end;r.step(new j(i,s,i,s,new S(n,0,0),t.length,!0))}function tc(r,e,t,n,i){if(!n.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let s=r.steps.length;r.doc.nodesBetween(e,t,(o,l)=>{let a=typeof i=="function"?i(o):i;if(o.isTextblock&&!o.hasMarkup(n,a)&&nc(r.doc,r.mapping.slice(s).map(l),n)){let c=null;if(n.schema.linebreakReplacement){let f=n.whitespace=="pre",p=!!n.contentMatch.matchType(n.schema.linebreakReplacement);f&&!p?c=!1:!f&&p&&(c=!0)}c===!1&&Fs(r,o,l,s),Jr(r,r.mapping.slice(s).map(l,1),n,void 0,c===null);let d=r.mapping.slice(s),u=d.map(l,1),h=d.map(l+o.nodeSize,1);return r.step(new j(u,h,u+1,h-1,new S(b.from(n.create(a,null,o.marks)),0,0),1,!0)),c===!0&&$s(r,o,l,s),!1}})}function $s(r,e,t,n){e.forEach((i,s)=>{if(i.isText){let o,l=/\r?\n|\r/g;for(;o=l.exec(i.text);){let a=r.mapping.slice(n).map(t+1+s+o.index);r.replaceWith(a,a+1,e.type.schema.linebreakReplacement.create())}}})}function Fs(r,e,t,n){e.forEach((i,s)=>{if(i.type==i.type.schema.linebreakReplacement){let o=r.mapping.slice(n).map(t+1+s);r.replaceWith(o,o+1,e.type.schema.text(`
@@ -93,7 +93,7 @@ img.ProseMirror-separator {
93
93
  `},addCommands(){return{setHardBreak:()=>({commands:r,chain:e,state:t,editor:n})=>r.first([()=>r.exitCode(),()=>r.command(()=>{const{selection:i,storedMarks:s}=t;if(i.$from.parent.type.spec.isolating)return!1;const{keepMarks:o}=this.options,{splittableMarks:l}=n.extensionManager,a=s||i.$to.parentOffset&&i.$from.marks();return e().insertContent({type:this.name}).command(({tr:c,dispatch:d})=>{if(d&&a&&o){const u=a.filter(h=>l.includes(h.type.name));c.ensureMarks(u)}return!0}).run()})])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}}),Ff=Se.create({name:"heading",addOptions(){return{levels:[1,2,3,4,5,6],HTMLAttributes:{}}},content:"inline*",group:"block",defining:!0,addAttributes(){return{level:{default:1,rendered:!1}}},parseHTML(){return this.options.levels.map(r=>({tag:`h${r}`,attrs:{level:r}}))},renderHTML({node:r,HTMLAttributes:e}){return[`h${this.options.levels.includes(r.attrs.level)?r.attrs.level:this.options.levels[0]}`,K(this.options.HTMLAttributes,e),0]},addCommands(){return{setHeading:r=>({commands:e})=>this.options.levels.includes(r.level)?e.setNode(this.name,r):!1,toggleHeading:r=>({commands:e})=>this.options.levels.includes(r.level)?e.toggleNode(this.name,"paragraph",r):!1}},addKeyboardShortcuts(){return this.options.levels.reduce((r,e)=>({...r,[`Mod-Alt-${e}`]:()=>this.editor.commands.toggleHeading({level:e})}),{})},addInputRules(){return this.options.levels.map(r=>Vi({find:new RegExp(`^(#{${Math.min(...this.options.levels)},${r}})\\s$`),type:this.type,getAttributes:{level:r}}))}});var pr=200,U=function(){};U.prototype.append=function(e){return e.length?(e=U.from(e),!this.length&&e||e.length<pr&&this.leafAppend(e)||this.length<pr&&e.leafPrepend(this)||this.appendInner(e)):this},U.prototype.prepend=function(e){return e.length?U.from(e).append(this):this},U.prototype.appendInner=function(e){return new Hf(this,e)},U.prototype.slice=function(e,t){return e===void 0&&(e=0),t===void 0&&(t=this.length),e>=t?U.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,t))},U.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)},U.prototype.forEach=function(e,t,n){t===void 0&&(t=0),n===void 0&&(n=this.length),t<=n?this.forEachInner(e,t,n,0):this.forEachInvertedInner(e,t,n,0)},U.prototype.map=function(e,t,n){t===void 0&&(t=0),n===void 0&&(n=this.length);var i=[];return this.forEach(function(s,o){return i.push(e(s,o))},t,n),i},U.from=function(e){return e instanceof U?e:e&&e.length?new Zl(e):U.empty};var Zl=function(r){function e(n){r.call(this),this.values=n}r&&(e.__proto__=r),e.prototype=Object.create(r&&r.prototype),e.prototype.constructor=e;var t={length:{configurable:!0},depth:{configurable:!0}};return e.prototype.flatten=function(){return this.values},e.prototype.sliceInner=function(i,s){return i==0&&s==this.length?this:new e(this.values.slice(i,s))},e.prototype.getInner=function(i){return this.values[i]},e.prototype.forEachInner=function(i,s,o,l){for(var a=s;a<o;a++)if(i(this.values[a],l+a)===!1)return!1},e.prototype.forEachInvertedInner=function(i,s,o,l){for(var a=s-1;a>=o;a--)if(i(this.values[a],l+a)===!1)return!1},e.prototype.leafAppend=function(i){if(this.length+i.length<=pr)return new e(this.values.concat(i.flatten()))},e.prototype.leafPrepend=function(i){if(this.length+i.length<=pr)return new e(i.flatten().concat(this.values))},t.length.get=function(){return this.values.length},t.depth.get=function(){return 0},Object.defineProperties(e.prototype,t),e}(U);U.empty=new Zl([]);var Hf=function(r){function e(t,n){r.call(this),this.left=t,this.right=n,this.length=t.length+n.length,this.depth=Math.max(t.depth,n.depth)+1}return r&&(e.__proto__=r),e.prototype=Object.create(r&&r.prototype),e.prototype.constructor=e,e.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},e.prototype.getInner=function(n){return n<this.left.length?this.left.get(n):this.right.get(n-this.left.length)},e.prototype.forEachInner=function(n,i,s,o){var l=this.left.length;if(i<l&&this.left.forEachInner(n,i,Math.min(s,l),o)===!1||s>l&&this.right.forEachInner(n,Math.max(i-l,0),Math.min(this.length,s)-l,o+l)===!1)return!1},e.prototype.forEachInvertedInner=function(n,i,s,o){var l=this.left.length;if(i>l&&this.right.forEachInvertedInner(n,i-l,Math.max(s,l)-l,o+l)===!1||s<l&&this.left.forEachInvertedInner(n,Math.min(i,l),s,o)===!1)return!1},e.prototype.sliceInner=function(n,i){if(n==0&&i==this.length)return this;var s=this.left.length;return i<=s?this.left.slice(n,i):n>=s?this.right.slice(n-s,i-s):this.left.slice(n,s).append(this.right.slice(0,i-s))},e.prototype.leafAppend=function(n){var i=this.right.leafAppend(n);if(i)return new e(this.left,i)},e.prototype.leafPrepend=function(n){var i=this.left.leafPrepend(n);if(i)return new e(i,this.right)},e.prototype.appendInner=function(n){return this.left.depth>=Math.max(this.right.depth,n.depth)+1?new e(this.left,new e(this.right,n)):new e(this,n)},e}(U);const Vf=500;class we{constructor(e,t){this.items=e,this.eventCount=t}popEvent(e,t){if(this.eventCount==0)return null;let n=this.items.length;for(;;n--)if(this.items.get(n-1).selection){--n;break}let i,s;t&&(i=this.remapping(n,this.items.length),s=i.maps.length);let o=e.tr,l,a,c=[],d=[];return this.items.forEach((u,h)=>{if(!u.step){i||(i=this.remapping(n,h+1),s=i.maps.length),s--,d.push(u);return}if(i){d.push(new Ae(u.map));let f=u.step.map(i.slice(s)),p;f&&o.maybeStep(f).doc&&(p=o.mapping.maps[o.mapping.maps.length-1],c.push(new Ae(p,void 0,void 0,c.length+d.length))),s--,p&&i.appendMap(p,s)}else o.maybeStep(u.step);if(u.selection)return l=i?u.selection.map(i.slice(s)):u.selection,a=new we(this.items.slice(0,n).append(d.reverse().concat(c)),this.eventCount-1),!1},this.items.length,0),{remaining:a,transform:o,selection:l}}addTransform(e,t,n,i){let s=[],o=this.eventCount,l=this.items,a=!i&&l.length?l.get(l.length-1):null;for(let d=0;d<e.steps.length;d++){let u=e.steps[d].invert(e.docs[d]),h=new Ae(e.mapping.maps[d],u,t),f;(f=a&&a.merge(h))&&(h=f,d?s.pop():l=l.slice(0,l.length-1)),s.push(h),t&&(o++,t=void 0),i||(a=h)}let c=o-n.depth;return c>Wf&&(l=qf(l,c),o-=c),new we(l.append(s),o)}remapping(e,t){let n=new Wt;return this.items.forEach((i,s)=>{let o=i.mirrorOffset!=null&&s-i.mirrorOffset>=e?n.maps.length-i.mirrorOffset:void 0;n.appendMap(i.map,o)},e,t),n}addMaps(e){return this.eventCount==0?this:new we(this.items.append(e.map(t=>new Ae(t))),this.eventCount)}rebased(e,t){if(!this.eventCount)return this;let n=[],i=Math.max(0,this.items.length-t),s=e.mapping,o=e.steps.length,l=this.eventCount;this.items.forEach(h=>{h.selection&&l--},i);let a=t;this.items.forEach(h=>{let f=s.getMirror(--a);if(f==null)return;o=Math.min(o,f);let p=s.maps[f];if(h.step){let m=e.steps[f].invert(e.docs[f]),g=h.selection&&h.selection.map(s.slice(a+1,f));g&&l++,n.push(new Ae(p,m,g))}else n.push(new Ae(p))},i);let c=[];for(let h=t;h<o;h++)c.push(new Ae(s.maps[h]));let d=this.items.slice(0,i).append(c).append(n),u=new we(d,l);return u.emptyItemCount()>Vf&&(u=u.compress(this.items.length-n.length)),u}emptyItemCount(){let e=0;return this.items.forEach(t=>{t.step||e++}),e}compress(e=this.items.length){let t=this.remapping(0,e),n=t.maps.length,i=[],s=0;return this.items.forEach((o,l)=>{if(l>=e)i.push(o),o.selection&&s++;else if(o.step){let a=o.step.map(t.slice(n)),c=a&&a.getMap();if(n--,c&&t.appendMap(c,n),a){let d=o.selection&&o.selection.map(t.slice(n));d&&s++;let u=new Ae(c.invert(),a,d),h,f=i.length-1;(h=i.length&&i[f].merge(u))?i[f]=h:i.push(u)}}else o.map&&n--},this.items.length,0),new we(U.from(i.reverse()),s)}}we.empty=new we(U.empty,0);function qf(r,e){let t;return r.forEach((n,i)=>{if(n.selection&&e--==0)return t=i,!1}),r.slice(t)}class Ae{constructor(e,t,n,i){this.map=e,this.step=t,this.selection=n,this.mirrorOffset=i}merge(e){if(this.step&&e.step&&!e.selection){let t=e.step.merge(this.step);if(t)return new Ae(t.getMap().invert(),t,this.selection)}}}class Ze{constructor(e,t,n,i,s){this.done=e,this.undone=t,this.prevRanges=n,this.prevTime=i,this.prevComposition=s}}const Wf=20;function jf(r,e,t,n){let i=t.getMeta(mt),s;if(i)return i.historyState;t.getMeta(Uf)&&(r=new Ze(r.done,r.undone,null,0,-1));let o=t.getMeta("appendedTransaction");if(t.steps.length==0)return r;if(o&&o.getMeta(mt))return o.getMeta(mt).redo?new Ze(r.done.addTransform(t,void 0,n,mr(e)),r.undone,Ql(t.mapping.maps),r.prevTime,r.prevComposition):new Ze(r.done,r.undone.addTransform(t,void 0,n,mr(e)),null,r.prevTime,r.prevComposition);if(t.getMeta("addToHistory")!==!1&&!(o&&o.getMeta("addToHistory")===!1)){let l=t.getMeta("composition"),a=r.prevTime==0||!o&&r.prevComposition!=l&&(r.prevTime<(t.time||0)-n.newGroupDelay||!Jf(t,r.prevRanges)),c=o?Wi(r.prevRanges,t.mapping):Ql(t.mapping.maps);return new Ze(r.done.addTransform(t,a?e.selection.getBookmark():void 0,n,mr(e)),we.empty,c,t.time,l??r.prevComposition)}else return(s=t.getMeta("rebased"))?new Ze(r.done.rebased(t,s),r.undone.rebased(t,s),Wi(r.prevRanges,t.mapping),r.prevTime,r.prevComposition):new Ze(r.done.addMaps(t.mapping.maps),r.undone.addMaps(t.mapping.maps),Wi(r.prevRanges,t.mapping),r.prevTime,r.prevComposition)}function Jf(r,e){if(!e)return!1;if(!r.docChanged)return!0;let t=!1;return r.mapping.maps[0].forEach((n,i)=>{for(let s=0;s<e.length;s+=2)n<=e[s+1]&&i>=e[s]&&(t=!0)}),t}function Ql(r){let e=[];for(let t=r.length-1;t>=0&&e.length==0;t--)r[t].forEach((n,i,s,o)=>e.push(s,o));return e}function Wi(r,e){if(!r)return null;let t=[];for(let n=0;n<r.length;n+=2){let i=e.map(r[n],1),s=e.map(r[n+1],-1);i<=s&&t.push(i,s)}return t}function Kf(r,e,t){let n=mr(e),i=mt.get(e).spec.config,s=(t?r.undone:r.done).popEvent(e,n);if(!s)return null;let o=s.selection.resolve(s.transform.doc),l=(t?r.done:r.undone).addTransform(s.transform,e.selection.getBookmark(),i,n),a=new Ze(t?l:s.remaining,t?s.remaining:l,null,0,-1);return s.transform.setSelection(o).setMeta(mt,{redo:t,historyState:a})}let ji=!1,ea=null;function mr(r){let e=r.plugins;if(ea!=e){ji=!1,ea=e;for(let t=0;t<e.length;t++)if(e[t].spec.historyPreserveItems){ji=!0;break}}return ji}const mt=new Te("history"),Uf=new Te("closeHistory");function _f(r={}){return r={depth:r.depth||100,newGroupDelay:r.newGroupDelay||500},new oe({key:mt,state:{init(){return new Ze(we.empty,we.empty,null,0,-1)},apply(e,t,n){return jf(t,n,e,r)}},config:r,props:{handleDOMEvents:{beforeinput(e,t){let n=t.inputType,i=n=="historyUndo"?na:n=="historyRedo"?ra:null;return!i||!e.editable?!1:(t.preventDefault(),i(e.state,e.dispatch))}}}})}function ta(r,e){return(t,n)=>{let i=mt.getState(t);if(!i||(r?i.undone:i.done).eventCount==0)return!1;if(n){let s=Kf(i,t,r);s&&n(e?s.scrollIntoView():s)}return!0}}const na=ta(!1,!0),ra=ta(!0,!0),Gf=Q.create({name:"history",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:r,dispatch:e})=>na(r,e),redo:()=>({state:r,dispatch:e})=>ra(r,e)}},addProseMirrorPlugins(){return[_f(this.options)]},addKeyboardShortcuts(){return{"Mod-z":()=>this.editor.commands.undo(),"Shift-Mod-z":()=>this.editor.commands.redo(),"Mod-y":()=>this.editor.commands.redo(),"Mod-я":()=>this.editor.commands.undo(),"Shift-Mod-я":()=>this.editor.commands.redo()}}}),Yf=Se.create({name:"horizontalRule",addOptions(){return{HTMLAttributes:{}}},group:"block",parseHTML(){return[{tag:"hr"}]},renderHTML({HTMLAttributes:r}){return["hr",K(this.options.HTMLAttributes,r)]},addCommands(){return{setHorizontalRule:()=>({chain:r,state:e})=>{if(!df(e,e.schema.nodes[this.name]))return!1;const{selection:t}=e,{$from:n,$to:i}=t,s=r();return n.parentOffset===0?s.insertContentAt({from:Math.max(n.pos-1,0),to:i.pos},{type:this.name}):Vh(t)?s.insertContentAt(i.pos,{type:this.name}):s.insertContent({type:this.name}),s.command(({tr:o,dispatch:l})=>{var a;if(l){const{$to:c}=o.selection,d=c.end();if(c.nodeAfter)c.nodeAfter.isTextblock?o.setSelection(v.create(o.doc,c.pos+1)):c.nodeAfter.isBlock?o.setSelection(C.create(o.doc,c.pos)):o.setSelection(v.create(o.doc,c.pos));else{const u=(a=c.parent.type.contentMatch.defaultType)===null||a===void 0?void 0:a.create();u&&(o.insert(d,u),o.setSelection(v.create(o.doc,d+1)))}o.scrollIntoView()}return!0}).run()}}},addInputRules(){return[_l({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type})]}}),Xf=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,Zf=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,Qf=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,ep=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,tp=Oe.create({name:"italic",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"em"},{tag:"i",getAttrs:r=>r.style.fontStyle!=="normal"&&null},{style:"font-style=normal",clearMark:r=>r.type.name===this.name},{style:"font-style=italic"}]},renderHTML({HTMLAttributes:r}){return["em",K(this.options.HTMLAttributes,r),0]},addCommands(){return{setItalic:()=>({commands:r})=>r.setMark(this.name),toggleItalic:()=>({commands:r})=>r.toggleMark(this.name),unsetItalic:()=>({commands:r})=>r.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-i":()=>this.editor.commands.toggleItalic(),"Mod-I":()=>this.editor.commands.toggleItalic()}},addInputRules(){return[ft({find:Xf,type:this.type}),ft({find:Qf,type:this.type})]},addPasteRules(){return[pt({find:Zf,type:this.type}),pt({find:ep,type:this.type})]}}),np=Se.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:r}){return["li",K(this.options.HTMLAttributes,r),0]},addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)}}}),rp="listItem",ia="textStyle",sa=/^(\d+)\.\s$/,ip=Se.create({name:"orderedList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},addAttributes(){return{start:{default:1,parseHTML:r=>r.hasAttribute("start")?parseInt(r.getAttribute("start")||"",10):1},type:{default:null,parseHTML:r=>r.getAttribute("type")}}},parseHTML(){return[{tag:"ol"}]},renderHTML({HTMLAttributes:r}){const{start:e,...t}=r;return e===1?["ol",K(this.options.HTMLAttributes,t),0]:["ol",K(this.options.HTMLAttributes,r),0]},addCommands(){return{toggleOrderedList:()=>({commands:r,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(rp,this.editor.getAttributes(ia)).run():r.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let r=on({find:sa,type:this.type,getAttributes:e=>({start:+e[1]}),joinPredicate:(e,t)=>t.childCount+t.attrs.start===+e[1]});return(this.options.keepMarks||this.options.keepAttributes)&&(r=on({find:sa,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes(ia)}),joinPredicate:(e,t)=>t.childCount+t.attrs.start===+e[1],editor:this.editor})),[r]}}),sp=Se.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:r}){return["p",K(this.options.HTMLAttributes,r),0]},addCommands(){return{setParagraph:()=>({commands:r})=>r.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),op=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,lp=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,ap=Oe.create({name:"strike",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"s"},{tag:"del"},{tag:"strike"},{style:"text-decoration",consuming:!1,getAttrs:r=>r.includes("line-through")?{}:!1}]},renderHTML({HTMLAttributes:r}){return["s",K(this.options.HTMLAttributes,r),0]},addCommands(){return{setStrike:()=>({commands:r})=>r.setMark(this.name),toggleStrike:()=>({commands:r})=>r.toggleMark(this.name),unsetStrike:()=>({commands:r})=>r.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-s":()=>this.editor.commands.toggleStrike()}},addInputRules(){return[ft({find:op,type:this.type})]},addPasteRules(){return[pt({find:lp,type:this.type})]}}),cp=Se.create({name:"text",group:"inline"}),dp=Q.create({name:"starterKit",addExtensions(){const r=[];return this.options.bold!==!1&&r.push(yf.configure(this.options.bold)),this.options.blockquote!==!1&&r.push(hf.configure(this.options.blockquote)),this.options.bulletList!==!1&&r.push(kf.configure(this.options.bulletList)),this.options.code!==!1&&r.push(wf.configure(this.options.code)),this.options.codeBlock!==!1&&r.push(Tf.configure(this.options.codeBlock)),this.options.document!==!1&&r.push(Ef.configure(this.options.document)),this.options.dropcursor!==!1&&r.push(Af.configure(this.options.dropcursor)),this.options.gapcursor!==!1&&r.push(zf.configure(this.options.gapcursor)),this.options.hardBreak!==!1&&r.push($f.configure(this.options.hardBreak)),this.options.heading!==!1&&r.push(Ff.configure(this.options.heading)),this.options.history!==!1&&r.push(Gf.configure(this.options.history)),this.options.horizontalRule!==!1&&r.push(Yf.configure(this.options.horizontalRule)),this.options.italic!==!1&&r.push(tp.configure(this.options.italic)),this.options.listItem!==!1&&r.push(np.configure(this.options.listItem)),this.options.orderedList!==!1&&r.push(ip.configure(this.options.orderedList)),this.options.paragraph!==!1&&r.push(sp.configure(this.options.paragraph)),this.options.strike!==!1&&r.push(ap.configure(this.options.strike)),this.options.text!==!1&&r.push(cp.configure(this.options.text)),r}}),up=r=>{if(!r.children.length)return;const e=r.querySelectorAll("span");e&&e.forEach(t=>{var n,i;const s=t.getAttribute("style"),o=(i=(n=t.parentElement)===null||n===void 0?void 0:n.closest("span"))===null||i===void 0?void 0:i.getAttribute("style");t.setAttribute("style",`${o};${s}`)})},hp=Oe.create({name:"textStyle",priority:101,addOptions(){return{HTMLAttributes:{},mergeNestedSpanStyles:!1}},parseHTML(){return[{tag:"span",getAttrs:r=>r.hasAttribute("style")?(this.options.mergeNestedSpanStyles&&up(r),{}):!1}]},renderHTML({HTMLAttributes:r}){return["span",K(this.options.HTMLAttributes,r),0]},addCommands(){return{removeEmptyTextStyle:()=>({tr:r})=>{const{selection:e}=r;return r.doc.nodesBetween(e.from,e.to,(t,n)=>{if(t.isTextblock)return!0;t.marks.filter(i=>i.type===this.type).some(i=>Object.values(i.attrs).some(s=>!!s))||r.removeMark(n,n+t.nodeSize,this.type)}),!0}}}}),fp=Q.create({name:"color",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{color:{default:null,parseHTML:r=>{var e;return(e=r.style.color)===null||e===void 0?void 0:e.replace(/['"]+/g,"")},renderHTML:r=>r.color?{style:`color: ${r.color}`}:{}}}}]},addCommands(){return{setColor:r=>({chain:e})=>e().setMark("textStyle",{color:r}).run(),unsetColor:()=>({chain:r})=>r().setMark("textStyle",{color:null}).removeEmptyTextStyle().run()}}}),pp=/(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))$/,mp=/(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))/g,gp=Oe.create({name:"highlight",addOptions(){return{multicolor:!1,HTMLAttributes:{}}},addAttributes(){return this.options.multicolor?{color:{default:null,parseHTML:r=>r.getAttribute("data-color")||r.style.backgroundColor,renderHTML:r=>r.color?{"data-color":r.color,style:`background-color: ${r.color}; color: inherit`}:{}}}:{}},parseHTML(){return[{tag:"mark"}]},renderHTML({HTMLAttributes:r}){return["mark",K(this.options.HTMLAttributes,r),0]},addCommands(){return{setHighlight:r=>({commands:e})=>e.setMark(this.name,r),toggleHighlight:r=>({commands:e})=>e.toggleMark(this.name,r),unsetHighlight:()=>({commands:r})=>r.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-h":()=>this.editor.commands.toggleHighlight()}},addInputRules(){return[ft({find:pp,type:this.type})]},addPasteRules(){return[pt({find:mp,type:this.type})]}}),yp=Q.create({name:"textAlign",addOptions(){return{types:[],alignments:["left","center","right","justify"],defaultAlignment:null}},addGlobalAttributes(){return[{types:this.options.types,attributes:{textAlign:{default:this.options.defaultAlignment,parseHTML:r=>{const e=r.style.textAlign;return this.options.alignments.includes(e)?e:this.options.defaultAlignment},renderHTML:r=>r.textAlign?{style:`text-align: ${r.textAlign}`}:{}}}}]},addCommands(){return{setTextAlign:r=>({commands:e})=>this.options.alignments.includes(r)?this.options.types.map(t=>e.updateAttributes(t,{textAlign:r})).every(t=>t):!1,unsetTextAlign:()=>({commands:r})=>this.options.types.map(e=>r.resetAttributes(e,"textAlign")).every(e=>e),toggleTextAlign:r=>({editor:e,commands:t})=>this.options.alignments.includes(r)?e.isActive({textAlign:r})?t.unsetTextAlign():t.setTextAlign(r):!1}},addKeyboardShortcuts(){return{"Mod-Shift-l":()=>this.editor.commands.setTextAlign("left"),"Mod-Shift-e":()=>this.editor.commands.setTextAlign("center"),"Mod-Shift-r":()=>this.editor.commands.setTextAlign("right"),"Mod-Shift-j":()=>this.editor.commands.setTextAlign("justify")}}}),bp=/(?:^|\s)(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/,kp=Se.create({name:"image",addOptions(){return{inline:!1,allowBase64:!1,HTMLAttributes:{}}},inline(){return this.options.inline},group(){return this.options.inline?"inline":"block"},draggable:!0,addAttributes(){return{src:{default:null},alt:{default:null},title:{default:null}}},parseHTML(){return[{tag:this.options.allowBase64?"img[src]":'img[src]:not([src^="data:"])'}]},renderHTML({HTMLAttributes:r}){return["img",K(this.options.HTMLAttributes,r)]},addCommands(){return{setImage:r=>({commands:e})=>e.insertContent({type:this.name,attrs:r})}},addInputRules(){return[_l({find:bp,type:this.type,getAttributes:r=>{const[,,e,t,n]=r;return{src:t,alt:e,title:n}}})]}});class xp extends wa{constructor(){super();M(this,fe);M(this,ae,null);M(this,hn,null);M(this,fn,null)}connectedCallback(){super.connectedCallback()&&(R(this,fe,ua).call(this),R(this,fe,ha).call(this),R(this,fe,Zi).call(this))}get value(){return k(this,ae).getHTML()}set value(t){let n=t||"";n&&!/<\/?[a-z][^>]*>/i.test(n)&&(n=n.split(`
94
94
  `).map(i=>`<p>${i}</p>`).join("")),k(this,ae)?k(this,ae).commands.setContent(n,!1):L(this,fn,n)}get id(){return this.getAttribute("id")}set id(t){this.setAttribute("id",t)}get name(){return this.getAttribute("name")}set name(t){this.setAttribute("name",t)}get readonly(){return this.hasAttribute("readonly")}set readonly(t){t?this.setAttribute("readonly",""):this.removeAttribute("readonly"),R(this,fe,Zi).call(this)}disconnectedCallback(){k(this,ae)&&(k(this,ae).destroy(),L(this,ae,null))}}ae=new WeakMap,hn=new WeakMap,fn=new WeakMap,fe=new WeakSet,Zi=function(){if(k(this,ae)){const t=this.readonly;k(this,ae).setEditable(!t);const n=this.shadowRoot.querySelector(".menu-bar");n&&(n.style.display=t?"none":"flex")}},ua=function(){const t=Br.getComponentCssPath("nineEditor.css"),n=t?`@import "${t}";`:"";this.shadowRoot.innerHTML=`
95
95
  <style>
96
- @import "https://cdn.jsdelivr.net/npm/@nine-lab/nine-ux@0.1.266/dist/css/nineEditor.css";
96
+ @import "https://cdn.jsdelivr.net/npm/@nine-lab/nine-ux@0.1.267/dist/css/nineEditor.css";
97
97
  ${n}
98
98
  </style>
99
99
 
@@ -130,7 +130,7 @@ img.ProseMirror-separator {
130
130
  <div id="editor-container"></div>
131
131
  `,L(this,hn,this.shadowRoot.querySelector("#editor-container")),this.shadowRoot.querySelector("#font-size").onchange=i=>{const s=i.target.value;console.log(i.target,s),k(this,ae).chain().focus().setMark("textStyle",{fontSize:s}).run()}},ha=function(){L(this,ae,new cf({element:k(this,hn),editable:!this.readonly,extensions:[dp,fp,gp.configure({multicolor:!0}),yp.configure({types:["heading","paragraph"]}),kp.configure({inline:!0,allowBase64:!0}),hp.extend({addAttributes(){return{fontSize:{default:null,parseHTML:t=>t.style.fontSize,renderHTML:t=>t.fontSize?{style:`font-size: ${t.fontSize}`}:{}}}}})],content:k(this,fn)||this.originContents||"",onUpdate:({editor:t})=>{this.dispatchEvent(new CustomEvent("change",{detail:t.getHTML()}))},onSelectionUpdate:({editor:t})=>{this.readonly||R(this,fe,fa).call(this,t)}})),R(this,fe,pa).call(this)},fa=function(t){this.shadowRoot.querySelectorAll("[data-cmd]").forEach(o=>{t.isActive(o.dataset.cmd)?o.classList.add("is-active"):o.classList.remove("is-active")}),this.shadowRoot.querySelectorAll("[data-align]").forEach(o=>{t.isActive({textAlign:o.dataset.align})?o.classList.add("is-active"):o.classList.remove("is-active")});const n=t.getAttributes("textStyle"),i=this.shadowRoot.querySelector("#font-size");i&&(i.value=n.fontSize||"14px");const s=this.shadowRoot.querySelector("#color-picker");s&&(s.value=n.color||"#000000")},pa=function(){const t=k(this,ae);this.shadowRoot.querySelectorAll("[data-cmd]").forEach(n=>{n.onclick=()=>{const i=n.dataset.cmd;i==="bold"&&t.chain().focus().toggleBold().run(),i==="italic"&&t.chain().focus().toggleItalic().run(),i==="underline"&&t.chain().focus().toggleUnderline().run(),i==="strike"&&t.chain().focus().toggleStrike().run(),i==="highlight"&&t.chain().focus().toggleHighlight().run(),i==="bulletList"&&t.chain().focus().toggleBulletList().run(),i==="orderedList"&&t.chain().focus().toggleOrderedList().run(),i==="undo"&&t.chain().focus().undo().run(),i==="redo"&&t.chain().focus().redo().run()}}),this.shadowRoot.querySelector("#color-picker").oninput=n=>{t.chain().focus().setColor(n.target.value).run()},this.shadowRoot.querySelectorAll("[data-align]").forEach(n=>{n.onclick=()=>t.chain().focus().setTextAlign(n.dataset.align).run()}),this.shadowRoot.querySelector("#img-btn").onclick=()=>{const n=window.prompt("Image URL");n&&t.chain().focus().setImage({src:n}).run()}};const Le=typeof window<"u"&&window.nine?window.nine:O.nine,oa={alert:window.alert,confirm:window.confirm},la=()=>{var t;console.log(Le,window.nine);const{nativeOverride:r}=((t=Le==null?void 0:Le.config)==null?void 0:t.ux)||{},e=Array.isArray(r)?r:r===!0?["alert","confirm"]:[];console.log(Le,e),window.alert=e.includes("alert")?n=>Br.alert(n):oa.alert,window.confirm=e.includes("confirm")?async n=>await Br.confirm(n):oa.confirm,Le.config.debug&&e.length>0&&console.log(`[nine-ux] Native API Overridden: ${e.join(", ")}`)};(()=>{la(),Le==null||Le.subscribeConfig(r=>{(r==="ux"||r==="config")&&la()})})();class Sp extends HTMLElement{constructor(){super();M(this,ce);M(this,pn);M(this,yr,()=>{this.innerHTML="";const t=O.nine.cssPath?`@import "${O.nine.cssPath}/nineCollapse.css";`:"",n=document.createElement("template");n.innerHTML=`
132
132
  <style>
133
- @import "https://cdn.jsdelivr.net/npm/@nine-lab/nine-ux@0.1.266/dist/css/nineCollapse.css";
133
+ @import "https://cdn.jsdelivr.net/npm/@nine-lab/nine-ux@0.1.267/dist/css/nineCollapse.css";
134
134
  ${t}
135
135
  </style>
136
136
 
@@ -181,7 +181,7 @@ img.ProseMirror-separator {
181
181
  }
182
182
  `;if(n){const l=new CSSStyleSheet;l.replaceSync(o),n.adoptedStyleSheets=[...n.adoptedStyleSheets,l]}else{const l=document.createElement("style");l.textContent=o,document.head.appendChild(l)}t.addEventListener("click",()=>{k(this,ce).classList.add("nx-collapse"),setTimeout(()=>{this.classList.add("nx-collapse")},100),setTimeout(()=>{L(this,pn,k(this,ce).style.display),k(this,ce).style.display="none"},500)})}this.shadowRoot.querySelector("button").addEventListener("click",()=>{k(this,ce).style.display=k(this,pn),k(this,ce).classList.remove("nx-collapse"),k(this,ce).classList.add("nx-expand"),setTimeout(()=>{this.classList.remove("nx-collapse"),this.classList.add("nx-expand")},100),setTimeout(()=>{k(this,ce).classList.remove("nx-expand"),this.classList.remove("nx-expand")},600)})});this.attachShadow({mode:"open"})}connectedCallback(){const t=this.getAttribute("target");L(this,ce,document.querySelector(t)),k(this,yr).call(this),k(this,br).call(this)}}ce=new WeakMap,pn=new WeakMap,yr=new WeakMap,br=new WeakMap,customElements.get("nine-collapse")||customElements.define("nine-collapse",Sp);class wp extends HTMLElement{constructor(){super();M(this,Me);M(this,Pt,!1);M(this,Lt);L(this,Lt,this.attachShadow({mode:"open"}))}static get observedAttributes(){return["lang","code"]}connectedCallback(){!this.getAttribute("code")&&this.textContent.trim()&&this.setAttribute("code",this.textContent.trim()),R(this,Me,On).call(this)}attributeChangedCallback(){R(this,Me,On).call(this)}}Pt=new WeakMap,Lt=new WeakMap,Me=new WeakSet,ma=async function(){const t=this.getAttribute("code")||"";try{await navigator.clipboard.writeText(t),L(this,Pt,!0),R(this,Me,On).call(this),setTimeout(()=>{L(this,Pt,!1),R(this,Me,On).call(this)},2e3)}catch(n){console.error("Code copy failed:",n)}},On=function(){const t=this.getAttribute("lang")||"Bash",n=this.getAttribute("code")||this.textContent.trim()||"",i=this.getAttribute("css-path");k(this,Lt).innerHTML=`
183
183
  <style>
184
- @import "https://cdn.jsdelivr.net/npm/@nine-lab/nine-ux@0.1.266/dist/css/nine-code-block.css";
184
+ @import "https://cdn.jsdelivr.net/npm/@nine-lab/nine-ux@0.1.267/dist/css/nine-code-block.css";
185
185
  ${i?`@import "${i}";`:""}
186
186
  </style>
187
187
 
@@ -201,7 +201,7 @@ img.ProseMirror-separator {
201
201
  </div>
202
202
  `,k(this,Lt).querySelector(".copy-btn").onclick=()=>R(this,Me,ma).call(this)},ga=function(t){const n=document.createElement("div");return n.textContent=t,n.innerHTML},typeof window<"u"&&(customElements.get("nine-code-block")||customElements.define("nine-code-block",wp));class Mp extends O.trace.constructor{constructor(){super(),this.init("nine-ux","blueviolet")}}const aa=new Mp;class Cp extends HTMLElement{constructor(){super();M(this,yt);M(this,kr,()=>{const t=O.nine.cssPath?`@import "${O.nine.cssPath}/nineTab.css";`:"";this.shadowRoot.innerHTML=`
203
203
  <style>
204
- @import "https://cdn.jsdelivr.net/npm/@nine-lab/nine-ux@0.1.266/dist/css/nineTab.css";
204
+ @import "https://cdn.jsdelivr.net/npm/@nine-lab/nine-ux@0.1.267/dist/css/nineTab.css";
205
205
  ${t}
206
206
  </style>
207
207
 
@@ -209,7 +209,7 @@ img.ProseMirror-separator {
209
209
  <div class="tab-pages"></div>
210
210
  `});_(this,"initialize",()=>{this.shadowRoot.querySelectorAll(".tab-button").forEach((n,i)=>{n.classList.remove("active")});const t=this.shadowRoot.querySelector('.tab-button:not([style*="display: none"])');t&&t.click()});M(this,xr,()=>{this.classList.add(this.getAttribute("theme")||"theme-1"),R(this,yt,Qi).call(this),this.shadowRoot.querySelectorAll(".tab-button").forEach(o=>{o.addEventListener("click",this.switchTabHandler)});const t=this.shadowRoot.querySelector(".tab-button"),n=this.shadowRoot.querySelector(".tab-page");t&&n&&(t.classList.add("active"),n.classList.add("active"),setTimeout(()=>{this.shadowRoot.querySelector(".tab-pages").style.height=`${n.scrollHeight}px`},100),aa.log(n.style.height,n.scrollHeight)),this.shadowRoot.querySelectorAll(".tab-page:not(.active)").forEach(o=>{o.classList.add("exit-right")});const i=new ResizeObserver(()=>{const o=this.shadowRoot.querySelector(".tab-page.active");o&&(this.shadowRoot.querySelector(".tab-pages").style.height=`${o.scrollHeight}px`)}),s=this.shadowRoot.querySelector(".tab-page.active");s&&i.observe(s)});_(this,"addTabPage",(t,n)=>{const i=this.shadowRoot.querySelector(".tabs"),s=this.shadowRoot.querySelector(".tab-pages");if(!i||!s)return;const l=`content${this.shadowRoot.querySelectorAll(".tab-button").length}`,a=document.createElement("div");a.classList.add("tab-button"),a.textContent=t,a.setAttribute("data-target",l),a.addEventListener("click",this.switchTabHandler),i.appendChild(a);const c=document.createElement("div");c.id=l,c.classList.add("tab-page","exit-right"),c.innerHTML=n,s.appendChild(c),this.shadowRoot.querySelectorAll(".tab-page:not(.active)").forEach(d=>{d.classList.add("exit-right")})});_(this,"removeTabPage",t=>{this.shadowRoot.querySelectorAll(".tab-button").forEach(i=>{const s=i.textContent.trim(),o=i.getAttribute("data-target"),l=this.shadowRoot.getElementById(o),a=l&&(l.querySelector(`.${t}`)||l.classList.contains(t));(s.toLowerCase().includes(t.toLowerCase())||a)&&(i.removeEventListener("click",this.switchTabHandler),i.remove(),l&&l.remove())}),this.initialize()});_(this,"clearTabs",()=>{this.innerHTML="";const t=this.shadowRoot.querySelector(".tabs"),n=this.shadowRoot.querySelector(".tab-pages");t&&(t.innerHTML=""),n&&(n.innerHTML="",n.style.height="0px")});_(this,"refresh",()=>{const t=this.shadowRoot.querySelector(".tabs"),n=this.shadowRoot.querySelector(".tab-pages");t&&(t.innerHTML=""),n&&(n.innerHTML="",n.style.height="0px"),R(this,yt,Qi).call(this),this.shadowRoot.querySelectorAll(".tab-button").forEach(i=>{i.removeEventListener("click",this.switchTabHandler),i.addEventListener("click",this.switchTabHandler)}),this.shadowRoot.querySelectorAll(".tab-page:not(.active)").forEach(i=>{i.classList.add("exit-right")}),this.initialize()});this.attachShadow({mode:"open"}),k(this,kr).call(this),this.switchTabHandler=R(this,yt,ya).bind(this),this.tabpage={show:t=>{this.shadowRoot.querySelectorAll(".tab-button").forEach((n,i)=>{n.innerText.trim()===t&&(n.style.display="unset")})},showAll:()=>{this.shadowRoot.querySelectorAll(".tab-button").forEach((t,n)=>{t.style.display="unset"})},hide:t=>{this.shadowRoot.querySelectorAll(".tab-button").forEach((n,i)=>{n.innerText.trim()===t&&(n.style.display="none")})}}}connectedCallback(){k(this,xr).call(this),this.dispatchEvent(new CustomEvent("tabload",{bubbles:!0,detail:{}}))}}kr=new WeakMap,yt=new WeakSet,Qi=function(){const t=this.shadowRoot.querySelector(".tabs"),n=this.shadowRoot.querySelector(".tab-pages"),i=this.querySelectorAll("nine-tab-page");i.forEach((s,o)=>{const l=document.createElement("div");l.classList.add("tab-button"),l.textContent=s.getAttribute("caption"),l.setAttribute("data-target",`content${o}`),t.appendChild(l);const a=document.createElement("div");a.id=`content${o}`,a.classList.add("tab-page"),a.innerHTML=s.innerHTML,n.appendChild(a)}),i.forEach(s=>{s.remove()})},ya=function(t){const n=t.target;if(!n.classList.contains("tab-button"))return;const i=n.getAttribute("data-target"),s=this.shadowRoot.querySelector(".tab-button.active"),o=this.shadowRoot.querySelector(".tab-page.active"),l=this.shadowRoot.getElementById(i);s!==n&&(s&&o?(s.classList.remove("active"),o.classList.remove("active","exit-left","exit-right"),o.style.left="",s.compareDocumentPosition(n)&Node.DOCUMENT_POSITION_FOLLOWING?o.classList.add("exit-left"):o.classList.add("exit-right"),l.classList.add("active"),l.style.left="",l.classList.remove("exit-left","exit-right")):o&&l&&(o.classList.remove("active","exit-left","exit-right"),o.style.left="",o.classList.add("exit-left"),l.classList.add("active"),l.style.left="",l.classList.remove("exit-left","exit-right")),n.classList.add("active"),this.shadowRoot.querySelector(".tab-pages").style.height=`${l.scrollHeight}px`)},xr=new WeakMap;class Tp extends HTMLElement{constructor(){super()}connectedCallback(){this.caption=this.getAttribute("caption")}}customElements.get("nine-tab")||customElements.define("nine-tab",Cp),customElements.get("nine-tab-page")||customElements.define("nine-tab-page",Tp);class Ep extends HTMLElement{constructor(){super();M(this,pe);_(this,"originContents");M(this,mn,!1);M(this,bt);M(this,gn,!1);_(this,"getData",()=>{const t={};return R(this,pe,An).call(this).forEach(n=>{const i=n.name;if(!i)return;let s;if(n.tagName==="INPUT"&&n.type==="checkbox"){let o=n.getAttribute("true-value")||"Y",l=n.getAttribute("false-value")||"N";s=n.checked?o:l}else n.tagName==="INPUT"&&n.type,s=n.value;t[i]?(Array.isArray(t[i])||(t[i]=[t[i]]),t[i].push(s)):t[i]=s}),t});_(this,"clearData",(t={})=>{R(this,pe,ts).call(this),R(this,pe,An).call(this).forEach(n=>{const i=n.name;if(!i)return;const s=t&&t[i]!==void 0?t[i]:"";R(this,pe,es).call(this,n,s)}),this.changed=!1});_(this,"setData",t=>{if(!t||typeof t!="object")return;R(this,pe,ts).call(this);let n=!1;R(this,pe,An).call(this).forEach(i=>{const s=i.name;!s||!t.hasOwnProperty(s)||R(this,pe,es).call(this,i,t[s])&&(n=!0)}),n&&(this.changed=!0)});_(this,"initData",t=>{this.clearData(t),this.changed=!1});M(this,yn,t=>{this.changed=!0});M(this,Sr,()=>{for(const t of this.attributes)t.name.startsWith("css-")&&this.style.setProperty(t.name.substring(4),t.value);this.originContents=this.innerHTML.trim(),this.innerHTML="",this.shadowRoot&&this.tagName.toLowerCase()==="nx-div"&&(this.shadowRoot.innerHTML=this.originContents)})}connectedCallback(){return k(this,mn)?!1:(this.getAttribute("use-shadow")!=="false"&&!this.shadowRoot?(this.attachShadow({mode:"open"}),L(this,bt,this.shadowRoot)):L(this,bt,this),k(this,Sr).call(this),L(this,mn,!0),!0)}get changed(){return k(this,gn)}set changed(t){const n=!!t;L(this,gn,n);const i=this.closest(".detail-wrapper");if(i){const s=i.querySelector("nx-title2");s&&(s.changed=n)}}get root(){return k(this,bt)||this}}mn=new WeakMap,bt=new WeakMap,gn=new WeakMap,pe=new WeakSet,An=function(){return k(this,bt).querySelectorAll("input[name], textarea[name], select[name], nx-editor[name]")},es=function(t,n){const i=t.tagName.toUpperCase(),s=t.type;let o=!1;if(["INPUT","TEXTAREA","SELECT","NX-EDITOR"].includes(i))if(s==="checkbox"){const l=t.getAttribute("true-value")||"Y",a=String(l)===String(n);t.checked!==a&&(o=!0),t.checked=a}else if(s==="radio"){const l=String(t.value)===String(n);t.checked!==l&&(o=!0),t.checked=l}else t.value!==n&&(o=!0),t.value=n;else t.textContent!==n&&(o=!0),t.textContent=n;return o},ts=function(){R(this,pe,An).call(this).forEach(t=>{t.removeEventListener("input",k(this,yn)),t.addEventListener("input",k(this,yn))})},yn=new WeakMap,Sr=new WeakMap;class vp{static apply(e,t="1",n="auto"){if(!e)return;const i=Number(t)||1,s=n.replace(/,/g," ").replace(/\*/g,"1fr");e.style.display="grid",e.style.gridTemplateRows=s,e.style.gap="12px 16px",e.style.width="100%";const o=()=>Array.from(e.children).filter(u=>u.tagName.toLowerCase()!=="style"&&u.tagName.toLowerCase()!=="nx-splitter");if(o().forEach(u=>{u.style.display="flex",u.style.alignItems="center",u.style.minWidth="0";const h=u.querySelector(".label");h&&(h.style.whiteSpace="nowrap",h.style.display="inline-block");const f=u.querySelector("input, select, textarea");f&&(f.style.flex="1",f.style.minWidth="0")}),e.dataset.layoutObserved)return;let a=0,c=0;const d=new ResizeObserver(u=>{for(let h of u){const f=Math.floor(h.contentRect.width);if(f<=0)return;const p=o();if(f<150){p.forEach(x=>{const N=x.querySelector(".label");N&&(N.style.width="auto")});return}let g=Math.floor(f/220);if(g=Math.max(1,Math.min(g,i)),a===g&&c===f)return;if(a=g,c=f,e.style.gridTemplateColumns=`repeat(${g}, minmax(0, 1fr))`,g===1){p.forEach(x=>{x.style.flexDirection="column",x.style.alignItems="flex-start",x.style.gap="4px",x.style.width="100%";const N=x.querySelector(".label");N&&(N.style.width="auto");const I=x.querySelector("input, select, textarea");I&&(I.style.width="100%")});return}p.forEach(x=>{x.style.flexDirection="row",x.style.alignItems="center",x.style.gap="8px",x.style.width="100%";const N=x.querySelector(".label");N&&(N.style.width="auto",N.style.whiteSpace="nowrap");const I=x.querySelector("input, select, textarea");I&&(I.style.width="100%",I.style.flex="1")});const y={};for(let x=0;x<g;x++)y[x]=[];let T=0;p.forEach(x=>{const N=x.querySelector(".label"),E=(window.getComputedStyle(x).gridColumnStart||"").match(/span\s+(\d+)/),P=E?Number(E[1]):1;T+P>g&&(T=0),N&&y[T].push(N),T+=P,T>=g&&(T=0)}),Object.values(y).forEach(x=>{if(x.length===0)return;const N=x.map($=>$.getBoundingClientRect().width),I=Math.max(...N);I>10&&x.forEach($=>{$.style.width=`${Math.ceil(I)+1}px`})})}});d.observe(e),e.dataset.layoutObserved="true",e._layoutObserverRef=d}static destroy(e){e&&e._layoutObserverRef&&(e._layoutObserverRef.disconnect(),delete e._layoutObserverRef,e.removeAttribute("data-layout-observed"))}}class Op extends Ep{constructor(){super();M(this,wr,()=>{var a;const t=this.getAttribute("caption"),n=this.getAttribute("max-column"),i=((a=this.getAttribute("rows-height"))==null?void 0:a.replace(/,/g," "))||"",s=nine.cssPath?`@import "${nine.cssPath}/ninePanel.css";`:"",o=document.createElement("template");o.innerHTML=`
211
211
  <style>
212
- @import "https://cdn.jsdelivr.net/npm/@nine-lab/nine-ux@0.1.266/dist/css/ninePanel.css";
212
+ @import "https://cdn.jsdelivr.net/npm/@nine-lab/nine-ux@0.1.267/dist/css/ninePanel.css";
213
213
  ${s}
214
214
  </style>
215
215
 
@@ -231,7 +231,7 @@ img.ProseMirror-separator {
231
231
  ${n.name}
232
232
  </nine-side-menu-item>`}).join("")});_(this,"expand",()=>{k(this,xn).call(this,"collapse"),document.body.style.width=`calc(100% - ${k(this,zt)}px)`});_(this,"collapse",()=>{k(this,kn).call(this,"collapse"),document.body.style.width=`calc(100% - ${k(this,Bt)}px)`,this.shadowRoot.host.style.width="var(--min-width)",setTimeout(()=>{this.shadowRoot.host.style.width=""},300)});M(this,bn,t=>{const n=this.shadowRoot.querySelector("nine-side-menu-body");return n?n.querySelectorAll(t):[]});M(this,kn,t=>{this.classList.add(t),this.shadowRoot.querySelectorAll("nine-side-menu-item,nine-side-menu-head,nine-side-menu-foot,nine-side-menu-body,nine-side-menu-custom").forEach(n=>{n.classList.add(t)}),k(this,bn).call(this,"nine-side-menu-item").forEach(n=>{n.classList.add(t)})});M(this,xn,t=>{this.classList.remove(t),this.shadowRoot.querySelectorAll("nine-side-menu-item,nine-side-menu-head,nine-side-menu-foot,nine-side-menu-body,nine-side-menu-custom").forEach(n=>{n.classList.remove(t)}),k(this,bn).call(this,"nine-side-menu-item").forEach(n=>{n.classList.remove(t)})});M(this,Cr,()=>{const t=this.innerHTML.trim();this.innerHTML="",L(this,Bt,Number(this.getAttribute("min-width")||48)),L(this,zt,Number(this.getAttribute("max-width")||256));const n=nine.cssPath?`@import "${nine.cssPath}/nineMenu.css";`:"";this.shadowRoot.innerHTML=`
233
233
  <style>
234
- @import "https://cdn.jsdelivr.net/npm/@nine-lab/nine-ux@0.1.266/dist/css/nineMenu.css";
234
+ @import "https://cdn.jsdelivr.net/npm/@nine-lab/nine-ux@0.1.267/dist/css/nineMenu.css";
235
235
  ${n}
236
236
 
237
237
  :host {
@@ -281,7 +281,7 @@ img.ProseMirror-separator {
281
281
  </li>
282
282
  `},customElements.get("nine-side-menu")||customElements.define("nine-side-menu",Ap),customElements.get("nine-side-menu-head")||customElements.define("nine-side-menu-head",Np),customElements.get("nine-side-menu-foot")||customElements.define("nine-side-menu-foot",Dp),customElements.get("nine-side-menu-body")||customElements.define("nine-side-menu-body",Rp),customElements.get("nine-side-menu-item")||customElements.define("nine-side-menu-item",Ip);class Pp extends HTMLElement{constructor(){super();M(this,me,[]);M(this,Mn,[]);M(this,Cn,()=>{let t=document.querySelector("nine-side-menu");t&&(t=t.shadowRoot.querySelector("nine-side-menu-item.active")),k(this,Tn).call(this,t),k(this,En).call(this)});M(this,Tn,t=>{if(L(this,me,[]),t){const n=t.caption||t.title;n&&k(this,me).unshift({path:t.getAttribute("href"),caption:n});let i=t,s=!1;for(;i;)if(i=i.previousElementSibling,i&&i.tagName==="NX-SIDE-MENU-ITEM"){const o=i.caption;if(i.getAttribute("type")==="group"){o&&!s&&(k(this,me).unshift({path:i.getAttribute("href"),caption:o}),s=!0);break}}}this.closest(".list-wrapper")||k(this,me).push({path:"",caption:this.getAttribute("caption")||"Current Page"}),k(this,me).unshift({path:"/",caption:"Home"}),L(this,me,k(this,me).concat(k(this,Mn)))});M(this,En,()=>{let t=document.querySelector("nine-side-menu");t&&(t=t.shadowRoot.querySelector("nine-side-menu-item.active"));const n=t?t.caption:"No Caption";this.innerHTML="",this.shadowRoot.innerHTML="";const i=O.nine.cssPath?`@import "${O.nine.cssPath}/nineNav.css";`:"",s=document.createElement("template");s.innerHTML=`
283
283
  <style>
284
- @import "https://cdn.jsdelivr.net/npm/@nine-lab/nine-ux@0.1.266/dist/css/nineNav.css";
284
+ @import "https://cdn.jsdelivr.net/npm/@nine-lab/nine-ux@0.1.267/dist/css/nineNav.css";
285
285
  ${i}
286
286
  </style>
287
287
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nine-lab/nine-ux",
3
- "version": "0.1.266",
3
+ "version": "0.1.267",
4
4
  "type": "module",
5
5
  "main": "./dist/nine-ux.umd.js",
6
6
  "module": "./dist/nine-ux.js",
@@ -18,14 +18,14 @@
18
18
  "scripts": {
19
19
  "dev": "vite",
20
20
  "build": "vite build && mkdir -p dist/css",
21
- "release": "npm version patch && npm run build && npm publish"
21
+ "release": "npm version patch && npm run build && npm publish --access public"
22
22
  },
23
23
  "peerDependencies": {
24
- "@nine-lab/nine-util": "*",
24
+ "@ninebone/util": "*",
25
25
  "ninegrid2": "^6.1429.0"
26
26
  },
27
27
  "devDependencies": {
28
- "@nine-lab/nine-util": "^0.9.158",
28
+ "@ninebone/util": "^0.9.158",
29
29
  "vite": "^5.4.21"
30
30
  },
31
31
  "dependencies": {