@harbour-enterprises/superdoc 0.12.10 → 0.12.11
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/chunks/{super-editor.es-Bf6kv8E7.cjs → super-editor.es-CmqH_wli.cjs} +3 -3
- package/dist/chunks/{super-editor.es-B4hMBqlj.es.js → super-editor.es-DlmgQ4J3.es.js} +31 -12
- package/dist/super-editor/ai-writer.es.js +2 -2
- package/dist/super-editor/chunks/{converter-lyVGCU64.js → converter-BaK7tyEH.js} +2 -2
- package/dist/super-editor/chunks/{docx-zipper-5A2iHpqR.js → docx-zipper-CSpGjsCF.js} +1 -1
- package/dist/super-editor/chunks/{editor-DugKTpYa.js → editor-D-OAU3KR.js} +31 -12
- package/dist/super-editor/chunks/{toolbar-Dbj1GrW9.js → toolbar-DlRHgwNd.js} +2 -2
- package/dist/super-editor/converter.es.js +1 -1
- package/dist/super-editor/core/Editor.d.ts +16 -0
- package/dist/super-editor/core/Editor.d.ts.map +1 -1
- package/dist/super-editor/core/helpers/annotator.d.ts +1 -1
- package/dist/super-editor/core/helpers/annotator.d.ts.map +1 -1
- package/dist/super-editor/docx-zipper.es.js +2 -2
- package/dist/super-editor/editor.es.js +3 -3
- package/dist/super-editor/file-zipper.es.js +1 -1
- package/dist/super-editor/super-editor.es.js +6 -6
- package/dist/super-editor/toolbar.es.js +2 -2
- package/dist/super-editor.cjs +1 -1
- package/dist/super-editor.es.js +1 -1
- package/dist/superdoc.cjs +2 -2
- package/dist/superdoc.es.js +3 -3
- package/dist/superdoc.umd.js +32 -13
- package/dist/superdoc.umd.js.map +1 -1
- package/package.json +1 -1
|
@@ -27,7 +27,7 @@ Actual: `+$.attribValue);else{var F=$.tag,L=$.tags[$.tags.length-1]||$;F.ns===L.
|
|
|
27
27
|
`)}};ms.empty=new ms(!0);let IC=class{constructor(e,n){this.string=e,this.nodeTypes=n,this.inline=null,this.pos=0,this.tokens=e.split(/\s*(?=\b|\W|$)/),this.tokens[this.tokens.length-1]==""&&this.tokens.pop(),this.tokens[0]==""&&this.tokens.shift()}get next(){return this.tokens[this.pos]}eat(e){return this.next==e&&(this.pos++||!0)}err(e){throw new SyntaxError(e+" (in content expression '"+this.string+"')")}};function Yb(t){let e=[];do e.push(FC(t));while(t.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function FC(t){let e=[];do e.push(RC(t));while(t.next&&t.next!=")"&&t.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function RC(t){let e=PC(t);for(;;)if(t.eat("+"))e={type:"plus",expr:e};else if(t.eat("*"))e={type:"star",expr:e};else if(t.eat("?"))e={type:"opt",expr:e};else if(t.eat("{"))e=BC(t,e);else break;return e}function ug(t){/\D/.test(t.next)&&t.err("Expected number, got '"+t.next+"'");let e=Number(t.next);return t.pos++,e}function BC(t,e){let n=ug(t),r=n;return t.eat(",")&&(t.next!="}"?r=ug(t):r=-1),t.eat("}")||t.err("Unclosed braced range"),{type:"range",min:n,max:r,expr:e}}function LC(t,e){let n=t.nodeTypes,r=n[e];if(r)return[r];let o=[];for(let i in n){let s=n[i];s.isInGroup(e)&&o.push(s)}return o.length==0&&t.err("No node type or group '"+e+"' found"),o}function PC(t){if(t.eat("(")){let e=Yb(t);return t.eat(")")||t.err("Missing closing paren"),e}else if(/\W/.test(t.next))t.err("Unexpected token '"+t.next+"'");else{let e=LC(t,t.next).map(n=>(t.inline==null?t.inline=n.isInline:t.inline!=n.isInline&&t.err("Mixing inline and block content"),{type:"name",value:n}));return t.pos++,e.length==1?e[0]:{type:"choice",exprs:e}}}function zC(t){let e=[[]];return o(i(t,0),n()),e;function n(){return e.push([])-1}function r(s,a,l){let c={term:l,to:a};return e[s].push(c),c}function o(s,a){s.forEach(l=>l.to=a)}function i(s,a){if(s.type=="choice")return s.exprs.reduce((l,c)=>l.concat(i(c,a)),[]);if(s.type=="seq")for(let l=0;;l++){let c=i(s.exprs[l],a);if(l==s.exprs.length-1)return c;o(c,a=n())}else if(s.type=="star"){let l=n();return r(a,l),o(i(s.expr,l),l),[r(l)]}else if(s.type=="plus"){let l=n();return o(i(s.expr,a),l),o(i(s.expr,l),l),[r(l)]}else{if(s.type=="opt")return[r(a)].concat(i(s.expr,a));if(s.type=="range"){let l=a;for(let c=0;c<s.min;c++){let u=n();o(i(s.expr,l),u),l=u}if(s.max==-1)o(i(s.expr,l),l);else for(let c=s.min;c<s.max;c++){let u=n();r(l,u),o(i(s.expr,l),u),l=u}return[r(l)]}else{if(s.type=="name")return[r(a,void 0,s.value)];throw new Error("Unknown expr type")}}}}function Zb(t,e){return e-t}function dg(t,e){let n=[];return r(e),n.sort(Zb);function r(o){let i=t[o];if(i.length==1&&!i[0].term)return r(i[0].to);n.push(o);for(let s=0;s<i.length;s++){let{term:a,to:l}=i[s];!a&&n.indexOf(l)==-1&&r(l)}}}function jC(t){let e=Object.create(null);return n(dg(t,0));function n(r){let o=[];r.forEach(s=>{t[s].forEach(({term:a,to:l})=>{if(!a)return;let c;for(let u=0;u<o.length;u++)o[u][0]==a&&(c=o[u][1]);dg(t,l).forEach(u=>{c||o.push([a,c=[]]),c.indexOf(u)==-1&&c.push(u)})})});let i=e[r.join(",")]=new ms(r.indexOf(t.length-1)>-1);for(let s=0;s<o.length;s++){let a=o[s][1].sort(Zb);i.next.push({type:o[s][0],next:e[a.join(",")]||n(a)})}return i}}function qC(t,e){for(let n=0,r=[t];n<r.length;n++){let o=r[n],i=!o.validEnd,s=[];for(let a=0;a<o.next.length;a++){let{type:l,next:c}=o.next[a];s.push(l.name),i&&!(l.isText||l.hasRequiredAttrs())&&(i=!1),r.indexOf(c)==-1&&r.push(c)}i&&e.err("Only non-generatable nodes ("+s.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}function Qb(t){let e=Object.create(null);for(let n in t){let r=t[n];if(!r.hasDefault)return null;e[n]=r.default}return e}function ev(t,e){let n=Object.create(null);for(let r in t){let o=e&&e[r];if(o===void 0){let i=t[r];if(i.hasDefault)o=i.default;else throw new RangeError("No value supplied for attribute "+r)}n[r]=o}return n}function tv(t,e,n,r){for(let o in e)if(!(o in t))throw new RangeError(`Unsupported attribute ${o} for ${n} of type ${o}`);for(let o in t){let i=t[o];i.validate&&i.validate(e[o])}}function nv(t,e){let n=Object.create(null);if(e)for(let r in e)n[r]=new UC(t,r,e[r]);return n}let pg=class rv{constructor(e,n,r){this.name=e,this.schema=n,this.spec=r,this.markSet=null,this.groups=r.group?r.group.split(" "):[],this.attrs=nv(e,r.attrs),this.defaultAttrs=Qb(this.attrs),this.contentMatch=null,this.inlineContent=null,this.isBlock=!(r.inline||e=="text"),this.isText=e=="text"}get isInline(){return!this.isBlock}get isTextblock(){return this.isBlock&&this.inlineContent}get isLeaf(){return this.contentMatch==ms.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:ev(this.attrs,e)}create(e=null,n,r){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new so(this,this.computeAttrs(e),ye.from(n),Xe.setFrom(r))}createChecked(e=null,n,r){return n=ye.from(n),this.checkContent(n),new so(this,this.computeAttrs(e),n,Xe.setFrom(r))}createAndFill(e=null,n,r){if(e=this.computeAttrs(e),n=ye.from(n),n.size){let s=this.contentMatch.fillBefore(n);if(!s)return null;n=s.append(n)}let o=this.contentMatch.matchFragment(n),i=o&&o.fillBefore(ye.empty,!0);return i?new so(this,e,n.append(i),Xe.setFrom(r)):null}validContent(e){let n=this.contentMatch.matchFragment(e);if(!n||!n.validEnd)return!1;for(let r=0;r<e.childCount;r++)if(!this.allowsMarks(e.child(r).marks))return!1;return!0}checkContent(e){if(!this.validContent(e))throw new RangeError(`Invalid content for node ${this.name}: ${e.toString().slice(0,50)}`)}checkAttrs(e){tv(this.attrs,e,"node",this.name)}allowsMarkType(e){return this.markSet==null||this.markSet.indexOf(e)>-1}allowsMarks(e){if(this.markSet==null)return!0;for(let n=0;n<e.length;n++)if(!this.allowsMarkType(e[n].type))return!1;return!0}allowedMarks(e){if(this.markSet==null)return e;let n;for(let r=0;r<e.length;r++)this.allowsMarkType(e[r].type)?n&&n.push(e[r]):n||(n=e.slice(0,r));return n?n.length?n:Xe.none:e}static compile(e,n){let r=Object.create(null);e.forEach((i,s)=>r[i]=new rv(i,n,s));let o=n.spec.topNode||"doc";if(!r[o])throw new RangeError("Schema is missing its top node type ('"+o+"')");if(!r.text)throw new RangeError("Every schema needs a 'text' type");for(let i in r.text.attrs)throw new RangeError("The text node type should not have attributes");return r}};function VC(t,e,n){let r=n.split("|");return o=>{let i=o===null?"null":typeof o;if(r.indexOf(i)<0)throw new RangeError(`Expected value of type ${r} for attribute ${e} on type ${t}, got ${i}`)}}let UC=class{constructor(e,n,r){this.hasDefault=Object.prototype.hasOwnProperty.call(r,"default"),this.default=r.default,this.validate=typeof r.validate=="string"?VC(e,n,r.validate):r.validate}get isRequired(){return!this.hasDefault}},ov=class iv{constructor(e,n,r,o){this.name=e,this.rank=n,this.schema=r,this.spec=o,this.attrs=nv(e,o.attrs),this.excluded=null;let i=Qb(this.attrs);this.instance=i?new Xe(this,i):null}create(e=null){return!e&&this.instance?this.instance:new Xe(this,ev(this.attrs,e))}static compile(e,n){let r=Object.create(null),o=0;return e.forEach((i,s)=>r[i]=new iv(i,o++,n,s)),r}removeFromSet(e){for(var n=0;n<e.length;n++)e[n].type==this&&(e=e.slice(0,n).concat(e.slice(n+1)),n--);return e}isInSet(e){for(let n=0;n<e.length;n++)if(e[n].type==this)return e[n]}checkAttrs(e){tv(this.attrs,e,"mark",this.name)}excludes(e){return this.excluded.indexOf(e)>-1}},sv=class{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let n=this.spec={};for(let o in e)n[o]=e[o];n.nodes=St.from(e.nodes),n.marks=St.from(e.marks||{}),this.nodes=pg.compile(this.spec.nodes,this),this.marks=ov.compile(this.spec.marks,this);let r=Object.create(null);for(let o in this.nodes){if(o in this.marks)throw new RangeError(o+" can not be both a node and a mark");let i=this.nodes[o],s=i.spec.content||"",a=i.spec.marks;if(i.contentMatch=r[s]||(r[s]=ms.parse(s,this.nodes)),i.inlineContent=i.contentMatch.inlineContent,i.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!i.isInline||!i.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=i}i.markSet=a=="_"?null:a?fg(this,a.split(" ")):a==""||!i.inlineContent?[]:null}for(let o in this.marks){let i=this.marks[o],s=i.spec.excludes;i.excluded=s==null?[i]:s==""?[]:fg(this,s.split(" "))}this.nodeFromJSON=this.nodeFromJSON.bind(this),this.markFromJSON=this.markFromJSON.bind(this),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(e,n=null,r,o){if(typeof e=="string")e=this.nodeType(e);else if(e instanceof pg){if(e.schema!=this)throw new RangeError("Node type from different schema used ("+e.name+")")}else throw new RangeError("Invalid node type: "+e);return e.createChecked(n,r,o)}text(e,n){let r=this.nodes.text;return new NC(r,r.defaultAttrs,e,Xe.setFrom(n))}mark(e,n){return typeof e=="string"&&(e=this.marks[e]),e.create(n)}nodeFromJSON(e){return so.fromJSON(this,e)}markFromJSON(e){return Xe.fromJSON(this,e)}nodeType(e){let n=this.nodes[e];if(!n)throw new RangeError("Unknown node type: "+e);return n}};function fg(t,e){let n=[];for(let r=0;r<e.length;r++){let o=e[r],i=t.marks[o],s=i;if(i)n.push(i);else for(let a in t.marks){let l=t.marks[a];(o=="_"||l.spec.group&&l.spec.group.split(" ").indexOf(o)>-1)&&n.push(s=l)}if(!s)throw new SyntaxError("Unknown mark type: '"+e[r]+"'")}return n}function HC(t){return t.tag!=null}function WC(t){return t.style!=null}let er=class Ed{constructor(e,n){this.schema=e,this.rules=n,this.tags=[],this.styles=[];let r=this.matchedStyles=[];n.forEach(o=>{if(HC(o))this.tags.push(o);else if(WC(o)){let i=/[^=]*/.exec(o.style)[0];r.indexOf(i)<0&&r.push(i),this.styles.push(o)}}),this.normalizeLists=!this.tags.some(o=>{if(!/^(ul|ol)\b/.test(o.tag)||!o.node)return!1;let i=e.nodes[o.node];return i.contentMatch.matchType(i)})}parse(e,n={}){let r=new mg(this,n,!1);return r.addAll(e,Xe.none,n.from,n.to),r.finish()}parseSlice(e,n={}){let r=new mg(this,n,!0);return r.addAll(e,Xe.none,n.from,n.to),ve.maxOpen(r.finish())}matchTag(e,n,r){for(let o=r?this.tags.indexOf(r)+1:0;o<this.tags.length;o++){let i=this.tags[o];if(JC(e,i.tag)&&(i.namespace===void 0||e.namespaceURI==i.namespace)&&(!i.context||n.matchesContext(i.context))){if(i.getAttrs){let s=i.getAttrs(e);if(s===!1)continue;i.attrs=s||void 0}return i}}}matchStyle(e,n,r,o){for(let i=o?this.styles.indexOf(o)+1:0;i<this.styles.length;i++){let s=this.styles[i],a=s.style;if(!(a.indexOf(e)!=0||s.context&&!r.matchesContext(s.context)||a.length>e.length&&(a.charCodeAt(e.length)!=61||a.slice(e.length+1)!=n))){if(s.getAttrs){let l=s.getAttrs(n);if(l===!1)continue;s.attrs=l||void 0}return s}}}static schemaRules(e){let n=[];function r(o){let i=o.priority==null?50:o.priority,s=0;for(;s<n.length;s++){let a=n[s];if((a.priority==null?50:a.priority)<i)break}n.splice(s,0,o)}for(let o in e.marks){let i=e.marks[o].spec.parseDOM;i&&i.forEach(s=>{r(s=gg(s)),s.mark||s.ignore||s.clearMark||(s.mark=o)})}for(let o in e.nodes){let i=e.nodes[o].spec.parseDOM;i&&i.forEach(s=>{r(s=gg(s)),s.node||s.ignore||s.mark||(s.node=o)})}return n}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new Ed(e,Ed.schemaRules(e)))}};const av={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},GC={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},lv={ol:!0,ul:!0},gs=1,Td=2,Ra=4;function hg(t,e,n){return e!=null?(e?gs:0)|(e==="full"?Td:0):t&&t.whitespace=="pre"?gs|Td:n&-5}let ia=class{constructor(e,n,r,o,i,s){this.type=e,this.attrs=n,this.marks=r,this.solid=o,this.options=s,this.content=[],this.activeMarks=Xe.none,this.match=i||(s&Ra?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let n=this.type.contentMatch.fillBefore(ye.from(e));if(n)this.match=this.type.contentMatch.matchFragment(n);else{let r=this.type.contentMatch,o;return(o=r.findWrapping(e.type))?(this.match=r,o):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&gs)){let r=this.content[this.content.length-1],o;if(r&&r.isText&&(o=/[ \t\r\n\u000c]+$/.exec(r.text))){let i=r;r.text.length==o[0].length?this.content.pop():this.content[this.content.length-1]=i.withText(i.text.slice(0,i.text.length-o[0].length))}}let n=ye.from(this.content);return!e&&this.match&&(n=n.append(this.match.fillBefore(ye.empty,!0))),this.type?this.type.create(this.attrs,n,this.marks):n}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!av.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}},mg=class{constructor(e,n,r){this.parser=e,this.options=n,this.isOpen=r,this.open=0,this.localPreserveWS=!1;let o=n.topNode,i,s=hg(null,n.preserveWhitespace,0)|(r?Ra:0);o?i=new ia(o.type,o.attrs,Xe.none,!0,n.topMatch||o.type.contentMatch,s):r?i=new ia(null,null,Xe.none,!0,null,s):i=new ia(e.schema.topNodeType,null,Xe.none,!0,null,s),this.nodes=[i],this.find=n.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e,n){e.nodeType==3?this.addTextNode(e,n):e.nodeType==1&&this.addElement(e,n)}addTextNode(e,n){let r=e.nodeValue,o=this.top,i=o.options&Td?"full":this.localPreserveWS||(o.options&gs)>0;if(i==="full"||o.inlineContext(e)||/[^ \t\r\n\u000c]/.test(r)){if(i)i!=="full"?r=r.replace(/\r?\n|\r/g," "):r=r.replace(/\r\n?/g,`
|
|
28
28
|
`);else if(r=r.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(r)&&this.open==this.nodes.length-1){let s=o.content[o.content.length-1],a=e.previousSibling;(!s||a&&a.nodeName=="BR"||s.isText&&/[ \t\r\n\u000c]$/.test(s.text))&&(r=r.slice(1))}r&&this.insertNode(this.parser.schema.text(r),n,!/\S/.test(r)),this.findInText(e)}else this.findInside(e)}addElement(e,n,r){let o=this.localPreserveWS,i=this.top;(e.tagName=="PRE"||/pre/.test(e.style&&e.style.whiteSpace))&&(this.localPreserveWS=!0);let s=e.nodeName.toLowerCase(),a;lv.hasOwnProperty(s)&&this.parser.normalizeLists&&KC(e);let l=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(a=this.parser.matchTag(e,this,r));e:if(l?l.ignore:GC.hasOwnProperty(s))this.findInside(e),this.ignoreFallback(e,n);else if(!l||l.skip||l.closeParent){l&&l.closeParent?this.open=Math.max(0,this.open-1):l&&l.skip.nodeType&&(e=l.skip);let c,u=this.needsBlock;if(av.hasOwnProperty(s))i.content.length&&i.content[0].isInline&&this.open&&(this.open--,i=this.top),c=!0,i.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e,n);break e}let d=l&&l.skip?n:this.readStyles(e,n);d&&this.addAll(e,d),c&&this.sync(i),this.needsBlock=u}else{let c=this.readStyles(e,n);c&&this.addElementByRule(e,l,c,l.consuming===!1?a:void 0)}this.localPreserveWS=o}leafFallback(e,n){e.nodeName=="BR"&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode(`
|
|
29
29
|
`),n)}ignoreFallback(e,n){e.nodeName=="BR"&&(!this.top.type||!this.top.type.inlineContent)&&this.findPlace(this.parser.schema.text("-"),n,!0)}readStyles(e,n){let r=e.style;if(r&&r.length)for(let o=0;o<this.parser.matchedStyles.length;o++){let i=this.parser.matchedStyles[o],s=r.getPropertyValue(i);if(s)for(let a=void 0;;){let l=this.parser.matchStyle(i,s,this,a);if(!l)break;if(l.ignore)return null;if(l.clearMark?n=n.filter(c=>!l.clearMark(c)):n=n.concat(this.parser.schema.marks[l.mark].create(l.attrs)),l.consuming===!1)a=l;else break}}return n}addElementByRule(e,n,r,o){let i,s;if(n.node)if(s=this.parser.schema.nodes[n.node],s.isLeaf)this.insertNode(s.create(n.attrs),r,e.nodeName=="BR")||this.leafFallback(e,r);else{let l=this.enter(s,n.attrs||null,r,n.preserveWhitespace);l&&(i=!0,r=l)}else{let l=this.parser.schema.marks[n.mark];r=r.concat(l.create(n.attrs))}let a=this.top;if(s&&s.isLeaf)this.findInside(e);else if(o)this.addElement(e,r,o);else if(n.getContent)this.findInside(e),n.getContent(e,this.parser.schema).forEach(l=>this.insertNode(l,r,!1));else{let l=e;typeof n.contentElement=="string"?l=e.querySelector(n.contentElement):typeof n.contentElement=="function"?l=n.contentElement(e):n.contentElement&&(l=n.contentElement),this.findAround(e,l,!0),this.addAll(l,r),this.findAround(e,l,!1)}i&&this.sync(a)&&this.open--}addAll(e,n,r,o){let i=r||0;for(let s=r?e.childNodes[r]:e.firstChild,a=o==null?null:e.childNodes[o];s!=a;s=s.nextSibling,++i)this.findAtPoint(e,i),this.addDOM(s,n);this.findAtPoint(e,i)}findPlace(e,n,r){let o,i;for(let s=this.open,a=0;s>=0;s--){let l=this.nodes[s],c=l.findWrapping(e);if(c&&(!o||o.length>c.length+a)&&(o=c,i=l,!c.length))break;if(l.solid){if(r)break;a+=2}}if(!o)return null;this.sync(i);for(let s=0;s<o.length;s++)n=this.enterInner(o[s],null,n,!1);return n}insertNode(e,n,r){if(e.isInline&&this.needsBlock&&!this.top.type){let i=this.textblockFromContext();i&&(n=this.enterInner(i,null,n))}let o=this.findPlace(e,n,r);if(o){this.closeExtra();let i=this.top;i.match&&(i.match=i.match.matchType(e.type));let s=Xe.none;for(let a of o.concat(e.marks))(i.type?i.type.allowsMarkType(a.type):yg(a.type,e.type))&&(s=a.addToSet(s));return i.content.push(e.mark(s)),!0}return!1}enter(e,n,r,o){let i=this.findPlace(e.create(n),r,!1);return i&&(i=this.enterInner(e,n,r,!0,o)),i}enterInner(e,n,r,o=!1,i){this.closeExtra();let s=this.top;s.match=s.match&&s.match.matchType(e);let a=hg(e,i,s.options);s.options&Ra&&s.content.length==0&&(a|=Ra);let l=Xe.none;return r=r.filter(c=>(s.type?s.type.allowsMarkType(c.type):yg(c.type,e))?(l=c.addToSet(l),!1):!0),this.nodes.push(new ia(e,n,l,o,null,a)),this.open++,r}closeExtra(e=!1){let n=this.nodes.length-1;if(n>this.open){for(;n>this.open;n--)this.nodes[n-1].content.push(this.nodes[n].finish(e));this.nodes.length=this.open+1}}finish(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(!!(this.isOpen||this.options.topOpen))}sync(e){for(let n=this.open;n>=0;n--){if(this.nodes[n]==e)return this.open=n,!0;this.localPreserveWS&&(this.nodes[n].options|=gs)}return!1}get currentPos(){this.closeExtra();let e=0;for(let n=this.open;n>=0;n--){let r=this.nodes[n].content;for(let o=r.length-1;o>=0;o--)e+=r[o].nodeSize;n&&e++}return e}findAtPoint(e,n){if(this.find)for(let r=0;r<this.find.length;r++)this.find[r].node==e&&this.find[r].offset==n&&(this.find[r].pos=this.currentPos)}findInside(e){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].pos==null&&e.nodeType==1&&e.contains(this.find[n].node)&&(this.find[n].pos=this.currentPos)}findAround(e,n,r){if(e!=n&&this.find)for(let o=0;o<this.find.length;o++)this.find[o].pos==null&&e.nodeType==1&&e.contains(this.find[o].node)&&n.compareDocumentPosition(this.find[o].node)&(r?2:4)&&(this.find[o].pos=this.currentPos)}findInText(e){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].node==e&&(this.find[n].pos=this.currentPos-(e.nodeValue.length-this.find[n].offset))}matchesContext(e){if(e.indexOf("|")>-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let n=e.split("/"),r=this.options.context,o=!this.isOpen&&(!r||r.parent.type==this.nodes[0].type),i=-(r?r.depth+1:0)+(o?0:1),s=(a,l)=>{for(;a>=0;a--){let c=n[a];if(c==""){if(a==n.length-1||a==0)continue;for(;l>=i;l--)if(s(a-1,l))return!0;return!1}else{let u=l>0||l==0&&o?this.nodes[l].type:r&&l>=i?r.node(l-i).type:null;if(!u||u.name!=c&&!u.isInGroup(c))return!1;l--}}return!0};return s(n.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let n=e.depth;n>=0;n--){let r=e.node(n).contentMatchAt(e.indexAfter(n)).defaultType;if(r&&r.isTextblock&&r.defaultAttrs)return r}for(let n in this.parser.schema.nodes){let r=this.parser.schema.nodes[n];if(r.isTextblock&&r.defaultAttrs)return r}}};function KC(t){for(let e=t.firstChild,n=null;e;e=e.nextSibling){let r=e.nodeType==1?e.nodeName.toLowerCase():null;r&&lv.hasOwnProperty(r)&&n?(n.appendChild(e),e=n):r=="li"?n=e:r&&(n=null)}}function JC(t,e){return(t.matches||t.msMatchesSelector||t.webkitMatchesSelector||t.mozMatchesSelector).call(t,e)}function gg(t){let e={};for(let n in t)e[n]=t[n];return e}function yg(t,e){let n=e.schema.nodes;for(let r in n){let o=n[r];if(!o.allowsMarkType(t))continue;let i=[],s=a=>{i.push(a);for(let l=0;l<a.edgeCount;l++){let{type:c,next:u}=a.edge(l);if(c==e||i.indexOf(u)<0&&s(u))return!0}};if(s(o.contentMatch))return!0}}let xi=class cv{constructor(e,n){this.nodes=e,this.marks=n}serializeFragment(e,n={},r){r||(r=yu(n).createDocumentFragment());let o=r,i=[];return e.forEach(s=>{if(i.length||s.marks.length){let a=0,l=0;for(;a<i.length&&l<s.marks.length;){let c=s.marks[l];if(!this.marks[c.type.name]){l++;continue}if(!c.eq(i[a][0])||c.type.spec.spanning===!1)break;a++,l++}for(;a<i.length;)o=i.pop()[1];for(;l<s.marks.length;){let c=s.marks[l++],u=this.serializeMark(c,s.isInline,n);u&&(i.push([c,o]),o.appendChild(u.dom),o=u.contentDOM||u.dom)}}o.appendChild(this.serializeNodeInner(s,n))}),r}serializeNodeInner(e,n){let{dom:r,contentDOM:o}=Ba(yu(n),this.nodes[e.type.name](e),null,e.attrs);if(o){if(e.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(e.content,n,o)}return r}serializeNode(e,n={}){let r=this.serializeNodeInner(e,n);for(let o=e.marks.length-1;o>=0;o--){let i=this.serializeMark(e.marks[o],e.isInline,n);i&&((i.contentDOM||i.dom).appendChild(r),r=i.dom)}return r}serializeMark(e,n,r={}){let o=this.marks[e.type.name];return o&&Ba(yu(r),o(e,n),null,e.attrs)}static renderSpec(e,n,r=null,o){return Ba(e,n,r,o)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new cv(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let n=wg(e.nodes);return n.text||(n.text=r=>r.text),n}static marksFromSchema(e){return wg(e.marks)}};function wg(t){let e={};for(let n in t){let r=t[n].spec.toDOM;r&&(e[n]=r)}return e}function yu(t){return t.document||window.document}const bg=new WeakMap;function XC(t){let e=bg.get(t);return e===void 0&&bg.set(t,e=YC(t)),e}function YC(t){let e=null;function n(r){if(r&&typeof r=="object")if(Array.isArray(r))if(typeof r[0]=="string")e||(e=[]),e.push(r);else for(let o=0;o<r.length;o++)n(r[o]);else for(let o in r)n(r[o])}return n(t),e}function Ba(t,e,n,r){if(typeof e=="string")return{dom:t.createTextNode(e)};if(e.nodeType!=null)return{dom:e};if(e.dom&&e.dom.nodeType!=null)return e;let o=e[0],i;if(typeof o!="string")throw new RangeError("Invalid array passed to renderSpec");if(r&&(i=XC(r))&&i.indexOf(e)>-1)throw new RangeError("Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.");let s=o.indexOf(" ");s>0&&(n=o.slice(0,s),o=o.slice(s+1));let a,l=n?t.createElementNS(n,o):t.createElement(o),c=e[1],u=1;if(c&&typeof c=="object"&&c.nodeType==null&&!Array.isArray(c)){u=2;for(let d in c)if(c[d]!=null){let p=d.indexOf(" ");p>0?l.setAttributeNS(d.slice(0,p),d.slice(p+1),c[d]):l.setAttribute(d,c[d])}}for(let d=u;d<e.length;d++){let p=e[d];if(p===0){if(d<e.length-1||d>u)throw new RangeError("Content hole must be the only child of its parent node");return{dom:l,contentDOM:l}}else{let{dom:f,contentDOM:h}=Ba(t,p,n,r);if(l.appendChild(f),h){if(a)throw new RangeError("Multiple content holes");a=h}}}return{dom:l,contentDOM:a}}const uv=65535,dv=Math.pow(2,16);function ZC(t,e){return t+e*dv}function vg(t){return t&uv}function QC(t){return(t-(t&uv))/dv}const pv=1,fv=2,La=4,hv=8;let $d=class{constructor(e,n,r){this.pos=e,this.delInfo=n,this.recover=r}get deleted(){return(this.delInfo&hv)>0}get deletedBefore(){return(this.delInfo&(pv|La))>0}get deletedAfter(){return(this.delInfo&(fv|La))>0}get deletedAcross(){return(this.delInfo&La)>0}},mo=class Bo{constructor(e,n=!1){if(this.ranges=e,this.inverted=n,!e.length&&Bo.empty)return Bo.empty}recover(e){let n=0,r=vg(e);if(!this.inverted)for(let o=0;o<r;o++)n+=this.ranges[o*3+2]-this.ranges[o*3+1];return this.ranges[r*3]+n+QC(e)}mapResult(e,n=1){return this._map(e,n,!1)}map(e,n=1){return this._map(e,n,!0)}_map(e,n,r){let o=0,i=this.inverted?2:1,s=this.inverted?1:2;for(let a=0;a<this.ranges.length;a+=3){let l=this.ranges[a]-(this.inverted?o:0);if(l>e)break;let c=this.ranges[a+i],u=this.ranges[a+s],d=l+c;if(e<=d){let p=c?e==l?-1:e==d?1:n:n,f=l+o+(p<0?0:u);if(r)return f;let h=e==(n<0?l:d)?null:ZC(a/3,e-l),m=e==l?fv:e==d?pv:La;return(n<0?e!=l:e!=d)&&(m|=hv),new $d(f,m,h)}o+=u-c}return r?e+o:new $d(e+o,0,null)}touches(e,n){let r=0,o=vg(n),i=this.inverted?2:1,s=this.inverted?1:2;for(let a=0;a<this.ranges.length;a+=3){let l=this.ranges[a]-(this.inverted?r:0);if(l>e)break;let c=this.ranges[a+i],u=l+c;if(e<=u&&a==o*3)return!0;r+=this.ranges[a+s]-c}return!1}forEach(e){let n=this.inverted?2:1,r=this.inverted?1:2;for(let o=0,i=0;o<this.ranges.length;o+=3){let s=this.ranges[o],a=s-(this.inverted?i:0),l=s+(this.inverted?0:i),c=this.ranges[o+n],u=this.ranges[o+r];e(a,a+c,l,l+u),i+=u-c}}invert(){return new Bo(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?Bo.empty:new Bo(e<0?[0,-e,0]:[0,0,e])}};mo.empty=new mo([]);let ni=class Od{constructor(e,n,r=0,o=e?e.length:0){this.mirror=n,this.from=r,this.to=o,this._maps=e||[],this.ownData=!(e||n)}get maps(){return this._maps}slice(e=0,n=this.maps.length){return new Od(this._maps,this.mirror,e,n)}appendMap(e,n){this.ownData||(this._maps=this._maps.slice(),this.mirror=this.mirror&&this.mirror.slice(),this.ownData=!0),this.to=this._maps.push(e),n!=null&&this.setMirror(this._maps.length-1,n)}appendMapping(e){for(let n=0,r=this._maps.length;n<e._maps.length;n++){let o=e.getMirror(n);this.appendMap(e._maps[n],o!=null&&o<n?r+o:void 0)}}getMirror(e){if(this.mirror){for(let n=0;n<this.mirror.length;n++)if(this.mirror[n]==e)return this.mirror[n+(n%2?-1:1)]}}setMirror(e,n){this.mirror||(this.mirror=[]),this.mirror.push(e,n)}appendMappingInverted(e){for(let n=e.maps.length-1,r=this._maps.length+e._maps.length;n>=0;n--){let o=e.getMirror(n);this.appendMap(e._maps[n].invert(),o!=null&&o>n?r-o-1:void 0)}}invert(){let e=new Od;return e.appendMappingInverted(this),e}map(e,n=1){if(this.mirror)return this._map(e,n,!0);for(let r=this.from;r<this.to;r++)e=this._maps[r].map(e,n);return e}mapResult(e,n=1){return this._map(e,n,!1)}_map(e,n,r){let o=0;for(let i=this.from;i<this.to;i++){let s=this._maps[i],a=s.mapResult(e,n);if(a.recover!=null){let l=this.getMirror(i);if(l!=null&&l>i&&l<this.to){i=l,e=this._maps[l].recover(a.recover);continue}}o|=a.delInfo,e=a.pos}return r?e:new $d(e,o,null)}};const wu=Object.create(null);let Rt=class{getMap(){return mo.empty}merge(e){return null}static fromJSON(e,n){if(!n||!n.stepType)throw new RangeError("Invalid input for Step.fromJSON");let r=wu[n.stepType];if(!r)throw new RangeError(`No step type ${n.stepType} defined`);return r.fromJSON(e,n)}static jsonID(e,n){if(e in wu)throw new RangeError("Duplicate use of step JSON ID "+e);return wu[e]=n,n.prototype.jsonID=e,n}},jt=class Ii{constructor(e,n){this.doc=e,this.failed=n}static ok(e){return new Ii(e,null)}static fail(e){return new Ii(null,e)}static fromReplace(e,n,r,o){try{return Ii.ok(e.replace(n,r,o))}catch(i){if(i instanceof al)return Ii.fail(i.message);throw i}}};function rf(t,e,n){let r=[];for(let o=0;o<t.childCount;o++){let i=t.child(o);i.content.size&&(i=i.copy(rf(i.content,e,i))),i.isInline&&(i=e(i,n,o)),r.push(i)}return ye.fromArray(r)}let Vs=class Fi extends Rt{constructor(e,n,r){super(),this.from=e,this.to=n,this.mark=r}apply(e){let n=e.slice(this.from,this.to),r=e.resolve(this.from),o=r.node(r.sharedDepth(this.to)),i=new ve(rf(n.content,(s,a)=>!s.isAtom||!a.type.allowsMarkType(this.mark.type)?s:s.mark(this.mark.addToSet(s.marks)),o),n.openStart,n.openEnd);return jt.fromReplace(e,this.from,this.to,i)}invert(){return new vn(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new Fi(n.pos,r.pos,this.mark)}merge(e){return e instanceof Fi&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Fi(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new Fi(n.from,n.to,e.markFromJSON(n.mark))}};Rt.jsonID("addMark",Vs);let vn=class Ri extends Rt{constructor(e,n,r){super(),this.from=e,this.to=n,this.mark=r}apply(e){let n=e.slice(this.from,this.to),r=new ve(rf(n.content,o=>o.mark(this.mark.removeFromSet(o.marks)),e),n.openStart,n.openEnd);return jt.fromReplace(e,this.from,this.to,r)}invert(){return new Vs(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new Ri(n.pos,r.pos,this.mark)}merge(e){return e instanceof Ri&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Ri(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new Ri(n.from,n.to,e.markFromJSON(n.mark))}};Rt.jsonID("removeMark",vn);let of=class Bi extends Rt{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return jt.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.addToSet(n.marks));return jt.fromReplace(e,this.pos,this.pos+1,new ve(ye.from(r),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);if(n){let r=this.mark.addToSet(n.marks);if(r.length==n.marks.length){for(let o=0;o<n.marks.length;o++)if(!n.marks[o].isInSet(r))return new Bi(this.pos,n.marks[o]);return new Bi(this.pos,this.mark)}}return new ul(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new Bi(n.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new Bi(n.pos,e.markFromJSON(n.mark))}};Rt.jsonID("addNodeMark",of);let ul=class Md extends Rt{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return jt.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.removeFromSet(n.marks));return jt.fromReplace(e,this.pos,this.pos+1,new ve(ye.from(r),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);return!n||!this.mark.isInSet(n.marks)?this:new of(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new Md(n.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new Md(n.pos,e.markFromJSON(n.mark))}};Rt.jsonID("removeNodeMark",ul);let Tt=class Hr extends Rt{constructor(e,n,r,o=!1){super(),this.from=e,this.to=n,this.slice=r,this.structure=o}apply(e){return this.structure&&Dd(e,this.from,this.to)?jt.fail("Structure replace would overwrite content"):jt.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new mo([this.from,this.to-this.from,this.slice.size])}invert(e){return new Hr(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deletedAcross&&r.deletedAcross?null:new Hr(n.pos,Math.max(n.pos,r.pos),this.slice,this.structure)}merge(e){if(!(e instanceof Hr)||e.structure||this.structure)return null;if(this.from+this.slice.size==e.from&&!this.slice.openEnd&&!e.slice.openStart){let n=this.slice.size+e.slice.size==0?ve.empty:new ve(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new Hr(this.from,this.to+(e.to-e.from),n,this.structure)}else if(e.to==this.from&&!this.slice.openStart&&!e.slice.openEnd){let n=this.slice.size+e.slice.size==0?ve.empty:new ve(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new Hr(e.from,this.to,n,this.structure)}else return null}toJSON(){let e={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new Hr(n.from,n.to,ve.fromJSON(e,n.slice),!!n.structure)}};Rt.jsonID("replace",Tt);let Zt=class Pa extends Rt{constructor(e,n,r,o,i,s,a=!1){super(),this.from=e,this.to=n,this.gapFrom=r,this.gapTo=o,this.slice=i,this.insert=s,this.structure=a}apply(e){if(this.structure&&(Dd(e,this.from,this.gapFrom)||Dd(e,this.gapTo,this.to)))return jt.fail("Structure gap-replace would overwrite content");let n=e.slice(this.gapFrom,this.gapTo);if(n.openStart||n.openEnd)return jt.fail("Gap is not a flat range");let r=this.slice.insertAt(this.insert,n.content);return r?jt.fromReplace(e,this.from,this.to,r):jt.fail("Content does not fit in gap")}getMap(){return new mo([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(e){let n=this.gapTo-this.gapFrom;return new Pa(this.from,this.from+this.slice.size+n,this.from+this.insert,this.from+this.insert+n,e.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1),o=this.from==this.gapFrom?n.pos:e.map(this.gapFrom,-1),i=this.to==this.gapTo?r.pos:e.map(this.gapTo,1);return n.deletedAcross&&r.deletedAcross||o<n.pos||i>r.pos?null:new Pa(n.pos,r.pos,o,i,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number"||typeof n.gapFrom!="number"||typeof n.gapTo!="number"||typeof n.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new Pa(n.from,n.to,n.gapFrom,n.gapTo,ve.fromJSON(e,n.slice),n.insert,!!n.structure)}};Rt.jsonID("replaceAround",Zt);function Dd(t,e,n){let r=t.resolve(e),o=n-e,i=r.depth;for(;o>0&&i>0&&r.indexAfter(i)==r.node(i).childCount;)i--,o--;if(o>0){let s=r.node(i).maybeChild(r.indexAfter(i));for(;o>0;){if(!s||s.isLeaf)return!0;s=s.firstChild,o--}}return!1}function eE(t,e,n,r){let o=[],i=[],s,a;t.doc.nodesBetween(e,n,(l,c,u)=>{if(!l.isInline)return;let d=l.marks;if(!r.isInSet(d)&&u.type.allowsMarkType(r.type)){let p=Math.max(c,e),f=Math.min(c+l.nodeSize,n),h=r.addToSet(d);for(let m=0;m<d.length;m++)d[m].isInSet(h)||(s&&s.to==p&&s.mark.eq(d[m])?s.to=f:o.push(s=new vn(p,f,d[m])));a&&a.to==p?a.to=f:i.push(a=new Vs(p,f,r))}}),o.forEach(l=>t.step(l)),i.forEach(l=>t.step(l))}function tE(t,e,n,r){let o=[],i=0;t.doc.nodesBetween(e,n,(s,a)=>{if(!s.isInline)return;i++;let l=null;if(r instanceof ov){let c=s.marks,u;for(;u=r.isInSet(c);)(l||(l=[])).push(u),c=u.removeFromSet(c)}else r?r.isInSet(s.marks)&&(l=[r]):l=s.marks;if(l&&l.length){let c=Math.min(a+s.nodeSize,n);for(let u=0;u<l.length;u++){let d=l[u],p;for(let f=0;f<o.length;f++){let h=o[f];h.step==i-1&&d.eq(o[f].style)&&(p=h)}p?(p.to=c,p.step=i):o.push({style:d,from:Math.max(a,e),to:c,step:i})}}}),o.forEach(s=>t.step(new vn(s.from,s.to,s.style)))}function sf(t,e,n,r=n.contentMatch,o=!0){let i=t.doc.nodeAt(e),s=[],a=e+1;for(let l=0;l<i.childCount;l++){let c=i.child(l),u=a+c.nodeSize,d=r.matchType(c.type);if(!d)s.push(new Tt(a,u,ve.empty));else{r=d;for(let p=0;p<c.marks.length;p++)n.allowsMarkType(c.marks[p].type)||t.step(new vn(a,u,c.marks[p]));if(o&&c.isText&&n.whitespace!="pre"){let p,f=/\r?\n|\r/g,h;for(;p=f.exec(c.text);)h||(h=new ve(ye.from(n.schema.text(" ",n.allowedMarks(c.marks))),0,0)),s.push(new Tt(a+p.index,a+p.index+p[0].length,h))}}a=u}if(!r.validEnd){let l=r.fillBefore(ye.empty,!0);t.replace(a,a,new ve(l,0,0))}for(let l=s.length-1;l>=0;l--)t.step(s[l])}function nE(t,e,n){return(e==0||t.canReplace(e,t.childCount))&&(n==t.childCount||t.canReplace(0,n))}function Us(t){let e=t.parent.content.cutByIndex(t.startIndex,t.endIndex);for(let n=t.depth;;--n){let r=t.$from.node(n),o=t.$from.index(n),i=t.$to.indexAfter(n);if(n<t.depth&&r.canReplace(o,i,e))return n;if(n==0||r.type.spec.isolating||!nE(r,o,i))break}return null}function rE(t,e,n){let{$from:r,$to:o,depth:i}=e,s=r.before(i+1),a=o.after(i+1),l=s,c=a,u=ye.empty,d=0;for(let h=i,m=!1;h>n;h--)m||r.index(h)>0?(m=!0,u=ye.from(r.node(h).copy(u)),d++):l--;let p=ye.empty,f=0;for(let h=i,m=!1;h>n;h--)m||o.after(h+1)<o.end(h)?(m=!0,p=ye.from(o.node(h).copy(p)),f++):c++;t.step(new Zt(l,c,s,a,new ve(u.append(p),d,f),u.size-d,!0))}function mv(t,e,n=null,r=t){let o=oE(t,e),i=o&&iE(r,e);return i?o.map(xg).concat({type:e,attrs:n}).concat(i.map(xg)):null}function xg(t){return{type:t,attrs:null}}function oE(t,e){let{parent:n,startIndex:r,endIndex:o}=t,i=n.contentMatchAt(r).findWrapping(e);if(!i)return null;let s=i.length?i[0]:e;return n.canReplaceWith(r,o,s)?i:null}function iE(t,e){let{parent:n,startIndex:r,endIndex:o}=t,i=n.child(r),s=e.contentMatch.findWrapping(i.type);if(!s)return null;let a=(s.length?s[s.length-1]:e).contentMatch;for(let l=r;a&&l<o;l++)a=a.matchType(n.child(l).type);return!a||!a.validEnd?null:s}function sE(t,e,n){let r=ye.empty;for(let s=n.length-1;s>=0;s--){if(r.size){let a=n[s].type.contentMatch.matchFragment(r);if(!a||!a.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}r=ye.from(n[s].type.create(n[s].attrs,r))}let o=e.start,i=e.end;t.step(new Zt(o,i,o,i,new ve(r,0,0),n.length,!0))}function aE(t,e,n,r,o){if(!r.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let i=t.steps.length;t.doc.nodesBetween(e,n,(s,a)=>{let l=typeof o=="function"?o(s):o;if(s.isTextblock&&!s.hasMarkup(r,l)&&lE(t.doc,t.mapping.slice(i).map(a),r)){let c=null;if(r.schema.linebreakReplacement){let f=r.whitespace=="pre",h=!!r.contentMatch.matchType(r.schema.linebreakReplacement);f&&!h?c=!1:!f&&h&&(c=!0)}c===!1&&yv(t,s,a,i),sf(t,t.mapping.slice(i).map(a,1),r,void 0,c===null);let u=t.mapping.slice(i),d=u.map(a,1),p=u.map(a+s.nodeSize,1);return t.step(new Zt(d,p,d+1,p-1,new ve(ye.from(r.create(l,null,s.marks)),0,0),1,!0)),c===!0&&gv(t,s,a,i),!1}})}function gv(t,e,n,r){e.forEach((o,i)=>{if(o.isText){let s,a=/\r?\n|\r/g;for(;s=a.exec(o.text);){let l=t.mapping.slice(r).map(n+1+i+s.index);t.replaceWith(l,l+1,e.type.schema.linebreakReplacement.create())}}})}function yv(t,e,n,r){e.forEach((o,i)=>{if(o.type==o.type.schema.linebreakReplacement){let s=t.mapping.slice(r).map(n+1+i);t.replaceWith(s,s+1,e.type.schema.text(`
|
|
30
|
-
`))}})}function lE(t,e,n){let r=t.resolve(e),o=r.index();return r.parent.canReplaceWith(o,o+1,n)}function cE(t,e,n,r,o){let i=t.doc.nodeAt(e);if(!i)throw new RangeError("No node at given position");n||(n=i.type);let s=n.create(r,null,o||i.marks);if(i.isLeaf)return t.replaceWith(e,e+i.nodeSize,s);if(!n.validContent(i.content))throw new RangeError("Invalid content for node type "+n.name);t.step(new Zt(e,e+i.nodeSize,e+1,e+i.nodeSize-1,new ve(ye.from(s),0,0),1,!0))}function tr(t,e,n=1,r){let o=t.resolve(e),i=o.depth-n,s=r&&r[r.length-1]||o.parent;if(i<0||o.parent.type.spec.isolating||!o.parent.canReplace(o.index(),o.parent.childCount)||!s.type.validContent(o.parent.content.cutByIndex(o.index(),o.parent.childCount)))return!1;for(let c=o.depth-1,u=n-2;c>i;c--,u--){let d=o.node(c),p=o.index(c);if(d.type.spec.isolating)return!1;let f=d.content.cutByIndex(p,d.childCount),h=r&&r[u+1];h&&(f=f.replaceChild(0,h.type.create(h.attrs)));let m=r&&r[u]||d;if(!d.canReplace(p+1,d.childCount)||!m.type.validContent(f))return!1}let a=o.indexAfter(i),l=r&&r[0];return o.node(i).canReplaceWith(a,a,l?l.type:o.node(i+1).type)}function uE(t,e,n=1,r){let o=t.doc.resolve(e),i=ye.empty,s=ye.empty;for(let a=o.depth,l=o.depth-n,c=n-1;a>l;a--,c--){i=ye.from(o.node(a).copy(i));let u=r&&r[c];s=ye.from(u?u.type.create(u.attrs,s):o.node(a).copy(s))}t.step(new Tt(e,e,new ve(i.append(s),n,n),!0))}function Pr(t,e){let n=t.resolve(e),r=n.index();return wv(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(r,r+1)}function dE(t,e){e.content.size||t.type.compatibleContent(e.type);let n=t.contentMatchAt(t.childCount),{linebreakReplacement:r}=t.type.schema;for(let o=0;o<e.childCount;o++){let i=e.child(o),s=i.type==r?t.type.schema.nodes.text:i.type;if(n=n.matchType(s),!n||!t.type.allowsMarks(i.marks))return!1}return n.validEnd}function wv(t,e){return!!(t&&e&&!t.isLeaf&&dE(t,e))}function bv(t,e,n=-1){let r=t.resolve(e);for(let o=r.depth;;o--){let i,s,a=r.index(o);if(o==r.depth?(i=r.nodeBefore,s=r.nodeAfter):n>0?(i=r.node(o+1),a++,s=r.node(o).maybeChild(a)):(i=r.node(o).maybeChild(a-1),s=r.node(o+1)),i&&!i.isTextblock&&wv(i,s)&&r.node(o).canReplace(a,a+1))return e;if(o==0)break;e=n<0?r.before(o):r.after(o)}}function pE(t,e,n){let r=null,{linebreakReplacement:o}=t.doc.type.schema,i=t.doc.resolve(e-n),s=i.node().type;if(o&&s.inlineContent){let u=s.whitespace=="pre",d=!!s.contentMatch.matchType(o);u&&!d?r=!1:!u&&d&&(r=!0)}let a=t.steps.length;if(r===!1){let u=t.doc.resolve(e+n);yv(t,u.node(),u.before(),a)}s.inlineContent&&sf(t,e+n-1,s,i.node().contentMatchAt(i.index()),r==null);let l=t.mapping.slice(a),c=l.map(e-n);if(t.step(new Tt(c,l.map(e+n,-1),ve.empty,!0)),r===!0){let u=t.doc.resolve(c);gv(t,u.node(),u.before(),t.steps.length)}return t}function fE(t,e,n){let r=t.resolve(e);if(r.parent.canReplaceWith(r.index(),r.index(),n))return e;if(r.parentOffset==0)for(let o=r.depth-1;o>=0;o--){let i=r.index(o);if(r.node(o).canReplaceWith(i,i,n))return r.before(o+1);if(i>0)return null}if(r.parentOffset==r.parent.content.size)for(let o=r.depth-1;o>=0;o--){let i=r.indexAfter(o);if(r.node(o).canReplaceWith(i,i,n))return r.after(o+1);if(i<r.node(o).childCount)return null}return null}function vv(t,e,n){let r=t.resolve(e);if(!n.content.size)return e;let o=n.content;for(let i=0;i<n.openStart;i++)o=o.firstChild.content;for(let i=1;i<=(n.openStart==0&&n.size?2:1);i++)for(let s=r.depth;s>=0;s--){let a=s==r.depth?0:r.pos<=(r.start(s+1)+r.end(s+1))/2?-1:1,l=r.index(s)+(a>0?1:0),c=r.node(s),u=!1;if(i==1)u=c.canReplace(l,l,o);else{let d=c.contentMatchAt(l).findWrapping(o.firstChild.type);u=d&&c.canReplaceWith(l,l,d[0])}if(u)return a==0?r.pos:a<0?r.before(s+1):r.after(s+1)}return null}function af(t,e,n=e,r=ve.empty){if(e==n&&!r.size)return null;let o=t.resolve(e),i=t.resolve(n);return xv(o,i,r)?new Tt(e,n,r):new hE(o,i,r).fit()}function xv(t,e,n){return!n.openStart&&!n.openEnd&&t.start()==e.start()&&t.parent.canReplace(t.index(),e.index(),n.content)}let hE=class{constructor(e,n,r){this.$from=e,this.$to=n,this.unplaced=r,this.frontier=[],this.placed=ye.empty;for(let o=0;o<=e.depth;o++){let i=e.node(o);this.frontier.push({type:i.type,match:i.contentMatchAt(e.indexAfter(o))})}for(let o=e.depth;o>0;o--)this.placed=ye.from(e.node(o).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let c=this.findFittable();c?this.placeNodes(c):this.openMore()||this.dropNode()}let e=this.mustMoveInline(),n=this.placed.size-this.depth-this.$from.depth,r=this.$from,o=this.close(e<0?this.$to:r.doc.resolve(e));if(!o)return null;let i=this.placed,s=r.depth,a=o.depth;for(;s&&a&&i.childCount==1;)i=i.firstChild.content,s--,a--;let l=new ve(i,s,a);return e>-1?new Zt(r.pos,e,this.$to.pos,this.$to.end(),l,n):l.size||r.pos!=this.$to.pos?new Tt(r.pos,o.pos,l):null}findFittable(){let e=this.unplaced.openStart;for(let n=this.unplaced.content,r=0,o=this.unplaced.openEnd;r<e;r++){let i=n.firstChild;if(n.childCount>1&&(o=0),i.type.spec.isolating&&o<=r){e=r;break}n=i.content}for(let n=1;n<=2;n++)for(let r=n==1?e:this.unplaced.openStart;r>=0;r--){let o,i=null;r?(i=bu(this.unplaced.content,r-1).firstChild,o=i.content):o=this.unplaced.content;let s=o.firstChild;for(let a=this.depth;a>=0;a--){let{type:l,match:c}=this.frontier[a],u,d=null;if(n==1&&(s?c.matchType(s.type)||(d=c.fillBefore(ye.from(s),!1)):i&&l.compatibleContent(i.type)))return{sliceDepth:r,frontierDepth:a,parent:i,inject:d};if(n==2&&s&&(u=c.findWrapping(s.type)))return{sliceDepth:r,frontierDepth:a,parent:i,wrap:u};if(i&&c.matchType(i.type))break}}}openMore(){let{content:e,openStart:n,openEnd:r}=this.unplaced,o=bu(e,n);return!o.childCount||o.firstChild.isLeaf?!1:(this.unplaced=new ve(e,n+1,Math.max(r,o.size+n>=e.size-r?n+1:0)),!0)}dropNode(){let{content:e,openStart:n,openEnd:r}=this.unplaced,o=bu(e,n);if(o.childCount<=1&&n>0){let i=e.size-n<=n+o.size;this.unplaced=new ve(Li(e,n-1,1),n-1,i?n-1:r)}else this.unplaced=new ve(Li(e,n,1),n,r)}placeNodes({sliceDepth:e,frontierDepth:n,parent:r,inject:o,wrap:i}){for(;this.depth>n;)this.closeFrontierNode();if(i)for(let m=0;m<i.length;m++)this.openFrontierNode(i[m]);let s=this.unplaced,a=r?r.content:s.content,l=s.openStart-e,c=0,u=[],{match:d,type:p}=this.frontier[n];if(o){for(let m=0;m<o.childCount;m++)u.push(o.child(m));d=d.matchFragment(o)}let f=a.size+e-(s.content.size-s.openEnd);for(;c<a.childCount;){let m=a.child(c),y=d.matchType(m.type);if(!y)break;c++,(c>1||l==0||m.content.size)&&(d=y,u.push(kv(m.mark(p.allowedMarks(m.marks)),c==1?l:0,c==a.childCount?f:-1)))}let h=c==a.childCount;h||(f=-1),this.placed=Pi(this.placed,n,ye.from(u)),this.frontier[n].match=d,h&&f<0&&r&&r.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let m=0,y=a;m<f;m++){let g=y.lastChild;this.frontier.push({type:g.type,match:g.contentMatchAt(g.childCount)}),y=g.content}this.unplaced=h?e==0?ve.empty:new ve(Li(s.content,e-1,1),e-1,f<0?s.openEnd:e-1):new ve(Li(s.content,e,c),s.openStart,s.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let e=this.frontier[this.depth],n;if(!e.type.isTextblock||!vu(this.$to,this.$to.depth,e.type,e.match,!1)||this.$to.depth==this.depth&&(n=this.findCloseLevel(this.$to))&&n.depth==this.depth)return-1;let{depth:r}=this.$to,o=this.$to.after(r);for(;r>1&&o==this.$to.end(--r);)++o;return o}findCloseLevel(e){e:for(let n=Math.min(this.depth,e.depth);n>=0;n--){let{match:r,type:o}=this.frontier[n],i=n<e.depth&&e.end(n+1)==e.pos+(e.depth-(n+1)),s=vu(e,n,o,r,i);if(s){for(let a=n-1;a>=0;a--){let{match:l,type:c}=this.frontier[a],u=vu(e,a,c,l,!0);if(!u||u.childCount)continue e}return{depth:n,fit:s,move:i?e.doc.resolve(e.after(n+1)):e}}}}close(e){let n=this.findCloseLevel(e);if(!n)return null;for(;this.depth>n.depth;)this.closeFrontierNode();n.fit.childCount&&(this.placed=Pi(this.placed,n.depth,n.fit)),e=n.move;for(let r=n.depth+1;r<=e.depth;r++){let o=e.node(r),i=o.type.contentMatch.fillBefore(o.content,!0,e.index(r));this.openFrontierNode(o.type,o.attrs,i)}return e}openFrontierNode(e,n=null,r){let o=this.frontier[this.depth];o.match=o.match.matchType(e),this.placed=Pi(this.placed,this.depth,ye.from(e.create(n,r))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let e=this.frontier.pop().match.fillBefore(ye.empty,!0);e.childCount&&(this.placed=Pi(this.placed,this.frontier.length,e))}};function Li(t,e,n){return e==0?t.cutByIndex(n,t.childCount):t.replaceChild(0,t.firstChild.copy(Li(t.firstChild.content,e-1,n)))}function Pi(t,e,n){return e==0?t.append(n):t.replaceChild(t.childCount-1,t.lastChild.copy(Pi(t.lastChild.content,e-1,n)))}function bu(t,e){for(let n=0;n<e;n++)t=t.firstChild.content;return t}function kv(t,e,n){if(e<=0)return t;let r=t.content;return e>1&&(r=r.replaceChild(0,kv(r.firstChild,e-1,r.childCount==1?n-1:0))),e>0&&(r=t.type.contentMatch.fillBefore(r).append(r),n<=0&&(r=r.append(t.type.contentMatch.matchFragment(r).fillBefore(ye.empty,!0)))),t.copy(r)}function vu(t,e,n,r,o){let i=t.node(e),s=o?t.indexAfter(e):t.index(e);if(s==i.childCount&&!n.compatibleContent(i.type))return null;let a=r.fillBefore(i.content,!0,s);return a&&!mE(n,i.content,s)?a:null}function mE(t,e,n){for(let r=n;r<e.childCount;r++)if(!t.allowsMarks(e.child(r).marks))return!0;return!1}function gE(t){return t.spec.defining||t.spec.definingForContent}function yE(t,e,n,r){if(!r.size)return t.deleteRange(e,n);let o=t.doc.resolve(e),i=t.doc.resolve(n);if(xv(o,i,r))return t.step(new Tt(e,n,r));let s=Av(o,t.doc.resolve(n));s[s.length-1]==0&&s.pop();let a=-(o.depth+1);s.unshift(a);for(let p=o.depth,f=o.pos-1;p>0;p--,f--){let h=o.node(p).type.spec;if(h.defining||h.definingAsContext||h.isolating)break;s.indexOf(p)>-1?a=p:o.before(p)==f&&s.splice(1,0,-p)}let l=s.indexOf(a),c=[],u=r.openStart;for(let p=r.content,f=0;;f++){let h=p.firstChild;if(c.push(h),f==r.openStart)break;p=h.content}for(let p=u-1;p>=0;p--){let f=c[p],h=gE(f.type);if(h&&!f.sameMarkup(o.node(Math.abs(a)-1)))u=p;else if(h||!f.type.isTextblock)break}for(let p=r.openStart;p>=0;p--){let f=(p+u+1)%(r.openStart+1),h=c[f];if(h)for(let m=0;m<s.length;m++){let y=s[(m+l)%s.length],g=!0;y<0&&(g=!1,y=-y);let v=o.node(y-1),k=o.index(y-1);if(v.canReplaceWith(k,k,h.type,h.marks))return t.replace(o.before(y),g?i.after(y):n,new ve(Sv(r.content,0,r.openStart,f),f,r.openEnd))}}let d=t.steps.length;for(let p=s.length-1;p>=0&&(t.replace(e,n,r),!(t.steps.length>d));p--){let f=s[p];f<0||(e=o.before(f),n=i.after(f))}}function Sv(t,e,n,r,o){if(e<n){let i=t.firstChild;t=t.replaceChild(0,i.copy(Sv(i.content,e+1,n,r,i)))}if(e>r){let i=o.contentMatchAt(0),s=i.fillBefore(t).append(t);t=s.append(i.matchFragment(s).fillBefore(ye.empty,!0))}return t}function wE(t,e,n,r){if(!r.isInline&&e==n&&t.doc.resolve(e).parent.content.size){let o=fE(t.doc,e,r.type);o!=null&&(e=n=o)}t.replaceRange(e,n,new ve(ye.from(r),0,0))}function bE(t,e,n){let r=t.doc.resolve(e),o=t.doc.resolve(n),i=Av(r,o);for(let s=0;s<i.length;s++){let a=i[s],l=s==i.length-1;if(l&&a==0||r.node(a).type.contentMatch.validEnd)return t.delete(r.start(a),o.end(a));if(a>0&&(l||r.node(a-1).canReplace(r.index(a-1),o.indexAfter(a-1))))return t.delete(r.before(a),o.after(a))}for(let s=1;s<=r.depth&&s<=o.depth;s++)if(e-r.start(s)==r.depth-s&&n>r.end(s)&&o.end(s)-n!=o.depth-s&&r.start(s-1)==o.start(s-1)&&r.node(s-1).canReplace(r.index(s-1),o.index(s-1)))return t.delete(r.before(s),n);t.delete(e,n)}function Av(t,e){let n=[],r=Math.min(t.depth,e.depth);for(let o=r;o>=0;o--){let i=t.start(o);if(i<t.pos-(t.depth-o)||e.end(o)>e.pos+(e.depth-o)||t.node(o).type.spec.isolating||e.node(o).type.spec.isolating)break;(i==e.start(o)||o==t.depth&&o==e.depth&&t.parent.inlineContent&&e.parent.inlineContent&&o&&e.start(o-1)==i-1)&&n.push(o)}return n}let Cv=class za extends Rt{constructor(e,n,r){super(),this.pos=e,this.attr=n,this.value=r}apply(e){let n=e.nodeAt(this.pos);if(!n)return jt.fail("No node at attribute step's position");let r=Object.create(null);for(let i in n.attrs)r[i]=n.attrs[i];r[this.attr]=this.value;let o=n.type.create(r,null,n.marks);return jt.fromReplace(e,this.pos,this.pos+1,new ve(ye.from(o),0,n.isLeaf?0:1))}getMap(){return mo.empty}invert(e){return new za(this.pos,this.attr,e.nodeAt(this.pos).attrs[this.attr])}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new za(n.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(e,n){if(typeof n.pos!="number"||typeof n.attr!="string")throw new RangeError("Invalid input for AttrStep.fromJSON");return new za(n.pos,n.attr,n.value)}};Rt.jsonID("attr",Cv);let Ev=class _d extends Rt{constructor(e,n){super(),this.attr=e,this.value=n}apply(e){let n=Object.create(null);for(let o in e.attrs)n[o]=e.attrs[o];n[this.attr]=this.value;let r=e.type.create(n,e.content,e.marks);return jt.ok(r)}getMap(){return mo.empty}invert(e){return new _d(this.attr,e.attrs[this.attr])}map(e){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(e,n){if(typeof n.attr!="string")throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new _d(n.attr,n.value)}};Rt.jsonID("docAttr",Ev);let ri=class extends Error{};ri=function t(e){let n=Error.call(this,e);return n.__proto__=t.prototype,n};ri.prototype=Object.create(Error.prototype);ri.prototype.constructor=ri;ri.prototype.name="TransformError";let Tv=class{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new ni}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let n=this.maybeStep(e);if(n.failed)throw new ri(n.failed);return this}maybeStep(e){let n=e.apply(this.doc);return n.failed||this.addStep(e,n.doc),n}get docChanged(){return this.steps.length>0}addStep(e,n){this.docs.push(this.doc),this.steps.push(e),this.mapping.appendMap(e.getMap()),this.doc=n}replace(e,n=e,r=ve.empty){let o=af(this.doc,e,n,r);return o&&this.step(o),this}replaceWith(e,n,r){return this.replace(e,n,new ve(ye.from(r),0,0))}delete(e,n){return this.replace(e,n,ve.empty)}insert(e,n){return this.replaceWith(e,e,n)}replaceRange(e,n,r){return yE(this,e,n,r),this}replaceRangeWith(e,n,r){return wE(this,e,n,r),this}deleteRange(e,n){return bE(this,e,n),this}lift(e,n){return rE(this,e,n),this}join(e,n=1){return pE(this,e,n),this}wrap(e,n){return sE(this,e,n),this}setBlockType(e,n=e,r,o=null){return aE(this,e,n,r,o),this}setNodeMarkup(e,n,r=null,o){return cE(this,e,n,r,o),this}setNodeAttribute(e,n,r){return this.step(new Cv(e,n,r)),this}setDocAttribute(e,n){return this.step(new Ev(e,n)),this}addNodeMark(e,n){return this.step(new of(e,n)),this}removeNodeMark(e,n){let r=this.doc.nodeAt(e);if(!r)throw new RangeError("No node at position "+e);if(n instanceof Xe)n.isInSet(r.marks)&&this.step(new ul(e,n));else{let o=r.marks,i,s=[];for(;i=n.isInSet(o);)s.push(new ul(e,i)),o=i.removeFromSet(o);for(let a=s.length-1;a>=0;a--)this.step(s[a])}return this}split(e,n=1,r){return uE(this,e,n,r),this}addMark(e,n,r){return eE(this,e,n,r),this}removeMark(e,n,r){return tE(this,e,n,r),this}clearIncompatible(e,n,r){return sf(this,e,n,r),this}};const xu=Object.create(null);let je=class{constructor(e,n,r){this.$anchor=e,this.$head=n,this.ranges=r||[new $v(e.min(n),e.max(n))]}get anchor(){return this.$anchor.pos}get head(){return this.$head.pos}get from(){return this.$from.pos}get to(){return this.$to.pos}get $from(){return this.ranges[0].$from}get $to(){return this.ranges[0].$to}get empty(){let e=this.ranges;for(let n=0;n<e.length;n++)if(e[n].$from.pos!=e[n].$to.pos)return!1;return!0}content(){return this.$from.doc.slice(this.from,this.to,!0)}replace(e,n=ve.empty){let r=n.content.lastChild,o=null;for(let a=0;a<n.openEnd;a++)o=r,r=r.lastChild;let i=e.steps.length,s=this.ranges;for(let a=0;a<s.length;a++){let{$from:l,$to:c}=s[a],u=e.mapping.slice(i);e.replaceRange(u.map(l.pos),u.map(c.pos),a?ve.empty:n),a==0&&Ag(e,i,(r?r.isInline:o&&o.isTextblock)?-1:1)}}replaceWith(e,n){let r=e.steps.length,o=this.ranges;for(let i=0;i<o.length;i++){let{$from:s,$to:a}=o[i],l=e.mapping.slice(r),c=l.map(s.pos),u=l.map(a.pos);i?e.deleteRange(c,u):(e.replaceRangeWith(c,u,n),Ag(e,r,n.isInline?-1:1))}}static findFrom(e,n,r=!1){let o=e.parent.inlineContent?new Pe(e):Lo(e.node(0),e.parent,e.pos,e.index(),n,r);if(o)return o;for(let i=e.depth-1;i>=0;i--){let s=n<0?Lo(e.node(0),e.node(i),e.before(i+1),e.index(i),n,r):Lo(e.node(0),e.node(i),e.after(i+1),e.index(i)+1,n,r);if(s)return s}return null}static near(e,n=1){return this.findFrom(e,n)||this.findFrom(e,-n)||new Nn(e.node(0))}static atStart(e){return Lo(e,e,0,0,1)||new Nn(e)}static atEnd(e){return Lo(e,e,e.content.size,e.childCount,-1)||new Nn(e)}static fromJSON(e,n){if(!n||!n.type)throw new RangeError("Invalid input for Selection.fromJSON");let r=xu[n.type];if(!r)throw new RangeError(`No selection type ${n.type} defined`);return r.fromJSON(e,n)}static jsonID(e,n){if(e in xu)throw new RangeError("Duplicate use of selection JSON ID "+e);return xu[e]=n,n.prototype.jsonID=e,n}getBookmark(){return Pe.between(this.$anchor,this.$head).getBookmark()}};je.prototype.visible=!0;let $v=class{constructor(e,n){this.$from=e,this.$to=n}},kg=!1;function Sg(t){!kg&&!t.parent.inlineContent&&(kg=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+t.parent.type.name+")"))}let Pe=class zi extends je{constructor(e,n=e){Sg(e),Sg(n),super(e,n)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(e,n){let r=e.resolve(n.map(this.head));if(!r.parent.inlineContent)return je.near(r);let o=e.resolve(n.map(this.anchor));return new zi(o.parent.inlineContent?o:r,r)}replace(e,n=ve.empty){if(super.replace(e,n),n==ve.empty){let r=this.$from.marksAcross(this.$to);r&&e.ensureMarks(r)}}eq(e){return e instanceof zi&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new Ov(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(e,n){if(typeof n.anchor!="number"||typeof n.head!="number")throw new RangeError("Invalid input for TextSelection.fromJSON");return new zi(e.resolve(n.anchor),e.resolve(n.head))}static create(e,n,r=n){let o=e.resolve(n);return new this(o,r==n?o:e.resolve(r))}static between(e,n,r){let o=e.pos-n.pos;if((!r||o)&&(r=o>=0?1:-1),!n.parent.inlineContent){let i=je.findFrom(n,r,!0)||je.findFrom(n,-r,!0);if(i)n=i.$head;else return je.near(n,r)}return e.parent.inlineContent||(o==0?e=n:(e=(je.findFrom(e,-r,!0)||je.findFrom(e,r,!0)).$anchor,e.pos<n.pos!=o<0&&(e=n))),new zi(e,n)}};je.jsonID("text",Pe);let Ov=class Mv{constructor(e,n){this.anchor=e,this.head=n}map(e){return new Mv(e.map(this.anchor),e.map(this.head))}resolve(e){return Pe.between(e.resolve(this.anchor),e.resolve(this.head))}},_e=class ji extends je{constructor(e){let n=e.nodeAfter,r=e.node(0).resolve(e.pos+n.nodeSize);super(e,r),this.node=n}map(e,n){let{deleted:r,pos:o}=n.mapResult(this.anchor),i=e.resolve(o);return r?je.near(i):new ji(i)}content(){return new ve(ye.from(this.node),0,0)}eq(e){return e instanceof ji&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new vE(this.anchor)}static fromJSON(e,n){if(typeof n.anchor!="number")throw new RangeError("Invalid input for NodeSelection.fromJSON");return new ji(e.resolve(n.anchor))}static create(e,n){return new ji(e.resolve(n))}static isSelectable(e){return!e.isText&&e.type.spec.selectable!==!1}};_e.prototype.visible=!1;je.jsonID("node",_e);let vE=class Dv{constructor(e){this.anchor=e}map(e){let{deleted:n,pos:r}=e.mapResult(this.anchor);return n?new Ov(r,r):new Dv(r)}resolve(e){let n=e.resolve(this.anchor),r=n.nodeAfter;return r&&_e.isSelectable(r)?new _e(n):je.near(n)}},Nn=class ja extends je{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,n=ve.empty){if(n==ve.empty){e.delete(0,e.doc.content.size);let r=je.atStart(e.doc);r.eq(e.selection)||e.setSelection(r)}else super.replace(e,n)}toJSON(){return{type:"all"}}static fromJSON(e){return new ja(e)}map(e){return new ja(e)}eq(e){return e instanceof ja}getBookmark(){return xE}};je.jsonID("all",Nn);const xE={map(){return this},resolve(t){return new Nn(t)}};function Lo(t,e,n,r,o,i=!1){if(e.inlineContent)return Pe.create(t,n);for(let s=r-(o>0?0:1);o>0?s<e.childCount:s>=0;s+=o){let a=e.child(s);if(a.isAtom){if(!i&&_e.isSelectable(a))return _e.create(t,n-(o<0?a.nodeSize:0))}else{let l=Lo(t,a,n+o,o<0?a.childCount:0,o,i);if(l)return l}n+=a.nodeSize*o}return null}function Ag(t,e,n){let r=t.steps.length-1;if(r<e)return;let o=t.steps[r];if(!(o instanceof Tt||o instanceof Zt))return;let i=t.mapping.maps[r],s;i.forEach((a,l,c,u)=>{s==null&&(s=u)}),t.setSelection(je.near(t.doc.resolve(s),n))}const Cg=1,Eg=2,Tg=4;let kE=class extends Tv{constructor(e){super(e.doc),this.curSelectionFor=0,this.updated=0,this.meta=Object.create(null),this.time=Date.now(),this.curSelection=e.selection,this.storedMarks=e.storedMarks}get selection(){return this.curSelectionFor<this.steps.length&&(this.curSelection=this.curSelection.map(this.doc,this.mapping.slice(this.curSelectionFor)),this.curSelectionFor=this.steps.length),this.curSelection}setSelection(e){if(e.$from.doc!=this.doc)throw new RangeError("Selection passed to setSelection must point at the current document");return this.curSelection=e,this.curSelectionFor=this.steps.length,this.updated=(this.updated|Cg)&-3,this.storedMarks=null,this}get selectionSet(){return(this.updated&Cg)>0}setStoredMarks(e){return this.storedMarks=e,this.updated|=Eg,this}ensureMarks(e){return Xe.sameSet(this.storedMarks||this.selection.$from.marks(),e)||this.setStoredMarks(e),this}addStoredMark(e){return this.ensureMarks(e.addToSet(this.storedMarks||this.selection.$head.marks()))}removeStoredMark(e){return this.ensureMarks(e.removeFromSet(this.storedMarks||this.selection.$head.marks()))}get storedMarksSet(){return(this.updated&Eg)>0}addStep(e,n){super.addStep(e,n),this.updated=this.updated&-3,this.storedMarks=null}setTime(e){return this.time=e,this}replaceSelection(e){return this.selection.replace(this,e),this}replaceSelectionWith(e,n=!0){let r=this.selection;return n&&(e=e.mark(this.storedMarks||(r.empty?r.$from.marks():r.$from.marksAcross(r.$to)||Xe.none))),r.replaceWith(this,e),this}deleteSelection(){return this.selection.replace(this),this}insertText(e,n,r){let o=this.doc.type.schema;if(n==null)return e?this.replaceSelectionWith(o.text(e),!0):this.deleteSelection();{if(r==null&&(r=n),r=r??n,!e)return this.deleteRange(n,r);let i=this.storedMarks;if(!i){let s=this.doc.resolve(n);i=r==n?s.marks():s.marksAcross(this.doc.resolve(r))}return this.replaceRangeWith(n,r,o.text(e,i)),this.selection.empty||this.setSelection(je.near(this.selection.$to)),this}}setMeta(e,n){return this.meta[typeof e=="string"?e:e.key]=n,this}getMeta(e){return this.meta[typeof e=="string"?e:e.key]}get isGeneric(){for(let e in this.meta)return!1;return!0}scrollIntoView(){return this.updated|=Tg,this}get scrolledIntoView(){return(this.updated&Tg)>0}};function $g(t,e){return!e||!t?t:t.bind(e)}let qi=class{constructor(e,n,r){this.name=e,this.init=$g(n.init,r),this.apply=$g(n.apply,r)}};const SE=[new qi("doc",{init(t){return t.doc||t.schema.topNodeType.createAndFill()},apply(t){return t.doc}}),new qi("selection",{init(t,e){return t.selection||je.atStart(e.doc)},apply(t){return t.selection}}),new qi("storedMarks",{init(t){return t.storedMarks||null},apply(t,e,n,r){return r.selection.$cursor?t.storedMarks:null}}),new qi("scrollToSelection",{init(){return 0},apply(t,e){return t.scrolledIntoView?e+1:e}})];let ku=class{constructor(e,n){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=SE.slice(),n&&n.forEach(r=>{if(this.pluginsByKey[r.key])throw new RangeError("Adding different instances of a keyed plugin ("+r.key+")");this.plugins.push(r),this.pluginsByKey[r.key]=r,r.spec.state&&this.fields.push(new qi(r.key,r.spec.state,r))})}},Zi=class Vi{constructor(e){this.config=e}get schema(){return this.config.schema}get plugins(){return this.config.plugins}apply(e){return this.applyTransaction(e).state}filterTransaction(e,n=-1){for(let r=0;r<this.config.plugins.length;r++)if(r!=n){let o=this.config.plugins[r];if(o.spec.filterTransaction&&!o.spec.filterTransaction.call(o,e,this))return!1}return!0}applyTransaction(e){if(!this.filterTransaction(e))return{state:this,transactions:[]};let n=[e],r=this.applyInner(e),o=null;for(;;){let i=!1;for(let s=0;s<this.config.plugins.length;s++){let a=this.config.plugins[s];if(a.spec.appendTransaction){let l=o?o[s].n:0,c=o?o[s].state:this,u=l<n.length&&a.spec.appendTransaction.call(a,l?n.slice(l):n,c,r);if(u&&r.filterTransaction(u,s)){if(u.setMeta("appendedTransaction",e),!o){o=[];for(let d=0;d<this.config.plugins.length;d++)o.push(d<s?{state:r,n:n.length}:{state:this,n:0})}n.push(u),r=r.applyInner(u),i=!0}o&&(o[s]={state:r,n:n.length})}}if(!i)return{state:r,transactions:n}}}applyInner(e){if(!e.before.eq(this.doc))throw new RangeError("Applying a mismatched transaction");let n=new Vi(this.config),r=this.config.fields;for(let o=0;o<r.length;o++){let i=r[o];n[i.name]=i.apply(e,this[i.name],this,n)}return n}get tr(){return new kE(this)}static create(e){let n=new ku(e.doc?e.doc.type.schema:e.schema,e.plugins),r=new Vi(n);for(let o=0;o<n.fields.length;o++)r[n.fields[o].name]=n.fields[o].init(e,r);return r}reconfigure(e){let n=new ku(this.schema,e.plugins),r=n.fields,o=new Vi(n);for(let i=0;i<r.length;i++){let s=r[i].name;o[s]=this.hasOwnProperty(s)?this[s]:r[i].init(e,o)}return o}toJSON(e){let n={doc:this.doc.toJSON(),selection:this.selection.toJSON()};if(this.storedMarks&&(n.storedMarks=this.storedMarks.map(r=>r.toJSON())),e&&typeof e=="object")for(let r in e){if(r=="doc"||r=="selection")throw new RangeError("The JSON fields `doc` and `selection` are reserved");let o=e[r],i=o.spec.state;i&&i.toJSON&&(n[r]=i.toJSON.call(o,this[o.key]))}return n}static fromJSON(e,n,r){if(!n)throw new RangeError("Invalid input for EditorState.fromJSON");if(!e.schema)throw new RangeError("Required config field 'schema' missing");let o=new ku(e.schema,e.plugins),i=new Vi(o);return o.fields.forEach(s=>{if(s.name=="doc")i.doc=so.fromJSON(e.schema,n.doc);else if(s.name=="selection")i.selection=je.fromJSON(i.doc,n.selection);else if(s.name=="storedMarks")n.storedMarks&&(i.storedMarks=n.storedMarks.map(e.schema.markFromJSON));else{if(r)for(let a in r){let l=r[a],c=l.spec.state;if(l.key==s.name&&c&&c.fromJSON&&Object.prototype.hasOwnProperty.call(n,a)){i[s.name]=c.fromJSON.call(l,e,n[a],i);return}}i[s.name]=s.init(e,i)}}),i}};function _v(t,e,n){for(let r in t){let o=t[r];o instanceof Function?o=o.bind(e):r=="handleDOMEvents"&&(o=_v(o,e,{})),n[r]=o}return n}let Ue=class{constructor(e){this.spec=e,this.props={},e.props&&_v(e.props,this,this.props),this.key=e.key?e.key.key:Nv("plugin")}getState(e){return e[this.key]}};const Su=Object.create(null);function Nv(t){return t in Su?t+"$"+ ++Su[t]:(Su[t]=0,t+"$")}let Ge=class{constructor(e="key"){this.key=Nv(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}};const dl=t=>t.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`),AE=t=>dl(t),qa=Object.freeze({RESOLVED:"resolved",NEW:"new",ADD:"add",UPDATE:"update",DELETED:"deleted",PENDING:"pending",SELECTED:"selected",COMMENTS_LIST:"comments-list",CHANGE_ACCEPTED:"change-accepted",CHANGE_REJECTED:"change-rejected"}),CE={mounted(t,e,n){const r=o=>{t.contains(o.target)||e.value(o)};document.addEventListener("click",r),t.__clickOutsideHandler=r},unmounted(t){document.removeEventListener("click",t.__clickOutsideHandler),delete t.__clickOutsideHandler}};function Ke(t,e=null,...n){return typeof t=="function"?e?t.bind(e)(...n):t(...n):t}function EE(t={}){return Object.keys(t).length===0&&t.constructor===Object}const TE=()=>typeof navigator<"u"?/Mac/.test(navigator.platform):!1,$E=()=>["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform),Iv=t=>Object.prototype.toString.call(t)==="[object RegExp]";function oi(t,e,n={strict:!0}){const r=Object.keys(e);return r.length?r.every(o=>n.strict?e[o]===t[o]:Iv(e[o])?e[o].test(t[o]):e[o]===t[o]):!0}function Og(t,e){const n=typeof e=="string"?[e]:e;return Object.keys(t).reduce((r,o)=>(n.includes(o)||(r[o]=t[o]),r),{})}const OE=/[\d-.]+(\w+)$/,ME=["px","rem","em","in","q","mm","cm","pt","pc","vh","vw","vmin","vmax"];function nr(t="0"){const e=t.toString()||"0",n=Number.parseFloat(e),r=(e.match(OE)?.[1]??"").toLowerCase();return[n,ME.includes(r)?r:null]}function pl(t=0,e=0,n=0){return Math.min(Math.max(t,e),n)}function ii(t){if(t!=null)return typeof t=="string"&&(t=parseFloat(t)),Math.round(t*1440)}function Wt(t){if(t!=null)return typeof t=="string"&&(t=parseInt(t,10)),Math.round(t/1440*100)/100}function nt(t){if(t!=null)return t=Wt(t),Math.round(t*96)}function at(t){if(t!=null)return t=t/96,ii(t)}function Jo(t){if(t!=null)return t/240}function Nd(t){if(t!=null)return t*240}function DE(t){if(t!=null)return Math.round(t/2)}function Gt(t){if(t==null)return;typeof t=="string"&&(t=parseFloat(t));const e=t*96/914400;return Math.round(e)}function Vr(t){if(t!=null)return typeof t=="string"&&(t=parseFloat(t)),Math.round(t*9525)}function Fv(t){return t==null?void 0:parseFloat(t)/8*1.3333}function Rv(t){if(t!=null)return Math.round(t*6)}function Bv(t){if(t!=null)return t/20}function _E(t){if(t!=null)return t*20}const NE=async(t,e)=>{const n=/^https?:|^blob:|^file:|^data:/i.test(t);if(e&&n&&typeof fetch=="function"){const i=await fetch(t);if(!i.ok)throw new Error(`Fetch failed: ${i.status} ${i.statusText}`);return await i.arrayBuffer()}const r=t.includes(",")?t.split(",",2)[1]:t.trim().replace(/\s/g,"");try{if(typeof globalThis.atob=="function"){const i=globalThis.atob(r),s=new Uint8Array(i.length);for(let a=0;a<i.length;a++)s[a]=i.charCodeAt(a);return s.buffer}}catch(i){console.warn("atob failed, falling back to Buffer:",i)}const o=mt.from(r,"base64");return o.buffer.slice(o.byteOffset,o.byteOffset+o.byteLength)},IE=t=>{const e=new window.DOMParser().parseFromString(t,"text/xml").querySelectorAll("Default");return Array.from(e).map(n=>n.getAttribute("Extension"))},FE=t=>new Map([["yellow","#ffff00"],["green","#00ff00"],["blue","#0000FFFF"],["cyan","#00ffff"],["magenta","#ff00ff"],["red","#ff0000"],["darkYellow","#808000FF"],["darkGreen","#008000FF"],["darkBlue","#000080"],["darkCyan","#008080FF"],["darkMagenta","#800080FF"],["darkGray","#808080FF"],["darkRed","#800000FF"],["lightGray","#C0C0C0FF"],["black","#000"]]).get(t)||null;function RE(t){if(!t||typeof t!="string")return!1;switch(t.length){case 3:return/^[0-9A-F]{3}$/i.test(t);case 6:return/^[0-9A-F]{6}$/i.test(t);case 8:return/^[0-9A-F]{8}$/i.test(t);default:return!1}}const BE=t=>{const e=Number(t).toString(16);return e.length===1?"0"+e:e},LE=t=>"#"+t.match(/\d+/g).map(BE).join(""),Zl=(t,e,n="",r=!1)=>{let[o,i]=nr(t);return Number.isNaN(o)||o===0?{}:n==="atLeast"&&o<1?{}:(i=i||e,o+=i?4:.2,r?{"line-height":`${o}${i}`}:`line-height: ${o}${i}`)},PE=(t,e)=>{const n=new Uint8Array(t),r=e.replace(/[-{}]/g,"");if(r.length!==32){console.error("Invalid GUID");return}const o=new Uint8Array(16);for(let i=0,s=0;i<32;i+=2,s++){const a=r[i]+r[i+1];o[s]=parseInt(a,16)}for(let i=0;i<32;i++){const s=15-i%16;n[i]^=o[s]}return n.buffer},Id=(t,e)=>t.className?.split(" ")?.indexOf(e)>=0?!0:t.parentNode&&Id(t.parentNode,e);function Yn(t=8){const e="0123456789abcdef";let n=[];for(let r=0;r<t;r++){const o=Math.floor(Math.random()*e.length);n.push(e[o])}return n.join("")}function lf(){return Math.floor(Math.random()*2147483647).toString(16).toUpperCase().padStart(8,"0")}const zE={"xmlns:wpc":"http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas","xmlns:cx":"http://schemas.microsoft.com/office/drawing/2014/chartex","xmlns:cx1":"http://schemas.microsoft.com/office/drawing/2015/9/8/chartex","xmlns:cx2":"http://schemas.microsoft.com/office/drawing/2015/10/21/chartex","xmlns:cx3":"http://schemas.microsoft.com/office/drawing/2016/5/9/chartex","xmlns:cx4":"http://schemas.microsoft.com/office/drawing/2016/5/10/chartex","xmlns:cx5":"http://schemas.microsoft.com/office/drawing/2016/5/11/chartex","xmlns:cx6":"http://schemas.microsoft.com/office/drawing/2016/5/12/chartex","xmlns:cx7":"http://schemas.microsoft.com/office/drawing/2016/5/13/chartex","xmlns:cx8":"http://schemas.microsoft.com/office/drawing/2016/5/14/chartex","xmlns:mc":"http://schemas.openxmlformats.org/markup-compatibility/2006","xmlns:aink":"http://schemas.microsoft.com/office/drawing/2016/ink","xmlns:am3d":"http://schemas.microsoft.com/office/drawing/2017/model3d","xmlns:o":"urn:schemas-microsoft-com:office:office","xmlns:oel":"http://schemas.microsoft.com/office/2019/extlst","xmlns:r":"http://schemas.openxmlformats.org/officeDocument/2006/relationships","xmlns:m":"http://schemas.openxmlformats.org/officeDocument/2006/math","xmlns:v":"urn:schemas-microsoft-com:vml","xmlns:wp14":"http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing","xmlns:wp":"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing","xmlns:w10":"urn:schemas-microsoft-com:office:word","xmlns:w":"http://schemas.openxmlformats.org/wordprocessingml/2006/main","xmlns:w14":"http://schemas.microsoft.com/office/word/2010/wordml","xmlns:w15":"http://schemas.microsoft.com/office/word/2012/wordml","xmlns:w16cex":"http://schemas.microsoft.com/office/word/2018/wordml/cex","xmlns:w16cid":"http://schemas.microsoft.com/office/word/2016/wordml/cid","xmlns:w16":"http://schemas.microsoft.com/office/word/2018/wordml","xmlns:w16du":"http://schemas.microsoft.com/office/word/2023/wordml/word16du","xmlns:w16sdtdh":"http://schemas.microsoft.com/office/word/2020/wordml/sdtdatahash","xmlns:w16sdtfl":"http://schemas.microsoft.com/office/word/2024/wordml/sdtformatlock","xmlns:w16se":"http://schemas.microsoft.com/office/word/2015/wordml/symex","xmlns:wpg":"http://schemas.microsoft.com/office/word/2010/wordprocessingGroup","xmlns:wpi":"http://schemas.microsoft.com/office/word/2010/wordprocessingInk","xmlns:wne":"http://schemas.microsoft.com/office/word/2006/wordml","xmlns:wps":"http://schemas.microsoft.com/office/word/2010/wordprocessingShape","mc:Ignorable":"w14 w15 w16se w16cid w16 w16cex w16sdtdh w16sdtfl w16du wp14"},jE={elements:[{type:"element",name:"Properties",attributes:{xmlns:"http://schemas.openxmlformats.org/officeDocument/2006/custom-properties","xmlns:vt":"http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes"},elements:[]}]},qE={elements:[{type:"element",name:"w:settings",attributes:{"xmlns:w":"http://schemas.openxmlformats.org/wordprocessingml/2006/main"},elements:[]}]},VE={type:"element",name:"w:r",elements:[{type:"element",name:"w:rPr",elements:[{type:"element",name:"w:rStyle",attributes:{"w:val":"CommentReference"}}]},{type:"element",name:"w:annotationRef"}]},Mg={Normal:{type:"element",name:"w:style",attributes:{"w:type":"paragraph","w:default":"1","w:styleId":"Normal"},elements:[{type:"element",name:"w:name",attributes:{"w:val":"Normal"}},{type:"element",name:"w:qFormat"}]},Title:{type:"element",name:"w:style",attributes:{"w:type":"paragraph","w:styleId":"Title"},elements:[{type:"element",name:"w:name",attributes:{"w:val":"Title"}},{type:"element",name:"w:basedOn",attributes:{"w:val":"Normal"}},{type:"element",name:"w:next",attributes:{"w:val":"Normal"}},{type:"element",name:"w:link",attributes:{"w:val":"TitleChar"}},{type:"element",name:"w:uiPriority",attributes:{"w:val":"10"}},{type:"element",name:"w:qFormat"},{type:"element",name:"w:rsid",attributes:{"w:val":"00B72667"}},{type:"element",name:"w:pPr",elements:[{type:"element",name:"w:spacing",attributes:{"w:after":"80"}},{type:"element",name:"w:contextualSpacing"}]},{type:"element",name:"w:rPr",elements:[{type:"element",name:"w:rFonts",attributes:{"w:asciiTheme":"majorHAnsi","w:eastAsiaTheme":"majorEastAsia","w:hAnsiTheme":"majorHAnsi","w:cstheme":"majorBidi"}},{type:"element",name:"w:spacing",attributes:{"w:val":"-10"}},{type:"element",name:"w:kern",attributes:{"w:val":"28"}},{type:"element",name:"w:sz",attributes:{"w:val":"56"}},{type:"element",name:"w:szCs",attributes:{"w:val":"56"}}]}]},Subtitle:{type:"element",name:"w:style",attributes:{"w:type":"paragraph","w:styleId":"Subtitle"},elements:[{type:"element",name:"w:name",attributes:{"w:val":"Subtitle"}},{type:"element",name:"w:basedOn",attributes:{"w:val":"Normal"}},{type:"element",name:"w:next",attributes:{"w:val":"Normal"}},{type:"element",name:"w:link",attributes:{"w:val":"SubtitleChar"}},{type:"element",name:"w:uiPriority",attributes:{"w:val":"11"}},{type:"element",name:"w:qFormat"},{type:"element",name:"w:rsid",attributes:{"w:val":"00B72667"}},{type:"element",name:"w:pPr",elements:[{type:"element",name:"w:numPr",elements:[{type:"element",name:"w:ilvl",attributes:{"w:val":"1"}}]},{type:"element",name:"w:spacing",attributes:{"w:after":"160"}}]},{type:"element",name:"w:rPr",elements:[{type:"element",name:"w:rFonts",attributes:{"w:asciiTheme":"minorHAnsi","w:eastAsiaTheme":"majorEastAsia","w:hAnsiTheme":"minorHAnsi","w:cstheme":"majorBidi"}},{type:"element",name:"w:color",attributes:{"w:val":"595959","w:themeColor":"text1","w:themeTint":"A6"}},{type:"element",name:"w:spacing",attributes:{"w:val":"15"}},{type:"element",name:"w:sz",attributes:{"w:val":"28"}},{type:"element",name:"w:szCs",attributes:{"w:val":"28"}}]}]},Heading1:{type:"element",name:"w:style",attributes:{"w:type":"paragraph","w:styleId":"Heading1"},elements:[{type:"element",name:"w:name",attributes:{"w:val":"heading 1"}},{type:"element",name:"w:basedOn",attributes:{"w:val":"Normal"}},{type:"element",name:"w:next",attributes:{"w:val":"Normal"}},{type:"element",name:"w:link",attributes:{"w:val":"Heading1Char"}},{type:"element",name:"w:uiPriority",attributes:{"w:val":"9"}},{type:"element",name:"w:qFormat"},{type:"element",name:"w:rsid",attributes:{"w:val":"00233D7B"}},{type:"element",name:"w:pPr",elements:[{type:"element",name:"w:keepNext"},{type:"element",name:"w:keepLines"},{type:"element",name:"w:spacing",attributes:{"w:before":"360","w:after":"80"}},{type:"element",name:"w:outlineLvl",attributes:{"w:val":"0"}}]},{type:"element",name:"w:rPr",elements:[{type:"element",name:"w:rFonts",attributes:{"w:asciiTheme":"majorHAnsi","w:eastAsiaTheme":"majorEastAsia","w:hAnsiTheme":"majorHAnsi","w:cstheme":"majorBidi"}},{type:"element",name:"w:color",attributes:{"w:val":"0F4761","w:themeColor":"accent1","w:themeShade":"BF"}},{type:"element",name:"w:sz",attributes:{"w:val":"40"}},{type:"element",name:"w:szCs",attributes:{"w:val":"40"}}]}]},Heading2:{type:"element",name:"w:style",attributes:{"w:type":"paragraph","w:styleId":"Heading2"},elements:[{type:"element",name:"w:name",attributes:{"w:val":"heading 2"}},{type:"element",name:"w:basedOn",attributes:{"w:val":"Normal"}},{type:"element",name:"w:next",attributes:{"w:val":"Normal"}},{type:"element",name:"w:link",attributes:{"w:val":"Heading2Char"}},{type:"element",name:"w:uiPriority",attributes:{"w:val":"9"}},{type:"element",name:"w:semiHidden"},{type:"element",name:"w:unhideWhenUsed"},{type:"element",name:"w:qFormat"},{type:"element",name:"w:rsid",attributes:{"w:val":"00233D7B"}},{type:"element",name:"w:pPr",elements:[{type:"element",name:"w:keepNext"},{type:"element",name:"w:keepLines"},{type:"element",name:"w:spacing",attributes:{"w:before":"160","w:after":"80"}},{type:"element",name:"w:outlineLvl",attributes:{"w:val":"1"}}]},{type:"element",name:"w:rPr",elements:[{type:"element",name:"w:rFonts",attributes:{"w:asciiTheme":"majorHAnsi","w:eastAsiaTheme":"majorEastAsia","w:hAnsiTheme":"majorHAnsi","w:cstheme":"majorBidi"}},{type:"element",name:"w:color",attributes:{"w:val":"0F4761","w:themeColor":"accent1","w:themeShade":"BF"}},{type:"element",name:"w:sz",attributes:{"w:val":"32"}},{type:"element",name:"w:szCs",attributes:{"w:val":"32"}}]}]},Heading3:{type:"element",name:"w:style",attributes:{"w:type":"paragraph","w:styleId":"Heading3"},elements:[{type:"element",name:"w:name",attributes:{"w:val":"heading 3"}},{type:"element",name:"w:basedOn",attributes:{"w:val":"Normal"}},{type:"element",name:"w:next",attributes:{"w:val":"Normal"}},{type:"element",name:"w:link",attributes:{"w:val":"Heading3Char"}},{type:"element",name:"w:uiPriority",attributes:{"w:val":"9"}},{type:"element",name:"w:semiHidden"},{type:"element",name:"w:unhideWhenUsed"},{type:"element",name:"w:qFormat"},{type:"element",name:"w:rsid",attributes:{"w:val":"00233D7B"}},{type:"element",name:"w:pPr",elements:[{type:"element",name:"w:keepNext"},{type:"element",name:"w:keepLines"},{type:"element",name:"w:spacing",attributes:{"w:before":"160","w:after":"80"}},{type:"element",name:"w:outlineLvl",attributes:{"w:val":"2"}}]},{type:"element",name:"w:rPr",elements:[{type:"element",name:"w:rFonts",attributes:{"w:eastAsiaTheme":"majorEastAsia","w:cstheme":"majorBidi"}},{type:"element",name:"w:color",attributes:{"w:val":"0F4761","w:themeColor":"accent1","w:themeShade":"BF"}},{type:"element",name:"w:sz",attributes:{"w:val":"28"}},{type:"element",name:"w:szCs",attributes:{"w:val":"28"}}]}]}},UE={declaration:{attributes:{version:"1.0",encoding:"UTF-8",standalone:"yes"}},elements:[{type:"element",name:"w:comments",attributes:{"xmlns:wpc":"http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas","xmlns:cx":"http://schemas.microsoft.com/office/drawing/2014/chartex","xmlns:cx1":"http://schemas.microsoft.com/office/drawing/2015/9/8/chartex","xmlns:cx2":"http://schemas.microsoft.com/office/drawing/2015/10/21/chartex","xmlns:cx3":"http://schemas.microsoft.com/office/drawing/2016/5/9/chartex","xmlns:cx4":"http://schemas.microsoft.com/office/drawing/2016/5/10/chartex","xmlns:cx5":"http://schemas.microsoft.com/office/drawing/2016/5/11/chartex","xmlns:cx6":"http://schemas.microsoft.com/office/drawing/2016/5/12/chartex","xmlns:cx7":"http://schemas.microsoft.com/office/drawing/2016/5/13/chartex","xmlns:cx8":"http://schemas.microsoft.com/office/drawing/2016/5/14/chartex","xmlns:mc":"http://schemas.openxmlformats.org/markup-compatibility/2006","xmlns:aink":"http://schemas.microsoft.com/office/drawing/2016/ink","xmlns:am3d":"http://schemas.microsoft.com/office/drawing/2017/model3d","xmlns:o":"urn:schemas-microsoft-com:office:office","xmlns:oel":"http://schemas.microsoft.com/office/2019/extlst","xmlns:r":"http://schemas.openxmlformats.org/officeDocument/2006/relationships","xmlns:m":"http://schemas.openxmlformats.org/officeDocument/2006/math","xmlns:v":"urn:schemas-microsoft-com:vml","xmlns:wp14":"http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing","xmlns:wp":"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing","xmlns:w10":"urn:schemas-microsoft-com:office:word","xmlns:w":"http://schemas.openxmlformats.org/wordprocessingml/2006/main","xmlns:w14":"http://schemas.microsoft.com/office/word/2010/wordml","xmlns:w15":"http://schemas.microsoft.com/office/word/2012/wordml","xmlns:w16cex":"http://schemas.microsoft.com/office/word/2018/wordml/cex","xmlns:w16cid":"http://schemas.microsoft.com/office/word/2016/wordml/cid","xmlns:w16":"http://schemas.microsoft.com/office/word/2018/wordml","xmlns:w16du":"http://schemas.microsoft.com/office/word/2023/wordml/word16du","xmlns:w16sdtdh":"http://schemas.microsoft.com/office/word/2020/wordml/sdtdatahash","xmlns:w16sdtfl":"http://schemas.microsoft.com/office/word/2024/wordml/sdtformatlock","xmlns:w16se":"http://schemas.microsoft.com/office/word/2015/wordml/symex","xmlns:wpg":"http://schemas.microsoft.com/office/word/2010/wordprocessingGroup","xmlns:wpi":"http://schemas.microsoft.com/office/word/2010/wordprocessingInk","xmlns:wne":"http://schemas.microsoft.com/office/word/2006/wordml","xmlns:wps":"http://schemas.microsoft.com/office/word/2010/wordprocessingShape","mc:Ignorable":"w14 w15 w16se w16cid w16 w16cex w16sdtdh w16sdtfl w16du wp14"},elements:[]}]},HE={declaration:{attributes:{version:"1.0",encoding:"UTF-8",standalone:"yes"}},elements:[{type:"element",name:"w15:commentsEx",attributes:{"xmlns:wpc":"http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas","xmlns:cx":"http://schemas.microsoft.com/office/drawing/2014/chartex","xmlns:cx1":"http://schemas.microsoft.com/office/drawing/2015/9/8/chartex","xmlns:cx2":"http://schemas.microsoft.com/office/drawing/2015/10/21/chartex","xmlns:cx3":"http://schemas.microsoft.com/office/drawing/2016/5/9/chartex","xmlns:cx4":"http://schemas.microsoft.com/office/drawing/2016/5/10/chartex","xmlns:cx5":"http://schemas.microsoft.com/office/drawing/2016/5/11/chartex","xmlns:cx6":"http://schemas.microsoft.com/office/drawing/2016/5/12/chartex","xmlns:cx7":"http://schemas.microsoft.com/office/drawing/2016/5/13/chartex","xmlns:cx8":"http://schemas.microsoft.com/office/drawing/2016/5/14/chartex","xmlns:mc":"http://schemas.openxmlformats.org/markup-compatibility/2006","xmlns:aink":"http://schemas.microsoft.com/office/drawing/2016/ink","xmlns:am3d":"http://schemas.microsoft.com/office/drawing/2017/model3d","xmlns:o":"urn:schemas-microsoft-com:office:office","xmlns:oel":"http://schemas.microsoft.com/office/2019/extlst","xmlns:r":"http://schemas.openxmlformats.org/officeDocument/2006/relationships","xmlns:m":"http://schemas.openxmlformats.org/officeDocument/2006/math","xmlns:v":"urn:schemas-microsoft-com:vml","xmlns:wp14":"http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing","xmlns:wp":"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing","xmlns:w10":"urn:schemas-microsoft-com:office:word","xmlns:w":"http://schemas.openxmlformats.org/wordprocessingml/2006/main","xmlns:w14":"http://schemas.microsoft.com/office/word/2010/wordml","xmlns:w15":"http://schemas.microsoft.com/office/word/2012/wordml","xmlns:w16cex":"http://schemas.microsoft.com/office/word/2018/wordml/cex","xmlns:w16cid":"http://schemas.microsoft.com/office/word/2016/wordml/cid","xmlns:w16":"http://schemas.microsoft.com/office/word/2018/wordml","xmlns:w16du":"http://schemas.microsoft.com/office/word/2023/wordml/word16du","xmlns:w16sdtdh":"http://schemas.microsoft.com/office/word/2020/wordml/sdtdatahash","xmlns:w16sdtfl":"http://schemas.microsoft.com/office/word/2024/wordml/sdtformatlock","xmlns:w16se":"http://schemas.microsoft.com/office/word/2015/wordml/symex","xmlns:wpg":"http://schemas.microsoft.com/office/word/2010/wordprocessingGroup","xmlns:wpi":"http://schemas.microsoft.com/office/word/2010/wordprocessingInk","xmlns:wne":"http://schemas.microsoft.com/office/word/2006/wordml","xmlns:wps":"http://schemas.microsoft.com/office/word/2010/wordprocessingShape","mc:Ignorable":"w14 w15 w16se w16cid w16 w16cex w16sdtdh w16sdtfl w16du wp14"},elements:[]}]},WE={declaration:{attributes:{version:"1.0",encoding:"UTF-8",standalone:"yes"}},elements:[{type:"element",name:"w16cex:commentsExtensible",attributes:{"xmlns:wpc":"http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas","xmlns:cx":"http://schemas.microsoft.com/office/drawing/2014/chartex","xmlns:cx1":"http://schemas.microsoft.com/office/drawing/2015/9/8/chartex","xmlns:cx2":"http://schemas.microsoft.com/office/drawing/2015/10/21/chartex","xmlns:cx3":"http://schemas.microsoft.com/office/drawing/2016/5/9/chartex","xmlns:cx4":"http://schemas.microsoft.com/office/drawing/2016/5/10/chartex","xmlns:cx5":"http://schemas.microsoft.com/office/drawing/2016/5/11/chartex","xmlns:cx6":"http://schemas.microsoft.com/office/drawing/2016/5/12/chartex","xmlns:cx7":"http://schemas.microsoft.com/office/drawing/2016/5/13/chartex","xmlns:cx8":"http://schemas.microsoft.com/office/drawing/2016/5/14/chartex","xmlns:cr":"http://schemas.microsoft.com/office/comments/2020/reactions","xmlns:mc":"http://schemas.openxmlformats.org/markup-compatibility/2006","xmlns:aink":"http://schemas.microsoft.com/office/drawing/2016/ink","xmlns:am3d":"http://schemas.microsoft.com/office/drawing/2017/model3d","xmlns:o":"urn:schemas-microsoft-com:office:office","xmlns:oel":"http://schemas.microsoft.com/office/2019/extlst","xmlns:r":"http://schemas.openxmlformats.org/officeDocument/2006/relationships","xmlns:m":"http://schemas.openxmlformats.org/officeDocument/2006/math","xmlns:v":"urn:schemas-microsoft-com:vml","xmlns:wp14":"http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing","xmlns:wp":"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing","xmlns:w10":"urn:schemas-microsoft-com:office:word","xmlns:w":"http://schemas.openxmlformats.org/wordprocessingml/2006/main","xmlns:w14":"http://schemas.microsoft.com/office/word/2010/wordml","xmlns:w15":"http://schemas.microsoft.com/office/word/2012/wordml","xmlns:w16cex":"http://schemas.microsoft.com/office/word/2018/wordml/cex","xmlns:w16cid":"http://schemas.microsoft.com/office/word/2016/wordml/cid","xmlns:w16":"http://schemas.microsoft.com/office/word/2018/wordml","xmlns:w16du":"http://schemas.microsoft.com/office/word/2023/wordml/word16du","xmlns:w16sdtdh":"http://schemas.microsoft.com/office/word/2020/wordml/sdtdatahash","xmlns:w16sdtfl":"http://schemas.microsoft.com/office/word/2024/wordml/sdtformatlock","xmlns:w16se":"http://schemas.microsoft.com/office/word/2015/wordml/symex","xmlns:wpg":"http://schemas.microsoft.com/office/word/2010/wordprocessingGroup","xmlns:wpi":"http://schemas.microsoft.com/office/word/2010/wordprocessingInk","xmlns:wne":"http://schemas.microsoft.com/office/word/2006/wordml","xmlns:wps":"http://schemas.microsoft.com/office/word/2010/wordprocessingShape","mc:Ignorable":"w14 w15 w16se w16cid w16 w16cex w16sdtdh w16sdtfl cr w16du wp14"},elements:[]}]},GE={declaration:{attributes:{version:"1.0",encoding:"UTF-8",standalone:"yes"}},elements:[{type:"element",name:"w16cid:commentsIds",attributes:{"xmlns:wpc":"http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas","xmlns:cx":"http://schemas.microsoft.com/office/drawing/2014/chartex","xmlns:cx1":"http://schemas.microsoft.com/office/drawing/2015/9/8/chartex","xmlns:cx2":"http://schemas.microsoft.com/office/drawing/2015/10/21/chartex","xmlns:cx3":"http://schemas.microsoft.com/office/drawing/2016/5/9/chartex","xmlns:cx4":"http://schemas.microsoft.com/office/drawing/2016/5/10/chartex","xmlns:cx5":"http://schemas.microsoft.com/office/drawing/2016/5/11/chartex","xmlns:cx6":"http://schemas.microsoft.com/office/drawing/2016/5/12/chartex","xmlns:cx7":"http://schemas.microsoft.com/office/drawing/2016/5/13/chartex","xmlns:cx8":"http://schemas.microsoft.com/office/drawing/2016/5/14/chartex","xmlns:mc":"http://schemas.openxmlformats.org/markup-compatibility/2006","xmlns:aink":"http://schemas.microsoft.com/office/drawing/2016/ink","xmlns:am3d":"http://schemas.microsoft.com/office/drawing/2017/model3d","xmlns:o":"urn:schemas-microsoft-com:office:office","xmlns:oel":"http://schemas.microsoft.com/office/2019/extlst","xmlns:r":"http://schemas.openxmlformats.org/officeDocument/2006/relationships","xmlns:m":"http://schemas.openxmlformats.org/officeDocument/2006/math","xmlns:v":"urn:schemas-microsoft-com:vml","xmlns:wp14":"http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing","xmlns:wp":"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing","xmlns:w10":"urn:schemas-microsoft-com:office:word","xmlns:w":"http://schemas.openxmlformats.org/wordprocessingml/2006/main","xmlns:w14":"http://schemas.microsoft.com/office/word/2010/wordml","xmlns:w15":"http://schemas.microsoft.com/office/word/2012/wordml","xmlns:w16cex":"http://schemas.microsoft.com/office/word/2018/wordml/cex","xmlns:w16cid":"http://schemas.microsoft.com/office/word/2016/wordml/cid","xmlns:w16":"http://schemas.microsoft.com/office/word/2018/wordml","xmlns:w16du":"http://schemas.microsoft.com/office/word/2023/wordml/word16du","xmlns:w16sdtdh":"http://schemas.microsoft.com/office/word/2020/wordml/sdtdatahash","xmlns:w16sdtfl":"http://schemas.microsoft.com/office/word/2024/wordml/sdtformatlock","xmlns:w16se":"http://schemas.microsoft.com/office/word/2015/wordml/symex","xmlns:wpg":"http://schemas.microsoft.com/office/word/2010/wordprocessingGroup","xmlns:wpi":"http://schemas.microsoft.com/office/word/2010/wordprocessingInk","xmlns:wne":"http://schemas.microsoft.com/office/word/2006/wordml","xmlns:wps":"http://schemas.microsoft.com/office/word/2010/wordprocessingShape","mc:Ignorable":"w14 w15 w16se w16cid w16 w16cex w16sdtdh w16sdtfl w16du wp14"},elements:[]}]},KE={elements:[{type:"element",name:"Relationships",attributes:{xmlns:"http://schemas.openxmlformats.org/package/2006/relationships"},elements:[{type:"element",name:"Relationship",attributes:{Id:"rId8",Type:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/fontTable",Target:"fontTable.xml"}},{type:"element",name:"Relationship",attributes:{Id:"rId3",Type:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/webSettings",Target:"webSettings.xml"}},{type:"element",name:"Relationship",attributes:{Id:"rId7",Type:"http://schemas.microsoft.com/office/2018/08/relationships/commentsExtensible",Target:"commentsExtensible.xml"}},{type:"element",name:"Relationship",attributes:{Id:"rId2",Type:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/settings",Target:"settings.xml"}},{type:"element",name:"Relationship",attributes:{Id:"rId1",Type:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles",Target:"styles.xml"}},{type:"element",name:"Relationship",attributes:{Id:"rId6",Type:"http://schemas.microsoft.com/office/2016/09/relationships/commentsIds",Target:"commentsIds.xml"}},{type:"element",name:"Relationship",attributes:{Id:"rId5",Type:"http://schemas.microsoft.com/office/2011/relationships/commentsExtended",Target:"commentsExtended.xml"}},{type:"element",name:"Relationship",attributes:{Id:"rId10",Type:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme",Target:"theme/theme1.xml"}},{type:"element",name:"Relationship",attributes:{Id:"rId4",Type:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/comments",Target:"comments.xml"}}]}]},JE={declaration:{attributes:{version:"1.0",encoding:"UTF-8",standalone:"yes"}},elements:[{type:"element",name:"Types",attributes:{xmlns:"http://schemas.openxmlformats.org/package/2006/content-types"},elements:[{type:"element",name:"Default",attributes:{Extension:"rels",ContentType:"application/vnd.openxmlformats-package.relationships+xml"}},{type:"element",name:"Default",attributes:{Extension:"xml",ContentType:"application/xml"}},{type:"element",name:"Override",attributes:{PartName:"/word/document.xml",ContentType:"application/vnd.openxmlformats-officedocument.wordprocessingml.document.main+xml"}},{type:"element",name:"Override",attributes:{PartName:"/word/styles.xml",ContentType:"application/vnd.openxmlformats-officedocument.wordprocessingml.styles+xml"}},{type:"element",name:"Override",attributes:{PartName:"/word/settings.xml",ContentType:"application/vnd.openxmlformats-officedocument.wordprocessingml.settings+xml"}},{type:"element",name:"Override",attributes:{PartName:"/word/webSettings.xml",ContentType:"application/vnd.openxmlformats-officedocument.wordprocessingml.webSettings+xml"}},{type:"element",name:"Override",attributes:{PartName:"/word/comments.xml",ContentType:"application/vnd.openxmlformats-officedocument.wordprocessingml.comments+xml"}},{type:"element",name:"Override",attributes:{PartName:"/word/commentsExtended.xml",ContentType:"application/vnd.openxmlformats-officedocument.wordprocessingml.commentsExtended+xml"}},{type:"element",name:"Override",attributes:{PartName:"/word/commentsIds.xml",ContentType:"application/vnd.openxmlformats-officedocument.wordprocessingml.commentsIds+xml"}},{type:"element",name:"Override",attributes:{PartName:"/word/commentsExtensible.xml",ContentType:"application/vnd.openxmlformats-officedocument.wordprocessingml.commentsExtensible+xml"}},{type:"element",name:"Override",attributes:{PartName:"/word/fontTable.xml",ContentType:"application/vnd.openxmlformats-officedocument.wordprocessingml.fontTable+xml"}},{type:"element",name:"Override",attributes:{PartName:"/word/people.xml",ContentType:"application/vnd.openxmlformats-officedocument.wordprocessingml.people+xml"}},{type:"element",name:"Override",attributes:{PartName:"/word/theme/theme1.xml",ContentType:"application/vnd.openxmlformats-officedocument.theme+xml"}},{type:"element",name:"Override",attributes:{PartName:"/docProps/core.xml",ContentType:"application/vnd.openxmlformats-package.core-properties+xml"}},{type:"element",name:"Override",attributes:{PartName:"/docProps/app.xml",ContentType:"application/vnd.openxmlformats-officedocument.extended-properties+xml"}},{type:"element",name:"Override",attributes:{PartName:"/word/numbering.xml",ContentType:"application/vnd.openxmlformats-officedocument.wordprocessingml.numbering+xml"}}]}]},Po={COMMENTS_XML_DEF:UE,COMMENTS_EXTENDED_XML_DEF:HE,COMMENTS_EXTENSIBLE_XML_DEF:WE,COMMENTS_IDS_XML_DEF:GE,DOCUMENT_RELS_XML_DEF:KE,CONTENT_TYPES:JE},It="trackInsert",ut="trackDelete",vt="trackFormat",Qt=t=>{if(t)try{return JSON.parse(JSON.stringify(t))}catch(e){console.error("Error in carbonCopy",t,e);return}},XE={attributes:{"w:abstractNumId":"1"}},YE={attributes:{"w:abstractNumId":"0"}},Lv={declaration:{attributes:{version:"1.0",encoding:"UTF-8",standalone:"yes"}},elements:[{type:"element",name:"w:numbering",attributes:{"xmlns:wpc":"http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas","xmlns:cx":"http://schemas.microsoft.com/office/drawing/2014/chartex","xmlns:cx1":"http://schemas.microsoft.com/office/drawing/2015/9/8/chartex","xmlns:cx2":"http://schemas.microsoft.com/office/drawing/2015/10/21/chartex","xmlns:cx3":"http://schemas.microsoft.com/office/drawing/2016/5/9/chartex","xmlns:cx4":"http://schemas.microsoft.com/office/drawing/2016/5/10/chartex","xmlns:cx5":"http://schemas.microsoft.com/office/drawing/2016/5/11/chartex","xmlns:cx6":"http://schemas.microsoft.com/office/drawing/2016/5/12/chartex","xmlns:cx7":"http://schemas.microsoft.com/office/drawing/2016/5/13/chartex","xmlns:cx8":"http://schemas.microsoft.com/office/drawing/2016/5/14/chartex","xmlns:mc":"http://schemas.openxmlformats.org/markup-compatibility/2006","xmlns:aink":"http://schemas.microsoft.com/office/drawing/2016/ink","xmlns:am3d":"http://schemas.microsoft.com/office/drawing/2017/model3d","xmlns:o":"urn:schemas-microsoft-com:office:office","xmlns:oel":"http://schemas.microsoft.com/office/2019/extlst","xmlns:r":"http://schemas.openxmlformats.org/officeDocument/2006/relationships","xmlns:m":"http://schemas.openxmlformats.org/officeDocument/2006/math","xmlns:v":"urn:schemas-microsoft-com:vml","xmlns:wp14":"http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing","xmlns:wp":"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing","xmlns:w10":"urn:schemas-microsoft-com:office:word","xmlns:w":"http://schemas.openxmlformats.org/wordprocessingml/2006/main","xmlns:w14":"http://schemas.microsoft.com/office/word/2010/wordml","xmlns:w15":"http://schemas.microsoft.com/office/word/2012/wordml","xmlns:w16cex":"http://schemas.microsoft.com/office/word/2018/wordml/cex","xmlns:w16cid":"http://schemas.microsoft.com/office/word/2016/wordml/cid","xmlns:w16":"http://schemas.microsoft.com/office/word/2018/wordml","xmlns:w16du":"http://schemas.microsoft.com/office/word/2023/wordml/word16du","xmlns:w16sdtdh":"http://schemas.microsoft.com/office/word/2020/wordml/sdtdatahash","xmlns:w16se":"http://schemas.microsoft.com/office/word/2015/wordml/symex","xmlns:wpg":"http://schemas.microsoft.com/office/word/2010/wordprocessingGroup","xmlns:wpi":"http://schemas.microsoft.com/office/word/2010/wordprocessingInk","xmlns:wne":"http://schemas.microsoft.com/office/word/2006/wordml","xmlns:wps":"http://schemas.microsoft.com/office/word/2010/wordprocessingShape","mc:Ignorable":"w14 w15 w16se w16cid w16 w16cex w16sdtdh w16du wp14"},elements:[{type:"element",name:"w:abstractNum",attributes:{"w:abstractNumId":"0","w15:restartNumberingAfterBreak":"0"},elements:[{type:"element",name:"w:nsid",attributes:{"w:val":"16126B07"}},{type:"element",name:"w:multiLevelType",attributes:{"w:val":"hybridMultilevel"}},{type:"element",name:"w:tmpl",attributes:{"w:val":"51EC4E08"}},{type:"element",name:"w:lvl",attributes:{"w:ilvl":"0","w:tplc":"04090001"},elements:[{type:"element",name:"w:start",attributes:{"w:val":"1"}},{type:"element",name:"w:numFmt",attributes:{"w:val":"bullet"}},{type:"element",name:"w:lvlText",attributes:{"w:val":""}},{type:"element",name:"w:lvlJc",attributes:{"w:val":"left"}},{type:"element",name:"w:pPr",elements:[{type:"element",name:"w:ind",attributes:{"w:left":"720","w:hanging":"360"}}]},{type:"element",name:"w:rPr",elements:[{type:"element",name:"w:rFonts",attributes:{"w:ascii":"Symbol","w:hAnsi":"Symbol","w:hint":"default"}}]}]},{type:"element",name:"w:lvl",attributes:{"w:ilvl":"1","w:tplc":"04090003","w:tentative":"1"},elements:[{type:"element",name:"w:start",attributes:{"w:val":"1"}},{type:"element",name:"w:numFmt",attributes:{"w:val":"bullet"}},{type:"element",name:"w:lvlText",attributes:{"w:val":"o"}},{type:"element",name:"w:lvlJc",attributes:{"w:val":"left"}},{type:"element",name:"w:pPr",elements:[{type:"element",name:"w:ind",attributes:{"w:left":"1440","w:hanging":"360"}}]},{type:"element",name:"w:rPr",elements:[{type:"element",name:"w:rFonts",attributes:{"w:ascii":"Courier New","w:hAnsi":"Courier New","w:cs":"Courier New","w:hint":"default"}}]}]},{type:"element",name:"w:lvl",attributes:{"w:ilvl":"2","w:tplc":"04090005","w:tentative":"1"},elements:[{type:"element",name:"w:start",attributes:{"w:val":"1"}},{type:"element",name:"w:numFmt",attributes:{"w:val":"bullet"}},{type:"element",name:"w:lvlText",attributes:{"w:val":""}},{type:"element",name:"w:lvlJc",attributes:{"w:val":"left"}},{type:"element",name:"w:pPr",elements:[{type:"element",name:"w:ind",attributes:{"w:left":"2160","w:hanging":"360"}}]},{type:"element",name:"w:rPr",elements:[{type:"element",name:"w:rFonts",attributes:{"w:ascii":"Wingdings","w:hAnsi":"Wingdings","w:hint":"default"}}]}]},{type:"element",name:"w:lvl",attributes:{"w:ilvl":"3","w:tplc":"04090001","w:tentative":"1"},elements:[{type:"element",name:"w:start",attributes:{"w:val":"1"}},{type:"element",name:"w:numFmt",attributes:{"w:val":"bullet"}},{type:"element",name:"w:lvlText",attributes:{"w:val":""}},{type:"element",name:"w:lvlJc",attributes:{"w:val":"left"}},{type:"element",name:"w:pPr",elements:[{type:"element",name:"w:ind",attributes:{"w:left":"2880","w:hanging":"360"}}]},{type:"element",name:"w:rPr",elements:[{type:"element",name:"w:rFonts",attributes:{"w:ascii":"Symbol","w:hAnsi":"Symbol","w:hint":"default"}}]}]},{type:"element",name:"w:lvl",attributes:{"w:ilvl":"4","w:tplc":"04090003","w:tentative":"1"},elements:[{type:"element",name:"w:start",attributes:{"w:val":"1"}},{type:"element",name:"w:numFmt",attributes:{"w:val":"bullet"}},{type:"element",name:"w:lvlText",attributes:{"w:val":"o"}},{type:"element",name:"w:lvlJc",attributes:{"w:val":"left"}},{type:"element",name:"w:pPr",elements:[{type:"element",name:"w:ind",attributes:{"w:left":"3600","w:hanging":"360"}}]},{type:"element",name:"w:rPr",elements:[{type:"element",name:"w:rFonts",attributes:{"w:ascii":"Courier New","w:hAnsi":"Courier New","w:cs":"Courier New","w:hint":"default"}}]}]},{type:"element",name:"w:lvl",attributes:{"w:ilvl":"5","w:tplc":"04090005","w:tentative":"1"},elements:[{type:"element",name:"w:start",attributes:{"w:val":"1"}},{type:"element",name:"w:numFmt",attributes:{"w:val":"bullet"}},{type:"element",name:"w:lvlText",attributes:{"w:val":""}},{type:"element",name:"w:lvlJc",attributes:{"w:val":"left"}},{type:"element",name:"w:pPr",elements:[{type:"element",name:"w:ind",attributes:{"w:left":"4320","w:hanging":"360"}}]},{type:"element",name:"w:rPr",elements:[{type:"element",name:"w:rFonts",attributes:{"w:ascii":"Wingdings","w:hAnsi":"Wingdings","w:hint":"default"}}]}]},{type:"element",name:"w:lvl",attributes:{"w:ilvl":"6","w:tplc":"04090001","w:tentative":"1"},elements:[{type:"element",name:"w:start",attributes:{"w:val":"1"}},{type:"element",name:"w:numFmt",attributes:{"w:val":"bullet"}},{type:"element",name:"w:lvlText",attributes:{"w:val":""}},{type:"element",name:"w:lvlJc",attributes:{"w:val":"left"}},{type:"element",name:"w:pPr",elements:[{type:"element",name:"w:ind",attributes:{"w:left":"5040","w:hanging":"360"}}]},{type:"element",name:"w:rPr",elements:[{type:"element",name:"w:rFonts",attributes:{"w:ascii":"Symbol","w:hAnsi":"Symbol","w:hint":"default"}}]}]},{type:"element",name:"w:lvl",attributes:{"w:ilvl":"7","w:tplc":"04090003","w:tentative":"1"},elements:[{type:"element",name:"w:start",attributes:{"w:val":"1"}},{type:"element",name:"w:numFmt",attributes:{"w:val":"bullet"}},{type:"element",name:"w:lvlText",attributes:{"w:val":"o"}},{type:"element",name:"w:lvlJc",attributes:{"w:val":"left"}},{type:"element",name:"w:pPr",elements:[{type:"element",name:"w:ind",attributes:{"w:left":"5760","w:hanging":"360"}}]},{type:"element",name:"w:rPr",elements:[{type:"element",name:"w:rFonts",attributes:{"w:ascii":"Courier New","w:hAnsi":"Courier New","w:cs":"Courier New","w:hint":"default"}}]}]},{type:"element",name:"w:lvl",attributes:{"w:ilvl":"8","w:tplc":"04090005","w:tentative":"1"},elements:[{type:"element",name:"w:start",attributes:{"w:val":"1"}},{type:"element",name:"w:numFmt",attributes:{"w:val":"bullet"}},{type:"element",name:"w:lvlText",attributes:{"w:val":""}},{type:"element",name:"w:lvlJc",attributes:{"w:val":"left"}},{type:"element",name:"w:pPr",elements:[{type:"element",name:"w:ind",attributes:{"w:left":"6480","w:hanging":"360"}}]},{type:"element",name:"w:rPr",elements:[{type:"element",name:"w:rFonts",attributes:{"w:ascii":"Wingdings","w:hAnsi":"Wingdings","w:hint":"default"}}]}]}]},{type:"element",name:"w:abstractNum",attributes:{"w:abstractNumId":"1","w15:restartNumberingAfterBreak":"0"},elements:[{type:"element",name:"w:nsid",attributes:{"w:val":"587013BA"}},{type:"element",name:"w:multiLevelType",attributes:{"w:val":"hybridMultilevel"}},{type:"element",name:"w:tmpl",attributes:{"w:val":"EE6417C4"}},{type:"element",name:"w:lvl",attributes:{"w:ilvl":"0","w:tplc":"0409000F"},elements:[{type:"element",name:"w:start",attributes:{"w:val":"1"}},{type:"element",name:"w:numFmt",attributes:{"w:val":"decimal"}},{type:"element",name:"w:lvlText",attributes:{"w:val":"%1."}},{type:"element",name:"w:lvlJc",attributes:{"w:val":"left"}},{type:"element",name:"w:pPr",elements:[{type:"element",name:"w:ind",attributes:{"w:left":"720","w:hanging":"360"}}]}]},{type:"element",name:"w:lvl",attributes:{"w:ilvl":"1","w:tplc":"04090019","w:tentative":"1"},elements:[{type:"element",name:"w:start",attributes:{"w:val":"1"}},{type:"element",name:"w:numFmt",attributes:{"w:val":"lowerLetter"}},{type:"element",name:"w:lvlText",attributes:{"w:val":"%2."}},{type:"element",name:"w:lvlJc",attributes:{"w:val":"left"}},{type:"element",name:"w:pPr",elements:[{type:"element",name:"w:ind",attributes:{"w:left":"1440","w:hanging":"360"}}]}]},{type:"element",name:"w:lvl",attributes:{"w:ilvl":"2","w:tplc":"0409001B","w:tentative":"1"},elements:[{type:"element",name:"w:start",attributes:{"w:val":"1"}},{type:"element",name:"w:numFmt",attributes:{"w:val":"lowerRoman"}},{type:"element",name:"w:lvlText",attributes:{"w:val":"%3."}},{type:"element",name:"w:lvlJc",attributes:{"w:val":"right"}},{type:"element",name:"w:pPr",elements:[{type:"element",name:"w:ind",attributes:{"w:left":"2160","w:hanging":"180"}}]}]},{type:"element",name:"w:lvl",attributes:{"w:ilvl":"3","w:tplc":"0409000F","w:tentative":"1"},elements:[{type:"element",name:"w:start",attributes:{"w:val":"1"}},{type:"element",name:"w:numFmt",attributes:{"w:val":"decimal"}},{type:"element",name:"w:lvlText",attributes:{"w:val":"%4."}},{type:"element",name:"w:lvlJc",attributes:{"w:val":"left"}},{type:"element",name:"w:pPr",elements:[{type:"element",name:"w:ind",attributes:{"w:left":"2880","w:hanging":"360"}}]}]},{type:"element",name:"w:lvl",attributes:{"w:ilvl":"4","w:tplc":"04090019","w:tentative":"1"},elements:[{type:"element",name:"w:start",attributes:{"w:val":"1"}},{type:"element",name:"w:numFmt",attributes:{"w:val":"lowerLetter"}},{type:"element",name:"w:lvlText",attributes:{"w:val":"%5."}},{type:"element",name:"w:lvlJc",attributes:{"w:val":"left"}},{type:"element",name:"w:pPr",elements:[{type:"element",name:"w:ind",attributes:{"w:left":"3600","w:hanging":"360"}}]}]},{type:"element",name:"w:lvl",attributes:{"w:ilvl":"5","w:tplc":"0409001B","w:tentative":"1"},elements:[{type:"element",name:"w:start",attributes:{"w:val":"1"}},{type:"element",name:"w:numFmt",attributes:{"w:val":"lowerRoman"}},{type:"element",name:"w:lvlText",attributes:{"w:val":"%6."}},{type:"element",name:"w:lvlJc",attributes:{"w:val":"right"}},{type:"element",name:"w:pPr",elements:[{type:"element",name:"w:ind",attributes:{"w:left":"4320","w:hanging":"180"}}]}]},{type:"element",name:"w:lvl",attributes:{"w:ilvl":"6","w:tplc":"0409000F","w:tentative":"1"},elements:[{type:"element",name:"w:start",attributes:{"w:val":"1"}},{type:"element",name:"w:numFmt",attributes:{"w:val":"decimal"}},{type:"element",name:"w:lvlText",attributes:{"w:val":"%7."}},{type:"element",name:"w:lvlJc",attributes:{"w:val":"left"}},{type:"element",name:"w:pPr",elements:[{type:"element",name:"w:ind",attributes:{"w:left":"5040","w:hanging":"360"}}]}]},{type:"element",name:"w:lvl",attributes:{"w:ilvl":"7","w:tplc":"04090019","w:tentative":"1"},elements:[{type:"element",name:"w:start",attributes:{"w:val":"1"}},{type:"element",name:"w:numFmt",attributes:{"w:val":"lowerLetter"}},{type:"element",name:"w:lvlText",attributes:{"w:val":"%8."}},{type:"element",name:"w:lvlJc",attributes:{"w:val":"left"}},{type:"element",name:"w:pPr",elements:[{type:"element",name:"w:ind",attributes:{"w:left":"5760","w:hanging":"360"}}]}]},{type:"element",name:"w:lvl",attributes:{"w:ilvl":"8","w:tplc":"0409001B","w:tentative":"1"},elements:[{type:"element",name:"w:start",attributes:{"w:val":"1"}},{type:"element",name:"w:numFmt",attributes:{"w:val":"lowerRoman"}},{type:"element",name:"w:lvlText",attributes:{"w:val":"%9."}},{type:"element",name:"w:lvlJc",attributes:{"w:val":"right"}},{type:"element",name:"w:pPr",elements:[{type:"element",name:"w:ind",attributes:{"w:left":"6480","w:hanging":"180"}}]}]}]},{type:"element",name:"w:num",attributes:{"w:numId":"1","w16cid:durableId":"100147962"},elements:[{type:"element",name:"w:abstractNumId",attributes:{"w:val":"0"}}]},{type:"element",name:"w:num",attributes:{"w:numId":"2","w16cid:durableId":"485517411"},elements:[{type:"element",name:"w:abstractNumId",attributes:{"w:val":"1"}}]}]}]};function Dg(t,e){const{node:n,commentsExportType:r,exportedCommentDefs:o=[]}=t;if(!o.length||r==="clean")return;const i=n.attrs["w:id"],s=t.comments.find(p=>p.commentId==i);if(!s)return;const a=t.comments?.findIndex(p=>p.commentId===s.commentId),l=s.parentCommentId;let c;l&&(c=t.comments.find(p=>p.commentId===l||p.importedId===l));const u=c?.isInternal||s.isInternal;if(r==="external"&&u||s.resolvedTime)return;let d=ZE(e,a);if(e==="End"){const p={name:"w:r",elements:[{name:"w:commentReference",attributes:{"w:id":String(a)}}]};d=[d,p]}return d}const ZE=(t,e)=>({name:`w:commentRange${t}`,attributes:{"w:id":String(e)}}),QE=t=>({...t,commentParaId:lf()}),e4=(t,e,n,r)=>{const o=jv({editor:r,node:t.commentJSON}),i={"w:id":String(e),"w:author":t.creatorName||t.importedAuthor?.name,"w:email":t.creatorEmail||t.importedAuthor?.email,"w:date":Pv(t.createdTime),"w:initials":t4(t.creatorName),"w:done":t.resolvedTime?"1":"0","w15:paraId":t.commentParaId,"custom:internalId":t.commentId||t.internalId,"custom:trackedChange":t.trackedChange,"custom:trackedChangeText":t.trackedChangeText||null,"custom:trackedChangeType":t.trackedChangeType,"custom:trackedDeletedText":t.deletedText||null};if(t?.parentCommentId){const s=n.find(a=>a.commentId===t.parentCommentId);i["w15:paraIdParent"]=s.commentParaId}return{type:"element",name:"w:comment",attributes:i,elements:[o]}},t4=t=>t?t.replace("(imported)","").trim().split(" ").map(e=>e[0]).join(""):null,Pv=t=>new Date(t||Date.now()).toISOString().replace(/\.\d{3}Z$/,"Z"),n4=(t=[],e)=>{const n=Qt(e);return t.forEach(r=>{r.elements[0].elements.unshift(VE);const o=r.attributes["w15:paraId"];r.elements[0].attributes["w14:paraId"]=o,r.attributes={"w:id":r.attributes["w:id"],"w:author":r.attributes["w:author"],"w:email":r.attributes["w:email"],"w:date":r.attributes["w:date"],"w:initials":r.attributes["w:initials"],"custom:internalId":r.attributes["custom:internalId"],"custom:trackedChange":r.attributes["custom:trackedChange"],"custom:trackedChangeText":r.attributes["custom:trackedChangeText"],"custom:trackedChangeType":r.attributes["custom:trackedChangeType"],"custom:trackedDeletedText":r.attributes["custom:trackedDeletedText"],"xmlns:custom":"http://schemas.openxmlformats.org/wordprocessingml/2006/main"}}),n.elements[0].elements=t,n},r4=(t=[],e)=>{const n=Qt(e),r=t.map(o=>{const i={"w15:paraId":o.commentParaId,"w15:done":o.resolvedTime?"1":"0"},s=o.parentCommentId;if(s){const a=t.find(l=>l.commentId===s);i["w15:paraIdParent"]=a.commentParaId}return{type:"element",name:"w15:commentEx",attributes:i}});return n.elements[0].elements=r,n},o4=(t=[],e,n)=>{const r=Qt(e),o=Qt(n);return r.elements[0].elements=[],o.elements[0].elements=[],t.forEach(i=>{const s=lf(),a={type:"element",name:"w16cid:commentId",attributes:{"w16cid:paraId":i.commentParaId,"w16cid:durableId":s}};r.elements[0].elements.push(a);const l={type:"element",name:"w16cex:commentExtensible",attributes:{"w16cex:durableId":s,"w16cex:dateUtc":Pv()}};o.elements[0].elements.push(l)}),{documentIdsUpdated:r,extensibleUpdated:o}},i4=t=>{const e=Qt(t);return e["word/comments.xml"]=Po.COMMENTS_XML_DEF,e["word/commentsExtended.xml"]=Po.COMMENTS_EXTENDED_XML_DEF,e["word/commentsExtensible.xml"]=Po.COMMENTS_EXTENSIBLE_XML_DEF,e["word/commentsIds.xml"]=Po.COMMENTS_IDS_XML_DEF,e["[Content_Types].xml"]=Po.CONTENT_TYPES,e},s4=t=>{const e=Qt(t);return delete e["word/comments.xml"],delete e["word/commentsExtended.xml"],delete e["word/commentsExtensible.xml"],delete e["word/commentsIds.xml"],e},sa=t=>({...Po.DOCUMENT_RELS_XML_DEF.elements[0].elements.find(e=>e.attributes.Target===t)}),a4=({convertedXml:t,defs:e,commentsWithParaIds:n,exportType:r,converter:o})=>{const i=[];if(r==="clean")return{documentXml:s4(t),relationships:i};const s=i4(t);s["word/comments.xml"]=n4(e,s["word/comments.xml"]),i.push(sa("comments.xml")),s["word/commentsExtended.xml"]=r4(n,s["word/commentsExtended.xml"]),i.push(sa("commentsExtended.xml"));const{documentIdsUpdated:a,extensibleUpdated:l}=o4(n,s["word/commentsIds.xml"],s["word/commentsExtensible.xml"]);return s["word/commentsIds.xml"]=a,s["word/commentsExtensible.xml"]=l,i.push(sa("commentsIds.xml")),i.push(sa("commentsExtensible.xml")),{relationships:i,documentXml:s}},Fd=(t,e)=>e?["width",`${Math.max(e,t)}px`]:["min-width",`${t}px`],zv=(t,e,n,r)=>{let o=0,i=!0;const s=[],a=[],l=t.firstChild;if(!l)return{};for(let f=0,h=0;f<l.childCount;f++){const{colspan:m,colwidth:y}=l.child(f).attrs;for(let g=0;g<m;g++,h++){const v=n===h?r:y&&y[g];o+=v||e,v||(i=!1);const[k,b]=Fd(e,v);s.push(["col",{style:`${k}: ${b}`}]),a.push(parseInt(b,10))}}const c=i?`${o}px`:"",u=i?"":`${o}px`,d=["colgroup",{},...s],p=[...a];return{colgroup:d,tableWidth:c,tableMinWidth:u,colgroupValues:p}};function ki(t){const{type:e}=t.node||{},n={doc:u4,body:l4,paragraph:jv,text:d4,bulletList:Ng,orderedList:Ng,lineBreak:b4,table:v4,tableRow:E4,tableCell:$4,bookmarkStart:D4,fieldAnnotation:L4,tab:k4,image:Hv,hardBreak:P4,commentRangeStart:()=>Dg(t,"Start"),commentRangeEnd:()=>Dg(t,"End"),commentReference:()=>null,shapeContainer:z4,shapeTextbox:j4,contentBlock:q4,structuredContent:H4};return n[e]?n[e](t):(console.error("No translation function found for node type:",e),null)}function l4(t){const e=t.bodyNode?.elements.find(r=>r.name==="w:sectPr")||{};if(t.converter){const r=t.converter.pageStyles.pageMargins,o=e.elements.find(s=>s.name==="w:pgMar"),{attributes:i}=o;Object.entries(r).forEach(([s,a])=>{const l=ii(a);i[`w:${s}`]=l}),o.attributes=i}const n=lr(t);return t.isHeaderFooter?{name:"w:body",elements:[...n]}:{name:"w:body",elements:[...n,e]}}function jv(t){const e=lr(t),n=e.find(i=>i.name==="htmlAnnotation");if(n)return n.elements;const r=c4(t.node);r&&e.unshift(r);let o={};return t.node.attrs?.rsidRDefault&&(o["w:rsidRDefault"]=t.node.attrs.rsidRDefault),{name:"w:p",elements:e,attributes:o}}function c4(t){const{attrs:e={}}=t,n=[],{styleId:r}=e;r&&n.push({name:"w:pStyle",attributes:{"w:val":r}});const{spacing:o,indent:i,textAlign:s,textIndent:a,lineHeight:l,marksAttrs:c,keepLines:u,keepNext:d,dropcap:p}=e;if(o){const{lineSpaceBefore:h,lineSpaceAfter:m,line:y,lineRule:g}=o,v={};h>=0&&(v["w:before"]=at(h)),m>=0&&(v["w:after"]=at(m)),g==="exact"?l&&(v["w:line"]=_E(parseFloat(l))):l&&(v["w:line"]=Nd(l)),v["w:lineRule"]=g||"auto";const k={name:"w:spacing",attributes:v};n.push(k)}if(l&&!o){const h={name:"w:spacing",attributes:{"w:line":Nd(l)}};n.push(h)}if(i){const{left:h,right:m,firstLine:y,hanging:g}=i,v={};(h||h===0)&&(v["w:left"]=at(h)),(m||m===0)&&(v["w:right"]=at(m)),(y||y===0)&&(v["w:firstLine"]=at(y)),(g||g===0)&&(v["w:hanging"]=at(g)),a&&!v["w:left"]&&(v["w:left"]=ii(a));const k={name:"w:ind",attributes:v};n.push(k)}else if(a){const h={name:"w:ind",attributes:{"w:left":ii(a)}};n.push(h)}if(s){const h={name:"w:jc",attributes:{"w:val":s==="justify"?"both":s}};n.push(h)}if(c){const h=ec(c),m=qv(h);n.push(m)}u&&n.push({name:"w:keepLines",attributes:{"w:val":u}}),d&&n.push({name:"w:keepNext",attributes:{"w:val":d}}),p&&n.push({name:"w:framePr",attributes:{"w:dropCap":p.type,"w:lines":p.lines,"w:wrap":p.wrap,"w:vAnchor":p.vAnchor,"w:hAnchor":p.hAnchor}});const f=t.attrs?.paragraphProperties?.sectPr;return f&&n.push(f),n.length?{name:"w:pPr",elements:n}:null}function u4(t){const e={type:"body",content:t.node.content};return[{name:"w:document",elements:[ki({...t,node:e})],attributes:zE},t]}function lr(t){const{content:e}=t.node;if(!e)return[];const n=[];return e.forEach(r=>{let o=ki({...t,node:r});o?.name||o?.type,o instanceof Array?n.push(...o):n.push(o)}),n.filter(r=>r)}function Ql(t,e,n){const r=/^\s|\s$/.test(t)?"preserve":null,o=r?{"xml:space":r}:null,i=[],s=ec(e);if(i.push({name:"w:t",elements:[{text:t,type:"text"}],attributes:o}),n){const{editor:a}=n,l=a.extensionService.extensions.filter(c=>c.isExternal===!0);e.forEach(c=>{const u=l.some(p=>{const f=p.name;return c.type===f});if(!u)return;let d="";Object.entries(c.attrs).forEach(([p,f])=>{f&&(d+=`${p}=${f};`)}),u&&(i.unshift({type:"element",name:"w:bookmarkStart",attributes:{"w:id":"5000","w:name":c.type+";"+d}}),i.push({type:"element",name:"w:bookmarkEnd",attributes:{"w:id":"5000"}}))})}return Hs(i,s)}function d4(t){const{node:e}=t,n=[It,ut];if(e.marks?.some(i=>n.includes(i.type)))return f4(t);if(e.marks?.some(i=>i.type==="link"))return h4(t);const{text:r,marks:o=[]}=e;return Ql(r,o,t)}function p4(t){const e=t.find(n=>n.type===vt);if(e)return{type:"element",name:"w:rPrChange",attributes:{"w:id":e.attrs.id,"w:author":e.attrs.author,"w:authorEmail":e.attrs.authorEmail,"w:date":e.attrs.date},elements:e.attrs.before.map(n=>ec([n])).filter(n=>n!==void 0)}}function f4(t){const{node:e}=t,n=e.marks,r=[It,ut,vt],o=n.find(l=>r.includes(l.type)),i=o.type===It,s=p4(n);e.marks=n.filter(l=>!r.includes(l.type)),s&&e.marks.push(s);const a=ki({...t,node:e});if(!i){const l=a.elements.find(c=>c.name==="w:t");l.name="w:delText"}return{name:i?"w:ins":"w:del",type:"element",attributes:{"w:id":o.attrs.id,"w:author":o.attrs.author,"w:authorEmail":o.attrs.authorEmail,"w:date":o.attrs.date},elements:[a]}}function Hs(t,e){let n=[];return Array.isArray(t)?n=t:n=[t],e&&e.length&&n.unshift(qv(e)),{name:"w:r",elements:n}}function qv(t=[]){return{name:"w:rPr",elements:t.filter(e=>!!Object.keys(e).length)}}function ec(t=[]){return t.flatMap(e=>e.type==="textStyle"?Object.entries(e.attrs).filter(([n,r])=>r).map(([n,r])=>{const o={type:n,attrs:e.attrs};return Ig(o)}):Ig(e))}function h4(t){const{node:e}=t,n=e.marks.find(a=>a.type==="link"),r=n.attrs.href;let o=n.attrs.rId;o||(o=Uv(t,r)),e.marks=e.marks.filter(a=>a.type!=="link");const i=ki({...t,node:e}),s=Vv(i);return{name:"w:hyperlink",type:"element",attributes:{"r:id":o},elements:[s]}}function Vv(t){if(!t)return t;const e=Qt(t);if(!e)return e;const n={name:"w:rStyle",attributes:{"w:val":"Hyperlink"}},r={name:"w:color",attributes:{"w:val":"467886"}};if(e.name==="w:r"){const o=e.elements.find(i=>i.name==="w:rPr");if(o){const i=o.elements.find(a=>a.name==="w:color"),s=o.elements.find(a=>a.name==="w:rStyle");i||o.elements.unshift(r),s||o.elements.unshift(n)}else{const i={name:"w:rPr",elements:[n,r]};e.elements.unshift(i)}}return e}function Uv(t,e){const n="rId"+Yn();return(!t.relationships||!Array.isArray(t.relationships))&&(t.relationships=[]),t.relationships.push({type:"element",name:"Relationship",attributes:{Id:n,Type:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink",Target:e,TargetMode:"External"}}),n}function _g(t,e){const n="rId"+Yn(),r={type:"element",name:"Relationship",attributes:{Id:n,Type:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/image",Target:e}};return t.relationships.push(r),n}function Ng(t){const{type:e}=t.node,n=w4(t),r=[];return n.forEach(o=>{const{level:i,listType:s,pPrs:a,content:l,attrs:c={}}=o,u=(o.attrs.numId||o.listId)??m4(t,s),d=y4(i,u,a);l.forEach((p,f)=>{const h=Object.assign({},p);h.attrs={...h.attrs,...o.attrs};const m=ki({...t,node:h});m.elements||(m.elements=[]);const y=m.elements.findIndex(D=>D.name==="w:pPr");if(!m.elements.filter(D=>D.name!=="w:pPr").length){const D={name:"w:p",type:"element",elements:p.attrs.paragraphProperties?[p.attrs.paragraphProperties]:[]};return r.push(D)}const{attributes:g}=c,{originalInlineRunProps:v}=g||{};if(v&&d.elements.push(v),y===-1)m.elements.unshift(Qt(d));else{const D=Qt(d).elements.map(M=>m.elements[y].elements.find(E=>E.name===M.name)||M);m.elements[y].elements=D}let k;o.attrs?.importedFontSize&&(k={name:"w:sz",attributes:{"w:val":parseInt(o.attrs.importedFontSize.split("pt")[0])*2}});let b;o.attrs?.importedFontFamily&&(b={name:"w:rFonts",attributes:{"w:ascii":o.attrs?.importedFontFamily,"w:hAnsi":o.attrs?.importedFontFamily}});const C=m.elements.find(D=>D.name==="w:rPr");if(C)C.elements.push(fontSize);else if(k||b){const D=[];k&&D.push(k),b&&D.push(b),m.elements.unshift({name:"w:rPr",elements:D})}if(f!==0){const D=m.elements.find(I=>I.name==="w:pPr"),M=D.elements.findIndex(I=>I.name==="w:numPr");M!==-1&&D.elements.splice(M,1)}r.push(m)})}),r}function m4(t,e){const n=g4(t.converter?.numbering?.definitions),r=e==="bullet"?YE:XE,o=n,i=r.attributes["w:abstractNumId"],s={type:"element",name:"w:num",attributes:{"w:numId":String(o),"w16cid:durableId":"485517411"},elements:[{name:"w:abstractNumId",attributes:{"w:val":String(i)}}]};return t.converter.numbering.definitions[o]=s,o}const g4=t=>!t||!Object.keys(t).length?0:Math.max(...Object.keys(t).map(e=>parseInt(e,10)))+1;function y4(t,e,n=[]){return{name:"w:pPr",type:"element",elements:[{name:"w:numPr",type:"element",elements:[{name:"w:ilvl",type:"element",attributes:{"w:val":t}},{name:"w:numId",type:"element",attributes:{"w:val":e}}]},...n]}}function w4({node:t}){const{content:e,attrs:n={}}=t,{listId:r,syncId:o}=t.attrs||{},i=t.attrs["list-style-type"],{attributes:s={}}=n,a=s?.parentAttributes?.paragraphProperties?.elements?.filter(u=>u.name!=="w:numPr")||[],l=[];function c(u,d=0){!u||!u.length||u.forEach(p=>{const f=p.attrs?.indent;if(f){const{left:g,right:v,firstLine:k,hanging:b}=f,C={};g!==void 0&&(C["w:left"]=at(g)),v!==void 0&&(C["w:right"]=at(v)),k!==void 0&&(C["w:firstLine"]=at(k)),b!==void 0&&(C["w:hanging"]=at(b));const D={type:"element",name:"w:ind",attributes:C},M=a.findIndex(I=>I.name==="w:ind");M!==-1&&(a[M]=D)}const h=p.content?.filter(g=>g.type==="bulletList"||g.type==="orderedList")||[],m=p.content?.filter(g=>g.type!=="bulletList"&&g.type!=="orderedList")||[],y={...p,content:m,listId:r,level:d,listType:i,syncId:o,pPrs:a};l.push(y),h.length&&c(h[0].content,d+1)})}return c(e),l}function b4(t){const e={},{lineBreakType:n}=t.node?.attrs||{};return n&&(e["w:type"]=n),{name:"w:br",attributes:e}}function v4(t){t.node=x4(t.node,t);const e=lr(t),n=S4(t.node),r=C4(t.node,t);return e.unshift(n),e.unshift(r),{name:"w:tbl",elements:e}}function x4(t,{editorSchema:e}){const{content:n}=t;for(let r=0;r<n.length;r++){const o=n[r];if(o.content)for(let i=0;i<o.content?.length;i++){const s=o.content[i];if(!s){console.log("no cell");continue}const{attrs:a}=s;if(a.rowspan>1){const l=n.slice(r+1,r+a.rowspan),c={type:s.type,content:[e.nodes.paragraph.createAndFill().toJSON()],attrs:{...s.attrs,colspan:null,rowspan:null,continueMerge:!0}};l.forEach((u,d)=>{u.content.splice(i,0,c)})}}}return t}function k4(t){const{marks:e=[]}=t.node,n=ec(e);return Hs({name:"w:tab"},n)}function S4(t){const e=[],{attrs:n}=t,{tableWidth:r,tableWidthType:o,tableStyleId:i,borders:s,tableIndent:a,tableLayout:l,tableCellSpacing:c}=n;if(i){const u={name:"w:tblStyle",attributes:{"w:val":i}};e.push(u)}if(s){const u=A4(t);e.push(u)}if(a){const{width:u,type:d}=a,p={name:"w:tblInd",attributes:{"w:w":at(u),"w:type":d}};e.push(p)}if(l){const u={name:"w:tblLayout",attributes:{"w:type":l}};e.push(u)}if(r&&r.width){const u={name:"w:tblW",attributes:{"w:w":at(r.width),"w:type":r.type}};e.push(u)}return c&&e.push({name:"w:tblCellSpacing",attributes:{"w:w":c.w,"w:type":c.type}}),{name:"w:tblPr",elements:e}}function A4(t){const{borders:e}=t.attrs,n=[];return e?(["top","bottom","left","right","insideH","insideV"].forEach(r=>{const o=e[r];if(!o)return;let i={};!Object.keys(o).length||!o.size?i={"w:val":"nil"}:i={"w:val":"single","w:sz":Rv(o.size),"w:space":o.space||0,"w:color":o?.color?.substring(1)||"000000"};const s={name:`w:${r}`,attributes:i};n.push(s)}),{name:"w:tblBorders",elements:n}):void 0}function C4(t,e){const{editorSchema:n}=e;let r=[];try{const i=n.nodeFromJSON(t),s=25,{colgroupValues:a}=zv(i,s);r=a}catch{r=[]}const o=[];return r?.forEach(i=>{o.push({name:"w:gridCol",attributes:{"w:w":at(i)}})}),{name:"w:tblGrid",elements:o}}function E4(t){const e=lr(t),n=T4(t.node);return n.elements.length&&e.unshift(n),{name:"w:tr",elements:e}}function T4(t){const{attrs:e}=t,n=[],{rowHeight:r,rowHeightType:o}=e;if(r){const i={"w:val":at(r)};o&&(i["w:hRule"]=o);const s={name:"w:trHeight",attributes:i};n.push(s)}return{name:"w:trPr",elements:n}}function $4(t){const e=lr({...t,tableCell:t.node}),n=O4(t.node);return e.unshift(n),{name:"w:tc",elements:e}}function O4(t){const e=[],{attrs:n}=t,{colwidth:r=[],cellWidthType:o="dxa",background:i={},colspan:s,rowspan:a,widthUnit:l}=n,c=r.reduce((m,y)=>m+y,0),u={name:"w:tcW",attributes:{"w:w":l==="px"?at(c):ii(c),"w:type":o}};if(e.push(u),s){const m={name:"w:gridSpan",attributes:{"w:val":`${s}`}};e.push(m)}const{color:d}=i||{};if(d){const m={name:"w:shd",attributes:{"w:fill":d}};e.push(m)}const{cellMargins:p}=n;if(p){const m={name:"w:tcMar",elements:M4(p)};e.push(m)}const{verticalAlign:f}=n;if(f){const m={name:"w:vAlign",attributes:{"w:val":f}};e.push(m)}if(a&&a>1){const m={name:"w:vMerge",type:"element",attributes:{"w:val":"restart"}};e.push(m)}else if(n.continueMerge){const m={name:"w:vMerge",type:"element"};e.push(m)}const{borders:h={}}=n;if(h&&Object.keys(h).length){const m={name:"w:tcBorders",elements:Object.entries(h).map(([y,g])=>g.size?{name:`w:${y}`,attributes:{"w:val":"single","w:color":g.color?g.color.substring(1):"auto","w:sz":Rv(g.size),"w:space":g.space||0}}:{name:`w:${y}`,attributes:{"w:val":"nil"}})};e.push(m)}return{name:"w:tcPr",elements:e}}function M4(t){const e=[],{top:n,right:r,bottom:o,left:i}=t;return n!=null&&e.push({name:"w:top",attributes:{"w:w":at(n)}}),r!=null&&e.push({name:"w:right",attributes:{"w:w":at(r)}}),o!=null&&e.push({name:"w:bottom",attributes:{"w:w":at(o)}}),i!=null&&e.push({name:"w:left",attributes:{"w:w":at(i)}}),e}function D4(t){const e={name:"w:bookmarkStart",attributes:{"w:id":t.node.attrs.id,"w:name":t.node.attrs.name}},n={name:"w:bookmarkEnd",attributes:{"w:id":t.node.attrs.id}};return[e,n]}function Ig(t){const e=Nr.markTypes.find(i=>i.type===t.type);if(!e)return{};const n={name:e.name,attributes:{}},{attrs:r}=t;let o;switch(t.type){case"bold":case"italic":delete n.attributes,n.type="element";break;case"underline":n.type="element",n.attributes["w:val"]=r.underlineType;break;case"fontSize":o=r.fontSize,n.attributes["w:val"]=o.slice(0,-2)*2;break;case"fontFamily":o=r.fontFamily,["w:ascii","w:eastAsia","w:hAnsi","w:cs"].forEach(s=>{const a=o.split(", ");n.attributes[s]=a[0]?a[0]:o});break;case"color":let i=r.color.replace(/^#/,"").replace(/;$/,"");i.startsWith("rgb")&&(i=LE(i)),n.attributes["w:val"]=i;break;case"textAlign":n.attributes["w:val"]=r.textAlign;break;case"textIndent":n.attributes["w:firstline"]=ii(r.textIndent);break;case"lineHeight":n.attributes["w:line"]=Nd(r.lineHeight);break;case"highlight":n.attributes["w:fill"]=r.color?.substring(1),n.attributes["w:color"]="auto",n.attributes["w:val"]="clear",n.name="w:shd";break}return n}function _4(t){if(!t)return{};const e=t.split(";")[0].split("/")[1];if(!t||e!=="png")return{originalWidth:void 0,originalHeight:void 0};let n=t.split(",")[1].slice(0,50),r=Uint8Array.from(atob(n),i=>i.charCodeAt(0)),o=new DataView(r.buffer,0,28);return{originalWidth:o.getInt32(16),originalHeight:o.getInt32(20)}}function N4(t,e,n,r){let o=t,i=e,s=Math.min(n/t,r/e);return o=Math.round(o*s),i=Math.round(i*s),{scaledWidth:o,scaledHeight:i}}function Hv(t,e){const{node:{attrs:n={},marks:r=[]},tableCell:o}=t;let i=n.rId;const s=n.src||n.imageSrc,{originalWidth:a,originalHeight:l}=_4(s);let c=n.size?{w:Vr(n.size.width),h:Vr(n.size.height)}:e;if(a&&l){const m=Gt(c.w),y=Gt(c.h),{scaledWidth:g,scaledHeight:v}=N4(a,l,m,y);c={w:Vr(g),h:Vr(v)}}if(o){const m=o.attrs.colwidth.reduce((C,D)=>C+D,0),y=o.attrs.cellMargins?.left||8,g=o.attrs.cellMargins?.right||8,v=Vr(m-(y+g)),{width:k,height:b}=V4(c.w,c.h,v);k&&b&&(c={w:k,h:b})}if(t.node.type==="image"&&!i){const m=s?.split("word/")[1];i=_g(t,m)}else if(t.node.type==="fieldAnnotation"&&!i){const m=s?.split(";")[0].split("/")[1];if(!m)return Wv(t);const y=Yn(4),g=n.fieldId.replace("-","_"),v=`media/${g}_${y}.${m}`;i=_g(t,v),t.media[`${g}_${y}.${m}`]=s}let u=n.originalPadding||{distT:0,distB:0,distL:0,distR:0};const d=[];let p=[];n.isAnchor&&(u={...u,simplePos:n.originalAttributes?.simplePos,relativeHeight:1,behindDoc:n.originalAttributes?.behindDoc,locked:n.originalAttributes?.locked,layoutInCell:n.originalAttributes?.layoutInCell,allowOverlap:n.originalAttributes?.allowOverlap},n.simplePos&&d.push({name:"wp:simplePos",attributes:{x:0,y:0}}),n.anchorData&&(d.push({name:"wp:positionH",attributes:{relativeFrom:n.anchorData.hRelativeFrom},...n.marginOffset.left&&{elements:[{name:"wp:posOffset",elements:[{type:"text",text:Vr(n.marginOffset.left).toString()}]}]},...n.anchorData.alignH&&{elements:[{name:"wp:align",elements:[{type:"text",text:n.anchorData.alignH}]}]}}),d.push({name:"wp:positionV",attributes:{relativeFrom:n.anchorData.vRelativeFrom},...n.marginOffset.top&&{elements:[{name:"wp:posOffset",elements:[{type:"text",text:Vr(n.marginOffset.top).toString()}]}]},...n.anchorData.alignV&&{elements:[{name:"wp:align",elements:[{type:"text",text:n.anchorData.alignV}]}]}})),n.wrapText&&p.push({name:"wp:wrapSquare",attributes:{wrapText:n.wrapText}}),n.wrapTopAndBottom&&p.push({name:"wp:wrapTopAndBottom"}));const f="http://schemas.openxmlformats.org/drawingml/2006/main",h="http://schemas.openxmlformats.org/drawingml/2006/picture";return Hs({name:"w:drawing",elements:[{name:n.isAnchor?"wp:anchor":"wp:inline",attributes:u,elements:[...d,{name:"wp:extent",attributes:{cx:c.w,cy:c.h}},{name:"wp:effectExtent",attributes:{l:0,t:0,r:0,b:0}},...p,{name:"wp:docPr",attributes:{id:n.id||0,name:n.alt,descr:n.title}},{name:"wp:cNvGraphicFramePr",elements:[{name:"a:graphicFrameLocks",attributes:{"xmlns:a":f,noChangeAspect:1}}]},{name:"a:graphic",attributes:{"xmlns:a":f},elements:[{name:"a:graphicData",attributes:{uri:h},elements:[{name:"pic:pic",attributes:{"xmlns:pic":h},elements:[{name:"pic:nvPicPr",elements:[{name:"pic:cNvPr",attributes:{id:n.id||0,name:n.title}},{name:"pic:cNvPicPr",elements:[{name:"a:picLocks",attributes:{noChangeAspect:1,noChangeArrowheads:1}}]}]},{name:"pic:blipFill",elements:[{name:"a:blip",attributes:{"r:embed":i}},{name:"a:stretch",elements:[{name:"a:fillRect"}]}]},{name:"pic:spPr",attributes:{bwMode:"auto"},elements:[{name:"a:xfrm",elements:[{name:"a:ext",attributes:{cx:c.w,cy:c.h}},{name:"a:off",attributes:{x:0,y:0}}]},{name:"a:prstGeom",attributes:{prst:"rect"},elements:[{name:"a:avLst"}]},{name:"a:noFill"}]}]}]}]}]}]},[])}function Wv(t){const{node:{attrs:e={},marks:n=[]}}=t,r=Gv(e);return Ql(e.displayLabel,[...n,...r],t)}function I4(t){const{node:{attrs:e={},marks:n=[]}}=t,r=TC.decode(e.displayLabel);return Ql(r,n,t)}function F4(t){const{node:{attrs:e={},marks:n=[]},editorSchema:r}=t,o=new window.DOMParser().parseFromString(e.rawHtml||e.displayLabel,"text/html"),i=Gv(e),s=[...n,...i];let a=Zi.create({doc:er.fromSchema(r).parse(o)});s.length&&(a=U4(a,s));const l=a.doc.toJSON();return{name:"htmlAnnotation",elements:lr({...t,node:l})}}function Fg(t,e){return Hv(t,e)}function R4(t){const{node:{attrs:e={},marks:n=[]}}=t,r=Uv(t,e.linkUrl),o=Ql(e.linkUrl,n,t),i=Vv(o);return{name:"w:hyperlink",type:"element",attributes:{"r:id":r,"w:history":1},elements:[i]}}function B4(t){const e={w:4286250,h:4286250},n={w:99e4,h:495e3};return{text:Wv,image:r=>Fg(r,e),signature:r=>Fg(r,n),checkbox:I4,html:F4,link:R4}[t]}const Gv=(t={})=>{const{fontFamily:e,fontSize:n,bold:r,underline:o,italic:i,textColor:s,textHighlight:a}=t,l=[];return e&&l.push({type:"fontFamily",attrs:{fontFamily:e}}),n&&l.push({type:"fontSize",attrs:{fontSize:n}}),r&&l.push({type:"bold",attrs:{}}),o&&l.push({type:"underline",attrs:{}}),i&&l.push({type:"italic",attrs:{}}),s&&l.push({type:"color",attrs:{color:s}}),a&&l.push({type:"highlight",attrs:{color:a}}),l};function L4(t){const{node:e,isFinalDoc:n}=t,{attrs:r={}}=e,o=B4(r.type);if(!o)return{};let i,s;if(n)return o(t);i=o(t),s=[i],r.type==="html"&&(s=[...i.elements]);const a="http://schemas.openxmlformats.org/wordprocessingml/2006/main";return{name:"w:sdt",elements:[{name:"w:sdtPr",elements:[{name:"w:tag",attributes:{"w:val":r.fieldId}},{name:"w:alias",attributes:{"w:val":r.displayLabel}},{name:"w:fieldType",attributes:{"xmlns:w":a,"w:val":r.fieldType}},{name:"w:fieldTypeShort",attributes:{"xmlns:w":a,"w:val":r.type}},{name:"w:fieldColor",attributes:{"xmlns:w":a,"w:val":r.fieldColor}},{name:"w:fieldMultipleImage",attributes:{"xmlns:w":a,"w:val":r.multipleImage}},{name:"w:fieldFontFamily",attributes:{"xmlns:w":a,"w:val":r.fontFamily}},{name:"w:fieldFontSize",attributes:{"xmlns:w":a,"w:val":r.fontSize}},{name:"w:fieldTextColor",attributes:{"xmlns:w":a,"w:val":r.textColor}},{name:"w:fieldTextHighlight",attributes:{"xmlns:w":a,"w:val":r.textHighlight}}]},{name:"w:sdtContent",elements:s}]}}function P4(t){const{node:e={}}=t,{attrs:n={}}=e,{pageBreakSource:r}=n;return r==="sectPr"?null:{name:"w:r",elements:[{name:"w:br",type:"element",attributes:{"w:type":"page"}}]}}function z4(t){const{node:e}=t,n=lr(t),r={name:"v:shape",attributes:{...e.attrs.attributes,fillcolor:e.attrs.fillcolor},elements:[...n,...e.attrs.wrapAttributes?[{name:"w10:wrap",attributes:{...e.attrs.wrapAttributes}}]:[]]},o={name:"w:pict",attributes:{"w14:anchorId":Math.floor(Math.random()*4294967295).toString()},elements:[r]};return{name:"w:p",elements:[Hs(o)]}}function j4(t){const{node:e}=t,n={name:"w:txbxContent",elements:lr(t)};return{name:"v:textbox",attributes:{...e.attrs.attributes},elements:[n]}}function q4(t){const{node:e}=t,{drawingContent:n}=e.attrs,r={name:"w:drawing",elements:[...n?[...n.elements||[]]:[]]};return{name:"w:p",elements:[Hs({name:"mc:AlternateContent",elements:[{name:"mc:Choice",attributes:{Requires:"wps"},elements:[r]}]})]}}var Jr,Kv,Au,Cu;let Rg=class{constructor(e){ab(this,Jr),this.converter=e}schemaToXml(e,n=!1){return Dn(this,Jr,Kv).call(this,e,n).join("")}};Jr=new WeakSet,Kv=function(t,e=falase){const n=JSON.parse(JSON.stringify(t)),r=this.converter.declaration.attributes,o=`<?xml${Object.entries(r).map(([s,a])=>` ${s}="${a}"`).join("")}?>`,i=Dn(this,Jr,Cu).call(this,n,e);return[o,...i]},Au=function(t){if(t)return t.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")},Cu=function(t,e=!1){if(!t)return null;let{name:n}=t;const{elements:r,attributes:o}=t;let i=`<${n}`;for(let l in o){const c=typeof o[l]=="string"?Dn(this,Jr,Au).call(this,o[l]):o[l];i+=` ${l}="${c}"`}const s=n&&(!r||!r.length);s?i+=" />":i+=">";let a=[i];if(!n&&t.type==="text")return t.text;if(n==="w:instrText")a.push(r[0].text);else if(n==="w:t"||n==="w:delText"||n==="wp:posOffset"){const l=Dn(this,Jr,Au).call(this,r[0].text);a.push(l)}else if(r)for(let l of r){const c=Dn(this,Jr,Cu).call(this,l);if(!c)continue;if(typeof c=="string"){a.push(c);continue}const u=c.filter(d=>d!=="<undefined>"&&d!=="</undefined>");a.push(...u)}return s||a.push(`</${n}>`),a};function V4(t,e,n){if(t>n){let r=n/t,o=Math.round(e*r);return{width:n,height:o}}return{width:t,height:e}}function U4(t,e){const{tr:n,doc:r,schema:o}=t,i=["fontFamily","fontSize","highlight"];if(!e.some(d=>i.includes(d.type)))return t;const s=e.find(d=>d.type==="fontFamily"),a=e.find(d=>d.type==="fontSize"),l=e.find(d=>d.type==="highlight"),c=o.marks.textStyle,u=o.marks.highlight;return r.descendants((d,p)=>{if(!d.isText)return;const f=d.marks.find(m=>m.type.name==="textStyle"),h=d.marks.find(m=>m.type.name==="highlight");f?!f?.attrs.fontFamily&&s?n.addMark(p,p+d.nodeSize,c.create({...f?.attrs,...s.attrs})):!f?.attrs.fontSize&&a&&n.addMark(p,p+d.nodeSize,c.create({...f?.attrs,...a.attrs})):n.addMark(p,p+d.nodeSize,c.create({...s?.attrs,...a?.attrs})),h||n.addMark(p,p+d.nodeSize,u.create({...l?.attrs}))}),t.apply(n)}function H4(t){const{node:e}=t,{attrs:n={}}=e,r=[{name:"w:sdtContent",elements:lr({...t,nodes:e.content})}];return r.unshift(n.sdtPr),{name:"w:sdt",elements:r}}const W4='<w:document xmlns:wpc="http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas" xmlns:cx="http://schemas.microsoft.com/office/drawing/2014/chartex" xmlns:cx1="http://schemas.microsoft.com/office/drawing/2015/9/8/chartex" xmlns:cx2="http://schemas.microsoft.com/office/drawing/2015/10/21/chartex" xmlns:cx3="http://schemas.microsoft.com/office/drawing/2016/5/9/chartex" xmlns:cx4="http://schemas.microsoft.com/office/drawing/2016/5/10/chartex" xmlns:cx5="http://schemas.microsoft.com/office/drawing/2016/5/11/chartex" xmlns:cx6="http://schemas.microsoft.com/office/drawing/2016/5/12/chartex" xmlns:cx7="http://schemas.microsoft.com/office/drawing/2016/5/13/chartex" xmlns:cx8="http://schemas.microsoft.com/office/drawing/2016/5/14/chartex" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:aink="http://schemas.microsoft.com/office/drawing/2016/ink" xmlns:am3d="http://schemas.microsoft.com/office/drawing/2017/model3d" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:oel="http://schemas.microsoft.com/office/2019/extlst" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" xmlns:m="http://schemas.openxmlformats.org/officeDocument/2006/math" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:wp14="http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing" xmlns:wp="http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing" xmlns:w10="urn:schemas-microsoft-com:office:word" xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main" xmlns:w14="http://schemas.microsoft.com/office/word/2010/wordml" xmlns:w15="http://schemas.microsoft.com/office/word/2012/wordml" xmlns:w16cex="http://schemas.microsoft.com/office/word/2018/wordml/cex" xmlns:w16cid="http://schemas.microsoft.com/office/word/2016/wordml/cid" xmlns:w16="http://schemas.microsoft.com/office/word/2018/wordml" xmlns:w16sdtdh="http://schemas.microsoft.com/office/word/2020/wordml/sdtdatahash" xmlns:w16se="http://schemas.microsoft.com/office/word/2015/wordml/symex" xmlns:wpg="http://schemas.microsoft.com/office/word/2010/wordprocessingGroup" xmlns:wpi="http://schemas.microsoft.com/office/word/2010/wordprocessingInk" xmlns:wne="http://schemas.microsoft.com/office/word/2006/wordml" xmlns:wps="http://schemas.microsoft.com/office/word/2010/wordprocessingShape" mc:Ignorable="w14 w15 w16se w16cid w16 w16cex w16sdtdh wp14"><w:body></w:body></w:document>',G4=t=>JSON.parse(nf.xml2json(t,null,2)),K4=(t,e=W4)=>t["word/document.xml"]||G4(e),J4=t=>{const{nodes:e}=t;if(e.length===0)return{nodes:[],consumed:0};const n=e[0];switch(n.name){case"w:tbl":return{nodes:[Y4(n,t)],consumed:1}}return{nodes:[],consumed:0}},X4={handlerName:"tableNodeHandler",handler:J4};function Y4(t,e){const{docx:n,nodeListHandler:r}=e,o=t.elements.find(k=>k.name==="w:tblPr"),i=o.elements.find(k=>k.name==="w:tblBorders")?.elements||[],{borders:s,rowBorders:a}=Xv(i),l=o.elements.find(k=>k.name==="w:tblStyle"),c={tableStyleId:l?.attributes["w:val"]},u=o?.elements.find(k=>k.name==="w:tblInd");if(u){const{"w:w":k,"w:type":b}=u.attributes;c.tableIndent={width:nt(k),type:b}}const d=o?.elements.find(k=>k.name==="w:tblLayout");if(d){const{"w:type":k}=d.attributes;c.tableLayout=k}const p=Jv(l,n),f=o.elements.find(k=>k.name==="w:tblW");f&&(c.tableWidth={width:nt(f.attributes["w:w"]),type:f.attributes["w:type"]});const h=o.elements.find(k=>k.name==="w:tblCellSpacing");h&&(c.tableCellSpacing={w:h.attributes["w:w"],type:h.attributes["w:type"]},c.borderCollapse="separate");const m=t.elements.filter(k=>k.name==="w:tr"),y=Object.keys(s)?.length?s:p?.borders,g=Object.keys(a)?.length?a:p?.rowBorders;c.borders=y;const v=[];return m.forEach(k=>{const b=e6(k,t,g,l,e);b.content?.length&&v.push(b)}),{type:"table",content:v,attrs:c}}function Z4(t,e,n,r,o=null,i,s,a){const{docx:l,nodeListHandler:c}=s,u=t.elements.find(N=>N.name==="w:tcPr"),d=u?.elements?.find(N=>N.name==="w:tcBorders"),p=Q4(d,r),f=Yv(n),h=u?.elements?.find(N=>N.name==="w:tcW");let m=h?nt(h.attributes["w:w"]):null;const y=h?.attributes["w:type"];!m&&o&&(m=o);const g=Bg(t),{attributes:v}=g||{},k={color:u?.elements?.find(N=>N.name==="w:shd")?.attributes["w:fill"]},b=u?.elements?.find(N=>N.name==="w:gridSpan")?.attributes["w:val"],C=u?.elements?.find(N=>N.name==="w:tcMar"),D=u?.elements?.find(N=>N.name==="w:vAlign")?.attributes["w:val"]||"top",M={},I=Jv(i,l)||{};M.cellMargins=t6(C,I);const{fontSize:E,fonts:G={}}=I,oe=G.ascii;if(m){M.colwidth=[m],M.widthUnit="px";const N=f,H=f&&f.length>0,A=parseInt(b,10);if(A&&A>1&&H){let J=[];for(let ie=0;ie<A;ie++){let W=N[a+ie];typeof W<"u"?J.push(W):J.push(100)}J.length&&(M.colwidth=[...J])}}if(y&&(M.widthType=y),b&&(M.colspan=parseInt(b,10)),k&&(M.background=k),M.verticalAlign=D,E&&(M.fontSize=E),oe&&(M.fontFamily=oe.ascii),r&&(M.borders={...r}),p&&(M.borders=Object.assign(M.borders||{},p)),v&&v["w:val"]==="restart"){const N=n.elements.filter(W=>W.name==="w:tr"),H=N.findIndex(W=>W===e),A=N.slice(H+1);let J=e.elements.filter(W=>W.name==="w:tc").findIndex(W=>W===t),ie=1;for(let W of A){const ce=W.elements.findIndex(R=>R.name==="w:tc"),X=W.elements[ce+J];if(!X)break;const ue=Bg(X),{attributes:Z}=ue||{};if(!ue&&!Z||Z&&Z["w:val"]==="restart")break;ie++,W.elements.splice(ce+J,1)}M.rowspan=ie}return{type:"tableCell",content:c.handler({...s,nodes:t.elements}),attrs:M}}const Bg=t=>t.elements.find(e=>e.name==="w:tcPr")?.elements?.find(e=>e.name==="w:vMerge"),aa=(t,e,n={})=>{const r=t?.elements?.find(o=>o.name===`w:${e}`)?.attributes;if(r&&r["w:val"]!=="nil"){const o={},i=r["w:color"];i&&(o.color=i==="auto"?"#000000":`#${i}`);const s=r["w:sz"];return s&&(o.size=Fv(s)),o}if(r&&r["w:val"]==="nil"){const o=Object.assign({},n[e]||{});return Object.keys(o)?(o.val="none",o):null}return null},Q4=(t,e)=>{if(!t)return null;const n={},r=aa(t,"bottom",e);r&&(n.bottom=r);const o=aa(t,"top",e);o&&(n.top=o);const i=aa(t,"left",e);i&&(n.left=i);const s=aa(t,"right",e);return s&&(n.right=s),n};function Jv(t,e,n){if(!t)return null;const r={},{attributes:o={}}=t,i=o["w:val"];if(!i)return null;const s=e["word/styles.xml"],{elements:a}=s.elements[0],l=a.filter(m=>m.name==="w:style"),c=l.find(m=>m.attributes["w:styleId"]===i);if(!c)return null;r.name=c.elements.find(m=>m.name==="w:name");const u=c.elements.find(m=>m.name==="w:basedOn");c.elements.find(m=>m.name==="w:uiPriority");let d;if(u?.attributes){const m=l.find(y=>y.attributes["w:styleId"]===u.attributes["w:val"]);d=m?m.elements.find(y=>y.name==="w:tblPr"):{}}const p=c.elements.find(m=>m.name==="w:pPr");if(p){const m=p.elements.find(y=>y.name==="w:jc");m?.attributes&&(r.justification=m.attributes["w:val"])}const f=c?.elements.find(m=>m.name==="w:rPr");if(f){const m=f.elements.find(g=>g.name==="w:rFonts");if(m){const{"w:ascii":g,"w:hAnsi":v,"w:cs":k}=m.attributes;r.fonts={ascii:g,hAnsi:v,cs:k}}const y=f.elements.find(g=>g.name==="w:sz");y?.attributes&&(r.fontSize=DE(y.attributes["w:val"])+"pt")}const h=c.elements.find(m=>m.name==="w:tblPr");if(h&&h.elements){d&&d.elements&&h.elements.push(...d.elements);const m=h?.elements?.find(b=>b.name==="w:tblBorders"),{elements:y=[]}=m||{},{borders:g,rowBorders:v}=Xv(y);g&&(r.borders=g),v&&(r.rowBorders=v);const k=h?.elements.find(b=>b.name==="w:tblCellMar");if(k){const b=k.elements.find(I=>I.name==="w:left"),C=k.elements.find(I=>I.name==="w:right"),D=k.elements.find(I=>I.name==="w:top"),M=k.elements.find(I=>I.name==="w:bottom");r.cellMargins={marginLeft:b?.attributes["w:w"],marginRight:C?.attributes["w:w"],marginTop:D?.attributes["w:w"],marginBottom:M?.attributes["w:w"]}}}return r}function Xv(t){const e={},n={};return t.forEach(r=>{const{name:o}=r,i=o.split("w:")[1],{attributes:s}=r,a={},l=s["w:color"],c=s["w:sz"];l&&l!=="auto"&&(a.color=l.startsWith("#")?l:`#${l}`),c&&c!=="auto"&&(a.size=Fv(c)),["insideH","insideV"].includes(i)&&(n[i]=a),e[i]=a}),{borders:e,rowBorders:n}}function e6(t,e,n,r,o){const i={},s=t.elements.find(d=>d.name==="w:trPr")?.elements?.find(d=>d.name==="w:trHeight"),a=s?.attributes["w:val"];s?.attributes["w:hRule"];const l={};n?.insideH&&(l.bottom=n.insideH),n?.insideV&&(l.right=n.insideV),i.borders=l,a&&(i.rowHeight=nt(a));const c=Yv(e),u=t.elements.filter(d=>d.name==="w:tc");return{type:"tableRow",content:u?.map((d,p)=>{const f=u.length>1?c[p]:null;return Z4(d,t,e,l,f,r,o,p)})||[],attrs:i}}const t6=(t,e)=>{const n=t?.elements?.find(m=>m.name==="w:left"),r=t?.elements?.find(m=>m.name==="w:right"),o=t?.elements?.find(m=>m.name==="w:top"),i=t?.elements?.find(m=>m.name==="w:bottom"),s=n?.attributes["w:w"],a=r?.attributes["w:w"],l=o?.attributes["w:w"],c=i?.attributes["w:w"],{cellMargins:u={}}=e,{marginLeft:d,marginRight:p,marginTop:f,marginBottom:h}=u;return{left:nt(s??d),right:nt(a??p),top:nt(l??f),bottom:nt(c??h)}},Yv=t=>t.elements.find(e=>e.name==="w:tblGrid")?.elements?.flatMap(e=>e.name!=="w:gridCol"?[]:nt(e.attributes["w:w"]))||[],n6=t=>{const{nodes:e,filename:n}=t,r=["w:drawing","w:p"];if(e.length===0||!r.includes(e[0].name))return{nodes:[],consumed:0};const o=e[0];let i;if(o.name==="w:drawing"?i=o:i=o.elements.find(d=>d.name==="w:drawing"),!i)return{nodes:[],consumed:0};let s;const{elements:a}=i,l=n||null,c=a.find(d=>d.name==="wp:anchor");c&&(s=Lg(a[0],l,t),s.attrs.isAnchor=c);const u=a.find(d=>d.name==="wp:inline");return u&&(s=Lg(u,l,t)),{nodes:s?[s]:[],consumed:1}};function Lg(t,e,n){const{docx:r}=n,{attributes:o}=t,i={top:Gt(o.distT),bottom:Gt(o.distB),left:Gt(o.distL),right:Gt(o.distR)},s=t.elements.find(X=>X.name==="wp:extent"),a={width:Gt(s.attributes?.cx),height:Gt(s.attributes?.cy)},l=t.elements.find(X=>X.name==="a:graphic").elements.find(X=>X.name==="a:graphicData"),{uri:c}=l?.attributes;if(c&&c==="http://schemas.microsoft.com/office/word/2010/wordprocessingShape")return r6(n,t,l);const u=l.elements.find(X=>X.name==="pic:pic");if(!u||!u.elements)return null;const d=u.elements.find(X=>X.name==="pic:blipFill").elements.find(X=>X.name==="a:blip"),p=t.elements.find(X=>X.name==="wp:positionH"),f=p?.elements.find(X=>X.name==="wp:posOffset"),h=Gt(f?.elements[0]?.text),m=p?.attributes.relativeFrom,y=p?.elements.find(X=>X.name==="wp:align")?.elements[0]?.text,g=t.elements.find(X=>X.name==="wp:positionV"),v=g?.elements.find(X=>X.name==="wp:posOffset"),k=Gt(v?.elements[0]?.text),b=g?.attributes.relativeFrom,C=g?.elements.find(X=>X.name==="wp:align")?.elements[0]?.text,D=t.elements.find(X=>X.name==="wp:simplePos"),M=t.elements.find(X=>X.name==="wp:wrapSquare"),I=t.elements.find(X=>X.name==="wp:wrapTopAndBottom"),E=t.elements.find(X=>X.name==="wp:docPr");let G=null;(m||y||b||C)&&(G={hRelativeFrom:m,vRelativeFrom:b,alignH:y,alignV:C});const oe={left:h,top:k},{attributes:N}=d,H=N["r:embed"];let A=r[`word/_rels/${e||"document.xml"}.rels`];A||(A=r["word/_rels/document.xml.rels"]);const J=A.elements.find(X=>X.name==="Relationships"),{elements:ie}=J,W=ie.find(X=>X.attributes.Id===H),{attributes:ce}=W;return{type:"image",attrs:{src:`word/${ce.Target}`,alt:E?.attributes.name||"Image",id:E?.attributes.id||"",title:E?.attributes.descr||"Image",inline:!0,padding:i,marginOffset:oe,size:a,anchorData:G,...D&&{simplePos:{x:D.attributes.x,y:D.attributes.y}},...M&&{wrapText:M.attributes.wrapText},wrapTopAndBottom:!!I,originalPadding:{distT:o.distT,distB:o.distB,distL:o.distL,distR:o.distR},originalAttributes:t.attributes,rId:ce.Id}}}const r6=(t,e,n)=>{const r=n.elements.find(l=>l.name==="wps:wsp"),o=r.elements.find(l=>l.name==="wps:txbx")?.elements?.find(l=>l.name==="w:txbxContent");e.elements.find(l=>l.name==="wp:docPr");const i=r.elements.find(l=>l.name==="wps:spPr"),s=i?.elements.find(l=>l.name==="a:prstGeom");if(s&&s.attributes.prst==="rect")return o6(t,i);if(!o)return null;const{nodeListHandler:a}=t;return a.handler({...t,node:o.elements[0],nodes:o.elements})[0]},o6=(t,e)=>{const n={},[r]=t.nodes;r?.name==="w:drawing"&&(n.drawingContent=r);const o=e.elements.find(u=>u.name==="a:xfrm"),i=o.elements.find(u=>u.name==="a:off"),s=o.elements.find(u=>u.name==="a:ext");e.elements.find(u=>u.name==="a:ln");const a=e.elements.find(u=>u.name==="a:solidFill"),l={top:Gt(i.attributes.y),left:Gt(i.attributes.x),width:Gt(s.attributes.cx),height:Gt(s.attributes.cy)};n.size=l;const c=a?.elements[0]?.attributes.val;return c&&(n.background="#"+c),{type:"contentBlock",attrs:n}},i6={handlerName:"drawingNodeHandler",handler:n6};function si(t,e=[],n=null){const r=[],o=new Set;return t?.elements?.forEach(i=>{const s=Nr.markTypes.filter(a=>a.name===i.name);s.length||["w:shd","w:rStyle","w:pStyle","w:numPr","w:outlineLvl","w:bdr","w:pBdr","w:noProof","w:contextualSpacing","w:keepNext","w:tabs","w:keepLines"].includes(i.name)&&e.push(i.name),s.forEach(a=>{if(!a||o.has(a.type))return;o.add(a.type);const{attributes:l={}}=i,c={type:a.type};if(!(l["w:val"]=="0"||l["w:val"]==="none")){if(a.mark&&(c.type=a.mark),Object.keys(l).length){const u=a6(a.type,l,n);if(u==null)return;c.attrs={},c.attrs[a.property]=u}r.push(c)}})}),Rd(r)}function s6(t,e){const n=t.elements?.find(s=>s.name==="w:rPrChange");if(!n)return[];const{attributes:r}=n,o={id:r["w:id"],date:r["w:date"],author:r["w:author"],authorEmail:r["w:authorEmail"]},i=si(n);return[{type:vt,attrs:{...o,before:i,after:[...e]}}]}function Rd(t){const e=t.filter(o=>o.type==="textStyle"),n=t.filter(o=>o.type!=="textStyle"),r={};return e.length&&e.forEach(o=>{const{attrs:i={}}=o;Object.keys(i).forEach(s=>{r[s]=i[s]})}),[...n,{type:"textStyle",attrs:r}]}function a6(t,e,n){t==="tabs"&&(t="textIndent");const r={color:()=>`#${e["w:val"]}`,fontSize:()=>`${e["w:val"]/2}pt`,textIndent:()=>c6(e),fontFamily:()=>l6(e,n),lineHeight:()=>u6(e),textAlign:()=>e["w:val"],link:()=>e.href,underline:()=>e["w:val"],bold:()=>e?.["w:val"]||null,italic:()=>e?.["w:val"]||null,highlight:()=>d6(e)};if(t in r||console.debug("❗️❗️ No value mapper for:",t,"Attributes:",e),t in r)return r[t],r[t]()}function l6(t,e){const n=t["w:ascii"],r=t["w:asciiTheme"];if(!e||!r)return n;const o=e["word/theme/theme1.xml"];if(!o)return n;const{elements:i}=o,{elements:s}=i[0];return s.find(a=>a.name==="a:themeElements").elements.find(a=>a.name==="a:fontScheme").elements.find(a=>a.name==="a:majorFont").elements.find(a=>a.name==="a:latin").attributes.typeface}function c6(t){let e=t["w:left"];return e?`${Wt(e)}in`:null}function u6(t){const e=t["w:line"],n=t["w:lineRule"];return!e||e==="0"?null:n==="exact"?`${Bv(e)}pt`:`${Jo(e)}`}function d6(t){const e=t["w:fill"];return e&&e!=="auto"?`#${e}`:RE(t?.["w:val"])?`#${t["w:val"]}`:FE(t?.["w:val"])||null}function go(t,e){const n=[],r=[],{attributes:o={},elements:i=[]}=t,{nodes:s,paragraphProperties:a={},runProperties:l={}}=p6(i);return i.find(c=>c.name==="w:r")&&(a.elements=a?.elements?.filter(c=>c.name!=="w:rPr")),l&&l?.elements?.length&&n.push(...si(l,r)),a&&a.elements?.length&&n.push(...si(a,r)),n.push(...s6(l,n)),a&&a.elements?.length&&(o.paragraphProperties=a),n&&t.name==="w:p"&&n.forEach(c=>{const u=Object.keys(c.attrs??{})[0];if(u){const d=c.attrs[u];o[u]=d}}),{elements:s,attributes:o,marks:n,unknownMarks:r}}function p6(t){const e=t.find(o=>o.name==="w:pPr"),n=t.find(o=>o.name==="w:rPr"),r=t.find(o=>o.name==="w:sectPr");return{nodes:t.filter(o=>o.name!=="w:pPr"&&o.name!=="w:rPr"&&o.name!=="w:sectPr"),paragraphProperties:e,runProperties:n,sectionProperties:r}}function Va(t){return Nr.allowedElements[t.name||t.type]}const f6=t=>!!Nr.propertyTypes[t.name||t.type];function Zv(t){return t.filter(e=>e.name==="w:r").some(e=>e.elements.some(n=>n.name==="w:t"))}const h6=t=>{const{nodes:e,nodeListHandler:n}=t;if(e.length===0||!(e[0].name==="w:del"||e[0].name==="w:ins"||e[0].name==="w:sdt"))return{nodes:[],consumed:0};const r=e[0];let o;if(["w:ins","w:del"].includes(r.name))o=r;else{const d=r.elements.find(p=>p.name==="w:sdtContent")?.elements.find(p=>["w:ins","w:del"].includes(p.name));d&&(o=d)}if(!o)return{nodes:[],consumed:0};const{name:i}=o,{attributes:s,elements:a}=go(o),l=n.handler({...t,insideTrackChange:!0,nodes:a}),c=i==="w:del"?ut:It,u={id:s["w:id"],date:s["w:date"],author:s["w:author"],authorEmail:s["w:authorEmail"]};return l.forEach(d=>{d.marks===void 0&&(d.marks=[]),d.marks.push({type:c,attrs:u})}),{nodes:l,consumed:1}},m6={handlerName:"trackChangeNodeHandler",handler:h6},g6=t=>{const{nodes:e,docx:n,nodeListHandler:r}=t;if(e.length===0||e[0].name!=="w:hyperlink")return{nodes:[],consumed:0};const o=e[0],i=n["word/_rels/document.xml.rels"].elements.find(m=>m.name==="Relationships"),{elements:s}=i,{attributes:a}=o,l=a["r:id"],c=a["w:anchor"];a["w:history"];const u=s.find(m=>m.attributes.Id===l)||{},{attributes:d={}}=u;let p=d.Target;c&&!p&&(p=`#${c}`);const f=o.elements.filter(m=>m.name==="w:r"),h={type:"link",attrs:{href:p,rId:l}};for(const m of f){m.marks||(m.marks=[]),m.marks.push(h);const y=m.elements.find(g=>g.name==="w:rPr");if(y&&y.elements.find(g=>g.name==="w:rStyle")){const g=n["word/styles.xml"],{elements:v}=g.elements[0],k=v.filter(b=>b.name==="w:style").find(b=>b.attributes["w:styleId"]==="Hyperlink")?.elements?.find(b=>b.name==="w:rPr");k&&m.elements.unshift(k)}}return{nodes:r.handler({...t,nodes:f}),consumed:1}},y6={handlerName:"hyperlinkNodeHandler",handler:g6},w6=t=>{const{nodes:e,nodeListHandler:n,parentStyleId:r,docx:o}=t;if(e.length===0||e[0].name!=="w:r")return{nodes:[],consumed:0};const i=e[0],s={...t,nodes:i.elements};let a=n.handler(s)?.filter(u=>u)||[];const l=i.elements?.some(u=>u.name==="w:rPr"),c=b6(o,r);if(l){const{marks:u=[],attributes:d={}}=go(i),p=u.find(m=>m.type==="textStyle"),f=p&&Object.keys(p.attrs).length>0;c.marks&&!f&&u.push(...c.marks),i.marks&&u.push(...i.marks);const h=Rd(u);a=a.map(m=>{const y=m.marks||[];return{...m,marks:[...h,...y],attributes:d}})}else c.marks&&(a=a.map(u=>({...u,marks:Rd(c.marks)})));return{nodes:a,consumed:1}},b6=(t,e)=>{const n=t?.["word/styles.xml"];if(!n)return{};const r=n.elements[0].elements.filter(o=>o.name==="w:style").find(o=>o.attributes["w:styleId"]===e)||{};return r?go(r):{}},v6={handlerName:"runNodeHandler",handler:w6},x6=t=>{const{nodes:e,insideTrackChange:n}=t;if(e.length===0||!(e[0].name==="w:t"||n&&e[0].name==="w:delText"))return{nodes:[],consumed:0};const r=e[0],{type:o}=r,{attributes:i,elements:s,marks:a=[]}=go(r);let l;if(s.length===1)l=s[0].text;else if(!s.length&&"attributes"in r&&r.attributes["xml:space"]==="preserve")l=" ";else return{nodes:[],consumed:0};return{nodes:[{type:Va(r),text:l,attrs:{type:o,attributes:i||{}},marks:a}],consumed:1}},k6={handlerName:"textNodeHandler",handler:x6},Qv=t=>{if(!t||!Array.isArray(t))return t;let e=[],n=null;for(let r of t)r.type==="text"?n&&S6(n,r)?n={...n,text:n.text+=r.text}:(n&&e.push(n),n={...r}):(n&&(e.push(n),n=null),e.push(r));return n&&e.push(n),e},S6=(t,e)=>{if(!t||!e)return!1;let n=t.marks??[],r=e.marks??[];if(n.length!==r.length)return!1;for(let o=0;o<n.length;o++)if(n[o].attrs||(n[o].attrs={}),r[o].attrs||(r[o].attrs={}),n[o].type!==r[o].type||Object.keys(n[o].attrs).length!==Object.keys(r[o].attrs).length||!A6(n[o].attrs,r[o].attrs))return!1;return!0},A6=(t={},e={})=>oi(t,e),C6=t=>{const{nodes:e,lists:n,docx:r}=t;if(e.length===0||e[0].name!=="w:p")return{nodes:[],consumed:0};const o=Qt(e[0]),i=i1(o.elements);o.elements=i;const s=o.elements.find(a=>a.name==="w:pPr");if(Bd(o,r)){const a=Qt(e),l=[];let c=a.shift();for(;c&&Bd(c,r);)l.push(c),c=a.shift(),c?.elements&&!Zv(c.elements)&&(l.push(c),c=a.shift());return{nodes:[e1({listItems:l,params:t,originalPpr:s})],consumed:l.filter(u=>u.seen).length,lists:n}}else return{nodes:[],consumed:0,lists:n}},E6={handlerName:"listHandler",handler:C6};function e1({listItems:t,originalPpr:e,params:n,listLevel:r=0,actualListLevel:o=0,currentListNumId:i=null,path:s="",isNested:a=!1}){const{docx:l,nodeListHandler:c,lists:u}=n,d=[];let p,f;const h=c.handlerEntities.find(k=>k.handlerName==="standardNodeHandler")?.handler;if(!h)return console.error("Standard node handler not found"),{nodes:[],consumed:0};const m=t[0].elements.find(k=>k.name==="w:pPr")?.elements?.find(k=>k.name==="w:pStyle")?.attributes["w:val"],y=tc({node:t[0],styleId:m,docx:l});i=ai(y),o=parseInt(y?.elements?.find(k=>k.name==="w:ilvl")?.attributes["w:val"])||0,o===void 0&&(o=t1(m,l));let g=0;for(let[k,b]of t.entries()){if(b.seen)continue;if(b.elements&&!Zv(b.elements)){const $=h({...n,nodes:[b]}).nodes[0];$&&d[d.length-1]?.content.push($),b.seen=!0;continue}const{attributes:C,elements:D,marks:M=[]}=go(b),I=cf(m,l)||{},{marks:E}=go(I),G=M.find($=>$.type==="textStyle"),oe=E?.find($=>$.type==="textStyle"),{listType:N,listOrderingType:H,ilvl:A,listrPrs:J,listpPrs:ie,start:W,lvlText:ce,lvlJc:X,numId:ue}=M6(b,r,l);f=H;const Z=parseInt(A),R=o===Z&&ue===i,ee=O6({firstListId:ue,secondListId:i,level:Z,pStyleId:null,docx:l}),ne=ue!==i&&!ee,se=r<Z||r===Z&&ne&&g===r;u[i]||(u[i]={}),u[i][r]||(u[i][r]=Number(W));const Y={};if(R&&!se){p=N,b.seen=!0;const $=[];let T={type:"paragraph",content:c.handler({...n,nodes:[C.paragraphProperties,...D]})?.filter(S=>S)};T.content&&(T={...T,attrs:{textAlign:G?.attrs.textAlign||oe?.attrs.textAlign||null,rsidRDefault:C?.["w:rsidRDefault"]||null,styleId:m},content:Qv(T.content)}),$.push(T),g=r;let K=[];if(f!=="bullet"&&(K=[...s,u[i][r]],u[i][o]++),!s.length&&o>0){const S=u[i];if(S){const re=[];Object.keys(S).forEach(Q=>{re.push(S[Q])}),K=re}}let q=b.elements.find(S=>S.name==="w:pPr")?.elements.find(S=>S.name==="w:ind");const F=I?.elements?.find(S=>S.name==="w:pPr")?.elements?.find(S=>S.name==="w:ind");if(q||(q=F),q){const S={};q.attributes||(q.attributes={}),q.attributes["w:left"]!==void 0&&(S.left=nt(q.attributes["w:left"])),q.attributes["w:right"]!==void 0&&(S.right=nt(q.attributes["w:right"])),q.attributes["w:firstLine"]!==void 0&&(S.firstLine=nt(q.attributes["w:firstLine"])),q.attributes["w:hanging"]!==void 0&&(S.hanging=nt(q.attributes["w:hanging"])),Y.indent=S}ie&&(Y.listParagraphProperties=ie),J&&(Y.listRunProperties=J),Y.textStyle=G,Y.order=W,Y.lvlText=ce,Y.lvlJc=G?.attrs.textAlign,Y.listLevel=K,Y.listNumberingType=H,Y.attributes={parentAttributes:b?.attributes||null};const L=e?.elements?.find(S=>S.name==="w:rPr");L&&(Y.attributes.originalInlineRunProps=L),Y.numId=ue,l&&(Y.spacing=r1(b,l,m));const le=Pg($,Y,[]);d.push(le)}else if(se){const $=[...s,u[i][r]],T=e1({listItems:t.slice(k),originalPpr:e,params:n,listLevel:r+1,actualListLevel:r,currentListNumId:ue,path:$,isNested:!0});g=T.lastNestedListLevel,delete T.lastNestedListLevel;const K=d[d.length-1];K?K.content.push(T):d.push(Pg([T],Y,[]))}else if(ue){g=r,r>0&&b.elements[0].elements.find($=>$.name==="w:numPr")&&(u[i][r]=0);break}else{b.seen=!0;const $=h({...n,nodes:[b]}).nodes[0];d[d.length-1]?.content.push($)}}const v={type:p||"bulletList",content:d,attrs:{"list-style-type":f,listId:i,attributes:{parentAttributes:t[0]?.attributes||null}}};return a&&(v.lastNestedListLevel=g),v}const t1=(t,e)=>{const n=cf(t,e)?.elements?.find(r=>r.name==="w:pPr")?.elements?.find(r=>r.name==="w:outlineLvl");try{return parseInt(n?.attributes["w:val"])}catch{}};function Bd(t,e){const{elements:n}=t,r=n?.find(l=>l.name==="w:pPr");if(!r)return!1;const o=r.elements?.find(l=>l.name==="w:pStyle");let i=r.elements?.find(l=>l.name==="w:numPr"),s=ai(i);const a=o?.attributes["w:val"];return a&&!s&&(i=tc({node:t,styleId:a,docx:e}),s=ai(i)),!!s}const ai=t=>t?.elements?.find(e=>e.name==="w:numId")?.attributes["w:val"];function cf(t,e){const n=e["word/styles.xml"];return n?n.elements.find(r=>r.name==="w:styles").elements.filter(r=>r.name==="w:style").find(r=>r.attributes["w:styleId"]===t):{}}function tc({node:t,styleId:e,docx:n,seenStyleIds:r=new Set}){let o=t?.elements?.find(l=>l.name==="w:pPr")?.elements?.find(l=>l.name==="w:numPr"),i=ai(o);if(i)return o;const s=cf(e,n);o=s?.elements?.find(l=>l.name==="w:pPr")?.elements?.find(l=>l.name==="w:numPr"),i=ai(o);const a=s?.elements?.find(l=>l.name==="w:basedOn");if(!i&&!r.has(e)){const l=a?.attributes["w:val"];return r.add(e),l?tc({styleId:l,docx:n,seenStyleIds:r}):null}return o}function Pg(t,e,n){return{type:"listItem",content:t,attrs:e,marks:n}}const T6=["decimal","decimalZero","lowerRoman","upperRoman","lowerLetter","upperLetter","ordinal","cardinalText","ordinalText","hex","chicago","none"],$6=["bullet","square","circle","disc"],O6=({firstListId:t,secondListId:e,level:n,pStyleId:r,docx:o})=>{const{numFmt:i,lvlText:s,lvlJc:a}=fl(t,n,r,o),{numFmt:l,lvlText:c,lvlJc:u}=fl(e,n,r,o);return i===l&&s===c&&a===u},zg=(t,e)=>{const n=e["word/styles.xml"];if(!n)return null;const{elements:r}=n,o=r[0].elements.filter(h=>h.name==="w:style"),i=o.find(h=>h.attributes["w:styleId"]===t)||{},s=i?.elements?.find(h=>h.name==="w:pPr");if(!s)return null;let a=s?.elements?.find(h=>h.name==="w:numPr");if(!a)return null;let l=a?.elements?.find(h=>h.name==="w:numId")||{},c=ai(a),u=a?.elements?.find(h=>h.name==="w:ilvl"),d=u?.attributes?.["w:val"];const p=i?.elements?.find(h=>h.name==="w:basedOn")?.attributes?.["w:val"];let f=0;for(;a&&!c&&f<10;)a=(o.find(h=>h.attributes["w:styleId"]===p)||{})?.elements?.find(h=>h.name==="w:pPr")?.elements?.find(h=>h.name==="w:numPr"),l=a?.elements?.find(h=>h.name==="w:numId")||{},c=l?.attributes?.["w:val"],u||(u=a?.elements?.find(h=>h.name==="w:ilvl"),d=u?.attributes?.["w:val"]),f++;return{numId:c,ilvl:d}},fl=(t,e,n,r)=>{const o=r["word/numbering.xml"];if(!o)return{};const{elements:i}=o,s=i[0];if(n){const{numId:k,ilvl:b}=zg(n,r)||{};!t&&k&&(t=k),!e&&b&&(e=b?parseInt(b):null)}const a=s.elements,l=a.filter(k=>k.name==="w:abstractNum"),c=a.filter(k=>k.name==="w:num").find(k=>k.attributes["w:numId"]===t)?.elements[0].attributes["w:val"],u=l?.find(k=>k.attributes["w:abstractNumId"]===c),d=D6(u,e),p=u?.elements?.find(k=>k.name==="w:numStyleLink")?.attributes["w:val"];if(p){const k=zg(p,r);return fl(k.numId,e,null,r)}const f=d?.elements?.find(k=>k.name==="w:start")?.attributes["w:val"],h=d?.elements?.find(k=>k.name==="w:numFmt")?.attributes["w:val"],m=d?.elements?.find(k=>k.name==="w:lvlText").attributes["w:val"],y=d?.elements?.find(k=>k.name==="w:lvlJc").attributes["w:val"],g=d?.elements?.find(k=>k.name==="w:pPr"),v=d?.elements?.find(k=>k.name==="w:rPr");return{start:f,numFmt:h,lvlText:m,lvlJc:y,pPr:g,rPr:v}};function M6(t,e,n){if(!t)return;const{attributes:r={}}=t,{paragraphProperties:o={}}=r,{elements:i=[]}=o,s=t.elements.find(b=>b.name==="w:pPr")?.elements?.find(b=>b.name==="w:pStyle")?.attributes["w:val"],a=tc({node:t,styleId:s,docx:n});if(!a)return{};const l=a?.elements.find(b=>b.name==="w:numId")?.attributes["w:val"],c=a?.elements.find(b=>b.name==="w:ilvl")?.attributes["w:val"]||t1(s,n),u=i.find(b=>b.name==="w:pStyle")?.attributes["w:val"],{start:d,numFmt:p,lvlText:f,lvlJc:h,pPr:m,rPr:y}=fl(l,e,u,n);let g,v;m&&(g=_6(m)),y&&(v=N6(y));let k;if($6.includes(p?.toLowerCase()))k="bulletList";else if(T6.includes(p))k="orderedList";else return{};return{listType:k,listOrderingType:p,ilvl:c,numId:l,listrPrs:v,listpPrs:g,start:d,lvlText:f,lvlJc:h}}function D6(t,e){return t?.elements?.find(n=>Number(n.attributes["w:ilvl"])===e)}function _6(t){const{elements:e}=t,n=["w:ind","w:jc","w:tabs"],r={};return e&&e.forEach(o=>{n.includes(o.name);const{attributes:i={}}=o;Object.keys(i).forEach(s=>{r[s]=i[s]})}),r}function N6(t){const{elements:e}=t,n=["w:rFonts","w:b","w:bCs","w:i","w:iCs","w:strike","w:dstrike","w:color","w:sz","w:szCs","w:u","w:bdr","w:shd","w:vertAlign","w:jc","w:spacing","w:w","w:smallCaps","w:position","w:lang"],r={};return e&&e.forEach(o=>{n.includes(o.name);const{attributes:i={}}=o;Object.keys(i).forEach(s=>{r[s]=i[s]})}),r}const n1=t=>{const{nodes:e,docx:n,nodeListHandler:r,filename:o}=t;if(e.length===0||e[0].name!=="w:p")return{nodes:[],consumed:0};const i=Qt(e[0]);let s,a=i1(i.elements);if(i.elements=a,Bd(i,n))return{nodes:[],consumed:0};const l=r.handlerEntities.find(b=>b.handlerName==="standardNodeHandler")?.handler;if(!l)return console.error("Standard node handler not found"),{nodes:[],consumed:0};const c={...t,nodes:[i]},u=l(c);u.nodes.length===1&&(s=u.nodes[0]);const d=i.elements?.find(b=>b.name==="w:pPr"),p=d?.elements?.find(b=>b.name==="w:pStyle"),f=d?.elements?.find(b=>b.name==="w:rPr"),h=d?.elements?.find(b=>b.name==="w:framePr");if(f){let b=si(f,[]);if(!s.content?.length){let C=b?.findIndex(D=>D.type==="highlight");C!==-1&&b.splice(C,1)}s.attrs.marksAttrs=b}let m;if(p&&(m=p.attributes["w:val"],s.attrs.styleId=m),n){const b=I6(i,n,m);s.attrs.indent||(s.attrs.indent={}),(b.left||b.left===0)&&(s.attrs.indent.left=b.left),(b.right||b.right===0)&&(s.attrs.indent.right=b.right),(b.firstLine||b.firstLine===0)&&(s.attrs.indent.firstLine=b.firstLine),(b.hanging||b.hanging===0)&&(s.attrs.indent.hanging=b.hanging),(b.textIndent||b.textIndent===0)&&(s.attrs.textIndent=`${b.textIndent}in`)}const y=d?.elements?.find(b=>b.name==="w:jc");y&&y.attributes&&(s.attrs.textAlign=y.attributes["w:val"]);const g=d?.elements?.find(b=>b.name==="w:keepLines");g&&g.attributes&&(s.attrs.keepLines=g.attributes["w:val"]);const v=d?.elements?.find(b=>b.name==="w:keepNext");if(v&&v.attributes&&(s.attrs.keepNext=v.attributes["w:val"]),n){const b=i.attributes?.["w:rsidRDefault"];s.attrs.spacing=r1(i,n,m,s.attrs.marksAttrs),s.attrs.rsidRDefault=b}h&&h.attributes["w:dropCap"]&&(s.attrs.dropcap={type:h.attributes["w:dropCap"],lines:h.attributes["w:lines"],wrap:h.attributes["w:wrap"],hAnchor:h.attributes["w:hAnchor"],vAnchor:h.attributes["w:vAnchor"]}),s.attrs.filename=o,s&&s.content&&(s={...s,content:Qv(s.content)});const k=d?.elements?.find(b=>b.name==="w:sectPr");return k&&(s.attrs.paragraphProperties||(s.attrs.paragraphProperties={}),s.attrs.paragraphProperties.sectPr=k,s.attrs.pageBreakSource="sectPr"),{nodes:s?[s]:[],consumed:1}},I6=(t,e,n="")=>{const r={left:0,right:0,firstLine:0,hanging:0,textIndent:0},{indent:o={}}=o1(e,n),i=t.elements?.find(d=>d.name==="w:pPr")?.elements?.find(d=>d.name==="w:ind")?.attributes||{},s=i?.["w:left"]||o?.["w:left"],a=i?.["w:right"]||o?.["w:right"],l=i?.["w:firstLine"]||o?.["w:firstLine"],c=i?.["w:hanging"]||o?.["w:hanging"];s&&(r.left=nt(s)),a&&(r.right=nt(a)),l&&(r.firstLine=nt(l)),c&&(r.hanging=nt(c));const u=s-parseInt(c||0)||0;return u&&(r.textIndent=Wt(u)),r},r1=(t,e,n="",r=[])=>{const o={lineSpaceAfter:0,lineSpaceBefore:0,line:0,lineRule:null},{spacing:i={}}=o1(e,n);let s,a,l,c;const u=t.elements?.find(y=>y.name==="w:pPr")?.elements?.find(y=>y.name==="w:spacing")?.attributes||{},d=r.find(y=>y.type==="textStyle")?.attrs?.fontSize,p=u?.["w:line"]||l||i?.["w:line"];p&&(o.line=Jo(p));const f=u?.["w:lineRule"]||c||i?.["w:lineRule"];f&&(o.lineRule=f),f==="exact"&&p&&(o.line=`${Bv(p)}pt`);const h=u?.["w:before"]||a||i?.["w:before"];h&&(o.lineSpaceBefore=nt(h)),u?.["w:beforeAutospacing"]==="1"&&d&&(o.lineSpaceBefore+=Math.round(parseInt(d)*.5*96/72));const m=u?.["w:after"]||s||i?.["w:after"];return m&&(o.lineSpaceAfter=nt(m)),u?.["w:afterAutospacing"]==="1"&&d&&(o.lineSpaceAfter+=Math.round(parseInt(d)*.5*96/72)),o},o1=(t,e="")=>{const n=t["word/styles.xml"];if(!n)return{};const r=(n.elements[0].elements?.find(k=>k.name==="w:docDefaults")).elements.find(k=>k.name==="w:pPrDefault")?.elements?.find(k=>k.name==="w:pPr"),o=r?.elements?.find(k=>k.name==="w:spacing")||{},i=r?.elements?.find(k=>k.name==="w:ind")||{},s=n.elements[0].elements?.find(k=>k.name==="w:style"&&k.attributes["w:styleId"]==="Normal")?.elements?.find(k=>k.name==="w:pPr"),a=s?.elements?.find(k=>k.name==="w:spacing")||{},l=s?.elements?.find(k=>k.name==="w:ind")||{};let c={},u={},d={};if(e){const k=n.elements[0].elements?.find(b=>b.name==="w:style"&&b.attributes["w:styleId"]===e)?.elements?.find(b=>b.name==="w:pPr");c=k?.elements?.find(b=>b.name==="w:spacing")||{},u=k?.elements?.find(b=>b.name==="w:ind")||{},d=k?.elements?.find(b=>b.name==="w:jc")||{}}const{attributes:p}=o,{attributes:f}=a,{attributes:h}=c,{attributes:m}=d,{attributes:y}=i,{attributes:g}=l,{attributes:v}=u;return{spacing:h||p||f,indent:v||y||g,justify:m}},F6={handlerName:"paragraphNodeHandler",handler:n1};function R6(t,e){const n={lineSpaceBefore:null,lineSpaceAfter:null};if(!t)return n;const r=e["word/styles.xml"];if(!r)return n;const{elements:o}=r.elements[0],i=o.filter(ie=>{const{attributes:W}=ie;return W&&W["w:styleId"]===t}),s=i[0];if(!s)return n;const a=i.find(ie=>ie.elements.find(W=>W.name==="w:qFormat")),l=i.find(ie=>ie.elements.some(W=>W.name==="w:name"))?.elements.find(ie=>ie.name==="w:name")?.attributes["w:val"],c=s.elements.find(ie=>ie.name==="w:pPr"),u=c?.elements?.find(ie=>ie.name==="w:spacing"),d=c?.elements?.find(ie=>ie.name==="w:jc"),p=c?.elements?.find(ie=>ie.name==="w:ind");let f,h,m;u&&(f=nt(u?.attributes["w:before"]),h=nt(u?.attributes["w:after"]),m=Jo(u?.attributes["w:line"]));let y,g,v,k;p&&(y=d?.attributes["w:val"],g=nt(p?.attributes["w:left"]),v=nt(p?.attributes["w:right"]),k=nt(p?.attributes["w:firstLine"]));const b=c?.elements?.find(ie=>ie.name==="w:keepNext"),C=c?.elements?.find(ie=>ie.name==="w:keepLines"),D=c?.elements?.find(ie=>ie.name==="w:outlineLvl"),M=D?.attributes["w:val"],I=c?.elements?.find(ie=>ie.name==="w:pageBreakBefore");let E=0;I&&(I.attributes?.["w:val"]?E=Number(I?.attributes?.["w:val"]):E=1);const G=c?.elements?.find(ie=>ie.name==="w:pageBreakAfter");let oe;G&&(G.attributes?.["w:val"]?oe=Number(G?.attributes?.["w:val"]):oe=1);const N={name:l,qFormat:!!a,keepNext:!!b,keepLines:!!C,outlineLevel:D?parseInt(M):null,pageBreakBefore:!!E,pageBreakAfter:!!oe},H=s.elements.find(ie=>ie.name==="w:rPr"),A=si(H,[],e)||{},J={spacing:{lineSpaceAfter:h,lineSpaceBefore:f,line:m},textAlign:y,indent:{leftIndent:g,rightIndent:v,firstLine:k}};return A.forEach(ie=>{const{type:W,attrs:ce}=ie;if(W==="textStyle"){Object.entries(ce).forEach(([X,ue])=>{J[dl(X)]=ue});return}J[W]=ce}),{attrs:N,styles:J}}function i1(t=[]){const e=[];let n=[],r=!1;for(const o of t){const i=o.elements?.find(s=>s.name==="w:fldChar")?.attributes?.["w:fldCharType"];if(i==="begin"){n=[o],r=!0;continue}if(i==="separate"&&r){n.push(o);continue}if(i==="end"&&r){n.push(o),e.push(...B6(n)),n=[],r=!1;continue}r?n.push(o):e.push(o)}return n.length&&e.push(...n),e}const B6=(t=[])=>{let e=[],n=!1,r=!1;const o=t.findIndex(c=>c.elements?.some(u=>u.name==="w:fldChar"&&u.attributes["w:fldCharType"]==="separate")),i=t.findIndex(c=>c.elements?.some(u=>u.name==="w:fldChar"&&u.attributes["w:fldCharType"]==="end")),s=t.slice(o+1,i),a=t.find(c=>c.elements?.some(u=>u.name==="w:instrText"))?.elements?.find(c=>c.name==="w:instrText")?.elements[0].text;n||(n=a?.trim().startsWith("PAGE")),r||(r=a?.trim().startsWith("NUMPAGES"));const l=a?.match(/HYPERLINK\s+"([^"]+)"/);if(n)e.push({name:"sd:autoPageNumber",type:"element"});else if(r)e.push({name:"sd:totalPageNumber",type:"element"});else if(l&&l?.length>=2){const c=l[1],u=[];s.forEach(p=>{const f=p.elements.find(m=>m.name==="w:rPr");if(!f)return;const{elements:h}=f;h.forEach(m=>{u.push(m)})});const d={name:"w:rPr",type:"element",elements:[{name:"link",attributes:{href:c}},...u]};e.push({name:"w:r",type:"element",elements:[d,...s]})}return e},L6=t=>nodeListHandler.handler({...t,nodes:node.elements}),P6=t=>{const{nodes:e}=t;if(e.length===0||e[0].name!=="w:sdt")return{nodes:[],consumed:0};const n=e[0],r=n.elements.find(s=>s.name==="w:sdtPr")?.elements.find(s=>s.name==="w:docPartObj")?.elements.find(s=>s.name==="w:docPartGallery")?.attributes["w:val"];if(!r)return{nodes:[],consumed:0};if(!jg[r])return{nodes:[],consumed:0};const o=n?.elements.find(s=>s.name==="w:sdtContent"),i=jg[r];return{nodes:i({...t,nodes:[o]}),consumed:1}},jg={"Table of Contents":L6},z6=t=>{const{nodes:e,docx:n,nodeListHandler:r,insideTrackChange:o}=t;if(e.length===0||e[0].name!=="w:sdt")return{nodes:[],consumed:0};const i=e[0],s=i.elements.find(M=>M.name==="w:sdtPr"),a=i.elements.find(M=>M.name==="w:sdtContent"),l=s?.elements.find(M=>M.name==="w:fieldTypeShort")?.attributes["w:val"],{attrs:c,marks:u}=s1(a);if(s?.elements.find(M=>M.name==="w:docPartObj"))return P6({nodes:e,docx:n,nodeListHandler:r,insideTrackChange:o});const d=s?.elements.find(M=>M.name==="w:alias"),p=s?.elements.find(M=>M.name==="w:tag"),f=s?.elements.find(M=>M.name==="w:fieldType")?.attributes["w:val"],h=s?.elements.find(M=>M.name==="w:fieldColor")?.attributes["w:val"],m=s?.elements.find(M=>M.name==="w:fieldMultipleImage")?.attributes["w:val"],y=s?.elements.find(M=>M.name==="w:fieldFontFamily")?.attributes["w:val"],g=s?.elements.find(M=>M.name==="w:fieldFontSize")?.attributes["w:val"],v=s?.elements.find(M=>M.name==="w:fieldTextColor")?.attributes["w:val"],k=s?.elements.find(M=>M.name==="w:fieldTextHighlight")?.attributes["w:val"],b={type:l,fieldId:p?.attributes["w:val"],displayLabel:d?.attributes["w:val"],fieldType:f,fieldColor:h,multipleImage:m==="true",fontFamily:y!=="null"?y:null,fontSize:g!=="null"?g:null,textColor:v!=="null"?v:null,textHighlight:k!=="null"?k:null},C={...b,...c};if(!b.fieldId||!b.displayLabel)return{nodes:[],consumed:0};let D={type:"text",text:`{{${b.displayLabel}}}`,attrs:C,marks:u};return t.editor.options.annotations&&(D={type:"fieldAnnotation",attrs:C}),{nodes:[D],consumed:1}},s1=(t={},e)=>{const n=t.elements?.find(s=>s.name==="w:r")?.elements?.find(s=>s.name==="w:rPr");if(!n)return{};const r=si(n,[])||[],o=[];r.forEach(s=>{const{type:a}=s;if(a==="textStyle"){const{attrs:l}=s;Object.keys(l).forEach(c=>{o.push({type:c,attrs:l[c]})})}else o.push(s)});const i={};return o?.forEach(s=>{const{type:a}=s;i[a]=s.attrs||!0}),{attrs:i,marks:r}},j6={handlerName:"annotationNodeHandler",handler:z6},q6=t=>{const{nodes:e,nodeListHandler:n}=t;if(e.length===0||e[0].name!=="w:sdt")return{nodes:[],consumed:0};const r=e[0],o=r.elements.find(a=>a.name==="w:sdtPr"),i=r.elements.find(a=>a.name==="w:sdtContent"),{marks:s}=s1(i);return{nodes:[{type:"structuredContent",content:n.handler({...t,nodes:i?.elements}),marks:s,attrs:{sdtPr:o}}],consumed:1}},V6={handlerName:"sdtNodeHandler",handler:q6},U6=t=>{const{nodes:e,docx:n,nodeListHandler:r}=t;if(!e||e.length===0)return{nodes:[],consumed:0};const o=e[0],{name:i}=o,{attributes:s,elements:a,marks:l=[]}=go(o);if(i==="w:sdt")return{nodes:[],consumed:0};if(f6(o))return{nodes:[{type:Va(o),attrs:{...s},marks:[]}],consumed:0};if(!Va(o))return{nodes:[{type:i,content:a,attrs:{...s},marks:l}],consumed:0,unhandled:!0};const c=[],u=H6(o);if(a&&a.length){const d=a.map(h=>(h.marks||(h.marks=[]),h.marks.push(...l),h)),p={...t,nodes:d,parentStyleId:u},f=r.handler(p);c.push(...f)}return{nodes:[{type:Va(o),content:c,attrs:{...s},marks:[]}],consumed:1}},H6=t=>{const e=t.elements?.find(n=>n.name==="w:pPr")?.elements?.find(n=>n.name==="w:pStyle");return e?e.attributes["w:val"]:null},W6={handlerName:"standardNodeHandler",handler:U6},G6=t=>{const{nodes:e}=t;return e.length===0||e[0].name!=="w:br"?{nodes:[],consumed:0}:{nodes:[{type:e[0].attributes?.["w:type"]==="page"?"hardBreak":"lineBreak"}],consumed:1}},K6={handlerName:"lineBreakNodeHandler",handler:G6},J6=t=>{const{nodes:e,nodeListHandler:n,editor:r}=t;if(e.length===0||e[0].name!=="w:bookmarkStart")return{nodes:[],consumed:0};const o=e[0],i=n.handlerEntities.find(d=>d.handlerName==="standardNodeHandler")?.handler;if(!i)return console.error("Standard node handler not found"),{nodes:[],consumed:0};const s=r?.extensionService?.extensions?.filter(d=>d.isExternal===!0)||[],a=o.attributes["w:name"]?.split(";")[0],l=s.find(d=>d.name===a);if(l){const d=e.findIndex(y=>y.name==="w:bookmarkEnd"&&y.attributes["w:id"]===o.attributes["w:id"]),p=e.slice(1,d),f=t.nodeListHandler,h={};o.attributes["w:name"].split(";").forEach(y=>{const[g,v]=y.split("=");g&&v&&(h[g]=v)});const m=f.handler({...t,nodes:p});return m.forEach(y=>{y.marks.push({type:l.name,attrs:h})}),{nodes:m,consumed:m.length+2}}const c={...t,nodes:[o]},u=i(c);return u.nodes.length===1&&(u.nodes[0].attrs.name=o.attributes["w:name"],u.nodes[0].attrs.id=o.attributes["w:id"]),u},X6={handlerName:"bookmarkNodeHandler",handler:J6},Y6=t=>{const e={nodes:[],consumed:0},{nodes:n,nodeListHandler:r,parentStyleId:o,docx:i}=t;if(n.length===0||n[0].name!=="w:p")return e;const s=n[0]?.elements?.find(d=>d.name==="w:r");if(!s?.elements?.some(d=>d.name==="mc:AlternateContent"))return e;const a=s.elements.find(d=>d.name==="mc:AlternateContent");s.elements.findIndex(d=>d.name==="mc:AlternateContent");const l=["wps","wp14","w14","w15"],c=a.elements.find(d=>d.name==="mc:Choice"&&l.includes(d.attributes.Requires));if(!c)return e;const u=c.elements;return{nodes:r.handler({...t,nodes:u}),consumed:1}},Z6={handlerName:"alternateChoiceHandler",handler:Y6},Q6=t=>{const{nodes:e}=t;return e.length===0||e[0].name!=="sd:autoPageNumber"?{nodes:[],consumed:0}:{nodes:[{type:"page-number"}],consumed:1}},eT={handlerName:"autoPageNumberHandler",handler:Q6},tT=t=>{const{nodes:e}=t;return e.length===0||e[0].name!=="sd:totalPageNumber"?{nodes:[],consumed:0}:{nodes:[{type:"total-page-number"}],consumed:1}},nT={handlerName:"autoTotalPageCountEntity",handler:tT},rT=t=>{const{nodes:e,docx:n,parentStyleId:r}=t;if(e.length===0||e[0].name!=="w:tab")return{nodes:[],consumed:0};const o=e[0],i=n["word/styles.xml"];if(i&&i.elements?.length){const a=i.elements[0]?.elements?.find(l=>l.attributes?.["w:styleId"]===r)?.elements?.find(l=>l.name==="w:pPr")?.elements?.find(l=>l.name==="w:tabs")?.elements?.find(l=>l.name==="w:tab");nt(a?.attributes?.["w:pos"])}const{attributes:s={}}=o;return{nodes:[{type:"tab",attrs:{tabSize:s["w:val"]||48},content:[]}],consumed:1}},oT={handlerName:"tabNodeHandler",handler:rT},iT=t=>{const{nodes:e}=t;if(!e.length||e[0].name!=="w:p")return{nodes:[],consumed:0};const[n]=e,r=n.elements?.find(l=>l.name==="w:r")?.elements?.find(l=>l.name==="w:pict");if(!r)return{nodes:[],consumed:0};const o=r,i=o.elements?.find(l=>l.name==="v:shape");o.elements?.find(l=>l.name==="v:shapetype");const s=o.elements?.find(l=>l.name==="v:group");if(!i&&!s)return{nodes:[],consumed:0};let a=null;return s&&!i?a=null:i.elements?.find(l=>l.name==="v:textbox")&&(a=sT({pict:r,pNode:n,shape:i,params:t})),{nodes:a?[a]:[],consumed:1}};function sT({pict:t,pNode:e,shape:n,params:r}){const o={},i={},s=n.attributes||{};o.attributes=s,s.fillcolor&&(o.fillcolor=s.fillcolor);const a=aT(s.style),l=lT(a);l&&(o.style=l);const c=n.elements?.find(p=>p.name==="v:textbox"),u=n.elements?.find(p=>p.name==="w10:wrap");u?.attributes&&(o.wrapAttributes=u.attributes),c?.attributes&&(i.attributes=c.attributes);const d=(c?.elements?.find(p=>p.name==="w:txbxContent")?.elements||[]).map(p=>n1({nodes:[p],docx:r.docx,nodeListHandler:ys()})).reduce((p,f)=>[...p,...f.nodes],[]);return{type:"shapeContainer",attrs:o,content:[{type:"shapeTextbox",attrs:i,content:d}]}}function aT(t){return t?t.split(";").filter(e=>!!e.trim()).reduce((e,n)=>{const[r,o]=n.split(":").map(i=>i.trim());return r&&o&&(e[r]=o),e},{}):{}}function lT(t){const e=["width","height"];let n="";for(const[r,o]of Object.entries(t))e.includes(r)&&(n+=`${r}: ${o};`);return n}const cT={handlerName:"handlePictNode",handler:iT};function uT({docx:t}){const e=ys(),n=t["word/comments.xml"];if(!n)return;const{elements:r}=n;if(!r||!r.length)return;const{elements:o=[]}=r[0],i=o.map(s=>{const{attributes:a}=s,l=a["w:id"],c=a["w:author"],u=a["w:email"],d=a["w:initials"],p=a["w:date"],f=a["custom:internalId"],h=a["custom:trackedChange"]==="true",m=a["custom:trackedChangeType"],y=a["custom:trackedChangeText"]!=="null"?a["custom:trackedChangeText"]:null,g=a["custom:trackedDeletedText"]!=="null"?a["custom:trackedDeletedText"]:null,v=new Date(p).getTime(),{elements:k}=s,b=k[0],{elements:C}=b,D=e.handler({nodes:s.elements,nodeListHandler:e,docx:t}),{attrs:M}=D[0],I=M["w14:paraId"];return{commentId:f||Lr(),importedId:l,creatorName:c,creatorEmail:u,createdTime:v,textJson:D[0],initials:d,paraId:I,trackedChange:h,trackedChangeText:y,trackedChangeType:m,trackedDeletedText:g}});return dT({docx:t,comments:i})}const dT=({docx:t,comments:e})=>{const n=t["word/commentsExtended.xml"];if(!n)return[];const{elements:r}=n,{elements:o}=r[0],i=o.filter(s=>s.name==="w15:commentEx");return e.map(s=>{const a=i.find(d=>d.attributes["w15:paraId"]===s.paraId);if(!a)return{...s};const{isDone:l,paraIdParent:c}=pT(a);let u;return c&&(u=e.find(d=>d.paraId===c)),{...s,isDone:l,parentCommentId:u?.commentId}})},pT=t=>{const{attributes:e}=t,n=e["w15:paraId"],r=e["w15:done"]==="1",o=e["w15:paraIdParent"];return{paraId:n,isDone:r,paraIdParent:o}},fT=(t,e,n)=>{const r=Qt(K4(t));if(!r)return null;if(e?.telemetry){const s=Object.keys(t).map(a=>{const l=a.split("/");return{filePath:a,fileDepth:l.length,fileType:a.split(".").pop()}});e.telemetry.trackFileStructure({totalFiles:s.length,maxDepth:Math.max(...s.map(a=>a.fileDepth)),totalNodes:0,files:s},e.fileSource,e.documentId,e.documentInternalId)}const o=ys(),i=r.elements[0].elements.find(s=>s.name==="w:body");if(i){const s=i,a=["w:sectPr"],l=s.elements?.filter(p=>!a.includes(p.name))??[],c=uT({docx:t}),u={},d={type:"doc",content:o.handler({nodes:l,nodeListHandler:o,docx:t,converter:e,editor:n,lists:u}),attrs:{attributes:r.elements[0].attributes}};return d.content.length>1&&e?.telemetry?.trackUsage("document_import",{documentType:"docx",timestamp:new Date().toISOString()}),{pmDoc:d,savedTagsToRestore:s,pageStyles:mT(s,t,e,n),comments:c,linkedStyles:gT(t),numbering:bT(t)}}return null},ys=()=>{const t=[Z6,v6,cT,F6,E6,k6,K6,j6,V6,X6,y6,i6,m6,X4,oT,eT,nT,W6];return{handler:hT(t),handlerEntities:t}},hT=t=>{const e=(r,o,i,s)=>!r||o<0||o>=r.length?{elementIndex:o,error:"index_out_of_bounds",arrayLength:r?.length}:{elementName:r[o]?.name,attributes:i?.attrs,marks:i?.marks,elementPath:s,type:i?.type,content:i?.content},n=({nodes:r,docx:o,insideTrackChange:i,converter:s,editor:a,filename:l,parentStyleId:c,lists:u})=>{if(!r||!r.length)return[];const d=[];try{for(let p=0;p<r.length;p++)try{const f=r.slice(p);if(!f||f.length===0)continue;const{nodes:h,consumed:m,unhandled:y}=t.reduce((v,k)=>v.consumed>0?v:k.handler({nodes:f,docx:o,nodeListHandler:{handler:n,handlerEntities:t},insideTrackChange:i,converter:s,editor:a,filename:l,parentStyleId:c,lists:u}),{nodes:[],consumed:0}),g=e(r,p,h[0],`/word/${l||"document.xml"}`);if(y){if(!g.elementName)continue;s?.telemetry?.trackStatistic("unknown",g);continue}else{s?.telemetry?.trackStatistic("node",g),(g.type==="orderedList"||g.type==="bulletList")&&g.content.forEach(k=>{const b=e([k],0,k,`/word/${l||"document.xml"}`);s?.telemetry?.trackStatistic("attributes",b)});const v=h[0]?.marks?.find(k=>k.type==="highlight");v&&s?.docHiglightColors.add(v.attrs.color.toUpperCase())}m>0&&(p+=m-1),h&&h.forEach(v=>{if(v?.type&&!["runProperties"].includes(v.type)){if(v.type==="text"&&Array.isArray(v.content)&&!v.content.length)return;d.push(v)}})}catch(f){console.debug("Import error",f),a?.emit("exception",{error:f}),s?.telemetry?.trackStatistic("error",{type:"processing_error",message:f.message,name:f.name,stack:f.stack,fileName:`/word/${l||"document.xml"}`})}return d}catch(p){throw console.debug("Error during import",p),a?.emit("exception",{error:p}),s?.telemetry?.trackStatistic("error",{type:"fatal_error",message:p.message,name:p.name,stack:p.stack,fileName:`/word/${l||"document.xml"}`}),p}};return n};function mT(t,e,n,r){const o=t.elements?.find(s=>s.name==="w:sectPr"),i={};return o?.elements?.forEach(s=>{const{name:a,attributes:l}=s;switch(a){case"w:pgSz":i.pageSize={width:Wt(l["w:w"]),height:Wt(l["w:h"])};break;case"w:pgMar":i.pageMargins={top:Wt(l["w:top"]),right:Wt(l["w:right"]),bottom:Wt(l["w:bottom"]),left:Wt(l["w:left"]),header:Wt(l["w:header"]),footer:Wt(l["w:footer"]),gutter:Wt(l["w:gutter"])};break;case"w:cols":i.columns={space:Wt(l["w:space"]),num:l["w:num"],equalWidth:l["w:equalWidth"]};break;case"w:docGrid":i.docGrid={linePitch:Wt(l["w:linePitch"]),type:l["w:type"]};break;case"w:titlePg":n.headerIds.titlePg=!0}}),wT(e,n,r),i.alternateHeaders=vT(e),i}function gT(t){const e=t["word/styles.xml"];if(!e)return[];const{elements:n}=e.elements[0],r=n.filter(i=>i.name==="w:style");n.find(i=>i.name==="w:latentStyles")?.elements.forEach(i=>{const{attributes:s}=i;r.find(a=>a.attributes["w:styleId"]===s["w:name"])});const o=[];return r.forEach(i=>{const s=i.attributes["w:styleId"],a=R6(s,t),l={id:i.attributes["w:styleId"],type:i.attributes["w:type"],definition:a,attributes:{}};o.push(l)}),o}function yT(t){if(!t)return null;const e=Qt(t),{elements:n}=e.elements[0];return Object.keys(Mg).forEach(r=>{if(!n.some(o=>o.attributes?.["w:styleId"]===r)){const o=Mg[r];e.elements[0].elements.push(o)}}),e}const wT=(t,e,n)=>{const r=t["word/_rels/document.xml.rels"].elements.find(u=>u.name==="Relationships"),{elements:o}=r,i="http://schemas.openxmlformats.org/officeDocument/2006/relationships/header",s="http://schemas.openxmlformats.org/officeDocument/2006/relationships/footer",a=o.filter(u=>u.attributes.Type===i),l=o.filter(u=>u.attributes.Type===s),c=(a1(t["word/document.xml"])||[]).flatMap(u=>u.elements);a.forEach(u=>{const{rId:d,referenceFile:p,currentFileName:f}=qg(u,t);let h=c.find(g=>g.name==="w:headerReference"&&g.attributes["r:id"]===d)?.attributes["w:type"];e.headerIds[h]&&(h=null);const m=ys(),y=m.handler({nodes:p.elements[0].elements,nodeListHandler:m,docx:t,converter:e,editor:n,filename:f});e.headerIds.ids||(e.headerIds.ids=[]),e.headerIds.ids.push(d),e.headers[d]={type:"doc",content:[...y]},h&&(e.headerIds[h]=d)}),l.forEach(u=>{const{rId:d,referenceFile:p,currentFileName:f}=qg(u,t),h=c.find(g=>g.name==="w:footerReference"&&g.attributes["r:id"]===d)?.attributes["w:type"],m=ys(),y=m.handler({nodes:p.elements[0].elements,nodeListHandler:m,docx:t,converter:e,editor:n,filename:f});e.footerIds.ids||(e.footerIds.ids=[]),e.footerIds.ids.push(d),e.footers[d]={type:"doc",content:[...y]},e.footerIds[h]=d})},a1=(t,e=[])=>{for(const n in t)t[n]==="w:sectPr"?e.push(t):typeof t[n]=="object"&&a1(t[n],e);return e},qg=(t,e)=>{const n=t.attributes.Id,r=t.attributes.Target,o=e[`word/${r}`];return{rId:n,referenceFile:o,currentFileName:r}};function bT(t){let e=t["word/numbering.xml"];(!e||!e.elements?.length||!e.elements[0].elements?.length)&&(e=Lv);const n=e.elements[0].elements,r=n.filter(a=>a.name==="w:abstractNum"),o=n.filter(a=>a.name==="w:num"),i={};r.forEach(a=>{const l=Number(a.attributes["w:abstractNumId"]);i[l]=a});const s={};return o.forEach(a=>{const l=Number(a.attributes["w:numId"]);s[l]=a}),{abstracts:i,definitions:s}}const vT=t=>{const e=t["word/settings.xml"];if(!e||!e.elements?.length)return!1;const{elements:n=[]}=e.elements[0];return!!n.find(r=>r.name==="w:evenAndOddHeaders")},xT="http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink";var Wr,l1,c1,u1,d1,p1;const Ui=class f1{constructor(e=null){ab(this,Wr),this.debug=e?.debug||!1,this.declaration=null,this.documentAttributes=null,this.convertedXml={},this.docx=e?.docx||[],this.media=e?.media||{},this.fonts=e?.fonts||{},this.addedMedia={},this.comments=[],this.docHiglightColors=new Set([]),this.xml=e?.xml,this.declaration=null,this.numbering={},this.numbering=null,this.pageStyles=null,this.initialJSON=null,this.headers={},this.headerIds={default:null,even:null,odd:null,first:null},this.headerEditors=[],this.footers={},this.footerIds={default:null,even:null,odd:null,first:null},this.footerEditors=[],this.linkedStyles=[],this.json=e?.json,this.tagsNotInSchema=["w:body"],this.savedTagsToRestore=[],this.telemetry=e?.telemetry||null,this.documentInternalId=null,this.fileSource=e?.fileSource||null,this.documentId=e?.documentId||null,(this.docx.length||this.xml)&&this.parseFromXml()}parseFromXml(){this.docx?.forEach(e=>{this.convertedXml[e.name]=this.parseXmlToJson(e.content),e.name==="word/document.xml"&&(this.documentAttributes=this.convertedXml[e.name].elements[0]?.attributes),e.name==="word/styles.xml"&&(this.convertedXml[e.name]=yT(this.convertedXml[e.name]))}),this.initialJSON=this.convertedXml["word/document.xml"],this.initialJSON||(this.initialJSON=this.parseXmlToJson(this.xml)),this.declaration=this.initialJSON?.declaration}parseXmlToJson(e){return JSON.parse(nf.xml2json(e,null,2))}static getStoredSuperdocVersion(e){try{const n=e.find(a=>a.name==="docProps/custom.xml");if(!n)return;const r=new f1,o=n.content,i=r.parseXmlToJson(o).elements.find(a=>a.name==="Properties");if(!i.elements)return;const s=i.elements.find(a=>a.name==="property"&&a.attributes.name==="SuperdocVersion");return s?s.elements[0].elements[0].text:void 0}catch(n){console.warn("Error getting Superdoc version",n);return}}static updateDocumentVersion(e=this.convertedXml,n="0.12.10"){const r="docProps/custom.xml";e[r]||(e[r]=h1());const o=e["docProps/custom.xml"];if(!o)return;const i=o.elements.find(a=>a.name==="Properties");i.elements||(i.elements=[]);const s=i.elements.find(a=>a.name==="property"&&a.attributes.name==="SuperdocVersion");if(s)s.elements[0].elements[0].elements[0].text=n;else{const a=m1();i.elements.push(a)}return e}getDocumentDefaultStyles(){const e=this.convertedXml["word/styles.xml"];if(!e)return{};const n=e.elements[0].elements.find(i=>i.name==="w:docDefaults").elements.find(i=>i.name==="w:rPrDefault");if(!n.elements)return{};const r=n.elements[0].elements,o=r?.find(i=>i.name==="w:rFonts");if("elements"in n){const i=r.find(d=>d.name==="w:rFonts")?.attributes["w:asciiTheme"];let s,a,l;if(i){const d=this.getThemeInfo(i);s=d.typeface,a=d.panose}else o&&(s=o?.attributes["w:ascii"]);(e.elements[0].elements.filter(d=>d.name==="w:style"&&d.attributes["w:styleId"]==="Normal")||[]).forEach(d=>{const p=d.elements.find(f=>f.name==="w:rPr");s=p?.elements?.find(f=>f.name==="w:rFonts")?.attributes["w:ascii"],l=Number(p?.elements?.find(f=>f.name==="w:sz")?.attributes["w:val"])/2});const c=l||Number(r.find(d=>d.name==="w:sz")?.attributes["w:val"])/2||12,u=r.find(d=>d.name==="w:kern")?.attributes["w:val"];return{fontSizePt:c,kern:u,typeface:s,panose:a}}}getDocumentFonts(){const e=this.convertedXml["word/fontTable.xml"];if(!e||!Object.keys(this.fonts).length)return;const n=e.elements.find(s=>s.name==="w:fonts")?.elements.filter(s=>s.elements?.some(a=>a?.attributes&&a.attributes["r:id"]&&a.attributes["w:fontKey"]))?.reduce((s,a)=>{const l=a.elements.filter(c=>c.name.startsWith("w:embed"))?.map(c=>({...c,fontFamily:a.attributes["w:name"]}));return[...s,...l]},[]),r=this.convertedXml["word/_rels/fontTable.xml.rels"]?.elements.find(s=>s.name==="Relationships")||{},{elements:o}=r;let i="";for(const s of n){const a=o.find(y=>y.attributes.Id===s.attributes["r:id"])?.attributes?.Target;if(!a)return;const l=this.fonts[`word/${a}`]?.buffer;if(!l)return;const c=PE(l,s.attributes["w:fontKey"]);if(!c)return;const u=new Blob([c],{type:"font/ttf"}),d=URL.createObjectURL(u),p=s.name.includes("Regular"),f=s.name.includes("Bold"),h=s.name.includes("Italic"),m=s.name.includes("Light");i+=`
|
|
30
|
+
`))}})}function lE(t,e,n){let r=t.resolve(e),o=r.index();return r.parent.canReplaceWith(o,o+1,n)}function cE(t,e,n,r,o){let i=t.doc.nodeAt(e);if(!i)throw new RangeError("No node at given position");n||(n=i.type);let s=n.create(r,null,o||i.marks);if(i.isLeaf)return t.replaceWith(e,e+i.nodeSize,s);if(!n.validContent(i.content))throw new RangeError("Invalid content for node type "+n.name);t.step(new Zt(e,e+i.nodeSize,e+1,e+i.nodeSize-1,new ve(ye.from(s),0,0),1,!0))}function tr(t,e,n=1,r){let o=t.resolve(e),i=o.depth-n,s=r&&r[r.length-1]||o.parent;if(i<0||o.parent.type.spec.isolating||!o.parent.canReplace(o.index(),o.parent.childCount)||!s.type.validContent(o.parent.content.cutByIndex(o.index(),o.parent.childCount)))return!1;for(let c=o.depth-1,u=n-2;c>i;c--,u--){let d=o.node(c),p=o.index(c);if(d.type.spec.isolating)return!1;let f=d.content.cutByIndex(p,d.childCount),h=r&&r[u+1];h&&(f=f.replaceChild(0,h.type.create(h.attrs)));let m=r&&r[u]||d;if(!d.canReplace(p+1,d.childCount)||!m.type.validContent(f))return!1}let a=o.indexAfter(i),l=r&&r[0];return o.node(i).canReplaceWith(a,a,l?l.type:o.node(i+1).type)}function uE(t,e,n=1,r){let o=t.doc.resolve(e),i=ye.empty,s=ye.empty;for(let a=o.depth,l=o.depth-n,c=n-1;a>l;a--,c--){i=ye.from(o.node(a).copy(i));let u=r&&r[c];s=ye.from(u?u.type.create(u.attrs,s):o.node(a).copy(s))}t.step(new Tt(e,e,new ve(i.append(s),n,n),!0))}function Pr(t,e){let n=t.resolve(e),r=n.index();return wv(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(r,r+1)}function dE(t,e){e.content.size||t.type.compatibleContent(e.type);let n=t.contentMatchAt(t.childCount),{linebreakReplacement:r}=t.type.schema;for(let o=0;o<e.childCount;o++){let i=e.child(o),s=i.type==r?t.type.schema.nodes.text:i.type;if(n=n.matchType(s),!n||!t.type.allowsMarks(i.marks))return!1}return n.validEnd}function wv(t,e){return!!(t&&e&&!t.isLeaf&&dE(t,e))}function bv(t,e,n=-1){let r=t.resolve(e);for(let o=r.depth;;o--){let i,s,a=r.index(o);if(o==r.depth?(i=r.nodeBefore,s=r.nodeAfter):n>0?(i=r.node(o+1),a++,s=r.node(o).maybeChild(a)):(i=r.node(o).maybeChild(a-1),s=r.node(o+1)),i&&!i.isTextblock&&wv(i,s)&&r.node(o).canReplace(a,a+1))return e;if(o==0)break;e=n<0?r.before(o):r.after(o)}}function pE(t,e,n){let r=null,{linebreakReplacement:o}=t.doc.type.schema,i=t.doc.resolve(e-n),s=i.node().type;if(o&&s.inlineContent){let u=s.whitespace=="pre",d=!!s.contentMatch.matchType(o);u&&!d?r=!1:!u&&d&&(r=!0)}let a=t.steps.length;if(r===!1){let u=t.doc.resolve(e+n);yv(t,u.node(),u.before(),a)}s.inlineContent&&sf(t,e+n-1,s,i.node().contentMatchAt(i.index()),r==null);let l=t.mapping.slice(a),c=l.map(e-n);if(t.step(new Tt(c,l.map(e+n,-1),ve.empty,!0)),r===!0){let u=t.doc.resolve(c);gv(t,u.node(),u.before(),t.steps.length)}return t}function fE(t,e,n){let r=t.resolve(e);if(r.parent.canReplaceWith(r.index(),r.index(),n))return e;if(r.parentOffset==0)for(let o=r.depth-1;o>=0;o--){let i=r.index(o);if(r.node(o).canReplaceWith(i,i,n))return r.before(o+1);if(i>0)return null}if(r.parentOffset==r.parent.content.size)for(let o=r.depth-1;o>=0;o--){let i=r.indexAfter(o);if(r.node(o).canReplaceWith(i,i,n))return r.after(o+1);if(i<r.node(o).childCount)return null}return null}function vv(t,e,n){let r=t.resolve(e);if(!n.content.size)return e;let o=n.content;for(let i=0;i<n.openStart;i++)o=o.firstChild.content;for(let i=1;i<=(n.openStart==0&&n.size?2:1);i++)for(let s=r.depth;s>=0;s--){let a=s==r.depth?0:r.pos<=(r.start(s+1)+r.end(s+1))/2?-1:1,l=r.index(s)+(a>0?1:0),c=r.node(s),u=!1;if(i==1)u=c.canReplace(l,l,o);else{let d=c.contentMatchAt(l).findWrapping(o.firstChild.type);u=d&&c.canReplaceWith(l,l,d[0])}if(u)return a==0?r.pos:a<0?r.before(s+1):r.after(s+1)}return null}function af(t,e,n=e,r=ve.empty){if(e==n&&!r.size)return null;let o=t.resolve(e),i=t.resolve(n);return xv(o,i,r)?new Tt(e,n,r):new hE(o,i,r).fit()}function xv(t,e,n){return!n.openStart&&!n.openEnd&&t.start()==e.start()&&t.parent.canReplace(t.index(),e.index(),n.content)}let hE=class{constructor(e,n,r){this.$from=e,this.$to=n,this.unplaced=r,this.frontier=[],this.placed=ye.empty;for(let o=0;o<=e.depth;o++){let i=e.node(o);this.frontier.push({type:i.type,match:i.contentMatchAt(e.indexAfter(o))})}for(let o=e.depth;o>0;o--)this.placed=ye.from(e.node(o).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let c=this.findFittable();c?this.placeNodes(c):this.openMore()||this.dropNode()}let e=this.mustMoveInline(),n=this.placed.size-this.depth-this.$from.depth,r=this.$from,o=this.close(e<0?this.$to:r.doc.resolve(e));if(!o)return null;let i=this.placed,s=r.depth,a=o.depth;for(;s&&a&&i.childCount==1;)i=i.firstChild.content,s--,a--;let l=new ve(i,s,a);return e>-1?new Zt(r.pos,e,this.$to.pos,this.$to.end(),l,n):l.size||r.pos!=this.$to.pos?new Tt(r.pos,o.pos,l):null}findFittable(){let e=this.unplaced.openStart;for(let n=this.unplaced.content,r=0,o=this.unplaced.openEnd;r<e;r++){let i=n.firstChild;if(n.childCount>1&&(o=0),i.type.spec.isolating&&o<=r){e=r;break}n=i.content}for(let n=1;n<=2;n++)for(let r=n==1?e:this.unplaced.openStart;r>=0;r--){let o,i=null;r?(i=bu(this.unplaced.content,r-1).firstChild,o=i.content):o=this.unplaced.content;let s=o.firstChild;for(let a=this.depth;a>=0;a--){let{type:l,match:c}=this.frontier[a],u,d=null;if(n==1&&(s?c.matchType(s.type)||(d=c.fillBefore(ye.from(s),!1)):i&&l.compatibleContent(i.type)))return{sliceDepth:r,frontierDepth:a,parent:i,inject:d};if(n==2&&s&&(u=c.findWrapping(s.type)))return{sliceDepth:r,frontierDepth:a,parent:i,wrap:u};if(i&&c.matchType(i.type))break}}}openMore(){let{content:e,openStart:n,openEnd:r}=this.unplaced,o=bu(e,n);return!o.childCount||o.firstChild.isLeaf?!1:(this.unplaced=new ve(e,n+1,Math.max(r,o.size+n>=e.size-r?n+1:0)),!0)}dropNode(){let{content:e,openStart:n,openEnd:r}=this.unplaced,o=bu(e,n);if(o.childCount<=1&&n>0){let i=e.size-n<=n+o.size;this.unplaced=new ve(Li(e,n-1,1),n-1,i?n-1:r)}else this.unplaced=new ve(Li(e,n,1),n,r)}placeNodes({sliceDepth:e,frontierDepth:n,parent:r,inject:o,wrap:i}){for(;this.depth>n;)this.closeFrontierNode();if(i)for(let m=0;m<i.length;m++)this.openFrontierNode(i[m]);let s=this.unplaced,a=r?r.content:s.content,l=s.openStart-e,c=0,u=[],{match:d,type:p}=this.frontier[n];if(o){for(let m=0;m<o.childCount;m++)u.push(o.child(m));d=d.matchFragment(o)}let f=a.size+e-(s.content.size-s.openEnd);for(;c<a.childCount;){let m=a.child(c),y=d.matchType(m.type);if(!y)break;c++,(c>1||l==0||m.content.size)&&(d=y,u.push(kv(m.mark(p.allowedMarks(m.marks)),c==1?l:0,c==a.childCount?f:-1)))}let h=c==a.childCount;h||(f=-1),this.placed=Pi(this.placed,n,ye.from(u)),this.frontier[n].match=d,h&&f<0&&r&&r.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let m=0,y=a;m<f;m++){let g=y.lastChild;this.frontier.push({type:g.type,match:g.contentMatchAt(g.childCount)}),y=g.content}this.unplaced=h?e==0?ve.empty:new ve(Li(s.content,e-1,1),e-1,f<0?s.openEnd:e-1):new ve(Li(s.content,e,c),s.openStart,s.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let e=this.frontier[this.depth],n;if(!e.type.isTextblock||!vu(this.$to,this.$to.depth,e.type,e.match,!1)||this.$to.depth==this.depth&&(n=this.findCloseLevel(this.$to))&&n.depth==this.depth)return-1;let{depth:r}=this.$to,o=this.$to.after(r);for(;r>1&&o==this.$to.end(--r);)++o;return o}findCloseLevel(e){e:for(let n=Math.min(this.depth,e.depth);n>=0;n--){let{match:r,type:o}=this.frontier[n],i=n<e.depth&&e.end(n+1)==e.pos+(e.depth-(n+1)),s=vu(e,n,o,r,i);if(s){for(let a=n-1;a>=0;a--){let{match:l,type:c}=this.frontier[a],u=vu(e,a,c,l,!0);if(!u||u.childCount)continue e}return{depth:n,fit:s,move:i?e.doc.resolve(e.after(n+1)):e}}}}close(e){let n=this.findCloseLevel(e);if(!n)return null;for(;this.depth>n.depth;)this.closeFrontierNode();n.fit.childCount&&(this.placed=Pi(this.placed,n.depth,n.fit)),e=n.move;for(let r=n.depth+1;r<=e.depth;r++){let o=e.node(r),i=o.type.contentMatch.fillBefore(o.content,!0,e.index(r));this.openFrontierNode(o.type,o.attrs,i)}return e}openFrontierNode(e,n=null,r){let o=this.frontier[this.depth];o.match=o.match.matchType(e),this.placed=Pi(this.placed,this.depth,ye.from(e.create(n,r))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let e=this.frontier.pop().match.fillBefore(ye.empty,!0);e.childCount&&(this.placed=Pi(this.placed,this.frontier.length,e))}};function Li(t,e,n){return e==0?t.cutByIndex(n,t.childCount):t.replaceChild(0,t.firstChild.copy(Li(t.firstChild.content,e-1,n)))}function Pi(t,e,n){return e==0?t.append(n):t.replaceChild(t.childCount-1,t.lastChild.copy(Pi(t.lastChild.content,e-1,n)))}function bu(t,e){for(let n=0;n<e;n++)t=t.firstChild.content;return t}function kv(t,e,n){if(e<=0)return t;let r=t.content;return e>1&&(r=r.replaceChild(0,kv(r.firstChild,e-1,r.childCount==1?n-1:0))),e>0&&(r=t.type.contentMatch.fillBefore(r).append(r),n<=0&&(r=r.append(t.type.contentMatch.matchFragment(r).fillBefore(ye.empty,!0)))),t.copy(r)}function vu(t,e,n,r,o){let i=t.node(e),s=o?t.indexAfter(e):t.index(e);if(s==i.childCount&&!n.compatibleContent(i.type))return null;let a=r.fillBefore(i.content,!0,s);return a&&!mE(n,i.content,s)?a:null}function mE(t,e,n){for(let r=n;r<e.childCount;r++)if(!t.allowsMarks(e.child(r).marks))return!0;return!1}function gE(t){return t.spec.defining||t.spec.definingForContent}function yE(t,e,n,r){if(!r.size)return t.deleteRange(e,n);let o=t.doc.resolve(e),i=t.doc.resolve(n);if(xv(o,i,r))return t.step(new Tt(e,n,r));let s=Av(o,t.doc.resolve(n));s[s.length-1]==0&&s.pop();let a=-(o.depth+1);s.unshift(a);for(let p=o.depth,f=o.pos-1;p>0;p--,f--){let h=o.node(p).type.spec;if(h.defining||h.definingAsContext||h.isolating)break;s.indexOf(p)>-1?a=p:o.before(p)==f&&s.splice(1,0,-p)}let l=s.indexOf(a),c=[],u=r.openStart;for(let p=r.content,f=0;;f++){let h=p.firstChild;if(c.push(h),f==r.openStart)break;p=h.content}for(let p=u-1;p>=0;p--){let f=c[p],h=gE(f.type);if(h&&!f.sameMarkup(o.node(Math.abs(a)-1)))u=p;else if(h||!f.type.isTextblock)break}for(let p=r.openStart;p>=0;p--){let f=(p+u+1)%(r.openStart+1),h=c[f];if(h)for(let m=0;m<s.length;m++){let y=s[(m+l)%s.length],g=!0;y<0&&(g=!1,y=-y);let v=o.node(y-1),k=o.index(y-1);if(v.canReplaceWith(k,k,h.type,h.marks))return t.replace(o.before(y),g?i.after(y):n,new ve(Sv(r.content,0,r.openStart,f),f,r.openEnd))}}let d=t.steps.length;for(let p=s.length-1;p>=0&&(t.replace(e,n,r),!(t.steps.length>d));p--){let f=s[p];f<0||(e=o.before(f),n=i.after(f))}}function Sv(t,e,n,r,o){if(e<n){let i=t.firstChild;t=t.replaceChild(0,i.copy(Sv(i.content,e+1,n,r,i)))}if(e>r){let i=o.contentMatchAt(0),s=i.fillBefore(t).append(t);t=s.append(i.matchFragment(s).fillBefore(ye.empty,!0))}return t}function wE(t,e,n,r){if(!r.isInline&&e==n&&t.doc.resolve(e).parent.content.size){let o=fE(t.doc,e,r.type);o!=null&&(e=n=o)}t.replaceRange(e,n,new ve(ye.from(r),0,0))}function bE(t,e,n){let r=t.doc.resolve(e),o=t.doc.resolve(n),i=Av(r,o);for(let s=0;s<i.length;s++){let a=i[s],l=s==i.length-1;if(l&&a==0||r.node(a).type.contentMatch.validEnd)return t.delete(r.start(a),o.end(a));if(a>0&&(l||r.node(a-1).canReplace(r.index(a-1),o.indexAfter(a-1))))return t.delete(r.before(a),o.after(a))}for(let s=1;s<=r.depth&&s<=o.depth;s++)if(e-r.start(s)==r.depth-s&&n>r.end(s)&&o.end(s)-n!=o.depth-s&&r.start(s-1)==o.start(s-1)&&r.node(s-1).canReplace(r.index(s-1),o.index(s-1)))return t.delete(r.before(s),n);t.delete(e,n)}function Av(t,e){let n=[],r=Math.min(t.depth,e.depth);for(let o=r;o>=0;o--){let i=t.start(o);if(i<t.pos-(t.depth-o)||e.end(o)>e.pos+(e.depth-o)||t.node(o).type.spec.isolating||e.node(o).type.spec.isolating)break;(i==e.start(o)||o==t.depth&&o==e.depth&&t.parent.inlineContent&&e.parent.inlineContent&&o&&e.start(o-1)==i-1)&&n.push(o)}return n}let Cv=class za extends Rt{constructor(e,n,r){super(),this.pos=e,this.attr=n,this.value=r}apply(e){let n=e.nodeAt(this.pos);if(!n)return jt.fail("No node at attribute step's position");let r=Object.create(null);for(let i in n.attrs)r[i]=n.attrs[i];r[this.attr]=this.value;let o=n.type.create(r,null,n.marks);return jt.fromReplace(e,this.pos,this.pos+1,new ve(ye.from(o),0,n.isLeaf?0:1))}getMap(){return mo.empty}invert(e){return new za(this.pos,this.attr,e.nodeAt(this.pos).attrs[this.attr])}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new za(n.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(e,n){if(typeof n.pos!="number"||typeof n.attr!="string")throw new RangeError("Invalid input for AttrStep.fromJSON");return new za(n.pos,n.attr,n.value)}};Rt.jsonID("attr",Cv);let Ev=class _d extends Rt{constructor(e,n){super(),this.attr=e,this.value=n}apply(e){let n=Object.create(null);for(let o in e.attrs)n[o]=e.attrs[o];n[this.attr]=this.value;let r=e.type.create(n,e.content,e.marks);return jt.ok(r)}getMap(){return mo.empty}invert(e){return new _d(this.attr,e.attrs[this.attr])}map(e){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(e,n){if(typeof n.attr!="string")throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new _d(n.attr,n.value)}};Rt.jsonID("docAttr",Ev);let ri=class extends Error{};ri=function t(e){let n=Error.call(this,e);return n.__proto__=t.prototype,n};ri.prototype=Object.create(Error.prototype);ri.prototype.constructor=ri;ri.prototype.name="TransformError";let Tv=class{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new ni}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let n=this.maybeStep(e);if(n.failed)throw new ri(n.failed);return this}maybeStep(e){let n=e.apply(this.doc);return n.failed||this.addStep(e,n.doc),n}get docChanged(){return this.steps.length>0}addStep(e,n){this.docs.push(this.doc),this.steps.push(e),this.mapping.appendMap(e.getMap()),this.doc=n}replace(e,n=e,r=ve.empty){let o=af(this.doc,e,n,r);return o&&this.step(o),this}replaceWith(e,n,r){return this.replace(e,n,new ve(ye.from(r),0,0))}delete(e,n){return this.replace(e,n,ve.empty)}insert(e,n){return this.replaceWith(e,e,n)}replaceRange(e,n,r){return yE(this,e,n,r),this}replaceRangeWith(e,n,r){return wE(this,e,n,r),this}deleteRange(e,n){return bE(this,e,n),this}lift(e,n){return rE(this,e,n),this}join(e,n=1){return pE(this,e,n),this}wrap(e,n){return sE(this,e,n),this}setBlockType(e,n=e,r,o=null){return aE(this,e,n,r,o),this}setNodeMarkup(e,n,r=null,o){return cE(this,e,n,r,o),this}setNodeAttribute(e,n,r){return this.step(new Cv(e,n,r)),this}setDocAttribute(e,n){return this.step(new Ev(e,n)),this}addNodeMark(e,n){return this.step(new of(e,n)),this}removeNodeMark(e,n){let r=this.doc.nodeAt(e);if(!r)throw new RangeError("No node at position "+e);if(n instanceof Xe)n.isInSet(r.marks)&&this.step(new ul(e,n));else{let o=r.marks,i,s=[];for(;i=n.isInSet(o);)s.push(new ul(e,i)),o=i.removeFromSet(o);for(let a=s.length-1;a>=0;a--)this.step(s[a])}return this}split(e,n=1,r){return uE(this,e,n,r),this}addMark(e,n,r){return eE(this,e,n,r),this}removeMark(e,n,r){return tE(this,e,n,r),this}clearIncompatible(e,n,r){return sf(this,e,n,r),this}};const xu=Object.create(null);let je=class{constructor(e,n,r){this.$anchor=e,this.$head=n,this.ranges=r||[new $v(e.min(n),e.max(n))]}get anchor(){return this.$anchor.pos}get head(){return this.$head.pos}get from(){return this.$from.pos}get to(){return this.$to.pos}get $from(){return this.ranges[0].$from}get $to(){return this.ranges[0].$to}get empty(){let e=this.ranges;for(let n=0;n<e.length;n++)if(e[n].$from.pos!=e[n].$to.pos)return!1;return!0}content(){return this.$from.doc.slice(this.from,this.to,!0)}replace(e,n=ve.empty){let r=n.content.lastChild,o=null;for(let a=0;a<n.openEnd;a++)o=r,r=r.lastChild;let i=e.steps.length,s=this.ranges;for(let a=0;a<s.length;a++){let{$from:l,$to:c}=s[a],u=e.mapping.slice(i);e.replaceRange(u.map(l.pos),u.map(c.pos),a?ve.empty:n),a==0&&Ag(e,i,(r?r.isInline:o&&o.isTextblock)?-1:1)}}replaceWith(e,n){let r=e.steps.length,o=this.ranges;for(let i=0;i<o.length;i++){let{$from:s,$to:a}=o[i],l=e.mapping.slice(r),c=l.map(s.pos),u=l.map(a.pos);i?e.deleteRange(c,u):(e.replaceRangeWith(c,u,n),Ag(e,r,n.isInline?-1:1))}}static findFrom(e,n,r=!1){let o=e.parent.inlineContent?new Pe(e):Lo(e.node(0),e.parent,e.pos,e.index(),n,r);if(o)return o;for(let i=e.depth-1;i>=0;i--){let s=n<0?Lo(e.node(0),e.node(i),e.before(i+1),e.index(i),n,r):Lo(e.node(0),e.node(i),e.after(i+1),e.index(i)+1,n,r);if(s)return s}return null}static near(e,n=1){return this.findFrom(e,n)||this.findFrom(e,-n)||new Nn(e.node(0))}static atStart(e){return Lo(e,e,0,0,1)||new Nn(e)}static atEnd(e){return Lo(e,e,e.content.size,e.childCount,-1)||new Nn(e)}static fromJSON(e,n){if(!n||!n.type)throw new RangeError("Invalid input for Selection.fromJSON");let r=xu[n.type];if(!r)throw new RangeError(`No selection type ${n.type} defined`);return r.fromJSON(e,n)}static jsonID(e,n){if(e in xu)throw new RangeError("Duplicate use of selection JSON ID "+e);return xu[e]=n,n.prototype.jsonID=e,n}getBookmark(){return Pe.between(this.$anchor,this.$head).getBookmark()}};je.prototype.visible=!0;let $v=class{constructor(e,n){this.$from=e,this.$to=n}},kg=!1;function Sg(t){!kg&&!t.parent.inlineContent&&(kg=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+t.parent.type.name+")"))}let Pe=class zi extends je{constructor(e,n=e){Sg(e),Sg(n),super(e,n)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(e,n){let r=e.resolve(n.map(this.head));if(!r.parent.inlineContent)return je.near(r);let o=e.resolve(n.map(this.anchor));return new zi(o.parent.inlineContent?o:r,r)}replace(e,n=ve.empty){if(super.replace(e,n),n==ve.empty){let r=this.$from.marksAcross(this.$to);r&&e.ensureMarks(r)}}eq(e){return e instanceof zi&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new Ov(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(e,n){if(typeof n.anchor!="number"||typeof n.head!="number")throw new RangeError("Invalid input for TextSelection.fromJSON");return new zi(e.resolve(n.anchor),e.resolve(n.head))}static create(e,n,r=n){let o=e.resolve(n);return new this(o,r==n?o:e.resolve(r))}static between(e,n,r){let o=e.pos-n.pos;if((!r||o)&&(r=o>=0?1:-1),!n.parent.inlineContent){let i=je.findFrom(n,r,!0)||je.findFrom(n,-r,!0);if(i)n=i.$head;else return je.near(n,r)}return e.parent.inlineContent||(o==0?e=n:(e=(je.findFrom(e,-r,!0)||je.findFrom(e,r,!0)).$anchor,e.pos<n.pos!=o<0&&(e=n))),new zi(e,n)}};je.jsonID("text",Pe);let Ov=class Mv{constructor(e,n){this.anchor=e,this.head=n}map(e){return new Mv(e.map(this.anchor),e.map(this.head))}resolve(e){return Pe.between(e.resolve(this.anchor),e.resolve(this.head))}},_e=class ji extends je{constructor(e){let n=e.nodeAfter,r=e.node(0).resolve(e.pos+n.nodeSize);super(e,r),this.node=n}map(e,n){let{deleted:r,pos:o}=n.mapResult(this.anchor),i=e.resolve(o);return r?je.near(i):new ji(i)}content(){return new ve(ye.from(this.node),0,0)}eq(e){return e instanceof ji&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new vE(this.anchor)}static fromJSON(e,n){if(typeof n.anchor!="number")throw new RangeError("Invalid input for NodeSelection.fromJSON");return new ji(e.resolve(n.anchor))}static create(e,n){return new ji(e.resolve(n))}static isSelectable(e){return!e.isText&&e.type.spec.selectable!==!1}};_e.prototype.visible=!1;je.jsonID("node",_e);let vE=class Dv{constructor(e){this.anchor=e}map(e){let{deleted:n,pos:r}=e.mapResult(this.anchor);return n?new Ov(r,r):new Dv(r)}resolve(e){let n=e.resolve(this.anchor),r=n.nodeAfter;return r&&_e.isSelectable(r)?new _e(n):je.near(n)}},Nn=class ja extends je{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,n=ve.empty){if(n==ve.empty){e.delete(0,e.doc.content.size);let r=je.atStart(e.doc);r.eq(e.selection)||e.setSelection(r)}else super.replace(e,n)}toJSON(){return{type:"all"}}static fromJSON(e){return new ja(e)}map(e){return new ja(e)}eq(e){return e instanceof ja}getBookmark(){return xE}};je.jsonID("all",Nn);const xE={map(){return this},resolve(t){return new Nn(t)}};function Lo(t,e,n,r,o,i=!1){if(e.inlineContent)return Pe.create(t,n);for(let s=r-(o>0?0:1);o>0?s<e.childCount:s>=0;s+=o){let a=e.child(s);if(a.isAtom){if(!i&&_e.isSelectable(a))return _e.create(t,n-(o<0?a.nodeSize:0))}else{let l=Lo(t,a,n+o,o<0?a.childCount:0,o,i);if(l)return l}n+=a.nodeSize*o}return null}function Ag(t,e,n){let r=t.steps.length-1;if(r<e)return;let o=t.steps[r];if(!(o instanceof Tt||o instanceof Zt))return;let i=t.mapping.maps[r],s;i.forEach((a,l,c,u)=>{s==null&&(s=u)}),t.setSelection(je.near(t.doc.resolve(s),n))}const Cg=1,Eg=2,Tg=4;let kE=class extends Tv{constructor(e){super(e.doc),this.curSelectionFor=0,this.updated=0,this.meta=Object.create(null),this.time=Date.now(),this.curSelection=e.selection,this.storedMarks=e.storedMarks}get selection(){return this.curSelectionFor<this.steps.length&&(this.curSelection=this.curSelection.map(this.doc,this.mapping.slice(this.curSelectionFor)),this.curSelectionFor=this.steps.length),this.curSelection}setSelection(e){if(e.$from.doc!=this.doc)throw new RangeError("Selection passed to setSelection must point at the current document");return this.curSelection=e,this.curSelectionFor=this.steps.length,this.updated=(this.updated|Cg)&-3,this.storedMarks=null,this}get selectionSet(){return(this.updated&Cg)>0}setStoredMarks(e){return this.storedMarks=e,this.updated|=Eg,this}ensureMarks(e){return Xe.sameSet(this.storedMarks||this.selection.$from.marks(),e)||this.setStoredMarks(e),this}addStoredMark(e){return this.ensureMarks(e.addToSet(this.storedMarks||this.selection.$head.marks()))}removeStoredMark(e){return this.ensureMarks(e.removeFromSet(this.storedMarks||this.selection.$head.marks()))}get storedMarksSet(){return(this.updated&Eg)>0}addStep(e,n){super.addStep(e,n),this.updated=this.updated&-3,this.storedMarks=null}setTime(e){return this.time=e,this}replaceSelection(e){return this.selection.replace(this,e),this}replaceSelectionWith(e,n=!0){let r=this.selection;return n&&(e=e.mark(this.storedMarks||(r.empty?r.$from.marks():r.$from.marksAcross(r.$to)||Xe.none))),r.replaceWith(this,e),this}deleteSelection(){return this.selection.replace(this),this}insertText(e,n,r){let o=this.doc.type.schema;if(n==null)return e?this.replaceSelectionWith(o.text(e),!0):this.deleteSelection();{if(r==null&&(r=n),r=r??n,!e)return this.deleteRange(n,r);let i=this.storedMarks;if(!i){let s=this.doc.resolve(n);i=r==n?s.marks():s.marksAcross(this.doc.resolve(r))}return this.replaceRangeWith(n,r,o.text(e,i)),this.selection.empty||this.setSelection(je.near(this.selection.$to)),this}}setMeta(e,n){return this.meta[typeof e=="string"?e:e.key]=n,this}getMeta(e){return this.meta[typeof e=="string"?e:e.key]}get isGeneric(){for(let e in this.meta)return!1;return!0}scrollIntoView(){return this.updated|=Tg,this}get scrolledIntoView(){return(this.updated&Tg)>0}};function $g(t,e){return!e||!t?t:t.bind(e)}let qi=class{constructor(e,n,r){this.name=e,this.init=$g(n.init,r),this.apply=$g(n.apply,r)}};const SE=[new qi("doc",{init(t){return t.doc||t.schema.topNodeType.createAndFill()},apply(t){return t.doc}}),new qi("selection",{init(t,e){return t.selection||je.atStart(e.doc)},apply(t){return t.selection}}),new qi("storedMarks",{init(t){return t.storedMarks||null},apply(t,e,n,r){return r.selection.$cursor?t.storedMarks:null}}),new qi("scrollToSelection",{init(){return 0},apply(t,e){return t.scrolledIntoView?e+1:e}})];let ku=class{constructor(e,n){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=SE.slice(),n&&n.forEach(r=>{if(this.pluginsByKey[r.key])throw new RangeError("Adding different instances of a keyed plugin ("+r.key+")");this.plugins.push(r),this.pluginsByKey[r.key]=r,r.spec.state&&this.fields.push(new qi(r.key,r.spec.state,r))})}},Zi=class Vi{constructor(e){this.config=e}get schema(){return this.config.schema}get plugins(){return this.config.plugins}apply(e){return this.applyTransaction(e).state}filterTransaction(e,n=-1){for(let r=0;r<this.config.plugins.length;r++)if(r!=n){let o=this.config.plugins[r];if(o.spec.filterTransaction&&!o.spec.filterTransaction.call(o,e,this))return!1}return!0}applyTransaction(e){if(!this.filterTransaction(e))return{state:this,transactions:[]};let n=[e],r=this.applyInner(e),o=null;for(;;){let i=!1;for(let s=0;s<this.config.plugins.length;s++){let a=this.config.plugins[s];if(a.spec.appendTransaction){let l=o?o[s].n:0,c=o?o[s].state:this,u=l<n.length&&a.spec.appendTransaction.call(a,l?n.slice(l):n,c,r);if(u&&r.filterTransaction(u,s)){if(u.setMeta("appendedTransaction",e),!o){o=[];for(let d=0;d<this.config.plugins.length;d++)o.push(d<s?{state:r,n:n.length}:{state:this,n:0})}n.push(u),r=r.applyInner(u),i=!0}o&&(o[s]={state:r,n:n.length})}}if(!i)return{state:r,transactions:n}}}applyInner(e){if(!e.before.eq(this.doc))throw new RangeError("Applying a mismatched transaction");let n=new Vi(this.config),r=this.config.fields;for(let o=0;o<r.length;o++){let i=r[o];n[i.name]=i.apply(e,this[i.name],this,n)}return n}get tr(){return new kE(this)}static create(e){let n=new ku(e.doc?e.doc.type.schema:e.schema,e.plugins),r=new Vi(n);for(let o=0;o<n.fields.length;o++)r[n.fields[o].name]=n.fields[o].init(e,r);return r}reconfigure(e){let n=new ku(this.schema,e.plugins),r=n.fields,o=new Vi(n);for(let i=0;i<r.length;i++){let s=r[i].name;o[s]=this.hasOwnProperty(s)?this[s]:r[i].init(e,o)}return o}toJSON(e){let n={doc:this.doc.toJSON(),selection:this.selection.toJSON()};if(this.storedMarks&&(n.storedMarks=this.storedMarks.map(r=>r.toJSON())),e&&typeof e=="object")for(let r in e){if(r=="doc"||r=="selection")throw new RangeError("The JSON fields `doc` and `selection` are reserved");let o=e[r],i=o.spec.state;i&&i.toJSON&&(n[r]=i.toJSON.call(o,this[o.key]))}return n}static fromJSON(e,n,r){if(!n)throw new RangeError("Invalid input for EditorState.fromJSON");if(!e.schema)throw new RangeError("Required config field 'schema' missing");let o=new ku(e.schema,e.plugins),i=new Vi(o);return o.fields.forEach(s=>{if(s.name=="doc")i.doc=so.fromJSON(e.schema,n.doc);else if(s.name=="selection")i.selection=je.fromJSON(i.doc,n.selection);else if(s.name=="storedMarks")n.storedMarks&&(i.storedMarks=n.storedMarks.map(e.schema.markFromJSON));else{if(r)for(let a in r){let l=r[a],c=l.spec.state;if(l.key==s.name&&c&&c.fromJSON&&Object.prototype.hasOwnProperty.call(n,a)){i[s.name]=c.fromJSON.call(l,e,n[a],i);return}}i[s.name]=s.init(e,i)}}),i}};function _v(t,e,n){for(let r in t){let o=t[r];o instanceof Function?o=o.bind(e):r=="handleDOMEvents"&&(o=_v(o,e,{})),n[r]=o}return n}let Ue=class{constructor(e){this.spec=e,this.props={},e.props&&_v(e.props,this,this.props),this.key=e.key?e.key.key:Nv("plugin")}getState(e){return e[this.key]}};const Su=Object.create(null);function Nv(t){return t in Su?t+"$"+ ++Su[t]:(Su[t]=0,t+"$")}let Ge=class{constructor(e="key"){this.key=Nv(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}};const dl=t=>t.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`),AE=t=>dl(t),qa=Object.freeze({RESOLVED:"resolved",NEW:"new",ADD:"add",UPDATE:"update",DELETED:"deleted",PENDING:"pending",SELECTED:"selected",COMMENTS_LIST:"comments-list",CHANGE_ACCEPTED:"change-accepted",CHANGE_REJECTED:"change-rejected"}),CE={mounted(t,e,n){const r=o=>{t.contains(o.target)||e.value(o)};document.addEventListener("click",r),t.__clickOutsideHandler=r},unmounted(t){document.removeEventListener("click",t.__clickOutsideHandler),delete t.__clickOutsideHandler}};function Ke(t,e=null,...n){return typeof t=="function"?e?t.bind(e)(...n):t(...n):t}function EE(t={}){return Object.keys(t).length===0&&t.constructor===Object}const TE=()=>typeof navigator<"u"?/Mac/.test(navigator.platform):!1,$E=()=>["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform),Iv=t=>Object.prototype.toString.call(t)==="[object RegExp]";function oi(t,e,n={strict:!0}){const r=Object.keys(e);return r.length?r.every(o=>n.strict?e[o]===t[o]:Iv(e[o])?e[o].test(t[o]):e[o]===t[o]):!0}function Og(t,e){const n=typeof e=="string"?[e]:e;return Object.keys(t).reduce((r,o)=>(n.includes(o)||(r[o]=t[o]),r),{})}const OE=/[\d-.]+(\w+)$/,ME=["px","rem","em","in","q","mm","cm","pt","pc","vh","vw","vmin","vmax"];function nr(t="0"){const e=t.toString()||"0",n=Number.parseFloat(e),r=(e.match(OE)?.[1]??"").toLowerCase();return[n,ME.includes(r)?r:null]}function pl(t=0,e=0,n=0){return Math.min(Math.max(t,e),n)}function ii(t){if(t!=null)return typeof t=="string"&&(t=parseFloat(t)),Math.round(t*1440)}function Wt(t){if(t!=null)return typeof t=="string"&&(t=parseInt(t,10)),Math.round(t/1440*100)/100}function nt(t){if(t!=null)return t=Wt(t),Math.round(t*96)}function at(t){if(t!=null)return t=t/96,ii(t)}function Jo(t){if(t!=null)return t/240}function Nd(t){if(t!=null)return t*240}function DE(t){if(t!=null)return Math.round(t/2)}function Gt(t){if(t==null)return;typeof t=="string"&&(t=parseFloat(t));const e=t*96/914400;return Math.round(e)}function Vr(t){if(t!=null)return typeof t=="string"&&(t=parseFloat(t)),Math.round(t*9525)}function Fv(t){return t==null?void 0:parseFloat(t)/8*1.3333}function Rv(t){if(t!=null)return Math.round(t*6)}function Bv(t){if(t!=null)return t/20}function _E(t){if(t!=null)return t*20}const NE=async(t,e)=>{const n=/^https?:|^blob:|^file:|^data:/i.test(t);if(e&&n&&typeof fetch=="function"){const i=await fetch(t);if(!i.ok)throw new Error(`Fetch failed: ${i.status} ${i.statusText}`);return await i.arrayBuffer()}const r=t.includes(",")?t.split(",",2)[1]:t.trim().replace(/\s/g,"");try{if(typeof globalThis.atob=="function"){const i=globalThis.atob(r),s=new Uint8Array(i.length);for(let a=0;a<i.length;a++)s[a]=i.charCodeAt(a);return s.buffer}}catch(i){console.warn("atob failed, falling back to Buffer:",i)}const o=mt.from(r,"base64");return o.buffer.slice(o.byteOffset,o.byteOffset+o.byteLength)},IE=t=>{const e=new window.DOMParser().parseFromString(t,"text/xml").querySelectorAll("Default");return Array.from(e).map(n=>n.getAttribute("Extension"))},FE=t=>new Map([["yellow","#ffff00"],["green","#00ff00"],["blue","#0000FFFF"],["cyan","#00ffff"],["magenta","#ff00ff"],["red","#ff0000"],["darkYellow","#808000FF"],["darkGreen","#008000FF"],["darkBlue","#000080"],["darkCyan","#008080FF"],["darkMagenta","#800080FF"],["darkGray","#808080FF"],["darkRed","#800000FF"],["lightGray","#C0C0C0FF"],["black","#000"]]).get(t)||null;function RE(t){if(!t||typeof t!="string")return!1;switch(t.length){case 3:return/^[0-9A-F]{3}$/i.test(t);case 6:return/^[0-9A-F]{6}$/i.test(t);case 8:return/^[0-9A-F]{8}$/i.test(t);default:return!1}}const BE=t=>{const e=Number(t).toString(16);return e.length===1?"0"+e:e},LE=t=>"#"+t.match(/\d+/g).map(BE).join(""),Zl=(t,e,n="",r=!1)=>{let[o,i]=nr(t);return Number.isNaN(o)||o===0?{}:n==="atLeast"&&o<1?{}:(i=i||e,o+=i?4:.2,r?{"line-height":`${o}${i}`}:`line-height: ${o}${i}`)},PE=(t,e)=>{const n=new Uint8Array(t),r=e.replace(/[-{}]/g,"");if(r.length!==32){console.error("Invalid GUID");return}const o=new Uint8Array(16);for(let i=0,s=0;i<32;i+=2,s++){const a=r[i]+r[i+1];o[s]=parseInt(a,16)}for(let i=0;i<32;i++){const s=15-i%16;n[i]^=o[s]}return n.buffer},Id=(t,e)=>t.className?.split(" ")?.indexOf(e)>=0?!0:t.parentNode&&Id(t.parentNode,e);function Yn(t=8){const e="0123456789abcdef";let n=[];for(let r=0;r<t;r++){const o=Math.floor(Math.random()*e.length);n.push(e[o])}return n.join("")}function lf(){return Math.floor(Math.random()*2147483647).toString(16).toUpperCase().padStart(8,"0")}const zE={"xmlns:wpc":"http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas","xmlns:cx":"http://schemas.microsoft.com/office/drawing/2014/chartex","xmlns:cx1":"http://schemas.microsoft.com/office/drawing/2015/9/8/chartex","xmlns:cx2":"http://schemas.microsoft.com/office/drawing/2015/10/21/chartex","xmlns:cx3":"http://schemas.microsoft.com/office/drawing/2016/5/9/chartex","xmlns:cx4":"http://schemas.microsoft.com/office/drawing/2016/5/10/chartex","xmlns:cx5":"http://schemas.microsoft.com/office/drawing/2016/5/11/chartex","xmlns:cx6":"http://schemas.microsoft.com/office/drawing/2016/5/12/chartex","xmlns:cx7":"http://schemas.microsoft.com/office/drawing/2016/5/13/chartex","xmlns:cx8":"http://schemas.microsoft.com/office/drawing/2016/5/14/chartex","xmlns:mc":"http://schemas.openxmlformats.org/markup-compatibility/2006","xmlns:aink":"http://schemas.microsoft.com/office/drawing/2016/ink","xmlns:am3d":"http://schemas.microsoft.com/office/drawing/2017/model3d","xmlns:o":"urn:schemas-microsoft-com:office:office","xmlns:oel":"http://schemas.microsoft.com/office/2019/extlst","xmlns:r":"http://schemas.openxmlformats.org/officeDocument/2006/relationships","xmlns:m":"http://schemas.openxmlformats.org/officeDocument/2006/math","xmlns:v":"urn:schemas-microsoft-com:vml","xmlns:wp14":"http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing","xmlns:wp":"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing","xmlns:w10":"urn:schemas-microsoft-com:office:word","xmlns:w":"http://schemas.openxmlformats.org/wordprocessingml/2006/main","xmlns:w14":"http://schemas.microsoft.com/office/word/2010/wordml","xmlns:w15":"http://schemas.microsoft.com/office/word/2012/wordml","xmlns:w16cex":"http://schemas.microsoft.com/office/word/2018/wordml/cex","xmlns:w16cid":"http://schemas.microsoft.com/office/word/2016/wordml/cid","xmlns:w16":"http://schemas.microsoft.com/office/word/2018/wordml","xmlns:w16du":"http://schemas.microsoft.com/office/word/2023/wordml/word16du","xmlns:w16sdtdh":"http://schemas.microsoft.com/office/word/2020/wordml/sdtdatahash","xmlns:w16sdtfl":"http://schemas.microsoft.com/office/word/2024/wordml/sdtformatlock","xmlns:w16se":"http://schemas.microsoft.com/office/word/2015/wordml/symex","xmlns:wpg":"http://schemas.microsoft.com/office/word/2010/wordprocessingGroup","xmlns:wpi":"http://schemas.microsoft.com/office/word/2010/wordprocessingInk","xmlns:wne":"http://schemas.microsoft.com/office/word/2006/wordml","xmlns:wps":"http://schemas.microsoft.com/office/word/2010/wordprocessingShape","mc:Ignorable":"w14 w15 w16se w16cid w16 w16cex w16sdtdh w16sdtfl w16du wp14"},jE={elements:[{type:"element",name:"Properties",attributes:{xmlns:"http://schemas.openxmlformats.org/officeDocument/2006/custom-properties","xmlns:vt":"http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes"},elements:[]}]},qE={elements:[{type:"element",name:"w:settings",attributes:{"xmlns:w":"http://schemas.openxmlformats.org/wordprocessingml/2006/main"},elements:[]}]},VE={type:"element",name:"w:r",elements:[{type:"element",name:"w:rPr",elements:[{type:"element",name:"w:rStyle",attributes:{"w:val":"CommentReference"}}]},{type:"element",name:"w:annotationRef"}]},Mg={Normal:{type:"element",name:"w:style",attributes:{"w:type":"paragraph","w:default":"1","w:styleId":"Normal"},elements:[{type:"element",name:"w:name",attributes:{"w:val":"Normal"}},{type:"element",name:"w:qFormat"}]},Title:{type:"element",name:"w:style",attributes:{"w:type":"paragraph","w:styleId":"Title"},elements:[{type:"element",name:"w:name",attributes:{"w:val":"Title"}},{type:"element",name:"w:basedOn",attributes:{"w:val":"Normal"}},{type:"element",name:"w:next",attributes:{"w:val":"Normal"}},{type:"element",name:"w:link",attributes:{"w:val":"TitleChar"}},{type:"element",name:"w:uiPriority",attributes:{"w:val":"10"}},{type:"element",name:"w:qFormat"},{type:"element",name:"w:rsid",attributes:{"w:val":"00B72667"}},{type:"element",name:"w:pPr",elements:[{type:"element",name:"w:spacing",attributes:{"w:after":"80"}},{type:"element",name:"w:contextualSpacing"}]},{type:"element",name:"w:rPr",elements:[{type:"element",name:"w:rFonts",attributes:{"w:asciiTheme":"majorHAnsi","w:eastAsiaTheme":"majorEastAsia","w:hAnsiTheme":"majorHAnsi","w:cstheme":"majorBidi"}},{type:"element",name:"w:spacing",attributes:{"w:val":"-10"}},{type:"element",name:"w:kern",attributes:{"w:val":"28"}},{type:"element",name:"w:sz",attributes:{"w:val":"56"}},{type:"element",name:"w:szCs",attributes:{"w:val":"56"}}]}]},Subtitle:{type:"element",name:"w:style",attributes:{"w:type":"paragraph","w:styleId":"Subtitle"},elements:[{type:"element",name:"w:name",attributes:{"w:val":"Subtitle"}},{type:"element",name:"w:basedOn",attributes:{"w:val":"Normal"}},{type:"element",name:"w:next",attributes:{"w:val":"Normal"}},{type:"element",name:"w:link",attributes:{"w:val":"SubtitleChar"}},{type:"element",name:"w:uiPriority",attributes:{"w:val":"11"}},{type:"element",name:"w:qFormat"},{type:"element",name:"w:rsid",attributes:{"w:val":"00B72667"}},{type:"element",name:"w:pPr",elements:[{type:"element",name:"w:numPr",elements:[{type:"element",name:"w:ilvl",attributes:{"w:val":"1"}}]},{type:"element",name:"w:spacing",attributes:{"w:after":"160"}}]},{type:"element",name:"w:rPr",elements:[{type:"element",name:"w:rFonts",attributes:{"w:asciiTheme":"minorHAnsi","w:eastAsiaTheme":"majorEastAsia","w:hAnsiTheme":"minorHAnsi","w:cstheme":"majorBidi"}},{type:"element",name:"w:color",attributes:{"w:val":"595959","w:themeColor":"text1","w:themeTint":"A6"}},{type:"element",name:"w:spacing",attributes:{"w:val":"15"}},{type:"element",name:"w:sz",attributes:{"w:val":"28"}},{type:"element",name:"w:szCs",attributes:{"w:val":"28"}}]}]},Heading1:{type:"element",name:"w:style",attributes:{"w:type":"paragraph","w:styleId":"Heading1"},elements:[{type:"element",name:"w:name",attributes:{"w:val":"heading 1"}},{type:"element",name:"w:basedOn",attributes:{"w:val":"Normal"}},{type:"element",name:"w:next",attributes:{"w:val":"Normal"}},{type:"element",name:"w:link",attributes:{"w:val":"Heading1Char"}},{type:"element",name:"w:uiPriority",attributes:{"w:val":"9"}},{type:"element",name:"w:qFormat"},{type:"element",name:"w:rsid",attributes:{"w:val":"00233D7B"}},{type:"element",name:"w:pPr",elements:[{type:"element",name:"w:keepNext"},{type:"element",name:"w:keepLines"},{type:"element",name:"w:spacing",attributes:{"w:before":"360","w:after":"80"}},{type:"element",name:"w:outlineLvl",attributes:{"w:val":"0"}}]},{type:"element",name:"w:rPr",elements:[{type:"element",name:"w:rFonts",attributes:{"w:asciiTheme":"majorHAnsi","w:eastAsiaTheme":"majorEastAsia","w:hAnsiTheme":"majorHAnsi","w:cstheme":"majorBidi"}},{type:"element",name:"w:color",attributes:{"w:val":"0F4761","w:themeColor":"accent1","w:themeShade":"BF"}},{type:"element",name:"w:sz",attributes:{"w:val":"40"}},{type:"element",name:"w:szCs",attributes:{"w:val":"40"}}]}]},Heading2:{type:"element",name:"w:style",attributes:{"w:type":"paragraph","w:styleId":"Heading2"},elements:[{type:"element",name:"w:name",attributes:{"w:val":"heading 2"}},{type:"element",name:"w:basedOn",attributes:{"w:val":"Normal"}},{type:"element",name:"w:next",attributes:{"w:val":"Normal"}},{type:"element",name:"w:link",attributes:{"w:val":"Heading2Char"}},{type:"element",name:"w:uiPriority",attributes:{"w:val":"9"}},{type:"element",name:"w:semiHidden"},{type:"element",name:"w:unhideWhenUsed"},{type:"element",name:"w:qFormat"},{type:"element",name:"w:rsid",attributes:{"w:val":"00233D7B"}},{type:"element",name:"w:pPr",elements:[{type:"element",name:"w:keepNext"},{type:"element",name:"w:keepLines"},{type:"element",name:"w:spacing",attributes:{"w:before":"160","w:after":"80"}},{type:"element",name:"w:outlineLvl",attributes:{"w:val":"1"}}]},{type:"element",name:"w:rPr",elements:[{type:"element",name:"w:rFonts",attributes:{"w:asciiTheme":"majorHAnsi","w:eastAsiaTheme":"majorEastAsia","w:hAnsiTheme":"majorHAnsi","w:cstheme":"majorBidi"}},{type:"element",name:"w:color",attributes:{"w:val":"0F4761","w:themeColor":"accent1","w:themeShade":"BF"}},{type:"element",name:"w:sz",attributes:{"w:val":"32"}},{type:"element",name:"w:szCs",attributes:{"w:val":"32"}}]}]},Heading3:{type:"element",name:"w:style",attributes:{"w:type":"paragraph","w:styleId":"Heading3"},elements:[{type:"element",name:"w:name",attributes:{"w:val":"heading 3"}},{type:"element",name:"w:basedOn",attributes:{"w:val":"Normal"}},{type:"element",name:"w:next",attributes:{"w:val":"Normal"}},{type:"element",name:"w:link",attributes:{"w:val":"Heading3Char"}},{type:"element",name:"w:uiPriority",attributes:{"w:val":"9"}},{type:"element",name:"w:semiHidden"},{type:"element",name:"w:unhideWhenUsed"},{type:"element",name:"w:qFormat"},{type:"element",name:"w:rsid",attributes:{"w:val":"00233D7B"}},{type:"element",name:"w:pPr",elements:[{type:"element",name:"w:keepNext"},{type:"element",name:"w:keepLines"},{type:"element",name:"w:spacing",attributes:{"w:before":"160","w:after":"80"}},{type:"element",name:"w:outlineLvl",attributes:{"w:val":"2"}}]},{type:"element",name:"w:rPr",elements:[{type:"element",name:"w:rFonts",attributes:{"w:eastAsiaTheme":"majorEastAsia","w:cstheme":"majorBidi"}},{type:"element",name:"w:color",attributes:{"w:val":"0F4761","w:themeColor":"accent1","w:themeShade":"BF"}},{type:"element",name:"w:sz",attributes:{"w:val":"28"}},{type:"element",name:"w:szCs",attributes:{"w:val":"28"}}]}]}},UE={declaration:{attributes:{version:"1.0",encoding:"UTF-8",standalone:"yes"}},elements:[{type:"element",name:"w:comments",attributes:{"xmlns:wpc":"http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas","xmlns:cx":"http://schemas.microsoft.com/office/drawing/2014/chartex","xmlns:cx1":"http://schemas.microsoft.com/office/drawing/2015/9/8/chartex","xmlns:cx2":"http://schemas.microsoft.com/office/drawing/2015/10/21/chartex","xmlns:cx3":"http://schemas.microsoft.com/office/drawing/2016/5/9/chartex","xmlns:cx4":"http://schemas.microsoft.com/office/drawing/2016/5/10/chartex","xmlns:cx5":"http://schemas.microsoft.com/office/drawing/2016/5/11/chartex","xmlns:cx6":"http://schemas.microsoft.com/office/drawing/2016/5/12/chartex","xmlns:cx7":"http://schemas.microsoft.com/office/drawing/2016/5/13/chartex","xmlns:cx8":"http://schemas.microsoft.com/office/drawing/2016/5/14/chartex","xmlns:mc":"http://schemas.openxmlformats.org/markup-compatibility/2006","xmlns:aink":"http://schemas.microsoft.com/office/drawing/2016/ink","xmlns:am3d":"http://schemas.microsoft.com/office/drawing/2017/model3d","xmlns:o":"urn:schemas-microsoft-com:office:office","xmlns:oel":"http://schemas.microsoft.com/office/2019/extlst","xmlns:r":"http://schemas.openxmlformats.org/officeDocument/2006/relationships","xmlns:m":"http://schemas.openxmlformats.org/officeDocument/2006/math","xmlns:v":"urn:schemas-microsoft-com:vml","xmlns:wp14":"http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing","xmlns:wp":"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing","xmlns:w10":"urn:schemas-microsoft-com:office:word","xmlns:w":"http://schemas.openxmlformats.org/wordprocessingml/2006/main","xmlns:w14":"http://schemas.microsoft.com/office/word/2010/wordml","xmlns:w15":"http://schemas.microsoft.com/office/word/2012/wordml","xmlns:w16cex":"http://schemas.microsoft.com/office/word/2018/wordml/cex","xmlns:w16cid":"http://schemas.microsoft.com/office/word/2016/wordml/cid","xmlns:w16":"http://schemas.microsoft.com/office/word/2018/wordml","xmlns:w16du":"http://schemas.microsoft.com/office/word/2023/wordml/word16du","xmlns:w16sdtdh":"http://schemas.microsoft.com/office/word/2020/wordml/sdtdatahash","xmlns:w16sdtfl":"http://schemas.microsoft.com/office/word/2024/wordml/sdtformatlock","xmlns:w16se":"http://schemas.microsoft.com/office/word/2015/wordml/symex","xmlns:wpg":"http://schemas.microsoft.com/office/word/2010/wordprocessingGroup","xmlns:wpi":"http://schemas.microsoft.com/office/word/2010/wordprocessingInk","xmlns:wne":"http://schemas.microsoft.com/office/word/2006/wordml","xmlns:wps":"http://schemas.microsoft.com/office/word/2010/wordprocessingShape","mc:Ignorable":"w14 w15 w16se w16cid w16 w16cex w16sdtdh w16sdtfl w16du wp14"},elements:[]}]},HE={declaration:{attributes:{version:"1.0",encoding:"UTF-8",standalone:"yes"}},elements:[{type:"element",name:"w15:commentsEx",attributes:{"xmlns:wpc":"http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas","xmlns:cx":"http://schemas.microsoft.com/office/drawing/2014/chartex","xmlns:cx1":"http://schemas.microsoft.com/office/drawing/2015/9/8/chartex","xmlns:cx2":"http://schemas.microsoft.com/office/drawing/2015/10/21/chartex","xmlns:cx3":"http://schemas.microsoft.com/office/drawing/2016/5/9/chartex","xmlns:cx4":"http://schemas.microsoft.com/office/drawing/2016/5/10/chartex","xmlns:cx5":"http://schemas.microsoft.com/office/drawing/2016/5/11/chartex","xmlns:cx6":"http://schemas.microsoft.com/office/drawing/2016/5/12/chartex","xmlns:cx7":"http://schemas.microsoft.com/office/drawing/2016/5/13/chartex","xmlns:cx8":"http://schemas.microsoft.com/office/drawing/2016/5/14/chartex","xmlns:mc":"http://schemas.openxmlformats.org/markup-compatibility/2006","xmlns:aink":"http://schemas.microsoft.com/office/drawing/2016/ink","xmlns:am3d":"http://schemas.microsoft.com/office/drawing/2017/model3d","xmlns:o":"urn:schemas-microsoft-com:office:office","xmlns:oel":"http://schemas.microsoft.com/office/2019/extlst","xmlns:r":"http://schemas.openxmlformats.org/officeDocument/2006/relationships","xmlns:m":"http://schemas.openxmlformats.org/officeDocument/2006/math","xmlns:v":"urn:schemas-microsoft-com:vml","xmlns:wp14":"http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing","xmlns:wp":"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing","xmlns:w10":"urn:schemas-microsoft-com:office:word","xmlns:w":"http://schemas.openxmlformats.org/wordprocessingml/2006/main","xmlns:w14":"http://schemas.microsoft.com/office/word/2010/wordml","xmlns:w15":"http://schemas.microsoft.com/office/word/2012/wordml","xmlns:w16cex":"http://schemas.microsoft.com/office/word/2018/wordml/cex","xmlns:w16cid":"http://schemas.microsoft.com/office/word/2016/wordml/cid","xmlns:w16":"http://schemas.microsoft.com/office/word/2018/wordml","xmlns:w16du":"http://schemas.microsoft.com/office/word/2023/wordml/word16du","xmlns:w16sdtdh":"http://schemas.microsoft.com/office/word/2020/wordml/sdtdatahash","xmlns:w16sdtfl":"http://schemas.microsoft.com/office/word/2024/wordml/sdtformatlock","xmlns:w16se":"http://schemas.microsoft.com/office/word/2015/wordml/symex","xmlns:wpg":"http://schemas.microsoft.com/office/word/2010/wordprocessingGroup","xmlns:wpi":"http://schemas.microsoft.com/office/word/2010/wordprocessingInk","xmlns:wne":"http://schemas.microsoft.com/office/word/2006/wordml","xmlns:wps":"http://schemas.microsoft.com/office/word/2010/wordprocessingShape","mc:Ignorable":"w14 w15 w16se w16cid w16 w16cex w16sdtdh w16sdtfl w16du wp14"},elements:[]}]},WE={declaration:{attributes:{version:"1.0",encoding:"UTF-8",standalone:"yes"}},elements:[{type:"element",name:"w16cex:commentsExtensible",attributes:{"xmlns:wpc":"http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas","xmlns:cx":"http://schemas.microsoft.com/office/drawing/2014/chartex","xmlns:cx1":"http://schemas.microsoft.com/office/drawing/2015/9/8/chartex","xmlns:cx2":"http://schemas.microsoft.com/office/drawing/2015/10/21/chartex","xmlns:cx3":"http://schemas.microsoft.com/office/drawing/2016/5/9/chartex","xmlns:cx4":"http://schemas.microsoft.com/office/drawing/2016/5/10/chartex","xmlns:cx5":"http://schemas.microsoft.com/office/drawing/2016/5/11/chartex","xmlns:cx6":"http://schemas.microsoft.com/office/drawing/2016/5/12/chartex","xmlns:cx7":"http://schemas.microsoft.com/office/drawing/2016/5/13/chartex","xmlns:cx8":"http://schemas.microsoft.com/office/drawing/2016/5/14/chartex","xmlns:cr":"http://schemas.microsoft.com/office/comments/2020/reactions","xmlns:mc":"http://schemas.openxmlformats.org/markup-compatibility/2006","xmlns:aink":"http://schemas.microsoft.com/office/drawing/2016/ink","xmlns:am3d":"http://schemas.microsoft.com/office/drawing/2017/model3d","xmlns:o":"urn:schemas-microsoft-com:office:office","xmlns:oel":"http://schemas.microsoft.com/office/2019/extlst","xmlns:r":"http://schemas.openxmlformats.org/officeDocument/2006/relationships","xmlns:m":"http://schemas.openxmlformats.org/officeDocument/2006/math","xmlns:v":"urn:schemas-microsoft-com:vml","xmlns:wp14":"http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing","xmlns:wp":"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing","xmlns:w10":"urn:schemas-microsoft-com:office:word","xmlns:w":"http://schemas.openxmlformats.org/wordprocessingml/2006/main","xmlns:w14":"http://schemas.microsoft.com/office/word/2010/wordml","xmlns:w15":"http://schemas.microsoft.com/office/word/2012/wordml","xmlns:w16cex":"http://schemas.microsoft.com/office/word/2018/wordml/cex","xmlns:w16cid":"http://schemas.microsoft.com/office/word/2016/wordml/cid","xmlns:w16":"http://schemas.microsoft.com/office/word/2018/wordml","xmlns:w16du":"http://schemas.microsoft.com/office/word/2023/wordml/word16du","xmlns:w16sdtdh":"http://schemas.microsoft.com/office/word/2020/wordml/sdtdatahash","xmlns:w16sdtfl":"http://schemas.microsoft.com/office/word/2024/wordml/sdtformatlock","xmlns:w16se":"http://schemas.microsoft.com/office/word/2015/wordml/symex","xmlns:wpg":"http://schemas.microsoft.com/office/word/2010/wordprocessingGroup","xmlns:wpi":"http://schemas.microsoft.com/office/word/2010/wordprocessingInk","xmlns:wne":"http://schemas.microsoft.com/office/word/2006/wordml","xmlns:wps":"http://schemas.microsoft.com/office/word/2010/wordprocessingShape","mc:Ignorable":"w14 w15 w16se w16cid w16 w16cex w16sdtdh w16sdtfl cr w16du wp14"},elements:[]}]},GE={declaration:{attributes:{version:"1.0",encoding:"UTF-8",standalone:"yes"}},elements:[{type:"element",name:"w16cid:commentsIds",attributes:{"xmlns:wpc":"http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas","xmlns:cx":"http://schemas.microsoft.com/office/drawing/2014/chartex","xmlns:cx1":"http://schemas.microsoft.com/office/drawing/2015/9/8/chartex","xmlns:cx2":"http://schemas.microsoft.com/office/drawing/2015/10/21/chartex","xmlns:cx3":"http://schemas.microsoft.com/office/drawing/2016/5/9/chartex","xmlns:cx4":"http://schemas.microsoft.com/office/drawing/2016/5/10/chartex","xmlns:cx5":"http://schemas.microsoft.com/office/drawing/2016/5/11/chartex","xmlns:cx6":"http://schemas.microsoft.com/office/drawing/2016/5/12/chartex","xmlns:cx7":"http://schemas.microsoft.com/office/drawing/2016/5/13/chartex","xmlns:cx8":"http://schemas.microsoft.com/office/drawing/2016/5/14/chartex","xmlns:mc":"http://schemas.openxmlformats.org/markup-compatibility/2006","xmlns:aink":"http://schemas.microsoft.com/office/drawing/2016/ink","xmlns:am3d":"http://schemas.microsoft.com/office/drawing/2017/model3d","xmlns:o":"urn:schemas-microsoft-com:office:office","xmlns:oel":"http://schemas.microsoft.com/office/2019/extlst","xmlns:r":"http://schemas.openxmlformats.org/officeDocument/2006/relationships","xmlns:m":"http://schemas.openxmlformats.org/officeDocument/2006/math","xmlns:v":"urn:schemas-microsoft-com:vml","xmlns:wp14":"http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing","xmlns:wp":"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing","xmlns:w10":"urn:schemas-microsoft-com:office:word","xmlns:w":"http://schemas.openxmlformats.org/wordprocessingml/2006/main","xmlns:w14":"http://schemas.microsoft.com/office/word/2010/wordml","xmlns:w15":"http://schemas.microsoft.com/office/word/2012/wordml","xmlns:w16cex":"http://schemas.microsoft.com/office/word/2018/wordml/cex","xmlns:w16cid":"http://schemas.microsoft.com/office/word/2016/wordml/cid","xmlns:w16":"http://schemas.microsoft.com/office/word/2018/wordml","xmlns:w16du":"http://schemas.microsoft.com/office/word/2023/wordml/word16du","xmlns:w16sdtdh":"http://schemas.microsoft.com/office/word/2020/wordml/sdtdatahash","xmlns:w16sdtfl":"http://schemas.microsoft.com/office/word/2024/wordml/sdtformatlock","xmlns:w16se":"http://schemas.microsoft.com/office/word/2015/wordml/symex","xmlns:wpg":"http://schemas.microsoft.com/office/word/2010/wordprocessingGroup","xmlns:wpi":"http://schemas.microsoft.com/office/word/2010/wordprocessingInk","xmlns:wne":"http://schemas.microsoft.com/office/word/2006/wordml","xmlns:wps":"http://schemas.microsoft.com/office/word/2010/wordprocessingShape","mc:Ignorable":"w14 w15 w16se w16cid w16 w16cex w16sdtdh w16sdtfl w16du wp14"},elements:[]}]},KE={elements:[{type:"element",name:"Relationships",attributes:{xmlns:"http://schemas.openxmlformats.org/package/2006/relationships"},elements:[{type:"element",name:"Relationship",attributes:{Id:"rId8",Type:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/fontTable",Target:"fontTable.xml"}},{type:"element",name:"Relationship",attributes:{Id:"rId3",Type:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/webSettings",Target:"webSettings.xml"}},{type:"element",name:"Relationship",attributes:{Id:"rId7",Type:"http://schemas.microsoft.com/office/2018/08/relationships/commentsExtensible",Target:"commentsExtensible.xml"}},{type:"element",name:"Relationship",attributes:{Id:"rId2",Type:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/settings",Target:"settings.xml"}},{type:"element",name:"Relationship",attributes:{Id:"rId1",Type:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles",Target:"styles.xml"}},{type:"element",name:"Relationship",attributes:{Id:"rId6",Type:"http://schemas.microsoft.com/office/2016/09/relationships/commentsIds",Target:"commentsIds.xml"}},{type:"element",name:"Relationship",attributes:{Id:"rId5",Type:"http://schemas.microsoft.com/office/2011/relationships/commentsExtended",Target:"commentsExtended.xml"}},{type:"element",name:"Relationship",attributes:{Id:"rId10",Type:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme",Target:"theme/theme1.xml"}},{type:"element",name:"Relationship",attributes:{Id:"rId4",Type:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/comments",Target:"comments.xml"}}]}]},JE={declaration:{attributes:{version:"1.0",encoding:"UTF-8",standalone:"yes"}},elements:[{type:"element",name:"Types",attributes:{xmlns:"http://schemas.openxmlformats.org/package/2006/content-types"},elements:[{type:"element",name:"Default",attributes:{Extension:"rels",ContentType:"application/vnd.openxmlformats-package.relationships+xml"}},{type:"element",name:"Default",attributes:{Extension:"xml",ContentType:"application/xml"}},{type:"element",name:"Override",attributes:{PartName:"/word/document.xml",ContentType:"application/vnd.openxmlformats-officedocument.wordprocessingml.document.main+xml"}},{type:"element",name:"Override",attributes:{PartName:"/word/styles.xml",ContentType:"application/vnd.openxmlformats-officedocument.wordprocessingml.styles+xml"}},{type:"element",name:"Override",attributes:{PartName:"/word/settings.xml",ContentType:"application/vnd.openxmlformats-officedocument.wordprocessingml.settings+xml"}},{type:"element",name:"Override",attributes:{PartName:"/word/webSettings.xml",ContentType:"application/vnd.openxmlformats-officedocument.wordprocessingml.webSettings+xml"}},{type:"element",name:"Override",attributes:{PartName:"/word/comments.xml",ContentType:"application/vnd.openxmlformats-officedocument.wordprocessingml.comments+xml"}},{type:"element",name:"Override",attributes:{PartName:"/word/commentsExtended.xml",ContentType:"application/vnd.openxmlformats-officedocument.wordprocessingml.commentsExtended+xml"}},{type:"element",name:"Override",attributes:{PartName:"/word/commentsIds.xml",ContentType:"application/vnd.openxmlformats-officedocument.wordprocessingml.commentsIds+xml"}},{type:"element",name:"Override",attributes:{PartName:"/word/commentsExtensible.xml",ContentType:"application/vnd.openxmlformats-officedocument.wordprocessingml.commentsExtensible+xml"}},{type:"element",name:"Override",attributes:{PartName:"/word/fontTable.xml",ContentType:"application/vnd.openxmlformats-officedocument.wordprocessingml.fontTable+xml"}},{type:"element",name:"Override",attributes:{PartName:"/word/people.xml",ContentType:"application/vnd.openxmlformats-officedocument.wordprocessingml.people+xml"}},{type:"element",name:"Override",attributes:{PartName:"/word/theme/theme1.xml",ContentType:"application/vnd.openxmlformats-officedocument.theme+xml"}},{type:"element",name:"Override",attributes:{PartName:"/docProps/core.xml",ContentType:"application/vnd.openxmlformats-package.core-properties+xml"}},{type:"element",name:"Override",attributes:{PartName:"/docProps/app.xml",ContentType:"application/vnd.openxmlformats-officedocument.extended-properties+xml"}},{type:"element",name:"Override",attributes:{PartName:"/word/numbering.xml",ContentType:"application/vnd.openxmlformats-officedocument.wordprocessingml.numbering+xml"}}]}]},Po={COMMENTS_XML_DEF:UE,COMMENTS_EXTENDED_XML_DEF:HE,COMMENTS_EXTENSIBLE_XML_DEF:WE,COMMENTS_IDS_XML_DEF:GE,DOCUMENT_RELS_XML_DEF:KE,CONTENT_TYPES:JE},It="trackInsert",ut="trackDelete",vt="trackFormat",Qt=t=>{if(t)try{return JSON.parse(JSON.stringify(t))}catch(e){console.error("Error in carbonCopy",t,e);return}},XE={attributes:{"w:abstractNumId":"1"}},YE={attributes:{"w:abstractNumId":"0"}},Lv={declaration:{attributes:{version:"1.0",encoding:"UTF-8",standalone:"yes"}},elements:[{type:"element",name:"w:numbering",attributes:{"xmlns:wpc":"http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas","xmlns:cx":"http://schemas.microsoft.com/office/drawing/2014/chartex","xmlns:cx1":"http://schemas.microsoft.com/office/drawing/2015/9/8/chartex","xmlns:cx2":"http://schemas.microsoft.com/office/drawing/2015/10/21/chartex","xmlns:cx3":"http://schemas.microsoft.com/office/drawing/2016/5/9/chartex","xmlns:cx4":"http://schemas.microsoft.com/office/drawing/2016/5/10/chartex","xmlns:cx5":"http://schemas.microsoft.com/office/drawing/2016/5/11/chartex","xmlns:cx6":"http://schemas.microsoft.com/office/drawing/2016/5/12/chartex","xmlns:cx7":"http://schemas.microsoft.com/office/drawing/2016/5/13/chartex","xmlns:cx8":"http://schemas.microsoft.com/office/drawing/2016/5/14/chartex","xmlns:mc":"http://schemas.openxmlformats.org/markup-compatibility/2006","xmlns:aink":"http://schemas.microsoft.com/office/drawing/2016/ink","xmlns:am3d":"http://schemas.microsoft.com/office/drawing/2017/model3d","xmlns:o":"urn:schemas-microsoft-com:office:office","xmlns:oel":"http://schemas.microsoft.com/office/2019/extlst","xmlns:r":"http://schemas.openxmlformats.org/officeDocument/2006/relationships","xmlns:m":"http://schemas.openxmlformats.org/officeDocument/2006/math","xmlns:v":"urn:schemas-microsoft-com:vml","xmlns:wp14":"http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing","xmlns:wp":"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing","xmlns:w10":"urn:schemas-microsoft-com:office:word","xmlns:w":"http://schemas.openxmlformats.org/wordprocessingml/2006/main","xmlns:w14":"http://schemas.microsoft.com/office/word/2010/wordml","xmlns:w15":"http://schemas.microsoft.com/office/word/2012/wordml","xmlns:w16cex":"http://schemas.microsoft.com/office/word/2018/wordml/cex","xmlns:w16cid":"http://schemas.microsoft.com/office/word/2016/wordml/cid","xmlns:w16":"http://schemas.microsoft.com/office/word/2018/wordml","xmlns:w16du":"http://schemas.microsoft.com/office/word/2023/wordml/word16du","xmlns:w16sdtdh":"http://schemas.microsoft.com/office/word/2020/wordml/sdtdatahash","xmlns:w16se":"http://schemas.microsoft.com/office/word/2015/wordml/symex","xmlns:wpg":"http://schemas.microsoft.com/office/word/2010/wordprocessingGroup","xmlns:wpi":"http://schemas.microsoft.com/office/word/2010/wordprocessingInk","xmlns:wne":"http://schemas.microsoft.com/office/word/2006/wordml","xmlns:wps":"http://schemas.microsoft.com/office/word/2010/wordprocessingShape","mc:Ignorable":"w14 w15 w16se w16cid w16 w16cex w16sdtdh w16du wp14"},elements:[{type:"element",name:"w:abstractNum",attributes:{"w:abstractNumId":"0","w15:restartNumberingAfterBreak":"0"},elements:[{type:"element",name:"w:nsid",attributes:{"w:val":"16126B07"}},{type:"element",name:"w:multiLevelType",attributes:{"w:val":"hybridMultilevel"}},{type:"element",name:"w:tmpl",attributes:{"w:val":"51EC4E08"}},{type:"element",name:"w:lvl",attributes:{"w:ilvl":"0","w:tplc":"04090001"},elements:[{type:"element",name:"w:start",attributes:{"w:val":"1"}},{type:"element",name:"w:numFmt",attributes:{"w:val":"bullet"}},{type:"element",name:"w:lvlText",attributes:{"w:val":""}},{type:"element",name:"w:lvlJc",attributes:{"w:val":"left"}},{type:"element",name:"w:pPr",elements:[{type:"element",name:"w:ind",attributes:{"w:left":"720","w:hanging":"360"}}]},{type:"element",name:"w:rPr",elements:[{type:"element",name:"w:rFonts",attributes:{"w:ascii":"Symbol","w:hAnsi":"Symbol","w:hint":"default"}}]}]},{type:"element",name:"w:lvl",attributes:{"w:ilvl":"1","w:tplc":"04090003","w:tentative":"1"},elements:[{type:"element",name:"w:start",attributes:{"w:val":"1"}},{type:"element",name:"w:numFmt",attributes:{"w:val":"bullet"}},{type:"element",name:"w:lvlText",attributes:{"w:val":"o"}},{type:"element",name:"w:lvlJc",attributes:{"w:val":"left"}},{type:"element",name:"w:pPr",elements:[{type:"element",name:"w:ind",attributes:{"w:left":"1440","w:hanging":"360"}}]},{type:"element",name:"w:rPr",elements:[{type:"element",name:"w:rFonts",attributes:{"w:ascii":"Courier New","w:hAnsi":"Courier New","w:cs":"Courier New","w:hint":"default"}}]}]},{type:"element",name:"w:lvl",attributes:{"w:ilvl":"2","w:tplc":"04090005","w:tentative":"1"},elements:[{type:"element",name:"w:start",attributes:{"w:val":"1"}},{type:"element",name:"w:numFmt",attributes:{"w:val":"bullet"}},{type:"element",name:"w:lvlText",attributes:{"w:val":""}},{type:"element",name:"w:lvlJc",attributes:{"w:val":"left"}},{type:"element",name:"w:pPr",elements:[{type:"element",name:"w:ind",attributes:{"w:left":"2160","w:hanging":"360"}}]},{type:"element",name:"w:rPr",elements:[{type:"element",name:"w:rFonts",attributes:{"w:ascii":"Wingdings","w:hAnsi":"Wingdings","w:hint":"default"}}]}]},{type:"element",name:"w:lvl",attributes:{"w:ilvl":"3","w:tplc":"04090001","w:tentative":"1"},elements:[{type:"element",name:"w:start",attributes:{"w:val":"1"}},{type:"element",name:"w:numFmt",attributes:{"w:val":"bullet"}},{type:"element",name:"w:lvlText",attributes:{"w:val":""}},{type:"element",name:"w:lvlJc",attributes:{"w:val":"left"}},{type:"element",name:"w:pPr",elements:[{type:"element",name:"w:ind",attributes:{"w:left":"2880","w:hanging":"360"}}]},{type:"element",name:"w:rPr",elements:[{type:"element",name:"w:rFonts",attributes:{"w:ascii":"Symbol","w:hAnsi":"Symbol","w:hint":"default"}}]}]},{type:"element",name:"w:lvl",attributes:{"w:ilvl":"4","w:tplc":"04090003","w:tentative":"1"},elements:[{type:"element",name:"w:start",attributes:{"w:val":"1"}},{type:"element",name:"w:numFmt",attributes:{"w:val":"bullet"}},{type:"element",name:"w:lvlText",attributes:{"w:val":"o"}},{type:"element",name:"w:lvlJc",attributes:{"w:val":"left"}},{type:"element",name:"w:pPr",elements:[{type:"element",name:"w:ind",attributes:{"w:left":"3600","w:hanging":"360"}}]},{type:"element",name:"w:rPr",elements:[{type:"element",name:"w:rFonts",attributes:{"w:ascii":"Courier New","w:hAnsi":"Courier New","w:cs":"Courier New","w:hint":"default"}}]}]},{type:"element",name:"w:lvl",attributes:{"w:ilvl":"5","w:tplc":"04090005","w:tentative":"1"},elements:[{type:"element",name:"w:start",attributes:{"w:val":"1"}},{type:"element",name:"w:numFmt",attributes:{"w:val":"bullet"}},{type:"element",name:"w:lvlText",attributes:{"w:val":""}},{type:"element",name:"w:lvlJc",attributes:{"w:val":"left"}},{type:"element",name:"w:pPr",elements:[{type:"element",name:"w:ind",attributes:{"w:left":"4320","w:hanging":"360"}}]},{type:"element",name:"w:rPr",elements:[{type:"element",name:"w:rFonts",attributes:{"w:ascii":"Wingdings","w:hAnsi":"Wingdings","w:hint":"default"}}]}]},{type:"element",name:"w:lvl",attributes:{"w:ilvl":"6","w:tplc":"04090001","w:tentative":"1"},elements:[{type:"element",name:"w:start",attributes:{"w:val":"1"}},{type:"element",name:"w:numFmt",attributes:{"w:val":"bullet"}},{type:"element",name:"w:lvlText",attributes:{"w:val":""}},{type:"element",name:"w:lvlJc",attributes:{"w:val":"left"}},{type:"element",name:"w:pPr",elements:[{type:"element",name:"w:ind",attributes:{"w:left":"5040","w:hanging":"360"}}]},{type:"element",name:"w:rPr",elements:[{type:"element",name:"w:rFonts",attributes:{"w:ascii":"Symbol","w:hAnsi":"Symbol","w:hint":"default"}}]}]},{type:"element",name:"w:lvl",attributes:{"w:ilvl":"7","w:tplc":"04090003","w:tentative":"1"},elements:[{type:"element",name:"w:start",attributes:{"w:val":"1"}},{type:"element",name:"w:numFmt",attributes:{"w:val":"bullet"}},{type:"element",name:"w:lvlText",attributes:{"w:val":"o"}},{type:"element",name:"w:lvlJc",attributes:{"w:val":"left"}},{type:"element",name:"w:pPr",elements:[{type:"element",name:"w:ind",attributes:{"w:left":"5760","w:hanging":"360"}}]},{type:"element",name:"w:rPr",elements:[{type:"element",name:"w:rFonts",attributes:{"w:ascii":"Courier New","w:hAnsi":"Courier New","w:cs":"Courier New","w:hint":"default"}}]}]},{type:"element",name:"w:lvl",attributes:{"w:ilvl":"8","w:tplc":"04090005","w:tentative":"1"},elements:[{type:"element",name:"w:start",attributes:{"w:val":"1"}},{type:"element",name:"w:numFmt",attributes:{"w:val":"bullet"}},{type:"element",name:"w:lvlText",attributes:{"w:val":""}},{type:"element",name:"w:lvlJc",attributes:{"w:val":"left"}},{type:"element",name:"w:pPr",elements:[{type:"element",name:"w:ind",attributes:{"w:left":"6480","w:hanging":"360"}}]},{type:"element",name:"w:rPr",elements:[{type:"element",name:"w:rFonts",attributes:{"w:ascii":"Wingdings","w:hAnsi":"Wingdings","w:hint":"default"}}]}]}]},{type:"element",name:"w:abstractNum",attributes:{"w:abstractNumId":"1","w15:restartNumberingAfterBreak":"0"},elements:[{type:"element",name:"w:nsid",attributes:{"w:val":"587013BA"}},{type:"element",name:"w:multiLevelType",attributes:{"w:val":"hybridMultilevel"}},{type:"element",name:"w:tmpl",attributes:{"w:val":"EE6417C4"}},{type:"element",name:"w:lvl",attributes:{"w:ilvl":"0","w:tplc":"0409000F"},elements:[{type:"element",name:"w:start",attributes:{"w:val":"1"}},{type:"element",name:"w:numFmt",attributes:{"w:val":"decimal"}},{type:"element",name:"w:lvlText",attributes:{"w:val":"%1."}},{type:"element",name:"w:lvlJc",attributes:{"w:val":"left"}},{type:"element",name:"w:pPr",elements:[{type:"element",name:"w:ind",attributes:{"w:left":"720","w:hanging":"360"}}]}]},{type:"element",name:"w:lvl",attributes:{"w:ilvl":"1","w:tplc":"04090019","w:tentative":"1"},elements:[{type:"element",name:"w:start",attributes:{"w:val":"1"}},{type:"element",name:"w:numFmt",attributes:{"w:val":"lowerLetter"}},{type:"element",name:"w:lvlText",attributes:{"w:val":"%2."}},{type:"element",name:"w:lvlJc",attributes:{"w:val":"left"}},{type:"element",name:"w:pPr",elements:[{type:"element",name:"w:ind",attributes:{"w:left":"1440","w:hanging":"360"}}]}]},{type:"element",name:"w:lvl",attributes:{"w:ilvl":"2","w:tplc":"0409001B","w:tentative":"1"},elements:[{type:"element",name:"w:start",attributes:{"w:val":"1"}},{type:"element",name:"w:numFmt",attributes:{"w:val":"lowerRoman"}},{type:"element",name:"w:lvlText",attributes:{"w:val":"%3."}},{type:"element",name:"w:lvlJc",attributes:{"w:val":"right"}},{type:"element",name:"w:pPr",elements:[{type:"element",name:"w:ind",attributes:{"w:left":"2160","w:hanging":"180"}}]}]},{type:"element",name:"w:lvl",attributes:{"w:ilvl":"3","w:tplc":"0409000F","w:tentative":"1"},elements:[{type:"element",name:"w:start",attributes:{"w:val":"1"}},{type:"element",name:"w:numFmt",attributes:{"w:val":"decimal"}},{type:"element",name:"w:lvlText",attributes:{"w:val":"%4."}},{type:"element",name:"w:lvlJc",attributes:{"w:val":"left"}},{type:"element",name:"w:pPr",elements:[{type:"element",name:"w:ind",attributes:{"w:left":"2880","w:hanging":"360"}}]}]},{type:"element",name:"w:lvl",attributes:{"w:ilvl":"4","w:tplc":"04090019","w:tentative":"1"},elements:[{type:"element",name:"w:start",attributes:{"w:val":"1"}},{type:"element",name:"w:numFmt",attributes:{"w:val":"lowerLetter"}},{type:"element",name:"w:lvlText",attributes:{"w:val":"%5."}},{type:"element",name:"w:lvlJc",attributes:{"w:val":"left"}},{type:"element",name:"w:pPr",elements:[{type:"element",name:"w:ind",attributes:{"w:left":"3600","w:hanging":"360"}}]}]},{type:"element",name:"w:lvl",attributes:{"w:ilvl":"5","w:tplc":"0409001B","w:tentative":"1"},elements:[{type:"element",name:"w:start",attributes:{"w:val":"1"}},{type:"element",name:"w:numFmt",attributes:{"w:val":"lowerRoman"}},{type:"element",name:"w:lvlText",attributes:{"w:val":"%6."}},{type:"element",name:"w:lvlJc",attributes:{"w:val":"right"}},{type:"element",name:"w:pPr",elements:[{type:"element",name:"w:ind",attributes:{"w:left":"4320","w:hanging":"180"}}]}]},{type:"element",name:"w:lvl",attributes:{"w:ilvl":"6","w:tplc":"0409000F","w:tentative":"1"},elements:[{type:"element",name:"w:start",attributes:{"w:val":"1"}},{type:"element",name:"w:numFmt",attributes:{"w:val":"decimal"}},{type:"element",name:"w:lvlText",attributes:{"w:val":"%7."}},{type:"element",name:"w:lvlJc",attributes:{"w:val":"left"}},{type:"element",name:"w:pPr",elements:[{type:"element",name:"w:ind",attributes:{"w:left":"5040","w:hanging":"360"}}]}]},{type:"element",name:"w:lvl",attributes:{"w:ilvl":"7","w:tplc":"04090019","w:tentative":"1"},elements:[{type:"element",name:"w:start",attributes:{"w:val":"1"}},{type:"element",name:"w:numFmt",attributes:{"w:val":"lowerLetter"}},{type:"element",name:"w:lvlText",attributes:{"w:val":"%8."}},{type:"element",name:"w:lvlJc",attributes:{"w:val":"left"}},{type:"element",name:"w:pPr",elements:[{type:"element",name:"w:ind",attributes:{"w:left":"5760","w:hanging":"360"}}]}]},{type:"element",name:"w:lvl",attributes:{"w:ilvl":"8","w:tplc":"0409001B","w:tentative":"1"},elements:[{type:"element",name:"w:start",attributes:{"w:val":"1"}},{type:"element",name:"w:numFmt",attributes:{"w:val":"lowerRoman"}},{type:"element",name:"w:lvlText",attributes:{"w:val":"%9."}},{type:"element",name:"w:lvlJc",attributes:{"w:val":"right"}},{type:"element",name:"w:pPr",elements:[{type:"element",name:"w:ind",attributes:{"w:left":"6480","w:hanging":"180"}}]}]}]},{type:"element",name:"w:num",attributes:{"w:numId":"1","w16cid:durableId":"100147962"},elements:[{type:"element",name:"w:abstractNumId",attributes:{"w:val":"0"}}]},{type:"element",name:"w:num",attributes:{"w:numId":"2","w16cid:durableId":"485517411"},elements:[{type:"element",name:"w:abstractNumId",attributes:{"w:val":"1"}}]}]}]};function Dg(t,e){const{node:n,commentsExportType:r,exportedCommentDefs:o=[]}=t;if(!o.length||r==="clean")return;const i=n.attrs["w:id"],s=t.comments.find(p=>p.commentId==i);if(!s)return;const a=t.comments?.findIndex(p=>p.commentId===s.commentId),l=s.parentCommentId;let c;l&&(c=t.comments.find(p=>p.commentId===l||p.importedId===l));const u=c?.isInternal||s.isInternal;if(r==="external"&&u||s.resolvedTime)return;let d=ZE(e,a);if(e==="End"){const p={name:"w:r",elements:[{name:"w:commentReference",attributes:{"w:id":String(a)}}]};d=[d,p]}return d}const ZE=(t,e)=>({name:`w:commentRange${t}`,attributes:{"w:id":String(e)}}),QE=t=>({...t,commentParaId:lf()}),e4=(t,e,n,r)=>{const o=jv({editor:r,node:t.commentJSON}),i={"w:id":String(e),"w:author":t.creatorName||t.importedAuthor?.name,"w:email":t.creatorEmail||t.importedAuthor?.email,"w:date":Pv(t.createdTime),"w:initials":t4(t.creatorName),"w:done":t.resolvedTime?"1":"0","w15:paraId":t.commentParaId,"custom:internalId":t.commentId||t.internalId,"custom:trackedChange":t.trackedChange,"custom:trackedChangeText":t.trackedChangeText||null,"custom:trackedChangeType":t.trackedChangeType,"custom:trackedDeletedText":t.deletedText||null};if(t?.parentCommentId){const s=n.find(a=>a.commentId===t.parentCommentId);i["w15:paraIdParent"]=s.commentParaId}return{type:"element",name:"w:comment",attributes:i,elements:[o]}},t4=t=>t?t.replace("(imported)","").trim().split(" ").map(e=>e[0]).join(""):null,Pv=t=>new Date(t||Date.now()).toISOString().replace(/\.\d{3}Z$/,"Z"),n4=(t=[],e)=>{const n=Qt(e);return t.forEach(r=>{r.elements[0].elements.unshift(VE);const o=r.attributes["w15:paraId"];r.elements[0].attributes["w14:paraId"]=o,r.attributes={"w:id":r.attributes["w:id"],"w:author":r.attributes["w:author"],"w:email":r.attributes["w:email"],"w:date":r.attributes["w:date"],"w:initials":r.attributes["w:initials"],"custom:internalId":r.attributes["custom:internalId"],"custom:trackedChange":r.attributes["custom:trackedChange"],"custom:trackedChangeText":r.attributes["custom:trackedChangeText"],"custom:trackedChangeType":r.attributes["custom:trackedChangeType"],"custom:trackedDeletedText":r.attributes["custom:trackedDeletedText"],"xmlns:custom":"http://schemas.openxmlformats.org/wordprocessingml/2006/main"}}),n.elements[0].elements=t,n},r4=(t=[],e)=>{const n=Qt(e),r=t.map(o=>{const i={"w15:paraId":o.commentParaId,"w15:done":o.resolvedTime?"1":"0"},s=o.parentCommentId;if(s){const a=t.find(l=>l.commentId===s);i["w15:paraIdParent"]=a.commentParaId}return{type:"element",name:"w15:commentEx",attributes:i}});return n.elements[0].elements=r,n},o4=(t=[],e,n)=>{const r=Qt(e),o=Qt(n);return r.elements[0].elements=[],o.elements[0].elements=[],t.forEach(i=>{const s=lf(),a={type:"element",name:"w16cid:commentId",attributes:{"w16cid:paraId":i.commentParaId,"w16cid:durableId":s}};r.elements[0].elements.push(a);const l={type:"element",name:"w16cex:commentExtensible",attributes:{"w16cex:durableId":s,"w16cex:dateUtc":Pv()}};o.elements[0].elements.push(l)}),{documentIdsUpdated:r,extensibleUpdated:o}},i4=t=>{const e=Qt(t);return e["word/comments.xml"]=Po.COMMENTS_XML_DEF,e["word/commentsExtended.xml"]=Po.COMMENTS_EXTENDED_XML_DEF,e["word/commentsExtensible.xml"]=Po.COMMENTS_EXTENSIBLE_XML_DEF,e["word/commentsIds.xml"]=Po.COMMENTS_IDS_XML_DEF,e["[Content_Types].xml"]=Po.CONTENT_TYPES,e},s4=t=>{const e=Qt(t);return delete e["word/comments.xml"],delete e["word/commentsExtended.xml"],delete e["word/commentsExtensible.xml"],delete e["word/commentsIds.xml"],e},sa=t=>({...Po.DOCUMENT_RELS_XML_DEF.elements[0].elements.find(e=>e.attributes.Target===t)}),a4=({convertedXml:t,defs:e,commentsWithParaIds:n,exportType:r,converter:o})=>{const i=[];if(r==="clean")return{documentXml:s4(t),relationships:i};const s=i4(t);s["word/comments.xml"]=n4(e,s["word/comments.xml"]),i.push(sa("comments.xml")),s["word/commentsExtended.xml"]=r4(n,s["word/commentsExtended.xml"]),i.push(sa("commentsExtended.xml"));const{documentIdsUpdated:a,extensibleUpdated:l}=o4(n,s["word/commentsIds.xml"],s["word/commentsExtensible.xml"]);return s["word/commentsIds.xml"]=a,s["word/commentsExtensible.xml"]=l,i.push(sa("commentsIds.xml")),i.push(sa("commentsExtensible.xml")),{relationships:i,documentXml:s}},Fd=(t,e)=>e?["width",`${Math.max(e,t)}px`]:["min-width",`${t}px`],zv=(t,e,n,r)=>{let o=0,i=!0;const s=[],a=[],l=t.firstChild;if(!l)return{};for(let f=0,h=0;f<l.childCount;f++){const{colspan:m,colwidth:y}=l.child(f).attrs;for(let g=0;g<m;g++,h++){const v=n===h?r:y&&y[g];o+=v||e,v||(i=!1);const[k,b]=Fd(e,v);s.push(["col",{style:`${k}: ${b}`}]),a.push(parseInt(b,10))}}const c=i?`${o}px`:"",u=i?"":`${o}px`,d=["colgroup",{},...s],p=[...a];return{colgroup:d,tableWidth:c,tableMinWidth:u,colgroupValues:p}};function ki(t){const{type:e}=t.node||{},n={doc:u4,body:l4,paragraph:jv,text:d4,bulletList:Ng,orderedList:Ng,lineBreak:b4,table:v4,tableRow:E4,tableCell:$4,bookmarkStart:D4,fieldAnnotation:L4,tab:k4,image:Hv,hardBreak:P4,commentRangeStart:()=>Dg(t,"Start"),commentRangeEnd:()=>Dg(t,"End"),commentReference:()=>null,shapeContainer:z4,shapeTextbox:j4,contentBlock:q4,structuredContent:H4};return n[e]?n[e](t):(console.error("No translation function found for node type:",e),null)}function l4(t){const e=t.bodyNode?.elements.find(r=>r.name==="w:sectPr")||{};if(t.converter){const r=t.converter.pageStyles.pageMargins,o=e.elements.find(s=>s.name==="w:pgMar"),{attributes:i}=o;Object.entries(r).forEach(([s,a])=>{const l=ii(a);i[`w:${s}`]=l}),o.attributes=i}const n=lr(t);return t.isHeaderFooter?{name:"w:body",elements:[...n]}:{name:"w:body",elements:[...n,e]}}function jv(t){const e=lr(t),n=e.find(i=>i.name==="htmlAnnotation");if(n)return n.elements;const r=c4(t.node);r&&e.unshift(r);let o={};return t.node.attrs?.rsidRDefault&&(o["w:rsidRDefault"]=t.node.attrs.rsidRDefault),{name:"w:p",elements:e,attributes:o}}function c4(t){const{attrs:e={}}=t,n=[],{styleId:r}=e;r&&n.push({name:"w:pStyle",attributes:{"w:val":r}});const{spacing:o,indent:i,textAlign:s,textIndent:a,lineHeight:l,marksAttrs:c,keepLines:u,keepNext:d,dropcap:p}=e;if(o){const{lineSpaceBefore:h,lineSpaceAfter:m,line:y,lineRule:g}=o,v={};h>=0&&(v["w:before"]=at(h)),m>=0&&(v["w:after"]=at(m)),g==="exact"?l&&(v["w:line"]=_E(parseFloat(l))):l&&(v["w:line"]=Nd(l)),v["w:lineRule"]=g||"auto";const k={name:"w:spacing",attributes:v};n.push(k)}if(l&&!o){const h={name:"w:spacing",attributes:{"w:line":Nd(l)}};n.push(h)}if(i){const{left:h,right:m,firstLine:y,hanging:g}=i,v={};(h||h===0)&&(v["w:left"]=at(h)),(m||m===0)&&(v["w:right"]=at(m)),(y||y===0)&&(v["w:firstLine"]=at(y)),(g||g===0)&&(v["w:hanging"]=at(g)),a&&!v["w:left"]&&(v["w:left"]=ii(a));const k={name:"w:ind",attributes:v};n.push(k)}else if(a){const h={name:"w:ind",attributes:{"w:left":ii(a)}};n.push(h)}if(s){const h={name:"w:jc",attributes:{"w:val":s==="justify"?"both":s}};n.push(h)}if(c){const h=ec(c),m=qv(h);n.push(m)}u&&n.push({name:"w:keepLines",attributes:{"w:val":u}}),d&&n.push({name:"w:keepNext",attributes:{"w:val":d}}),p&&n.push({name:"w:framePr",attributes:{"w:dropCap":p.type,"w:lines":p.lines,"w:wrap":p.wrap,"w:vAnchor":p.vAnchor,"w:hAnchor":p.hAnchor}});const f=t.attrs?.paragraphProperties?.sectPr;return f&&n.push(f),n.length?{name:"w:pPr",elements:n}:null}function u4(t){const e={type:"body",content:t.node.content};return[{name:"w:document",elements:[ki({...t,node:e})],attributes:zE},t]}function lr(t){const{content:e}=t.node;if(!e)return[];const n=[];return e.forEach(r=>{let o=ki({...t,node:r});o?.name||o?.type,o instanceof Array?n.push(...o):n.push(o)}),n.filter(r=>r)}function Ql(t,e,n){const r=/^\s|\s$/.test(t)?"preserve":null,o=r?{"xml:space":r}:null,i=[],s=ec(e);if(i.push({name:"w:t",elements:[{text:t,type:"text"}],attributes:o}),n){const{editor:a}=n,l=a.extensionService.extensions.filter(c=>c.isExternal===!0);e.forEach(c=>{const u=l.some(p=>{const f=p.name;return c.type===f});if(!u)return;let d="";Object.entries(c.attrs).forEach(([p,f])=>{f&&(d+=`${p}=${f};`)}),u&&(i.unshift({type:"element",name:"w:bookmarkStart",attributes:{"w:id":"5000","w:name":c.type+";"+d}}),i.push({type:"element",name:"w:bookmarkEnd",attributes:{"w:id":"5000"}}))})}return Hs(i,s)}function d4(t){const{node:e}=t,n=[It,ut];if(e.marks?.some(i=>n.includes(i.type)))return f4(t);if(e.marks?.some(i=>i.type==="link"))return h4(t);const{text:r,marks:o=[]}=e;return Ql(r,o,t)}function p4(t){const e=t.find(n=>n.type===vt);if(e)return{type:"element",name:"w:rPrChange",attributes:{"w:id":e.attrs.id,"w:author":e.attrs.author,"w:authorEmail":e.attrs.authorEmail,"w:date":e.attrs.date},elements:e.attrs.before.map(n=>ec([n])).filter(n=>n!==void 0)}}function f4(t){const{node:e}=t,n=e.marks,r=[It,ut,vt],o=n.find(l=>r.includes(l.type)),i=o.type===It,s=p4(n);e.marks=n.filter(l=>!r.includes(l.type)),s&&e.marks.push(s);const a=ki({...t,node:e});if(!i){const l=a.elements.find(c=>c.name==="w:t");l.name="w:delText"}return{name:i?"w:ins":"w:del",type:"element",attributes:{"w:id":o.attrs.id,"w:author":o.attrs.author,"w:authorEmail":o.attrs.authorEmail,"w:date":o.attrs.date},elements:[a]}}function Hs(t,e){let n=[];return Array.isArray(t)?n=t:n=[t],e&&e.length&&n.unshift(qv(e)),{name:"w:r",elements:n}}function qv(t=[]){return{name:"w:rPr",elements:t.filter(e=>!!Object.keys(e).length)}}function ec(t=[]){return t.flatMap(e=>e.type==="textStyle"?Object.entries(e.attrs).filter(([n,r])=>r).map(([n,r])=>{const o={type:n,attrs:e.attrs};return Ig(o)}):Ig(e))}function h4(t){const{node:e}=t,n=e.marks.find(a=>a.type==="link"),r=n.attrs.href;let o=n.attrs.rId;o||(o=Uv(t,r)),e.marks=e.marks.filter(a=>a.type!=="link");const i=ki({...t,node:e}),s=Vv(i);return{name:"w:hyperlink",type:"element",attributes:{"r:id":o},elements:[s]}}function Vv(t){if(!t)return t;const e=Qt(t);if(!e)return e;const n={name:"w:rStyle",attributes:{"w:val":"Hyperlink"}},r={name:"w:color",attributes:{"w:val":"467886"}};if(e.name==="w:r"){const o=e.elements.find(i=>i.name==="w:rPr");if(o){const i=o.elements.find(a=>a.name==="w:color"),s=o.elements.find(a=>a.name==="w:rStyle");i||o.elements.unshift(r),s||o.elements.unshift(n)}else{const i={name:"w:rPr",elements:[n,r]};e.elements.unshift(i)}}return e}function Uv(t,e){const n="rId"+Yn();return(!t.relationships||!Array.isArray(t.relationships))&&(t.relationships=[]),t.relationships.push({type:"element",name:"Relationship",attributes:{Id:n,Type:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink",Target:e,TargetMode:"External"}}),n}function _g(t,e){const n="rId"+Yn(),r={type:"element",name:"Relationship",attributes:{Id:n,Type:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/image",Target:e}};return t.relationships.push(r),n}function Ng(t){const{type:e}=t.node,n=w4(t),r=[];return n.forEach(o=>{const{level:i,listType:s,pPrs:a,content:l,attrs:c={}}=o,u=(o.attrs.numId||o.listId)??m4(t,s),d=y4(i,u,a);l.forEach((p,f)=>{const h=Object.assign({},p);h.attrs={...h.attrs,...o.attrs};const m=ki({...t,node:h});m.elements||(m.elements=[]);const y=m.elements.findIndex(D=>D.name==="w:pPr");if(!m.elements.filter(D=>D.name!=="w:pPr").length){const D={name:"w:p",type:"element",elements:p.attrs.paragraphProperties?[p.attrs.paragraphProperties]:[]};return r.push(D)}const{attributes:g}=c,{originalInlineRunProps:v}=g||{};if(v&&d.elements.push(v),y===-1)m.elements.unshift(Qt(d));else{const D=Qt(d).elements.map(M=>m.elements[y].elements.find(E=>E.name===M.name)||M);m.elements[y].elements=D}let k;o.attrs?.importedFontSize&&(k={name:"w:sz",attributes:{"w:val":parseInt(o.attrs.importedFontSize.split("pt")[0])*2}});let b;o.attrs?.importedFontFamily&&(b={name:"w:rFonts",attributes:{"w:ascii":o.attrs?.importedFontFamily,"w:hAnsi":o.attrs?.importedFontFamily}});const C=m.elements.find(D=>D.name==="w:rPr");if(C)C.elements.push(fontSize);else if(k||b){const D=[];k&&D.push(k),b&&D.push(b),m.elements.unshift({name:"w:rPr",elements:D})}if(f!==0){const D=m.elements.find(I=>I.name==="w:pPr"),M=D.elements.findIndex(I=>I.name==="w:numPr");M!==-1&&D.elements.splice(M,1)}r.push(m)})}),r}function m4(t,e){const n=g4(t.converter?.numbering?.definitions),r=e==="bullet"?YE:XE,o=n,i=r.attributes["w:abstractNumId"],s={type:"element",name:"w:num",attributes:{"w:numId":String(o),"w16cid:durableId":"485517411"},elements:[{name:"w:abstractNumId",attributes:{"w:val":String(i)}}]};return t.converter.numbering.definitions[o]=s,o}const g4=t=>!t||!Object.keys(t).length?0:Math.max(...Object.keys(t).map(e=>parseInt(e,10)))+1;function y4(t,e,n=[]){return{name:"w:pPr",type:"element",elements:[{name:"w:numPr",type:"element",elements:[{name:"w:ilvl",type:"element",attributes:{"w:val":t}},{name:"w:numId",type:"element",attributes:{"w:val":e}}]},...n]}}function w4({node:t}){const{content:e,attrs:n={}}=t,{listId:r,syncId:o}=t.attrs||{},i=t.attrs["list-style-type"],{attributes:s={}}=n,a=s?.parentAttributes?.paragraphProperties?.elements?.filter(u=>u.name!=="w:numPr")||[],l=[];function c(u,d=0){!u||!u.length||u.forEach(p=>{const f=p.attrs?.indent;if(f){const{left:g,right:v,firstLine:k,hanging:b}=f,C={};g!==void 0&&(C["w:left"]=at(g)),v!==void 0&&(C["w:right"]=at(v)),k!==void 0&&(C["w:firstLine"]=at(k)),b!==void 0&&(C["w:hanging"]=at(b));const D={type:"element",name:"w:ind",attributes:C},M=a.findIndex(I=>I.name==="w:ind");M!==-1&&(a[M]=D)}const h=p.content?.filter(g=>g.type==="bulletList"||g.type==="orderedList")||[],m=p.content?.filter(g=>g.type!=="bulletList"&&g.type!=="orderedList")||[],y={...p,content:m,listId:r,level:d,listType:i,syncId:o,pPrs:a};l.push(y),h.length&&c(h[0].content,d+1)})}return c(e),l}function b4(t){const e={},{lineBreakType:n}=t.node?.attrs||{};return n&&(e["w:type"]=n),{name:"w:br",attributes:e}}function v4(t){t.node=x4(t.node,t);const e=lr(t),n=S4(t.node),r=C4(t.node,t);return e.unshift(n),e.unshift(r),{name:"w:tbl",elements:e}}function x4(t,{editorSchema:e}){const{content:n}=t;for(let r=0;r<n.length;r++){const o=n[r];if(o.content)for(let i=0;i<o.content?.length;i++){const s=o.content[i];if(!s){console.log("no cell");continue}const{attrs:a}=s;if(a.rowspan>1){const l=n.slice(r+1,r+a.rowspan),c={type:s.type,content:[e.nodes.paragraph.createAndFill().toJSON()],attrs:{...s.attrs,colspan:null,rowspan:null,continueMerge:!0}};l.forEach((u,d)=>{u.content.splice(i,0,c)})}}}return t}function k4(t){const{marks:e=[]}=t.node,n=ec(e);return Hs({name:"w:tab"},n)}function S4(t){const e=[],{attrs:n}=t,{tableWidth:r,tableWidthType:o,tableStyleId:i,borders:s,tableIndent:a,tableLayout:l,tableCellSpacing:c}=n;if(i){const u={name:"w:tblStyle",attributes:{"w:val":i}};e.push(u)}if(s){const u=A4(t);e.push(u)}if(a){const{width:u,type:d}=a,p={name:"w:tblInd",attributes:{"w:w":at(u),"w:type":d}};e.push(p)}if(l){const u={name:"w:tblLayout",attributes:{"w:type":l}};e.push(u)}if(r&&r.width){const u={name:"w:tblW",attributes:{"w:w":at(r.width),"w:type":r.type}};e.push(u)}return c&&e.push({name:"w:tblCellSpacing",attributes:{"w:w":c.w,"w:type":c.type}}),{name:"w:tblPr",elements:e}}function A4(t){const{borders:e}=t.attrs,n=[];return e?(["top","bottom","left","right","insideH","insideV"].forEach(r=>{const o=e[r];if(!o)return;let i={};!Object.keys(o).length||!o.size?i={"w:val":"nil"}:i={"w:val":"single","w:sz":Rv(o.size),"w:space":o.space||0,"w:color":o?.color?.substring(1)||"000000"};const s={name:`w:${r}`,attributes:i};n.push(s)}),{name:"w:tblBorders",elements:n}):void 0}function C4(t,e){const{editorSchema:n}=e;let r=[];try{const i=n.nodeFromJSON(t),s=25,{colgroupValues:a}=zv(i,s);r=a}catch{r=[]}const o=[];return r?.forEach(i=>{o.push({name:"w:gridCol",attributes:{"w:w":at(i)}})}),{name:"w:tblGrid",elements:o}}function E4(t){const e=lr(t),n=T4(t.node);return n.elements.length&&e.unshift(n),{name:"w:tr",elements:e}}function T4(t){const{attrs:e}=t,n=[],{rowHeight:r,rowHeightType:o}=e;if(r){const i={"w:val":at(r)};o&&(i["w:hRule"]=o);const s={name:"w:trHeight",attributes:i};n.push(s)}return{name:"w:trPr",elements:n}}function $4(t){const e=lr({...t,tableCell:t.node}),n=O4(t.node);return e.unshift(n),{name:"w:tc",elements:e}}function O4(t){const e=[],{attrs:n}=t,{colwidth:r=[],cellWidthType:o="dxa",background:i={},colspan:s,rowspan:a,widthUnit:l}=n,c=r.reduce((m,y)=>m+y,0),u={name:"w:tcW",attributes:{"w:w":l==="px"?at(c):ii(c),"w:type":o}};if(e.push(u),s){const m={name:"w:gridSpan",attributes:{"w:val":`${s}`}};e.push(m)}const{color:d}=i||{};if(d){const m={name:"w:shd",attributes:{"w:fill":d}};e.push(m)}const{cellMargins:p}=n;if(p){const m={name:"w:tcMar",elements:M4(p)};e.push(m)}const{verticalAlign:f}=n;if(f){const m={name:"w:vAlign",attributes:{"w:val":f}};e.push(m)}if(a&&a>1){const m={name:"w:vMerge",type:"element",attributes:{"w:val":"restart"}};e.push(m)}else if(n.continueMerge){const m={name:"w:vMerge",type:"element"};e.push(m)}const{borders:h={}}=n;if(h&&Object.keys(h).length){const m={name:"w:tcBorders",elements:Object.entries(h).map(([y,g])=>g.size?{name:`w:${y}`,attributes:{"w:val":"single","w:color":g.color?g.color.substring(1):"auto","w:sz":Rv(g.size),"w:space":g.space||0}}:{name:`w:${y}`,attributes:{"w:val":"nil"}})};e.push(m)}return{name:"w:tcPr",elements:e}}function M4(t){const e=[],{top:n,right:r,bottom:o,left:i}=t;return n!=null&&e.push({name:"w:top",attributes:{"w:w":at(n)}}),r!=null&&e.push({name:"w:right",attributes:{"w:w":at(r)}}),o!=null&&e.push({name:"w:bottom",attributes:{"w:w":at(o)}}),i!=null&&e.push({name:"w:left",attributes:{"w:w":at(i)}}),e}function D4(t){const e={name:"w:bookmarkStart",attributes:{"w:id":t.node.attrs.id,"w:name":t.node.attrs.name}},n={name:"w:bookmarkEnd",attributes:{"w:id":t.node.attrs.id}};return[e,n]}function Ig(t){const e=Nr.markTypes.find(i=>i.type===t.type);if(!e)return{};const n={name:e.name,attributes:{}},{attrs:r}=t;let o;switch(t.type){case"bold":case"italic":delete n.attributes,n.type="element";break;case"underline":n.type="element",n.attributes["w:val"]=r.underlineType;break;case"fontSize":o=r.fontSize,n.attributes["w:val"]=o.slice(0,-2)*2;break;case"fontFamily":o=r.fontFamily,["w:ascii","w:eastAsia","w:hAnsi","w:cs"].forEach(s=>{const a=o.split(", ");n.attributes[s]=a[0]?a[0]:o});break;case"color":let i=r.color.replace(/^#/,"").replace(/;$/,"");i.startsWith("rgb")&&(i=LE(i)),n.attributes["w:val"]=i;break;case"textAlign":n.attributes["w:val"]=r.textAlign;break;case"textIndent":n.attributes["w:firstline"]=ii(r.textIndent);break;case"lineHeight":n.attributes["w:line"]=Nd(r.lineHeight);break;case"highlight":n.attributes["w:fill"]=r.color?.substring(1),n.attributes["w:color"]="auto",n.attributes["w:val"]="clear",n.name="w:shd";break}return n}function _4(t){if(!t)return{};const e=t.split(";")[0].split("/")[1];if(!t||e!=="png")return{originalWidth:void 0,originalHeight:void 0};let n=t.split(",")[1].slice(0,50),r=Uint8Array.from(atob(n),i=>i.charCodeAt(0)),o=new DataView(r.buffer,0,28);return{originalWidth:o.getInt32(16),originalHeight:o.getInt32(20)}}function N4(t,e,n,r){let o=t,i=e,s=Math.min(n/t,r/e);return o=Math.round(o*s),i=Math.round(i*s),{scaledWidth:o,scaledHeight:i}}function Hv(t,e){const{node:{attrs:n={},marks:r=[]},tableCell:o}=t;let i=n.rId;const s=n.src||n.imageSrc,{originalWidth:a,originalHeight:l}=_4(s);let c=n.size?{w:Vr(n.size.width),h:Vr(n.size.height)}:e;if(a&&l){const m=Gt(c.w),y=Gt(c.h),{scaledWidth:g,scaledHeight:v}=N4(a,l,m,y);c={w:Vr(g),h:Vr(v)}}if(o){const m=o.attrs.colwidth.reduce((C,D)=>C+D,0),y=o.attrs.cellMargins?.left||8,g=o.attrs.cellMargins?.right||8,v=Vr(m-(y+g)),{width:k,height:b}=V4(c.w,c.h,v);k&&b&&(c={w:k,h:b})}if(t.node.type==="image"&&!i){const m=s?.split("word/")[1];i=_g(t,m)}else if(t.node.type==="fieldAnnotation"&&!i){const m=s?.split(";")[0].split("/")[1];if(!m)return Wv(t);const y=Yn(4),g=n.fieldId.replace("-","_"),v=`media/${g}_${y}.${m}`;i=_g(t,v),t.media[`${g}_${y}.${m}`]=s}let u=n.originalPadding||{distT:0,distB:0,distL:0,distR:0};const d=[];let p=[];n.isAnchor&&(u={...u,simplePos:n.originalAttributes?.simplePos,relativeHeight:1,behindDoc:n.originalAttributes?.behindDoc,locked:n.originalAttributes?.locked,layoutInCell:n.originalAttributes?.layoutInCell,allowOverlap:n.originalAttributes?.allowOverlap},n.simplePos&&d.push({name:"wp:simplePos",attributes:{x:0,y:0}}),n.anchorData&&(d.push({name:"wp:positionH",attributes:{relativeFrom:n.anchorData.hRelativeFrom},...n.marginOffset.left&&{elements:[{name:"wp:posOffset",elements:[{type:"text",text:Vr(n.marginOffset.left).toString()}]}]},...n.anchorData.alignH&&{elements:[{name:"wp:align",elements:[{type:"text",text:n.anchorData.alignH}]}]}}),d.push({name:"wp:positionV",attributes:{relativeFrom:n.anchorData.vRelativeFrom},...n.marginOffset.top&&{elements:[{name:"wp:posOffset",elements:[{type:"text",text:Vr(n.marginOffset.top).toString()}]}]},...n.anchorData.alignV&&{elements:[{name:"wp:align",elements:[{type:"text",text:n.anchorData.alignV}]}]}})),n.wrapText&&p.push({name:"wp:wrapSquare",attributes:{wrapText:n.wrapText}}),n.wrapTopAndBottom&&p.push({name:"wp:wrapTopAndBottom"}));const f="http://schemas.openxmlformats.org/drawingml/2006/main",h="http://schemas.openxmlformats.org/drawingml/2006/picture";return Hs({name:"w:drawing",elements:[{name:n.isAnchor?"wp:anchor":"wp:inline",attributes:u,elements:[...d,{name:"wp:extent",attributes:{cx:c.w,cy:c.h}},{name:"wp:effectExtent",attributes:{l:0,t:0,r:0,b:0}},...p,{name:"wp:docPr",attributes:{id:n.id||0,name:n.alt,descr:n.title}},{name:"wp:cNvGraphicFramePr",elements:[{name:"a:graphicFrameLocks",attributes:{"xmlns:a":f,noChangeAspect:1}}]},{name:"a:graphic",attributes:{"xmlns:a":f},elements:[{name:"a:graphicData",attributes:{uri:h},elements:[{name:"pic:pic",attributes:{"xmlns:pic":h},elements:[{name:"pic:nvPicPr",elements:[{name:"pic:cNvPr",attributes:{id:n.id||0,name:n.title}},{name:"pic:cNvPicPr",elements:[{name:"a:picLocks",attributes:{noChangeAspect:1,noChangeArrowheads:1}}]}]},{name:"pic:blipFill",elements:[{name:"a:blip",attributes:{"r:embed":i}},{name:"a:stretch",elements:[{name:"a:fillRect"}]}]},{name:"pic:spPr",attributes:{bwMode:"auto"},elements:[{name:"a:xfrm",elements:[{name:"a:ext",attributes:{cx:c.w,cy:c.h}},{name:"a:off",attributes:{x:0,y:0}}]},{name:"a:prstGeom",attributes:{prst:"rect"},elements:[{name:"a:avLst"}]},{name:"a:noFill"}]}]}]}]}]}]},[])}function Wv(t){const{node:{attrs:e={},marks:n=[]}}=t,r=Gv(e);return Ql(e.displayLabel,[...n,...r],t)}function I4(t){const{node:{attrs:e={},marks:n=[]}}=t,r=TC.decode(e.displayLabel);return Ql(r,n,t)}function F4(t){const{node:{attrs:e={},marks:n=[]},editorSchema:r}=t,o=new window.DOMParser().parseFromString(e.rawHtml||e.displayLabel,"text/html"),i=Gv(e),s=[...n,...i];let a=Zi.create({doc:er.fromSchema(r).parse(o)});s.length&&(a=U4(a,s));const l=a.doc.toJSON();return{name:"htmlAnnotation",elements:lr({...t,node:l})}}function Fg(t,e){return Hv(t,e)}function R4(t){const{node:{attrs:e={},marks:n=[]}}=t,r=Uv(t,e.linkUrl),o=Ql(e.linkUrl,n,t),i=Vv(o);return{name:"w:hyperlink",type:"element",attributes:{"r:id":r,"w:history":1},elements:[i]}}function B4(t){const e={w:4286250,h:4286250},n={w:99e4,h:495e3};return{text:Wv,image:r=>Fg(r,e),signature:r=>Fg(r,n),checkbox:I4,html:F4,link:R4}[t]}const Gv=(t={})=>{const{fontFamily:e,fontSize:n,bold:r,underline:o,italic:i,textColor:s,textHighlight:a}=t,l=[];return e&&l.push({type:"fontFamily",attrs:{fontFamily:e}}),n&&l.push({type:"fontSize",attrs:{fontSize:n}}),r&&l.push({type:"bold",attrs:{}}),o&&l.push({type:"underline",attrs:{}}),i&&l.push({type:"italic",attrs:{}}),s&&l.push({type:"color",attrs:{color:s}}),a&&l.push({type:"highlight",attrs:{color:a}}),l};function L4(t){const{node:e,isFinalDoc:n}=t,{attrs:r={}}=e,o=B4(r.type);if(!o)return{};let i,s;if(n)return o(t);i=o(t),s=[i],r.type==="html"&&(s=[...i.elements]);const a="http://schemas.openxmlformats.org/wordprocessingml/2006/main";return{name:"w:sdt",elements:[{name:"w:sdtPr",elements:[{name:"w:tag",attributes:{"w:val":r.fieldId}},{name:"w:alias",attributes:{"w:val":r.displayLabel}},{name:"w:fieldType",attributes:{"xmlns:w":a,"w:val":r.fieldType}},{name:"w:fieldTypeShort",attributes:{"xmlns:w":a,"w:val":r.type}},{name:"w:fieldColor",attributes:{"xmlns:w":a,"w:val":r.fieldColor}},{name:"w:fieldMultipleImage",attributes:{"xmlns:w":a,"w:val":r.multipleImage}},{name:"w:fieldFontFamily",attributes:{"xmlns:w":a,"w:val":r.fontFamily}},{name:"w:fieldFontSize",attributes:{"xmlns:w":a,"w:val":r.fontSize}},{name:"w:fieldTextColor",attributes:{"xmlns:w":a,"w:val":r.textColor}},{name:"w:fieldTextHighlight",attributes:{"xmlns:w":a,"w:val":r.textHighlight}}]},{name:"w:sdtContent",elements:s}]}}function P4(t){const{node:e={}}=t,{attrs:n={}}=e,{pageBreakSource:r}=n;return r==="sectPr"?null:{name:"w:r",elements:[{name:"w:br",type:"element",attributes:{"w:type":"page"}}]}}function z4(t){const{node:e}=t,n=lr(t),r={name:"v:shape",attributes:{...e.attrs.attributes,fillcolor:e.attrs.fillcolor},elements:[...n,...e.attrs.wrapAttributes?[{name:"w10:wrap",attributes:{...e.attrs.wrapAttributes}}]:[]]},o={name:"w:pict",attributes:{"w14:anchorId":Math.floor(Math.random()*4294967295).toString()},elements:[r]};return{name:"w:p",elements:[Hs(o)]}}function j4(t){const{node:e}=t,n={name:"w:txbxContent",elements:lr(t)};return{name:"v:textbox",attributes:{...e.attrs.attributes},elements:[n]}}function q4(t){const{node:e}=t,{drawingContent:n}=e.attrs,r={name:"w:drawing",elements:[...n?[...n.elements||[]]:[]]};return{name:"w:p",elements:[Hs({name:"mc:AlternateContent",elements:[{name:"mc:Choice",attributes:{Requires:"wps"},elements:[r]}]})]}}var Jr,Kv,Au,Cu;let Rg=class{constructor(e){ab(this,Jr),this.converter=e}schemaToXml(e,n=!1){return Dn(this,Jr,Kv).call(this,e,n).join("")}};Jr=new WeakSet,Kv=function(t,e=falase){const n=JSON.parse(JSON.stringify(t)),r=this.converter.declaration.attributes,o=`<?xml${Object.entries(r).map(([s,a])=>` ${s}="${a}"`).join("")}?>`,i=Dn(this,Jr,Cu).call(this,n,e);return[o,...i]},Au=function(t){if(t)return t.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")},Cu=function(t,e=!1){if(!t)return null;let{name:n}=t;const{elements:r,attributes:o}=t;let i=`<${n}`;for(let l in o){const c=typeof o[l]=="string"?Dn(this,Jr,Au).call(this,o[l]):o[l];i+=` ${l}="${c}"`}const s=n&&(!r||!r.length);s?i+=" />":i+=">";let a=[i];if(!n&&t.type==="text")return t.text;if(n==="w:instrText")a.push(r[0].text);else if(n==="w:t"||n==="w:delText"||n==="wp:posOffset"){const l=Dn(this,Jr,Au).call(this,r[0].text);a.push(l)}else if(r)for(let l of r){const c=Dn(this,Jr,Cu).call(this,l);if(!c)continue;if(typeof c=="string"){a.push(c);continue}const u=c.filter(d=>d!=="<undefined>"&&d!=="</undefined>");a.push(...u)}return s||a.push(`</${n}>`),a};function V4(t,e,n){if(t>n){let r=n/t,o=Math.round(e*r);return{width:n,height:o}}return{width:t,height:e}}function U4(t,e){const{tr:n,doc:r,schema:o}=t,i=["fontFamily","fontSize","highlight"];if(!e.some(d=>i.includes(d.type)))return t;const s=e.find(d=>d.type==="fontFamily"),a=e.find(d=>d.type==="fontSize"),l=e.find(d=>d.type==="highlight"),c=o.marks.textStyle,u=o.marks.highlight;return r.descendants((d,p)=>{if(!d.isText)return;const f=d.marks.find(m=>m.type.name==="textStyle"),h=d.marks.find(m=>m.type.name==="highlight");f?!f?.attrs.fontFamily&&s?n.addMark(p,p+d.nodeSize,c.create({...f?.attrs,...s.attrs})):!f?.attrs.fontSize&&a&&n.addMark(p,p+d.nodeSize,c.create({...f?.attrs,...a.attrs})):n.addMark(p,p+d.nodeSize,c.create({...s?.attrs,...a?.attrs})),h||n.addMark(p,p+d.nodeSize,u.create({...l?.attrs}))}),t.apply(n)}function H4(t){const{node:e}=t,{attrs:n={}}=e,r=[{name:"w:sdtContent",elements:lr({...t,nodes:e.content})}];return r.unshift(n.sdtPr),{name:"w:sdt",elements:r}}const W4='<w:document xmlns:wpc="http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas" xmlns:cx="http://schemas.microsoft.com/office/drawing/2014/chartex" xmlns:cx1="http://schemas.microsoft.com/office/drawing/2015/9/8/chartex" xmlns:cx2="http://schemas.microsoft.com/office/drawing/2015/10/21/chartex" xmlns:cx3="http://schemas.microsoft.com/office/drawing/2016/5/9/chartex" xmlns:cx4="http://schemas.microsoft.com/office/drawing/2016/5/10/chartex" xmlns:cx5="http://schemas.microsoft.com/office/drawing/2016/5/11/chartex" xmlns:cx6="http://schemas.microsoft.com/office/drawing/2016/5/12/chartex" xmlns:cx7="http://schemas.microsoft.com/office/drawing/2016/5/13/chartex" xmlns:cx8="http://schemas.microsoft.com/office/drawing/2016/5/14/chartex" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:aink="http://schemas.microsoft.com/office/drawing/2016/ink" xmlns:am3d="http://schemas.microsoft.com/office/drawing/2017/model3d" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:oel="http://schemas.microsoft.com/office/2019/extlst" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" xmlns:m="http://schemas.openxmlformats.org/officeDocument/2006/math" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:wp14="http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing" xmlns:wp="http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing" xmlns:w10="urn:schemas-microsoft-com:office:word" xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main" xmlns:w14="http://schemas.microsoft.com/office/word/2010/wordml" xmlns:w15="http://schemas.microsoft.com/office/word/2012/wordml" xmlns:w16cex="http://schemas.microsoft.com/office/word/2018/wordml/cex" xmlns:w16cid="http://schemas.microsoft.com/office/word/2016/wordml/cid" xmlns:w16="http://schemas.microsoft.com/office/word/2018/wordml" xmlns:w16sdtdh="http://schemas.microsoft.com/office/word/2020/wordml/sdtdatahash" xmlns:w16se="http://schemas.microsoft.com/office/word/2015/wordml/symex" xmlns:wpg="http://schemas.microsoft.com/office/word/2010/wordprocessingGroup" xmlns:wpi="http://schemas.microsoft.com/office/word/2010/wordprocessingInk" xmlns:wne="http://schemas.microsoft.com/office/word/2006/wordml" xmlns:wps="http://schemas.microsoft.com/office/word/2010/wordprocessingShape" mc:Ignorable="w14 w15 w16se w16cid w16 w16cex w16sdtdh wp14"><w:body></w:body></w:document>',G4=t=>JSON.parse(nf.xml2json(t,null,2)),K4=(t,e=W4)=>t["word/document.xml"]||G4(e),J4=t=>{const{nodes:e}=t;if(e.length===0)return{nodes:[],consumed:0};const n=e[0];switch(n.name){case"w:tbl":return{nodes:[Y4(n,t)],consumed:1}}return{nodes:[],consumed:0}},X4={handlerName:"tableNodeHandler",handler:J4};function Y4(t,e){const{docx:n,nodeListHandler:r}=e,o=t.elements.find(k=>k.name==="w:tblPr"),i=o.elements.find(k=>k.name==="w:tblBorders")?.elements||[],{borders:s,rowBorders:a}=Xv(i),l=o.elements.find(k=>k.name==="w:tblStyle"),c={tableStyleId:l?.attributes["w:val"]},u=o?.elements.find(k=>k.name==="w:tblInd");if(u){const{"w:w":k,"w:type":b}=u.attributes;c.tableIndent={width:nt(k),type:b}}const d=o?.elements.find(k=>k.name==="w:tblLayout");if(d){const{"w:type":k}=d.attributes;c.tableLayout=k}const p=Jv(l,n),f=o.elements.find(k=>k.name==="w:tblW");f&&(c.tableWidth={width:nt(f.attributes["w:w"]),type:f.attributes["w:type"]});const h=o.elements.find(k=>k.name==="w:tblCellSpacing");h&&(c.tableCellSpacing={w:h.attributes["w:w"],type:h.attributes["w:type"]},c.borderCollapse="separate");const m=t.elements.filter(k=>k.name==="w:tr"),y=Object.keys(s)?.length?s:p?.borders,g=Object.keys(a)?.length?a:p?.rowBorders;c.borders=y;const v=[];return m.forEach(k=>{const b=e6(k,t,g,l,e);b.content?.length&&v.push(b)}),{type:"table",content:v,attrs:c}}function Z4(t,e,n,r,o=null,i,s,a){const{docx:l,nodeListHandler:c}=s,u=t.elements.find(N=>N.name==="w:tcPr"),d=u?.elements?.find(N=>N.name==="w:tcBorders"),p=Q4(d,r),f=Yv(n),h=u?.elements?.find(N=>N.name==="w:tcW");let m=h?nt(h.attributes["w:w"]):null;const y=h?.attributes["w:type"];!m&&o&&(m=o);const g=Bg(t),{attributes:v}=g||{},k={color:u?.elements?.find(N=>N.name==="w:shd")?.attributes["w:fill"]},b=u?.elements?.find(N=>N.name==="w:gridSpan")?.attributes["w:val"],C=u?.elements?.find(N=>N.name==="w:tcMar"),D=u?.elements?.find(N=>N.name==="w:vAlign")?.attributes["w:val"]||"top",M={},I=Jv(i,l)||{};M.cellMargins=t6(C,I);const{fontSize:E,fonts:G={}}=I,oe=G.ascii;if(m){M.colwidth=[m],M.widthUnit="px";const N=f,H=f&&f.length>0,A=parseInt(b,10);if(A&&A>1&&H){let J=[];for(let ie=0;ie<A;ie++){let W=N[a+ie];typeof W<"u"?J.push(W):J.push(100)}J.length&&(M.colwidth=[...J])}}if(y&&(M.widthType=y),b&&(M.colspan=parseInt(b,10)),k&&(M.background=k),M.verticalAlign=D,E&&(M.fontSize=E),oe&&(M.fontFamily=oe.ascii),r&&(M.borders={...r}),p&&(M.borders=Object.assign(M.borders||{},p)),v&&v["w:val"]==="restart"){const N=n.elements.filter(W=>W.name==="w:tr"),H=N.findIndex(W=>W===e),A=N.slice(H+1);let J=e.elements.filter(W=>W.name==="w:tc").findIndex(W=>W===t),ie=1;for(let W of A){const ce=W.elements.findIndex(R=>R.name==="w:tc"),X=W.elements[ce+J];if(!X)break;const ue=Bg(X),{attributes:Z}=ue||{};if(!ue&&!Z||Z&&Z["w:val"]==="restart")break;ie++,W.elements.splice(ce+J,1)}M.rowspan=ie}return{type:"tableCell",content:c.handler({...s,nodes:t.elements}),attrs:M}}const Bg=t=>t.elements.find(e=>e.name==="w:tcPr")?.elements?.find(e=>e.name==="w:vMerge"),aa=(t,e,n={})=>{const r=t?.elements?.find(o=>o.name===`w:${e}`)?.attributes;if(r&&r["w:val"]!=="nil"){const o={},i=r["w:color"];i&&(o.color=i==="auto"?"#000000":`#${i}`);const s=r["w:sz"];return s&&(o.size=Fv(s)),o}if(r&&r["w:val"]==="nil"){const o=Object.assign({},n[e]||{});return Object.keys(o)?(o.val="none",o):null}return null},Q4=(t,e)=>{if(!t)return null;const n={},r=aa(t,"bottom",e);r&&(n.bottom=r);const o=aa(t,"top",e);o&&(n.top=o);const i=aa(t,"left",e);i&&(n.left=i);const s=aa(t,"right",e);return s&&(n.right=s),n};function Jv(t,e,n){if(!t)return null;const r={},{attributes:o={}}=t,i=o["w:val"];if(!i)return null;const s=e["word/styles.xml"],{elements:a}=s.elements[0],l=a.filter(m=>m.name==="w:style"),c=l.find(m=>m.attributes["w:styleId"]===i);if(!c)return null;r.name=c.elements.find(m=>m.name==="w:name");const u=c.elements.find(m=>m.name==="w:basedOn");c.elements.find(m=>m.name==="w:uiPriority");let d;if(u?.attributes){const m=l.find(y=>y.attributes["w:styleId"]===u.attributes["w:val"]);d=m?m.elements.find(y=>y.name==="w:tblPr"):{}}const p=c.elements.find(m=>m.name==="w:pPr");if(p){const m=p.elements.find(y=>y.name==="w:jc");m?.attributes&&(r.justification=m.attributes["w:val"])}const f=c?.elements.find(m=>m.name==="w:rPr");if(f){const m=f.elements.find(g=>g.name==="w:rFonts");if(m){const{"w:ascii":g,"w:hAnsi":v,"w:cs":k}=m.attributes;r.fonts={ascii:g,hAnsi:v,cs:k}}const y=f.elements.find(g=>g.name==="w:sz");y?.attributes&&(r.fontSize=DE(y.attributes["w:val"])+"pt")}const h=c.elements.find(m=>m.name==="w:tblPr");if(h&&h.elements){d&&d.elements&&h.elements.push(...d.elements);const m=h?.elements?.find(b=>b.name==="w:tblBorders"),{elements:y=[]}=m||{},{borders:g,rowBorders:v}=Xv(y);g&&(r.borders=g),v&&(r.rowBorders=v);const k=h?.elements.find(b=>b.name==="w:tblCellMar");if(k){const b=k.elements.find(I=>I.name==="w:left"),C=k.elements.find(I=>I.name==="w:right"),D=k.elements.find(I=>I.name==="w:top"),M=k.elements.find(I=>I.name==="w:bottom");r.cellMargins={marginLeft:b?.attributes["w:w"],marginRight:C?.attributes["w:w"],marginTop:D?.attributes["w:w"],marginBottom:M?.attributes["w:w"]}}}return r}function Xv(t){const e={},n={};return t.forEach(r=>{const{name:o}=r,i=o.split("w:")[1],{attributes:s}=r,a={},l=s["w:color"],c=s["w:sz"];l&&l!=="auto"&&(a.color=l.startsWith("#")?l:`#${l}`),c&&c!=="auto"&&(a.size=Fv(c)),["insideH","insideV"].includes(i)&&(n[i]=a),e[i]=a}),{borders:e,rowBorders:n}}function e6(t,e,n,r,o){const i={},s=t.elements.find(d=>d.name==="w:trPr")?.elements?.find(d=>d.name==="w:trHeight"),a=s?.attributes["w:val"];s?.attributes["w:hRule"];const l={};n?.insideH&&(l.bottom=n.insideH),n?.insideV&&(l.right=n.insideV),i.borders=l,a&&(i.rowHeight=nt(a));const c=Yv(e),u=t.elements.filter(d=>d.name==="w:tc");return{type:"tableRow",content:u?.map((d,p)=>{const f=u.length>1?c[p]:null;return Z4(d,t,e,l,f,r,o,p)})||[],attrs:i}}const t6=(t,e)=>{const n=t?.elements?.find(m=>m.name==="w:left"),r=t?.elements?.find(m=>m.name==="w:right"),o=t?.elements?.find(m=>m.name==="w:top"),i=t?.elements?.find(m=>m.name==="w:bottom"),s=n?.attributes["w:w"],a=r?.attributes["w:w"],l=o?.attributes["w:w"],c=i?.attributes["w:w"],{cellMargins:u={}}=e,{marginLeft:d,marginRight:p,marginTop:f,marginBottom:h}=u;return{left:nt(s??d),right:nt(a??p),top:nt(l??f),bottom:nt(c??h)}},Yv=t=>t.elements.find(e=>e.name==="w:tblGrid")?.elements?.flatMap(e=>e.name!=="w:gridCol"?[]:nt(e.attributes["w:w"]))||[],n6=t=>{const{nodes:e,filename:n}=t,r=["w:drawing","w:p"];if(e.length===0||!r.includes(e[0].name))return{nodes:[],consumed:0};const o=e[0];let i;if(o.name==="w:drawing"?i=o:i=o.elements.find(d=>d.name==="w:drawing"),!i)return{nodes:[],consumed:0};let s;const{elements:a}=i,l=n||null,c=a.find(d=>d.name==="wp:anchor");c&&(s=Lg(a[0],l,t),s.attrs.isAnchor=c);const u=a.find(d=>d.name==="wp:inline");return u&&(s=Lg(u,l,t)),{nodes:s?[s]:[],consumed:1}};function Lg(t,e,n){const{docx:r}=n,{attributes:o}=t,i={top:Gt(o.distT),bottom:Gt(o.distB),left:Gt(o.distL),right:Gt(o.distR)},s=t.elements.find(X=>X.name==="wp:extent"),a={width:Gt(s.attributes?.cx),height:Gt(s.attributes?.cy)},l=t.elements.find(X=>X.name==="a:graphic").elements.find(X=>X.name==="a:graphicData"),{uri:c}=l?.attributes;if(c&&c==="http://schemas.microsoft.com/office/word/2010/wordprocessingShape")return r6(n,t,l);const u=l.elements.find(X=>X.name==="pic:pic");if(!u||!u.elements)return null;const d=u.elements.find(X=>X.name==="pic:blipFill").elements.find(X=>X.name==="a:blip"),p=t.elements.find(X=>X.name==="wp:positionH"),f=p?.elements.find(X=>X.name==="wp:posOffset"),h=Gt(f?.elements[0]?.text),m=p?.attributes.relativeFrom,y=p?.elements.find(X=>X.name==="wp:align")?.elements[0]?.text,g=t.elements.find(X=>X.name==="wp:positionV"),v=g?.elements.find(X=>X.name==="wp:posOffset"),k=Gt(v?.elements[0]?.text),b=g?.attributes.relativeFrom,C=g?.elements.find(X=>X.name==="wp:align")?.elements[0]?.text,D=t.elements.find(X=>X.name==="wp:simplePos"),M=t.elements.find(X=>X.name==="wp:wrapSquare"),I=t.elements.find(X=>X.name==="wp:wrapTopAndBottom"),E=t.elements.find(X=>X.name==="wp:docPr");let G=null;(m||y||b||C)&&(G={hRelativeFrom:m,vRelativeFrom:b,alignH:y,alignV:C});const oe={left:h,top:k},{attributes:N}=d,H=N["r:embed"];let A=r[`word/_rels/${e||"document.xml"}.rels`];A||(A=r["word/_rels/document.xml.rels"]);const J=A.elements.find(X=>X.name==="Relationships"),{elements:ie}=J,W=ie.find(X=>X.attributes.Id===H),{attributes:ce}=W;return{type:"image",attrs:{src:`word/${ce.Target}`,alt:E?.attributes.name||"Image",id:E?.attributes.id||"",title:E?.attributes.descr||"Image",inline:!0,padding:i,marginOffset:oe,size:a,anchorData:G,...D&&{simplePos:{x:D.attributes.x,y:D.attributes.y}},...M&&{wrapText:M.attributes.wrapText},wrapTopAndBottom:!!I,originalPadding:{distT:o.distT,distB:o.distB,distL:o.distL,distR:o.distR},originalAttributes:t.attributes,rId:ce.Id}}}const r6=(t,e,n)=>{const r=n.elements.find(l=>l.name==="wps:wsp"),o=r.elements.find(l=>l.name==="wps:txbx")?.elements?.find(l=>l.name==="w:txbxContent");e.elements.find(l=>l.name==="wp:docPr");const i=r.elements.find(l=>l.name==="wps:spPr"),s=i?.elements.find(l=>l.name==="a:prstGeom");if(s&&s.attributes.prst==="rect")return o6(t,i);if(!o)return null;const{nodeListHandler:a}=t;return a.handler({...t,node:o.elements[0],nodes:o.elements})[0]},o6=(t,e)=>{const n={},[r]=t.nodes;r?.name==="w:drawing"&&(n.drawingContent=r);const o=e.elements.find(u=>u.name==="a:xfrm"),i=o.elements.find(u=>u.name==="a:off"),s=o.elements.find(u=>u.name==="a:ext");e.elements.find(u=>u.name==="a:ln");const a=e.elements.find(u=>u.name==="a:solidFill"),l={top:Gt(i.attributes.y),left:Gt(i.attributes.x),width:Gt(s.attributes.cx),height:Gt(s.attributes.cy)};n.size=l;const c=a?.elements[0]?.attributes.val;return c&&(n.background="#"+c),{type:"contentBlock",attrs:n}},i6={handlerName:"drawingNodeHandler",handler:n6};function si(t,e=[],n=null){const r=[],o=new Set;return t?.elements?.forEach(i=>{const s=Nr.markTypes.filter(a=>a.name===i.name);s.length||["w:shd","w:rStyle","w:pStyle","w:numPr","w:outlineLvl","w:bdr","w:pBdr","w:noProof","w:contextualSpacing","w:keepNext","w:tabs","w:keepLines"].includes(i.name)&&e.push(i.name),s.forEach(a=>{if(!a||o.has(a.type))return;o.add(a.type);const{attributes:l={}}=i,c={type:a.type};if(!(l["w:val"]=="0"||l["w:val"]==="none")){if(a.mark&&(c.type=a.mark),Object.keys(l).length){const u=a6(a.type,l,n);if(u==null)return;c.attrs={},c.attrs[a.property]=u}r.push(c)}})}),Rd(r)}function s6(t,e){const n=t.elements?.find(s=>s.name==="w:rPrChange");if(!n)return[];const{attributes:r}=n,o={id:r["w:id"],date:r["w:date"],author:r["w:author"],authorEmail:r["w:authorEmail"]},i=si(n);return[{type:vt,attrs:{...o,before:i,after:[...e]}}]}function Rd(t){const e=t.filter(o=>o.type==="textStyle"),n=t.filter(o=>o.type!=="textStyle"),r={};return e.length&&e.forEach(o=>{const{attrs:i={}}=o;Object.keys(i).forEach(s=>{r[s]=i[s]})}),[...n,{type:"textStyle",attrs:r}]}function a6(t,e,n){t==="tabs"&&(t="textIndent");const r={color:()=>`#${e["w:val"]}`,fontSize:()=>`${e["w:val"]/2}pt`,textIndent:()=>c6(e),fontFamily:()=>l6(e,n),lineHeight:()=>u6(e),textAlign:()=>e["w:val"],link:()=>e.href,underline:()=>e["w:val"],bold:()=>e?.["w:val"]||null,italic:()=>e?.["w:val"]||null,highlight:()=>d6(e)};if(t in r||console.debug("❗️❗️ No value mapper for:",t,"Attributes:",e),t in r)return r[t],r[t]()}function l6(t,e){const n=t["w:ascii"],r=t["w:asciiTheme"];if(!e||!r)return n;const o=e["word/theme/theme1.xml"];if(!o)return n;const{elements:i}=o,{elements:s}=i[0];return s.find(a=>a.name==="a:themeElements").elements.find(a=>a.name==="a:fontScheme").elements.find(a=>a.name==="a:majorFont").elements.find(a=>a.name==="a:latin").attributes.typeface}function c6(t){let e=t["w:left"];return e?`${Wt(e)}in`:null}function u6(t){const e=t["w:line"],n=t["w:lineRule"];return!e||e==="0"?null:n==="exact"?`${Bv(e)}pt`:`${Jo(e)}`}function d6(t){const e=t["w:fill"];return e&&e!=="auto"?`#${e}`:RE(t?.["w:val"])?`#${t["w:val"]}`:FE(t?.["w:val"])||null}function go(t,e){const n=[],r=[],{attributes:o={},elements:i=[]}=t,{nodes:s,paragraphProperties:a={},runProperties:l={}}=p6(i);return i.find(c=>c.name==="w:r")&&(a.elements=a?.elements?.filter(c=>c.name!=="w:rPr")),l&&l?.elements?.length&&n.push(...si(l,r)),a&&a.elements?.length&&n.push(...si(a,r)),n.push(...s6(l,n)),a&&a.elements?.length&&(o.paragraphProperties=a),n&&t.name==="w:p"&&n.forEach(c=>{const u=Object.keys(c.attrs??{})[0];if(u){const d=c.attrs[u];o[u]=d}}),{elements:s,attributes:o,marks:n,unknownMarks:r}}function p6(t){const e=t.find(o=>o.name==="w:pPr"),n=t.find(o=>o.name==="w:rPr"),r=t.find(o=>o.name==="w:sectPr");return{nodes:t.filter(o=>o.name!=="w:pPr"&&o.name!=="w:rPr"&&o.name!=="w:sectPr"),paragraphProperties:e,runProperties:n,sectionProperties:r}}function Va(t){return Nr.allowedElements[t.name||t.type]}const f6=t=>!!Nr.propertyTypes[t.name||t.type];function Zv(t){return t.filter(e=>e.name==="w:r").some(e=>e.elements.some(n=>n.name==="w:t"))}const h6=t=>{const{nodes:e,nodeListHandler:n}=t;if(e.length===0||!(e[0].name==="w:del"||e[0].name==="w:ins"||e[0].name==="w:sdt"))return{nodes:[],consumed:0};const r=e[0];let o;if(["w:ins","w:del"].includes(r.name))o=r;else{const d=r.elements.find(p=>p.name==="w:sdtContent")?.elements.find(p=>["w:ins","w:del"].includes(p.name));d&&(o=d)}if(!o)return{nodes:[],consumed:0};const{name:i}=o,{attributes:s,elements:a}=go(o),l=n.handler({...t,insideTrackChange:!0,nodes:a}),c=i==="w:del"?ut:It,u={id:s["w:id"],date:s["w:date"],author:s["w:author"],authorEmail:s["w:authorEmail"]};return l.forEach(d=>{d.marks===void 0&&(d.marks=[]),d.marks.push({type:c,attrs:u})}),{nodes:l,consumed:1}},m6={handlerName:"trackChangeNodeHandler",handler:h6},g6=t=>{const{nodes:e,docx:n,nodeListHandler:r}=t;if(e.length===0||e[0].name!=="w:hyperlink")return{nodes:[],consumed:0};const o=e[0],i=n["word/_rels/document.xml.rels"].elements.find(m=>m.name==="Relationships"),{elements:s}=i,{attributes:a}=o,l=a["r:id"],c=a["w:anchor"];a["w:history"];const u=s.find(m=>m.attributes.Id===l)||{},{attributes:d={}}=u;let p=d.Target;c&&!p&&(p=`#${c}`);const f=o.elements.filter(m=>m.name==="w:r"),h={type:"link",attrs:{href:p,rId:l}};for(const m of f){m.marks||(m.marks=[]),m.marks.push(h);const y=m.elements.find(g=>g.name==="w:rPr");if(y&&y.elements.find(g=>g.name==="w:rStyle")){const g=n["word/styles.xml"],{elements:v}=g.elements[0],k=v.filter(b=>b.name==="w:style").find(b=>b.attributes["w:styleId"]==="Hyperlink")?.elements?.find(b=>b.name==="w:rPr");k&&m.elements.unshift(k)}}return{nodes:r.handler({...t,nodes:f}),consumed:1}},y6={handlerName:"hyperlinkNodeHandler",handler:g6},w6=t=>{const{nodes:e,nodeListHandler:n,parentStyleId:r,docx:o}=t;if(e.length===0||e[0].name!=="w:r")return{nodes:[],consumed:0};const i=e[0],s={...t,nodes:i.elements};let a=n.handler(s)?.filter(u=>u)||[];const l=i.elements?.some(u=>u.name==="w:rPr"),c=b6(o,r);if(l){const{marks:u=[],attributes:d={}}=go(i),p=u.find(m=>m.type==="textStyle"),f=p&&Object.keys(p.attrs).length>0;c.marks&&!f&&u.push(...c.marks),i.marks&&u.push(...i.marks);const h=Rd(u);a=a.map(m=>{const y=m.marks||[];return{...m,marks:[...h,...y],attributes:d}})}else c.marks&&(a=a.map(u=>({...u,marks:Rd(c.marks)})));return{nodes:a,consumed:1}},b6=(t,e)=>{const n=t?.["word/styles.xml"];if(!n)return{};const r=n.elements[0].elements.filter(o=>o.name==="w:style").find(o=>o.attributes["w:styleId"]===e)||{};return r?go(r):{}},v6={handlerName:"runNodeHandler",handler:w6},x6=t=>{const{nodes:e,insideTrackChange:n}=t;if(e.length===0||!(e[0].name==="w:t"||n&&e[0].name==="w:delText"))return{nodes:[],consumed:0};const r=e[0],{type:o}=r,{attributes:i,elements:s,marks:a=[]}=go(r);let l;if(s.length===1)l=s[0].text;else if(!s.length&&"attributes"in r&&r.attributes["xml:space"]==="preserve")l=" ";else return{nodes:[],consumed:0};return{nodes:[{type:Va(r),text:l,attrs:{type:o,attributes:i||{}},marks:a}],consumed:1}},k6={handlerName:"textNodeHandler",handler:x6},Qv=t=>{if(!t||!Array.isArray(t))return t;let e=[],n=null;for(let r of t)r.type==="text"?n&&S6(n,r)?n={...n,text:n.text+=r.text}:(n&&e.push(n),n={...r}):(n&&(e.push(n),n=null),e.push(r));return n&&e.push(n),e},S6=(t,e)=>{if(!t||!e)return!1;let n=t.marks??[],r=e.marks??[];if(n.length!==r.length)return!1;for(let o=0;o<n.length;o++)if(n[o].attrs||(n[o].attrs={}),r[o].attrs||(r[o].attrs={}),n[o].type!==r[o].type||Object.keys(n[o].attrs).length!==Object.keys(r[o].attrs).length||!A6(n[o].attrs,r[o].attrs))return!1;return!0},A6=(t={},e={})=>oi(t,e),C6=t=>{const{nodes:e,lists:n,docx:r}=t;if(e.length===0||e[0].name!=="w:p")return{nodes:[],consumed:0};const o=Qt(e[0]),i=i1(o.elements);o.elements=i;const s=o.elements.find(a=>a.name==="w:pPr");if(Bd(o,r)){const a=Qt(e),l=[];let c=a.shift();for(;c&&Bd(c,r);)l.push(c),c=a.shift(),c?.elements&&!Zv(c.elements)&&(l.push(c),c=a.shift());return{nodes:[e1({listItems:l,params:t,originalPpr:s})],consumed:l.filter(u=>u.seen).length,lists:n}}else return{nodes:[],consumed:0,lists:n}},E6={handlerName:"listHandler",handler:C6};function e1({listItems:t,originalPpr:e,params:n,listLevel:r=0,actualListLevel:o=0,currentListNumId:i=null,path:s="",isNested:a=!1}){const{docx:l,nodeListHandler:c,lists:u}=n,d=[];let p,f;const h=c.handlerEntities.find(k=>k.handlerName==="standardNodeHandler")?.handler;if(!h)return console.error("Standard node handler not found"),{nodes:[],consumed:0};const m=t[0].elements.find(k=>k.name==="w:pPr")?.elements?.find(k=>k.name==="w:pStyle")?.attributes["w:val"],y=tc({node:t[0],styleId:m,docx:l});i=ai(y),o=parseInt(y?.elements?.find(k=>k.name==="w:ilvl")?.attributes["w:val"])||0,o===void 0&&(o=t1(m,l));let g=0;for(let[k,b]of t.entries()){if(b.seen)continue;if(b.elements&&!Zv(b.elements)){const $=h({...n,nodes:[b]}).nodes[0];$&&d[d.length-1]?.content.push($),b.seen=!0;continue}const{attributes:C,elements:D,marks:M=[]}=go(b),I=cf(m,l)||{},{marks:E}=go(I),G=M.find($=>$.type==="textStyle"),oe=E?.find($=>$.type==="textStyle"),{listType:N,listOrderingType:H,ilvl:A,listrPrs:J,listpPrs:ie,start:W,lvlText:ce,lvlJc:X,numId:ue}=M6(b,r,l);f=H;const Z=parseInt(A),R=o===Z&&ue===i,ee=O6({firstListId:ue,secondListId:i,level:Z,pStyleId:null,docx:l}),ne=ue!==i&&!ee,se=r<Z||r===Z&&ne&&g===r;u[i]||(u[i]={}),u[i][r]||(u[i][r]=Number(W));const Y={};if(R&&!se){p=N,b.seen=!0;const $=[];let T={type:"paragraph",content:c.handler({...n,nodes:[C.paragraphProperties,...D]})?.filter(S=>S)};T.content&&(T={...T,attrs:{textAlign:G?.attrs.textAlign||oe?.attrs.textAlign||null,rsidRDefault:C?.["w:rsidRDefault"]||null,styleId:m},content:Qv(T.content)}),$.push(T),g=r;let K=[];if(f!=="bullet"&&(K=[...s,u[i][r]],u[i][o]++),!s.length&&o>0){const S=u[i];if(S){const re=[];Object.keys(S).forEach(Q=>{re.push(S[Q])}),K=re}}let q=b.elements.find(S=>S.name==="w:pPr")?.elements.find(S=>S.name==="w:ind");const F=I?.elements?.find(S=>S.name==="w:pPr")?.elements?.find(S=>S.name==="w:ind");if(q||(q=F),q){const S={};q.attributes||(q.attributes={}),q.attributes["w:left"]!==void 0&&(S.left=nt(q.attributes["w:left"])),q.attributes["w:right"]!==void 0&&(S.right=nt(q.attributes["w:right"])),q.attributes["w:firstLine"]!==void 0&&(S.firstLine=nt(q.attributes["w:firstLine"])),q.attributes["w:hanging"]!==void 0&&(S.hanging=nt(q.attributes["w:hanging"])),Y.indent=S}ie&&(Y.listParagraphProperties=ie),J&&(Y.listRunProperties=J),Y.textStyle=G,Y.order=W,Y.lvlText=ce,Y.lvlJc=G?.attrs.textAlign,Y.listLevel=K,Y.listNumberingType=H,Y.attributes={parentAttributes:b?.attributes||null};const L=e?.elements?.find(S=>S.name==="w:rPr");L&&(Y.attributes.originalInlineRunProps=L),Y.numId=ue,l&&(Y.spacing=r1(b,l,m));const le=Pg($,Y,[]);d.push(le)}else if(se){const $=[...s,u[i][r]],T=e1({listItems:t.slice(k),originalPpr:e,params:n,listLevel:r+1,actualListLevel:r,currentListNumId:ue,path:$,isNested:!0});g=T.lastNestedListLevel,delete T.lastNestedListLevel;const K=d[d.length-1];K?K.content.push(T):d.push(Pg([T],Y,[]))}else if(ue){g=r,r>0&&b.elements[0].elements.find($=>$.name==="w:numPr")&&(u[i][r]=0);break}else{b.seen=!0;const $=h({...n,nodes:[b]}).nodes[0];d[d.length-1]?.content.push($)}}const v={type:p||"bulletList",content:d,attrs:{"list-style-type":f,listId:i,attributes:{parentAttributes:t[0]?.attributes||null}}};return a&&(v.lastNestedListLevel=g),v}const t1=(t,e)=>{const n=cf(t,e)?.elements?.find(r=>r.name==="w:pPr")?.elements?.find(r=>r.name==="w:outlineLvl");try{return parseInt(n?.attributes["w:val"])}catch{}};function Bd(t,e){const{elements:n}=t,r=n?.find(l=>l.name==="w:pPr");if(!r)return!1;const o=r.elements?.find(l=>l.name==="w:pStyle");let i=r.elements?.find(l=>l.name==="w:numPr"),s=ai(i);const a=o?.attributes["w:val"];return a&&!s&&(i=tc({node:t,styleId:a,docx:e}),s=ai(i)),!!s}const ai=t=>t?.elements?.find(e=>e.name==="w:numId")?.attributes["w:val"];function cf(t,e){const n=e["word/styles.xml"];return n?n.elements.find(r=>r.name==="w:styles").elements.filter(r=>r.name==="w:style").find(r=>r.attributes["w:styleId"]===t):{}}function tc({node:t,styleId:e,docx:n,seenStyleIds:r=new Set}){let o=t?.elements?.find(l=>l.name==="w:pPr")?.elements?.find(l=>l.name==="w:numPr"),i=ai(o);if(i)return o;const s=cf(e,n);o=s?.elements?.find(l=>l.name==="w:pPr")?.elements?.find(l=>l.name==="w:numPr"),i=ai(o);const a=s?.elements?.find(l=>l.name==="w:basedOn");if(!i&&!r.has(e)){const l=a?.attributes["w:val"];return r.add(e),l?tc({styleId:l,docx:n,seenStyleIds:r}):null}return o}function Pg(t,e,n){return{type:"listItem",content:t,attrs:e,marks:n}}const T6=["decimal","decimalZero","lowerRoman","upperRoman","lowerLetter","upperLetter","ordinal","cardinalText","ordinalText","hex","chicago","none"],$6=["bullet","square","circle","disc"],O6=({firstListId:t,secondListId:e,level:n,pStyleId:r,docx:o})=>{const{numFmt:i,lvlText:s,lvlJc:a}=fl(t,n,r,o),{numFmt:l,lvlText:c,lvlJc:u}=fl(e,n,r,o);return i===l&&s===c&&a===u},zg=(t,e)=>{const n=e["word/styles.xml"];if(!n)return null;const{elements:r}=n,o=r[0].elements.filter(h=>h.name==="w:style"),i=o.find(h=>h.attributes["w:styleId"]===t)||{},s=i?.elements?.find(h=>h.name==="w:pPr");if(!s)return null;let a=s?.elements?.find(h=>h.name==="w:numPr");if(!a)return null;let l=a?.elements?.find(h=>h.name==="w:numId")||{},c=ai(a),u=a?.elements?.find(h=>h.name==="w:ilvl"),d=u?.attributes?.["w:val"];const p=i?.elements?.find(h=>h.name==="w:basedOn")?.attributes?.["w:val"];let f=0;for(;a&&!c&&f<10;)a=(o.find(h=>h.attributes["w:styleId"]===p)||{})?.elements?.find(h=>h.name==="w:pPr")?.elements?.find(h=>h.name==="w:numPr"),l=a?.elements?.find(h=>h.name==="w:numId")||{},c=l?.attributes?.["w:val"],u||(u=a?.elements?.find(h=>h.name==="w:ilvl"),d=u?.attributes?.["w:val"]),f++;return{numId:c,ilvl:d}},fl=(t,e,n,r)=>{const o=r["word/numbering.xml"];if(!o)return{};const{elements:i}=o,s=i[0];if(n){const{numId:k,ilvl:b}=zg(n,r)||{};!t&&k&&(t=k),!e&&b&&(e=b?parseInt(b):null)}const a=s.elements,l=a.filter(k=>k.name==="w:abstractNum"),c=a.filter(k=>k.name==="w:num").find(k=>k.attributes["w:numId"]===t)?.elements[0].attributes["w:val"],u=l?.find(k=>k.attributes["w:abstractNumId"]===c),d=D6(u,e),p=u?.elements?.find(k=>k.name==="w:numStyleLink")?.attributes["w:val"];if(p){const k=zg(p,r);return fl(k.numId,e,null,r)}const f=d?.elements?.find(k=>k.name==="w:start")?.attributes["w:val"],h=d?.elements?.find(k=>k.name==="w:numFmt")?.attributes["w:val"],m=d?.elements?.find(k=>k.name==="w:lvlText").attributes["w:val"],y=d?.elements?.find(k=>k.name==="w:lvlJc").attributes["w:val"],g=d?.elements?.find(k=>k.name==="w:pPr"),v=d?.elements?.find(k=>k.name==="w:rPr");return{start:f,numFmt:h,lvlText:m,lvlJc:y,pPr:g,rPr:v}};function M6(t,e,n){if(!t)return;const{attributes:r={}}=t,{paragraphProperties:o={}}=r,{elements:i=[]}=o,s=t.elements.find(b=>b.name==="w:pPr")?.elements?.find(b=>b.name==="w:pStyle")?.attributes["w:val"],a=tc({node:t,styleId:s,docx:n});if(!a)return{};const l=a?.elements.find(b=>b.name==="w:numId")?.attributes["w:val"],c=a?.elements.find(b=>b.name==="w:ilvl")?.attributes["w:val"]||t1(s,n),u=i.find(b=>b.name==="w:pStyle")?.attributes["w:val"],{start:d,numFmt:p,lvlText:f,lvlJc:h,pPr:m,rPr:y}=fl(l,e,u,n);let g,v;m&&(g=_6(m)),y&&(v=N6(y));let k;if($6.includes(p?.toLowerCase()))k="bulletList";else if(T6.includes(p))k="orderedList";else return{};return{listType:k,listOrderingType:p,ilvl:c,numId:l,listrPrs:v,listpPrs:g,start:d,lvlText:f,lvlJc:h}}function D6(t,e){return t?.elements?.find(n=>Number(n.attributes["w:ilvl"])===e)}function _6(t){const{elements:e}=t,n=["w:ind","w:jc","w:tabs"],r={};return e&&e.forEach(o=>{n.includes(o.name);const{attributes:i={}}=o;Object.keys(i).forEach(s=>{r[s]=i[s]})}),r}function N6(t){const{elements:e}=t,n=["w:rFonts","w:b","w:bCs","w:i","w:iCs","w:strike","w:dstrike","w:color","w:sz","w:szCs","w:u","w:bdr","w:shd","w:vertAlign","w:jc","w:spacing","w:w","w:smallCaps","w:position","w:lang"],r={};return e&&e.forEach(o=>{n.includes(o.name);const{attributes:i={}}=o;Object.keys(i).forEach(s=>{r[s]=i[s]})}),r}const n1=t=>{const{nodes:e,docx:n,nodeListHandler:r,filename:o}=t;if(e.length===0||e[0].name!=="w:p")return{nodes:[],consumed:0};const i=Qt(e[0]);let s,a=i1(i.elements);if(i.elements=a,Bd(i,n))return{nodes:[],consumed:0};const l=r.handlerEntities.find(b=>b.handlerName==="standardNodeHandler")?.handler;if(!l)return console.error("Standard node handler not found"),{nodes:[],consumed:0};const c={...t,nodes:[i]},u=l(c);u.nodes.length===1&&(s=u.nodes[0]);const d=i.elements?.find(b=>b.name==="w:pPr"),p=d?.elements?.find(b=>b.name==="w:pStyle"),f=d?.elements?.find(b=>b.name==="w:rPr"),h=d?.elements?.find(b=>b.name==="w:framePr");if(f){let b=si(f,[]);if(!s.content?.length){let C=b?.findIndex(D=>D.type==="highlight");C!==-1&&b.splice(C,1)}s.attrs.marksAttrs=b}let m;if(p&&(m=p.attributes["w:val"],s.attrs.styleId=m),n){const b=I6(i,n,m);s.attrs.indent||(s.attrs.indent={}),(b.left||b.left===0)&&(s.attrs.indent.left=b.left),(b.right||b.right===0)&&(s.attrs.indent.right=b.right),(b.firstLine||b.firstLine===0)&&(s.attrs.indent.firstLine=b.firstLine),(b.hanging||b.hanging===0)&&(s.attrs.indent.hanging=b.hanging),(b.textIndent||b.textIndent===0)&&(s.attrs.textIndent=`${b.textIndent}in`)}const y=d?.elements?.find(b=>b.name==="w:jc");y&&y.attributes&&(s.attrs.textAlign=y.attributes["w:val"]);const g=d?.elements?.find(b=>b.name==="w:keepLines");g&&g.attributes&&(s.attrs.keepLines=g.attributes["w:val"]);const v=d?.elements?.find(b=>b.name==="w:keepNext");if(v&&v.attributes&&(s.attrs.keepNext=v.attributes["w:val"]),n){const b=i.attributes?.["w:rsidRDefault"];s.attrs.spacing=r1(i,n,m,s.attrs.marksAttrs),s.attrs.rsidRDefault=b}h&&h.attributes["w:dropCap"]&&(s.attrs.dropcap={type:h.attributes["w:dropCap"],lines:h.attributes["w:lines"],wrap:h.attributes["w:wrap"],hAnchor:h.attributes["w:hAnchor"],vAnchor:h.attributes["w:vAnchor"]}),s.attrs.filename=o,s&&s.content&&(s={...s,content:Qv(s.content)});const k=d?.elements?.find(b=>b.name==="w:sectPr");return k&&(s.attrs.paragraphProperties||(s.attrs.paragraphProperties={}),s.attrs.paragraphProperties.sectPr=k,s.attrs.pageBreakSource="sectPr"),{nodes:s?[s]:[],consumed:1}},I6=(t,e,n="")=>{const r={left:0,right:0,firstLine:0,hanging:0,textIndent:0},{indent:o={}}=o1(e,n),i=t.elements?.find(d=>d.name==="w:pPr")?.elements?.find(d=>d.name==="w:ind")?.attributes||{},s=i?.["w:left"]||o?.["w:left"],a=i?.["w:right"]||o?.["w:right"],l=i?.["w:firstLine"]||o?.["w:firstLine"],c=i?.["w:hanging"]||o?.["w:hanging"];s&&(r.left=nt(s)),a&&(r.right=nt(a)),l&&(r.firstLine=nt(l)),c&&(r.hanging=nt(c));const u=s-parseInt(c||0)||0;return u&&(r.textIndent=Wt(u)),r},r1=(t,e,n="",r=[])=>{const o={lineSpaceAfter:0,lineSpaceBefore:0,line:0,lineRule:null},{spacing:i={}}=o1(e,n);let s,a,l,c;const u=t.elements?.find(y=>y.name==="w:pPr")?.elements?.find(y=>y.name==="w:spacing")?.attributes||{},d=r.find(y=>y.type==="textStyle")?.attrs?.fontSize,p=u?.["w:line"]||l||i?.["w:line"];p&&(o.line=Jo(p));const f=u?.["w:lineRule"]||c||i?.["w:lineRule"];f&&(o.lineRule=f),f==="exact"&&p&&(o.line=`${Bv(p)}pt`);const h=u?.["w:before"]||a||i?.["w:before"];h&&(o.lineSpaceBefore=nt(h)),u?.["w:beforeAutospacing"]==="1"&&d&&(o.lineSpaceBefore+=Math.round(parseInt(d)*.5*96/72));const m=u?.["w:after"]||s||i?.["w:after"];return m&&(o.lineSpaceAfter=nt(m)),u?.["w:afterAutospacing"]==="1"&&d&&(o.lineSpaceAfter+=Math.round(parseInt(d)*.5*96/72)),o},o1=(t,e="")=>{const n=t["word/styles.xml"];if(!n)return{};const r=(n.elements[0].elements?.find(k=>k.name==="w:docDefaults")).elements.find(k=>k.name==="w:pPrDefault")?.elements?.find(k=>k.name==="w:pPr"),o=r?.elements?.find(k=>k.name==="w:spacing")||{},i=r?.elements?.find(k=>k.name==="w:ind")||{},s=n.elements[0].elements?.find(k=>k.name==="w:style"&&k.attributes["w:styleId"]==="Normal")?.elements?.find(k=>k.name==="w:pPr"),a=s?.elements?.find(k=>k.name==="w:spacing")||{},l=s?.elements?.find(k=>k.name==="w:ind")||{};let c={},u={},d={};if(e){const k=n.elements[0].elements?.find(b=>b.name==="w:style"&&b.attributes["w:styleId"]===e)?.elements?.find(b=>b.name==="w:pPr");c=k?.elements?.find(b=>b.name==="w:spacing")||{},u=k?.elements?.find(b=>b.name==="w:ind")||{},d=k?.elements?.find(b=>b.name==="w:jc")||{}}const{attributes:p}=o,{attributes:f}=a,{attributes:h}=c,{attributes:m}=d,{attributes:y}=i,{attributes:g}=l,{attributes:v}=u;return{spacing:h||p||f,indent:v||y||g,justify:m}},F6={handlerName:"paragraphNodeHandler",handler:n1};function R6(t,e){const n={lineSpaceBefore:null,lineSpaceAfter:null};if(!t)return n;const r=e["word/styles.xml"];if(!r)return n;const{elements:o}=r.elements[0],i=o.filter(ie=>{const{attributes:W}=ie;return W&&W["w:styleId"]===t}),s=i[0];if(!s)return n;const a=i.find(ie=>ie.elements.find(W=>W.name==="w:qFormat")),l=i.find(ie=>ie.elements.some(W=>W.name==="w:name"))?.elements.find(ie=>ie.name==="w:name")?.attributes["w:val"],c=s.elements.find(ie=>ie.name==="w:pPr"),u=c?.elements?.find(ie=>ie.name==="w:spacing"),d=c?.elements?.find(ie=>ie.name==="w:jc"),p=c?.elements?.find(ie=>ie.name==="w:ind");let f,h,m;u&&(f=nt(u?.attributes["w:before"]),h=nt(u?.attributes["w:after"]),m=Jo(u?.attributes["w:line"]));let y,g,v,k;p&&(y=d?.attributes["w:val"],g=nt(p?.attributes["w:left"]),v=nt(p?.attributes["w:right"]),k=nt(p?.attributes["w:firstLine"]));const b=c?.elements?.find(ie=>ie.name==="w:keepNext"),C=c?.elements?.find(ie=>ie.name==="w:keepLines"),D=c?.elements?.find(ie=>ie.name==="w:outlineLvl"),M=D?.attributes["w:val"],I=c?.elements?.find(ie=>ie.name==="w:pageBreakBefore");let E=0;I&&(I.attributes?.["w:val"]?E=Number(I?.attributes?.["w:val"]):E=1);const G=c?.elements?.find(ie=>ie.name==="w:pageBreakAfter");let oe;G&&(G.attributes?.["w:val"]?oe=Number(G?.attributes?.["w:val"]):oe=1);const N={name:l,qFormat:!!a,keepNext:!!b,keepLines:!!C,outlineLevel:D?parseInt(M):null,pageBreakBefore:!!E,pageBreakAfter:!!oe},H=s.elements.find(ie=>ie.name==="w:rPr"),A=si(H,[],e)||{},J={spacing:{lineSpaceAfter:h,lineSpaceBefore:f,line:m},textAlign:y,indent:{leftIndent:g,rightIndent:v,firstLine:k}};return A.forEach(ie=>{const{type:W,attrs:ce}=ie;if(W==="textStyle"){Object.entries(ce).forEach(([X,ue])=>{J[dl(X)]=ue});return}J[W]=ce}),{attrs:N,styles:J}}function i1(t=[]){const e=[];let n=[],r=!1;for(const o of t){const i=o.elements?.find(s=>s.name==="w:fldChar")?.attributes?.["w:fldCharType"];if(i==="begin"){n=[o],r=!0;continue}if(i==="separate"&&r){n.push(o);continue}if(i==="end"&&r){n.push(o),e.push(...B6(n)),n=[],r=!1;continue}r?n.push(o):e.push(o)}return n.length&&e.push(...n),e}const B6=(t=[])=>{let e=[],n=!1,r=!1;const o=t.findIndex(c=>c.elements?.some(u=>u.name==="w:fldChar"&&u.attributes["w:fldCharType"]==="separate")),i=t.findIndex(c=>c.elements?.some(u=>u.name==="w:fldChar"&&u.attributes["w:fldCharType"]==="end")),s=t.slice(o+1,i),a=t.find(c=>c.elements?.some(u=>u.name==="w:instrText"))?.elements?.find(c=>c.name==="w:instrText")?.elements[0].text;n||(n=a?.trim().startsWith("PAGE")),r||(r=a?.trim().startsWith("NUMPAGES"));const l=a?.match(/HYPERLINK\s+"([^"]+)"/);if(n)e.push({name:"sd:autoPageNumber",type:"element"});else if(r)e.push({name:"sd:totalPageNumber",type:"element"});else if(l&&l?.length>=2){const c=l[1],u=[];s.forEach(p=>{const f=p.elements.find(m=>m.name==="w:rPr");if(!f)return;const{elements:h}=f;h.forEach(m=>{u.push(m)})});const d={name:"w:rPr",type:"element",elements:[{name:"link",attributes:{href:c}},...u]};e.push({name:"w:r",type:"element",elements:[d,...s]})}return e},L6=t=>nodeListHandler.handler({...t,nodes:node.elements}),P6=t=>{const{nodes:e}=t;if(e.length===0||e[0].name!=="w:sdt")return{nodes:[],consumed:0};const n=e[0],r=n.elements.find(s=>s.name==="w:sdtPr")?.elements.find(s=>s.name==="w:docPartObj")?.elements.find(s=>s.name==="w:docPartGallery")?.attributes["w:val"];if(!r)return{nodes:[],consumed:0};if(!jg[r])return{nodes:[],consumed:0};const o=n?.elements.find(s=>s.name==="w:sdtContent"),i=jg[r];return{nodes:i({...t,nodes:[o]}),consumed:1}},jg={"Table of Contents":L6},z6=t=>{const{nodes:e,docx:n,nodeListHandler:r,insideTrackChange:o}=t;if(e.length===0||e[0].name!=="w:sdt")return{nodes:[],consumed:0};const i=e[0],s=i.elements.find(M=>M.name==="w:sdtPr"),a=i.elements.find(M=>M.name==="w:sdtContent"),l=s?.elements.find(M=>M.name==="w:fieldTypeShort")?.attributes["w:val"],{attrs:c,marks:u}=s1(a);if(s?.elements.find(M=>M.name==="w:docPartObj"))return P6({nodes:e,docx:n,nodeListHandler:r,insideTrackChange:o});const d=s?.elements.find(M=>M.name==="w:alias"),p=s?.elements.find(M=>M.name==="w:tag"),f=s?.elements.find(M=>M.name==="w:fieldType")?.attributes["w:val"],h=s?.elements.find(M=>M.name==="w:fieldColor")?.attributes["w:val"],m=s?.elements.find(M=>M.name==="w:fieldMultipleImage")?.attributes["w:val"],y=s?.elements.find(M=>M.name==="w:fieldFontFamily")?.attributes["w:val"],g=s?.elements.find(M=>M.name==="w:fieldFontSize")?.attributes["w:val"],v=s?.elements.find(M=>M.name==="w:fieldTextColor")?.attributes["w:val"],k=s?.elements.find(M=>M.name==="w:fieldTextHighlight")?.attributes["w:val"],b={type:l,fieldId:p?.attributes["w:val"],displayLabel:d?.attributes["w:val"],fieldType:f,fieldColor:h,multipleImage:m==="true",fontFamily:y!=="null"?y:null,fontSize:g!=="null"?g:null,textColor:v!=="null"?v:null,textHighlight:k!=="null"?k:null},C={...b,...c};if(!b.fieldId||!b.displayLabel)return{nodes:[],consumed:0};let D={type:"text",text:`{{${b.displayLabel}}}`,attrs:C,marks:u};return t.editor.options.annotations&&(D={type:"fieldAnnotation",attrs:C}),{nodes:[D],consumed:1}},s1=(t={},e)=>{const n=t.elements?.find(s=>s.name==="w:r")?.elements?.find(s=>s.name==="w:rPr");if(!n)return{};const r=si(n,[])||[],o=[];r.forEach(s=>{const{type:a}=s;if(a==="textStyle"){const{attrs:l}=s;Object.keys(l).forEach(c=>{o.push({type:c,attrs:l[c]})})}else o.push(s)});const i={};return o?.forEach(s=>{const{type:a}=s;i[a]=s.attrs||!0}),{attrs:i,marks:r}},j6={handlerName:"annotationNodeHandler",handler:z6},q6=t=>{const{nodes:e,nodeListHandler:n}=t;if(e.length===0||e[0].name!=="w:sdt")return{nodes:[],consumed:0};const r=e[0],o=r.elements.find(a=>a.name==="w:sdtPr"),i=r.elements.find(a=>a.name==="w:sdtContent"),{marks:s}=s1(i);return{nodes:[{type:"structuredContent",content:n.handler({...t,nodes:i?.elements}),marks:s,attrs:{sdtPr:o}}],consumed:1}},V6={handlerName:"sdtNodeHandler",handler:q6},U6=t=>{const{nodes:e,docx:n,nodeListHandler:r}=t;if(!e||e.length===0)return{nodes:[],consumed:0};const o=e[0],{name:i}=o,{attributes:s,elements:a,marks:l=[]}=go(o);if(i==="w:sdt")return{nodes:[],consumed:0};if(f6(o))return{nodes:[{type:Va(o),attrs:{...s},marks:[]}],consumed:0};if(!Va(o))return{nodes:[{type:i,content:a,attrs:{...s},marks:l}],consumed:0,unhandled:!0};const c=[],u=H6(o);if(a&&a.length){const d=a.map(h=>(h.marks||(h.marks=[]),h.marks.push(...l),h)),p={...t,nodes:d,parentStyleId:u},f=r.handler(p);c.push(...f)}return{nodes:[{type:Va(o),content:c,attrs:{...s},marks:[]}],consumed:1}},H6=t=>{const e=t.elements?.find(n=>n.name==="w:pPr")?.elements?.find(n=>n.name==="w:pStyle");return e?e.attributes["w:val"]:null},W6={handlerName:"standardNodeHandler",handler:U6},G6=t=>{const{nodes:e}=t;return e.length===0||e[0].name!=="w:br"?{nodes:[],consumed:0}:{nodes:[{type:e[0].attributes?.["w:type"]==="page"?"hardBreak":"lineBreak"}],consumed:1}},K6={handlerName:"lineBreakNodeHandler",handler:G6},J6=t=>{const{nodes:e,nodeListHandler:n,editor:r}=t;if(e.length===0||e[0].name!=="w:bookmarkStart")return{nodes:[],consumed:0};const o=e[0],i=n.handlerEntities.find(d=>d.handlerName==="standardNodeHandler")?.handler;if(!i)return console.error("Standard node handler not found"),{nodes:[],consumed:0};const s=r?.extensionService?.extensions?.filter(d=>d.isExternal===!0)||[],a=o.attributes["w:name"]?.split(";")[0],l=s.find(d=>d.name===a);if(l){const d=e.findIndex(y=>y.name==="w:bookmarkEnd"&&y.attributes["w:id"]===o.attributes["w:id"]),p=e.slice(1,d),f=t.nodeListHandler,h={};o.attributes["w:name"].split(";").forEach(y=>{const[g,v]=y.split("=");g&&v&&(h[g]=v)});const m=f.handler({...t,nodes:p});return m.forEach(y=>{y.marks.push({type:l.name,attrs:h})}),{nodes:m,consumed:m.length+2}}const c={...t,nodes:[o]},u=i(c);return u.nodes.length===1&&(u.nodes[0].attrs.name=o.attributes["w:name"],u.nodes[0].attrs.id=o.attributes["w:id"]),u},X6={handlerName:"bookmarkNodeHandler",handler:J6},Y6=t=>{const e={nodes:[],consumed:0},{nodes:n,nodeListHandler:r,parentStyleId:o,docx:i}=t;if(n.length===0||n[0].name!=="w:p")return e;const s=n[0]?.elements?.find(d=>d.name==="w:r");if(!s?.elements?.some(d=>d.name==="mc:AlternateContent"))return e;const a=s.elements.find(d=>d.name==="mc:AlternateContent");s.elements.findIndex(d=>d.name==="mc:AlternateContent");const l=["wps","wp14","w14","w15"],c=a.elements.find(d=>d.name==="mc:Choice"&&l.includes(d.attributes.Requires));if(!c)return e;const u=c.elements;return{nodes:r.handler({...t,nodes:u}),consumed:1}},Z6={handlerName:"alternateChoiceHandler",handler:Y6},Q6=t=>{const{nodes:e}=t;return e.length===0||e[0].name!=="sd:autoPageNumber"?{nodes:[],consumed:0}:{nodes:[{type:"page-number"}],consumed:1}},eT={handlerName:"autoPageNumberHandler",handler:Q6},tT=t=>{const{nodes:e}=t;return e.length===0||e[0].name!=="sd:totalPageNumber"?{nodes:[],consumed:0}:{nodes:[{type:"total-page-number"}],consumed:1}},nT={handlerName:"autoTotalPageCountEntity",handler:tT},rT=t=>{const{nodes:e,docx:n,parentStyleId:r}=t;if(e.length===0||e[0].name!=="w:tab")return{nodes:[],consumed:0};const o=e[0],i=n["word/styles.xml"];if(i&&i.elements?.length){const a=i.elements[0]?.elements?.find(l=>l.attributes?.["w:styleId"]===r)?.elements?.find(l=>l.name==="w:pPr")?.elements?.find(l=>l.name==="w:tabs")?.elements?.find(l=>l.name==="w:tab");nt(a?.attributes?.["w:pos"])}const{attributes:s={}}=o;return{nodes:[{type:"tab",attrs:{tabSize:s["w:val"]||48},content:[]}],consumed:1}},oT={handlerName:"tabNodeHandler",handler:rT},iT=t=>{const{nodes:e}=t;if(!e.length||e[0].name!=="w:p")return{nodes:[],consumed:0};const[n]=e,r=n.elements?.find(l=>l.name==="w:r")?.elements?.find(l=>l.name==="w:pict");if(!r)return{nodes:[],consumed:0};const o=r,i=o.elements?.find(l=>l.name==="v:shape");o.elements?.find(l=>l.name==="v:shapetype");const s=o.elements?.find(l=>l.name==="v:group");if(!i&&!s)return{nodes:[],consumed:0};let a=null;return s&&!i?a=null:i.elements?.find(l=>l.name==="v:textbox")&&(a=sT({pict:r,pNode:n,shape:i,params:t})),{nodes:a?[a]:[],consumed:1}};function sT({pict:t,pNode:e,shape:n,params:r}){const o={},i={},s=n.attributes||{};o.attributes=s,s.fillcolor&&(o.fillcolor=s.fillcolor);const a=aT(s.style),l=lT(a);l&&(o.style=l);const c=n.elements?.find(p=>p.name==="v:textbox"),u=n.elements?.find(p=>p.name==="w10:wrap");u?.attributes&&(o.wrapAttributes=u.attributes),c?.attributes&&(i.attributes=c.attributes);const d=(c?.elements?.find(p=>p.name==="w:txbxContent")?.elements||[]).map(p=>n1({nodes:[p],docx:r.docx,nodeListHandler:ys()})).reduce((p,f)=>[...p,...f.nodes],[]);return{type:"shapeContainer",attrs:o,content:[{type:"shapeTextbox",attrs:i,content:d}]}}function aT(t){return t?t.split(";").filter(e=>!!e.trim()).reduce((e,n)=>{const[r,o]=n.split(":").map(i=>i.trim());return r&&o&&(e[r]=o),e},{}):{}}function lT(t){const e=["width","height"];let n="";for(const[r,o]of Object.entries(t))e.includes(r)&&(n+=`${r}: ${o};`);return n}const cT={handlerName:"handlePictNode",handler:iT};function uT({docx:t}){const e=ys(),n=t["word/comments.xml"];if(!n)return;const{elements:r}=n;if(!r||!r.length)return;const{elements:o=[]}=r[0],i=o.map(s=>{const{attributes:a}=s,l=a["w:id"],c=a["w:author"],u=a["w:email"],d=a["w:initials"],p=a["w:date"],f=a["custom:internalId"],h=a["custom:trackedChange"]==="true",m=a["custom:trackedChangeType"],y=a["custom:trackedChangeText"]!=="null"?a["custom:trackedChangeText"]:null,g=a["custom:trackedDeletedText"]!=="null"?a["custom:trackedDeletedText"]:null,v=new Date(p).getTime(),{elements:k}=s,b=k[0],{elements:C}=b,D=e.handler({nodes:s.elements,nodeListHandler:e,docx:t}),{attrs:M}=D[0],I=M["w14:paraId"];return{commentId:f||Lr(),importedId:l,creatorName:c,creatorEmail:u,createdTime:v,textJson:D[0],initials:d,paraId:I,trackedChange:h,trackedChangeText:y,trackedChangeType:m,trackedDeletedText:g}});return dT({docx:t,comments:i})}const dT=({docx:t,comments:e})=>{const n=t["word/commentsExtended.xml"];if(!n)return[];const{elements:r}=n,{elements:o}=r[0],i=o.filter(s=>s.name==="w15:commentEx");return e.map(s=>{const a=i.find(d=>d.attributes["w15:paraId"]===s.paraId);if(!a)return{...s};const{isDone:l,paraIdParent:c}=pT(a);let u;return c&&(u=e.find(d=>d.paraId===c)),{...s,isDone:l,parentCommentId:u?.commentId}})},pT=t=>{const{attributes:e}=t,n=e["w15:paraId"],r=e["w15:done"]==="1",o=e["w15:paraIdParent"];return{paraId:n,isDone:r,paraIdParent:o}},fT=(t,e,n)=>{const r=Qt(K4(t));if(!r)return null;if(e?.telemetry){const s=Object.keys(t).map(a=>{const l=a.split("/");return{filePath:a,fileDepth:l.length,fileType:a.split(".").pop()}});e.telemetry.trackFileStructure({totalFiles:s.length,maxDepth:Math.max(...s.map(a=>a.fileDepth)),totalNodes:0,files:s},e.fileSource,e.documentId,e.documentInternalId)}const o=ys(),i=r.elements[0].elements.find(s=>s.name==="w:body");if(i){const s=i,a=["w:sectPr"],l=s.elements?.filter(p=>!a.includes(p.name))??[],c=uT({docx:t}),u={},d={type:"doc",content:o.handler({nodes:l,nodeListHandler:o,docx:t,converter:e,editor:n,lists:u}),attrs:{attributes:r.elements[0].attributes}};return d.content.length>1&&e?.telemetry?.trackUsage("document_import",{documentType:"docx",timestamp:new Date().toISOString()}),{pmDoc:d,savedTagsToRestore:s,pageStyles:mT(s,t,e,n),comments:c,linkedStyles:gT(t),numbering:bT(t)}}return null},ys=()=>{const t=[Z6,v6,cT,F6,E6,k6,K6,j6,V6,X6,y6,i6,m6,X4,oT,eT,nT,W6];return{handler:hT(t),handlerEntities:t}},hT=t=>{const e=(r,o,i,s)=>!r||o<0||o>=r.length?{elementIndex:o,error:"index_out_of_bounds",arrayLength:r?.length}:{elementName:r[o]?.name,attributes:i?.attrs,marks:i?.marks,elementPath:s,type:i?.type,content:i?.content},n=({nodes:r,docx:o,insideTrackChange:i,converter:s,editor:a,filename:l,parentStyleId:c,lists:u})=>{if(!r||!r.length)return[];const d=[];try{for(let p=0;p<r.length;p++)try{const f=r.slice(p);if(!f||f.length===0)continue;const{nodes:h,consumed:m,unhandled:y}=t.reduce((v,k)=>v.consumed>0?v:k.handler({nodes:f,docx:o,nodeListHandler:{handler:n,handlerEntities:t},insideTrackChange:i,converter:s,editor:a,filename:l,parentStyleId:c,lists:u}),{nodes:[],consumed:0}),g=e(r,p,h[0],`/word/${l||"document.xml"}`);if(y){if(!g.elementName)continue;s?.telemetry?.trackStatistic("unknown",g);continue}else{s?.telemetry?.trackStatistic("node",g),(g.type==="orderedList"||g.type==="bulletList")&&g.content.forEach(k=>{const b=e([k],0,k,`/word/${l||"document.xml"}`);s?.telemetry?.trackStatistic("attributes",b)});const v=h[0]?.marks?.find(k=>k.type==="highlight");v&&s?.docHiglightColors.add(v.attrs.color.toUpperCase())}m>0&&(p+=m-1),h&&h.forEach(v=>{if(v?.type&&!["runProperties"].includes(v.type)){if(v.type==="text"&&Array.isArray(v.content)&&!v.content.length)return;d.push(v)}})}catch(f){console.debug("Import error",f),a?.emit("exception",{error:f}),s?.telemetry?.trackStatistic("error",{type:"processing_error",message:f.message,name:f.name,stack:f.stack,fileName:`/word/${l||"document.xml"}`})}return d}catch(p){throw console.debug("Error during import",p),a?.emit("exception",{error:p}),s?.telemetry?.trackStatistic("error",{type:"fatal_error",message:p.message,name:p.name,stack:p.stack,fileName:`/word/${l||"document.xml"}`}),p}};return n};function mT(t,e,n,r){const o=t.elements?.find(s=>s.name==="w:sectPr"),i={};return o?.elements?.forEach(s=>{const{name:a,attributes:l}=s;switch(a){case"w:pgSz":i.pageSize={width:Wt(l["w:w"]),height:Wt(l["w:h"])};break;case"w:pgMar":i.pageMargins={top:Wt(l["w:top"]),right:Wt(l["w:right"]),bottom:Wt(l["w:bottom"]),left:Wt(l["w:left"]),header:Wt(l["w:header"]),footer:Wt(l["w:footer"]),gutter:Wt(l["w:gutter"])};break;case"w:cols":i.columns={space:Wt(l["w:space"]),num:l["w:num"],equalWidth:l["w:equalWidth"]};break;case"w:docGrid":i.docGrid={linePitch:Wt(l["w:linePitch"]),type:l["w:type"]};break;case"w:titlePg":n.headerIds.titlePg=!0}}),wT(e,n,r),i.alternateHeaders=vT(e),i}function gT(t){const e=t["word/styles.xml"];if(!e)return[];const{elements:n}=e.elements[0],r=n.filter(i=>i.name==="w:style");n.find(i=>i.name==="w:latentStyles")?.elements.forEach(i=>{const{attributes:s}=i;r.find(a=>a.attributes["w:styleId"]===s["w:name"])});const o=[];return r.forEach(i=>{const s=i.attributes["w:styleId"],a=R6(s,t),l={id:i.attributes["w:styleId"],type:i.attributes["w:type"],definition:a,attributes:{}};o.push(l)}),o}function yT(t){if(!t)return null;const e=Qt(t),{elements:n}=e.elements[0];return Object.keys(Mg).forEach(r=>{if(!n.some(o=>o.attributes?.["w:styleId"]===r)){const o=Mg[r];e.elements[0].elements.push(o)}}),e}const wT=(t,e,n)=>{const r=t["word/_rels/document.xml.rels"].elements.find(u=>u.name==="Relationships"),{elements:o}=r,i="http://schemas.openxmlformats.org/officeDocument/2006/relationships/header",s="http://schemas.openxmlformats.org/officeDocument/2006/relationships/footer",a=o.filter(u=>u.attributes.Type===i),l=o.filter(u=>u.attributes.Type===s),c=(a1(t["word/document.xml"])||[]).flatMap(u=>u.elements);a.forEach(u=>{const{rId:d,referenceFile:p,currentFileName:f}=qg(u,t);let h=c.find(g=>g.name==="w:headerReference"&&g.attributes["r:id"]===d)?.attributes["w:type"];e.headerIds[h]&&(h=null);const m=ys(),y=m.handler({nodes:p.elements[0].elements,nodeListHandler:m,docx:t,converter:e,editor:n,filename:f});e.headerIds.ids||(e.headerIds.ids=[]),e.headerIds.ids.push(d),e.headers[d]={type:"doc",content:[...y]},h&&(e.headerIds[h]=d)}),l.forEach(u=>{const{rId:d,referenceFile:p,currentFileName:f}=qg(u,t),h=c.find(g=>g.name==="w:footerReference"&&g.attributes["r:id"]===d)?.attributes["w:type"],m=ys(),y=m.handler({nodes:p.elements[0].elements,nodeListHandler:m,docx:t,converter:e,editor:n,filename:f});e.footerIds.ids||(e.footerIds.ids=[]),e.footerIds.ids.push(d),e.footers[d]={type:"doc",content:[...y]},e.footerIds[h]=d})},a1=(t,e=[])=>{for(const n in t)t[n]==="w:sectPr"?e.push(t):typeof t[n]=="object"&&a1(t[n],e);return e},qg=(t,e)=>{const n=t.attributes.Id,r=t.attributes.Target,o=e[`word/${r}`];return{rId:n,referenceFile:o,currentFileName:r}};function bT(t){let e=t["word/numbering.xml"];(!e||!e.elements?.length||!e.elements[0].elements?.length)&&(e=Lv);const n=e.elements[0].elements,r=n.filter(a=>a.name==="w:abstractNum"),o=n.filter(a=>a.name==="w:num"),i={};r.forEach(a=>{const l=Number(a.attributes["w:abstractNumId"]);i[l]=a});const s={};return o.forEach(a=>{const l=Number(a.attributes["w:numId"]);s[l]=a}),{abstracts:i,definitions:s}}const vT=t=>{const e=t["word/settings.xml"];if(!e||!e.elements?.length)return!1;const{elements:n=[]}=e.elements[0];return!!n.find(r=>r.name==="w:evenAndOddHeaders")},xT="http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink";var Wr,l1,c1,u1,d1,p1;const Ui=class f1{constructor(e=null){ab(this,Wr),this.debug=e?.debug||!1,this.declaration=null,this.documentAttributes=null,this.convertedXml={},this.docx=e?.docx||[],this.media=e?.media||{},this.fonts=e?.fonts||{},this.addedMedia={},this.comments=[],this.docHiglightColors=new Set([]),this.xml=e?.xml,this.declaration=null,this.numbering={},this.numbering=null,this.pageStyles=null,this.initialJSON=null,this.headers={},this.headerIds={default:null,even:null,odd:null,first:null},this.headerEditors=[],this.footers={},this.footerIds={default:null,even:null,odd:null,first:null},this.footerEditors=[],this.linkedStyles=[],this.json=e?.json,this.tagsNotInSchema=["w:body"],this.savedTagsToRestore=[],this.telemetry=e?.telemetry||null,this.documentInternalId=null,this.fileSource=e?.fileSource||null,this.documentId=e?.documentId||null,(this.docx.length||this.xml)&&this.parseFromXml()}parseFromXml(){this.docx?.forEach(e=>{this.convertedXml[e.name]=this.parseXmlToJson(e.content),e.name==="word/document.xml"&&(this.documentAttributes=this.convertedXml[e.name].elements[0]?.attributes),e.name==="word/styles.xml"&&(this.convertedXml[e.name]=yT(this.convertedXml[e.name]))}),this.initialJSON=this.convertedXml["word/document.xml"],this.initialJSON||(this.initialJSON=this.parseXmlToJson(this.xml)),this.declaration=this.initialJSON?.declaration}parseXmlToJson(e){return JSON.parse(nf.xml2json(e,null,2))}static getStoredSuperdocVersion(e){try{const n=e.find(a=>a.name==="docProps/custom.xml");if(!n)return;const r=new f1,o=n.content,i=r.parseXmlToJson(o).elements.find(a=>a.name==="Properties");if(!i.elements)return;const s=i.elements.find(a=>a.name==="property"&&a.attributes.name==="SuperdocVersion");return s?s.elements[0].elements[0].text:void 0}catch(n){console.warn("Error getting Superdoc version",n);return}}static updateDocumentVersion(e=this.convertedXml,n="0.12.11"){const r="docProps/custom.xml";e[r]||(e[r]=h1());const o=e["docProps/custom.xml"];if(!o)return;const i=o.elements.find(a=>a.name==="Properties");i.elements||(i.elements=[]);const s=i.elements.find(a=>a.name==="property"&&a.attributes.name==="SuperdocVersion");if(s)s.elements[0].elements[0].elements[0].text=n;else{const a=m1();i.elements.push(a)}return e}getDocumentDefaultStyles(){const e=this.convertedXml["word/styles.xml"];if(!e)return{};const n=e.elements[0].elements.find(i=>i.name==="w:docDefaults").elements.find(i=>i.name==="w:rPrDefault");if(!n.elements)return{};const r=n.elements[0].elements,o=r?.find(i=>i.name==="w:rFonts");if("elements"in n){const i=r.find(d=>d.name==="w:rFonts")?.attributes["w:asciiTheme"];let s,a,l;if(i){const d=this.getThemeInfo(i);s=d.typeface,a=d.panose}else o&&(s=o?.attributes["w:ascii"]);(e.elements[0].elements.filter(d=>d.name==="w:style"&&d.attributes["w:styleId"]==="Normal")||[]).forEach(d=>{const p=d.elements.find(f=>f.name==="w:rPr");s=p?.elements?.find(f=>f.name==="w:rFonts")?.attributes["w:ascii"],l=Number(p?.elements?.find(f=>f.name==="w:sz")?.attributes["w:val"])/2});const c=l||Number(r.find(d=>d.name==="w:sz")?.attributes["w:val"])/2||12,u=r.find(d=>d.name==="w:kern")?.attributes["w:val"];return{fontSizePt:c,kern:u,typeface:s,panose:a}}}getDocumentFonts(){const e=this.convertedXml["word/fontTable.xml"];if(!e||!Object.keys(this.fonts).length)return;const n=e.elements.find(s=>s.name==="w:fonts")?.elements.filter(s=>s.elements?.some(a=>a?.attributes&&a.attributes["r:id"]&&a.attributes["w:fontKey"]))?.reduce((s,a)=>{const l=a.elements.filter(c=>c.name.startsWith("w:embed"))?.map(c=>({...c,fontFamily:a.attributes["w:name"]}));return[...s,...l]},[]),r=this.convertedXml["word/_rels/fontTable.xml.rels"]?.elements.find(s=>s.name==="Relationships")||{},{elements:o}=r;let i="";for(const s of n){const a=o.find(y=>y.attributes.Id===s.attributes["r:id"])?.attributes?.Target;if(!a)return;const l=this.fonts[`word/${a}`]?.buffer;if(!l)return;const c=PE(l,s.attributes["w:fontKey"]);if(!c)return;const u=new Blob([c],{type:"font/ttf"}),d=URL.createObjectURL(u),p=s.name.includes("Regular"),f=s.name.includes("Bold"),h=s.name.includes("Italic"),m=s.name.includes("Light");i+=`
|
|
31
31
|
@font-face {
|
|
32
32
|
font-style: ${h?"italic":"normal"};
|
|
33
33
|
font-weight: ${p?"normal":f?"bold":m?"200":"normal"};
|
|
@@ -35,14 +35,14 @@ Actual: `+$.attribValue);else{var F=$.tag,L=$.tags[$.tags.length-1]||$;F.ns===L.
|
|
|
35
35
|
font-family: ${s.fontFamily};
|
|
36
36
|
src: url(${d}) format('truetype');
|
|
37
37
|
}
|
|
38
|
-
`}return i}getDocumentInternalId(){const e="word/settings.xml";this.convertedXml[e]||(this.convertedXml[e]=qE);const n=Object.assign({},this.convertedXml[e]);if(!n.elements[0]?.elements?.length){const o=this.createDocumentIdElement(n);n.elements[0].elements=[o],n.elements[0].attributes["xmlns:w15"]||(n.elements[0].attributes["xmlns:w15"]="http://schemas.microsoft.com/office/word/2012/wordml"),this.convertedXml[e]=n;return}const r=n.elements[0].elements.find(o=>o.name==="w15:docId");this.documentInternalId=r?.attributes["w15:val"]}createDocumentIdElement(){const e=Lr().toUpperCase();return this.documentInternalId=e,{type:"element",name:"w15:docId",attributes:{"w15:val":`{${e}}`}}}getThemeInfo(e){e=e.toLowerCase();const n=this.convertedXml["word/theme/theme1.xml"].elements.find(s=>s.name==="a:theme").elements.find(s=>s.name==="a:themeElements").elements.find(s=>s.name==="a:fontScheme");let r;e.startsWith("major")?r=n.elements.find(s=>s.name==="a:majorFont").elements[0]:e.startsWith("minor")&&(r=n.elements.find(s=>s.name==="a:minorFont").elements[0]);const{typeface:o,panose:i}=r.attributes;return{typeface:o,panose:i}}getSchema(e){this.getDocumentInternalId();const n=fT({...this.convertedXml,media:this.media},this,e);return n?(this.savedTagsToRestore.push({...n.savedTagsToRestore}),this.pageStyles=n.pageStyles,this.numbering=n.numbering,this.comments=n.comments,this.linkedStyles=n.linkedStyles,n.pmDoc):null}schemaToXml(e,n=!1){return new Rg(this).schemaToXml(e,n)}async exportToDocx(e,n,r,o=!1,i,s=[],a){const l=s.map(m=>QE(m)),c=l.map((m,y)=>e4(m,y,l,a)),{result:u,params:d}=this.exportToXmlJson({data:e,editorSchema:n,comments:s,commentDefinitions:c,commentsExportType:i,isFinalDoc:o,editor:a}),p=new Rg(this).schemaToXml(u);await Dn(this,Wr,p1).call(this,{...r,...d.media,...this.media},a);let f={...this.convertedXml},h=[];if(s.length){const{documentXml:m,relationships:y}=Dn(this,Wr,c1).call(this,{defs:d.exportedCommentDefs,exportType:i,commentsWithParaIds:l});f={...m},h=y}return this.convertedXml={...this.convertedXml,...f},Dn(this,Wr,d1).call(this,[...d.relationships,...h]),Dn(this,Wr,u1).call(this,{isFinalDoc:o}),kT(this.convertedXml),Dn(this,Wr,l1).call(this,d),p}exportToXmlJson({data:e,editorSchema:n,comments:r,commentDefinitions:o,commentsExportType:i="clean",isFinalDoc:s=!1,editor:a,isHeaderFooter:l=!1}){const c=this.savedTagsToRestore.find(p=>p.name==="w:body"),[u,d]=ki({node:e,bodyNode:c,relationships:[],documentMedia:{},media:{},isFinalDoc:s,editorSchema:n,converter:this,pageStyles:this.pageStyles,comments:r,commentsExportType:i,exportedCommentDefs:o,editor:a,isHeaderFooter:l});return{result:u,params:d}}};Wr=new WeakSet,l1=function(t){const e="word/numbering.xml";let n=this.convertedXml[e];const r=this.numbering;n||(n=Lv);const o=n.elements[0],i=Object.values(r.abstracts).map(a=>a),s=Object.values(r.definitions).map(a=>a);o.elements=[...i,...s],this.convertedXml[e]=n},c1=function({defs:t,exportType:e,commentsWithParaIds:n}){const{documentXml:r,relationships:o}=a4({exportType:e,convertedXml:this.convertedXml,defs:t,commentsWithParaIds:n,converter:this});return{documentXml:r,relationships:o}},u1=function({isFinalDoc:t=!1}){const e=this.convertedXml["word/_rels/document.xml.rels"].elements.find(n=>n.name==="Relationships");Object.entries(this.headers).forEach(([n,r])=>{const o=e.elements.find(u=>u.attributes.Id===n)?.attributes.Target,i=this.headerEditors.find(u=>u.id===n);if(!i)return;const{result:s,params:a}=this.exportToXmlJson({data:r,editor:i.editor,editorSchema:i.editor.schema,comments:[],commentDefinitions:[],isHeaderFooter:!0,isFinalDoc:t}),l=s.elements[0].elements,c=this.convertedXml[`word/${o}`];if(c.elements[0].elements=l,a.relationships.length){const u=this.convertedXml[`word/_rels/${o}.rels`]?.elements?.find(d=>d.name==="Relationships")?.elements||[];this.convertedXml[`word/_rels/${o}.rels`]={declaration:this.initialJSON?.declaration,elements:[{name:"Relationships",attributes:{xmlns:"http://schemas.openxmlformats.org/package/2006/relationships"},elements:[...u,...a.relationships]}]}}}),Object.entries(this.footers).forEach(([n,r])=>{const o=e.elements.find(u=>u.attributes.Id===n)?.attributes.Target,i=this.footerEditors.find(u=>u.id===n);if(!i)return;const{result:s,params:a}=this.exportToXmlJson({data:r,editor:i.editor,editorSchema:i.editor.schema,comments:[],commentDefinitions:[],isHeaderFooter:!0,isFinalDoc:t}),l=s.elements[0].elements,c=this.convertedXml[`word/${o}`];if(c.elements[0].elements=l,a.relationships.length){const u=this.convertedXml[`word/_rels/${o}.rels`]?.elements?.find(d=>d.name==="Relationships")?.elements||[];this.convertedXml[`word/_rels/${o}.rels`]={declaration:this.initialJSON?.declaration,elements:[{name:"Relationships",attributes:{xmlns:"http://schemas.openxmlformats.org/package/2006/relationships"},elements:[...u,...a.relationships]}]}}})},d1=function(t=[]){const e=this.convertedXml["word/_rels/document.xml.rels"],n=e.elements.find(s=>s.name==="Relationships"),r=[],o=/rId|mi/g;let i=Math.max(...n.elements.map(s=>Number(s.attributes.Id.replace(o,""))));t.forEach(s=>{const a=s.attributes.Id,l=n.elements.find(d=>d.attributes.Target===s.attributes.Target),c=s.attributes.Target?.startsWith("media/")&&a.length>6,u=s.attributes.Type===xT&&a.length>6;l&&!c&&!u||(s.attributes.Target=s.attributes?.Target?.replace(/&/g,"&"),s.attributes.Id=a.length>6?a:`rId${++i}`,r.push(s))}),n.elements=[...n.elements,...r],this.convertedXml["word/_rels/document.xml.rels"]=e},p1=async function(t,e){const n={};for(const r in t){if(typeof t[r]!="string")return;const o=r.split("/").pop();n[o]=await NE(t[r],e.options.isHeadless)}this.convertedXml.media={...this.convertedXml.media,...n},this.media=this.convertedXml.media,this.addedMedia=n},ta(Ui,"allowedElements",Object.freeze({"w:document":"doc","w:body":"body","w:p":"paragraph","w:r":"run","w:t":"text","w:delText":"text","w:br":"lineBreak","w:tbl":"table","w:tr":"tableRow","w:tc":"tableCell","w:drawing":"drawing","w:bookmarkStart":"bookmarkStart","w:sectPr":"sectionProperties","w:rPr":"runProperties","w:commentRangeStart":"commentRangeStart","w:commentRangeEnd":"commentRangeEnd","w:commentReference":"commentReference"})),ta(Ui,"markTypes",[{name:"w:b",type:"bold"},{name:"w:bCs",type:"bold"},{name:"w:i",type:"italic"},{name:"w:iCs",type:"italic"},{name:"w:u",type:"underline",mark:"underline",property:"underlineType"},{name:"w:strike",type:"strike"},{name:"w:color",type:"color",mark:"textStyle",property:"color"},{name:"w:sz",type:"fontSize",mark:"textStyle",property:"fontSize"},{name:"w:szCs",type:"fontSize",mark:"textStyle",property:"fontSize"},{name:"w:rFonts",type:"fontFamily",mark:"textStyle",property:"fontFamily"},{name:"w:jc",type:"textAlign",mark:"textStyle",property:"textAlign"},{name:"w:ind",type:"textIndent",mark:"textStyle",property:"textIndent"},{name:"w:spacing",type:"lineHeight",mark:"textStyle",property:"lineHeight"},{name:"link",type:"link",mark:"link",property:"href"},{name:"w:highlight",type:"highlight",mark:"highlight",property:"color"},{name:"w:shd",type:"highlight",mark:"highlight",property:"color"}]),ta(Ui,"propertyTypes",Object.freeze({"w:pPr":"paragraphProperties","w:rPr":"runProperties","w:sectPr":"sectionProperties","w:numPr":"numberingProperties","w:tcPr":"tableCellProperties"})),ta(Ui,"elements",new Set(["w:document","w:body","w:p","w:r","w:t","w:delText"]));let Nr=Ui;function kT(t){const e="docProps/custom.xml";t[e]||(t[e]=h1());const n=t[e].elements.find(s=>s.name==="Properties");n.elements||(n.elements=[]);const r=n.elements,o=r.filter(s=>typeof s=="object"&&s!==null).filter(s=>{const{attributes:a}=s;return a.name!=="SuperdocVersion"});let i=2;try{i=o.length?Math.max(...r.map(s=>s.attributes.pid))+1:2}catch{}return o.push(m1(i)),n.elements=o,t}function h1(){return jE}function m1(t=2,e="0.12.10"){return{type:"element",name:"property",attributes:{name:"SuperdocVersion",fmtid:"{D5CDD505-2E9C-101B-9397-08002B2CF9AE}",pid:t},elements:[{type:"element",name:"vt:lpwstr",elements:[{type:"text",text:e}]}]}}function la(t){throw new Error('Could not dynamically require "'+t+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var g1={exports:{}};(function(t,e){(function(n){t.exports=n()})(function(){return function n(r,o,i){function s(c,u){if(!o[c]){if(!r[c]){var d=typeof la=="function"&&la;if(!u&&d)return d(c,!0);if(a)return a(c,!0);var p=new Error("Cannot find module '"+c+"'");throw p.code="MODULE_NOT_FOUND",p}var f=o[c]={exports:{}};r[c][0].call(f.exports,function(h){var m=r[c][1][h];return s(m||h)},f,f.exports,n,r,o,i)}return o[c].exports}for(var a=typeof la=="function"&&la,l=0;l<i.length;l++)s(i[l]);return s}({1:[function(n,r,o){var i=n("./utils"),s=n("./support"),a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";o.encode=function(l){for(var c,u,d,p,f,h,m,y=[],g=0,v=l.length,k=v,b=i.getTypeOf(l)!=="string";g<l.length;)k=v-g,d=b?(c=l[g++],u=g<v?l[g++]:0,g<v?l[g++]:0):(c=l.charCodeAt(g++),u=g<v?l.charCodeAt(g++):0,g<v?l.charCodeAt(g++):0),p=c>>2,f=(3&c)<<4|u>>4,h=1<k?(15&u)<<2|d>>6:64,m=2<k?63&d:64,y.push(a.charAt(p)+a.charAt(f)+a.charAt(h)+a.charAt(m));return y.join("")},o.decode=function(l){var c,u,d,p,f,h,m=0,y=0,g="data:";if(l.substr(0,g.length)===g)throw new Error("Invalid base64 input, it looks like a data url.");var v,k=3*(l=l.replace(/[^A-Za-z0-9+/=]/g,"")).length/4;if(l.charAt(l.length-1)===a.charAt(64)&&k--,l.charAt(l.length-2)===a.charAt(64)&&k--,k%1!=0)throw new Error("Invalid base64 input, bad content length.");for(v=s.uint8array?new Uint8Array(0|k):new Array(0|k);m<l.length;)c=a.indexOf(l.charAt(m++))<<2|(p=a.indexOf(l.charAt(m++)))>>4,u=(15&p)<<4|(f=a.indexOf(l.charAt(m++)))>>2,d=(3&f)<<6|(h=a.indexOf(l.charAt(m++))),v[y++]=c,f!==64&&(v[y++]=u),h!==64&&(v[y++]=d);return v}},{"./support":30,"./utils":32}],2:[function(n,r,o){var i=n("./external"),s=n("./stream/DataWorker"),a=n("./stream/Crc32Probe"),l=n("./stream/DataLengthProbe");function c(u,d,p,f,h){this.compressedSize=u,this.uncompressedSize=d,this.crc32=p,this.compression=f,this.compressedContent=h}c.prototype={getContentWorker:function(){var u=new s(i.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new l("data_length")),d=this;return u.on("end",function(){if(this.streamInfo.data_length!==d.uncompressedSize)throw new Error("Bug : uncompressed data size mismatch")}),u},getCompressedWorker:function(){return new s(i.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}},c.createWorkerFrom=function(u,d,p){return u.pipe(new a).pipe(new l("uncompressedSize")).pipe(d.compressWorker(p)).pipe(new l("compressedSize")).withStreamInfo("compression",d)},r.exports=c},{"./external":6,"./stream/Crc32Probe":25,"./stream/DataLengthProbe":26,"./stream/DataWorker":27}],3:[function(n,r,o){var i=n("./stream/GenericWorker");o.STORE={magic:"\0\0",compressWorker:function(){return new i("STORE compression")},uncompressWorker:function(){return new i("STORE decompression")}},o.DEFLATE=n("./flate")},{"./flate":7,"./stream/GenericWorker":28}],4:[function(n,r,o){var i=n("./utils"),s=function(){for(var a,l=[],c=0;c<256;c++){a=c;for(var u=0;u<8;u++)a=1&a?3988292384^a>>>1:a>>>1;l[c]=a}return l}();r.exports=function(a,l){return a!==void 0&&a.length?i.getTypeOf(a)!=="string"?function(c,u,d,p){var f=s,h=p+d;c^=-1;for(var m=p;m<h;m++)c=c>>>8^f[255&(c^u[m])];return-1^c}(0|l,a,a.length,0):function(c,u,d,p){var f=s,h=p+d;c^=-1;for(var m=p;m<h;m++)c=c>>>8^f[255&(c^u.charCodeAt(m))];return-1^c}(0|l,a,a.length,0):0}},{"./utils":32}],5:[function(n,r,o){o.base64=!1,o.binary=!1,o.dir=!1,o.createFolders=!0,o.date=null,o.compression=null,o.compressionOptions=null,o.comment=null,o.unixPermissions=null,o.dosPermissions=null},{}],6:[function(n,r,o){var i=null;i=typeof Promise<"u"?Promise:n("lie"),r.exports={Promise:i}},{lie:37}],7:[function(n,r,o){var i=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Uint32Array<"u",s=n("pako"),a=n("./utils"),l=n("./stream/GenericWorker"),c=i?"uint8array":"array";function u(d,p){l.call(this,"FlateWorker/"+d),this._pako=null,this._pakoAction=d,this._pakoOptions=p,this.meta={}}o.magic="\b\0",a.inherits(u,l),u.prototype.processChunk=function(d){this.meta=d.meta,this._pako===null&&this._createPako(),this._pako.push(a.transformTo(c,d.data),!1)},u.prototype.flush=function(){l.prototype.flush.call(this),this._pako===null&&this._createPako(),this._pako.push([],!0)},u.prototype.cleanUp=function(){l.prototype.cleanUp.call(this),this._pako=null},u.prototype._createPako=function(){this._pako=new s[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var d=this;this._pako.onData=function(p){d.push({data:p,meta:d.meta})}},o.compressWorker=function(d){return new u("Deflate",d)},o.uncompressWorker=function(){return new u("Inflate",{})}},{"./stream/GenericWorker":28,"./utils":32,pako:38}],8:[function(n,r,o){function i(f,h){var m,y="";for(m=0;m<h;m++)y+=String.fromCharCode(255&f),f>>>=8;return y}function s(f,h,m,y,g,v){var k,b,C=f.file,D=f.compression,M=v!==c.utf8encode,I=a.transformTo("string",v(C.name)),E=a.transformTo("string",c.utf8encode(C.name)),G=C.comment,oe=a.transformTo("string",v(G)),N=a.transformTo("string",c.utf8encode(G)),H=E.length!==C.name.length,A=N.length!==G.length,J="",ie="",W="",ce=C.dir,X=C.date,ue={crc32:0,compressedSize:0,uncompressedSize:0};h&&!m||(ue.crc32=f.crc32,ue.compressedSize=f.compressedSize,ue.uncompressedSize=f.uncompressedSize);var Z=0;h&&(Z|=8),M||!H&&!A||(Z|=2048);var R=0,ee=0;ce&&(R|=16),g==="UNIX"?(ee=798,R|=function(se,Y){var $=se;return se||($=Y?16893:33204),(65535&$)<<16}(C.unixPermissions,ce)):(ee=20,R|=function(se){return 63&(se||0)}(C.dosPermissions)),k=X.getUTCHours(),k<<=6,k|=X.getUTCMinutes(),k<<=5,k|=X.getUTCSeconds()/2,b=X.getUTCFullYear()-1980,b<<=4,b|=X.getUTCMonth()+1,b<<=5,b|=X.getUTCDate(),H&&(ie=i(1,1)+i(u(I),4)+E,J+="up"+i(ie.length,2)+ie),A&&(W=i(1,1)+i(u(oe),4)+N,J+="uc"+i(W.length,2)+W);var ne="";return ne+=`
|
|
38
|
+
`}return i}getDocumentInternalId(){const e="word/settings.xml";this.convertedXml[e]||(this.convertedXml[e]=qE);const n=Object.assign({},this.convertedXml[e]);if(!n.elements[0]?.elements?.length){const o=this.createDocumentIdElement(n);n.elements[0].elements=[o],n.elements[0].attributes["xmlns:w15"]||(n.elements[0].attributes["xmlns:w15"]="http://schemas.microsoft.com/office/word/2012/wordml"),this.convertedXml[e]=n;return}const r=n.elements[0].elements.find(o=>o.name==="w15:docId");this.documentInternalId=r?.attributes["w15:val"]}createDocumentIdElement(){const e=Lr().toUpperCase();return this.documentInternalId=e,{type:"element",name:"w15:docId",attributes:{"w15:val":`{${e}}`}}}getThemeInfo(e){e=e.toLowerCase();const n=this.convertedXml["word/theme/theme1.xml"].elements.find(s=>s.name==="a:theme").elements.find(s=>s.name==="a:themeElements").elements.find(s=>s.name==="a:fontScheme");let r;e.startsWith("major")?r=n.elements.find(s=>s.name==="a:majorFont").elements[0]:e.startsWith("minor")&&(r=n.elements.find(s=>s.name==="a:minorFont").elements[0]);const{typeface:o,panose:i}=r.attributes;return{typeface:o,panose:i}}getSchema(e){this.getDocumentInternalId();const n=fT({...this.convertedXml,media:this.media},this,e);return n?(this.savedTagsToRestore.push({...n.savedTagsToRestore}),this.pageStyles=n.pageStyles,this.numbering=n.numbering,this.comments=n.comments,this.linkedStyles=n.linkedStyles,n.pmDoc):null}schemaToXml(e,n=!1){return new Rg(this).schemaToXml(e,n)}async exportToDocx(e,n,r,o=!1,i,s=[],a){const l=s.map(m=>QE(m)),c=l.map((m,y)=>e4(m,y,l,a)),{result:u,params:d}=this.exportToXmlJson({data:e,editorSchema:n,comments:s,commentDefinitions:c,commentsExportType:i,isFinalDoc:o,editor:a}),p=new Rg(this).schemaToXml(u);await Dn(this,Wr,p1).call(this,{...r,...d.media,...this.media},a);let f={...this.convertedXml},h=[];if(s.length){const{documentXml:m,relationships:y}=Dn(this,Wr,c1).call(this,{defs:d.exportedCommentDefs,exportType:i,commentsWithParaIds:l});f={...m},h=y}return this.convertedXml={...this.convertedXml,...f},Dn(this,Wr,d1).call(this,[...d.relationships,...h]),Dn(this,Wr,u1).call(this,{isFinalDoc:o}),kT(this.convertedXml),Dn(this,Wr,l1).call(this,d),p}exportToXmlJson({data:e,editorSchema:n,comments:r,commentDefinitions:o,commentsExportType:i="clean",isFinalDoc:s=!1,editor:a,isHeaderFooter:l=!1}){const c=this.savedTagsToRestore.find(p=>p.name==="w:body"),[u,d]=ki({node:e,bodyNode:c,relationships:[],documentMedia:{},media:{},isFinalDoc:s,editorSchema:n,converter:this,pageStyles:this.pageStyles,comments:r,commentsExportType:i,exportedCommentDefs:o,editor:a,isHeaderFooter:l});return{result:u,params:d}}};Wr=new WeakSet,l1=function(t){const e="word/numbering.xml";let n=this.convertedXml[e];const r=this.numbering;n||(n=Lv);const o=n.elements[0],i=Object.values(r.abstracts).map(a=>a),s=Object.values(r.definitions).map(a=>a);o.elements=[...i,...s],this.convertedXml[e]=n},c1=function({defs:t,exportType:e,commentsWithParaIds:n}){const{documentXml:r,relationships:o}=a4({exportType:e,convertedXml:this.convertedXml,defs:t,commentsWithParaIds:n,converter:this});return{documentXml:r,relationships:o}},u1=function({isFinalDoc:t=!1}){const e=this.convertedXml["word/_rels/document.xml.rels"].elements.find(n=>n.name==="Relationships");Object.entries(this.headers).forEach(([n,r])=>{const o=e.elements.find(u=>u.attributes.Id===n)?.attributes.Target,i=this.headerEditors.find(u=>u.id===n);if(!i)return;const{result:s,params:a}=this.exportToXmlJson({data:r,editor:i.editor,editorSchema:i.editor.schema,comments:[],commentDefinitions:[],isHeaderFooter:!0,isFinalDoc:t}),l=s.elements[0].elements,c=this.convertedXml[`word/${o}`];if(c.elements[0].elements=l,a.relationships.length){const u=this.convertedXml[`word/_rels/${o}.rels`]?.elements?.find(d=>d.name==="Relationships")?.elements||[];this.convertedXml[`word/_rels/${o}.rels`]={declaration:this.initialJSON?.declaration,elements:[{name:"Relationships",attributes:{xmlns:"http://schemas.openxmlformats.org/package/2006/relationships"},elements:[...u,...a.relationships]}]}}}),Object.entries(this.footers).forEach(([n,r])=>{const o=e.elements.find(u=>u.attributes.Id===n)?.attributes.Target,i=this.footerEditors.find(u=>u.id===n);if(!i)return;const{result:s,params:a}=this.exportToXmlJson({data:r,editor:i.editor,editorSchema:i.editor.schema,comments:[],commentDefinitions:[],isHeaderFooter:!0,isFinalDoc:t}),l=s.elements[0].elements,c=this.convertedXml[`word/${o}`];if(c.elements[0].elements=l,a.relationships.length){const u=this.convertedXml[`word/_rels/${o}.rels`]?.elements?.find(d=>d.name==="Relationships")?.elements||[];this.convertedXml[`word/_rels/${o}.rels`]={declaration:this.initialJSON?.declaration,elements:[{name:"Relationships",attributes:{xmlns:"http://schemas.openxmlformats.org/package/2006/relationships"},elements:[...u,...a.relationships]}]}}})},d1=function(t=[]){const e=this.convertedXml["word/_rels/document.xml.rels"],n=e.elements.find(s=>s.name==="Relationships"),r=[],o=/rId|mi/g;let i=Math.max(...n.elements.map(s=>Number(s.attributes.Id.replace(o,""))));t.forEach(s=>{const a=s.attributes.Id,l=n.elements.find(d=>d.attributes.Target===s.attributes.Target),c=s.attributes.Target?.startsWith("media/")&&a.length>6,u=s.attributes.Type===xT&&a.length>6;l&&!c&&!u||(s.attributes.Target=s.attributes?.Target?.replace(/&/g,"&"),s.attributes.Id=a.length>6?a:`rId${++i}`,r.push(s))}),n.elements=[...n.elements,...r],this.convertedXml["word/_rels/document.xml.rels"]=e},p1=async function(t,e){const n={};for(const r in t){if(typeof t[r]!="string")return;const o=r.split("/").pop();n[o]=await NE(t[r],e.options.isHeadless)}this.convertedXml.media={...this.convertedXml.media,...n},this.media=this.convertedXml.media,this.addedMedia=n},ta(Ui,"allowedElements",Object.freeze({"w:document":"doc","w:body":"body","w:p":"paragraph","w:r":"run","w:t":"text","w:delText":"text","w:br":"lineBreak","w:tbl":"table","w:tr":"tableRow","w:tc":"tableCell","w:drawing":"drawing","w:bookmarkStart":"bookmarkStart","w:sectPr":"sectionProperties","w:rPr":"runProperties","w:commentRangeStart":"commentRangeStart","w:commentRangeEnd":"commentRangeEnd","w:commentReference":"commentReference"})),ta(Ui,"markTypes",[{name:"w:b",type:"bold"},{name:"w:bCs",type:"bold"},{name:"w:i",type:"italic"},{name:"w:iCs",type:"italic"},{name:"w:u",type:"underline",mark:"underline",property:"underlineType"},{name:"w:strike",type:"strike"},{name:"w:color",type:"color",mark:"textStyle",property:"color"},{name:"w:sz",type:"fontSize",mark:"textStyle",property:"fontSize"},{name:"w:szCs",type:"fontSize",mark:"textStyle",property:"fontSize"},{name:"w:rFonts",type:"fontFamily",mark:"textStyle",property:"fontFamily"},{name:"w:jc",type:"textAlign",mark:"textStyle",property:"textAlign"},{name:"w:ind",type:"textIndent",mark:"textStyle",property:"textIndent"},{name:"w:spacing",type:"lineHeight",mark:"textStyle",property:"lineHeight"},{name:"link",type:"link",mark:"link",property:"href"},{name:"w:highlight",type:"highlight",mark:"highlight",property:"color"},{name:"w:shd",type:"highlight",mark:"highlight",property:"color"}]),ta(Ui,"propertyTypes",Object.freeze({"w:pPr":"paragraphProperties","w:rPr":"runProperties","w:sectPr":"sectionProperties","w:numPr":"numberingProperties","w:tcPr":"tableCellProperties"})),ta(Ui,"elements",new Set(["w:document","w:body","w:p","w:r","w:t","w:delText"]));let Nr=Ui;function kT(t){const e="docProps/custom.xml";t[e]||(t[e]=h1());const n=t[e].elements.find(s=>s.name==="Properties");n.elements||(n.elements=[]);const r=n.elements,o=r.filter(s=>typeof s=="object"&&s!==null).filter(s=>{const{attributes:a}=s;return a.name!=="SuperdocVersion"});let i=2;try{i=o.length?Math.max(...r.map(s=>s.attributes.pid))+1:2}catch{}return o.push(m1(i)),n.elements=o,t}function h1(){return jE}function m1(t=2,e="0.12.11"){return{type:"element",name:"property",attributes:{name:"SuperdocVersion",fmtid:"{D5CDD505-2E9C-101B-9397-08002B2CF9AE}",pid:t},elements:[{type:"element",name:"vt:lpwstr",elements:[{type:"text",text:e}]}]}}function la(t){throw new Error('Could not dynamically require "'+t+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var g1={exports:{}};(function(t,e){(function(n){t.exports=n()})(function(){return function n(r,o,i){function s(c,u){if(!o[c]){if(!r[c]){var d=typeof la=="function"&&la;if(!u&&d)return d(c,!0);if(a)return a(c,!0);var p=new Error("Cannot find module '"+c+"'");throw p.code="MODULE_NOT_FOUND",p}var f=o[c]={exports:{}};r[c][0].call(f.exports,function(h){var m=r[c][1][h];return s(m||h)},f,f.exports,n,r,o,i)}return o[c].exports}for(var a=typeof la=="function"&&la,l=0;l<i.length;l++)s(i[l]);return s}({1:[function(n,r,o){var i=n("./utils"),s=n("./support"),a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";o.encode=function(l){for(var c,u,d,p,f,h,m,y=[],g=0,v=l.length,k=v,b=i.getTypeOf(l)!=="string";g<l.length;)k=v-g,d=b?(c=l[g++],u=g<v?l[g++]:0,g<v?l[g++]:0):(c=l.charCodeAt(g++),u=g<v?l.charCodeAt(g++):0,g<v?l.charCodeAt(g++):0),p=c>>2,f=(3&c)<<4|u>>4,h=1<k?(15&u)<<2|d>>6:64,m=2<k?63&d:64,y.push(a.charAt(p)+a.charAt(f)+a.charAt(h)+a.charAt(m));return y.join("")},o.decode=function(l){var c,u,d,p,f,h,m=0,y=0,g="data:";if(l.substr(0,g.length)===g)throw new Error("Invalid base64 input, it looks like a data url.");var v,k=3*(l=l.replace(/[^A-Za-z0-9+/=]/g,"")).length/4;if(l.charAt(l.length-1)===a.charAt(64)&&k--,l.charAt(l.length-2)===a.charAt(64)&&k--,k%1!=0)throw new Error("Invalid base64 input, bad content length.");for(v=s.uint8array?new Uint8Array(0|k):new Array(0|k);m<l.length;)c=a.indexOf(l.charAt(m++))<<2|(p=a.indexOf(l.charAt(m++)))>>4,u=(15&p)<<4|(f=a.indexOf(l.charAt(m++)))>>2,d=(3&f)<<6|(h=a.indexOf(l.charAt(m++))),v[y++]=c,f!==64&&(v[y++]=u),h!==64&&(v[y++]=d);return v}},{"./support":30,"./utils":32}],2:[function(n,r,o){var i=n("./external"),s=n("./stream/DataWorker"),a=n("./stream/Crc32Probe"),l=n("./stream/DataLengthProbe");function c(u,d,p,f,h){this.compressedSize=u,this.uncompressedSize=d,this.crc32=p,this.compression=f,this.compressedContent=h}c.prototype={getContentWorker:function(){var u=new s(i.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new l("data_length")),d=this;return u.on("end",function(){if(this.streamInfo.data_length!==d.uncompressedSize)throw new Error("Bug : uncompressed data size mismatch")}),u},getCompressedWorker:function(){return new s(i.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}},c.createWorkerFrom=function(u,d,p){return u.pipe(new a).pipe(new l("uncompressedSize")).pipe(d.compressWorker(p)).pipe(new l("compressedSize")).withStreamInfo("compression",d)},r.exports=c},{"./external":6,"./stream/Crc32Probe":25,"./stream/DataLengthProbe":26,"./stream/DataWorker":27}],3:[function(n,r,o){var i=n("./stream/GenericWorker");o.STORE={magic:"\0\0",compressWorker:function(){return new i("STORE compression")},uncompressWorker:function(){return new i("STORE decompression")}},o.DEFLATE=n("./flate")},{"./flate":7,"./stream/GenericWorker":28}],4:[function(n,r,o){var i=n("./utils"),s=function(){for(var a,l=[],c=0;c<256;c++){a=c;for(var u=0;u<8;u++)a=1&a?3988292384^a>>>1:a>>>1;l[c]=a}return l}();r.exports=function(a,l){return a!==void 0&&a.length?i.getTypeOf(a)!=="string"?function(c,u,d,p){var f=s,h=p+d;c^=-1;for(var m=p;m<h;m++)c=c>>>8^f[255&(c^u[m])];return-1^c}(0|l,a,a.length,0):function(c,u,d,p){var f=s,h=p+d;c^=-1;for(var m=p;m<h;m++)c=c>>>8^f[255&(c^u.charCodeAt(m))];return-1^c}(0|l,a,a.length,0):0}},{"./utils":32}],5:[function(n,r,o){o.base64=!1,o.binary=!1,o.dir=!1,o.createFolders=!0,o.date=null,o.compression=null,o.compressionOptions=null,o.comment=null,o.unixPermissions=null,o.dosPermissions=null},{}],6:[function(n,r,o){var i=null;i=typeof Promise<"u"?Promise:n("lie"),r.exports={Promise:i}},{lie:37}],7:[function(n,r,o){var i=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Uint32Array<"u",s=n("pako"),a=n("./utils"),l=n("./stream/GenericWorker"),c=i?"uint8array":"array";function u(d,p){l.call(this,"FlateWorker/"+d),this._pako=null,this._pakoAction=d,this._pakoOptions=p,this.meta={}}o.magic="\b\0",a.inherits(u,l),u.prototype.processChunk=function(d){this.meta=d.meta,this._pako===null&&this._createPako(),this._pako.push(a.transformTo(c,d.data),!1)},u.prototype.flush=function(){l.prototype.flush.call(this),this._pako===null&&this._createPako(),this._pako.push([],!0)},u.prototype.cleanUp=function(){l.prototype.cleanUp.call(this),this._pako=null},u.prototype._createPako=function(){this._pako=new s[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var d=this;this._pako.onData=function(p){d.push({data:p,meta:d.meta})}},o.compressWorker=function(d){return new u("Deflate",d)},o.uncompressWorker=function(){return new u("Inflate",{})}},{"./stream/GenericWorker":28,"./utils":32,pako:38}],8:[function(n,r,o){function i(f,h){var m,y="";for(m=0;m<h;m++)y+=String.fromCharCode(255&f),f>>>=8;return y}function s(f,h,m,y,g,v){var k,b,C=f.file,D=f.compression,M=v!==c.utf8encode,I=a.transformTo("string",v(C.name)),E=a.transformTo("string",c.utf8encode(C.name)),G=C.comment,oe=a.transformTo("string",v(G)),N=a.transformTo("string",c.utf8encode(G)),H=E.length!==C.name.length,A=N.length!==G.length,J="",ie="",W="",ce=C.dir,X=C.date,ue={crc32:0,compressedSize:0,uncompressedSize:0};h&&!m||(ue.crc32=f.crc32,ue.compressedSize=f.compressedSize,ue.uncompressedSize=f.uncompressedSize);var Z=0;h&&(Z|=8),M||!H&&!A||(Z|=2048);var R=0,ee=0;ce&&(R|=16),g==="UNIX"?(ee=798,R|=function(se,Y){var $=se;return se||($=Y?16893:33204),(65535&$)<<16}(C.unixPermissions,ce)):(ee=20,R|=function(se){return 63&(se||0)}(C.dosPermissions)),k=X.getUTCHours(),k<<=6,k|=X.getUTCMinutes(),k<<=5,k|=X.getUTCSeconds()/2,b=X.getUTCFullYear()-1980,b<<=4,b|=X.getUTCMonth()+1,b<<=5,b|=X.getUTCDate(),H&&(ie=i(1,1)+i(u(I),4)+E,J+="up"+i(ie.length,2)+ie),A&&(W=i(1,1)+i(u(oe),4)+N,J+="uc"+i(W.length,2)+W);var ne="";return ne+=`
|
|
39
39
|
\0`,ne+=i(Z,2),ne+=D.magic,ne+=i(k,2),ne+=i(b,2),ne+=i(ue.crc32,4),ne+=i(ue.compressedSize,4),ne+=i(ue.uncompressedSize,4),ne+=i(I.length,2),ne+=i(J.length,2),{fileRecord:d.LOCAL_FILE_HEADER+ne+I+J,dirRecord:d.CENTRAL_FILE_HEADER+i(ee,2)+ne+i(oe.length,2)+"\0\0\0\0"+i(R,4)+i(y,4)+I+J+oe}}var a=n("../utils"),l=n("../stream/GenericWorker"),c=n("../utf8"),u=n("../crc32"),d=n("../signature");function p(f,h,m,y){l.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=h,this.zipPlatform=m,this.encodeFileName=y,this.streamFiles=f,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}a.inherits(p,l),p.prototype.push=function(f){var h=f.meta.percent||0,m=this.entriesCount,y=this._sources.length;this.accumulate?this.contentBuffer.push(f):(this.bytesWritten+=f.data.length,l.prototype.push.call(this,{data:f.data,meta:{currentFile:this.currentFile,percent:m?(h+100*(m-y-1))/m:100}}))},p.prototype.openedSource=function(f){this.currentSourceOffset=this.bytesWritten,this.currentFile=f.file.name;var h=this.streamFiles&&!f.file.dir;if(h){var m=s(f,h,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:m.fileRecord,meta:{percent:0}})}else this.accumulate=!0},p.prototype.closedSource=function(f){this.accumulate=!1;var h=this.streamFiles&&!f.file.dir,m=s(f,h,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(m.dirRecord),h)this.push({data:function(y){return d.DATA_DESCRIPTOR+i(y.crc32,4)+i(y.compressedSize,4)+i(y.uncompressedSize,4)}(f),meta:{percent:100}});else for(this.push({data:m.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},p.prototype.flush=function(){for(var f=this.bytesWritten,h=0;h<this.dirRecords.length;h++)this.push({data:this.dirRecords[h],meta:{percent:100}});var m=this.bytesWritten-f,y=function(g,v,k,b,C){var D=a.transformTo("string",C(b));return d.CENTRAL_DIRECTORY_END+"\0\0\0\0"+i(g,2)+i(g,2)+i(v,4)+i(k,4)+i(D.length,2)+D}(this.dirRecords.length,m,f,this.zipComment,this.encodeFileName);this.push({data:y,meta:{percent:100}})},p.prototype.prepareNextSource=function(){this.previous=this._sources.shift(),this.openedSource(this.previous.streamInfo),this.isPaused?this.previous.pause():this.previous.resume()},p.prototype.registerPrevious=function(f){this._sources.push(f);var h=this;return f.on("data",function(m){h.processChunk(m)}),f.on("end",function(){h.closedSource(h.previous.streamInfo),h._sources.length?h.prepareNextSource():h.end()}),f.on("error",function(m){h.error(m)}),this},p.prototype.resume=function(){return!!l.prototype.resume.call(this)&&(!this.previous&&this._sources.length?(this.prepareNextSource(),!0):this.previous||this._sources.length||this.generatedError?void 0:(this.end(),!0))},p.prototype.error=function(f){var h=this._sources;if(!l.prototype.error.call(this,f))return!1;for(var m=0;m<h.length;m++)try{h[m].error(f)}catch{}return!0},p.prototype.lock=function(){l.prototype.lock.call(this);for(var f=this._sources,h=0;h<f.length;h++)f[h].lock()},r.exports=p},{"../crc32":4,"../signature":23,"../stream/GenericWorker":28,"../utf8":31,"../utils":32}],9:[function(n,r,o){var i=n("../compressions"),s=n("./ZipFileWorker");o.generateWorker=function(a,l,c){var u=new s(l.streamFiles,c,l.platform,l.encodeFileName),d=0;try{a.forEach(function(p,f){d++;var h=function(v,k){var b=v||k,C=i[b];if(!C)throw new Error(b+" is not a valid compression method !");return C}(f.options.compression,l.compression),m=f.options.compressionOptions||l.compressionOptions||{},y=f.dir,g=f.date;f._compressWorker(h,m).withStreamInfo("file",{name:p,dir:y,date:g,comment:f.comment||"",unixPermissions:f.unixPermissions,dosPermissions:f.dosPermissions}).pipe(u)}),u.entriesCount=d}catch(p){u.error(p)}return u}},{"../compressions":3,"./ZipFileWorker":8}],10:[function(n,r,o){function i(){if(!(this instanceof i))return new i;if(arguments.length)throw new Error("The constructor with parameters has been removed in JSZip 3.0, please check the upgrade guide.");this.files=Object.create(null),this.comment=null,this.root="",this.clone=function(){var s=new i;for(var a in this)typeof this[a]!="function"&&(s[a]=this[a]);return s}}(i.prototype=n("./object")).loadAsync=n("./load"),i.support=n("./support"),i.defaults=n("./defaults"),i.version="3.10.1",i.loadAsync=function(s,a){return new i().loadAsync(s,a)},i.external=n("./external"),r.exports=i},{"./defaults":5,"./external":6,"./load":11,"./object":15,"./support":30}],11:[function(n,r,o){var i=n("./utils"),s=n("./external"),a=n("./utf8"),l=n("./zipEntries"),c=n("./stream/Crc32Probe"),u=n("./nodejsUtils");function d(p){return new s.Promise(function(f,h){var m=p.decompressed.getContentWorker().pipe(new c);m.on("error",function(y){h(y)}).on("end",function(){m.streamInfo.crc32!==p.decompressed.crc32?h(new Error("Corrupted zip : CRC32 mismatch")):f()}).resume()})}r.exports=function(p,f){var h=this;return f=i.extend(f||{},{base64:!1,checkCRC32:!1,optimizedBinaryString:!1,createFolders:!1,decodeFileName:a.utf8decode}),u.isNode&&u.isStream(p)?s.Promise.reject(new Error("JSZip can't accept a stream when loading a zip file.")):i.prepareContent("the loaded zip file",p,!0,f.optimizedBinaryString,f.base64).then(function(m){var y=new l(f);return y.load(m),y}).then(function(m){var y=[s.Promise.resolve(m)],g=m.files;if(f.checkCRC32)for(var v=0;v<g.length;v++)y.push(d(g[v]));return s.Promise.all(y)}).then(function(m){for(var y=m.shift(),g=y.files,v=0;v<g.length;v++){var k=g[v],b=k.fileNameStr,C=i.resolve(k.fileNameStr);h.file(C,k.decompressed,{binary:!0,optimizedBinaryString:!0,date:k.date,dir:k.dir,comment:k.fileCommentStr.length?k.fileCommentStr:null,unixPermissions:k.unixPermissions,dosPermissions:k.dosPermissions,createFolders:f.createFolders}),k.dir||(h.file(C).unsafeOriginalName=b)}return y.zipComment.length&&(h.comment=y.zipComment),h})}},{"./external":6,"./nodejsUtils":14,"./stream/Crc32Probe":25,"./utf8":31,"./utils":32,"./zipEntries":33}],12:[function(n,r,o){var i=n("../utils"),s=n("../stream/GenericWorker");function a(l,c){s.call(this,"Nodejs stream input adapter for "+l),this._upstreamEnded=!1,this._bindStream(c)}i.inherits(a,s),a.prototype._bindStream=function(l){var c=this;(this._stream=l).pause(),l.on("data",function(u){c.push({data:u,meta:{percent:0}})}).on("error",function(u){c.isPaused?this.generatedError=u:c.error(u)}).on("end",function(){c.isPaused?c._upstreamEnded=!0:c.end()})},a.prototype.pause=function(){return!!s.prototype.pause.call(this)&&(this._stream.pause(),!0)},a.prototype.resume=function(){return!!s.prototype.resume.call(this)&&(this._upstreamEnded?this.end():this._stream.resume(),!0)},r.exports=a},{"../stream/GenericWorker":28,"../utils":32}],13:[function(n,r,o){var i=n("readable-stream").Readable;function s(a,l,c){i.call(this,l),this._helper=a;var u=this;a.on("data",function(d,p){u.push(d)||u._helper.pause(),c&&c(p)}).on("error",function(d){u.emit("error",d)}).on("end",function(){u.push(null)})}n("../utils").inherits(s,i),s.prototype._read=function(){this._helper.resume()},r.exports=s},{"../utils":32,"readable-stream":16}],14:[function(n,r,o){r.exports={isNode:typeof mt<"u",newBufferFrom:function(i,s){if(mt.from&&mt.from!==Uint8Array.from)return mt.from(i,s);if(typeof i=="number")throw new Error('The "data" argument must not be a number');return new mt(i,s)},allocBuffer:function(i){if(mt.alloc)return mt.alloc(i);var s=new mt(i);return s.fill(0),s},isBuffer:function(i){return mt.isBuffer(i)},isStream:function(i){return i&&typeof i.on=="function"&&typeof i.pause=="function"&&typeof i.resume=="function"}}},{}],15:[function(n,r,o){function i(C,D,M){var I,E=a.getTypeOf(D),G=a.extend(M||{},u);G.date=G.date||new Date,G.compression!==null&&(G.compression=G.compression.toUpperCase()),typeof G.unixPermissions=="string"&&(G.unixPermissions=parseInt(G.unixPermissions,8)),G.unixPermissions&&16384&G.unixPermissions&&(G.dir=!0),G.dosPermissions&&16&G.dosPermissions&&(G.dir=!0),G.dir&&(C=g(C)),G.createFolders&&(I=y(C))&&v.call(this,I,!0);var oe=E==="string"&&G.binary===!1&&G.base64===!1;M&&M.binary!==void 0||(G.binary=!oe),(D instanceof d&&D.uncompressedSize===0||G.dir||!D||D.length===0)&&(G.base64=!1,G.binary=!0,D="",G.compression="STORE",E="string");var N=null;N=D instanceof d||D instanceof l?D:h.isNode&&h.isStream(D)?new m(C,D):a.prepareContent(C,D,G.binary,G.optimizedBinaryString,G.base64);var H=new p(C,N,G);this.files[C]=H}var s=n("./utf8"),a=n("./utils"),l=n("./stream/GenericWorker"),c=n("./stream/StreamHelper"),u=n("./defaults"),d=n("./compressedObject"),p=n("./zipObject"),f=n("./generate"),h=n("./nodejsUtils"),m=n("./nodejs/NodejsStreamInputAdapter"),y=function(C){C.slice(-1)==="/"&&(C=C.substring(0,C.length-1));var D=C.lastIndexOf("/");return 0<D?C.substring(0,D):""},g=function(C){return C.slice(-1)!=="/"&&(C+="/"),C},v=function(C,D){return D=D!==void 0?D:u.createFolders,C=g(C),this.files[C]||i.call(this,C,null,{dir:!0,createFolders:D}),this.files[C]};function k(C){return Object.prototype.toString.call(C)==="[object RegExp]"}var b={load:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},forEach:function(C){var D,M,I;for(D in this.files)I=this.files[D],(M=D.slice(this.root.length,D.length))&&D.slice(0,this.root.length)===this.root&&C(M,I)},filter:function(C){var D=[];return this.forEach(function(M,I){C(M,I)&&D.push(I)}),D},file:function(C,D,M){if(arguments.length!==1)return C=this.root+C,i.call(this,C,D,M),this;if(k(C)){var I=C;return this.filter(function(G,oe){return!oe.dir&&I.test(G)})}var E=this.files[this.root+C];return E&&!E.dir?E:null},folder:function(C){if(!C)return this;if(k(C))return this.filter(function(E,G){return G.dir&&C.test(E)});var D=this.root+C,M=v.call(this,D),I=this.clone();return I.root=M.name,I},remove:function(C){C=this.root+C;var D=this.files[C];if(D||(C.slice(-1)!=="/"&&(C+="/"),D=this.files[C]),D&&!D.dir)delete this.files[C];else for(var M=this.filter(function(E,G){return G.name.slice(0,C.length)===C}),I=0;I<M.length;I++)delete this.files[M[I].name];return this},generate:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},generateInternalStream:function(C){var D,M={};try{if((M=a.extend(C||{},{streamFiles:!1,compression:"STORE",compressionOptions:null,type:"",platform:"DOS",comment:null,mimeType:"application/zip",encodeFileName:s.utf8encode})).type=M.type.toLowerCase(),M.compression=M.compression.toUpperCase(),M.type==="binarystring"&&(M.type="string"),!M.type)throw new Error("No output type specified.");a.checkSupport(M.type),M.platform!=="darwin"&&M.platform!=="freebsd"&&M.platform!=="linux"&&M.platform!=="sunos"||(M.platform="UNIX"),M.platform==="win32"&&(M.platform="DOS");var I=M.comment||this.comment||"";D=f.generateWorker(this,M,I)}catch(E){(D=new l("error")).error(E)}return new c(D,M.type||"string",M.mimeType)},generateAsync:function(C,D){return this.generateInternalStream(C).accumulate(D)},generateNodeStream:function(C,D){return(C=C||{}).type||(C.type="nodebuffer"),this.generateInternalStream(C).toNodejsStream(D)}};r.exports=b},{"./compressedObject":2,"./defaults":5,"./generate":9,"./nodejs/NodejsStreamInputAdapter":12,"./nodejsUtils":14,"./stream/GenericWorker":28,"./stream/StreamHelper":29,"./utf8":31,"./utils":32,"./zipObject":35}],16:[function(n,r,o){r.exports=n("stream")},{stream:void 0}],17:[function(n,r,o){var i=n("./DataReader");function s(a){i.call(this,a);for(var l=0;l<this.data.length;l++)a[l]=255&a[l]}n("../utils").inherits(s,i),s.prototype.byteAt=function(a){return this.data[this.zero+a]},s.prototype.lastIndexOfSignature=function(a){for(var l=a.charCodeAt(0),c=a.charCodeAt(1),u=a.charCodeAt(2),d=a.charCodeAt(3),p=this.length-4;0<=p;--p)if(this.data[p]===l&&this.data[p+1]===c&&this.data[p+2]===u&&this.data[p+3]===d)return p-this.zero;return-1},s.prototype.readAndCheckSignature=function(a){var l=a.charCodeAt(0),c=a.charCodeAt(1),u=a.charCodeAt(2),d=a.charCodeAt(3),p=this.readData(4);return l===p[0]&&c===p[1]&&u===p[2]&&d===p[3]},s.prototype.readData=function(a){if(this.checkOffset(a),a===0)return[];var l=this.data.slice(this.zero+this.index,this.zero+this.index+a);return this.index+=a,l},r.exports=s},{"../utils":32,"./DataReader":18}],18:[function(n,r,o){var i=n("../utils");function s(a){this.data=a,this.length=a.length,this.index=0,this.zero=0}s.prototype={checkOffset:function(a){this.checkIndex(this.index+a)},checkIndex:function(a){if(this.length<this.zero+a||a<0)throw new Error("End of data reached (data length = "+this.length+", asked index = "+a+"). Corrupted zip ?")},setIndex:function(a){this.checkIndex(a),this.index=a},skip:function(a){this.setIndex(this.index+a)},byteAt:function(){},readInt:function(a){var l,c=0;for(this.checkOffset(a),l=this.index+a-1;l>=this.index;l--)c=(c<<8)+this.byteAt(l);return this.index+=a,c},readString:function(a){return i.transformTo("string",this.readData(a))},readData:function(){},lastIndexOfSignature:function(){},readAndCheckSignature:function(){},readDate:function(){var a=this.readInt(4);return new Date(Date.UTC(1980+(a>>25&127),(a>>21&15)-1,a>>16&31,a>>11&31,a>>5&63,(31&a)<<1))}},r.exports=s},{"../utils":32}],19:[function(n,r,o){var i=n("./Uint8ArrayReader");function s(a){i.call(this,a)}n("../utils").inherits(s,i),s.prototype.readData=function(a){this.checkOffset(a);var l=this.data.slice(this.zero+this.index,this.zero+this.index+a);return this.index+=a,l},r.exports=s},{"../utils":32,"./Uint8ArrayReader":21}],20:[function(n,r,o){var i=n("./DataReader");function s(a){i.call(this,a)}n("../utils").inherits(s,i),s.prototype.byteAt=function(a){return this.data.charCodeAt(this.zero+a)},s.prototype.lastIndexOfSignature=function(a){return this.data.lastIndexOf(a)-this.zero},s.prototype.readAndCheckSignature=function(a){return a===this.readData(4)},s.prototype.readData=function(a){this.checkOffset(a);var l=this.data.slice(this.zero+this.index,this.zero+this.index+a);return this.index+=a,l},r.exports=s},{"../utils":32,"./DataReader":18}],21:[function(n,r,o){var i=n("./ArrayReader");function s(a){i.call(this,a)}n("../utils").inherits(s,i),s.prototype.readData=function(a){if(this.checkOffset(a),a===0)return new Uint8Array(0);var l=this.data.subarray(this.zero+this.index,this.zero+this.index+a);return this.index+=a,l},r.exports=s},{"../utils":32,"./ArrayReader":17}],22:[function(n,r,o){var i=n("../utils"),s=n("../support"),a=n("./ArrayReader"),l=n("./StringReader"),c=n("./NodeBufferReader"),u=n("./Uint8ArrayReader");r.exports=function(d){var p=i.getTypeOf(d);return i.checkSupport(p),p!=="string"||s.uint8array?p==="nodebuffer"?new c(d):s.uint8array?new u(i.transformTo("uint8array",d)):new a(i.transformTo("array",d)):new l(d)}},{"../support":30,"../utils":32,"./ArrayReader":17,"./NodeBufferReader":19,"./StringReader":20,"./Uint8ArrayReader":21}],23:[function(n,r,o){o.LOCAL_FILE_HEADER="PK",o.CENTRAL_FILE_HEADER="PK",o.CENTRAL_DIRECTORY_END="PK",o.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK\x07",o.ZIP64_CENTRAL_DIRECTORY_END="PK",o.DATA_DESCRIPTOR="PK\x07\b"},{}],24:[function(n,r,o){var i=n("./GenericWorker"),s=n("../utils");function a(l){i.call(this,"ConvertWorker to "+l),this.destType=l}s.inherits(a,i),a.prototype.processChunk=function(l){this.push({data:s.transformTo(this.destType,l.data),meta:l.meta})},r.exports=a},{"../utils":32,"./GenericWorker":28}],25:[function(n,r,o){var i=n("./GenericWorker"),s=n("../crc32");function a(){i.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}n("../utils").inherits(a,i),a.prototype.processChunk=function(l){this.streamInfo.crc32=s(l.data,this.streamInfo.crc32||0),this.push(l)},r.exports=a},{"../crc32":4,"../utils":32,"./GenericWorker":28}],26:[function(n,r,o){var i=n("../utils"),s=n("./GenericWorker");function a(l){s.call(this,"DataLengthProbe for "+l),this.propName=l,this.withStreamInfo(l,0)}i.inherits(a,s),a.prototype.processChunk=function(l){if(l){var c=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=c+l.data.length}s.prototype.processChunk.call(this,l)},r.exports=a},{"../utils":32,"./GenericWorker":28}],27:[function(n,r,o){var i=n("../utils"),s=n("./GenericWorker");function a(l){s.call(this,"DataWorker");var c=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,l.then(function(u){c.dataIsReady=!0,c.data=u,c.max=u&&u.length||0,c.type=i.getTypeOf(u),c.isPaused||c._tickAndRepeat()},function(u){c.error(u)})}i.inherits(a,s),a.prototype.cleanUp=function(){s.prototype.cleanUp.call(this),this.data=null},a.prototype.resume=function(){return!!s.prototype.resume.call(this)&&(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,i.delay(this._tickAndRepeat,[],this)),!0)},a.prototype._tickAndRepeat=function(){this._tickScheduled=!1,this.isPaused||this.isFinished||(this._tick(),this.isFinished||(i.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))},a.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var l=null,c=Math.min(this.max,this.index+16384);if(this.index>=this.max)return this.end();switch(this.type){case"string":l=this.data.substring(this.index,c);break;case"uint8array":l=this.data.subarray(this.index,c);break;case"array":case"nodebuffer":l=this.data.slice(this.index,c)}return this.index=c,this.push({data:l,meta:{percent:this.max?this.index/this.max*100:0}})},r.exports=a},{"../utils":32,"./GenericWorker":28}],28:[function(n,r,o){function i(s){this.name=s||"default",this.streamInfo={},this.generatedError=null,this.extraStreamInfo={},this.isPaused=!0,this.isFinished=!1,this.isLocked=!1,this._listeners={data:[],end:[],error:[]},this.previous=null}i.prototype={push:function(s){this.emit("data",s)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit("end"),this.cleanUp(),this.isFinished=!0}catch(s){this.emit("error",s)}return!0},error:function(s){return!this.isFinished&&(this.isPaused?this.generatedError=s:(this.isFinished=!0,this.emit("error",s),this.previous&&this.previous.error(s),this.cleanUp()),!0)},on:function(s,a){return this._listeners[s].push(a),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(s,a){if(this._listeners[s])for(var l=0;l<this._listeners[s].length;l++)this._listeners[s][l].call(this,a)},pipe:function(s){return s.registerPrevious(this)},registerPrevious:function(s){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.streamInfo=s.streamInfo,this.mergeStreamInfo(),this.previous=s;var a=this;return s.on("data",function(l){a.processChunk(l)}),s.on("end",function(){a.end()}),s.on("error",function(l){a.error(l)}),this},pause:function(){return!this.isPaused&&!this.isFinished&&(this.isPaused=!0,this.previous&&this.previous.pause(),!0)},resume:function(){if(!this.isPaused||this.isFinished)return!1;var s=this.isPaused=!1;return this.generatedError&&(this.error(this.generatedError),s=!0),this.previous&&this.previous.resume(),!s},flush:function(){},processChunk:function(s){this.push(s)},withStreamInfo:function(s,a){return this.extraStreamInfo[s]=a,this.mergeStreamInfo(),this},mergeStreamInfo:function(){for(var s in this.extraStreamInfo)Object.prototype.hasOwnProperty.call(this.extraStreamInfo,s)&&(this.streamInfo[s]=this.extraStreamInfo[s])},lock:function(){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.isLocked=!0,this.previous&&this.previous.lock()},toString:function(){var s="Worker "+this.name;return this.previous?this.previous+" -> "+s:s}},r.exports=i},{}],29:[function(n,r,o){var i=n("../utils"),s=n("./ConvertWorker"),a=n("./GenericWorker"),l=n("../base64"),c=n("../support"),u=n("../external"),d=null;if(c.nodestream)try{d=n("../nodejs/NodejsStreamOutputAdapter")}catch{}function p(h,m){return new u.Promise(function(y,g){var v=[],k=h._internalType,b=h._outputType,C=h._mimeType;h.on("data",function(D,M){v.push(D),m&&m(M)}).on("error",function(D){v=[],g(D)}).on("end",function(){try{var D=function(M,I,E){switch(M){case"blob":return i.newBlob(i.transformTo("arraybuffer",I),E);case"base64":return l.encode(I);default:return i.transformTo(M,I)}}(b,function(M,I){var E,G=0,oe=null,N=0;for(E=0;E<I.length;E++)N+=I[E].length;switch(M){case"string":return I.join("");case"array":return Array.prototype.concat.apply([],I);case"uint8array":for(oe=new Uint8Array(N),E=0;E<I.length;E++)oe.set(I[E],G),G+=I[E].length;return oe;case"nodebuffer":return mt.concat(I);default:throw new Error("concat : unsupported type '"+M+"'")}}(k,v),C);y(D)}catch(M){g(M)}v=[]}).resume()})}function f(h,m,y){var g=m;switch(m){case"blob":case"arraybuffer":g="uint8array";break;case"base64":g="string"}try{this._internalType=g,this._outputType=m,this._mimeType=y,i.checkSupport(g),this._worker=h.pipe(new s(g)),h.lock()}catch(v){this._worker=new a("error"),this._worker.error(v)}}f.prototype={accumulate:function(h){return p(this,h)},on:function(h,m){var y=this;return h==="data"?this._worker.on(h,function(g){m.call(y,g.data,g.meta)}):this._worker.on(h,function(){i.delay(m,arguments,y)}),this},resume:function(){return i.delay(this._worker.resume,[],this._worker),this},pause:function(){return this._worker.pause(),this},toNodejsStream:function(h){if(i.checkSupport("nodestream"),this._outputType!=="nodebuffer")throw new Error(this._outputType+" is not supported by this method");return new d(this,{objectMode:this._outputType!=="nodebuffer"},h)}},r.exports=f},{"../base64":1,"../external":6,"../nodejs/NodejsStreamOutputAdapter":13,"../support":30,"../utils":32,"./ConvertWorker":24,"./GenericWorker":28}],30:[function(n,r,o){if(o.base64=!0,o.array=!0,o.string=!0,o.arraybuffer=typeof ArrayBuffer<"u"&&typeof Uint8Array<"u",o.nodebuffer=typeof mt<"u",o.uint8array=typeof Uint8Array<"u",typeof ArrayBuffer>"u")o.blob=!1;else{var i=new ArrayBuffer(0);try{o.blob=new Blob([i],{type:"application/zip"}).size===0}catch{try{var s=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);s.append(i),o.blob=s.getBlob("application/zip").size===0}catch{o.blob=!1}}}try{o.nodestream=!!n("readable-stream").Readable}catch{o.nodestream=!1}},{"readable-stream":16}],31:[function(n,r,o){for(var i=n("./utils"),s=n("./support"),a=n("./nodejsUtils"),l=n("./stream/GenericWorker"),c=new Array(256),u=0;u<256;u++)c[u]=252<=u?6:248<=u?5:240<=u?4:224<=u?3:192<=u?2:1;c[254]=c[254]=1;function d(){l.call(this,"utf-8 decode"),this.leftOver=null}function p(){l.call(this,"utf-8 encode")}o.utf8encode=function(f){return s.nodebuffer?a.newBufferFrom(f,"utf-8"):function(h){var m,y,g,v,k,b=h.length,C=0;for(v=0;v<b;v++)(64512&(y=h.charCodeAt(v)))==55296&&v+1<b&&(64512&(g=h.charCodeAt(v+1)))==56320&&(y=65536+(y-55296<<10)+(g-56320),v++),C+=y<128?1:y<2048?2:y<65536?3:4;for(m=s.uint8array?new Uint8Array(C):new Array(C),v=k=0;k<C;v++)(64512&(y=h.charCodeAt(v)))==55296&&v+1<b&&(64512&(g=h.charCodeAt(v+1)))==56320&&(y=65536+(y-55296<<10)+(g-56320),v++),y<128?m[k++]=y:(y<2048?m[k++]=192|y>>>6:(y<65536?m[k++]=224|y>>>12:(m[k++]=240|y>>>18,m[k++]=128|y>>>12&63),m[k++]=128|y>>>6&63),m[k++]=128|63&y);return m}(f)},o.utf8decode=function(f){return s.nodebuffer?i.transformTo("nodebuffer",f).toString("utf-8"):function(h){var m,y,g,v,k=h.length,b=new Array(2*k);for(m=y=0;m<k;)if((g=h[m++])<128)b[y++]=g;else if(4<(v=c[g]))b[y++]=65533,m+=v-1;else{for(g&=v===2?31:v===3?15:7;1<v&&m<k;)g=g<<6|63&h[m++],v--;1<v?b[y++]=65533:g<65536?b[y++]=g:(g-=65536,b[y++]=55296|g>>10&1023,b[y++]=56320|1023&g)}return b.length!==y&&(b.subarray?b=b.subarray(0,y):b.length=y),i.applyFromCharCode(b)}(f=i.transformTo(s.uint8array?"uint8array":"array",f))},i.inherits(d,l),d.prototype.processChunk=function(f){var h=i.transformTo(s.uint8array?"uint8array":"array",f.data);if(this.leftOver&&this.leftOver.length){if(s.uint8array){var m=h;(h=new Uint8Array(m.length+this.leftOver.length)).set(this.leftOver,0),h.set(m,this.leftOver.length)}else h=this.leftOver.concat(h);this.leftOver=null}var y=function(v,k){var b;for((k=k||v.length)>v.length&&(k=v.length),b=k-1;0<=b&&(192&v[b])==128;)b--;return b<0||b===0?k:b+c[v[b]]>k?b:k}(h),g=h;y!==h.length&&(s.uint8array?(g=h.subarray(0,y),this.leftOver=h.subarray(y,h.length)):(g=h.slice(0,y),this.leftOver=h.slice(y,h.length))),this.push({data:o.utf8decode(g),meta:f.meta})},d.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:o.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)},o.Utf8DecodeWorker=d,i.inherits(p,l),p.prototype.processChunk=function(f){this.push({data:o.utf8encode(f.data),meta:f.meta})},o.Utf8EncodeWorker=p},{"./nodejsUtils":14,"./stream/GenericWorker":28,"./support":30,"./utils":32}],32:[function(n,r,o){var i=n("./support"),s=n("./base64"),a=n("./nodejsUtils"),l=n("./external");function c(m){return m}function u(m,y){for(var g=0;g<m.length;++g)y[g]=255&m.charCodeAt(g);return y}n("setimmediate"),o.newBlob=function(m,y){o.checkSupport("blob");try{return new Blob([m],{type:y})}catch{try{var g=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);return g.append(m),g.getBlob(y)}catch{throw new Error("Bug : can't construct the Blob.")}}};var d={stringifyByChunk:function(m,y,g){var v=[],k=0,b=m.length;if(b<=g)return String.fromCharCode.apply(null,m);for(;k<b;)y==="array"||y==="nodebuffer"?v.push(String.fromCharCode.apply(null,m.slice(k,Math.min(k+g,b)))):v.push(String.fromCharCode.apply(null,m.subarray(k,Math.min(k+g,b)))),k+=g;return v.join("")},stringifyByChar:function(m){for(var y="",g=0;g<m.length;g++)y+=String.fromCharCode(m[g]);return y},applyCanBeUsed:{uint8array:function(){try{return i.uint8array&&String.fromCharCode.apply(null,new Uint8Array(1)).length===1}catch{return!1}}(),nodebuffer:function(){try{return i.nodebuffer&&String.fromCharCode.apply(null,a.allocBuffer(1)).length===1}catch{return!1}}()}};function p(m){var y=65536,g=o.getTypeOf(m),v=!0;if(g==="uint8array"?v=d.applyCanBeUsed.uint8array:g==="nodebuffer"&&(v=d.applyCanBeUsed.nodebuffer),v)for(;1<y;)try{return d.stringifyByChunk(m,g,y)}catch{y=Math.floor(y/2)}return d.stringifyByChar(m)}function f(m,y){for(var g=0;g<m.length;g++)y[g]=m[g];return y}o.applyFromCharCode=p;var h={};h.string={string:c,array:function(m){return u(m,new Array(m.length))},arraybuffer:function(m){return h.string.uint8array(m).buffer},uint8array:function(m){return u(m,new Uint8Array(m.length))},nodebuffer:function(m){return u(m,a.allocBuffer(m.length))}},h.array={string:p,array:c,arraybuffer:function(m){return new Uint8Array(m).buffer},uint8array:function(m){return new Uint8Array(m)},nodebuffer:function(m){return a.newBufferFrom(m)}},h.arraybuffer={string:function(m){return p(new Uint8Array(m))},array:function(m){return f(new Uint8Array(m),new Array(m.byteLength))},arraybuffer:c,uint8array:function(m){return new Uint8Array(m)},nodebuffer:function(m){return a.newBufferFrom(new Uint8Array(m))}},h.uint8array={string:p,array:function(m){return f(m,new Array(m.length))},arraybuffer:function(m){return m.buffer},uint8array:c,nodebuffer:function(m){return a.newBufferFrom(m)}},h.nodebuffer={string:p,array:function(m){return f(m,new Array(m.length))},arraybuffer:function(m){return h.nodebuffer.uint8array(m).buffer},uint8array:function(m){return f(m,new Uint8Array(m.length))},nodebuffer:c},o.transformTo=function(m,y){if(y=y||"",!m)return y;o.checkSupport(m);var g=o.getTypeOf(y);return h[g][m](y)},o.resolve=function(m){for(var y=m.split("/"),g=[],v=0;v<y.length;v++){var k=y[v];k==="."||k===""&&v!==0&&v!==y.length-1||(k===".."?g.pop():g.push(k))}return g.join("/")},o.getTypeOf=function(m){return typeof m=="string"?"string":Object.prototype.toString.call(m)==="[object Array]"?"array":i.nodebuffer&&a.isBuffer(m)?"nodebuffer":i.uint8array&&m instanceof Uint8Array?"uint8array":i.arraybuffer&&m instanceof ArrayBuffer?"arraybuffer":void 0},o.checkSupport=function(m){if(!i[m.toLowerCase()])throw new Error(m+" is not supported by this platform")},o.MAX_VALUE_16BITS=65535,o.MAX_VALUE_32BITS=-1,o.pretty=function(m){var y,g,v="";for(g=0;g<(m||"").length;g++)v+="\\x"+((y=m.charCodeAt(g))<16?"0":"")+y.toString(16).toUpperCase();return v},o.delay=function(m,y,g){setImmediate(function(){m.apply(g||null,y||[])})},o.inherits=function(m,y){function g(){}g.prototype=y.prototype,m.prototype=new g},o.extend=function(){var m,y,g={};for(m=0;m<arguments.length;m++)for(y in arguments[m])Object.prototype.hasOwnProperty.call(arguments[m],y)&&g[y]===void 0&&(g[y]=arguments[m][y]);return g},o.prepareContent=function(m,y,g,v,k){return l.Promise.resolve(y).then(function(b){return i.blob&&(b instanceof Blob||["[object File]","[object Blob]"].indexOf(Object.prototype.toString.call(b))!==-1)&&typeof FileReader<"u"?new l.Promise(function(C,D){var M=new FileReader;M.onload=function(I){C(I.target.result)},M.onerror=function(I){D(I.target.error)},M.readAsArrayBuffer(b)}):b}).then(function(b){var C=o.getTypeOf(b);return C?(C==="arraybuffer"?b=o.transformTo("uint8array",b):C==="string"&&(k?b=s.decode(b):g&&v!==!0&&(b=function(D){return u(D,i.uint8array?new Uint8Array(D.length):new Array(D.length))}(b))),b):l.Promise.reject(new Error("Can't read the data of '"+m+"'. Is it in a supported JavaScript type (String, Blob, ArrayBuffer, etc) ?"))})}},{"./base64":1,"./external":6,"./nodejsUtils":14,"./support":30,setimmediate:54}],33:[function(n,r,o){var i=n("./reader/readerFor"),s=n("./utils"),a=n("./signature"),l=n("./zipEntry"),c=n("./support");function u(d){this.files=[],this.loadOptions=d}u.prototype={checkSignature:function(d){if(!this.reader.readAndCheckSignature(d)){this.reader.index-=4;var p=this.reader.readString(4);throw new Error("Corrupted zip or bug: unexpected signature ("+s.pretty(p)+", expected "+s.pretty(d)+")")}},isSignature:function(d,p){var f=this.reader.index;this.reader.setIndex(d);var h=this.reader.readString(4)===p;return this.reader.setIndex(f),h},readBlockEndOfCentral:function(){this.diskNumber=this.reader.readInt(2),this.diskWithCentralDirStart=this.reader.readInt(2),this.centralDirRecordsOnThisDisk=this.reader.readInt(2),this.centralDirRecords=this.reader.readInt(2),this.centralDirSize=this.reader.readInt(4),this.centralDirOffset=this.reader.readInt(4),this.zipCommentLength=this.reader.readInt(2);var d=this.reader.readData(this.zipCommentLength),p=c.uint8array?"uint8array":"array",f=s.transformTo(p,d);this.zipComment=this.loadOptions.decodeFileName(f)},readBlockZip64EndOfCentral:function(){this.zip64EndOfCentralSize=this.reader.readInt(8),this.reader.skip(4),this.diskNumber=this.reader.readInt(4),this.diskWithCentralDirStart=this.reader.readInt(4),this.centralDirRecordsOnThisDisk=this.reader.readInt(8),this.centralDirRecords=this.reader.readInt(8),this.centralDirSize=this.reader.readInt(8),this.centralDirOffset=this.reader.readInt(8),this.zip64ExtensibleData={};for(var d,p,f,h=this.zip64EndOfCentralSize-44;0<h;)d=this.reader.readInt(2),p=this.reader.readInt(4),f=this.reader.readData(p),this.zip64ExtensibleData[d]={id:d,length:p,value:f}},readBlockZip64EndOfCentralLocator:function(){if(this.diskWithZip64CentralDirStart=this.reader.readInt(4),this.relativeOffsetEndOfZip64CentralDir=this.reader.readInt(8),this.disksCount=this.reader.readInt(4),1<this.disksCount)throw new Error("Multi-volumes zip are not supported")},readLocalFiles:function(){var d,p;for(d=0;d<this.files.length;d++)p=this.files[d],this.reader.setIndex(p.localHeaderOffset),this.checkSignature(a.LOCAL_FILE_HEADER),p.readLocalPart(this.reader),p.handleUTF8(),p.processAttributes()},readCentralDir:function(){var d;for(this.reader.setIndex(this.centralDirOffset);this.reader.readAndCheckSignature(a.CENTRAL_FILE_HEADER);)(d=new l({zip64:this.zip64},this.loadOptions)).readCentralPart(this.reader),this.files.push(d);if(this.centralDirRecords!==this.files.length&&this.centralDirRecords!==0&&this.files.length===0)throw new Error("Corrupted zip or bug: expected "+this.centralDirRecords+" records in central dir, got "+this.files.length)},readEndOfCentral:function(){var d=this.reader.lastIndexOfSignature(a.CENTRAL_DIRECTORY_END);if(d<0)throw this.isSignature(0,a.LOCAL_FILE_HEADER)?new Error("Corrupted zip: can't find end of central directory"):new Error("Can't find end of central directory : is this a zip file ? If it is, see https://stuk.github.io/jszip/documentation/howto/read_zip.html");this.reader.setIndex(d);var p=d;if(this.checkSignature(a.CENTRAL_DIRECTORY_END),this.readBlockEndOfCentral(),this.diskNumber===s.MAX_VALUE_16BITS||this.diskWithCentralDirStart===s.MAX_VALUE_16BITS||this.centralDirRecordsOnThisDisk===s.MAX_VALUE_16BITS||this.centralDirRecords===s.MAX_VALUE_16BITS||this.centralDirSize===s.MAX_VALUE_32BITS||this.centralDirOffset===s.MAX_VALUE_32BITS){if(this.zip64=!0,(d=this.reader.lastIndexOfSignature(a.ZIP64_CENTRAL_DIRECTORY_LOCATOR))<0)throw new Error("Corrupted zip: can't find the ZIP64 end of central directory locator");if(this.reader.setIndex(d),this.checkSignature(a.ZIP64_CENTRAL_DIRECTORY_LOCATOR),this.readBlockZip64EndOfCentralLocator(),!this.isSignature(this.relativeOffsetEndOfZip64CentralDir,a.ZIP64_CENTRAL_DIRECTORY_END)&&(this.relativeOffsetEndOfZip64CentralDir=this.reader.lastIndexOfSignature(a.ZIP64_CENTRAL_DIRECTORY_END),this.relativeOffsetEndOfZip64CentralDir<0))throw new Error("Corrupted zip: can't find the ZIP64 end of central directory");this.reader.setIndex(this.relativeOffsetEndOfZip64CentralDir),this.checkSignature(a.ZIP64_CENTRAL_DIRECTORY_END),this.readBlockZip64EndOfCentral()}var f=this.centralDirOffset+this.centralDirSize;this.zip64&&(f+=20,f+=12+this.zip64EndOfCentralSize);var h=p-f;if(0<h)this.isSignature(p,a.CENTRAL_FILE_HEADER)||(this.reader.zero=h);else if(h<0)throw new Error("Corrupted zip: missing "+Math.abs(h)+" bytes.")},prepareReader:function(d){this.reader=i(d)},load:function(d){this.prepareReader(d),this.readEndOfCentral(),this.readCentralDir(),this.readLocalFiles()}},r.exports=u},{"./reader/readerFor":22,"./signature":23,"./support":30,"./utils":32,"./zipEntry":34}],34:[function(n,r,o){var i=n("./reader/readerFor"),s=n("./utils"),a=n("./compressedObject"),l=n("./crc32"),c=n("./utf8"),u=n("./compressions"),d=n("./support");function p(f,h){this.options=f,this.loadOptions=h}p.prototype={isEncrypted:function(){return(1&this.bitFlag)==1},useUTF8:function(){return(2048&this.bitFlag)==2048},readLocalPart:function(f){var h,m;if(f.skip(22),this.fileNameLength=f.readInt(2),m=f.readInt(2),this.fileName=f.readData(this.fileNameLength),f.skip(m),this.compressedSize===-1||this.uncompressedSize===-1)throw new Error("Bug or corrupted zip : didn't get enough information from the central directory (compressedSize === -1 || uncompressedSize === -1)");if((h=function(y){for(var g in u)if(Object.prototype.hasOwnProperty.call(u,g)&&u[g].magic===y)return u[g];return null}(this.compressionMethod))===null)throw new Error("Corrupted zip : compression "+s.pretty(this.compressionMethod)+" unknown (inner file : "+s.transformTo("string",this.fileName)+")");this.decompressed=new a(this.compressedSize,this.uncompressedSize,this.crc32,h,f.readData(this.compressedSize))},readCentralPart:function(f){this.versionMadeBy=f.readInt(2),f.skip(2),this.bitFlag=f.readInt(2),this.compressionMethod=f.readString(2),this.date=f.readDate(),this.crc32=f.readInt(4),this.compressedSize=f.readInt(4),this.uncompressedSize=f.readInt(4);var h=f.readInt(2);if(this.extraFieldsLength=f.readInt(2),this.fileCommentLength=f.readInt(2),this.diskNumberStart=f.readInt(2),this.internalFileAttributes=f.readInt(2),this.externalFileAttributes=f.readInt(4),this.localHeaderOffset=f.readInt(4),this.isEncrypted())throw new Error("Encrypted zip are not supported");f.skip(h),this.readExtraFields(f),this.parseZIP64ExtraField(f),this.fileComment=f.readData(this.fileCommentLength)},processAttributes:function(){this.unixPermissions=null,this.dosPermissions=null;var f=this.versionMadeBy>>8;this.dir=!!(16&this.externalFileAttributes),f==0&&(this.dosPermissions=63&this.externalFileAttributes),f==3&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||this.fileNameStr.slice(-1)!=="/"||(this.dir=!0)},parseZIP64ExtraField:function(){if(this.extraFields[1]){var f=i(this.extraFields[1].value);this.uncompressedSize===s.MAX_VALUE_32BITS&&(this.uncompressedSize=f.readInt(8)),this.compressedSize===s.MAX_VALUE_32BITS&&(this.compressedSize=f.readInt(8)),this.localHeaderOffset===s.MAX_VALUE_32BITS&&(this.localHeaderOffset=f.readInt(8)),this.diskNumberStart===s.MAX_VALUE_32BITS&&(this.diskNumberStart=f.readInt(4))}},readExtraFields:function(f){var h,m,y,g=f.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});f.index+4<g;)h=f.readInt(2),m=f.readInt(2),y=f.readData(m),this.extraFields[h]={id:h,length:m,value:y};f.setIndex(g)},handleUTF8:function(){var f=d.uint8array?"uint8array":"array";if(this.useUTF8())this.fileNameStr=c.utf8decode(this.fileName),this.fileCommentStr=c.utf8decode(this.fileComment);else{var h=this.findExtraFieldUnicodePath();if(h!==null)this.fileNameStr=h;else{var m=s.transformTo(f,this.fileName);this.fileNameStr=this.loadOptions.decodeFileName(m)}var y=this.findExtraFieldUnicodeComment();if(y!==null)this.fileCommentStr=y;else{var g=s.transformTo(f,this.fileComment);this.fileCommentStr=this.loadOptions.decodeFileName(g)}}},findExtraFieldUnicodePath:function(){var f=this.extraFields[28789];if(f){var h=i(f.value);return h.readInt(1)!==1||l(this.fileName)!==h.readInt(4)?null:c.utf8decode(h.readData(f.length-5))}return null},findExtraFieldUnicodeComment:function(){var f=this.extraFields[25461];if(f){var h=i(f.value);return h.readInt(1)!==1||l(this.fileComment)!==h.readInt(4)?null:c.utf8decode(h.readData(f.length-5))}return null}},r.exports=p},{"./compressedObject":2,"./compressions":3,"./crc32":4,"./reader/readerFor":22,"./support":30,"./utf8":31,"./utils":32}],35:[function(n,r,o){function i(h,m,y){this.name=h,this.dir=y.dir,this.date=y.date,this.comment=y.comment,this.unixPermissions=y.unixPermissions,this.dosPermissions=y.dosPermissions,this._data=m,this._dataBinary=y.binary,this.options={compression:y.compression,compressionOptions:y.compressionOptions}}var s=n("./stream/StreamHelper"),a=n("./stream/DataWorker"),l=n("./utf8"),c=n("./compressedObject"),u=n("./stream/GenericWorker");i.prototype={internalStream:function(h){var m=null,y="string";try{if(!h)throw new Error("No output type specified.");var g=(y=h.toLowerCase())==="string"||y==="text";y!=="binarystring"&&y!=="text"||(y="string"),m=this._decompressWorker();var v=!this._dataBinary;v&&!g&&(m=m.pipe(new l.Utf8EncodeWorker)),!v&&g&&(m=m.pipe(new l.Utf8DecodeWorker))}catch(k){(m=new u("error")).error(k)}return new s(m,y,"")},async:function(h,m){return this.internalStream(h).accumulate(m)},nodeStream:function(h,m){return this.internalStream(h||"nodebuffer").toNodejsStream(m)},_compressWorker:function(h,m){if(this._data instanceof c&&this._data.compression.magic===h.magic)return this._data.getCompressedWorker();var y=this._decompressWorker();return this._dataBinary||(y=y.pipe(new l.Utf8EncodeWorker)),c.createWorkerFrom(y,h,m)},_decompressWorker:function(){return this._data instanceof c?this._data.getContentWorker():this._data instanceof u?this._data:new a(this._data)}};for(var d=["asText","asBinary","asNodeBuffer","asUint8Array","asArrayBuffer"],p=function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},f=0;f<d.length;f++)i.prototype[d[f]]=p;r.exports=i},{"./compressedObject":2,"./stream/DataWorker":27,"./stream/GenericWorker":28,"./stream/StreamHelper":29,"./utf8":31}],36:[function(n,r,o){(function(i){var s,a,l=i.MutationObserver||i.WebKitMutationObserver;if(l){var c=0,u=new l(h),d=i.document.createTextNode("");u.observe(d,{characterData:!0}),s=function(){d.data=c=++c%2}}else if(i.setImmediate||i.MessageChannel===void 0)s="document"in i&&"onreadystatechange"in i.document.createElement("script")?function(){var m=i.document.createElement("script");m.onreadystatechange=function(){h(),m.onreadystatechange=null,m.parentNode.removeChild(m),m=null},i.document.documentElement.appendChild(m)}:function(){setTimeout(h,0)};else{var p=new i.MessageChannel;p.port1.onmessage=h,s=function(){p.port2.postMessage(0)}}var f=[];function h(){var m,y;a=!0;for(var g=f.length;g;){for(y=f,f=[],m=-1;++m<g;)y[m]();g=f.length}a=!1}r.exports=function(m){f.push(m)!==1||a||s()}}).call(this,typeof zt<"u"?zt:typeof self<"u"?self:typeof window<"u"?window:{})},{}],37:[function(n,r,o){var i=n("immediate");function s(){}var a={},l=["REJECTED"],c=["FULFILLED"],u=["PENDING"];function d(g){if(typeof g!="function")throw new TypeError("resolver must be a function");this.state=u,this.queue=[],this.outcome=void 0,g!==s&&m(this,g)}function p(g,v,k){this.promise=g,typeof v=="function"&&(this.onFulfilled=v,this.callFulfilled=this.otherCallFulfilled),typeof k=="function"&&(this.onRejected=k,this.callRejected=this.otherCallRejected)}function f(g,v,k){i(function(){var b;try{b=v(k)}catch(C){return a.reject(g,C)}b===g?a.reject(g,new TypeError("Cannot resolve promise with itself")):a.resolve(g,b)})}function h(g){var v=g&&g.then;if(g&&(typeof g=="object"||typeof g=="function")&&typeof v=="function")return function(){v.apply(g,arguments)}}function m(g,v){var k=!1;function b(M){k||(k=!0,a.reject(g,M))}function C(M){k||(k=!0,a.resolve(g,M))}var D=y(function(){v(C,b)});D.status==="error"&&b(D.value)}function y(g,v){var k={};try{k.value=g(v),k.status="success"}catch(b){k.status="error",k.value=b}return k}(r.exports=d).prototype.finally=function(g){if(typeof g!="function")return this;var v=this.constructor;return this.then(function(k){return v.resolve(g()).then(function(){return k})},function(k){return v.resolve(g()).then(function(){throw k})})},d.prototype.catch=function(g){return this.then(null,g)},d.prototype.then=function(g,v){if(typeof g!="function"&&this.state===c||typeof v!="function"&&this.state===l)return this;var k=new this.constructor(s);return this.state!==u?f(k,this.state===c?g:v,this.outcome):this.queue.push(new p(k,g,v)),k},p.prototype.callFulfilled=function(g){a.resolve(this.promise,g)},p.prototype.otherCallFulfilled=function(g){f(this.promise,this.onFulfilled,g)},p.prototype.callRejected=function(g){a.reject(this.promise,g)},p.prototype.otherCallRejected=function(g){f(this.promise,this.onRejected,g)},a.resolve=function(g,v){var k=y(h,v);if(k.status==="error")return a.reject(g,k.value);var b=k.value;if(b)m(g,b);else{g.state=c,g.outcome=v;for(var C=-1,D=g.queue.length;++C<D;)g.queue[C].callFulfilled(v)}return g},a.reject=function(g,v){g.state=l,g.outcome=v;for(var k=-1,b=g.queue.length;++k<b;)g.queue[k].callRejected(v);return g},d.resolve=function(g){return g instanceof this?g:a.resolve(new this(s),g)},d.reject=function(g){var v=new this(s);return a.reject(v,g)},d.all=function(g){var v=this;if(Object.prototype.toString.call(g)!=="[object Array]")return this.reject(new TypeError("must be an array"));var k=g.length,b=!1;if(!k)return this.resolve([]);for(var C=new Array(k),D=0,M=-1,I=new this(s);++M<k;)E(g[M],M);return I;function E(G,oe){v.resolve(G).then(function(N){C[oe]=N,++D!==k||b||(b=!0,a.resolve(I,C))},function(N){b||(b=!0,a.reject(I,N))})}},d.race=function(g){var v=this;if(Object.prototype.toString.call(g)!=="[object Array]")return this.reject(new TypeError("must be an array"));var k=g.length,b=!1;if(!k)return this.resolve([]);for(var C=-1,D=new this(s);++C<k;)M=g[C],v.resolve(M).then(function(I){b||(b=!0,a.resolve(D,I))},function(I){b||(b=!0,a.reject(D,I))});var M;return D}},{immediate:36}],38:[function(n,r,o){var i={};(0,n("./lib/utils/common").assign)(i,n("./lib/deflate"),n("./lib/inflate"),n("./lib/zlib/constants")),r.exports=i},{"./lib/deflate":39,"./lib/inflate":40,"./lib/utils/common":41,"./lib/zlib/constants":44}],39:[function(n,r,o){var i=n("./zlib/deflate"),s=n("./utils/common"),a=n("./utils/strings"),l=n("./zlib/messages"),c=n("./zlib/zstream"),u=Object.prototype.toString,d=0,p=-1,f=0,h=8;function m(g){if(!(this instanceof m))return new m(g);this.options=s.assign({level:p,method:h,chunkSize:16384,windowBits:15,memLevel:8,strategy:f,to:""},g||{});var v=this.options;v.raw&&0<v.windowBits?v.windowBits=-v.windowBits:v.gzip&&0<v.windowBits&&v.windowBits<16&&(v.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new c,this.strm.avail_out=0;var k=i.deflateInit2(this.strm,v.level,v.method,v.windowBits,v.memLevel,v.strategy);if(k!==d)throw new Error(l[k]);if(v.header&&i.deflateSetHeader(this.strm,v.header),v.dictionary){var b;if(b=typeof v.dictionary=="string"?a.string2buf(v.dictionary):u.call(v.dictionary)==="[object ArrayBuffer]"?new Uint8Array(v.dictionary):v.dictionary,(k=i.deflateSetDictionary(this.strm,b))!==d)throw new Error(l[k]);this._dict_set=!0}}function y(g,v){var k=new m(v);if(k.push(g,!0),k.err)throw k.msg||l[k.err];return k.result}m.prototype.push=function(g,v){var k,b,C=this.strm,D=this.options.chunkSize;if(this.ended)return!1;b=v===~~v?v:v===!0?4:0,typeof g=="string"?C.input=a.string2buf(g):u.call(g)==="[object ArrayBuffer]"?C.input=new Uint8Array(g):C.input=g,C.next_in=0,C.avail_in=C.input.length;do{if(C.avail_out===0&&(C.output=new s.Buf8(D),C.next_out=0,C.avail_out=D),(k=i.deflate(C,b))!==1&&k!==d)return this.onEnd(k),!(this.ended=!0);C.avail_out!==0&&(C.avail_in!==0||b!==4&&b!==2)||(this.options.to==="string"?this.onData(a.buf2binstring(s.shrinkBuf(C.output,C.next_out))):this.onData(s.shrinkBuf(C.output,C.next_out)))}while((0<C.avail_in||C.avail_out===0)&&k!==1);return b===4?(k=i.deflateEnd(this.strm),this.onEnd(k),this.ended=!0,k===d):b!==2||(this.onEnd(d),!(C.avail_out=0))},m.prototype.onData=function(g){this.chunks.push(g)},m.prototype.onEnd=function(g){g===d&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=s.flattenChunks(this.chunks)),this.chunks=[],this.err=g,this.msg=this.strm.msg},o.Deflate=m,o.deflate=y,o.deflateRaw=function(g,v){return(v=v||{}).raw=!0,y(g,v)},o.gzip=function(g,v){return(v=v||{}).gzip=!0,y(g,v)}},{"./utils/common":41,"./utils/strings":42,"./zlib/deflate":46,"./zlib/messages":51,"./zlib/zstream":53}],40:[function(n,r,o){var i=n("./zlib/inflate"),s=n("./utils/common"),a=n("./utils/strings"),l=n("./zlib/constants"),c=n("./zlib/messages"),u=n("./zlib/zstream"),d=n("./zlib/gzheader"),p=Object.prototype.toString;function f(m){if(!(this instanceof f))return new f(m);this.options=s.assign({chunkSize:16384,windowBits:0,to:""},m||{});var y=this.options;y.raw&&0<=y.windowBits&&y.windowBits<16&&(y.windowBits=-y.windowBits,y.windowBits===0&&(y.windowBits=-15)),!(0<=y.windowBits&&y.windowBits<16)||m&&m.windowBits||(y.windowBits+=32),15<y.windowBits&&y.windowBits<48&&!(15&y.windowBits)&&(y.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new u,this.strm.avail_out=0;var g=i.inflateInit2(this.strm,y.windowBits);if(g!==l.Z_OK)throw new Error(c[g]);this.header=new d,i.inflateGetHeader(this.strm,this.header)}function h(m,y){var g=new f(y);if(g.push(m,!0),g.err)throw g.msg||c[g.err];return g.result}f.prototype.push=function(m,y){var g,v,k,b,C,D,M=this.strm,I=this.options.chunkSize,E=this.options.dictionary,G=!1;if(this.ended)return!1;v=y===~~y?y:y===!0?l.Z_FINISH:l.Z_NO_FLUSH,typeof m=="string"?M.input=a.binstring2buf(m):p.call(m)==="[object ArrayBuffer]"?M.input=new Uint8Array(m):M.input=m,M.next_in=0,M.avail_in=M.input.length;do{if(M.avail_out===0&&(M.output=new s.Buf8(I),M.next_out=0,M.avail_out=I),(g=i.inflate(M,l.Z_NO_FLUSH))===l.Z_NEED_DICT&&E&&(D=typeof E=="string"?a.string2buf(E):p.call(E)==="[object ArrayBuffer]"?new Uint8Array(E):E,g=i.inflateSetDictionary(this.strm,D)),g===l.Z_BUF_ERROR&&G===!0&&(g=l.Z_OK,G=!1),g!==l.Z_STREAM_END&&g!==l.Z_OK)return this.onEnd(g),!(this.ended=!0);M.next_out&&(M.avail_out!==0&&g!==l.Z_STREAM_END&&(M.avail_in!==0||v!==l.Z_FINISH&&v!==l.Z_SYNC_FLUSH)||(this.options.to==="string"?(k=a.utf8border(M.output,M.next_out),b=M.next_out-k,C=a.buf2string(M.output,k),M.next_out=b,M.avail_out=I-b,b&&s.arraySet(M.output,M.output,k,b,0),this.onData(C)):this.onData(s.shrinkBuf(M.output,M.next_out)))),M.avail_in===0&&M.avail_out===0&&(G=!0)}while((0<M.avail_in||M.avail_out===0)&&g!==l.Z_STREAM_END);return g===l.Z_STREAM_END&&(v=l.Z_FINISH),v===l.Z_FINISH?(g=i.inflateEnd(this.strm),this.onEnd(g),this.ended=!0,g===l.Z_OK):v!==l.Z_SYNC_FLUSH||(this.onEnd(l.Z_OK),!(M.avail_out=0))},f.prototype.onData=function(m){this.chunks.push(m)},f.prototype.onEnd=function(m){m===l.Z_OK&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=s.flattenChunks(this.chunks)),this.chunks=[],this.err=m,this.msg=this.strm.msg},o.Inflate=f,o.inflate=h,o.inflateRaw=function(m,y){return(y=y||{}).raw=!0,h(m,y)},o.ungzip=h},{"./utils/common":41,"./utils/strings":42,"./zlib/constants":44,"./zlib/gzheader":47,"./zlib/inflate":49,"./zlib/messages":51,"./zlib/zstream":53}],41:[function(n,r,o){var i=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Int32Array<"u";o.assign=function(l){for(var c=Array.prototype.slice.call(arguments,1);c.length;){var u=c.shift();if(u){if(typeof u!="object")throw new TypeError(u+"must be non-object");for(var d in u)u.hasOwnProperty(d)&&(l[d]=u[d])}}return l},o.shrinkBuf=function(l,c){return l.length===c?l:l.subarray?l.subarray(0,c):(l.length=c,l)};var s={arraySet:function(l,c,u,d,p){if(c.subarray&&l.subarray)l.set(c.subarray(u,u+d),p);else for(var f=0;f<d;f++)l[p+f]=c[u+f]},flattenChunks:function(l){var c,u,d,p,f,h;for(c=d=0,u=l.length;c<u;c++)d+=l[c].length;for(h=new Uint8Array(d),c=p=0,u=l.length;c<u;c++)f=l[c],h.set(f,p),p+=f.length;return h}},a={arraySet:function(l,c,u,d,p){for(var f=0;f<d;f++)l[p+f]=c[u+f]},flattenChunks:function(l){return[].concat.apply([],l)}};o.setTyped=function(l){l?(o.Buf8=Uint8Array,o.Buf16=Uint16Array,o.Buf32=Int32Array,o.assign(o,s)):(o.Buf8=Array,o.Buf16=Array,o.Buf32=Array,o.assign(o,a))},o.setTyped(i)},{}],42:[function(n,r,o){var i=n("./common"),s=!0,a=!0;try{String.fromCharCode.apply(null,[0])}catch{s=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch{a=!1}for(var l=new i.Buf8(256),c=0;c<256;c++)l[c]=252<=c?6:248<=c?5:240<=c?4:224<=c?3:192<=c?2:1;function u(d,p){if(p<65537&&(d.subarray&&a||!d.subarray&&s))return String.fromCharCode.apply(null,i.shrinkBuf(d,p));for(var f="",h=0;h<p;h++)f+=String.fromCharCode(d[h]);return f}l[254]=l[254]=1,o.string2buf=function(d){var p,f,h,m,y,g=d.length,v=0;for(m=0;m<g;m++)(64512&(f=d.charCodeAt(m)))==55296&&m+1<g&&(64512&(h=d.charCodeAt(m+1)))==56320&&(f=65536+(f-55296<<10)+(h-56320),m++),v+=f<128?1:f<2048?2:f<65536?3:4;for(p=new i.Buf8(v),m=y=0;y<v;m++)(64512&(f=d.charCodeAt(m)))==55296&&m+1<g&&(64512&(h=d.charCodeAt(m+1)))==56320&&(f=65536+(f-55296<<10)+(h-56320),m++),f<128?p[y++]=f:(f<2048?p[y++]=192|f>>>6:(f<65536?p[y++]=224|f>>>12:(p[y++]=240|f>>>18,p[y++]=128|f>>>12&63),p[y++]=128|f>>>6&63),p[y++]=128|63&f);return p},o.buf2binstring=function(d){return u(d,d.length)},o.binstring2buf=function(d){for(var p=new i.Buf8(d.length),f=0,h=p.length;f<h;f++)p[f]=d.charCodeAt(f);return p},o.buf2string=function(d,p){var f,h,m,y,g=p||d.length,v=new Array(2*g);for(f=h=0;f<g;)if((m=d[f++])<128)v[h++]=m;else if(4<(y=l[m]))v[h++]=65533,f+=y-1;else{for(m&=y===2?31:y===3?15:7;1<y&&f<g;)m=m<<6|63&d[f++],y--;1<y?v[h++]=65533:m<65536?v[h++]=m:(m-=65536,v[h++]=55296|m>>10&1023,v[h++]=56320|1023&m)}return u(v,h)},o.utf8border=function(d,p){var f;for((p=p||d.length)>d.length&&(p=d.length),f=p-1;0<=f&&(192&d[f])==128;)f--;return f<0||f===0?p:f+l[d[f]]>p?f:p}},{"./common":41}],43:[function(n,r,o){r.exports=function(i,s,a,l){for(var c=65535&i|0,u=i>>>16&65535|0,d=0;a!==0;){for(a-=d=2e3<a?2e3:a;u=u+(c=c+s[l++]|0)|0,--d;);c%=65521,u%=65521}return c|u<<16|0}},{}],44:[function(n,r,o){r.exports={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8}},{}],45:[function(n,r,o){var i=function(){for(var s,a=[],l=0;l<256;l++){s=l;for(var c=0;c<8;c++)s=1&s?3988292384^s>>>1:s>>>1;a[l]=s}return a}();r.exports=function(s,a,l,c){var u=i,d=c+l;s^=-1;for(var p=c;p<d;p++)s=s>>>8^u[255&(s^a[p])];return-1^s}},{}],46:[function(n,r,o){var i,s=n("../utils/common"),a=n("./trees"),l=n("./adler32"),c=n("./crc32"),u=n("./messages"),d=0,p=4,f=0,h=-2,m=-1,y=4,g=2,v=8,k=9,b=286,C=30,D=19,M=2*b+1,I=15,E=3,G=258,oe=G+E+1,N=42,H=113,A=1,J=2,ie=3,W=4;function ce(S,re){return S.msg=u[re],re}function X(S){return(S<<1)-(4<S?9:0)}function ue(S){for(var re=S.length;0<=--re;)S[re]=0}function Z(S){var re=S.state,Q=re.pending;Q>S.avail_out&&(Q=S.avail_out),Q!==0&&(s.arraySet(S.output,re.pending_buf,re.pending_out,Q,S.next_out),S.next_out+=Q,re.pending_out+=Q,S.total_out+=Q,S.avail_out-=Q,re.pending-=Q,re.pending===0&&(re.pending_out=0))}function R(S,re){a._tr_flush_block(S,0<=S.block_start?S.block_start:-1,S.strstart-S.block_start,re),S.block_start=S.strstart,Z(S.strm)}function ee(S,re){S.pending_buf[S.pending++]=re}function ne(S,re){S.pending_buf[S.pending++]=re>>>8&255,S.pending_buf[S.pending++]=255&re}function se(S,re){var Q,z,V=S.max_chain_length,j=S.strstart,de=S.prev_length,fe=S.nice_match,ae=S.strstart>S.w_size-oe?S.strstart-(S.w_size-oe):0,me=S.window,we=S.w_mask,he=S.prev,be=S.strstart+G,ze=me[j+de-1],Ce=me[j+de];S.prev_length>=S.good_match&&(V>>=2),fe>S.lookahead&&(fe=S.lookahead);do if(me[(Q=re)+de]===Ce&&me[Q+de-1]===ze&&me[Q]===me[j]&&me[++Q]===me[j+1]){j+=2,Q++;do;while(me[++j]===me[++Q]&&me[++j]===me[++Q]&&me[++j]===me[++Q]&&me[++j]===me[++Q]&&me[++j]===me[++Q]&&me[++j]===me[++Q]&&me[++j]===me[++Q]&&me[++j]===me[++Q]&&j<be);if(z=G-(be-j),j=be-G,de<z){if(S.match_start=re,fe<=(de=z))break;ze=me[j+de-1],Ce=me[j+de]}}while((re=he[re&we])>ae&&--V!=0);return de<=S.lookahead?de:S.lookahead}function Y(S){var re,Q,z,V,j,de,fe,ae,me,we,he=S.w_size;do{if(V=S.window_size-S.lookahead-S.strstart,S.strstart>=he+(he-oe)){for(s.arraySet(S.window,S.window,he,he,0),S.match_start-=he,S.strstart-=he,S.block_start-=he,re=Q=S.hash_size;z=S.head[--re],S.head[re]=he<=z?z-he:0,--Q;);for(re=Q=he;z=S.prev[--re],S.prev[re]=he<=z?z-he:0,--Q;);V+=he}if(S.strm.avail_in===0)break;if(de=S.strm,fe=S.window,ae=S.strstart+S.lookahead,me=V,we=void 0,we=de.avail_in,me<we&&(we=me),Q=we===0?0:(de.avail_in-=we,s.arraySet(fe,de.input,de.next_in,we,ae),de.state.wrap===1?de.adler=l(de.adler,fe,we,ae):de.state.wrap===2&&(de.adler=c(de.adler,fe,we,ae)),de.next_in+=we,de.total_in+=we,we),S.lookahead+=Q,S.lookahead+S.insert>=E)for(j=S.strstart-S.insert,S.ins_h=S.window[j],S.ins_h=(S.ins_h<<S.hash_shift^S.window[j+1])&S.hash_mask;S.insert&&(S.ins_h=(S.ins_h<<S.hash_shift^S.window[j+E-1])&S.hash_mask,S.prev[j&S.w_mask]=S.head[S.ins_h],S.head[S.ins_h]=j,j++,S.insert--,!(S.lookahead+S.insert<E)););}while(S.lookahead<oe&&S.strm.avail_in!==0)}function $(S,re){for(var Q,z;;){if(S.lookahead<oe){if(Y(S),S.lookahead<oe&&re===d)return A;if(S.lookahead===0)break}if(Q=0,S.lookahead>=E&&(S.ins_h=(S.ins_h<<S.hash_shift^S.window[S.strstart+E-1])&S.hash_mask,Q=S.prev[S.strstart&S.w_mask]=S.head[S.ins_h],S.head[S.ins_h]=S.strstart),Q!==0&&S.strstart-Q<=S.w_size-oe&&(S.match_length=se(S,Q)),S.match_length>=E)if(z=a._tr_tally(S,S.strstart-S.match_start,S.match_length-E),S.lookahead-=S.match_length,S.match_length<=S.max_lazy_match&&S.lookahead>=E){for(S.match_length--;S.strstart++,S.ins_h=(S.ins_h<<S.hash_shift^S.window[S.strstart+E-1])&S.hash_mask,Q=S.prev[S.strstart&S.w_mask]=S.head[S.ins_h],S.head[S.ins_h]=S.strstart,--S.match_length!=0;);S.strstart++}else S.strstart+=S.match_length,S.match_length=0,S.ins_h=S.window[S.strstart],S.ins_h=(S.ins_h<<S.hash_shift^S.window[S.strstart+1])&S.hash_mask;else z=a._tr_tally(S,0,S.window[S.strstart]),S.lookahead--,S.strstart++;if(z&&(R(S,!1),S.strm.avail_out===0))return A}return S.insert=S.strstart<E-1?S.strstart:E-1,re===p?(R(S,!0),S.strm.avail_out===0?ie:W):S.last_lit&&(R(S,!1),S.strm.avail_out===0)?A:J}function T(S,re){for(var Q,z,V;;){if(S.lookahead<oe){if(Y(S),S.lookahead<oe&&re===d)return A;if(S.lookahead===0)break}if(Q=0,S.lookahead>=E&&(S.ins_h=(S.ins_h<<S.hash_shift^S.window[S.strstart+E-1])&S.hash_mask,Q=S.prev[S.strstart&S.w_mask]=S.head[S.ins_h],S.head[S.ins_h]=S.strstart),S.prev_length=S.match_length,S.prev_match=S.match_start,S.match_length=E-1,Q!==0&&S.prev_length<S.max_lazy_match&&S.strstart-Q<=S.w_size-oe&&(S.match_length=se(S,Q),S.match_length<=5&&(S.strategy===1||S.match_length===E&&4096<S.strstart-S.match_start)&&(S.match_length=E-1)),S.prev_length>=E&&S.match_length<=S.prev_length){for(V=S.strstart+S.lookahead-E,z=a._tr_tally(S,S.strstart-1-S.prev_match,S.prev_length-E),S.lookahead-=S.prev_length-1,S.prev_length-=2;++S.strstart<=V&&(S.ins_h=(S.ins_h<<S.hash_shift^S.window[S.strstart+E-1])&S.hash_mask,Q=S.prev[S.strstart&S.w_mask]=S.head[S.ins_h],S.head[S.ins_h]=S.strstart),--S.prev_length!=0;);if(S.match_available=0,S.match_length=E-1,S.strstart++,z&&(R(S,!1),S.strm.avail_out===0))return A}else if(S.match_available){if((z=a._tr_tally(S,0,S.window[S.strstart-1]))&&R(S,!1),S.strstart++,S.lookahead--,S.strm.avail_out===0)return A}else S.match_available=1,S.strstart++,S.lookahead--}return S.match_available&&(z=a._tr_tally(S,0,S.window[S.strstart-1]),S.match_available=0),S.insert=S.strstart<E-1?S.strstart:E-1,re===p?(R(S,!0),S.strm.avail_out===0?ie:W):S.last_lit&&(R(S,!1),S.strm.avail_out===0)?A:J}function K(S,re,Q,z,V){this.good_length=S,this.max_lazy=re,this.nice_length=Q,this.max_chain=z,this.func=V}function q(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=v,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new s.Buf16(2*M),this.dyn_dtree=new s.Buf16(2*(2*C+1)),this.bl_tree=new s.Buf16(2*(2*D+1)),ue(this.dyn_ltree),ue(this.dyn_dtree),ue(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new s.Buf16(I+1),this.heap=new s.Buf16(2*b+1),ue(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new s.Buf16(2*b+1),ue(this.depth),this.l_buf=0,this.lit_bufsize=0,this.last_lit=0,this.d_buf=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}function F(S){var re;return S&&S.state?(S.total_in=S.total_out=0,S.data_type=g,(re=S.state).pending=0,re.pending_out=0,re.wrap<0&&(re.wrap=-re.wrap),re.status=re.wrap?N:H,S.adler=re.wrap===2?0:1,re.last_flush=d,a._tr_init(re),f):ce(S,h)}function L(S){var re=F(S);return re===f&&function(Q){Q.window_size=2*Q.w_size,ue(Q.head),Q.max_lazy_match=i[Q.level].max_lazy,Q.good_match=i[Q.level].good_length,Q.nice_match=i[Q.level].nice_length,Q.max_chain_length=i[Q.level].max_chain,Q.strstart=0,Q.block_start=0,Q.lookahead=0,Q.insert=0,Q.match_length=Q.prev_length=E-1,Q.match_available=0,Q.ins_h=0}(S.state),re}function le(S,re,Q,z,V,j){if(!S)return h;var de=1;if(re===m&&(re=6),z<0?(de=0,z=-z):15<z&&(de=2,z-=16),V<1||k<V||Q!==v||z<8||15<z||re<0||9<re||j<0||y<j)return ce(S,h);z===8&&(z=9);var fe=new q;return(S.state=fe).strm=S,fe.wrap=de,fe.gzhead=null,fe.w_bits=z,fe.w_size=1<<fe.w_bits,fe.w_mask=fe.w_size-1,fe.hash_bits=V+7,fe.hash_size=1<<fe.hash_bits,fe.hash_mask=fe.hash_size-1,fe.hash_shift=~~((fe.hash_bits+E-1)/E),fe.window=new s.Buf8(2*fe.w_size),fe.head=new s.Buf16(fe.hash_size),fe.prev=new s.Buf16(fe.w_size),fe.lit_bufsize=1<<V+6,fe.pending_buf_size=4*fe.lit_bufsize,fe.pending_buf=new s.Buf8(fe.pending_buf_size),fe.d_buf=1*fe.lit_bufsize,fe.l_buf=3*fe.lit_bufsize,fe.level=re,fe.strategy=j,fe.method=Q,L(S)}i=[new K(0,0,0,0,function(S,re){var Q=65535;for(Q>S.pending_buf_size-5&&(Q=S.pending_buf_size-5);;){if(S.lookahead<=1){if(Y(S),S.lookahead===0&&re===d)return A;if(S.lookahead===0)break}S.strstart+=S.lookahead,S.lookahead=0;var z=S.block_start+Q;if((S.strstart===0||S.strstart>=z)&&(S.lookahead=S.strstart-z,S.strstart=z,R(S,!1),S.strm.avail_out===0)||S.strstart-S.block_start>=S.w_size-oe&&(R(S,!1),S.strm.avail_out===0))return A}return S.insert=0,re===p?(R(S,!0),S.strm.avail_out===0?ie:W):(S.strstart>S.block_start&&(R(S,!1),S.strm.avail_out),A)}),new K(4,4,8,4,$),new K(4,5,16,8,$),new K(4,6,32,32,$),new K(4,4,16,16,T),new K(8,16,32,32,T),new K(8,16,128,128,T),new K(8,32,128,256,T),new K(32,128,258,1024,T),new K(32,258,258,4096,T)],o.deflateInit=function(S,re){return le(S,re,v,15,8,0)},o.deflateInit2=le,o.deflateReset=L,o.deflateResetKeep=F,o.deflateSetHeader=function(S,re){return S&&S.state?S.state.wrap!==2?h:(S.state.gzhead=re,f):h},o.deflate=function(S,re){var Q,z,V,j;if(!S||!S.state||5<re||re<0)return S?ce(S,h):h;if(z=S.state,!S.output||!S.input&&S.avail_in!==0||z.status===666&&re!==p)return ce(S,S.avail_out===0?-5:h);if(z.strm=S,Q=z.last_flush,z.last_flush=re,z.status===N)if(z.wrap===2)S.adler=0,ee(z,31),ee(z,139),ee(z,8),z.gzhead?(ee(z,(z.gzhead.text?1:0)+(z.gzhead.hcrc?2:0)+(z.gzhead.extra?4:0)+(z.gzhead.name?8:0)+(z.gzhead.comment?16:0)),ee(z,255&z.gzhead.time),ee(z,z.gzhead.time>>8&255),ee(z,z.gzhead.time>>16&255),ee(z,z.gzhead.time>>24&255),ee(z,z.level===9?2:2<=z.strategy||z.level<2?4:0),ee(z,255&z.gzhead.os),z.gzhead.extra&&z.gzhead.extra.length&&(ee(z,255&z.gzhead.extra.length),ee(z,z.gzhead.extra.length>>8&255)),z.gzhead.hcrc&&(S.adler=c(S.adler,z.pending_buf,z.pending,0)),z.gzindex=0,z.status=69):(ee(z,0),ee(z,0),ee(z,0),ee(z,0),ee(z,0),ee(z,z.level===9?2:2<=z.strategy||z.level<2?4:0),ee(z,3),z.status=H);else{var de=v+(z.w_bits-8<<4)<<8;de|=(2<=z.strategy||z.level<2?0:z.level<6?1:z.level===6?2:3)<<6,z.strstart!==0&&(de|=32),de+=31-de%31,z.status=H,ne(z,de),z.strstart!==0&&(ne(z,S.adler>>>16),ne(z,65535&S.adler)),S.adler=1}if(z.status===69)if(z.gzhead.extra){for(V=z.pending;z.gzindex<(65535&z.gzhead.extra.length)&&(z.pending!==z.pending_buf_size||(z.gzhead.hcrc&&z.pending>V&&(S.adler=c(S.adler,z.pending_buf,z.pending-V,V)),Z(S),V=z.pending,z.pending!==z.pending_buf_size));)ee(z,255&z.gzhead.extra[z.gzindex]),z.gzindex++;z.gzhead.hcrc&&z.pending>V&&(S.adler=c(S.adler,z.pending_buf,z.pending-V,V)),z.gzindex===z.gzhead.extra.length&&(z.gzindex=0,z.status=73)}else z.status=73;if(z.status===73)if(z.gzhead.name){V=z.pending;do{if(z.pending===z.pending_buf_size&&(z.gzhead.hcrc&&z.pending>V&&(S.adler=c(S.adler,z.pending_buf,z.pending-V,V)),Z(S),V=z.pending,z.pending===z.pending_buf_size)){j=1;break}j=z.gzindex<z.gzhead.name.length?255&z.gzhead.name.charCodeAt(z.gzindex++):0,ee(z,j)}while(j!==0);z.gzhead.hcrc&&z.pending>V&&(S.adler=c(S.adler,z.pending_buf,z.pending-V,V)),j===0&&(z.gzindex=0,z.status=91)}else z.status=91;if(z.status===91)if(z.gzhead.comment){V=z.pending;do{if(z.pending===z.pending_buf_size&&(z.gzhead.hcrc&&z.pending>V&&(S.adler=c(S.adler,z.pending_buf,z.pending-V,V)),Z(S),V=z.pending,z.pending===z.pending_buf_size)){j=1;break}j=z.gzindex<z.gzhead.comment.length?255&z.gzhead.comment.charCodeAt(z.gzindex++):0,ee(z,j)}while(j!==0);z.gzhead.hcrc&&z.pending>V&&(S.adler=c(S.adler,z.pending_buf,z.pending-V,V)),j===0&&(z.status=103)}else z.status=103;if(z.status===103&&(z.gzhead.hcrc?(z.pending+2>z.pending_buf_size&&Z(S),z.pending+2<=z.pending_buf_size&&(ee(z,255&S.adler),ee(z,S.adler>>8&255),S.adler=0,z.status=H)):z.status=H),z.pending!==0){if(Z(S),S.avail_out===0)return z.last_flush=-1,f}else if(S.avail_in===0&&X(re)<=X(Q)&&re!==p)return ce(S,-5);if(z.status===666&&S.avail_in!==0)return ce(S,-5);if(S.avail_in!==0||z.lookahead!==0||re!==d&&z.status!==666){var fe=z.strategy===2?function(ae,me){for(var we;;){if(ae.lookahead===0&&(Y(ae),ae.lookahead===0)){if(me===d)return A;break}if(ae.match_length=0,we=a._tr_tally(ae,0,ae.window[ae.strstart]),ae.lookahead--,ae.strstart++,we&&(R(ae,!1),ae.strm.avail_out===0))return A}return ae.insert=0,me===p?(R(ae,!0),ae.strm.avail_out===0?ie:W):ae.last_lit&&(R(ae,!1),ae.strm.avail_out===0)?A:J}(z,re):z.strategy===3?function(ae,me){for(var we,he,be,ze,Ce=ae.window;;){if(ae.lookahead<=G){if(Y(ae),ae.lookahead<=G&&me===d)return A;if(ae.lookahead===0)break}if(ae.match_length=0,ae.lookahead>=E&&0<ae.strstart&&(he=Ce[be=ae.strstart-1])===Ce[++be]&&he===Ce[++be]&&he===Ce[++be]){ze=ae.strstart+G;do;while(he===Ce[++be]&&he===Ce[++be]&&he===Ce[++be]&&he===Ce[++be]&&he===Ce[++be]&&he===Ce[++be]&&he===Ce[++be]&&he===Ce[++be]&&be<ze);ae.match_length=G-(ze-be),ae.match_length>ae.lookahead&&(ae.match_length=ae.lookahead)}if(ae.match_length>=E?(we=a._tr_tally(ae,1,ae.match_length-E),ae.lookahead-=ae.match_length,ae.strstart+=ae.match_length,ae.match_length=0):(we=a._tr_tally(ae,0,ae.window[ae.strstart]),ae.lookahead--,ae.strstart++),we&&(R(ae,!1),ae.strm.avail_out===0))return A}return ae.insert=0,me===p?(R(ae,!0),ae.strm.avail_out===0?ie:W):ae.last_lit&&(R(ae,!1),ae.strm.avail_out===0)?A:J}(z,re):i[z.level].func(z,re);if(fe!==ie&&fe!==W||(z.status=666),fe===A||fe===ie)return S.avail_out===0&&(z.last_flush=-1),f;if(fe===J&&(re===1?a._tr_align(z):re!==5&&(a._tr_stored_block(z,0,0,!1),re===3&&(ue(z.head),z.lookahead===0&&(z.strstart=0,z.block_start=0,z.insert=0))),Z(S),S.avail_out===0))return z.last_flush=-1,f}return re!==p?f:z.wrap<=0?1:(z.wrap===2?(ee(z,255&S.adler),ee(z,S.adler>>8&255),ee(z,S.adler>>16&255),ee(z,S.adler>>24&255),ee(z,255&S.total_in),ee(z,S.total_in>>8&255),ee(z,S.total_in>>16&255),ee(z,S.total_in>>24&255)):(ne(z,S.adler>>>16),ne(z,65535&S.adler)),Z(S),0<z.wrap&&(z.wrap=-z.wrap),z.pending!==0?f:1)},o.deflateEnd=function(S){var re;return S&&S.state?(re=S.state.status)!==N&&re!==69&&re!==73&&re!==91&&re!==103&&re!==H&&re!==666?ce(S,h):(S.state=null,re===H?ce(S,-3):f):h},o.deflateSetDictionary=function(S,re){var Q,z,V,j,de,fe,ae,me,we=re.length;if(!S||!S.state||(j=(Q=S.state).wrap)===2||j===1&&Q.status!==N||Q.lookahead)return h;for(j===1&&(S.adler=l(S.adler,re,we,0)),Q.wrap=0,we>=Q.w_size&&(j===0&&(ue(Q.head),Q.strstart=0,Q.block_start=0,Q.insert=0),me=new s.Buf8(Q.w_size),s.arraySet(me,re,we-Q.w_size,Q.w_size,0),re=me,we=Q.w_size),de=S.avail_in,fe=S.next_in,ae=S.input,S.avail_in=we,S.next_in=0,S.input=re,Y(Q);Q.lookahead>=E;){for(z=Q.strstart,V=Q.lookahead-(E-1);Q.ins_h=(Q.ins_h<<Q.hash_shift^Q.window[z+E-1])&Q.hash_mask,Q.prev[z&Q.w_mask]=Q.head[Q.ins_h],Q.head[Q.ins_h]=z,z++,--V;);Q.strstart=z,Q.lookahead=E-1,Y(Q)}return Q.strstart+=Q.lookahead,Q.block_start=Q.strstart,Q.insert=Q.lookahead,Q.lookahead=0,Q.match_length=Q.prev_length=E-1,Q.match_available=0,S.next_in=fe,S.input=ae,S.avail_in=de,Q.wrap=j,f},o.deflateInfo="pako deflate (from Nodeca project)"},{"../utils/common":41,"./adler32":43,"./crc32":45,"./messages":51,"./trees":52}],47:[function(n,r,o){r.exports=function(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}},{}],48:[function(n,r,o){r.exports=function(i,s){var a,l,c,u,d,p,f,h,m,y,g,v,k,b,C,D,M,I,E,G,oe,N,H,A,J;a=i.state,l=i.next_in,A=i.input,c=l+(i.avail_in-5),u=i.next_out,J=i.output,d=u-(s-i.avail_out),p=u+(i.avail_out-257),f=a.dmax,h=a.wsize,m=a.whave,y=a.wnext,g=a.window,v=a.hold,k=a.bits,b=a.lencode,C=a.distcode,D=(1<<a.lenbits)-1,M=(1<<a.distbits)-1;e:do{k<15&&(v+=A[l++]<<k,k+=8,v+=A[l++]<<k,k+=8),I=b[v&D];t:for(;;){if(v>>>=E=I>>>24,k-=E,(E=I>>>16&255)===0)J[u++]=65535&I;else{if(!(16&E)){if(!(64&E)){I=b[(65535&I)+(v&(1<<E)-1)];continue t}if(32&E){a.mode=12;break e}i.msg="invalid literal/length code",a.mode=30;break e}G=65535&I,(E&=15)&&(k<E&&(v+=A[l++]<<k,k+=8),G+=v&(1<<E)-1,v>>>=E,k-=E),k<15&&(v+=A[l++]<<k,k+=8,v+=A[l++]<<k,k+=8),I=C[v&M];n:for(;;){if(v>>>=E=I>>>24,k-=E,!(16&(E=I>>>16&255))){if(!(64&E)){I=C[(65535&I)+(v&(1<<E)-1)];continue n}i.msg="invalid distance code",a.mode=30;break e}if(oe=65535&I,k<(E&=15)&&(v+=A[l++]<<k,(k+=8)<E&&(v+=A[l++]<<k,k+=8)),f<(oe+=v&(1<<E)-1)){i.msg="invalid distance too far back",a.mode=30;break e}if(v>>>=E,k-=E,(E=u-d)<oe){if(m<(E=oe-E)&&a.sane){i.msg="invalid distance too far back",a.mode=30;break e}if(H=g,(N=0)===y){if(N+=h-E,E<G){for(G-=E;J[u++]=g[N++],--E;);N=u-oe,H=J}}else if(y<E){if(N+=h+y-E,(E-=y)<G){for(G-=E;J[u++]=g[N++],--E;);if(N=0,y<G){for(G-=E=y;J[u++]=g[N++],--E;);N=u-oe,H=J}}}else if(N+=y-E,E<G){for(G-=E;J[u++]=g[N++],--E;);N=u-oe,H=J}for(;2<G;)J[u++]=H[N++],J[u++]=H[N++],J[u++]=H[N++],G-=3;G&&(J[u++]=H[N++],1<G&&(J[u++]=H[N++]))}else{for(N=u-oe;J[u++]=J[N++],J[u++]=J[N++],J[u++]=J[N++],2<(G-=3););G&&(J[u++]=J[N++],1<G&&(J[u++]=J[N++]))}break}}break}}while(l<c&&u<p);l-=G=k>>3,v&=(1<<(k-=G<<3))-1,i.next_in=l,i.next_out=u,i.avail_in=l<c?c-l+5:5-(l-c),i.avail_out=u<p?p-u+257:257-(u-p),a.hold=v,a.bits=k}},{}],49:[function(n,r,o){var i=n("../utils/common"),s=n("./adler32"),a=n("./crc32"),l=n("./inffast"),c=n("./inftrees"),u=1,d=2,p=0,f=-2,h=1,m=852,y=592;function g(N){return(N>>>24&255)+(N>>>8&65280)+((65280&N)<<8)+((255&N)<<24)}function v(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new i.Buf16(320),this.work=new i.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function k(N){var H;return N&&N.state?(H=N.state,N.total_in=N.total_out=H.total=0,N.msg="",H.wrap&&(N.adler=1&H.wrap),H.mode=h,H.last=0,H.havedict=0,H.dmax=32768,H.head=null,H.hold=0,H.bits=0,H.lencode=H.lendyn=new i.Buf32(m),H.distcode=H.distdyn=new i.Buf32(y),H.sane=1,H.back=-1,p):f}function b(N){var H;return N&&N.state?((H=N.state).wsize=0,H.whave=0,H.wnext=0,k(N)):f}function C(N,H){var A,J;return N&&N.state?(J=N.state,H<0?(A=0,H=-H):(A=1+(H>>4),H<48&&(H&=15)),H&&(H<8||15<H)?f:(J.window!==null&&J.wbits!==H&&(J.window=null),J.wrap=A,J.wbits=H,b(N))):f}function D(N,H){var A,J;return N?(J=new v,(N.state=J).window=null,(A=C(N,H))!==p&&(N.state=null),A):f}var M,I,E=!0;function G(N){if(E){var H;for(M=new i.Buf32(512),I=new i.Buf32(32),H=0;H<144;)N.lens[H++]=8;for(;H<256;)N.lens[H++]=9;for(;H<280;)N.lens[H++]=7;for(;H<288;)N.lens[H++]=8;for(c(u,N.lens,0,288,M,0,N.work,{bits:9}),H=0;H<32;)N.lens[H++]=5;c(d,N.lens,0,32,I,0,N.work,{bits:5}),E=!1}N.lencode=M,N.lenbits=9,N.distcode=I,N.distbits=5}function oe(N,H,A,J){var ie,W=N.state;return W.window===null&&(W.wsize=1<<W.wbits,W.wnext=0,W.whave=0,W.window=new i.Buf8(W.wsize)),J>=W.wsize?(i.arraySet(W.window,H,A-W.wsize,W.wsize,0),W.wnext=0,W.whave=W.wsize):(J<(ie=W.wsize-W.wnext)&&(ie=J),i.arraySet(W.window,H,A-J,ie,W.wnext),(J-=ie)?(i.arraySet(W.window,H,A-J,J,0),W.wnext=J,W.whave=W.wsize):(W.wnext+=ie,W.wnext===W.wsize&&(W.wnext=0),W.whave<W.wsize&&(W.whave+=ie))),0}o.inflateReset=b,o.inflateReset2=C,o.inflateResetKeep=k,o.inflateInit=function(N){return D(N,15)},o.inflateInit2=D,o.inflate=function(N,H){var A,J,ie,W,ce,X,ue,Z,R,ee,ne,se,Y,$,T,K,q,F,L,le,S,re,Q,z,V=0,j=new i.Buf8(4),de=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!N||!N.state||!N.output||!N.input&&N.avail_in!==0)return f;(A=N.state).mode===12&&(A.mode=13),ce=N.next_out,ie=N.output,ue=N.avail_out,W=N.next_in,J=N.input,X=N.avail_in,Z=A.hold,R=A.bits,ee=X,ne=ue,re=p;e:for(;;)switch(A.mode){case h:if(A.wrap===0){A.mode=13;break}for(;R<16;){if(X===0)break e;X--,Z+=J[W++]<<R,R+=8}if(2&A.wrap&&Z===35615){j[A.check=0]=255&Z,j[1]=Z>>>8&255,A.check=a(A.check,j,2,0),R=Z=0,A.mode=2;break}if(A.flags=0,A.head&&(A.head.done=!1),!(1&A.wrap)||(((255&Z)<<8)+(Z>>8))%31){N.msg="incorrect header check",A.mode=30;break}if((15&Z)!=8){N.msg="unknown compression method",A.mode=30;break}if(R-=4,S=8+(15&(Z>>>=4)),A.wbits===0)A.wbits=S;else if(S>A.wbits){N.msg="invalid window size",A.mode=30;break}A.dmax=1<<S,N.adler=A.check=1,A.mode=512&Z?10:12,R=Z=0;break;case 2:for(;R<16;){if(X===0)break e;X--,Z+=J[W++]<<R,R+=8}if(A.flags=Z,(255&A.flags)!=8){N.msg="unknown compression method",A.mode=30;break}if(57344&A.flags){N.msg="unknown header flags set",A.mode=30;break}A.head&&(A.head.text=Z>>8&1),512&A.flags&&(j[0]=255&Z,j[1]=Z>>>8&255,A.check=a(A.check,j,2,0)),R=Z=0,A.mode=3;case 3:for(;R<32;){if(X===0)break e;X--,Z+=J[W++]<<R,R+=8}A.head&&(A.head.time=Z),512&A.flags&&(j[0]=255&Z,j[1]=Z>>>8&255,j[2]=Z>>>16&255,j[3]=Z>>>24&255,A.check=a(A.check,j,4,0)),R=Z=0,A.mode=4;case 4:for(;R<16;){if(X===0)break e;X--,Z+=J[W++]<<R,R+=8}A.head&&(A.head.xflags=255&Z,A.head.os=Z>>8),512&A.flags&&(j[0]=255&Z,j[1]=Z>>>8&255,A.check=a(A.check,j,2,0)),R=Z=0,A.mode=5;case 5:if(1024&A.flags){for(;R<16;){if(X===0)break e;X--,Z+=J[W++]<<R,R+=8}A.length=Z,A.head&&(A.head.extra_len=Z),512&A.flags&&(j[0]=255&Z,j[1]=Z>>>8&255,A.check=a(A.check,j,2,0)),R=Z=0}else A.head&&(A.head.extra=null);A.mode=6;case 6:if(1024&A.flags&&(X<(se=A.length)&&(se=X),se&&(A.head&&(S=A.head.extra_len-A.length,A.head.extra||(A.head.extra=new Array(A.head.extra_len)),i.arraySet(A.head.extra,J,W,se,S)),512&A.flags&&(A.check=a(A.check,J,se,W)),X-=se,W+=se,A.length-=se),A.length))break e;A.length=0,A.mode=7;case 7:if(2048&A.flags){if(X===0)break e;for(se=0;S=J[W+se++],A.head&&S&&A.length<65536&&(A.head.name+=String.fromCharCode(S)),S&&se<X;);if(512&A.flags&&(A.check=a(A.check,J,se,W)),X-=se,W+=se,S)break e}else A.head&&(A.head.name=null);A.length=0,A.mode=8;case 8:if(4096&A.flags){if(X===0)break e;for(se=0;S=J[W+se++],A.head&&S&&A.length<65536&&(A.head.comment+=String.fromCharCode(S)),S&&se<X;);if(512&A.flags&&(A.check=a(A.check,J,se,W)),X-=se,W+=se,S)break e}else A.head&&(A.head.comment=null);A.mode=9;case 9:if(512&A.flags){for(;R<16;){if(X===0)break e;X--,Z+=J[W++]<<R,R+=8}if(Z!==(65535&A.check)){N.msg="header crc mismatch",A.mode=30;break}R=Z=0}A.head&&(A.head.hcrc=A.flags>>9&1,A.head.done=!0),N.adler=A.check=0,A.mode=12;break;case 10:for(;R<32;){if(X===0)break e;X--,Z+=J[W++]<<R,R+=8}N.adler=A.check=g(Z),R=Z=0,A.mode=11;case 11:if(A.havedict===0)return N.next_out=ce,N.avail_out=ue,N.next_in=W,N.avail_in=X,A.hold=Z,A.bits=R,2;N.adler=A.check=1,A.mode=12;case 12:if(H===5||H===6)break e;case 13:if(A.last){Z>>>=7&R,R-=7&R,A.mode=27;break}for(;R<3;){if(X===0)break e;X--,Z+=J[W++]<<R,R+=8}switch(A.last=1&Z,R-=1,3&(Z>>>=1)){case 0:A.mode=14;break;case 1:if(G(A),A.mode=20,H!==6)break;Z>>>=2,R-=2;break e;case 2:A.mode=17;break;case 3:N.msg="invalid block type",A.mode=30}Z>>>=2,R-=2;break;case 14:for(Z>>>=7&R,R-=7&R;R<32;){if(X===0)break e;X--,Z+=J[W++]<<R,R+=8}if((65535&Z)!=(Z>>>16^65535)){N.msg="invalid stored block lengths",A.mode=30;break}if(A.length=65535&Z,R=Z=0,A.mode=15,H===6)break e;case 15:A.mode=16;case 16:if(se=A.length){if(X<se&&(se=X),ue<se&&(se=ue),se===0)break e;i.arraySet(ie,J,W,se,ce),X-=se,W+=se,ue-=se,ce+=se,A.length-=se;break}A.mode=12;break;case 17:for(;R<14;){if(X===0)break e;X--,Z+=J[W++]<<R,R+=8}if(A.nlen=257+(31&Z),Z>>>=5,R-=5,A.ndist=1+(31&Z),Z>>>=5,R-=5,A.ncode=4+(15&Z),Z>>>=4,R-=4,286<A.nlen||30<A.ndist){N.msg="too many length or distance symbols",A.mode=30;break}A.have=0,A.mode=18;case 18:for(;A.have<A.ncode;){for(;R<3;){if(X===0)break e;X--,Z+=J[W++]<<R,R+=8}A.lens[de[A.have++]]=7&Z,Z>>>=3,R-=3}for(;A.have<19;)A.lens[de[A.have++]]=0;if(A.lencode=A.lendyn,A.lenbits=7,Q={bits:A.lenbits},re=c(0,A.lens,0,19,A.lencode,0,A.work,Q),A.lenbits=Q.bits,re){N.msg="invalid code lengths set",A.mode=30;break}A.have=0,A.mode=19;case 19:for(;A.have<A.nlen+A.ndist;){for(;K=(V=A.lencode[Z&(1<<A.lenbits)-1])>>>16&255,q=65535&V,!((T=V>>>24)<=R);){if(X===0)break e;X--,Z+=J[W++]<<R,R+=8}if(q<16)Z>>>=T,R-=T,A.lens[A.have++]=q;else{if(q===16){for(z=T+2;R<z;){if(X===0)break e;X--,Z+=J[W++]<<R,R+=8}if(Z>>>=T,R-=T,A.have===0){N.msg="invalid bit length repeat",A.mode=30;break}S=A.lens[A.have-1],se=3+(3&Z),Z>>>=2,R-=2}else if(q===17){for(z=T+3;R<z;){if(X===0)break e;X--,Z+=J[W++]<<R,R+=8}R-=T,S=0,se=3+(7&(Z>>>=T)),Z>>>=3,R-=3}else{for(z=T+7;R<z;){if(X===0)break e;X--,Z+=J[W++]<<R,R+=8}R-=T,S=0,se=11+(127&(Z>>>=T)),Z>>>=7,R-=7}if(A.have+se>A.nlen+A.ndist){N.msg="invalid bit length repeat",A.mode=30;break}for(;se--;)A.lens[A.have++]=S}}if(A.mode===30)break;if(A.lens[256]===0){N.msg="invalid code -- missing end-of-block",A.mode=30;break}if(A.lenbits=9,Q={bits:A.lenbits},re=c(u,A.lens,0,A.nlen,A.lencode,0,A.work,Q),A.lenbits=Q.bits,re){N.msg="invalid literal/lengths set",A.mode=30;break}if(A.distbits=6,A.distcode=A.distdyn,Q={bits:A.distbits},re=c(d,A.lens,A.nlen,A.ndist,A.distcode,0,A.work,Q),A.distbits=Q.bits,re){N.msg="invalid distances set",A.mode=30;break}if(A.mode=20,H===6)break e;case 20:A.mode=21;case 21:if(6<=X&&258<=ue){N.next_out=ce,N.avail_out=ue,N.next_in=W,N.avail_in=X,A.hold=Z,A.bits=R,l(N,ne),ce=N.next_out,ie=N.output,ue=N.avail_out,W=N.next_in,J=N.input,X=N.avail_in,Z=A.hold,R=A.bits,A.mode===12&&(A.back=-1);break}for(A.back=0;K=(V=A.lencode[Z&(1<<A.lenbits)-1])>>>16&255,q=65535&V,!((T=V>>>24)<=R);){if(X===0)break e;X--,Z+=J[W++]<<R,R+=8}if(K&&!(240&K)){for(F=T,L=K,le=q;K=(V=A.lencode[le+((Z&(1<<F+L)-1)>>F)])>>>16&255,q=65535&V,!(F+(T=V>>>24)<=R);){if(X===0)break e;X--,Z+=J[W++]<<R,R+=8}Z>>>=F,R-=F,A.back+=F}if(Z>>>=T,R-=T,A.back+=T,A.length=q,K===0){A.mode=26;break}if(32&K){A.back=-1,A.mode=12;break}if(64&K){N.msg="invalid literal/length code",A.mode=30;break}A.extra=15&K,A.mode=22;case 22:if(A.extra){for(z=A.extra;R<z;){if(X===0)break e;X--,Z+=J[W++]<<R,R+=8}A.length+=Z&(1<<A.extra)-1,Z>>>=A.extra,R-=A.extra,A.back+=A.extra}A.was=A.length,A.mode=23;case 23:for(;K=(V=A.distcode[Z&(1<<A.distbits)-1])>>>16&255,q=65535&V,!((T=V>>>24)<=R);){if(X===0)break e;X--,Z+=J[W++]<<R,R+=8}if(!(240&K)){for(F=T,L=K,le=q;K=(V=A.distcode[le+((Z&(1<<F+L)-1)>>F)])>>>16&255,q=65535&V,!(F+(T=V>>>24)<=R);){if(X===0)break e;X--,Z+=J[W++]<<R,R+=8}Z>>>=F,R-=F,A.back+=F}if(Z>>>=T,R-=T,A.back+=T,64&K){N.msg="invalid distance code",A.mode=30;break}A.offset=q,A.extra=15&K,A.mode=24;case 24:if(A.extra){for(z=A.extra;R<z;){if(X===0)break e;X--,Z+=J[W++]<<R,R+=8}A.offset+=Z&(1<<A.extra)-1,Z>>>=A.extra,R-=A.extra,A.back+=A.extra}if(A.offset>A.dmax){N.msg="invalid distance too far back",A.mode=30;break}A.mode=25;case 25:if(ue===0)break e;if(se=ne-ue,A.offset>se){if((se=A.offset-se)>A.whave&&A.sane){N.msg="invalid distance too far back",A.mode=30;break}Y=se>A.wnext?(se-=A.wnext,A.wsize-se):A.wnext-se,se>A.length&&(se=A.length),$=A.window}else $=ie,Y=ce-A.offset,se=A.length;for(ue<se&&(se=ue),ue-=se,A.length-=se;ie[ce++]=$[Y++],--se;);A.length===0&&(A.mode=21);break;case 26:if(ue===0)break e;ie[ce++]=A.length,ue--,A.mode=21;break;case 27:if(A.wrap){for(;R<32;){if(X===0)break e;X--,Z|=J[W++]<<R,R+=8}if(ne-=ue,N.total_out+=ne,A.total+=ne,ne&&(N.adler=A.check=A.flags?a(A.check,ie,ne,ce-ne):s(A.check,ie,ne,ce-ne)),ne=ue,(A.flags?Z:g(Z))!==A.check){N.msg="incorrect data check",A.mode=30;break}R=Z=0}A.mode=28;case 28:if(A.wrap&&A.flags){for(;R<32;){if(X===0)break e;X--,Z+=J[W++]<<R,R+=8}if(Z!==(4294967295&A.total)){N.msg="incorrect length check",A.mode=30;break}R=Z=0}A.mode=29;case 29:re=1;break e;case 30:re=-3;break e;case 31:return-4;case 32:default:return f}return N.next_out=ce,N.avail_out=ue,N.next_in=W,N.avail_in=X,A.hold=Z,A.bits=R,(A.wsize||ne!==N.avail_out&&A.mode<30&&(A.mode<27||H!==4))&&oe(N,N.output,N.next_out,ne-N.avail_out)?(A.mode=31,-4):(ee-=N.avail_in,ne-=N.avail_out,N.total_in+=ee,N.total_out+=ne,A.total+=ne,A.wrap&&ne&&(N.adler=A.check=A.flags?a(A.check,ie,ne,N.next_out-ne):s(A.check,ie,ne,N.next_out-ne)),N.data_type=A.bits+(A.last?64:0)+(A.mode===12?128:0)+(A.mode===20||A.mode===15?256:0),(ee==0&&ne===0||H===4)&&re===p&&(re=-5),re)},o.inflateEnd=function(N){if(!N||!N.state)return f;var H=N.state;return H.window&&(H.window=null),N.state=null,p},o.inflateGetHeader=function(N,H){var A;return N&&N.state&&2&(A=N.state).wrap?((A.head=H).done=!1,p):f},o.inflateSetDictionary=function(N,H){var A,J=H.length;return N&&N.state?(A=N.state).wrap!==0&&A.mode!==11?f:A.mode===11&&s(1,H,J,0)!==A.check?-3:oe(N,H,J,J)?(A.mode=31,-4):(A.havedict=1,p):f},o.inflateInfo="pako inflate (from Nodeca project)"},{"../utils/common":41,"./adler32":43,"./crc32":45,"./inffast":48,"./inftrees":50}],50:[function(n,r,o){var i=n("../utils/common"),s=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],a=[16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78],l=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0],c=[16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64];r.exports=function(u,d,p,f,h,m,y,g){var v,k,b,C,D,M,I,E,G,oe=g.bits,N=0,H=0,A=0,J=0,ie=0,W=0,ce=0,X=0,ue=0,Z=0,R=null,ee=0,ne=new i.Buf16(16),se=new i.Buf16(16),Y=null,$=0;for(N=0;N<=15;N++)ne[N]=0;for(H=0;H<f;H++)ne[d[p+H]]++;for(ie=oe,J=15;1<=J&&ne[J]===0;J--);if(J<ie&&(ie=J),J===0)return h[m++]=20971520,h[m++]=20971520,g.bits=1,0;for(A=1;A<J&&ne[A]===0;A++);for(ie<A&&(ie=A),N=X=1;N<=15;N++)if(X<<=1,(X-=ne[N])<0)return-1;if(0<X&&(u===0||J!==1))return-1;for(se[1]=0,N=1;N<15;N++)se[N+1]=se[N]+ne[N];for(H=0;H<f;H++)d[p+H]!==0&&(y[se[d[p+H]]++]=H);if(M=u===0?(R=Y=y,19):u===1?(R=s,ee-=257,Y=a,$-=257,256):(R=l,Y=c,-1),N=A,D=m,ce=H=Z=0,b=-1,C=(ue=1<<(W=ie))-1,u===1&&852<ue||u===2&&592<ue)return 1;for(;;){for(I=N-ce,G=y[H]<M?(E=0,y[H]):y[H]>M?(E=Y[$+y[H]],R[ee+y[H]]):(E=96,0),v=1<<N-ce,A=k=1<<W;h[D+(Z>>ce)+(k-=v)]=I<<24|E<<16|G|0,k!==0;);for(v=1<<N-1;Z&v;)v>>=1;if(v!==0?(Z&=v-1,Z+=v):Z=0,H++,--ne[N]==0){if(N===J)break;N=d[p+y[H]]}if(ie<N&&(Z&C)!==b){for(ce===0&&(ce=ie),D+=A,X=1<<(W=N-ce);W+ce<J&&!((X-=ne[W+ce])<=0);)W++,X<<=1;if(ue+=1<<W,u===1&&852<ue||u===2&&592<ue)return 1;h[b=Z&C]=ie<<24|W<<16|D-m|0}}return Z!==0&&(h[D+Z]=N-ce<<24|64<<16|0),g.bits=ie,0}},{"../utils/common":41}],51:[function(n,r,o){r.exports={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"}},{}],52:[function(n,r,o){var i=n("../utils/common"),s=0,a=1;function l(V){for(var j=V.length;0<=--j;)V[j]=0}var c=0,u=29,d=256,p=d+1+u,f=30,h=19,m=2*p+1,y=15,g=16,v=7,k=256,b=16,C=17,D=18,M=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0],I=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],E=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],G=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],oe=new Array(2*(p+2));l(oe);var N=new Array(2*f);l(N);var H=new Array(512);l(H);var A=new Array(256);l(A);var J=new Array(u);l(J);var ie,W,ce,X=new Array(f);function ue(V,j,de,fe,ae){this.static_tree=V,this.extra_bits=j,this.extra_base=de,this.elems=fe,this.max_length=ae,this.has_stree=V&&V.length}function Z(V,j){this.dyn_tree=V,this.max_code=0,this.stat_desc=j}function R(V){return V<256?H[V]:H[256+(V>>>7)]}function ee(V,j){V.pending_buf[V.pending++]=255&j,V.pending_buf[V.pending++]=j>>>8&255}function ne(V,j,de){V.bi_valid>g-de?(V.bi_buf|=j<<V.bi_valid&65535,ee(V,V.bi_buf),V.bi_buf=j>>g-V.bi_valid,V.bi_valid+=de-g):(V.bi_buf|=j<<V.bi_valid&65535,V.bi_valid+=de)}function se(V,j,de){ne(V,de[2*j],de[2*j+1])}function Y(V,j){for(var de=0;de|=1&V,V>>>=1,de<<=1,0<--j;);return de>>>1}function $(V,j,de){var fe,ae,me=new Array(y+1),we=0;for(fe=1;fe<=y;fe++)me[fe]=we=we+de[fe-1]<<1;for(ae=0;ae<=j;ae++){var he=V[2*ae+1];he!==0&&(V[2*ae]=Y(me[he]++,he))}}function T(V){var j;for(j=0;j<p;j++)V.dyn_ltree[2*j]=0;for(j=0;j<f;j++)V.dyn_dtree[2*j]=0;for(j=0;j<h;j++)V.bl_tree[2*j]=0;V.dyn_ltree[2*k]=1,V.opt_len=V.static_len=0,V.last_lit=V.matches=0}function K(V){8<V.bi_valid?ee(V,V.bi_buf):0<V.bi_valid&&(V.pending_buf[V.pending++]=V.bi_buf),V.bi_buf=0,V.bi_valid=0}function q(V,j,de,fe){var ae=2*j,me=2*de;return V[ae]<V[me]||V[ae]===V[me]&&fe[j]<=fe[de]}function F(V,j,de){for(var fe=V.heap[de],ae=de<<1;ae<=V.heap_len&&(ae<V.heap_len&&q(j,V.heap[ae+1],V.heap[ae],V.depth)&&ae++,!q(j,fe,V.heap[ae],V.depth));)V.heap[de]=V.heap[ae],de=ae,ae<<=1;V.heap[de]=fe}function L(V,j,de){var fe,ae,me,we,he=0;if(V.last_lit!==0)for(;fe=V.pending_buf[V.d_buf+2*he]<<8|V.pending_buf[V.d_buf+2*he+1],ae=V.pending_buf[V.l_buf+he],he++,fe===0?se(V,ae,j):(se(V,(me=A[ae])+d+1,j),(we=M[me])!==0&&ne(V,ae-=J[me],we),se(V,me=R(--fe),de),(we=I[me])!==0&&ne(V,fe-=X[me],we)),he<V.last_lit;);se(V,k,j)}function le(V,j){var de,fe,ae,me=j.dyn_tree,we=j.stat_desc.static_tree,he=j.stat_desc.has_stree,be=j.stat_desc.elems,ze=-1;for(V.heap_len=0,V.heap_max=m,de=0;de<be;de++)me[2*de]!==0?(V.heap[++V.heap_len]=ze=de,V.depth[de]=0):me[2*de+1]=0;for(;V.heap_len<2;)me[2*(ae=V.heap[++V.heap_len]=ze<2?++ze:0)]=1,V.depth[ae]=0,V.opt_len--,he&&(V.static_len-=we[2*ae+1]);for(j.max_code=ze,de=V.heap_len>>1;1<=de;de--)F(V,me,de);for(ae=be;de=V.heap[1],V.heap[1]=V.heap[V.heap_len--],F(V,me,1),fe=V.heap[1],V.heap[--V.heap_max]=de,V.heap[--V.heap_max]=fe,me[2*ae]=me[2*de]+me[2*fe],V.depth[ae]=(V.depth[de]>=V.depth[fe]?V.depth[de]:V.depth[fe])+1,me[2*de+1]=me[2*fe+1]=ae,V.heap[1]=ae++,F(V,me,1),2<=V.heap_len;);V.heap[--V.heap_max]=V.heap[1],function(Ce,ct){var x,O,_,P,B,U,te=ct.dyn_tree,ge=ct.max_code,xe=ct.stat_desc.static_tree,ke=ct.stat_desc.has_stree,Oe=ct.stat_desc.extra_bits,Ne=ct.stat_desc.extra_base,Je=ct.stat_desc.max_length,it=0;for(P=0;P<=y;P++)Ce.bl_count[P]=0;for(te[2*Ce.heap[Ce.heap_max]+1]=0,x=Ce.heap_max+1;x<m;x++)Je<(P=te[2*te[2*(O=Ce.heap[x])+1]+1]+1)&&(P=Je,it++),te[2*O+1]=P,ge<O||(Ce.bl_count[P]++,B=0,Ne<=O&&(B=Oe[O-Ne]),U=te[2*O],Ce.opt_len+=U*(P+B),ke&&(Ce.static_len+=U*(xe[2*O+1]+B)));if(it!==0){do{for(P=Je-1;Ce.bl_count[P]===0;)P--;Ce.bl_count[P]--,Ce.bl_count[P+1]+=2,Ce.bl_count[Je]--,it-=2}while(0<it);for(P=Je;P!==0;P--)for(O=Ce.bl_count[P];O!==0;)ge<(_=Ce.heap[--x])||(te[2*_+1]!==P&&(Ce.opt_len+=(P-te[2*_+1])*te[2*_],te[2*_+1]=P),O--)}}(V,j),$(me,ze,V.bl_count)}function S(V,j,de){var fe,ae,me=-1,we=j[1],he=0,be=7,ze=4;for(we===0&&(be=138,ze=3),j[2*(de+1)+1]=65535,fe=0;fe<=de;fe++)ae=we,we=j[2*(fe+1)+1],++he<be&&ae===we||(he<ze?V.bl_tree[2*ae]+=he:ae!==0?(ae!==me&&V.bl_tree[2*ae]++,V.bl_tree[2*b]++):he<=10?V.bl_tree[2*C]++:V.bl_tree[2*D]++,me=ae,ze=(he=0)===we?(be=138,3):ae===we?(be=6,3):(be=7,4))}function re(V,j,de){var fe,ae,me=-1,we=j[1],he=0,be=7,ze=4;for(we===0&&(be=138,ze=3),fe=0;fe<=de;fe++)if(ae=we,we=j[2*(fe+1)+1],!(++he<be&&ae===we)){if(he<ze)for(;se(V,ae,V.bl_tree),--he!=0;);else ae!==0?(ae!==me&&(se(V,ae,V.bl_tree),he--),se(V,b,V.bl_tree),ne(V,he-3,2)):he<=10?(se(V,C,V.bl_tree),ne(V,he-3,3)):(se(V,D,V.bl_tree),ne(V,he-11,7));me=ae,ze=(he=0)===we?(be=138,3):ae===we?(be=6,3):(be=7,4)}}l(X);var Q=!1;function z(V,j,de,fe){ne(V,(c<<1)+(fe?1:0),3),function(ae,me,we,he){K(ae),ee(ae,we),ee(ae,~we),i.arraySet(ae.pending_buf,ae.window,me,we,ae.pending),ae.pending+=we}(V,j,de)}o._tr_init=function(V){Q||(function(){var j,de,fe,ae,me,we=new Array(y+1);for(ae=fe=0;ae<u-1;ae++)for(J[ae]=fe,j=0;j<1<<M[ae];j++)A[fe++]=ae;for(A[fe-1]=ae,ae=me=0;ae<16;ae++)for(X[ae]=me,j=0;j<1<<I[ae];j++)H[me++]=ae;for(me>>=7;ae<f;ae++)for(X[ae]=me<<7,j=0;j<1<<I[ae]-7;j++)H[256+me++]=ae;for(de=0;de<=y;de++)we[de]=0;for(j=0;j<=143;)oe[2*j+1]=8,j++,we[8]++;for(;j<=255;)oe[2*j+1]=9,j++,we[9]++;for(;j<=279;)oe[2*j+1]=7,j++,we[7]++;for(;j<=287;)oe[2*j+1]=8,j++,we[8]++;for($(oe,p+1,we),j=0;j<f;j++)N[2*j+1]=5,N[2*j]=Y(j,5);ie=new ue(oe,M,d+1,p,y),W=new ue(N,I,0,f,y),ce=new ue(new Array(0),E,0,h,v)}(),Q=!0),V.l_desc=new Z(V.dyn_ltree,ie),V.d_desc=new Z(V.dyn_dtree,W),V.bl_desc=new Z(V.bl_tree,ce),V.bi_buf=0,V.bi_valid=0,T(V)},o._tr_stored_block=z,o._tr_flush_block=function(V,j,de,fe){var ae,me,we=0;0<V.level?(V.strm.data_type===2&&(V.strm.data_type=function(he){var be,ze=4093624447;for(be=0;be<=31;be++,ze>>>=1)if(1&ze&&he.dyn_ltree[2*be]!==0)return s;if(he.dyn_ltree[18]!==0||he.dyn_ltree[20]!==0||he.dyn_ltree[26]!==0)return a;for(be=32;be<d;be++)if(he.dyn_ltree[2*be]!==0)return a;return s}(V)),le(V,V.l_desc),le(V,V.d_desc),we=function(he){var be;for(S(he,he.dyn_ltree,he.l_desc.max_code),S(he,he.dyn_dtree,he.d_desc.max_code),le(he,he.bl_desc),be=h-1;3<=be&&he.bl_tree[2*G[be]+1]===0;be--);return he.opt_len+=3*(be+1)+5+5+4,be}(V),ae=V.opt_len+3+7>>>3,(me=V.static_len+3+7>>>3)<=ae&&(ae=me)):ae=me=de+5,de+4<=ae&&j!==-1?z(V,j,de,fe):V.strategy===4||me===ae?(ne(V,2+(fe?1:0),3),L(V,oe,N)):(ne(V,4+(fe?1:0),3),function(he,be,ze,Ce){var ct;for(ne(he,be-257,5),ne(he,ze-1,5),ne(he,Ce-4,4),ct=0;ct<Ce;ct++)ne(he,he.bl_tree[2*G[ct]+1],3);re(he,he.dyn_ltree,be-1),re(he,he.dyn_dtree,ze-1)}(V,V.l_desc.max_code+1,V.d_desc.max_code+1,we+1),L(V,V.dyn_ltree,V.dyn_dtree)),T(V),fe&&K(V)},o._tr_tally=function(V,j,de){return V.pending_buf[V.d_buf+2*V.last_lit]=j>>>8&255,V.pending_buf[V.d_buf+2*V.last_lit+1]=255&j,V.pending_buf[V.l_buf+V.last_lit]=255&de,V.last_lit++,j===0?V.dyn_ltree[2*de]++:(V.matches++,j--,V.dyn_ltree[2*(A[de]+d+1)]++,V.dyn_dtree[2*R(j)]++),V.last_lit===V.lit_bufsize-1},o._tr_align=function(V){ne(V,2,3),se(V,k,oe),function(j){j.bi_valid===16?(ee(j,j.bi_buf),j.bi_buf=0,j.bi_valid=0):8<=j.bi_valid&&(j.pending_buf[j.pending++]=255&j.bi_buf,j.bi_buf>>=8,j.bi_valid-=8)}(V)}},{"../utils/common":41}],53:[function(n,r,o){r.exports=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}},{}],54:[function(n,r,o){(function(i){(function(s,a){if(!s.setImmediate){var l,c,u,d,p=1,f={},h=!1,m=s.document,y=Object.getPrototypeOf&&Object.getPrototypeOf(s);y=y&&y.setTimeout?y:s,l={}.toString.call(s.process)==="[object process]"?function(b){Se.nextTick(function(){v(b)})}:function(){if(s.postMessage&&!s.importScripts){var b=!0,C=s.onmessage;return s.onmessage=function(){b=!1},s.postMessage("","*"),s.onmessage=C,b}}()?(d="setImmediate$"+Math.random()+"$",s.addEventListener?s.addEventListener("message",k,!1):s.attachEvent("onmessage",k),function(b){s.postMessage(d+b,"*")}):s.MessageChannel?((u=new MessageChannel).port1.onmessage=function(b){v(b.data)},function(b){u.port2.postMessage(b)}):m&&"onreadystatechange"in m.createElement("script")?(c=m.documentElement,function(b){var C=m.createElement("script");C.onreadystatechange=function(){v(b),C.onreadystatechange=null,c.removeChild(C),C=null},c.appendChild(C)}):function(b){setTimeout(v,0,b)},y.setImmediate=function(b){typeof b!="function"&&(b=new Function(""+b));for(var C=new Array(arguments.length-1),D=0;D<C.length;D++)C[D]=arguments[D+1];var M={callback:b,args:C};return f[p]=M,l(p),p++},y.clearImmediate=g}function g(b){delete f[b]}function v(b){if(h)setTimeout(v,0,b);else{var C=f[b];if(C){h=!0;try{(function(D){var M=D.callback,I=D.args;switch(I.length){case 0:M();break;case 1:M(I[0]);break;case 2:M(I[0],I[1]);break;case 3:M(I[0],I[1],I[2]);break;default:M.apply(a,I)}})(C)}finally{g(b),h=!1}}}}function k(b){b.source===s&&typeof b.data=="string"&&b.data.indexOf(d)===0&&v(+b.data.slice(d.length))}})(typeof self>"u"?i===void 0?this:i:self)}).call(this,typeof zt<"u"?zt:typeof self<"u"?self:typeof window<"u"?window:{})},{}]},{},[10])(10)})})(g1);var ST=g1.exports;const Ld=Wl(ST);let Pd=class{constructor(e={}){this.debug=e.debug||!1,this.zip=new Ld,this.files=[],this.media={},this.mediaFiles={},this.fonts={}}async getDocxData(e,n=!1){const r=await this.unzip(e),o=Object.entries(r.files),i={},s=["xml","rels"];for(const a of o){const[l,c]=a;if(s.some(u=>c.name.endsWith(u))){const u=await c.async("string");this.files.push({name:c.name,content:u})}else if(c.name.startsWith("word/media")&&c.name!=="word/media/")if(n){const u=(await c.async("nodebuffer")).toString("base64");i[c.name]=u}else{const u=await c.async("blob"),d=this.getFileExtension(c.name),p=await c.async("base64");this.mediaFiles[c.name]=`data:image/${d};base64,${p}`;const f=new File([u],c.name,{type:u.type}),h=URL.createObjectURL(f);this.media[c.name]=h}else if(c.name.startsWith("word/fonts")&&c.name!=="word/fonts/"){const u=await c.async("uint8array");this.fonts[c.name]=u}}return this.files}getFileExtension(e){return e.split(".").pop()}async updateContentTypes(e,n){const r=Object.keys(n).map(y=>this.getFileExtension(y)),o="[Content_Types].xml",i=await e.file(o).async("string");let s="";const a=IE(i),l=new Set;for(let y of r){if(a.includes(y)||l.has(y))continue;const g=`<Default Extension="${y}" ContentType="image/${y}"/>`;s+=g,l.add(y)}const c=JSON.parse(nf.xml2json(i,null,2)).elements?.find(y=>y.name==="Types")||{},u=c.elements?.some(y=>y.name==="Override"&&y.attributes.PartName==="/word/comments.xml"),d=c.elements?.some(y=>y.name==="Override"&&y.attributes.PartName==="/word/commentsExtended.xml"),p=c.elements?.some(y=>y.name==="Override"&&y.attributes.PartName==="/word/commentsIds.xml"),f=c.elements?.some(y=>y.name==="Override"&&y.attributes.PartName==="/word/commentsExtensible.xml");e.files["word/comments.xml"]&&(u||(s+='<Override PartName="/word/comments.xml" ContentType="application/vnd.openxmlformats-officedocument.wordprocessingml.comments+xml" />')),e.files["word/commentsExtended.xml"]&&(d||(s+='<Override PartName="/word/commentsExtended.xml" ContentType="application/vnd.openxmlformats-officedocument.wordprocessingml.commentsExtended+xml" />')),e.files["word/commentsIds.xml"]&&(p||(s+='<Override PartName="/word/commentsIds.xml" ContentType="application/vnd.openxmlformats-officedocument.wordprocessingml.commentsIds+xml" />')),e.files["word/commentsExtensible.xml"]&&(f||(s+='<Override PartName="/word/commentsExtensible.xml" ContentType="application/vnd.openxmlformats-officedocument.wordprocessingml.commentsExtensible+xml" />'));const h='<Types xmlns="http://schemas.openxmlformats.org/package/2006/content-types">',m=i.replace(h,`${h}${s}`);e.file(o,m)}async unzip(e){return await this.zip.loadAsync(e)}async updateZip({docx:e,updatedDocs:n,originalDocxFile:r,media:o,fonts:i,isHeadless:s}){let a;r?a=await this.exportFromOriginalFile(r,n,o):a=await this.exportFromCollaborativeDocx(e,n,o,i);const l=s?"nodebuffer":"blob";return await a.generateAsync({type:l})}async exportFromCollaborativeDocx(e,n,r,o){const i=new Ld;for(const s of e){const a=s.content;i.file(s.name,a)}Object.keys(n).forEach(s=>{const a=n[s];i.file(s,a)}),Object.keys(r).forEach(s=>{const a=mt.from(r[s],"base64");i.file(`word/media/${s}`,a)});for(const[s,a]of Object.entries(o))i.file(s,a);return await this.updateContentTypes(i,r),i}async exportFromOriginalFile(e,n,r){const o=await this.unzip(e),i=[];return o.forEach((s,a)=>{const l=a.async("string").then(c=>{o.file(a.name,c)});i.push(l)}),await Promise.all(i),Object.keys(n).forEach(s=>{o.file(s,n[s])}),Object.keys(r).forEach(s=>{o.file(`word/media/${s}`,r[s])}),await this.updateContentTypes(o,r),o}};var AT=Object.defineProperty,y1=t=>{throw TypeError(t)},CT=(t,e,n)=>e in t?AT(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,Re=(t,e,n)=>CT(t,typeof e!="symbol"?e+"":e,n),uf=(t,e,n)=>e.has(t)||y1("Cannot "+n),Xn=(t,e,n)=>(uf(t,e,"read from private field"),n?n.call(t):e.get(t)),$r=(t,e,n)=>e.has(t)?y1("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,n),w1=(t,e,n,r)=>(uf(t,e,"write to private field"),e.set(t,n),n),Ae=(t,e,n)=>(uf(t,e,"access private method"),n);function Ws(t){const{from:e,to:n,empty:r}=t.selection,o=[];return r?(t.storedMarks&&o.push(...t.storedMarks),o.push(...t.selection.$head.marks())):t.doc.nodesBetween(e,n,i=>{o.push(...i.marks)}),o}const nc=(t,e,n=!1)=>{const{selection:r,doc:o}=t,{$from:i,$to:s}=r,a=i.marks().find(d=>d.type===e),l=s.marks().find(d=>d.type===e);let c;const u=[];return o.nodesBetween(i.pos,s.pos,(d,p)=>{if(d.marks){const f=d.marks.find(h=>h.type===e);f&&(c={from:p,to:p+d.nodeSize,attrs:f.attrs,contained:!a||!l||a===l},u.push(c))}}),n?u:c};function df(t){const{state:e}=t,{selection:n}=e,r=Ws(e),o=n.$head.parent.attrs.marksAttrs,i=r.filter(f=>!["textStyle","link"].includes(f.type.name)).map(f=>({name:f.type.name,attrs:f.attrs})),s=r.filter(f=>f.type.name==="textStyle");if(i.push(...s.flatMap(Vg)),o){const f=o.filter(m=>!["textStyle","link"].includes(m.type)).map(m=>({name:m.type,attrs:m.attrs||{}})),h=o.filter(m=>m.type==="textStyle");i.push(...f),i.push(...h.flatMap(Vg))}const a=e.schema.marks.link,l=nc(e,a);if(l){let{from:f,to:h,attrs:m}=l;n.from>=f&&n.to<=h&&i.push({name:"link",attrs:m})}const c=["paragraphSpacing"],u=ET(e);Object.keys(u).forEach(f=>{if(c.includes(f))return;const h={};h[f]=u[f],i.push({name:f,attrs:h})});const d=i.find(f=>f.name==="textColor"),p=i.find(f=>f.name==="textHighlight");return d&&i.push({name:"color",attrs:{color:d.attrs?.textColor}}),p&&i.push({name:"highlight",attrs:{color:p.attrs?.textHighlight}}),t.storage.formatCommands?.storedStyle&&i.push({name:"copyFormat",attrs:!0}),i}function Vg(t){const e=[],{attrs:n}=t;return Object.keys(n).forEach(r=>{n[r]&&e.push({name:r,attrs:{[r]:n[r]}})}),e}function ET(t){try{const{from:e,to:n,empty:r}=t.selection,o={},i=l=>{Object.keys(l.attrs).forEach(c=>{const u=l.attrs[c];u&&(o[c]=u)})};let s=e,a=n;return r?t.doc.nodesBetween(s,a+1,l=>i(l)):t.doc.nodesBetween(e,n,l=>i(l)),o}catch{return{}}}var hl=200,xt=function(){};xt.prototype.append=function(t){return t.length?(t=xt.from(t),!this.length&&t||t.length<hl&&this.leafAppend(t)||this.length<hl&&t.leafPrepend(this)||this.appendInner(t)):this};xt.prototype.prepend=function(t){return t.length?xt.from(t).append(this):this};xt.prototype.appendInner=function(t){return new TT(this,t)};xt.prototype.slice=function(t,e){return t===void 0&&(t=0),e===void 0&&(e=this.length),t>=e?xt.empty:this.sliceInner(Math.max(0,t),Math.min(this.length,e))};xt.prototype.get=function(t){if(!(t<0||t>=this.length))return this.getInner(t)};xt.prototype.forEach=function(t,e,n){e===void 0&&(e=0),n===void 0&&(n=this.length),e<=n?this.forEachInner(t,e,n,0):this.forEachInvertedInner(t,e,n,0)};xt.prototype.map=function(t,e,n){e===void 0&&(e=0),n===void 0&&(n=this.length);var r=[];return this.forEach(function(o,i){return r.push(t(o,i))},e,n),r};xt.from=function(t){return t instanceof xt?t:t&&t.length?new b1(t):xt.empty};var b1=function(t){function e(r){t.call(this),this.values=r}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={length:{configurable:!0},depth:{configurable:!0}};return e.prototype.flatten=function(){return this.values},e.prototype.sliceInner=function(r,o){return r==0&&o==this.length?this:new e(this.values.slice(r,o))},e.prototype.getInner=function(r){return this.values[r]},e.prototype.forEachInner=function(r,o,i,s){for(var a=o;a<i;a++)if(r(this.values[a],s+a)===!1)return!1},e.prototype.forEachInvertedInner=function(r,o,i,s){for(var a=o-1;a>=i;a--)if(r(this.values[a],s+a)===!1)return!1},e.prototype.leafAppend=function(r){if(this.length+r.length<=hl)return new e(this.values.concat(r.flatten()))},e.prototype.leafPrepend=function(r){if(this.length+r.length<=hl)return new e(r.flatten().concat(this.values))},n.length.get=function(){return this.values.length},n.depth.get=function(){return 0},Object.defineProperties(e.prototype,n),e}(xt);xt.empty=new b1([]);var TT=function(t){function e(n,r){t.call(this),this.left=n,this.right=r,this.length=n.length+r.length,this.depth=Math.max(n.depth,r.depth)+1}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.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,r,o,i){var s=this.left.length;if(r<s&&this.left.forEachInner(n,r,Math.min(o,s),i)===!1||o>s&&this.right.forEachInner(n,Math.max(r-s,0),Math.min(this.length,o)-s,i+s)===!1)return!1},e.prototype.forEachInvertedInner=function(n,r,o,i){var s=this.left.length;if(r>s&&this.right.forEachInvertedInner(n,r-s,Math.max(o,s)-s,i+s)===!1||o<s&&this.left.forEachInvertedInner(n,Math.min(r,s),o,i)===!1)return!1},e.prototype.sliceInner=function(n,r){if(n==0&&r==this.length)return this;var o=this.left.length;return r<=o?this.left.slice(n,r):n>=o?this.right.slice(n-o,r-o):this.left.slice(n,o).append(this.right.slice(0,r-o))},e.prototype.leafAppend=function(n){var r=this.right.leafAppend(n);if(r)return new e(this.left,r)},e.prototype.leafPrepend=function(n){var r=this.left.leafPrepend(n);if(r)return new e(r,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}(xt);const $T=500;let ws=class zo{constructor(e,n){this.items=e,this.eventCount=n}popEvent(e,n){if(this.eventCount==0)return null;let r=this.items.length;for(;;r--)if(this.items.get(r-1).selection){--r;break}let o,i;n&&(o=this.remapping(r,this.items.length),i=o.maps.length);let s=e.tr,a,l,c=[],u=[];return this.items.forEach((d,p)=>{if(!d.step){o||(o=this.remapping(r,p+1),i=o.maps.length),i--,u.push(d);return}if(o){u.push(new fr(d.map));let f=d.step.map(o.slice(i)),h;f&&s.maybeStep(f).doc&&(h=s.mapping.maps[s.mapping.maps.length-1],c.push(new fr(h,void 0,void 0,c.length+u.length))),i--,h&&o.appendMap(h,i)}else s.maybeStep(d.step);if(d.selection)return a=o?d.selection.map(o.slice(i)):d.selection,l=new zo(this.items.slice(0,r).append(u.reverse().concat(c)),this.eventCount-1),!1},this.items.length,0),{remaining:l,transform:s,selection:a}}addTransform(e,n,r,o){let i=[],s=this.eventCount,a=this.items,l=!o&&a.length?a.get(a.length-1):null;for(let u=0;u<e.steps.length;u++){let d=e.steps[u].invert(e.docs[u]),p=new fr(e.mapping.maps[u],d,n),f;(f=l&&l.merge(p))&&(p=f,u?i.pop():a=a.slice(0,a.length-1)),i.push(p),n&&(s++,n=void 0),o||(l=p)}let c=s-r.depth;return c>MT&&(a=OT(a,c),s-=c),new zo(a.append(i),s)}remapping(e,n){let r=new ni;return this.items.forEach((o,i)=>{let s=o.mirrorOffset!=null&&i-o.mirrorOffset>=e?r.maps.length-o.mirrorOffset:void 0;r.appendMap(o.map,s)},e,n),r}addMaps(e){return this.eventCount==0?this:new zo(this.items.append(e.map(n=>new fr(n))),this.eventCount)}rebased(e,n){if(!this.eventCount)return this;let r=[],o=Math.max(0,this.items.length-n),i=e.mapping,s=e.steps.length,a=this.eventCount;this.items.forEach(p=>{p.selection&&a--},o);let l=n;this.items.forEach(p=>{let f=i.getMirror(--l);if(f==null)return;s=Math.min(s,f);let h=i.maps[f];if(p.step){let m=e.steps[f].invert(e.docs[f]),y=p.selection&&p.selection.map(i.slice(l+1,f));y&&a++,r.push(new fr(h,m,y))}else r.push(new fr(h))},o);let c=[];for(let p=n;p<s;p++)c.push(new fr(i.maps[p]));let u=this.items.slice(0,o).append(c).append(r),d=new zo(u,a);return d.emptyItemCount()>$T&&(d=d.compress(this.items.length-r.length)),d}emptyItemCount(){let e=0;return this.items.forEach(n=>{n.step||e++}),e}compress(e=this.items.length){let n=this.remapping(0,e),r=n.maps.length,o=[],i=0;return this.items.forEach((s,a)=>{if(a>=e)o.push(s),s.selection&&i++;else if(s.step){let l=s.step.map(n.slice(r)),c=l&&l.getMap();if(r--,c&&n.appendMap(c,r),l){let u=s.selection&&s.selection.map(n.slice(r));u&&i++;let d=new fr(c.invert(),l,u),p,f=o.length-1;(p=o.length&&o[f].merge(d))?o[f]=p:o.push(d)}}else s.map&&r--},this.items.length,0),new zo(xt.from(o.reverse()),i)}};ws.empty=new ws(xt.empty,0);function OT(t,e){let n;return t.forEach((r,o)=>{if(r.selection&&e--==0)return n=o,!1}),t.slice(n)}let fr=class v1{constructor(e,n,r,o){this.map=e,this.step=n,this.selection=r,this.mirrorOffset=o}merge(e){if(this.step&&e.step&&!e.selection){let n=e.step.merge(this.step);if(n)return new v1(n.getMap().invert(),n,this.selection)}}};class vr{constructor(e,n,r,o,i){this.done=e,this.undone=n,this.prevRanges=r,this.prevTime=o,this.prevComposition=i}}const MT=20;function DT(t,e,n,r){let o=n.getMeta(rr),i;if(o)return o.historyState;n.getMeta(IT)&&(t=new vr(t.done,t.undone,null,0,-1));let s=n.getMeta("appendedTransaction");if(n.steps.length==0)return t;if(s&&s.getMeta(rr))return s.getMeta(rr).redo?new vr(t.done.addTransform(n,void 0,r,Ua(e)),t.undone,Ug(n.mapping.maps),t.prevTime,t.prevComposition):new vr(t.done,t.undone.addTransform(n,void 0,r,Ua(e)),null,t.prevTime,t.prevComposition);if(n.getMeta("addToHistory")!==!1&&!(s&&s.getMeta("addToHistory")===!1)){let a=n.getMeta("composition"),l=t.prevTime==0||!s&&t.prevComposition!=a&&(t.prevTime<(n.time||0)-r.newGroupDelay||!_T(n,t.prevRanges)),c=s?Eu(t.prevRanges,n.mapping):Ug(n.mapping.maps);return new vr(t.done.addTransform(n,l?e.selection.getBookmark():void 0,r,Ua(e)),ws.empty,c,n.time,a??t.prevComposition)}else return(i=n.getMeta("rebased"))?new vr(t.done.rebased(n,i),t.undone.rebased(n,i),Eu(t.prevRanges,n.mapping),t.prevTime,t.prevComposition):new vr(t.done.addMaps(n.mapping.maps),t.undone.addMaps(n.mapping.maps),Eu(t.prevRanges,n.mapping),t.prevTime,t.prevComposition)}function _T(t,e){if(!e)return!1;if(!t.docChanged)return!0;let n=!1;return t.mapping.maps[0].forEach((r,o)=>{for(let i=0;i<e.length;i+=2)r<=e[i+1]&&o>=e[i]&&(n=!0)}),n}function Ug(t){let e=[];for(let n=t.length-1;n>=0&&e.length==0;n--)t[n].forEach((r,o,i,s)=>e.push(i,s));return e}function Eu(t,e){if(!t)return null;let n=[];for(let r=0;r<t.length;r+=2){let o=e.map(t[r],1),i=e.map(t[r+1],-1);o<=i&&n.push(o,i)}return n}function NT(t,e,n){let r=Ua(e),o=rr.get(e).spec.config,i=(n?t.undone:t.done).popEvent(e,r);if(!i)return null;let s=i.selection.resolve(i.transform.doc),a=(n?t.done:t.undone).addTransform(i.transform,e.selection.getBookmark(),o,r),l=new vr(n?a:i.remaining,n?i.remaining:a,null,0,-1);return i.transform.setSelection(s).setMeta(rr,{redo:n,historyState:l})}let Tu=!1,Hg=null;function Ua(t){let e=t.plugins;if(Hg!=e){Tu=!1,Hg=e;for(let n=0;n<e.length;n++)if(e[n].spec.historyPreserveItems){Tu=!0;break}}return Tu}const rr=new Ge("history"),IT=new Ge("closeHistory");function FT(t={}){return t={depth:t.depth||100,newGroupDelay:t.newGroupDelay||500},new Ue({key:rr,state:{init(){return new vr(ws.empty,ws.empty,null,0,-1)},apply(e,n,r){return DT(n,r,e,t)}},config:t,props:{handleDOMEvents:{beforeinput(e,n){let r=n.inputType,o=r=="historyUndo"?k1:r=="historyRedo"?S1:null;return o?(n.preventDefault(),o(e.state,e.dispatch)):!1}}}})}function x1(t,e){return(n,r)=>{let o=rr.getState(n);if(!o||(t?o.undone:o.done).eventCount==0)return!1;if(r){let i=NT(o,n,t);i&&r(i.scrollIntoView())}return!0}}const k1=x1(!1),S1=x1(!0);function RT(t){let e=rr.getState(t);return e?e.done.eventCount:0}function BT(t){let e=rr.getState(t);return e?e.undone.eventCount:0}function Fe(t,e,n={}){return typeof t.config[e]=="function"?t.config[e].bind({...n}):t.config[e]}class Ye{constructor(e){Re(this,"type","extension"),Re(this,"name","extension"),Re(this,"options"),Re(this,"storage"),Re(this,"config",{name:this.name}),this.config={...this.config,...e},this.name=this.config.name,this.config.addOptions&&(this.options=Ke(Fe(this,"addOptions",{name:this.name}))),this.storage=Ke(Fe(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(...e){return new Ye(...e)}}const A1=Ye.create({name:"history",addOptions(){return{depth:100,newGroupDelay:500}},addPmPlugins(){return[FT(this.options)]},addCommands(){return{undo:()=>({state:t,dispatch:e,tr:n})=>(n.setMeta("inputType","historyUndo"),k1(t,e)),redo:()=>({state:t,dispatch:e,tr:n})=>(n.setMeta("inputType","historyRedo"),S1(t,e))}},addShortcuts(){return{"Mod-z":()=>this.editor.commands.undo(),"Mod-Shift-z":()=>this.editor.commands.redo(),"Mod-y":()=>this.editor.commands.redo()}}});let He=class C1{constructor(e){Re(this,"type","node"),Re(this,"name","node"),Re(this,"options"),Re(this,"storage"),Re(this,"config",{name:this.name}),this.config={...this.config,...e},this.name=this.config.name,this.config.addOptions&&(this.options=Ke(Fe(this,"addOptions",{name:this.name}))),this.storage=Ke(Fe(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(...e){return new C1(...e)}},tn=class E1{constructor(e){Re(this,"type","mark"),Re(this,"name","mark"),Re(this,"options"),Re(this,"storage"),Re(this,"isExternal"),Re(this,"config",{name:this.name}),this.config={...this.config,...e},this.name=this.config.name,this.isExternal=!!this.config.isExternal,this.config.addOptions&&(this.options=Ke(Fe(this,"addOptions",{name:this.name}))),this.storage=Ke(Fe(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(...e){return new E1(...e)}};function pt(t,e){if(typeof t=="string"){if(!e.nodes[t])throw Error(`There is no node type named '${t}' in schema.`);return e.nodes[t]}return t}function cr(t,e){if(typeof t=="string"){if(!e.marks[t])throw Error(`There is no mark type named '${t}' in schema.`);return e.marks[t]}return t}function Gs(t,e){return e.nodes[t]?"node":e.marks[t]?"mark":null}var ml,T1,$1;let Te=class{static getAttributesFromExtensions(e){const n=[],r={default:null,rendered:!0,renderDOM:null,parseDOM:null,keepOnSplit:!0},o=Ae(this,ml,T1).call(this,e,r),i=Ae(this,ml,$1).call(this,e,r);return n.push(...o,...i),n}static insertExtensionAttrsToParseRule(e,n){return"style"in e?e:{...e,getAttrs:r=>{const o=e.getAttrs?e.getAttrs(r):e.attrs;if(o===!1)return!1;const i=a=>typeof a!="string"?a:a.match(/^[+-]?(\d*\.)?\d+$/)?Number(a):a==="true"?!0:a==="false"?!1:a;let s={};for(const a of n){const l=a.attribute.parseDOM?a.attribute.parseDOM(r):i(r.getAttribute(a.name));l!=null&&(s={...s,[a.name]:l})}return{...o,...s}}}}static getAttributesToRender(e,n){const r=n.filter(i=>i.attribute.rendered).map(i=>i.attribute.renderDOM?i.attribute.renderDOM(e.attrs)||{}:{[i.name]:e.attrs[i.name]});let o={};for(const i of r)o=this.mergeAttributes(o,i);return o}static mergeAttributes(...e){const n=e.filter(o=>!!o);let r={};for(const o of n){const i={...r};for(const[s,a]of Object.entries(o)){if(!i[s]){i[s]=a;continue}if(s==="class"){const l=a?a.split(" "):[],c=i[s]?i[s].split(" "):[],u=l.filter(d=>!c.includes(d));i[s]=[...c,...u].join(" ")}else s==="style"?i[s]=[i[s],a].join("; "):i[s]=a}r=i}return r}static getSplittedAttributes(e,n,r){const o=Object.entries(r).filter(([i])=>{const s=e.find(a=>a.type===n&&a.name===i);return s?s.attribute.keepOnSplit:!1});return Object.fromEntries(o)}static getMarkAttributes(e,n){const r=cr(n,e.schema),o=Ws(e).find(i=>i.type.name===r.name);return o?{...o.attrs}:{}}static getNodeAttributes(e,n){const r=pt(n,e.schema),{from:o,to:i}=e.selection,s=[];e.doc.nodesBetween(o,i,l=>{s.push(l)});const a=s.reverse().find(l=>l.type.name===r.name);return a?{...a.attrs}:{}}static getAttributes(e,n){const r=Gs(typeof n=="string"?n:n.name,e.schema);return r==="node"?this.getNodeAttributes(e,n):r==="mark"?this.getMarkAttributes(e,n):{}}};ml=new WeakSet,T1=function(t,e){const n=[],r=o=>{for(const i of o.types){const s=Object.entries(o.attributes);for(const[a,l]of s)n.push({type:i,name:a,attribute:{...e,...l}})}};for(const o of t){const i={name:o.name,options:o.options,storage:o.storage},s=Fe(o,"addGlobalAttributes",i);if(!s)continue;const a=s();for(const l of a)r(l)}return n},$1=function(t,e){const n=[],r=t.filter(o=>o.type==="node"||o.type==="mark");for(const o of r){const i={name:o.name,options:o.options,storage:o.storage},s=Fe(o,"addAttributes",i);if(!s)continue;const a=s();for(const[l,c]of Object.entries(a)){const u={...e,...c};typeof u.default=="function"&&(u.default=u.default()),n.push({type:o.name,name:l,attribute:u})}}return n},$r(Te,ml);function zd(t){const e=Object.entries(t).filter(([n,r])=>n==="attrs"&&EE(r)?!1:r!=null);return Object.fromEntries(e)}var gl,O1,M1;const D1=class jd{static createSchemaByExtensions(e,n){var r,o;const i=e.filter(d=>d.type==="node"),s=e.filter(d=>d.type==="mark"),a=i.find(d=>Fe(d,"topNode"))?.name,l=Te.getAttributesFromExtensions(e),c=Ae(r=jd,gl,O1).call(r,i,l,n),u=Ae(o=jd,gl,M1).call(o,s,l,n);return new sv({topNode:a,nodes:c,marks:u})}};gl=new WeakSet,O1=function(t,e,n){const r=t.map(o=>{const i=e.filter(f=>f.type===o.name),s={name:o.name,options:o.options,storage:o.storage,editor:n},a=Object.fromEntries(i.map(f=>[f.name,{default:f?.attribute?.default}])),l=t.reduce((f,h)=>{const m=Fe(h,"extendNodeSchema",s);return{...f,...m?m(o):{}}},{}),c=zd({content:Ke(Fe(o,"content",s)),group:Ke(Fe(o,"group",s)),marks:Ke(Fe(o,"marks",s)),inline:Ke(Fe(o,"inline",s)),atom:Ke(Fe(o,"atom",s)),selectable:Ke(Fe(o,"selectable",s)),draggable:Ke(Fe(o,"draggable",s)),code:Ke(Fe(o,"code",s)),defining:Ke(Fe(o,"defining",s)),isolating:Ke(Fe(o,"isolating",s)),attrs:a,...l}),u=Ke(Fe(o,"parseDOM",s));u&&(c.parseDOM=u.map(f=>Te.insertExtensionAttrsToParseRule(f,i)));const d=Fe(o,"renderDOM",s);d&&(c.toDOM=f=>d({node:f,htmlAttributes:Te.getAttributesToRender(f,i)}));const p=Fe(o,"renderText",s);return p&&(c.toText=p),[o.name,c]});return Object.fromEntries(r)},M1=function(t,e,n){const r=t.map(o=>{const i=e.filter(d=>d.type===o.name),s={name:o.name,options:o.options,storage:o.storage,editor:n},a=Object.fromEntries(i.map(d=>[d.name,{default:d?.attribute?.default}])),l=zd({group:Ke(Fe(o,"group",s)),inclusive:Ke(Fe(o,"inclusive",s)),excludes:Ke(Fe(o,"excludes",s)),spanning:Ke(Fe(o,"spanning",s)),code:Ke(Fe(o,"code",s)),attrs:a}),c=Ke(Fe(o,"parseDOM",s));c&&(l.parseDOM=c.map(d=>Te.insertExtensionAttrsToParseRule(d,i)));const u=Fe(o,"renderDOM",s);return u&&(l.toDOM=d=>u({mark:d,htmlAttributes:Te.getAttributesToRender(d,i)})),[o.name,l]});return Object.fromEntries(r)},$r(D1,gl);let LT=D1;function pf(t,e){let{selection:n,doc:r,storedMarks:o}=t;return{...e,apply:e.apply.bind(e),applyTransaction:e.applyTransaction.bind(e),plugins:e.plugins,schema:e.schema,reconfigure:e.reconfigure.bind(e),toJSON:e.toJSON.bind(e),get storedMarks(){return o},get selection(){return n},get doc(){return r},get tr(){return n=t.selection,r=t.doc,o=t.storedMarks,t}}}let _1=class N1{constructor(e){Re(this,"editor"),Re(this,"rawCommands"),this.editor=e.editor,this.rawCommands=this.editor.extensionService.commands}static create(...e){return new N1(...e)}get state(){return this.editor.state}get commands(){const{editor:e,state:n}=this,{view:r}=e,{tr:o}=n,i=this.createProps(o),s=Object.entries(this.rawCommands).map(([a,l])=>[a,(...c)=>{const u=l(...c)(i);return o.getMeta("preventDispatch")||r.dispatch(o),u}]);return Object.fromEntries(s)}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(e,n=!0){const{editor:r,state:o,rawCommands:i}=this,{view:s}=r,a=[],l=!!e,c=e||o.tr,u=()=>(!l&&n&&!c.getMeta("preventDispatch")&&s.dispatch(c),a.every(f=>f===!0)),d=Object.entries(i).map(([f,h])=>[f,(...m)=>{const y=this.createProps(c,n),g=h(...m)(y);return a.push(g),p}]),p={...Object.fromEntries(d),run:u};return p}createCan(e){const{rawCommands:n,state:r}=this,o=!1,i=e||r.tr,s=this.createProps(i,o);return{...Object.fromEntries(Object.entries(n).map(([a,l])=>[a,(...c)=>l(...c)({...s,dispatch:void 0})])),chain:()=>this.createChain(i,o)}}createProps(e,n=!0){const{editor:r,state:o,rawCommands:i}=this,{view:s}=r,a={tr:e,editor:r,view:s,state:pf(e,o),dispatch:n?()=>{}:void 0,chain:()=>this.createChain(e,n),can:()=>this.createCan(e),get commands(){return Object.fromEntries(Object.entries(i).map(([l,c])=>[l,(...u)=>c(...u)(a)]))}};return a}};const PT=t=>e=>{const n=typeof t=="function"?t(e):t;for(let r=0;r<n.length;r+=1)if(n[r](e))return!0;return!1},zT=t=>e=>t(e),jT=()=>({tr:t})=>(t.insertText(" ",t.selection.from,t.selection.to),!0),I1=({tr:t,state:e,dispatch:n})=>{const{from:r}=t.selection,o=e.schema.text(" ");return t=t.replaceSelectionWith(o),t=t.setSelection(Pe.create(t.doc,r+1)),n&&n(t),!0},qT=()=>({tr:t,state:e,dispatch:n})=>{const r=t.selection.from,o=e.schema?.nodes?.tab?.create();return o?(t.insert(r,o),n&&n(t),!0):I1({tr:t,state:e,dispatch:n})},VT=(t,e)=>({tr:n})=>(n.setMeta(t,e),!0),ff=(t,e)=>t.selection.empty?!1:(e&&e(t.tr.deleteSelection().scrollIntoView()),!0);function UT(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("backward",t):n.parentOffset>0)?null:n}const F1=(t,e,n)=>{let r=UT(t,n);if(!r)return!1;let o=B1(r);if(!o){let s=r.blockRange(),a=s&&Us(s);return a==null?!1:(e&&e(t.tr.lift(s,a).scrollIntoView()),!0)}let i=o.nodeBefore;if(U1(t,o,e,-1))return!0;if(r.parent.content.size==0&&(li(i,"end")||_e.isSelectable(i)))for(let s=r.depth;;s--){let a=af(t.doc,r.before(s),r.after(s),ve.empty);if(a&&a.slice.size<a.to-a.from){if(e){let l=t.tr.step(a);l.setSelection(li(i,"end")?je.findFrom(l.doc.resolve(l.mapping.map(o.pos,-1)),-1):_e.create(l.doc,o.pos-i.nodeSize)),e(l.scrollIntoView())}return!0}if(s==1||r.node(s-1).childCount>1)break}return i.isAtom&&o.depth==r.depth-1?(e&&e(t.tr.delete(o.pos-i.nodeSize,o.pos).scrollIntoView()),!0):!1};function li(t,e,n=!1){for(let r=t;r;r=e=="start"?r.firstChild:r.lastChild){if(r.isTextblock)return!0;if(n&&r.childCount!=1)return!1}return!1}const R1=(t,e,n)=>{let{$head:r,empty:o}=t.selection,i=r;if(!o)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("backward",t):r.parentOffset>0)return!1;i=B1(r)}let s=i&&i.nodeBefore;return!s||!_e.isSelectable(s)?!1:(e&&e(t.tr.setSelection(_e.create(t.doc,i.pos-s.nodeSize)).scrollIntoView()),!0)};function B1(t){if(!t.parent.type.spec.isolating)for(let e=t.depth-1;e>=0;e--){if(t.index(e)>0)return t.doc.resolve(t.before(e+1));if(t.node(e).type.spec.isolating)break}return null}function HT(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("forward",t):n.parentOffset<n.parent.content.size)?null:n}const L1=(t,e,n)=>{let r=HT(t,n);if(!r)return!1;let o=z1(r);if(!o)return!1;let i=o.nodeAfter;if(U1(t,o,e,1))return!0;if(r.parent.content.size==0&&(li(i,"start")||_e.isSelectable(i))){let s=af(t.doc,r.before(),r.after(),ve.empty);if(s&&s.slice.size<s.to-s.from){if(e){let a=t.tr.step(s);a.setSelection(li(i,"start")?je.findFrom(a.doc.resolve(a.mapping.map(o.pos)),1):_e.create(a.doc,a.mapping.map(o.pos))),e(a.scrollIntoView())}return!0}}return i.isAtom&&o.depth==r.depth-1?(e&&e(t.tr.delete(o.pos,o.pos+i.nodeSize).scrollIntoView()),!0):!1},P1=(t,e,n)=>{let{$head:r,empty:o}=t.selection,i=r;if(!o)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("forward",t):r.parentOffset<r.parent.content.size)return!1;i=z1(r)}let s=i&&i.nodeAfter;return!s||!_e.isSelectable(s)?!1:(e&&e(t.tr.setSelection(_e.create(t.doc,i.pos)).scrollIntoView()),!0)};function z1(t){if(!t.parent.type.spec.isolating)for(let e=t.depth-1;e>=0;e--){let n=t.node(e);if(t.index(e)+1<n.childCount)return t.doc.resolve(t.after(e+1));if(n.type.spec.isolating)break}return null}const WT=(t,e)=>{let n=t.selection,r=n instanceof _e,o;if(r){if(n.node.isTextblock||!Pr(t.doc,n.from))return!1;o=n.from}else if(o=bv(t.doc,n.from,-1),o==null)return!1;if(e){let i=t.tr.join(o);r&&i.setSelection(_e.create(i.doc,o-t.doc.resolve(o).nodeBefore.nodeSize)),e(i.scrollIntoView())}return!0},GT=(t,e)=>{let n=t.selection,r;if(n instanceof _e){if(n.node.isTextblock||!Pr(t.doc,n.to))return!1;r=n.to}else if(r=bv(t.doc,n.to,1),r==null)return!1;return e&&e(t.tr.join(r).scrollIntoView()),!0},j1=(t,e)=>{let{$head:n,$anchor:r}=t.selection;return!n.parent.type.spec.code||!n.sameParent(r)?!1:(e&&e(t.tr.insertText(`
|
|
40
40
|
`).scrollIntoView()),!0)};function hf(t){for(let e=0;e<t.edgeCount;e++){let{type:n}=t.edge(e);if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}const KT=(t,e)=>{let{$head:n,$anchor:r}=t.selection;if(!n.parent.type.spec.code||!n.sameParent(r))return!1;let o=n.node(-1),i=n.indexAfter(-1),s=hf(o.contentMatchAt(i));if(!s||!o.canReplaceWith(i,i,s))return!1;if(e){let a=n.after(),l=t.tr.replaceWith(a,a,s.createAndFill());l.setSelection(je.near(l.doc.resolve(a),1)),e(l.scrollIntoView())}return!0},q1=(t,e)=>{let n=t.selection,{$from:r,$to:o}=n;if(n instanceof Nn||r.parent.inlineContent||o.parent.inlineContent)return!1;let i=hf(o.parent.contentMatchAt(o.indexAfter()));if(!i||!i.isTextblock)return!1;if(e){let s=(!r.parentOffset&&o.index()<o.parent.childCount?r:o).pos,a=t.tr.insert(s,i.createAndFill());a.setSelection(Pe.create(a.doc,s+1)),e(a.scrollIntoView())}return!0},V1=(t,e)=>{let{$cursor:n}=t.selection;if(!n||n.parent.content.size)return!1;if(n.depth>1&&n.after()!=n.end(-1)){let i=n.before();if(tr(t.doc,i))return e&&e(t.tr.split(i).scrollIntoView()),!0}let r=n.blockRange(),o=r&&Us(r);return o==null?!1:(e&&e(t.tr.lift(r,o).scrollIntoView()),!0)};function JT(t){return(e,n)=>{let{$from:r,$to:o}=e.selection;if(e.selection instanceof _e&&e.selection.node.isBlock)return!r.parentOffset||!tr(e.doc,r.pos)?!1:(n&&n(e.tr.split(r.pos).scrollIntoView()),!0);if(!r.depth)return!1;let i=[],s,a,l=!1,c=!1;for(let f=r.depth;;f--)if(r.node(f).isBlock){l=r.end(f)==r.pos+(r.depth-f),c=r.start(f)==r.pos-(r.depth-f),a=hf(r.node(f-1).contentMatchAt(r.indexAfter(f-1))),i.unshift(l&&a?{type:a}:null),s=f;break}else{if(f==1)return!1;i.unshift(null)}let u=e.tr;(e.selection instanceof Pe||e.selection instanceof Nn)&&u.deleteSelection();let d=u.mapping.map(r.pos),p=tr(u.doc,d,i.length,i);if(p||(i[0]=a?{type:a}:null,p=tr(u.doc,d,i.length,i)),!p)return!1;if(u.split(d,i.length,i),!l&&c&&r.node(s).type!=a){let f=u.mapping.map(r.before(s)),h=u.doc.resolve(f);a&&r.node(s-1).canReplaceWith(h.index(),h.index()+1,a)&&u.setNodeMarkup(u.mapping.map(r.before(s)),a)}return n&&n(u.scrollIntoView()),!0}}const XT=JT(),YT=(t,e)=>(e&&e(t.tr.setSelection(new Nn(t.doc))),!0);function ZT(t,e,n){let r=e.nodeBefore,o=e.nodeAfter,i=e.index();return!r||!o||!r.type.compatibleContent(o.type)?!1:!r.content.size&&e.parent.canReplace(i-1,i)?(n&&n(t.tr.delete(e.pos-r.nodeSize,e.pos).scrollIntoView()),!0):!e.parent.canReplace(i,i+1)||!(o.isTextblock||Pr(t.doc,e.pos))?!1:(n&&n(t.tr.join(e.pos).scrollIntoView()),!0)}function U1(t,e,n,r){let o=e.nodeBefore,i=e.nodeAfter,s,a,l=o.type.spec.isolating||i.type.spec.isolating;if(!l&&ZT(t,e,n))return!0;let c=!l&&e.parent.canReplace(e.index(),e.index()+1);if(c&&(s=(a=o.contentMatchAt(o.childCount)).findWrapping(i.type))&&a.matchType(s[0]||i.type).validEnd){if(n){let f=e.pos+i.nodeSize,h=ye.empty;for(let g=s.length-1;g>=0;g--)h=ye.from(s[g].create(null,h));h=ye.from(o.copy(h));let m=t.tr.step(new Zt(e.pos-1,f,e.pos,f,new ve(h,1,0),s.length,!0)),y=m.doc.resolve(f+2*s.length);y.nodeAfter&&y.nodeAfter.type==o.type&&Pr(m.doc,y.pos)&&m.join(y.pos),n(m.scrollIntoView())}return!0}let u=i.type.spec.isolating||r>0&&l?null:je.findFrom(e,1),d=u&&u.$from.blockRange(u.$to),p=d&&Us(d);if(p!=null&&p>=e.depth)return n&&n(t.tr.lift(d,p).scrollIntoView()),!0;if(c&&li(i,"start",!0)&&li(o,"end")){let f=o,h=[];for(;h.push(f),!f.isTextblock;)f=f.lastChild;let m=i,y=1;for(;!m.isTextblock;m=m.firstChild)y++;if(f.canReplace(f.childCount,f.childCount,m.content)){if(n){let g=ye.empty;for(let k=h.length-1;k>=0;k--)g=ye.from(h[k].copy(g));let v=t.tr.step(new Zt(e.pos-h.length,e.pos+i.nodeSize,e.pos+y,e.pos+i.nodeSize-y,new ve(g,h.length,0),0,!0));n(v.scrollIntoView())}return!0}}return!1}function H1(t){return function(e,n){let r=e.selection,o=t<0?r.$from:r.$to,i=o.depth;for(;o.node(i).isInline;){if(!i)return!1;i--}return o.node(i).isTextblock?(n&&n(e.tr.setSelection(Pe.create(e.doc,t<0?o.start(i):o.end(i)))),!0):!1}}const QT=H1(-1),e$=H1(1);function Wg(t,e=null){return function(n,r){let o=!1;for(let i=0;i<n.selection.ranges.length&&!o;i++){let{$from:{pos:s},$to:{pos:a}}=n.selection.ranges[i];n.doc.nodesBetween(s,a,(l,c)=>{if(o)return!1;if(!(!l.isTextblock||l.hasMarkup(t,e)))if(l.type==t)o=!0;else{let u=n.doc.resolve(c),d=u.index();o=u.parent.canReplaceWith(d,d+1,t)}})}if(!o)return!1;if(r){let i=n.tr;for(let s=0;s<n.selection.ranges.length;s++){let{$from:{pos:a},$to:{pos:l}}=n.selection.ranges[s];i.setBlockType(a,l,t,e)}r(i.scrollIntoView())}return!0}}function mf(...t){return function(e,n,r){for(let o=0;o<t.length;o++)if(t[o](e,n,r))return!0;return!1}}mf(ff,F1,R1);mf(ff,L1,P1);mf(j1,q1,V1,XT);typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):typeof os<"u"&&os.platform&&os.platform()=="darwin";function W1(t){for(let e=0;e<t.edgeCount;e++){const{type:n}=t.edge(e);if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}const Gg=(t,e)=>{const n=t.storedMarks||t.selection.$to.parentOffset&&t.selection.$from.marks();if(n){const r=n.filter(o=>e?.includes(o.type.name));t.tr.ensureMarks(r)}},t$=({keepMarks:t=!0}={})=>e=>{const{tr:n,state:r,dispatch:o,editor:i}=e,{selection:s,doc:a}=n,{$from:l,$to:c}=s,u=i.extensionService.attributes,d=Te.getSplittedAttributes(u,l.node().type.name,l.node().attrs);if(s instanceof _e&&s.node.isBlock)return!l.parentOffset||!tr(a,l.pos)?!1:(o&&(t&&Gg(r,i.extensionService.splittableMarks),n.split(l.pos).scrollIntoView()),!0);if(!l.parent.isBlock)return!1;if(o){const p=c.parentOffset===c.parent.content.size;s instanceof Pe&&n.deleteSelection();const f=l.depth===0?null:W1(l.node(-1).contentMatchAt(l.indexAfter(-1)));let h=p&&f?[{type:f,attrs:d}]:void 0,m=tr(n.doc,n.mapping.map(l.pos),1,h);if(!h&&!m&&tr(n.doc,n.mapping.map(l.pos),1,f?[{type:f}]:void 0)&&(m=!0,h=f?[{type:f,attrs:d}]:void 0),m&&(n.split(n.mapping.map(l.pos),1,h),f&&!p&&!l.parentOffset&&l.parent.type!==f)){const y=n.mapping.map(l.before()),g=n.doc.resolve(y);l.node(-1).canReplaceWith(g.index(),g.index()+1,f)&&n.setNodeMarkup(n.mapping.map(l.before()),f)}t&&Gg(r,i.extensionService.splittableMarks),n.scrollIntoView()}return!0},n$=()=>({state:t,dispatch:e})=>V1(t,e),r$=()=>({state:t,dispatch:e})=>q1(t,e),o$=()=>({state:t,dispatch:e})=>j1(t,e),i$=()=>({state:t,dispatch:e})=>KT(t,e),G1=t=>{};function s$(t,e,n,r){let{selection:o}=n;t.options.isHeaderOrFooter&&(o=t.options.lastSelection);let i=null;if(G1()&&(i=o.$cursor),i){const s=e.storedMarks??i.marks();return!!r.isInSet(s)||!s.some(a=>a.type.excludes(r))}return o.ranges.some(({$from:s,$to:a})=>{let l=s.depth===0?e.doc.inlineContent&&e.doc.type.allowsMarkType(r):!1;return e.doc.nodesBetween(s.pos,a.pos,(c,u,d)=>{if(l)return!1;if(c.isInline){const p=!d||d.type.allowsMarkType(r),f=!!r.isInSet(c.marks)||!c.marks.some(h=>h.type.excludes(r));l=p&&f}return!l}),l})}const a$=(t,e={})=>({tr:n,state:r,dispatch:o,editor:i})=>{let{selection:s}=n;i.options.isHeaderOrFooter&&(s=i.options.lastSelection);const{empty:a,ranges:l}=s,c=cr(t,r.schema);if(o)if(a){const u=Te.getMarkAttributes(r,c);n.addStoredMark(c.create({...u,...e}))}else l.forEach(u=>{const d=u.$from.pos,p=u.$to.pos;r.doc.nodesBetween(d,p,(f,h)=>{const m=Math.max(h,d),y=Math.min(h+f.nodeSize,p);f.marks.find(g=>g.type===c)?f.marks.forEach(g=>{c===g.type&&n.addMark(m,y,c.create({...g.attrs,...e}))}):n.addMark(m,y,c.create(e))})});return s$(i,r,n,c)};function qd(t,e,n={}){return t.find(r=>r.type===e&&oi(r.attrs,n))}function l$(t,e,n={}){return!!qd(t,e,n)}function gf(t,e,n={}){if(!t||!e)return;let r=t.parent.childAfter(t.parentOffset);if(t.parentOffset===r.offset&&r.offset!==0&&(r=t.parent.childBefore(t.parentOffset)),!r.node)return;const o=qd([...r.node.marks],e,n);if(!o)return;let i=r.index,s=t.start()+r.offset,a=i+1,l=s+r.node.nodeSize;for(qd([...r.node.marks],e,n);i>0&&o.isInSet(t.parent.child(i-1).marks);)i-=1,s-=t.parent.child(i).nodeSize;for(;a<t.parent.childCount&&l$([...t.parent.child(a).marks],e,n);)l+=t.parent.child(a).nodeSize,a+=1;return{from:s,to:l}}const c$=(t,e={})=>({tr:n,state:r,dispatch:o,editor:i})=>{const{extendEmptyMarkRange:s=!1}=e;let{selection:a}=n;i.options.isHeaderOrFooter&&(a=i.options.lastSelection);const l=cr(t,r.schema),{$from:c,empty:u,ranges:d}=a;if(!o)return!0;if(u&&s){let{from:p,to:f}=a;const h=c.marks().find(y=>y.type===l)?.attrs,m=gf(c,l,h);m&&(p=m.from,f=m.to),n.removeMark(p,f,l)}else d.forEach(p=>{n.removeMark(p.$from.pos,p.$to.pos,l)});return n.removeStoredMark(l),!0},u$=()=>({tr:t,dispatch:e,editor:n})=>{let{selection:r}=t;n.options.isHeaderOrFooter&&(r=n.options.lastSelection);const{empty:o,ranges:i}=r;return o||e&&i.forEach(s=>{t.removeMark(s.$from.pos,s.$to.pos)}),!0};function yl(t,e,n={}){const{empty:r,ranges:o}=t.selection,i=e?cr(e,t.schema):null;if(r)return!!(t.storedMarks||t.selection.$from.marks()).filter(u=>i?i.name===u.type.name:!0).find(u=>oi(u.attrs,n,{strict:!1}));let s=0;const a=[];if(o.forEach(({$from:u,$to:d})=>{const p=u.pos,f=d.pos;t.doc.nodesBetween(p,f,(h,m)=>{if(!h.isText&&!h.marks.length)return;const y=Math.max(p,m),g=Math.min(f,m+h.nodeSize),v=g-y;s+=v,a.push(...h.marks.map(k=>({mark:k,from:y,to:g})))})}),s===0)return!1;const l=a.filter(u=>i?i.name===u.mark.type.name:!0).filter(u=>oi(u.mark.attrs,n,{strict:!1})).reduce((u,d)=>u+d.to-d.from,0),c=a.filter(u=>i?u.mark.type!==i&&u.mark.type.excludes(i):!0).reduce((u,d)=>u+d.to-d.from,0);return(l>0?l+c:l)>=s}const d$=(t,e={},n={})=>({state:r,commands:o})=>{const{extendEmptyMarkRange:i=!1}=n,s=cr(t,r.schema);return yl(r,s,e)?o.unsetMark(s,{extendEmptyMarkRange:i}):o.setMark(s,e)},p$=()=>({state:t,tr:e,dispatch:n})=>{const{selection:r}=e,{ranges:o}=r;return n&&o.forEach(({$from:i,$to:s})=>{t.doc.nodesBetween(i.pos,s.pos,(a,l)=>{if(a.type.isText)return;const{doc:c,mapping:u}=e,d=c.resolve(u.map(l)),p=c.resolve(u.map(l+a.nodeSize)),f=d.blockRange(p);if(!f)return;const h=Us(f);if(a.type.isTextblock){const{defaultType:m}=d.parent.contentMatchAt(d.index());e.setNodeMarkup(f.start,m)}(h||h===0)&&e.lift(f,h)})}),!0},f$=(t,e={})=>({state:n,dispatch:r,chain:o})=>{const i=pt(t,n.schema);return i.isTextblock?o().command(({commands:s})=>Wg(i,e)(n)?!0:s.clearNodes()).command(({state:s})=>Wg(i,e)(s,r)).run():!1};function wl(t,e,n={}){const{from:r,to:o,empty:i}=t.selection,s=e?pt(e,t.schema):null,a=[];t.doc.nodesBetween(r,o,(u,d)=>{if(u.isText)return;const p=Math.max(r,d),f=Math.min(o,d+u.nodeSize);a.push({node:u,from:p,to:f})});const l=o-r,c=a.filter(u=>s?s.name===u.node.type.name:!0).filter(u=>oi(u.node.attrs,n,{strict:!1}));return i?!!c.length:c.reduce((u,d)=>u+d.to-d.from,0)>=l}const h$=(t,e,n={})=>({state:r,commands:o})=>{const i=pt(t,r.schema),s=pt(e,r.schema);return wl(r,i,n)?o.setNode(s):o.setNode(i,n)},m$=()=>({state:t,dispatch:e})=>YT(t,e),g$=()=>({state:t,dispatch:e})=>ff(t,e),y$=(t,e={})=>({tr:n,state:r,dispatch:o})=>{let i=null,s=null;const a=Gs(typeof t=="string"?t:t.name,r.schema);return a?(a==="node"&&(i=pt(t,r.schema)),a==="mark"&&(s=cr(t,r.schema)),o&&n.selection.ranges.forEach(l=>{const c=l.$from.pos,u=l.$to.pos;r.doc.nodesBetween(c,u,(d,p)=>{i&&i===d.type&&n.setNodeMarkup(p,void 0,{...d.attrs,...e}),s&&d.marks.length&&d.marks.forEach(f=>{if(s===f.type){const h=Math.max(p,c),m=Math.min(p+d.nodeSize,u);n.addMark(h,m,s.create({...f.attrs,...e}))}})})}),!0):!1},w$=(t,e)=>({tr:n,state:r,dispatch:o})=>{let i=null,s=null;const a=Gs(typeof t=="string"?t:t.name,r.schema);return a?(a==="node"&&(i=pt(t,r.schema)),a==="mark"&&(s=cr(t,r.schema)),o&&n.selection.ranges.forEach(l=>{r.doc.nodesBetween(l.$from.pos,l.$to.pos,(c,u)=>{i&&i===c.type&&n.setNodeMarkup(u,void 0,Og(c.attrs,e)),s&&c.marks.length&&c.marks.forEach(d=>{s===d.type&&n.addMark(u,u+c.nodeSize,s.create(Og(d.attrs,e)))})})}),!0):!1},b$=()=>({state:t,dispatch:e})=>WT(t,e),v$=()=>({state:t,dispatch:e})=>GT(t,e),x$=()=>({state:t,dispatch:e})=>F1(t,e),k$=()=>({state:t,dispatch:e})=>L1(t,e),S$=()=>({state:t,dispatch:e})=>R1(t,e),A$=()=>({state:t,dispatch:e})=>P1(t,e),C$=()=>({state:t,dispatch:e})=>QT(t,e),E$=()=>({state:t,dispatch:e})=>e$(t,e),T$=(t,e)=>({tr:n,commands:r})=>r.insertContentAt({from:n.selection.from,to:n.selection.to},t,e),K1=t=>{const e=t.childNodes;for(let n=e.length-1;n>=0;n-=1){const r=e[n];r.nodeType===3&&r.nodeValue&&/^(\n\s\s|\n)$/.test(r.nodeValue)?t.removeChild(r):r.nodeType===1&&K1(r)}return t};function ca(t){const e=`<body>${t}</body>`,n=new window.DOMParser().parseFromString(e,"text/html").body;return K1(n)}function Vd(t,e,n){n={slice:!0,parseOptions:{},...n};const r=typeof t=="object"&&t!==null,o=typeof t=="string";if(r)try{if(Array.isArray(t)&&t.length>0)return ye.fromArray(t.map(s=>e.nodeFromJSON(s)));const i=e.nodeFromJSON(t);return n.errorOnInvalidContent&&i.check(),i}catch(i){if(n.errorOnInvalidContent)throw new Error("[super-editor error]: Invalid JSON content",{cause:i});return console.warn("[super-editor warn]: Invalid content.","Passed value:",t,"Error:",i),Vd("",e,n)}if(o){if(n.errorOnInvalidContent){let s=!1,a="";const l=new sv({topNode:e.spec.topNode,marks:e.spec.marks,nodes:e.spec.nodes.append({__supereditor__private__unknown__catch__all__node:{content:"inline*",group:"block",parseDOM:[{tag:"*",getAttrs:c=>(s=!0,a=typeof c=="string"?c:c.outerHTML,null)}]}})});if(n.slice?er.fromSchema(l).parseSlice(ca(t),n.parseOptions):er.fromSchema(l).parse(ca(t),n.parseOptions),n.errorOnInvalidContent&&s)throw new Error("[super-editor error]: Invalid HTML content",{cause:new Error(`Invalid element found: ${a}`)})}const i=er.fromSchema(e);return n.slice?i.parseSlice(ca(t),n.parseOptions).content:i.parse(ca(t),n.parseOptions)}return Vd("",e,n)}function $$(t,e,n){const r=t.steps.length-1;if(r<e)return;const o=t.steps[r];if(!(o instanceof Tt||o instanceof Zt))return;const i=t.mapping.maps[r];let s=0;i.forEach((a,l,c,u)=>{s===0&&(s=u)}),t.setSelection(je.near(t.doc.resolve(s),n))}const O$=t=>!("type"in t),M$=(t,e,n)=>({tr:r,dispatch:o,editor:i})=>{if(o){n={parseOptions:{},updateSelection:!0,applyInputRules:!1,applyPasteRules:!1,...n};let s;try{s=Vd(e,i.schema,{parseOptions:{preserveWhitespace:"full",...n.parseOptions},errorOnInvalidContent:n.errorOnInvalidContent??i.options.enableContentCheck})}catch(p){return i.emit("contentError",{editor:i,error:p,disableCollaboration:()=>{console.error("[super-editor error]: Unable to disable collaboration at this point in time")}}),!1}let{from:a,to:l}=typeof t=="number"?{from:t,to:t}:{from:t.from,to:t.to},c=!0,u=!0;if((O$(s)?s:[s]).forEach(p=>{p.check(),c=c?p.isText&&p.marks.length===0:!1,u=u?p.isBlock:!1}),a===l&&u){const{parent:p}=r.doc.resolve(a);p.isTextblock&&!p.type.spec.code&&!p.childCount&&(a-=1,l+=1)}let d;c?(Array.isArray(e)?d=e.map(p=>p.text||"").join(""):typeof e=="object"&&e&&e.text?d=e.text:d=e,r.insertText(d,a,l)):(d=s,r.replaceWith(a,l,d)),n.updateSelection&&$$(r,r.steps.length-1,-1),n.applyInputRules&&r.setMeta("applyInputRules",{from:a,text:d}),n.applyPasteRules&&r.setMeta("applyPasteRules",{from:a,text:d})}return!0},D$=()=>({state:t,dispatch:e})=>{const n=t.plugins;for(let r=0;r<n.length;r+=1){const o=n[r];let i;if(o.spec.isInputRules&&(i=o.getState(t))){if(e){const s=t.tr,a=i.transform;for(let l=a.steps.length-1;l>=0;l-=1)s.step(a.steps[l].invert(a.docs[l]));if(i.text){const l=s.doc.resolve(i.from).marks();s.replaceWith(i.from,i.to,t.schema.text(i.text,l))}else s.delete(i.from,i.to)}return!0}}return!1};function _$(t,e=null){return function(n,r){let{$from:o,$to:i}=n.selection,s=o.blockRange(i);if(!s)return!1;let a=r?n.tr:null;return N$(a,s,t,e)?(r&&r(a.scrollIntoView()),!0):!1}}function N$(t,e,n,r=null){let o=!1,i=e,s=e.$from.doc;if(e.depth>=2&&e.$from.node(e.depth-1).type.compatibleContent(n)&&e.startIndex==0){if(e.$from.index(e.depth-1)==0)return!1;let l=s.resolve(e.start-2);i=new cl(l,l,e.depth),e.endIndex<e.parent.childCount&&(e=new cl(e.$from,s.resolve(e.$to.end(e.depth)),e.depth)),o=!0}let a=mv(i,n,r,e);return a?(t&&I$(t,e,a,o,n),!0):!1}function I$(t,e,n,r,o){let i=ye.empty;for(let u=n.length-1;u>=0;u--)i=ye.from(n[u].type.create(n[u].attrs,i));t.step(new Zt(e.start-(r?2:0),e.end,e.start,e.end,new ve(i,0,0),n.length,!0));let s=0;for(let u=0;u<n.length;u++)n[u].type==o&&(s=u+1);let a=n.length-s,l=e.start+n.length-(r?2:0),c=e.parent;for(let u=e.startIndex,d=e.endIndex,p=!0;u<d;u++,p=!1)!p&&tr(t.doc,l,a)&&(t.split(l,a),l+=2*a),l+=c.child(u).nodeSize;return t}function F$(t){return function(e,n){let{$from:r,$to:o}=e.selection,i=r.blockRange(o,s=>s.childCount>0&&s.firstChild.type==t);return i?n?r.node(i.depth-1).type==t?R$(e,n,t,i):B$(e,n,i):!0:!1}}function R$(t,e,n,r){let o=t.tr,i=r.end,s=r.$to.end(r.depth);i<s&&(o.step(new Zt(i-1,s,i,s,new ve(ye.from(n.create(null,r.parent.copy())),1,0),1,!0)),r=new cl(o.doc.resolve(r.$from.pos),o.doc.resolve(s),r.depth));const a=Us(r);if(a==null)return!1;o.lift(r,a);let l=o.doc.resolve(o.mapping.map(i,-1)-1);return Pr(o.doc,l.pos)&&l.nodeBefore.type==l.nodeAfter.type&&o.join(l.pos),e(o.scrollIntoView()),!0}function B$(t,e,n){let r=t.tr,o=n.parent;for(let f=n.end,h=n.endIndex-1,m=n.startIndex;h>m;h--)f-=o.child(h).nodeSize,r.delete(f-1,f+1);let i=r.doc.resolve(n.start),s=i.nodeAfter;if(r.mapping.map(n.end)!=n.start+i.nodeAfter.nodeSize)return!1;let a=n.startIndex==0,l=n.endIndex==o.childCount,c=i.node(-1),u=i.index(-1);if(!c.canReplace(u+(a?0:1),u+1,s.content.append(l?ye.empty:ye.from(o))))return!1;let d=i.pos,p=d+s.nodeSize;return r.step(new Zt(d-(a?1:0),p+(l?1:0),d+1,p-1,new ve((a?ye.empty:ye.from(o.copy(ye.empty))).append(l?ye.empty:ye.from(o.copy(ye.empty))),a?0:1,l?0:1),a?0:1)),e(r.scrollIntoView()),!0}function L$(t){return function(e,n){let{$from:r,$to:o}=e.selection,i=r.blockRange(o,c=>c.childCount>0&&c.firstChild.type==t);if(!i)return!1;let s=i.startIndex;if(s==0)return!1;let a=i.parent,l=a.child(s-1);if(l.type!=t)return!1;if(n){let c=l.lastChild&&l.lastChild.type==a.type,u=ye.from(c?t.create():null),d=new ve(ye.from(t.create(null,ye.from(a.type.create(null,u)))),c?3:1,0),p=i.start,f=i.end;n(e.tr.step(new Zt(p-(c?3:1),f,p,f,d,1,!0)).scrollIntoView())}return!0}}const P$=(t,e={})=>({state:n,dispatch:r})=>{const o=pt(t,n.schema);return _$(o,e)(n,r)},rc=(t,e)=>{for(let n=t.depth;n>0;n--){const r=t.node(n);if(e(r))return{pos:n>0?t.before(n):0,start:t.start(n),depth:n,node:r}}},Kt=t=>({$from:e})=>rc(e,t),Ud=(t,e)=>{const n=e.filter(i=>i.type==="node").find(i=>i.name===t);if(!n)return!1;const r={name:n.name,options:n.options,storage:n.storage},o=Ke(Fe(n,"group",r));return typeof o!="string"?!1:o.split(" ").includes("list")},z$={type:"element",name:"w:abstractNum",attributes:{"w:abstractNumId":"1","w15:restartNumberingAfterBreak":"0"},elements:[{type:"element",name:"w:multiLevelType",attributes:{"w:val":"hybridMultilevel"}},{type:"element",name:"w:tmpl",attributes:{"w:val":"EE6417C4"}},{type:"element",name:"w:lvl",attributes:{"w:ilvl":"0","w:tplc":"0409000F"},elements:[{type:"element",name:"w:start",attributes:{"w:val":"1"}},{type:"element",name:"w:numFmt",attributes:{"w:val":"decimal"}},{type:"element",name:"w:lvlText",attributes:{"w:val":"%1."}},{type:"element",name:"w:lvlJc",attributes:{"w:val":"left"}},{type:"element",name:"w:pPr",elements:[{type:"element",name:"w:ind",attributes:{"w:left":"720","w:hanging":"360"}}]}]},{type:"element",name:"w:lvl",attributes:{"w:ilvl":"1","w:tplc":"04090019","w:tentative":"1"},elements:[{type:"element",name:"w:start",attributes:{"w:val":"1"}},{type:"element",name:"w:numFmt",attributes:{"w:val":"lowerLetter"}},{type:"element",name:"w:lvlText",attributes:{"w:val":"%2."}},{type:"element",name:"w:lvlJc",attributes:{"w:val":"left"}},{type:"element",name:"w:pPr",elements:[{type:"element",name:"w:ind",attributes:{"w:left":"1440","w:hanging":"360"}}]}]},{type:"element",name:"w:lvl",attributes:{"w:ilvl":"2","w:tplc":"0409001B","w:tentative":"1"},elements:[{type:"element",name:"w:start",attributes:{"w:val":"1"}},{type:"element",name:"w:numFmt",attributes:{"w:val":"lowerRoman"}},{type:"element",name:"w:lvlText",attributes:{"w:val":"%3."}},{type:"element",name:"w:lvlJc",attributes:{"w:val":"right"}},{type:"element",name:"w:pPr",elements:[{type:"element",name:"w:ind",attributes:{"w:left":"2160","w:hanging":"180"}}]}]},{type:"element",name:"w:lvl",attributes:{"w:ilvl":"3","w:tplc":"0409000F","w:tentative":"1"},elements:[{type:"element",name:"w:start",attributes:{"w:val":"1"}},{type:"element",name:"w:numFmt",attributes:{"w:val":"decimal"}},{type:"element",name:"w:lvlText",attributes:{"w:val":"%4."}},{type:"element",name:"w:lvlJc",attributes:{"w:val":"left"}},{type:"element",name:"w:pPr",elements:[{type:"element",name:"w:ind",attributes:{"w:left":"2880","w:hanging":"360"}}]}]},{type:"element",name:"w:lvl",attributes:{"w:ilvl":"4","w:tplc":"04090019","w:tentative":"1"},elements:[{type:"element",name:"w:start",attributes:{"w:val":"1"}},{type:"element",name:"w:numFmt",attributes:{"w:val":"lowerLetter"}},{type:"element",name:"w:lvlText",attributes:{"w:val":"%5."}},{type:"element",name:"w:lvlJc",attributes:{"w:val":"left"}},{type:"element",name:"w:pPr",elements:[{type:"element",name:"w:ind",attributes:{"w:left":"3600","w:hanging":"360"}}]}]},{type:"element",name:"w:lvl",attributes:{"w:ilvl":"5","w:tplc":"0409001B","w:tentative":"1"},elements:[{type:"element",name:"w:start",attributes:{"w:val":"1"}},{type:"element",name:"w:numFmt",attributes:{"w:val":"lowerRoman"}},{type:"element",name:"w:lvlText",attributes:{"w:val":"%6."}},{type:"element",name:"w:lvlJc",attributes:{"w:val":"right"}},{type:"element",name:"w:pPr",elements:[{type:"element",name:"w:ind",attributes:{"w:left":"4320","w:hanging":"180"}}]}]},{type:"element",name:"w:lvl",attributes:{"w:ilvl":"6","w:tplc":"0409000F","w:tentative":"1"},elements:[{type:"element",name:"w:start",attributes:{"w:val":"1"}},{type:"element",name:"w:numFmt",attributes:{"w:val":"decimal"}},{type:"element",name:"w:lvlText",attributes:{"w:val":"%7."}},{type:"element",name:"w:lvlJc",attributes:{"w:val":"left"}},{type:"element",name:"w:pPr",elements:[{type:"element",name:"w:ind",attributes:{"w:left":"5040","w:hanging":"360"}}]}]},{type:"element",name:"w:lvl",attributes:{"w:ilvl":"7","w:tplc":"04090019","w:tentative":"1"},elements:[{type:"element",name:"w:start",attributes:{"w:val":"1"}},{type:"element",name:"w:numFmt",attributes:{"w:val":"lowerLetter"}},{type:"element",name:"w:lvlText",attributes:{"w:val":"%8."}},{type:"element",name:"w:lvlJc",attributes:{"w:val":"left"}},{type:"element",name:"w:pPr",elements:[{type:"element",name:"w:ind",attributes:{"w:left":"5760","w:hanging":"360"}}]}]},{type:"element",name:"w:lvl",attributes:{"w:ilvl":"8","w:tplc":"0409001B","w:tentative":"1"},elements:[{type:"element",name:"w:start",attributes:{"w:val":"1"}},{type:"element",name:"w:numFmt",attributes:{"w:val":"lowerRoman"}},{type:"element",name:"w:lvlText",attributes:{"w:val":"%9."}},{type:"element",name:"w:lvlJc",attributes:{"w:val":"right"}},{type:"element",name:"w:pPr",elements:[{type:"element",name:"w:ind",attributes:{"w:left":"6480","w:hanging":"180"}}]}]}]},j$={type:"element",name:"w:abstractNum",attributes:{"w:abstractNumId":"0","w15:restartNumberingAfterBreak":"0"},elements:[{type:"element",name:"w:nsid",attributes:{"w:val":"16126B07"}},{type:"element",name:"w:multiLevelType",attributes:{"w:val":"hybridMultilevel"}},{type:"element",name:"w:tmpl",attributes:{"w:val":"51EC4E08"}},{type:"element",name:"w:lvl",attributes:{"w:ilvl":"0","w:tplc":"04090001"},elements:[{type:"element",name:"w:start",attributes:{"w:val":"1"}},{type:"element",name:"w:numFmt",attributes:{"w:val":"bullet"}},{type:"element",name:"w:lvlText",attributes:{"w:val":""}},{type:"element",name:"w:lvlJc",attributes:{"w:val":"left"}},{type:"element",name:"w:pPr",elements:[{type:"element",name:"w:ind",attributes:{"w:left":"720","w:hanging":"360"}}]},{type:"element",name:"w:rPr",elements:[{type:"element",name:"w:rFonts",attributes:{"w:ascii":"Symbol","w:hAnsi":"Symbol","w:hint":"default"}}]}]},{type:"element",name:"w:lvl",attributes:{"w:ilvl":"1","w:tplc":"04090003","w:tentative":"1"},elements:[{type:"element",name:"w:start",attributes:{"w:val":"1"}},{type:"element",name:"w:numFmt",attributes:{"w:val":"bullet"}},{type:"element",name:"w:lvlText",attributes:{"w:val":"o"}},{type:"element",name:"w:lvlJc",attributes:{"w:val":"left"}},{type:"element",name:"w:pPr",elements:[{type:"element",name:"w:ind",attributes:{"w:left":"1440","w:hanging":"360"}}]},{type:"element",name:"w:rPr",elements:[{type:"element",name:"w:rFonts",attributes:{"w:ascii":"Courier New","w:hAnsi":"Courier New","w:cs":"Courier New","w:hint":"default"}}]}]},{type:"element",name:"w:lvl",attributes:{"w:ilvl":"2","w:tplc":"04090005","w:tentative":"1"},elements:[{type:"element",name:"w:start",attributes:{"w:val":"1"}},{type:"element",name:"w:numFmt",attributes:{"w:val":"bullet"}},{type:"element",name:"w:lvlText",attributes:{"w:val":""}},{type:"element",name:"w:lvlJc",attributes:{"w:val":"left"}},{type:"element",name:"w:pPr",elements:[{type:"element",name:"w:ind",attributes:{"w:left":"2160","w:hanging":"360"}}]},{type:"element",name:"w:rPr",elements:[{type:"element",name:"w:rFonts",attributes:{"w:ascii":"Wingdings","w:hAnsi":"Wingdings","w:hint":"default"}}]}]},{type:"element",name:"w:lvl",attributes:{"w:ilvl":"3","w:tplc":"04090001","w:tentative":"1"},elements:[{type:"element",name:"w:start",attributes:{"w:val":"1"}},{type:"element",name:"w:numFmt",attributes:{"w:val":"bullet"}},{type:"element",name:"w:lvlText",attributes:{"w:val":""}},{type:"element",name:"w:lvlJc",attributes:{"w:val":"left"}},{type:"element",name:"w:pPr",elements:[{type:"element",name:"w:ind",attributes:{"w:left":"2880","w:hanging":"360"}}]},{type:"element",name:"w:rPr",elements:[{type:"element",name:"w:rFonts",attributes:{"w:ascii":"Symbol","w:hAnsi":"Symbol","w:hint":"default"}}]}]},{type:"element",name:"w:lvl",attributes:{"w:ilvl":"4","w:tplc":"04090003","w:tentative":"1"},elements:[{type:"element",name:"w:start",attributes:{"w:val":"1"}},{type:"element",name:"w:numFmt",attributes:{"w:val":"bullet"}},{type:"element",name:"w:lvlText",attributes:{"w:val":"o"}},{type:"element",name:"w:lvlJc",attributes:{"w:val":"left"}},{type:"element",name:"w:pPr",elements:[{type:"element",name:"w:ind",attributes:{"w:left":"3600","w:hanging":"360"}}]},{type:"element",name:"w:rPr",elements:[{type:"element",name:"w:rFonts",attributes:{"w:ascii":"Courier New","w:hAnsi":"Courier New","w:cs":"Courier New","w:hint":"default"}}]}]},{type:"element",name:"w:lvl",attributes:{"w:ilvl":"5","w:tplc":"04090005","w:tentative":"1"},elements:[{type:"element",name:"w:start",attributes:{"w:val":"1"}},{type:"element",name:"w:numFmt",attributes:{"w:val":"bullet"}},{type:"element",name:"w:lvlText",attributes:{"w:val":""}},{type:"element",name:"w:lvlJc",attributes:{"w:val":"left"}},{type:"element",name:"w:pPr",elements:[{type:"element",name:"w:ind",attributes:{"w:left":"4320","w:hanging":"360"}}]},{type:"element",name:"w:rPr",elements:[{type:"element",name:"w:rFonts",attributes:{"w:ascii":"Wingdings","w:hAnsi":"Wingdings","w:hint":"default"}}]}]},{type:"element",name:"w:lvl",attributes:{"w:ilvl":"6","w:tplc":"04090001","w:tentative":"1"},elements:[{type:"element",name:"w:start",attributes:{"w:val":"1"}},{type:"element",name:"w:numFmt",attributes:{"w:val":"bullet"}},{type:"element",name:"w:lvlText",attributes:{"w:val":""}},{type:"element",name:"w:lvlJc",attributes:{"w:val":"left"}},{type:"element",name:"w:pPr",elements:[{type:"element",name:"w:ind",attributes:{"w:left":"5040","w:hanging":"360"}}]},{type:"element",name:"w:rPr",elements:[{type:"element",name:"w:rFonts",attributes:{"w:ascii":"Symbol","w:hAnsi":"Symbol","w:hint":"default"}}]}]},{type:"element",name:"w:lvl",attributes:{"w:ilvl":"7","w:tplc":"04090003","w:tentative":"1"},elements:[{type:"element",name:"w:start",attributes:{"w:val":"1"}},{type:"element",name:"w:numFmt",attributes:{"w:val":"bullet"}},{type:"element",name:"w:lvlText",attributes:{"w:val":"o"}},{type:"element",name:"w:lvlJc",attributes:{"w:val":"left"}},{type:"element",name:"w:pPr",elements:[{type:"element",name:"w:ind",attributes:{"w:left":"5760","w:hanging":"360"}}]},{type:"element",name:"w:rPr",elements:[{type:"element",name:"w:rFonts",attributes:{"w:ascii":"Courier New","w:hAnsi":"Courier New","w:cs":"Courier New","w:hint":"default"}}]}]},{type:"element",name:"w:lvl",attributes:{"w:ilvl":"8","w:tplc":"04090005","w:tentative":"1"},elements:[{type:"element",name:"w:start",attributes:{"w:val":"1"}},{type:"element",name:"w:numFmt",attributes:{"w:val":"bullet"}},{type:"element",name:"w:lvlText",attributes:{"w:val":""}},{type:"element",name:"w:lvlJc",attributes:{"w:val":"left"}},{type:"element",name:"w:pPr",elements:[{type:"element",name:"w:ind",attributes:{"w:left":"6480","w:hanging":"360"}}]},{type:"element",name:"w:rPr",elements:[{type:"element",name:"w:rFonts",attributes:{"w:ascii":"Wingdings","w:hAnsi":"Wingdings","w:hint":"default"}}]}]}]},$u=(t,e)=>{const n=Kt(i=>i.type===e)(t.selection);if(!n)return!0;const r=t.doc.resolve(Math.max(0,n.pos-1)).before(n.depth);if(r===void 0)return!0;const o=t.doc.nodeAt(r);return n.node.type===o?.type&&Pr(t.doc,n.pos)&&t.join(n.pos),!0},Ou=(t,e)=>{const n=Kt(i=>i.type===e)(t.selection);if(!n)return!0;const r=t.doc.resolve(n.start).after(n.depth);if(r===void 0)return!0;const o=t.doc.nodeAt(r);return n.node.type===o?.type&&Pr(t.doc,r)&&t.join(r),!0},q$=(t,e,n,r={})=>o=>{const{editor:i,tr:s,state:a,dispatch:l,chain:c,can:u,commands:d}=o,{extensions:p,splittableMarks:f}=i.extensionService,h=pt(t,a.schema),m=pt(e,a.schema),{selection:y,storedMarks:g}=a,{$from:v,$to:k}=y,b=v.blockRange(k),C=g||y.$to.parentOffset&&y.$from.marks();if(!b)return!1;const D=Kt(G=>Ud(G.type.name,p))(y),M=i.converter?.numbering??null;if(b.depth>=1&&D&&b.depth-D.depth<=1){if(D.node.type===h){const{listId:G}=D.node.attrs;return i.converter&&(i.converter.numbering=U$(G,M)),d.liftListItem(m)}if(Ud(D.node.type.name,p)&&h.validContent(D.node.content)&&l)return c().command(()=>(s.setNodeMarkup(D.pos,h),!0)).command(()=>$u(s,h)).command(()=>Ou(s,h)).run()}const I=({ensureMarks:G=!1})=>()=>{const oe=u().wrapInList(h,r);if(G){const N=C.filter(H=>f.includes(H.type.name));s.ensureMarks(N)}return oe?!0:d.clearNodes()},E=M?.definitions?J1(M.definitions):null;return i.converter&&(i.converter.numbering=V$(E,M,h)),r.listId=E,!n||!C||!l?c().command(I({ensureMarks:!1})).wrapInList(h,r).command(()=>$u(s,h)).command(()=>Ou(s,h)).run():c().command(I({ensureMarks:!0})).wrapInList(h,r).command(()=>$u(s,h)).command(()=>Ou(s,h)).run()},J1=t=>Math.max(...Object.keys(t).map(Number))+1,V$=(t,e,n)=>{const r=n.name==="orderedList"?z$:j$,o={...e},i=J1(o.abstracts),s={...r,attributes:{...r.attributes,"w:abstractNumId":String(i)}};o.abstracts[i]=s;const a={type:"element",name:"w:num",attributes:{"w:numId":String(t),"w16cid:durableId":"485517411"},elements:[{name:"w:abstractNumId",attributes:{"w:val":String(i)}}]};return o.definitions[t]=a,o},U$=(t,e)=>{const{definitions:n,abstracts:r}=e,o=n[t].elements[0].attributes["w:val"];return delete n[t],delete r[o],e},H$=t=>e=>{const{tr:n,state:r,dispatch:o,editor:i}=e,s=pt(t,r.schema),{$from:a,$to:l,node:c}=r.selection;if(c&&c.isBlock||a.depth<2||!a.sameParent(l))return!1;const u=a.node(-1);if(u.type!==s)return!1;const d=i.extensionService.attributes;if(a.parent.content.size===0&&a.node(-1).childCount===a.indexAfter(-1)){if(a.depth===2||a.node(-3).type!==s||a.index(-2)!==a.node(-2).childCount-1)return!1;if(o){let y=ye.empty;const g=a.index(-1)?1:a.index(-2)?2:3;for(let M=a.depth-g;M>=a.depth-3;M--)y=ye.from(a.node(M).copy(y));const v=a.indexAfter(-1)<a.node(-2).childCount?1:a.indexAfter(-2)<a.node(-3).childCount?2:3,k=Te.getSplittedAttributes(d,a.node().type.name,a.node().attrs),b=s.contentMatch.defaultType?.createAndFill(k)||void 0;y=y.append(ye.from(s.createAndFill(null,b)||void 0));const C=a.before(a.depth-(g-1));n.replace(C,a.after(-v),new ve(y,4-g,0));let D=-1;n.doc.nodesBetween(C,n.doc.content.size,(M,I)=>{if(D>-1)return!1;M.isTextblock&&M.content.size===0&&(D=I+1)}),D>-1&&n.setSelection(Pe.near(n.doc.resolve(D))),n.scrollIntoView()}return!0}const p=l.pos===a.end()?u.contentMatchAt(0).defaultType:null,f=Te.getSplittedAttributes(d,u.type.name,u.attrs),h=Te.getSplittedAttributes(d,a.node().type.name,a.node().attrs);n.delete(a.pos,l.pos);const m=p?[{type:s,attrs:f},{type:p,attrs:h}]:[{type:s,attrs:f}];if(!tr(n.doc,a.pos,2))return!1;if(o){const{selection:y,storedMarks:g}=r,{splittableMarks:v}=i.extensionService,k=g||y.$to.parentOffset&&y.$from.marks();if(n.split(a.pos,2,m).scrollIntoView(),!k||!o)return!0;const b=k.filter(C=>v.includes(C.type.name));n.ensureMarks(b),n.setMeta("splitListItem",b)}return!0},W$=t=>({state:e,dispatch:n})=>{const r=pt(t,e.schema);return L$(r)(e,n)},G$=t=>({state:e,dispatch:n})=>{const r=pt(t,e.schema);return F$(r)(e,n)},K$=Object.freeze(Object.defineProperty({__proto__:null,clearNodes:p$,command:zT,createParagraphNear:r$,deleteSelection:g$,exitCode:i$,first:PT,insertContent:T$,insertContentAt:M$,insertTabChar:jT,insertTabCharacter:I1,insertTabNode:qT,joinBackward:x$,joinDown:v$,joinForward:k$,joinUp:b$,liftEmptyBlock:n$,liftListItem:G$,newlineInCode:o$,resetAttributes:w$,selectAll:m$,selectNodeBackward:S$,selectNodeForward:A$,selectTextblockEnd:E$,selectTextblockStart:C$,setMark:a$,setMeta:VT,setNode:f$,sinkListItem:W$,splitBlock:t$,splitListItem:H$,toggleList:q$,toggleMark:d$,toggleNode:h$,undoInputRule:D$,unsetAllMarks:u$,unsetMark:c$,updateAttributes:y$,wrapInList:P$},Symbol.toStringTag,{value:"Module"})),J$=Ye.create({name:"commands",addCommands(){return{...K$}}}),X$=t=>t.commands.first(({commands:e})=>[()=>e.newlineInCode(),()=>e.createParagraphNear(),()=>e.liftEmptyBlock(),()=>e.splitBlock()]),$i=t=>t.commands.first(({commands:e,tr:n})=>[()=>e.undoInputRule(),()=>(n.setMeta("inputType","deleteContentBackward"),!1),()=>e.deleteSelection(),()=>e.joinBackward(),()=>e.selectNodeBackward()]),$o=t=>t.commands.first(({commands:e})=>[()=>e.deleteSelection(),()=>e.joinForward(),()=>e.selectNodeForward()]),Y$=Ye.create({name:"keymap",addShortcuts(){const t={Enter:()=>X$(this.editor),"Mod-Enter":()=>this.editor.commands.exitCode(),Backspace:()=>$i(this.editor),"Mod-Backspace":()=>$i(this.editor),"Shift-Backspace":()=>$i(this.editor),Delete:()=>$o(this.editor),"Mod-Delete":()=>$o(this.editor),"Mod-a":()=>this.editor.commands.selectAll(),Tab:()=>this.editor.commands.insertTabNode()},e={...t},n={...t,"Ctrl-h":()=>$i(this.editor),"Alt-Backspace":()=>$i(this.editor),"Ctrl-d":()=>$o(this.editor),"Ctrl-Alt-Backspace":()=>$o(this.editor),"Alt-Delete":()=>$o(this.editor),"Alt-d":()=>$o(this.editor),"Ctrl-a":()=>this.editor.commands.selectTextblockStart(),"Ctrl-e":()=>this.editor.commands.selectTextblockEnd(),"Ctrl-t":()=>this.editor.commands.insertTabChar()};return TE()||$E()?n:e}}),Z$=Ye.create({name:"editable",addPmPlugins(){return[new Ue({key:new Ge("editable"),props:{editable:()=>this.editor.options.editable}})]}}),Q$=Ye.create({name:"editorFocus",addPmPlugins(){const t=this.editor;return[new Ue({key:new Ge("editorFocus"),props:{handleDOMEvents:{focus:(e,n)=>{t.isFocused=!0;const r=t.state.tr.setMeta("focus",{event:n}).setMeta("addToHistory",!1);return e.dispatch(r),!1},blur:(e,n)=>{t.isFocused=!1;const r=t.state.tr.setMeta("blur",{event:n}).setMeta("addToHistory",!1);return e.dispatch(r),!1}}}})]}});function X1(t,e,n,{check:r=!1}={}){const o=t.getSchema(n);if(o){const i=e.nodeFromJSON(o);return r&&i.check(),i}return e.topNodeType.createAndFill()}function bs(t,e){return e.nodes[t]||e.marks[t]||null}function eO(t){const e={bulletList:1,orderedList:2};return{attributes:{parentAttributes:{"w14:paraId":Yn(),"w14:textId":Yn(),"w:rsidR":Yn(),"w:rsidRDefault":Yn(),"w:rsidP":Yn(),paragraphProperties:{type:"element",name:"w:pPr",elements:[{type:"element",name:"w:pStyle",attributes:{"w:val":"ListParagraph"}},{type:"element",name:"w:numPr",elements:[{type:"element",name:"w:ilvl",attributes:{"w:val":"0"}},{type:"element",name:"w:numId",attributes:{"w:val":e[t]||0}}]}]}}}}}function tO(t,e,n){const r=[];return t===e?n.resolve(t).marks().forEach(o=>{const i=n.resolve(t-1),s=gf(i,o.type);s&&r.push({mark:o,...s})}):n.nodesBetween(t,e,(o,i)=>{!o||o?.nodeSize===void 0||r.push(...o.marks.map(s=>({from:i,to:i+o.nodeSize,mark:s})))}),r}function Y1(t,e,n={}){if(!e)return wl(t,null,n)||yl(t,null,n);const r=Gs(e,t.schema);return r==="node"?wl(t,e,n):r==="mark"?yl(t,e,n):!1}function yf(t,e){const n=[];return t.descendants((r,o)=>{e(r)&&n.push({node:r,pos:o})}),n}function Z1(t,e,n){const r=t.state.doc.content.size,o=pl(e,0,r),i=pl(n,0,r),s=t.coordsAtPos(o),a=t.coordsAtPos(i,-1),l=Math.min(s.top,a.top),c=Math.max(s.bottom,a.bottom),u=Math.min(s.left,a.left),d=Math.max(s.right,a.right),p=d-u,f=c-l,h={top:l,bottom:c,left:u,right:d,width:p,height:f,x:u,y:l};return{...h,toJSON:()=>h}}const wf=t=>{const{$head:e}=t.selection;for(let n=e.depth;n>0;n-=1)if(e.node(n).type?.spec?.tableRole==="row")return!0;return!1},oc=Object.freeze(Object.defineProperty({__proto__:null,chainableEditorState:pf,cleanSchemaItem:zd,createDocument:X1,defaultBlockAt:W1,findChildren:yf,findMark:nc,findParentNode:Kt,findParentNodeClosestToPos:rc,generateDocxListAttributes:eO,generateDocxRandomId:Yn,generateRandom32BitHex:lf,getActiveFormatting:df,getExtensionConfigField:Fe,getMarkRange:gf,getMarkType:cr,getMarksBetween:tO,getMarksFromSelection:Ws,getNodeType:pt,getSchemaTypeByName:bs,getSchemaTypeNameByName:Gs,isActive:Y1,isInTable:wf,isList:Ud,isMarkActive:yl,isNodeActive:wl,isTextSelection:G1,posToDOMRect:Z1},Symbol.toStringTag,{value:"Module"})),Qr=globalThis||void 0||self,Ct=function(t){for(var e=0;;e++)if(t=t.previousSibling,!t)return e},ci=function(t){let e=t.assignedSlot||t.parentNode;return e&&e.nodeType==11?e.host:e};let Hd=null;const Kn=function(t,e,n){let r=Hd||(Hd=document.createRange());return r.setEnd(t,n??t.nodeValue.length),r.setStart(t,e||0),r},nO=function(){Hd=null},yo=function(t,e,n,r){return n&&(Kg(t,e,n,r,-1)||Kg(t,e,n,r,1))},rO=/^(img|br|input|textarea|hr)$/i;function Kg(t,e,n,r,o){for(;;){if(t==n&&e==r)return!0;if(e==(o<0?0:hn(t))){let i=t.parentNode;if(!i||i.nodeType!=1||Ks(t)||rO.test(t.nodeName)||t.contentEditable=="false")return!1;e=Ct(t)+(o<0?0:1),t=i}else if(t.nodeType==1){if(t=t.childNodes[e+(o<0?-1:0)],t.contentEditable=="false")return!1;e=o<0?hn(t):0}else return!1}}function hn(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function oO(t,e){for(;;){if(t.nodeType==3&&e)return t;if(t.nodeType==1&&e>0){if(t.contentEditable=="false")return null;t=t.childNodes[e-1],e=hn(t)}else if(t.parentNode&&!Ks(t))e=Ct(t),t=t.parentNode;else return null}}function iO(t,e){for(;;){if(t.nodeType==3&&e<t.nodeValue.length)return t;if(t.nodeType==1&&e<t.childNodes.length){if(t.contentEditable=="false")return null;t=t.childNodes[e],e=0}else if(t.parentNode&&!Ks(t))e=Ct(t)+1,t=t.parentNode;else return null}}function sO(t,e,n){for(let r=e==0,o=e==hn(t);r||o;){if(t==n)return!0;let i=Ct(t);if(t=t.parentNode,!t)return!1;r=r&&i==0,o=o&&i==hn(t)}}function Ks(t){let e;for(let n=t;n&&!(e=n.pmViewDesc);n=n.parentNode);return e&&e.node&&e.node.isBlock&&(e.dom==t||e.contentDOM==t)}const ic=function(t){return t.focusNode&&yo(t.focusNode,t.focusOffset,t.anchorNode,t.anchorOffset)};function Xr(t,e){let n=document.createEvent("Event");return n.initEvent("keydown",!0,!0),n.keyCode=t,n.key=n.code=e,n}function aO(t){let e=t.activeElement;for(;e&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e}function lO(t,e,n){if(t.caretPositionFromPoint)try{let r=t.caretPositionFromPoint(e,n);if(r)return{node:r.offsetNode,offset:Math.min(hn(r.offsetNode),r.offset)}}catch{}if(t.caretRangeFromPoint){let r=t.caretRangeFromPoint(e,n);if(r)return{node:r.startContainer,offset:Math.min(hn(r.startContainer),r.startOffset)}}}const Bn=typeof navigator<"u"?navigator:null,Jg=typeof document<"u"?document:null,zr=Bn&&Bn.userAgent||"",Wd=/Edge\/(\d+)/.exec(zr),Q1=/MSIE \d/.exec(zr),Gd=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(zr),Jt=!!(Q1||Gd||Wd),Or=Q1?document.documentMode:Gd?+Gd[1]:Wd?+Wd[1]:0,xn=!Jt&&/gecko\/(\d+)/i.test(zr);xn&&+(/Firefox\/(\d+)/.exec(zr)||[0,0])[1];const Kd=!Jt&&/Chrome\/(\d+)/.exec(zr),Dt=!!Kd,e2=Kd?+Kd[1]:0,qt=!Jt&&!!Bn&&/Apple Computer/.test(Bn.vendor),ui=qt&&(/Mobile\/\w+/.test(zr)||!!Bn&&Bn.maxTouchPoints>2),fn=ui||(Bn?/Mac/.test(Bn.platform):!1),cO=Bn?/Win/.test(Bn.platform):!1,Qn=/Android \d/.test(zr),Js=!!Jg&&"webkitFontSmoothing"in Jg.documentElement.style,uO=Js?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function dO(t){let e=t.defaultView&&t.defaultView.visualViewport;return e?{left:0,right:e.width,top:0,bottom:e.height}:{left:0,right:t.documentElement.clientWidth,top:0,bottom:t.documentElement.clientHeight}}function Un(t,e){return typeof t=="number"?t:t[e]}function pO(t){let e=t.getBoundingClientRect(),n=e.width/t.offsetWidth||1,r=e.height/t.offsetHeight||1;return{left:e.left,right:e.left+t.clientWidth*n,top:e.top,bottom:e.top+t.clientHeight*r}}function Xg(t,e,n){let r=t.someProp("scrollThreshold")||0,o=t.someProp("scrollMargin")||5,i=t.dom.ownerDocument;for(let s=n||t.dom;s;){if(s.nodeType!=1){s=ci(s);continue}let a=s,l=a==i.body,c=l?dO(i):pO(a),u=0,d=0;if(e.top<c.top+Un(r,"top")?d=-(c.top-e.top+Un(o,"top")):e.bottom>c.bottom-Un(r,"bottom")&&(d=e.bottom-e.top>c.bottom-c.top?e.top+Un(o,"top")-c.top:e.bottom-c.bottom+Un(o,"bottom")),e.left<c.left+Un(r,"left")?u=-(c.left-e.left+Un(o,"left")):e.right>c.right-Un(r,"right")&&(u=e.right-c.right+Un(o,"right")),u||d)if(l)i.defaultView.scrollBy(u,d);else{let f=a.scrollLeft,h=a.scrollTop;d&&(a.scrollTop+=d),u&&(a.scrollLeft+=u);let m=a.scrollLeft-f,y=a.scrollTop-h;e={left:e.left-m,top:e.top-y,right:e.right-m,bottom:e.bottom-y}}let p=l?"fixed":getComputedStyle(s).position;if(/^(fixed|sticky)$/.test(p))break;s=p=="absolute"?s.offsetParent:ci(s)}}function fO(t){let e=t.dom.getBoundingClientRect(),n=Math.max(0,e.top),r,o;for(let i=(e.left+e.right)/2,s=n+1;s<Math.min(innerHeight,e.bottom);s+=5){let a=t.root.elementFromPoint(i,s);if(!a||a==t.dom||!t.dom.contains(a))continue;let l=a.getBoundingClientRect();if(l.top>=n-20){r=a,o=l.top;break}}return{refDOM:r,refTop:o,stack:t2(t.dom)}}function t2(t){let e=[],n=t.ownerDocument;for(let r=t;r&&(e.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),t!=n);r=ci(r));return e}function hO({refDOM:t,refTop:e,stack:n}){let r=t?t.getBoundingClientRect().top:0;n2(n,r==0?0:r-e)}function n2(t,e){for(let n=0;n<t.length;n++){let{dom:r,top:o,left:i}=t[n];r.scrollTop!=o+e&&(r.scrollTop=o+e),r.scrollLeft!=i&&(r.scrollLeft=i)}}let Oo=null;function mO(t){if(t.setActive)return t.setActive();if(Oo)return t.focus(Oo);let e=t2(t);t.focus(Oo==null?{get preventScroll(){return Oo={preventScroll:!0},!0}}:void 0),Oo||(Oo=!1,n2(e,0))}function r2(t,e){let n,r=2e8,o,i=0,s=e.top,a=e.top,l,c;for(let u=t.firstChild,d=0;u;u=u.nextSibling,d++){let p;if(u.nodeType==1)p=u.getClientRects();else if(u.nodeType==3)p=Kn(u).getClientRects();else continue;for(let f=0;f<p.length;f++){let h=p[f];if(h.top<=s&&h.bottom>=a){s=Math.max(h.bottom,s),a=Math.min(h.top,a);let m=h.left>e.left?h.left-e.left:h.right<e.left?e.left-h.right:0;if(m<r){n=u,r=m,o=m&&n.nodeType==3?{left:h.right<e.left?h.right:h.left,top:e.top}:e,u.nodeType==1&&m&&(i=d+(e.left>=(h.left+h.right)/2?1:0));continue}}else h.top>e.top&&!l&&h.left<=e.left&&h.right>=e.left&&(l=u,c={left:Math.max(h.left,Math.min(h.right,e.left)),top:h.top});!n&&(e.left>=h.right&&e.top>=h.top||e.left>=h.left&&e.top>=h.bottom)&&(i=d+1)}}return!n&&l&&(n=l,o=c,r=0),n&&n.nodeType==3?gO(n,o):!n||r&&n.nodeType==1?{node:t,offset:i}:r2(n,o)}function gO(t,e){let n=t.nodeValue.length,r=document.createRange();for(let o=0;o<n;o++){r.setEnd(t,o+1),r.setStart(t,o);let i=gr(r,1);if(i.top!=i.bottom&&bf(e,i))return{node:t,offset:o+(e.left>=(i.left+i.right)/2?1:0)}}return{node:t,offset:0}}function bf(t,e){return t.left>=e.left-1&&t.left<=e.right+1&&t.top>=e.top-1&&t.top<=e.bottom+1}function yO(t,e){let n=t.parentNode;return n&&/^li$/i.test(n.nodeName)&&e.left<t.getBoundingClientRect().left?n:t}function wO(t,e,n){let{node:r,offset:o}=r2(e,n),i=-1;if(r.nodeType==1&&!r.firstChild){let s=r.getBoundingClientRect();i=s.left!=s.right&&n.left>(s.left+s.right)/2?1:-1}return t.docView.posFromDOM(r,o,i)}function bO(t,e,n,r){let o=-1;for(let i=e,s=!1;i!=t.dom;){let a=t.docView.nearestDesc(i,!0),l;if(!a)return null;if(a.dom.nodeType==1&&(a.node.isBlock&&a.parent||!a.contentDOM)&&((l=a.dom.getBoundingClientRect()).width||l.height)&&(a.node.isBlock&&a.parent&&(!s&&l.left>r.left||l.top>r.top?o=a.posBefore:(!s&&l.right<r.left||l.bottom<r.top)&&(o=a.posAfter),s=!0),!a.contentDOM&&o<0&&!a.node.isText))return(a.node.isBlock?r.top<(l.top+l.bottom)/2:r.left<(l.left+l.right)/2)?a.posBefore:a.posAfter;i=a.dom.parentNode}return o>-1?o:t.docView.posFromDOM(e,n,-1)}function o2(t,e,n){let r=t.childNodes.length;if(r&&n.top<n.bottom)for(let o=Math.max(0,Math.min(r-1,Math.floor(r*(e.top-n.top)/(n.bottom-n.top))-2)),i=o;;){let s=t.childNodes[i];if(s.nodeType==1){let a=s.getClientRects();for(let l=0;l<a.length;l++){let c=a[l];if(bf(e,c))return o2(s,e,c)}}if((i=(i+1)%r)==o)break}return t}function vO(t,e){let n=t.dom.ownerDocument,r,o=0,i=lO(n,e.left,e.top);i&&({node:r,offset:o}=i);let s=(t.root.elementFromPoint?t.root:n).elementFromPoint(e.left,e.top),a;if(!s||!t.dom.contains(s.nodeType!=1?s.parentNode:s)){let c=t.dom.getBoundingClientRect();if(!bf(e,c)||(s=o2(t.dom,e,c),!s))return null}if(qt)for(let c=s;r&&c;c=ci(c))c.draggable&&(r=void 0);if(s=yO(s,e),r){if(xn&&r.nodeType==1&&(o=Math.min(o,r.childNodes.length),o<r.childNodes.length)){let u=r.childNodes[o],d;u.nodeName=="IMG"&&(d=u.getBoundingClientRect()).right<=e.left&&d.bottom>e.top&&o++}let c;Js&&o&&r.nodeType==1&&(c=r.childNodes[o-1]).nodeType==1&&c.contentEditable=="false"&&c.getBoundingClientRect().top>=e.top&&o--,r==t.dom&&o==r.childNodes.length-1&&r.lastChild.nodeType==1&&e.top>r.lastChild.getBoundingClientRect().bottom?a=t.state.doc.content.size:(o==0||r.nodeType!=1||r.childNodes[o-1].nodeName!="BR")&&(a=bO(t,r,o,e))}a==null&&(a=wO(t,s,e));let l=t.docView.nearestDesc(s,!0);return{pos:a,inside:l?l.posAtStart-l.border:-1}}function Yg(t){return t.top<t.bottom||t.left<t.right}function gr(t,e){let n=t.getClientRects();if(n.length){let r=n[e<0?0:n.length-1];if(Yg(r))return r}return Array.prototype.find.call(n,Yg)||t.getBoundingClientRect()}const xO=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function i2(t,e,n){let{node:r,offset:o,atom:i}=t.docView.domFromPos(e,n<0?-1:1),s=Js||xn;if(r.nodeType==3)if(s&&(xO.test(r.nodeValue)||(n<0?!o:o==r.nodeValue.length))){let a=gr(Kn(r,o,o),n);if(xn&&o&&/\s/.test(r.nodeValue[o-1])&&o<r.nodeValue.length){let l=gr(Kn(r,o-1,o-1),-1);if(l.top==a.top){let c=gr(Kn(r,o,o+1),-1);if(c.top!=a.top)return Oi(c,c.left<l.left)}}return a}else{let a=o,l=o,c=n<0?1:-1;return n<0&&!o?(l++,c=-1):n>=0&&o==r.nodeValue.length?(a--,c=1):n<0?a--:l++,Oi(gr(Kn(r,a,l),c),c<0)}if(!t.state.doc.resolve(e-(i||0)).parent.inlineContent){if(i==null&&o&&(n<0||o==hn(r))){let a=r.childNodes[o-1];if(a.nodeType==1)return Mu(a.getBoundingClientRect(),!1)}if(i==null&&o<hn(r)){let a=r.childNodes[o];if(a.nodeType==1)return Mu(a.getBoundingClientRect(),!0)}return Mu(r.getBoundingClientRect(),n>=0)}if(i==null&&o&&(n<0||o==hn(r))){let a=r.childNodes[o-1],l=a.nodeType==3?Kn(a,hn(a)-(s?0:1)):a.nodeType==1&&(a.nodeName!="BR"||!a.nextSibling)?a:null;if(l)return Oi(gr(l,1),!1)}if(i==null&&o<hn(r)){let a=r.childNodes[o];for(;a.pmViewDesc&&a.pmViewDesc.ignoreForCoords;)a=a.nextSibling;let l=a?a.nodeType==3?Kn(a,0,s?0:1):a.nodeType==1?a:null:null;if(l)return Oi(gr(l,-1),!0)}return Oi(gr(r.nodeType==3?Kn(r):r,-n),n>=0)}function Oi(t,e){if(t.width==0)return t;let n=e?t.left:t.right;return{top:t.top,bottom:t.bottom,left:n,right:n}}function Mu(t,e){if(t.height==0)return t;let n=e?t.top:t.bottom;return{top:n,bottom:n,left:t.left,right:t.right}}function s2(t,e,n){let r=t.state,o=t.root.activeElement;r!=e&&t.updateState(e),o!=t.dom&&t.focus();try{return n()}finally{r!=e&&t.updateState(r),o!=t.dom&&o&&o.focus()}}function kO(t,e,n){let r=e.selection,o=n=="up"?r.$from:r.$to;return s2(t,e,()=>{let{node:i}=t.docView.domFromPos(o.pos,n=="up"?-1:1);for(;;){let a=t.docView.nearestDesc(i,!0);if(!a)break;if(a.node.isBlock){i=a.contentDOM||a.dom;break}i=a.dom.parentNode}let s=i2(t,o.pos,1);for(let a=i.firstChild;a;a=a.nextSibling){let l;if(a.nodeType==1)l=a.getClientRects();else if(a.nodeType==3)l=Kn(a,0,a.nodeValue.length).getClientRects();else continue;for(let c=0;c<l.length;c++){let u=l[c];if(u.bottom>u.top+1&&(n=="up"?s.top-u.top>(u.bottom-s.top)*2:u.bottom-s.bottom>(s.bottom-u.top)*2))return!1}}return!0})}const SO=/[\u0590-\u08ac]/;function AO(t,e,n){let{$head:r}=e.selection;if(!r.parent.isTextblock)return!1;let o=r.parentOffset,i=!o,s=o==r.parent.content.size,a=t.domSelection();return a?!SO.test(r.parent.textContent)||!a.modify?n=="left"||n=="backward"?i:s:s2(t,e,()=>{let{focusNode:l,focusOffset:c,anchorNode:u,anchorOffset:d}=t.domSelectionRange(),p=a.caretBidiLevel;a.modify("move",n,"character");let f=r.depth?t.docView.domAfterPos(r.before()):t.dom,{focusNode:h,focusOffset:m}=t.domSelectionRange(),y=h&&!f.contains(h.nodeType==1?h:h.parentNode)||l==h&&c==m;try{a.collapse(u,d),l&&(l!=u||c!=d)&&a.extend&&a.extend(l,c)}catch{}return p!=null&&(a.caretBidiLevel=p),y}):r.pos==r.start()||r.pos==r.end()}let Zg=null,Qg=null,ey=!1;function CO(t,e,n){return Zg==e&&Qg==n?ey:(Zg=e,Qg=n,ey=n=="up"||n=="down"?kO(t,e,n):AO(t,e,n))}const mn=0,ty=1,eo=2,Ln=3;let Xs=class{constructor(e,n,r,o){this.parent=e,this.children=n,this.dom=r,this.contentDOM=o,this.dirty=mn,r.pmViewDesc=this}matchesWidget(e){return!1}matchesMark(e){return!1}matchesNode(e,n,r){return!1}matchesHack(e){return!1}parseRule(){return null}stopEvent(e){return!1}get size(){let e=0;for(let n=0;n<this.children.length;n++)e+=this.children[n].size;return e}get border(){return 0}destroy(){this.parent=void 0,this.dom.pmViewDesc==this&&(this.dom.pmViewDesc=void 0);for(let e=0;e<this.children.length;e++)this.children[e].destroy()}posBeforeChild(e){for(let n=0,r=this.posAtStart;;n++){let o=this.children[n];if(o==e)return r;r+=o.size}}get posBefore(){return this.parent.posBeforeChild(this)}get posAtStart(){return this.parent?this.parent.posBeforeChild(this)+this.border:0}get posAfter(){return this.posBefore+this.size}get posAtEnd(){return this.posAtStart+this.size-2*this.border}localPosFromDOM(e,n,r){if(this.contentDOM&&this.contentDOM.contains(e.nodeType==1?e:e.parentNode))if(r<0){let i,s;if(e==this.contentDOM)i=e.childNodes[n-1];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;i=e.previousSibling}for(;i&&!((s=i.pmViewDesc)&&s.parent==this);)i=i.previousSibling;return i?this.posBeforeChild(s)+s.size:this.posAtStart}else{let i,s;if(e==this.contentDOM)i=e.childNodes[n];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;i=e.nextSibling}for(;i&&!((s=i.pmViewDesc)&&s.parent==this);)i=i.nextSibling;return i?this.posBeforeChild(s):this.posAtEnd}let o;if(e==this.dom&&this.contentDOM)o=n>Ct(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))o=e.compareDocumentPosition(this.contentDOM)&2;else if(this.dom.firstChild){if(n==0)for(let i=e;;i=i.parentNode){if(i==this.dom){o=!1;break}if(i.previousSibling)break}if(o==null&&n==e.childNodes.length)for(let i=e;;i=i.parentNode){if(i==this.dom){o=!0;break}if(i.nextSibling)break}}return o??r>0?this.posAtEnd:this.posAtStart}nearestDesc(e,n=!1){for(let r=!0,o=e;o;o=o.parentNode){let i=this.getDesc(o),s;if(i&&(!n||i.node))if(r&&(s=i.nodeDOM)&&!(s.nodeType==1?s.contains(e.nodeType==1?e:e.parentNode):s==e))r=!1;else return i}}getDesc(e){let n=e.pmViewDesc;for(let r=n;r;r=r.parent)if(r==this)return n}posFromDOM(e,n,r){for(let o=e;o;o=o.parentNode){let i=this.getDesc(o);if(i)return i.localPosFromDOM(e,n,r)}return-1}descAt(e){for(let n=0,r=0;n<this.children.length;n++){let o=this.children[n],i=r+o.size;if(r==e&&i!=r){for(;!o.border&&o.children.length;)for(let s=0;s<o.children.length;s++){let a=o.children[s];if(a.size){o=a;break}}return o}if(e<i)return o.descAt(e-r-o.border);r=i}}domFromPos(e,n){if(!this.contentDOM)return{node:this.dom,offset:0,atom:e+1};let r=0,o=0;for(let i=0;r<this.children.length;r++){let s=this.children[r],a=i+s.size;if(a>e||s instanceof d2){o=e-i;break}i=a}if(o)return this.children[r].domFromPos(o-this.children[r].border,n);for(let i;r&&!(i=this.children[r-1]).size&&i instanceof a2&&i.side>=0;r--);if(n<=0){let i,s=!0;for(;i=r?this.children[r-1]:null,!(!i||i.dom.parentNode==this.contentDOM);r--,s=!1);return i&&n&&s&&!i.border&&!i.domAtom?i.domFromPos(i.size,n):{node:this.contentDOM,offset:i?Ct(i.dom)+1:0}}else{let i,s=!0;for(;i=r<this.children.length?this.children[r]:null,!(!i||i.dom.parentNode==this.contentDOM);r++,s=!1);return i&&s&&!i.border&&!i.domAtom?i.domFromPos(0,n):{node:this.contentDOM,offset:i?Ct(i.dom):this.contentDOM.childNodes.length}}}parseRange(e,n,r=0){if(this.children.length==0)return{node:this.contentDOM,from:e,to:n,fromOffset:0,toOffset:this.contentDOM.childNodes.length};let o=-1,i=-1;for(let s=r,a=0;;a++){let l=this.children[a],c=s+l.size;if(o==-1&&e<=c){let u=s+l.border;if(e>=u&&n<=c-l.border&&l.node&&l.contentDOM&&this.contentDOM.contains(l.contentDOM))return l.parseRange(e,n,u);e=s;for(let d=a;d>0;d--){let p=this.children[d-1];if(p.size&&p.dom.parentNode==this.contentDOM&&!p.emptyChildAt(1)){o=Ct(p.dom)+1;break}e-=p.size}o==-1&&(o=0)}if(o>-1&&(c>n||a==this.children.length-1)){n=c;for(let u=a+1;u<this.children.length;u++){let d=this.children[u];if(d.size&&d.dom.parentNode==this.contentDOM&&!d.emptyChildAt(-1)){i=Ct(d.dom);break}n+=d.size}i==-1&&(i=this.contentDOM.childNodes.length);break}s=c}return{node:this.contentDOM,from:e,to:n,fromOffset:o,toOffset:i}}emptyChildAt(e){if(this.border||!this.contentDOM||!this.children.length)return!1;let n=this.children[e<0?0:this.children.length-1];return n.size==0||n.emptyChildAt(e)}domAfterPos(e){let{node:n,offset:r}=this.domFromPos(e,0);if(n.nodeType!=1||r==n.childNodes.length)throw new RangeError("No node after pos "+e);return n.childNodes[r]}setSelection(e,n,r,o=!1){let i=Math.min(e,n),s=Math.max(e,n);for(let f=0,h=0;f<this.children.length;f++){let m=this.children[f],y=h+m.size;if(i>h&&s<y)return m.setSelection(e-h-m.border,n-h-m.border,r,o);h=y}let a=this.domFromPos(e,e?-1:1),l=n==e?a:this.domFromPos(n,n?-1:1),c=r.root.getSelection(),u=r.domSelectionRange(),d=!1;if((xn||qt)&&e==n){let{node:f,offset:h}=a;if(f.nodeType==3){if(d=!!(h&&f.nodeValue[h-1]==`
|
|
41
41
|
`),d&&h==f.nodeValue.length)for(let m=f,y;m;m=m.parentNode){if(y=m.nextSibling){y.nodeName=="BR"&&(a=l={node:y.parentNode,offset:Ct(y)+1});break}let g=m.pmViewDesc;if(g&&g.node&&g.node.isBlock)break}}else{let m=f.childNodes[h-1];d=m&&(m.nodeName=="BR"||m.contentEditable=="false")}}if(xn&&u.focusNode&&u.focusNode!=l.node&&u.focusNode.nodeType==1){let f=u.focusNode.childNodes[u.focusOffset];f&&f.contentEditable=="false"&&(o=!0)}if(!(o||d&&qt)&&yo(a.node,a.offset,u.anchorNode,u.anchorOffset)&&yo(l.node,l.offset,u.focusNode,u.focusOffset))return;let p=!1;if((c.extend||e==n)&&!d){c.collapse(a.node,a.offset);try{e!=n&&c.extend(l.node,l.offset),p=!0}catch{}}if(!p){if(e>n){let h=a;a=l,l=h}let f=document.createRange();f.setEnd(l.node,l.offset),f.setStart(a.node,a.offset),c.removeAllRanges(),c.addRange(f)}}ignoreMutation(e){return!this.contentDOM&&e.type!="selection"}get contentLost(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}markDirty(e,n){for(let r=0,o=0;o<this.children.length;o++){let i=this.children[o],s=r+i.size;if(r==s?e<=s&&n>=r:e<s&&n>r){let a=r+i.border,l=s-i.border;if(e>=a&&n<=l){this.dirty=e==r||n==s?eo:ty,e==a&&n==l&&(i.contentLost||i.dom.parentNode!=this.contentDOM)?i.dirty=Ln:i.markDirty(e-a,n-a);return}else i.dirty=i.dom==i.contentDOM&&i.dom.parentNode==this.contentDOM&&!i.children.length?eo:Ln}r=s}this.dirty=eo}markParentsDirty(){let e=1;for(let n=this.parent;n;n=n.parent,e++){let r=e==1?eo:ty;n.dirty<r&&(n.dirty=r)}}get domAtom(){return!1}get ignoreForCoords(){return!1}isText(e){return!1}},a2=class extends Xs{constructor(e,n,r,o){let i,s=n.type.toDOM;if(typeof s=="function"&&(s=s(r,()=>{if(!i)return o;if(i.parent)return i.parent.posBeforeChild(i)})),!n.type.spec.raw){if(s.nodeType!=1){let a=document.createElement("span");a.appendChild(s),s=a}s.contentEditable="false",s.classList.add("ProseMirror-widget")}super(e,[],s,null),this.widget=n,this.widget=n,i=this}matchesWidget(e){return this.dirty==mn&&e.type.eq(this.widget.type)}parseRule(){return{ignore:!0}}stopEvent(e){let n=this.widget.spec.stopEvent;return n?n(e):!1}ignoreMutation(e){return e.type!="selection"||this.widget.spec.ignoreSelection}destroy(){this.widget.type.destroy(this.dom),super.destroy()}get domAtom(){return!0}get side(){return this.widget.type.side}};class EO extends Xs{constructor(e,n,r,o){super(e,[],n,null),this.textDOM=r,this.text=o}get size(){return this.text.length}localPosFromDOM(e,n){return e!=this.textDOM?this.posAtStart+(n?this.size:0):this.posAtStart+n}domFromPos(e){return{node:this.textDOM,offset:e}}ignoreMutation(e){return e.type==="characterData"&&e.target.nodeValue==e.oldValue}}let bl=class Jd extends Xs{constructor(e,n,r,o,i){super(e,[],r,o),this.mark=n,this.spec=i}static create(e,n,r,o){let i=o.nodeViews[n.type.name],s=i&&i(n,o,r);return(!s||!s.dom)&&(s=xi.renderSpec(document,n.type.spec.toDOM(n,r),null,n.attrs)),new Jd(e,n,s.dom,s.contentDOM||s.dom,s)}parseRule(){return this.dirty&Ln||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return this.dirty!=Ln&&this.mark.eq(e)}markDirty(e,n){if(super.markDirty(e,n),this.dirty!=mn){let r=this.parent;for(;!r.node;)r=r.parent;r.dirty<this.dirty&&(r.dirty=this.dirty),this.dirty=mn}}slice(e,n,r){let o=Jd.create(this.parent,this.mark,!0,r),i=this.children,s=this.size;n<s&&(i=Yd(i,n,s,r)),e>0&&(i=Yd(i,0,e,r));for(let a=0;a<i.length;a++)i[a].parent=o;return o.children=i,o}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}},Xo=class l2 extends Xs{constructor(e,n,r,o,i,s,a,l,c){super(e,[],i,s),this.node=n,this.outerDeco=r,this.innerDeco=o,this.nodeDOM=a}static create(e,n,r,o,i,s){let a=i.nodeViews[n.type.name],l,c=a&&a(n,i,()=>{if(!l)return s;if(l.parent)return l.parent.posBeforeChild(l)},r,o),u=c&&c.dom,d=c&&c.contentDOM;if(n.isText){if(!u)u=document.createTextNode(n.text);else if(u.nodeType!=3)throw new RangeError("Text must be rendered as a DOM text node")}else u||({dom:u,contentDOM:d}=xi.renderSpec(document,n.type.spec.toDOM(n),null,n.attrs));!d&&!n.isText&&u.nodeName!="BR"&&(u.hasAttribute("contenteditable")||(u.contentEditable="false"),n.type.spec.draggable&&(u.draggable=!0));let p=u;return u=h2(u,r,n),c?l=new TO(e,n,r,o,u,d||null,p,c,i,s+1):n.isText?new c2(e,n,r,o,u,p,i):new l2(e,n,r,o,u,d||null,p,i,s+1)}parseRule(){if(this.node.type.spec.reparseInView)return null;let e={node:this.node.type.name,attrs:this.node.attrs};if(this.node.type.whitespace=="pre"&&(e.preserveWhitespace="full"),!this.contentDOM)e.getContent=()=>this.node.content;else if(!this.contentLost)e.contentElement=this.contentDOM;else{for(let n=this.children.length-1;n>=0;n--){let r=this.children[n];if(this.dom.contains(r.dom.parentNode)){e.contentElement=r.dom.parentNode;break}}e.contentElement||(e.getContent=()=>ye.empty)}return e}matchesNode(e,n,r){return this.dirty==mn&&e.eq(this.node)&&vl(n,this.outerDeco)&&r.eq(this.innerDeco)}get size(){return this.node.nodeSize}get border(){return this.node.isLeaf?0:1}updateChildren(e,n){let r=this.node.inlineContent,o=n,i=e.composing?this.localCompositionInfo(e,n):null,s=i&&i.pos>-1?i:null,a=i&&i.pos<0,l=new OO(this,s&&s.node,e);_O(this.node,this.innerDeco,(c,u,d)=>{c.spec.marks?l.syncToMarks(c.spec.marks,r,e):c.type.side>=0&&!d&&l.syncToMarks(u==this.node.childCount?Xe.none:this.node.child(u).marks,r,e),l.placeWidget(c,e,o)},(c,u,d,p)=>{l.syncToMarks(c.marks,r,e);let f;l.findNodeMatch(c,u,d,p)||a&&e.state.selection.from>o&&e.state.selection.to<o+c.nodeSize&&(f=l.findIndexWithChild(i.node))>-1&&l.updateNodeAt(c,u,d,f,e)||l.updateNextNode(c,u,d,e,p,o)||l.addNode(c,u,d,e,o),o+=c.nodeSize}),l.syncToMarks([],r,e),this.node.isTextblock&&l.addTextblockHacks(),l.destroyRest(),(l.changed||this.dirty==eo)&&(s&&this.protectLocalComposition(e,s),p2(this.contentDOM,this.children,e),ui&&NO(this.dom))}localCompositionInfo(e,n){let{from:r,to:o}=e.state.selection;if(!(e.state.selection instanceof Pe)||r<n||o>n+this.node.content.size)return null;let i=e.input.compositionNode;if(!i||!this.dom.contains(i.parentNode))return null;if(this.node.inlineContent){let s=i.nodeValue,a=IO(this.node.content,s,r-n,o-n);return a<0?null:{node:i,pos:a,text:s}}else return{node:i,pos:-1,text:""}}protectLocalComposition(e,{node:n,pos:r,text:o}){if(this.getDesc(n))return;let i=n;for(;i.parentNode!=this.contentDOM;i=i.parentNode){for(;i.previousSibling;)i.parentNode.removeChild(i.previousSibling);for(;i.nextSibling;)i.parentNode.removeChild(i.nextSibling);i.pmViewDesc&&(i.pmViewDesc=void 0)}let s=new EO(this,i,n,o);e.input.compositionNodes.push(s),this.children=Yd(this.children,r,r+o.length,e,s)}update(e,n,r,o){return this.dirty==Ln||!e.sameMarkup(this.node)?!1:(this.updateInner(e,n,r,o),!0)}updateInner(e,n,r,o){this.updateOuterDeco(n),this.node=e,this.innerDeco=r,this.contentDOM&&this.updateChildren(o,this.posAtStart),this.dirty=mn}updateOuterDeco(e){if(vl(e,this.outerDeco))return;let n=this.nodeDOM.nodeType!=1,r=this.dom;this.dom=f2(this.dom,this.nodeDOM,Xd(this.outerDeco,this.node,n),Xd(e,this.node,n)),this.dom!=r&&(r.pmViewDesc=void 0,this.dom.pmViewDesc=this),this.outerDeco=e}selectNode(){this.nodeDOM.nodeType==1&&this.nodeDOM.classList.add("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&(this.dom.draggable=!0)}deselectNode(){this.nodeDOM.nodeType==1&&(this.nodeDOM.classList.remove("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&this.dom.removeAttribute("draggable"))}get domAtom(){return this.node.isAtom}};function ny(t,e,n,r,o){h2(r,e,t);let i=new Xo(void 0,t,e,n,r,r,r,o,0);return i.contentDOM&&i.updateChildren(o,0),i}let c2=class u2 extends Xo{constructor(e,n,r,o,i,s,a){super(e,n,r,o,i,null,s,a,0)}parseRule(){let e=this.nodeDOM.parentNode;for(;e&&e!=this.dom&&!e.pmIsDeco;)e=e.parentNode;return{skip:e||!0}}update(e,n,r,o){return this.dirty==Ln||this.dirty!=mn&&!this.inParent()||!e.sameMarkup(this.node)?!1:(this.updateOuterDeco(n),(this.dirty!=mn||e.text!=this.node.text)&&e.text!=this.nodeDOM.nodeValue&&(this.nodeDOM.nodeValue=e.text,o.trackWrites==this.nodeDOM&&(o.trackWrites=null)),this.node=e,this.dirty=mn,!0)}inParent(){let e=this.parent.contentDOM;for(let n=this.nodeDOM;n;n=n.parentNode)if(n==e)return!0;return!1}domFromPos(e){return{node:this.nodeDOM,offset:e}}localPosFromDOM(e,n,r){return e==this.nodeDOM?this.posAtStart+Math.min(n,this.node.text.length):super.localPosFromDOM(e,n,r)}ignoreMutation(e){return e.type!="characterData"&&e.type!="selection"}slice(e,n,r){let o=this.node.cut(e,n),i=document.createTextNode(o.text);return new u2(this.parent,o,this.outerDeco,this.innerDeco,i,i,r)}markDirty(e,n){super.markDirty(e,n),this.dom!=this.nodeDOM&&(e==0||n==this.nodeDOM.nodeValue.length)&&(this.dirty=Ln)}get domAtom(){return!1}isText(e){return this.node.text==e}},d2=class extends Xs{parseRule(){return{ignore:!0}}matchesHack(e){return this.dirty==mn&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}};class TO extends Xo{constructor(e,n,r,o,i,s,a,l,c,u){super(e,n,r,o,i,s,a,c,u),this.spec=l}update(e,n,r,o){if(this.dirty==Ln)return!1;if(this.spec.update&&(this.node.type==e.type||this.spec.multiType)){let i=this.spec.update(e,n,r);return i&&this.updateInner(e,n,r,o),i}else return!this.contentDOM&&!e.isLeaf?!1:super.update(e,n,r,o)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(e,n,r,o){this.spec.setSelection?this.spec.setSelection(e,n,r.root):super.setSelection(e,n,r,o)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}stopEvent(e){return this.spec.stopEvent?this.spec.stopEvent(e):!1}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}}function p2(t,e,n){let r=t.firstChild,o=!1;for(let i=0;i<e.length;i++){let s=e[i],a=s.dom;if(a.parentNode==t){for(;a!=r;)r=ry(r),o=!0;r=r.nextSibling}else o=!0,t.insertBefore(a,r);if(s instanceof bl){let l=r?r.previousSibling:t.lastChild;p2(s.contentDOM,s.children,n),r=l?l.nextSibling:t.firstChild}}for(;r;)r=ry(r),o=!0;o&&n.trackWrites==t&&(n.trackWrites=null)}const Qi=function(t){t&&(this.nodeName=t)};Qi.prototype=Object.create(null);const to=[new Qi];function Xd(t,e,n){if(t.length==0)return to;let r=n?to[0]:new Qi,o=[r];for(let i=0;i<t.length;i++){let s=t[i].type.attrs;if(s){s.nodeName&&o.push(r=new Qi(s.nodeName));for(let a in s){let l=s[a];l!=null&&(n&&o.length==1&&o.push(r=new Qi(e.isInline?"span":"div")),a=="class"?r.class=(r.class?r.class+" ":"")+l:a=="style"?r.style=(r.style?r.style+";":"")+l:a!="nodeName"&&(r[a]=l))}}}return o}function f2(t,e,n,r){if(n==to&&r==to)return e;let o=e;for(let i=0;i<r.length;i++){let s=r[i],a=n[i];if(i){let l;a&&a.nodeName==s.nodeName&&o!=t&&(l=o.parentNode)&&l.nodeName.toLowerCase()==s.nodeName||(l=document.createElement(s.nodeName),l.pmIsDeco=!0,l.appendChild(o),a=to[0]),o=l}$O(o,a||to[0],s)}return o}function $O(t,e,n){for(let r in e)r!="class"&&r!="style"&&r!="nodeName"&&!(r in n)&&t.removeAttribute(r);for(let r in n)r!="class"&&r!="style"&&r!="nodeName"&&n[r]!=e[r]&&t.setAttribute(r,n[r]);if(e.class!=n.class){let r=e.class?e.class.split(" ").filter(Boolean):[],o=n.class?n.class.split(" ").filter(Boolean):[];for(let i=0;i<r.length;i++)o.indexOf(r[i])==-1&&t.classList.remove(r[i]);for(let i=0;i<o.length;i++)r.indexOf(o[i])==-1&&t.classList.add(o[i]);t.classList.length==0&&t.removeAttribute("class")}if(e.style!=n.style){if(e.style){let r=/\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g,o;for(;o=r.exec(e.style);)t.style.removeProperty(o[1])}n.style&&(t.style.cssText+=n.style)}}function h2(t,e,n){return f2(t,t,to,Xd(e,n,t.nodeType!=1))}function vl(t,e){if(t.length!=e.length)return!1;for(let n=0;n<t.length;n++)if(!t[n].type.eq(e[n].type))return!1;return!0}function ry(t){let e=t.nextSibling;return t.parentNode.removeChild(t),e}class OO{constructor(e,n,r){this.lock=n,this.view=r,this.index=0,this.stack=[],this.changed=!1,this.top=e,this.preMatch=MO(e.node.content,e)}destroyBetween(e,n){if(e!=n){for(let r=e;r<n;r++)this.top.children[r].destroy();this.top.children.splice(e,n-e),this.changed=!0}}destroyRest(){this.destroyBetween(this.index,this.top.children.length)}syncToMarks(e,n,r){let o=0,i=this.stack.length>>1,s=Math.min(i,e.length);for(;o<s&&(o==i-1?this.top:this.stack[o+1<<1]).matchesMark(e[o])&&e[o].type.spec.spanning!==!1;)o++;for(;o<i;)this.destroyRest(),this.top.dirty=mn,this.index=this.stack.pop(),this.top=this.stack.pop(),i--;for(;i<e.length;){this.stack.push(this.top,this.index+1);let a=-1;for(let l=this.index;l<Math.min(this.index+3,this.top.children.length);l++){let c=this.top.children[l];if(c.matchesMark(e[i])&&!this.isLocked(c.dom)){a=l;break}}if(a>-1)a>this.index&&(this.changed=!0,this.destroyBetween(this.index,a)),this.top=this.top.children[this.index];else{let l=bl.create(this.top,e[i],n,r);this.top.children.splice(this.index,0,l),this.top=l,this.changed=!0}this.index=0,i++}}findNodeMatch(e,n,r,o){let i=-1,s;if(o>=this.preMatch.index&&(s=this.preMatch.matches[o-this.preMatch.index]).parent==this.top&&s.matchesNode(e,n,r))i=this.top.children.indexOf(s,this.index);else for(let a=this.index,l=Math.min(this.top.children.length,a+5);a<l;a++){let c=this.top.children[a];if(c.matchesNode(e,n,r)&&!this.preMatch.matched.has(c)){i=a;break}}return i<0?!1:(this.destroyBetween(this.index,i),this.index++,!0)}updateNodeAt(e,n,r,o,i){let s=this.top.children[o];return s.dirty==Ln&&s.dom==s.contentDOM&&(s.dirty=eo),s.update(e,n,r,i)?(this.destroyBetween(this.index,o),this.index++,!0):!1}findIndexWithChild(e){for(;;){let n=e.parentNode;if(!n)return-1;if(n==this.top.contentDOM){let r=e.pmViewDesc;if(r){for(let o=this.index;o<this.top.children.length;o++)if(this.top.children[o]==r)return o}return-1}e=n}}updateNextNode(e,n,r,o,i,s){for(let a=this.index;a<this.top.children.length;a++){let l=this.top.children[a];if(l instanceof Xo){let c=this.preMatch.matched.get(l);if(c!=null&&c!=i)return!1;let u=l.dom,d,p=this.isLocked(u)&&!(e.isText&&l.node&&l.node.isText&&l.nodeDOM.nodeValue==e.text&&l.dirty!=Ln&&vl(n,l.outerDeco));if(!p&&l.update(e,n,r,o))return this.destroyBetween(this.index,a),l.dom!=u&&(this.changed=!0),this.index++,!0;if(!p&&(d=this.recreateWrapper(l,e,n,r,o,s)))return this.destroyBetween(this.index,a),this.top.children[this.index]=d,d.contentDOM&&(d.dirty=eo,d.updateChildren(o,s+1),d.dirty=mn),this.changed=!0,this.index++,!0;break}}return!1}recreateWrapper(e,n,r,o,i,s){if(e.dirty||n.isAtom||!e.children.length||!e.node.content.eq(n.content)||!vl(r,e.outerDeco)||!o.eq(e.innerDeco))return null;let a=Xo.create(this.top,n,r,o,i,s);if(a.contentDOM){a.children=e.children,e.children=[];for(let l of a.children)l.parent=a}return e.destroy(),a}addNode(e,n,r,o,i){let s=Xo.create(this.top,e,n,r,o,i);s.contentDOM&&s.updateChildren(o,i+1),this.top.children.splice(this.index++,0,s),this.changed=!0}placeWidget(e,n,r){let o=this.index<this.top.children.length?this.top.children[this.index]:null;if(o&&o.matchesWidget(e)&&(e==o.widget||!o.widget.type.toDOM.parentNode))this.index++;else{let i=new a2(this.top,e,n,r);this.top.children.splice(this.index++,0,i),this.changed=!0}}addTextblockHacks(){let e=this.top.children[this.index-1],n=this.top;for(;e instanceof bl;)n=e,e=n.children[n.children.length-1];(!e||!(e instanceof c2)||/\n$/.test(e.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(e.node.text))&&((qt||Dt)&&e&&e.dom.contentEditable=="false"&&this.addHackNode("IMG",n),this.addHackNode("BR",this.top))}addHackNode(e,n){if(n==this.top&&this.index<n.children.length&&n.children[this.index].matchesHack(e))this.index++;else{let r=document.createElement(e);e=="IMG"&&(r.className="ProseMirror-separator",r.alt=""),e=="BR"&&(r.className="ProseMirror-trailingBreak");let o=new d2(this.top,[],r,null);n!=this.top?n.children.push(o):n.children.splice(this.index++,0,o),this.changed=!0}}isLocked(e){return this.lock&&(e==this.lock||e.nodeType==1&&e.contains(this.lock.parentNode))}}function MO(t,e){let n=e,r=n.children.length,o=t.childCount,i=new Map,s=[];e:for(;o>0;){let a;for(;;)if(r){let c=n.children[r-1];if(c instanceof bl)n=c,r=c.children.length;else{a=c,r--;break}}else{if(n==e)break e;r=n.parent.children.indexOf(n),n=n.parent}let l=a.node;if(l){if(l!=t.child(o-1))break;--o,i.set(a,o),s.push(a)}}return{index:o,matched:i,matches:s.reverse()}}function DO(t,e){return t.type.side-e.type.side}function _O(t,e,n,r){let o=e.locals(t),i=0;if(o.length==0){for(let c=0;c<t.childCount;c++){let u=t.child(c);r(u,o,e.forChild(i,u),c),i+=u.nodeSize}return}let s=0,a=[],l=null;for(let c=0;;){let u,d;for(;s<o.length&&o[s].to==i;){let y=o[s++];y.widget&&(u?(d||(d=[u])).push(y):u=y)}if(u)if(d){d.sort(DO);for(let y=0;y<d.length;y++)n(d[y],c,!!l)}else n(u,c,!!l);let p,f;if(l)f=-1,p=l,l=null;else if(c<t.childCount)f=c,p=t.child(c++);else break;for(let y=0;y<a.length;y++)a[y].to<=i&&a.splice(y--,1);for(;s<o.length&&o[s].from<=i&&o[s].to>i;)a.push(o[s++]);let h=i+p.nodeSize;if(p.isText){let y=h;s<o.length&&o[s].from<y&&(y=o[s].from);for(let g=0;g<a.length;g++)a[g].to<y&&(y=a[g].to);y<h&&(l=p.cut(y-i),p=p.cut(0,y-i),h=y,f=-1)}else for(;s<o.length&&o[s].to<h;)s++;let m=p.isInline&&!p.isLeaf?a.filter(y=>!y.inline):a.slice();r(p,m,e.forChild(i,p),f),i=h}}function NO(t){if(t.nodeName=="UL"||t.nodeName=="OL"){let e=t.style.cssText;t.style.cssText=e+"; list-style: square !important",window.getComputedStyle(t).listStyle,t.style.cssText=e}}function IO(t,e,n,r){for(let o=0,i=0;o<t.childCount&&i<=r;){let s=t.child(o++),a=i;if(i+=s.nodeSize,!s.isText)continue;let l=s.text;for(;o<t.childCount;){let c=t.child(o++);if(i+=c.nodeSize,!c.isText)break;l+=c.text}if(i>=n){if(i>=r&&l.slice(r-e.length-a,r-a)==e)return r-e.length;let c=a<r?l.lastIndexOf(e,r-a-1):-1;if(c>=0&&c+e.length+a>=n)return a+c;if(n==r&&l.length>=r+e.length-a&&l.slice(r-a,r-a+e.length)==e)return r}}return-1}function Yd(t,e,n,r,o){let i=[];for(let s=0,a=0;s<t.length;s++){let l=t[s],c=a,u=a+=l.size;c>=n||u<=e?i.push(l):(c<e&&i.push(l.slice(0,e-c,r)),o&&(i.push(o),o=void 0),u>n&&i.push(l.slice(n-c,l.size,r)))}return i}function vf(t,e=null){let n=t.domSelectionRange(),r=t.state.doc;if(!n.focusNode)return null;let o=t.docView.nearestDesc(n.focusNode),i=o&&o.size==0,s=t.docView.posFromDOM(n.focusNode,n.focusOffset,1);if(s<0)return null;let a=r.resolve(s),l,c;if(ic(n)){for(l=s;o&&!o.node;)o=o.parent;let d=o.node;if(o&&d.isAtom&&_e.isSelectable(d)&&o.parent&&!(d.isInline&&sO(n.focusNode,n.focusOffset,o.dom))){let p=o.posBefore;c=new _e(s==p?a:r.resolve(p))}}else{if(n instanceof t.dom.ownerDocument.defaultView.Selection&&n.rangeCount>1){let d=s,p=s;for(let f=0;f<n.rangeCount;f++){let h=n.getRangeAt(f);d=Math.min(d,t.docView.posFromDOM(h.startContainer,h.startOffset,1)),p=Math.max(p,t.docView.posFromDOM(h.endContainer,h.endOffset,-1))}if(d<0)return null;[l,s]=p==t.state.selection.anchor?[p,d]:[d,p],a=r.resolve(s)}else l=t.docView.posFromDOM(n.anchorNode,n.anchorOffset,1);if(l<0)return null}let u=r.resolve(l);if(!c){let d=e=="pointer"||t.state.selection.head<a.pos&&!i?1:-1;c=xf(t,u,a,d)}return c}function m2(t){return t.editable?t.hasFocus():y2(t)&&document.activeElement&&document.activeElement.contains(t.dom)}function or(t,e=!1){let n=t.state.selection;if(g2(t,n),!!m2(t)){if(!e&&t.input.mouseDown&&t.input.mouseDown.allowDefault&&Dt){let r=t.domSelectionRange(),o=t.domObserver.currentSelection;if(r.anchorNode&&o.anchorNode&&yo(r.anchorNode,r.anchorOffset,o.anchorNode,o.anchorOffset)){t.input.mouseDown.delayedSelectionSync=!0,t.domObserver.setCurSelection();return}}if(t.domObserver.disconnectSelection(),t.cursorWrapper)RO(t);else{let{anchor:r,head:o}=n,i,s;oy&&!(n instanceof Pe)&&(n.$from.parent.inlineContent||(i=iy(t,n.from)),!n.empty&&!n.$from.parent.inlineContent&&(s=iy(t,n.to))),t.docView.setSelection(r,o,t,e),oy&&(i&&sy(i),s&&sy(s)),n.visible?t.dom.classList.remove("ProseMirror-hideselection"):(t.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&FO(t))}t.domObserver.setCurSelection(),t.domObserver.connectSelection()}}const oy=qt||Dt&&e2<63;function iy(t,e){let{node:n,offset:r}=t.docView.domFromPos(e,0),o=r<n.childNodes.length?n.childNodes[r]:null,i=r?n.childNodes[r-1]:null;if(qt&&o&&o.contentEditable=="false")return Du(o);if((!o||o.contentEditable=="false")&&(!i||i.contentEditable=="false")){if(o)return Du(o);if(i)return Du(i)}}function Du(t){return t.contentEditable="true",qt&&t.draggable&&(t.draggable=!1,t.wasDraggable=!0),t}function sy(t){t.contentEditable="false",t.wasDraggable&&(t.draggable=!0,t.wasDraggable=null)}function FO(t){let e=t.dom.ownerDocument;e.removeEventListener("selectionchange",t.input.hideSelectionGuard);let n=t.domSelectionRange(),r=n.anchorNode,o=n.anchorOffset;e.addEventListener("selectionchange",t.input.hideSelectionGuard=()=>{(n.anchorNode!=r||n.anchorOffset!=o)&&(e.removeEventListener("selectionchange",t.input.hideSelectionGuard),setTimeout(()=>{(!m2(t)||t.state.selection.visible)&&t.dom.classList.remove("ProseMirror-hideselection")},20))})}function RO(t){let e=t.domSelection(),n=document.createRange();if(!e)return;let r=t.cursorWrapper.dom,o=r.nodeName=="IMG";o?n.setStart(r.parentNode,Ct(r)+1):n.setStart(r,0),n.collapse(!0),e.removeAllRanges(),e.addRange(n),!o&&!t.state.selection.visible&&Jt&&Or<=11&&(r.disabled=!0,r.disabled=!1)}function g2(t,e){if(e instanceof _e){let n=t.docView.descAt(e.from);n!=t.lastSelectedViewDesc&&(ay(t),n&&n.selectNode(),t.lastSelectedViewDesc=n)}else ay(t)}function ay(t){t.lastSelectedViewDesc&&(t.lastSelectedViewDesc.parent&&t.lastSelectedViewDesc.deselectNode(),t.lastSelectedViewDesc=void 0)}function xf(t,e,n,r){return t.someProp("createSelectionBetween",o=>o(t,e,n))||Pe.between(e,n,r)}function ly(t){return t.editable&&!t.hasFocus()?!1:y2(t)}function y2(t){let e=t.domSelectionRange();if(!e.anchorNode)return!1;try{return t.dom.contains(e.anchorNode.nodeType==3?e.anchorNode.parentNode:e.anchorNode)&&(t.editable||t.dom.contains(e.focusNode.nodeType==3?e.focusNode.parentNode:e.focusNode))}catch{return!1}}function BO(t){let e=t.docView.domFromPos(t.state.selection.anchor,0),n=t.domSelectionRange();return yo(e.node,e.offset,n.anchorNode,n.anchorOffset)}function Zd(t,e){let{$anchor:n,$head:r}=t.selection,o=e>0?n.max(r):n.min(r),i=o.parent.inlineContent?o.depth?t.doc.resolve(e>0?o.after():o.before()):null:o;return i&&je.findFrom(i,e)}function xr(t,e){return t.dispatch(t.state.tr.setSelection(e).scrollIntoView()),!0}function cy(t,e,n){let r=t.state.selection;if(r instanceof Pe)if(n.indexOf("s")>-1){let{$head:o}=r,i=o.textOffset?null:e<0?o.nodeBefore:o.nodeAfter;if(!i||i.isText||!i.isLeaf)return!1;let s=t.state.doc.resolve(o.pos+i.nodeSize*(e<0?-1:1));return xr(t,new Pe(r.$anchor,s))}else if(r.empty){if(t.endOfTextblock(e>0?"forward":"backward")){let o=Zd(t.state,e);return o&&o instanceof _e?xr(t,o):!1}else if(!(fn&&n.indexOf("m")>-1)){let o=r.$head,i=o.textOffset?null:e<0?o.nodeBefore:o.nodeAfter,s;if(!i||i.isText)return!1;let a=e<0?o.pos-i.nodeSize:o.pos;return i.isAtom||(s=t.docView.descAt(a))&&!s.contentDOM?_e.isSelectable(i)?xr(t,new _e(e<0?t.state.doc.resolve(o.pos-i.nodeSize):o)):Js?xr(t,new Pe(t.state.doc.resolve(e<0?a:a+i.nodeSize))):!1:!1}}else return!1;else{if(r instanceof _e&&r.node.isInline)return xr(t,new Pe(e>0?r.$to:r.$from));{let o=Zd(t.state,e);return o?xr(t,o):!1}}}function xl(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function es(t,e){let n=t.pmViewDesc;return n&&n.size==0&&(e<0||t.nextSibling||t.nodeName!="BR")}function Mo(t,e){return e<0?LO(t):PO(t)}function LO(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let o,i,s=!1;for(xn&&n.nodeType==1&&r<xl(n)&&es(n.childNodes[r],-1)&&(s=!0);;)if(r>0){if(n.nodeType!=1)break;{let a=n.childNodes[r-1];if(es(a,-1))o=n,i=--r;else if(a.nodeType==3)n=a,r=n.nodeValue.length;else break}}else{if(w2(n))break;{let a=n.previousSibling;for(;a&&es(a,-1);)o=n.parentNode,i=Ct(a),a=a.previousSibling;if(a)n=a,r=xl(n);else{if(n=n.parentNode,n==t.dom)break;r=0}}}s?Qd(t,n,r):o&&Qd(t,o,i)}function PO(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let o=xl(n),i,s;for(;;)if(r<o){if(n.nodeType!=1)break;let a=n.childNodes[r];if(es(a,1))i=n,s=++r;else break}else{if(w2(n))break;{let a=n.nextSibling;for(;a&&es(a,1);)i=a.parentNode,s=Ct(a)+1,a=a.nextSibling;if(a)n=a,r=0,o=xl(n);else{if(n=n.parentNode,n==t.dom)break;r=o=0}}}i&&Qd(t,i,s)}function w2(t){let e=t.pmViewDesc;return e&&e.node&&e.node.isBlock}function zO(t,e){for(;t&&e==t.childNodes.length&&!Ks(t);)e=Ct(t)+1,t=t.parentNode;for(;t&&e<t.childNodes.length;){let n=t.childNodes[e];if(n.nodeType==3)return n;if(n.nodeType==1&&n.contentEditable=="false")break;t=n,e=0}}function jO(t,e){for(;t&&!e&&!Ks(t);)e=Ct(t),t=t.parentNode;for(;t&&e;){let n=t.childNodes[e-1];if(n.nodeType==3)return n;if(n.nodeType==1&&n.contentEditable=="false")break;t=n,e=t.childNodes.length}}function Qd(t,e,n){if(e.nodeType!=3){let i,s;(s=zO(e,n))?(e=s,n=0):(i=jO(e,n))&&(e=i,n=i.nodeValue.length)}let r=t.domSelection();if(!r)return;if(ic(r)){let i=document.createRange();i.setEnd(e,n),i.setStart(e,n),r.removeAllRanges(),r.addRange(i)}else r.extend&&r.extend(e,n);t.domObserver.setCurSelection();let{state:o}=t;setTimeout(()=>{t.state==o&&or(t)},50)}function uy(t,e){let n=t.state.doc.resolve(e);if(!(Dt||cO)&&n.parent.inlineContent){let r=t.coordsAtPos(e);if(e>n.start()){let o=t.coordsAtPos(e-1),i=(o.top+o.bottom)/2;if(i>r.top&&i<r.bottom&&Math.abs(o.left-r.left)>1)return o.left<r.left?"ltr":"rtl"}if(e<n.end()){let o=t.coordsAtPos(e+1),i=(o.top+o.bottom)/2;if(i>r.top&&i<r.bottom&&Math.abs(o.left-r.left)>1)return o.left>r.left?"ltr":"rtl"}}return getComputedStyle(t.dom).direction=="rtl"?"rtl":"ltr"}function dy(t,e,n){let r=t.state.selection;if(r instanceof Pe&&!r.empty||n.indexOf("s")>-1||fn&&n.indexOf("m")>-1)return!1;let{$from:o,$to:i}=r;if(!o.parent.inlineContent||t.endOfTextblock(e<0?"up":"down")){let s=Zd(t.state,e);if(s&&s instanceof _e)return xr(t,s)}if(!o.parent.inlineContent){let s=e<0?o:i,a=r instanceof Nn?je.near(s,e):je.findFrom(s,e);return a?xr(t,a):!1}return!1}function py(t,e){if(!(t.state.selection instanceof Pe))return!0;let{$head:n,$anchor:r,empty:o}=t.state.selection;if(!n.sameParent(r))return!0;if(!o)return!1;if(t.endOfTextblock(e>0?"forward":"backward"))return!0;let i=!n.textOffset&&(e<0?n.nodeBefore:n.nodeAfter);if(i&&!i.isText){let s=t.state.tr;return e<0?s.delete(n.pos-i.nodeSize,n.pos):s.delete(n.pos,n.pos+i.nodeSize),t.dispatch(s),!0}return!1}function fy(t,e,n){t.domObserver.stop(),e.contentEditable=n,t.domObserver.start()}function qO(t){if(!qt||t.state.selection.$head.parentOffset>0)return!1;let{focusNode:e,focusOffset:n}=t.domSelectionRange();if(e&&e.nodeType==1&&n==0&&e.firstChild&&e.firstChild.contentEditable=="false"){let r=e.firstChild;fy(t,r,"true"),setTimeout(()=>fy(t,r,"false"),20)}return!1}function VO(t){let e="";return t.ctrlKey&&(e+="c"),t.metaKey&&(e+="m"),t.altKey&&(e+="a"),t.shiftKey&&(e+="s"),e}function UO(t,e){let n=e.keyCode,r=VO(e);if(n==8||fn&&n==72&&r=="c")return py(t,-1)||Mo(t,-1);if(n==46&&!e.shiftKey||fn&&n==68&&r=="c")return py(t,1)||Mo(t,1);if(n==13||n==27)return!0;if(n==37||fn&&n==66&&r=="c"){let o=n==37?uy(t,t.state.selection.from)=="ltr"?-1:1:-1;return cy(t,o,r)||Mo(t,o)}else if(n==39||fn&&n==70&&r=="c"){let o=n==39?uy(t,t.state.selection.from)=="ltr"?1:-1:1;return cy(t,o,r)||Mo(t,o)}else{if(n==38||fn&&n==80&&r=="c")return dy(t,-1,r)||Mo(t,-1);if(n==40||fn&&n==78&&r=="c")return qO(t)||dy(t,1,r)||Mo(t,1);if(r==(fn?"m":"c")&&(n==66||n==73||n==89||n==90))return!0}return!1}function kf(t,e){t.someProp("transformCopied",f=>{e=f(e,t)});let n=[],{content:r,openStart:o,openEnd:i}=e;for(;o>1&&i>1&&r.childCount==1&&r.firstChild.childCount==1;){o--,i--;let f=r.firstChild;n.push(f.type.name,f.attrs!=f.type.defaultAttrs?f.attrs:null),r=f.content}let s=t.someProp("clipboardSerializer")||xi.fromSchema(t.state.schema),a=A2(),l=a.createElement("div");l.appendChild(s.serializeFragment(r,{document:a}));let c=l.firstChild,u,d=0;for(;c&&c.nodeType==1&&(u=S2[c.nodeName.toLowerCase()]);){for(let f=u.length-1;f>=0;f--){let h=a.createElement(u[f]);for(;l.firstChild;)h.appendChild(l.firstChild);l.appendChild(h),d++}c=l.firstChild}c&&c.nodeType==1&&c.setAttribute("data-pm-slice",`${o} ${i}${d?` -${d}`:""} ${JSON.stringify(n)}`);let p=t.someProp("clipboardTextSerializer",f=>f(e,t))||e.content.textBetween(0,e.content.size,`
|
|
42
42
|
|
|
43
43
|
`);return{dom:l,text:p,slice:e}}function b2(t,e,n,r,o){let i=o.parent.type.spec.code,s,a;if(!n&&!e)return null;let l=e&&(r||i||!n);if(l){if(t.someProp("transformPastedText",p=>{e=p(e,i||r,t)}),i)return e?new ve(ye.from(t.state.schema.text(e.replace(/\r\n?/g,`
|
|
44
44
|
`))),0,0):ve.empty;let d=t.someProp("clipboardTextParser",p=>p(e,o,r,t));if(d)a=d;else{let p=o.marks(),{schema:f}=t.state,h=xi.fromSchema(f);s=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach(m=>{let y=s.appendChild(document.createElement("p"));m&&y.appendChild(h.serializeNode(f.text(m,p)))})}}else t.someProp("transformPastedHTML",d=>{n=d(n,t)}),s=KO(n),Js&&JO(s);let c=s&&s.querySelector("[data-pm-slice]"),u=c&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(c.getAttribute("data-pm-slice")||"");if(u&&u[3])for(let d=+u[3];d>0;d--){let p=s.firstChild;for(;p&&p.nodeType!=1;)p=p.nextSibling;if(!p)break;s=p}if(a||(a=(t.someProp("clipboardParser")||t.someProp("domParser")||er.fromSchema(t.state.schema)).parseSlice(s,{preserveWhitespace:!!(l||u),context:o,ruleFromNode(d){return d.nodeName=="BR"&&!d.nextSibling&&d.parentNode&&!HO.test(d.parentNode.nodeName)?{ignore:!0}:null}})),u)a=XO(hy(a,+u[1],+u[2]),u[4]);else if(a=ve.maxOpen(WO(a.content,o),!0),a.openStart||a.openEnd){let d=0,p=0;for(let f=a.content.firstChild;d<a.openStart&&!f.type.spec.isolating;d++,f=f.firstChild);for(let f=a.content.lastChild;p<a.openEnd&&!f.type.spec.isolating;p++,f=f.lastChild);a=hy(a,d,p)}return t.someProp("transformPasted",d=>{a=d(a,t)}),a}const HO=/^(a|abbr|acronym|b|cite|code|del|em|i|ins|kbd|label|output|q|ruby|s|samp|span|strong|sub|sup|time|u|tt|var)$/i;function WO(t,e){if(t.childCount<2)return t;for(let n=e.depth;n>=0;n--){let r=e.node(n).contentMatchAt(e.index(n)),o,i=[];if(t.forEach(s=>{if(!i)return;let a=r.findWrapping(s.type),l;if(!a)return i=null;if(l=i.length&&o.length&&x2(a,o,s,i[i.length-1],0))i[i.length-1]=l;else{i.length&&(i[i.length-1]=k2(i[i.length-1],o.length));let c=v2(s,a);i.push(c),r=r.matchType(c.type),o=a}}),i)return ye.from(i)}return t}function v2(t,e,n=0){for(let r=e.length-1;r>=n;r--)t=e[r].create(null,ye.from(t));return t}function x2(t,e,n,r,o){if(o<t.length&&o<e.length&&t[o]==e[o]){let i=x2(t,e,n,r.lastChild,o+1);if(i)return r.copy(r.content.replaceChild(r.childCount-1,i));if(r.contentMatchAt(r.childCount).matchType(o==t.length-1?n.type:t[o+1]))return r.copy(r.content.append(ye.from(v2(n,t,o+1))))}}function k2(t,e){if(e==0)return t;let n=t.content.replaceChild(t.childCount-1,k2(t.lastChild,e-1)),r=t.contentMatchAt(t.childCount).fillBefore(ye.empty,!0);return t.copy(n.append(r))}function ep(t,e,n,r,o,i){let s=e<0?t.firstChild:t.lastChild,a=s.content;return t.childCount>1&&(i=0),o<r-1&&(a=ep(a,e,n,r,o+1,i)),o>=n&&(a=e<0?s.contentMatchAt(0).fillBefore(a,i<=o).append(a):a.append(s.contentMatchAt(s.childCount).fillBefore(ye.empty,!0))),t.replaceChild(e<0?0:t.childCount-1,s.copy(a))}function hy(t,e,n){return e<t.openStart&&(t=new ve(ep(t.content,-1,e,t.openStart,0,t.openEnd),e,t.openEnd)),n<t.openEnd&&(t=new ve(ep(t.content,1,n,t.openEnd,0,0),t.openStart,n)),t}const S2={thead:["table"],tbody:["table"],tfoot:["table"],caption:["table"],colgroup:["table"],col:["table","colgroup"],tr:["table","tbody"],td:["table","tbody","tr"],th:["table","tbody","tr"]};let my=null;function A2(){return my||(my=document.implementation.createHTMLDocument("title"))}let _u=null;function GO(t){let e=window.trustedTypes;return e?(_u||(_u=e.defaultPolicy||e.createPolicy("ProseMirrorClipboard",{createHTML:n=>n})),_u.createHTML(t)):t}function KO(t){let e=/^(\s*<meta [^>]*>)*/.exec(t);e&&(t=t.slice(e[0].length));let n=A2().createElement("div"),r=/<([a-z][^>\s]+)/i.exec(t),o;if((o=r&&S2[r[1].toLowerCase()])&&(t=o.map(i=>"<"+i+">").join("")+t+o.map(i=>"</"+i+">").reverse().join("")),n.innerHTML=GO(t),o)for(let i=0;i<o.length;i++)n=n.querySelector(o[i])||n;return n}function JO(t){let e=t.querySelectorAll(Dt?"span:not([class]):not([style])":"span.Apple-converted-space");for(let n=0;n<e.length;n++){let r=e[n];r.childNodes.length==1&&r.textContent==" "&&r.parentNode&&r.parentNode.replaceChild(t.ownerDocument.createTextNode(" "),r)}}function XO(t,e){if(!t.size)return t;let n=t.content.firstChild.type.schema,r;try{r=JSON.parse(e)}catch{return t}let{content:o,openStart:i,openEnd:s}=t;for(let a=r.length-2;a>=0;a-=2){let l=n.nodes[r[a]];if(!l||l.hasRequiredAttrs())break;o=ye.from(l.create(r[a+1],o)),i++,s++}return new ve(o,i,s)}const Vt={},Ut={},YO={touchstart:!0,touchmove:!0};class ZO{constructor(){this.shiftKey=!1,this.mouseDown=null,this.lastKeyCode=null,this.lastKeyCodeTime=0,this.lastClick={time:0,x:0,y:0,type:"",button:0},this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastIOSEnter=0,this.lastIOSEnterFallbackTimeout=-1,this.lastFocus=0,this.lastTouch=0,this.lastChromeDelete=0,this.composing=!1,this.compositionNode=null,this.composingTimeout=-1,this.compositionNodes=[],this.compositionEndedAt=-2e8,this.compositionID=1,this.compositionPendingChanges=0,this.domChangeCount=0,this.eventHandlers=Object.create(null),this.hideSelectionGuard=null}}function QO(t){for(let e in Vt){let n=Vt[e];t.dom.addEventListener(e,t.input.eventHandlers[e]=r=>{t5(t,r)&&!Sf(t,r)&&(t.editable||!(r.type in Ut))&&n(t,r)},YO[e]?{passive:!0}:void 0)}qt&&t.dom.addEventListener("input",()=>null),tp(t)}function Ar(t,e){t.input.lastSelectionOrigin=e,t.input.lastSelectionTime=Date.now()}function e5(t){t.domObserver.stop();for(let e in t.input.eventHandlers)t.dom.removeEventListener(e,t.input.eventHandlers[e]);clearTimeout(t.input.composingTimeout),clearTimeout(t.input.lastIOSEnterFallbackTimeout)}function tp(t){t.someProp("handleDOMEvents",e=>{for(let n in e)t.input.eventHandlers[n]||t.dom.addEventListener(n,t.input.eventHandlers[n]=r=>Sf(t,r))})}function Sf(t,e){return t.someProp("handleDOMEvents",n=>{let r=n[e.type];return r?r(t,e)||e.defaultPrevented:!1})}function t5(t,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let n=e.target;n!=t.dom;n=n.parentNode)if(!n||n.nodeType==11||n.pmViewDesc&&n.pmViewDesc.stopEvent(e))return!1;return!0}function n5(t,e){!Sf(t,e)&&Vt[e.type]&&(t.editable||!(e.type in Ut))&&Vt[e.type](t,e)}Ut.keydown=(t,e)=>{let n=e;if(t.input.shiftKey=n.keyCode==16||n.shiftKey,!E2(t,n)&&(t.input.lastKeyCode=n.keyCode,t.input.lastKeyCodeTime=Date.now(),!(Qn&&Dt&&n.keyCode==13)))if(n.keyCode!=229&&t.domObserver.forceFlush(),ui&&n.keyCode==13&&!n.ctrlKey&&!n.altKey&&!n.metaKey){let r=Date.now();t.input.lastIOSEnter=r,t.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{t.input.lastIOSEnter==r&&(t.someProp("handleKeyDown",o=>o(t,Xr(13,"Enter"))),t.input.lastIOSEnter=0)},200)}else t.someProp("handleKeyDown",r=>r(t,n))||UO(t,n)?n.preventDefault():Ar(t,"key")};Ut.keyup=(t,e)=>{e.keyCode==16&&(t.input.shiftKey=!1)};Ut.keypress=(t,e)=>{let n=e;if(E2(t,n)||!n.charCode||n.ctrlKey&&!n.altKey||fn&&n.metaKey)return;if(t.someProp("handleKeyPress",o=>o(t,n))){n.preventDefault();return}let r=t.state.selection;if(!(r instanceof Pe)||!r.$from.sameParent(r.$to)){let o=String.fromCharCode(n.charCode);!/[\r\n]/.test(o)&&!t.someProp("handleTextInput",i=>i(t,r.$from.pos,r.$to.pos,o))&&t.dispatch(t.state.tr.insertText(o).scrollIntoView()),n.preventDefault()}};function sc(t){return{left:t.clientX,top:t.clientY}}function r5(t,e){let n=e.x-t.clientX,r=e.y-t.clientY;return n*n+r*r<100}function Af(t,e,n,r,o){if(r==-1)return!1;let i=t.state.doc.resolve(r);for(let s=i.depth+1;s>0;s--)if(t.someProp(e,a=>s>i.depth?a(t,n,i.nodeAfter,i.before(s),o,!0):a(t,n,i.node(s),i.before(s),o,!1)))return!0;return!1}function Yo(t,e,n){if(t.focused||t.focus(),t.state.selection.eq(e))return;let r=t.state.tr.setSelection(e);r.setMeta("pointer",!0),t.dispatch(r)}function o5(t,e){if(e==-1)return!1;let n=t.state.doc.resolve(e),r=n.nodeAfter;return r&&r.isAtom&&_e.isSelectable(r)?(Yo(t,new _e(n)),!0):!1}function i5(t,e){if(e==-1)return!1;let n=t.state.selection,r,o;n instanceof _e&&(r=n.node);let i=t.state.doc.resolve(e);for(let s=i.depth+1;s>0;s--){let a=s>i.depth?i.nodeAfter:i.node(s);if(_e.isSelectable(a)){r&&n.$from.depth>0&&s>=n.$from.depth&&i.before(n.$from.depth+1)==n.$from.pos?o=i.before(n.$from.depth):o=i.before(s);break}}return o!=null?(Yo(t,_e.create(t.state.doc,o)),!0):!1}function s5(t,e,n,r,o){return Af(t,"handleClickOn",e,n,r)||t.someProp("handleClick",i=>i(t,e,r))||(o?i5(t,n):o5(t,n))}function a5(t,e,n,r){return Af(t,"handleDoubleClickOn",e,n,r)||t.someProp("handleDoubleClick",o=>o(t,e,r))}function l5(t,e,n,r){return Af(t,"handleTripleClickOn",e,n,r)||t.someProp("handleTripleClick",o=>o(t,e,r))||c5(t,n,r)}function c5(t,e,n){if(n.button!=0)return!1;let r=t.state.doc;if(e==-1)return r.inlineContent?(Yo(t,Pe.create(r,0,r.content.size)),!0):!1;let o=r.resolve(e);for(let i=o.depth+1;i>0;i--){let s=i>o.depth?o.nodeAfter:o.node(i),a=o.before(i);if(s.inlineContent)Yo(t,Pe.create(r,a+1,a+1+s.content.size));else if(_e.isSelectable(s))Yo(t,_e.create(r,a));else continue;return!0}}function Cf(t){return kl(t)}const C2=fn?"metaKey":"ctrlKey";Vt.mousedown=(t,e)=>{let n=e;t.input.shiftKey=n.shiftKey;let r=Cf(t),o=Date.now(),i="singleClick";o-t.input.lastClick.time<500&&r5(n,t.input.lastClick)&&!n[C2]&&t.input.lastClick.button==n.button&&(t.input.lastClick.type=="singleClick"?i="doubleClick":t.input.lastClick.type=="doubleClick"&&(i="tripleClick")),t.input.lastClick={time:o,x:n.clientX,y:n.clientY,type:i,button:n.button};let s=t.posAtCoords(sc(n));s&&(i=="singleClick"?(t.input.mouseDown&&t.input.mouseDown.done(),t.input.mouseDown=new u5(t,s,n,!!r)):(i=="doubleClick"?a5:l5)(t,s.pos,s.inside,n)?n.preventDefault():Ar(t,"pointer"))};class u5{constructor(e,n,r,o){this.view=e,this.pos=n,this.event=r,this.flushed=o,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=e.state.doc,this.selectNode=!!r[C2],this.allowDefault=r.shiftKey;let i,s;if(n.inside>-1)i=e.state.doc.nodeAt(n.inside),s=n.inside;else{let u=e.state.doc.resolve(n.pos);i=u.parent,s=u.depth?u.before():0}const a=o?null:r.target,l=a?e.docView.nearestDesc(a,!0):null;this.target=l&&l.dom.nodeType==1?l.dom:null;let{selection:c}=e.state;(r.button==0&&i.type.spec.draggable&&i.type.spec.selectable!==!1||c instanceof _e&&c.from<=s&&c.to>s)&&(this.mightDrag={node:i,pos:s,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&xn&&!this.target.hasAttribute("contentEditable"))}),this.target&&this.mightDrag&&(this.mightDrag.addAttr||this.mightDrag.setUneditable)&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&(this.target.draggable=!0),this.mightDrag.setUneditable&&setTimeout(()=>{this.view.input.mouseDown==this&&this.target.setAttribute("contentEditable","false")},20),this.view.domObserver.start()),e.root.addEventListener("mouseup",this.up=this.up.bind(this)),e.root.addEventListener("mousemove",this.move=this.move.bind(this)),Ar(e,"pointer")}done(){this.view.root.removeEventListener("mouseup",this.up),this.view.root.removeEventListener("mousemove",this.move),this.mightDrag&&this.target&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&this.target.removeAttribute("draggable"),this.mightDrag.setUneditable&&this.target.removeAttribute("contentEditable"),this.view.domObserver.start()),this.delayedSelectionSync&&setTimeout(()=>or(this.view)),this.view.input.mouseDown=null}up(e){if(this.done(),!this.view.dom.contains(e.target))return;let n=this.pos;this.view.state.doc!=this.startDoc&&(n=this.view.posAtCoords(sc(e))),this.updateAllowDefault(e),this.allowDefault||!n?Ar(this.view,"pointer"):s5(this.view,n.pos,n.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||qt&&this.mightDrag&&!this.mightDrag.node.isAtom||Dt&&!this.view.state.selection.visible&&Math.min(Math.abs(n.pos-this.view.state.selection.from),Math.abs(n.pos-this.view.state.selection.to))<=2)?(Yo(this.view,je.near(this.view.state.doc.resolve(n.pos))),e.preventDefault()):Ar(this.view,"pointer")}move(e){this.updateAllowDefault(e),Ar(this.view,"pointer"),e.buttons==0&&this.done()}updateAllowDefault(e){!this.allowDefault&&(Math.abs(this.event.x-e.clientX)>4||Math.abs(this.event.y-e.clientY)>4)&&(this.allowDefault=!0)}}Vt.touchstart=t=>{t.input.lastTouch=Date.now(),Cf(t),Ar(t,"pointer")};Vt.touchmove=t=>{t.input.lastTouch=Date.now(),Ar(t,"pointer")};Vt.contextmenu=t=>Cf(t);function E2(t,e){return t.composing?!0:qt&&Math.abs(e.timeStamp-t.input.compositionEndedAt)<500?(t.input.compositionEndedAt=-2e8,!0):!1}const d5=Qn?5e3:-1;Ut.compositionstart=Ut.compositionupdate=t=>{if(!t.composing){t.domObserver.flush();let{state:e}=t,n=e.selection.$to;if(e.selection instanceof Pe&&(e.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some(r=>r.type.spec.inclusive===!1)))t.markCursor=t.state.storedMarks||n.marks(),kl(t,!0),t.markCursor=null;else if(kl(t,!e.selection.empty),xn&&e.selection.empty&&n.parentOffset&&!n.textOffset&&n.nodeBefore.marks.length){let r=t.domSelectionRange();for(let o=r.focusNode,i=r.focusOffset;o&&o.nodeType==1&&i!=0;){let s=i<0?o.lastChild:o.childNodes[i-1];if(!s)break;if(s.nodeType==3){let a=t.domSelection();a&&a.collapse(s,s.nodeValue.length);break}else o=s,i=-1}}t.input.composing=!0}T2(t,d5)};Ut.compositionend=(t,e)=>{t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=e.timeStamp,t.input.compositionPendingChanges=t.domObserver.pendingRecords().length?t.input.compositionID:0,t.input.compositionNode=null,t.input.compositionPendingChanges&&Promise.resolve().then(()=>t.domObserver.flush()),t.input.compositionID++,T2(t,20))};function T2(t,e){clearTimeout(t.input.composingTimeout),e>-1&&(t.input.composingTimeout=setTimeout(()=>kl(t),e))}function $2(t){for(t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=f5());t.input.compositionNodes.length>0;)t.input.compositionNodes.pop().markParentsDirty()}function p5(t){let e=t.domSelectionRange();if(!e.focusNode)return null;let n=oO(e.focusNode,e.focusOffset),r=iO(e.focusNode,e.focusOffset);if(n&&r&&n!=r){let o=r.pmViewDesc,i=t.domObserver.lastChangedTextNode;if(n==i||r==i)return i;if(!o||!o.isText(r.nodeValue))return r;if(t.input.compositionNode==r){let s=n.pmViewDesc;if(!(!s||!s.isText(n.nodeValue)))return r}}return n||r}function f5(){let t=document.createEvent("Event");return t.initEvent("event",!0,!0),t.timeStamp}function kl(t,e=!1){if(!(Qn&&t.domObserver.flushingSoon>=0)){if(t.domObserver.forceFlush(),$2(t),e||t.docView&&t.docView.dirty){let n=vf(t),r=t.state.selection;return n&&!n.eq(r)?t.dispatch(t.state.tr.setSelection(n)):(t.markCursor||e)&&!r.$from.node(r.$from.sharedDepth(r.to)).inlineContent?t.dispatch(t.state.tr.deleteSelection()):t.updateState(t.state),!0}return!1}}function h5(t,e){if(!t.dom.parentNode)return;let n=t.dom.parentNode.appendChild(document.createElement("div"));n.appendChild(e),n.style.cssText="position: fixed; left: -10000px; top: 10px";let r=getSelection(),o=document.createRange();o.selectNodeContents(e),t.dom.blur(),r.removeAllRanges(),r.addRange(o),setTimeout(()=>{n.parentNode&&n.parentNode.removeChild(n),t.focus()},50)}const vs=Jt&&Or<15||ui&&uO<604;Vt.copy=Ut.cut=(t,e)=>{let n=e,r=t.state.selection,o=n.type=="cut";if(r.empty)return;let i=vs?null:n.clipboardData,s=r.content(),{dom:a,text:l}=kf(t,s);i?(n.preventDefault(),i.clearData(),i.setData("text/html",a.innerHTML),i.setData("text/plain",l)):h5(t,a),o&&t.dispatch(t.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function m5(t){return t.openStart==0&&t.openEnd==0&&t.content.childCount==1?t.content.firstChild:null}function g5(t,e){if(!t.dom.parentNode)return;let n=t.input.shiftKey||t.state.selection.$from.parent.type.spec.code,r=t.dom.parentNode.appendChild(document.createElement(n?"textarea":"div"));n||(r.contentEditable="true"),r.style.cssText="position: fixed; left: -10000px; top: 10px",r.focus();let o=t.input.shiftKey&&t.input.lastKeyCode!=45;setTimeout(()=>{t.focus(),r.parentNode&&r.parentNode.removeChild(r),n?xs(t,r.value,null,o,e):xs(t,r.textContent,r.innerHTML,o,e)},50)}function xs(t,e,n,r,o){let i=b2(t,e,n,r,t.state.selection.$from);if(t.someProp("handlePaste",l=>l(t,o,i||ve.empty)))return!0;if(!i)return!1;let s=m5(i),a=s?t.state.tr.replaceSelectionWith(s,r):t.state.tr.replaceSelection(i);return t.dispatch(a.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function O2(t){let e=t.getData("text/plain")||t.getData("Text");if(e)return e;let n=t.getData("text/uri-list");return n?n.replace(/\r?\n/g," "):""}Ut.paste=(t,e)=>{let n=e;if(t.composing&&!Qn)return;let r=vs?null:n.clipboardData,o=t.input.shiftKey&&t.input.lastKeyCode!=45;r&&xs(t,O2(r),r.getData("text/html"),o,n)?n.preventDefault():g5(t,n)};let M2=class{constructor(e,n,r){this.slice=e,this.move=n,this.node=r}};const y5=fn?"altKey":"ctrlKey";function D2(t,e){return t.someProp("dragCopies",r=>!r(e))??!e[y5]}Vt.dragstart=(t,e)=>{let n=e,r=t.input.mouseDown;if(r&&r.done(),!n.dataTransfer)return;let o=t.state.selection,i=o.empty?null:t.posAtCoords(sc(n)),s;if(!(i&&i.pos>=o.from&&i.pos<=(o instanceof _e?o.to-1:o.to))){if(r&&r.mightDrag)s=_e.create(t.state.doc,r.mightDrag.pos);else if(n.target&&n.target.nodeType==1){let d=t.docView.nearestDesc(n.target,!0);d&&d.node.type.spec.draggable&&d!=t.docView&&(s=_e.create(t.state.doc,d.posBefore))}}let a=(s||t.state.selection).content(),{dom:l,text:c,slice:u}=kf(t,a);(!n.dataTransfer.files.length||!Dt||e2>120)&&n.dataTransfer.clearData(),n.dataTransfer.setData(vs?"Text":"text/html",l.innerHTML),n.dataTransfer.effectAllowed="copyMove",vs||n.dataTransfer.setData("text/plain",c),t.dragging=new M2(u,D2(t,n),s)};Vt.dragend=t=>{let e=t.dragging;window.setTimeout(()=>{t.dragging==e&&(t.dragging=null)},50)};Ut.dragover=Ut.dragenter=(t,e)=>e.preventDefault();Ut.drop=(t,e)=>{let n=e,r=t.dragging;if(t.dragging=null,!n.dataTransfer)return;let o=t.posAtCoords(sc(n));if(!o)return;let i=t.state.doc.resolve(o.pos),s=r&&r.slice;s?t.someProp("transformPasted",h=>{s=h(s,t)}):s=b2(t,O2(n.dataTransfer),vs?null:n.dataTransfer.getData("text/html"),!1,i);let a=!!(r&&D2(t,n));if(t.someProp("handleDrop",h=>h(t,n,s||ve.empty,a))){n.preventDefault();return}if(!s)return;n.preventDefault();let l=s?vv(t.state.doc,i.pos,s):i.pos;l==null&&(l=i.pos);let c=t.state.tr;if(a){let{node:h}=r;h?h.replace(c):c.deleteSelection()}let u=c.mapping.map(l),d=s.openStart==0&&s.openEnd==0&&s.content.childCount==1,p=c.doc;if(d?c.replaceRangeWith(u,u,s.content.firstChild):c.replaceRange(u,u,s),c.doc.eq(p))return;let f=c.doc.resolve(u);if(d&&_e.isSelectable(s.content.firstChild)&&f.nodeAfter&&f.nodeAfter.sameMarkup(s.content.firstChild))c.setSelection(new _e(f));else{let h=c.mapping.map(l);c.mapping.maps[c.mapping.maps.length-1].forEach((m,y,g,v)=>h=v),c.setSelection(xf(t,f,c.doc.resolve(h)))}t.focus(),t.dispatch(c.setMeta("uiEvent","drop"))};Vt.focus=t=>{t.input.lastFocus=Date.now(),t.focused||(t.domObserver.stop(),t.dom.classList.add("ProseMirror-focused"),t.domObserver.start(),t.focused=!0,setTimeout(()=>{t.docView&&t.hasFocus()&&!t.domObserver.currentSelection.eq(t.domSelectionRange())&&or(t)},20))};Vt.blur=(t,e)=>{let n=e;t.focused&&(t.domObserver.stop(),t.dom.classList.remove("ProseMirror-focused"),t.domObserver.start(),n.relatedTarget&&t.dom.contains(n.relatedTarget)&&t.domObserver.currentSelection.clear(),t.focused=!1)};Vt.beforeinput=(t,e)=>{if(Dt&&Qn&&e.inputType=="deleteContentBackward"){t.domObserver.flushSoon();let{domChangeCount:n}=t.input;setTimeout(()=>{if(t.input.domChangeCount!=n||(t.dom.blur(),t.focus(),t.someProp("handleKeyDown",o=>o(t,Xr(8,"Backspace")))))return;let{$cursor:r}=t.state.selection;r&&r.pos>0&&t.dispatch(t.state.tr.delete(r.pos-1,r.pos).scrollIntoView())},50)}};for(let t in Ut)Vt[t]=Ut[t];function ks(t,e){if(t==e)return!0;for(let n in t)if(t[n]!==e[n])return!1;for(let n in e)if(!(n in t))return!1;return!0}let gy=class _2{constructor(e,n){this.toDOM=e,this.spec=n||ao,this.side=this.spec.side||0}map(e,n,r,o){let{pos:i,deleted:s}=e.mapResult(n.from+o,this.side<0?-1:1);return s?null:new Le(i-r,i-r,this)}valid(){return!0}eq(e){return this==e||e instanceof _2&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&ks(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}},ts=class np{constructor(e,n){this.attrs=e,this.spec=n||ao}map(e,n,r,o){let i=e.map(n.from+o,this.spec.inclusiveStart?-1:1)-r,s=e.map(n.to+o,this.spec.inclusiveEnd?1:-1)-r;return i>=s?null:new Le(i,s,this)}valid(e,n){return n.from<n.to}eq(e){return this==e||e instanceof np&&ks(this.attrs,e.attrs)&&ks(this.spec,e.spec)}static is(e){return e.type instanceof np}destroy(){}};class Ef{constructor(e,n){this.attrs=e,this.spec=n||ao}map(e,n,r,o){let i=e.mapResult(n.from+o,1);if(i.deleted)return null;let s=e.mapResult(n.to+o,-1);return s.deleted||s.pos<=i.pos?null:new Le(i.pos-r,s.pos-r,this)}valid(e,n){let{index:r,offset:o}=e.content.findIndex(n.from),i;return o==n.from&&!(i=e.child(r)).isText&&o+i.nodeSize==n.to}eq(e){return this==e||e instanceof Ef&&ks(this.attrs,e.attrs)&&ks(this.spec,e.spec)}destroy(){}}class Le{constructor(e,n,r){this.from=e,this.to=n,this.type=r}copy(e,n){return new Le(e,n,this.type)}eq(e,n=0){return this.type.eq(e.type)&&this.from+n==e.from&&this.to+n==e.to}map(e,n,r){return this.type.map(e,this,n,r)}static widget(e,n,r){return new Le(e,e,new gy(n,r))}static inline(e,n,r,o){return new Le(e,n,new ts(r,o))}static node(e,n,r,o){return new Le(e,n,new Ef(r,o))}get spec(){return this.type.spec}get inline(){return this.type instanceof ts}get widget(){return this.type instanceof gy}}const jo=[],ao={};class De{constructor(e,n){this.local=e.length?e:jo,this.children=n.length?n:jo}static create(e,n){return n.length?Sl(n,e,0,ao):Ot}find(e,n,r){let o=[];return this.findInner(e??0,n??1e9,o,0,r),o}findInner(e,n,r,o,i){for(let s=0;s<this.local.length;s++){let a=this.local[s];a.from<=n&&a.to>=e&&(!i||i(a.spec))&&r.push(a.copy(a.from+o,a.to+o))}for(let s=0;s<this.children.length;s+=3)if(this.children[s]<n&&this.children[s+1]>e){let a=this.children[s]+1;this.children[s+2].findInner(e-a,n-a,r,o+a,i)}}map(e,n,r){return this==Ot||e.maps.length==0?this:this.mapInner(e,n,0,0,r||ao)}mapInner(e,n,r,o,i){let s;for(let a=0;a<this.local.length;a++){let l=this.local[a].map(e,r,o);l&&l.type.valid(n,l)?(s||(s=[])).push(l):i.onRemove&&i.onRemove(this.local[a].spec)}return this.children.length?w5(this.children,s||[],e,n,r,o,i):s?new De(s.sort(lo),jo):Ot}add(e,n){return n.length?this==Ot?De.create(e,n):this.addInner(e,n,0):this}addInner(e,n,r){let o,i=0;e.forEach((a,l)=>{let c=l+r,u;if(u=F2(n,a,c)){for(o||(o=this.children.slice());i<o.length&&o[i]<l;)i+=3;o[i]==l?o[i+2]=o[i+2].addInner(a,u,c+1):o.splice(i,0,l,l+a.nodeSize,Sl(u,a,c+1,ao)),i+=3}});let s=I2(i?R2(n):n,-r);for(let a=0;a<s.length;a++)s[a].type.valid(e,s[a])||s.splice(a--,1);return new De(s.length?this.local.concat(s).sort(lo):this.local,o||this.children)}remove(e){return e.length==0||this==Ot?this:this.removeInner(e,0)}removeInner(e,n){let r=this.children,o=this.local;for(let i=0;i<r.length;i+=3){let s,a=r[i]+n,l=r[i+1]+n;for(let u=0,d;u<e.length;u++)(d=e[u])&&d.from>a&&d.to<l&&(e[u]=null,(s||(s=[])).push(d));if(!s)continue;r==this.children&&(r=this.children.slice());let c=r[i+2].removeInner(s,a+1);c!=Ot?r[i+2]=c:(r.splice(i,3),i-=3)}if(o.length){for(let i=0,s;i<e.length;i++)if(s=e[i])for(let a=0;a<o.length;a++)o[a].eq(s,n)&&(o==this.local&&(o=this.local.slice()),o.splice(a--,1))}return r==this.children&&o==this.local?this:o.length||r.length?new De(o,r):Ot}forChild(e,n){if(this==Ot)return this;if(n.isLeaf)return De.empty;let r,o;for(let a=0;a<this.children.length;a+=3)if(this.children[a]>=e){this.children[a]==e&&(r=this.children[a+2]);break}let i=e+1,s=i+n.content.size;for(let a=0;a<this.local.length;a++){let l=this.local[a];if(l.from<s&&l.to>i&&l.type instanceof ts){let c=Math.max(i,l.from)-i,u=Math.min(s,l.to)-i;c<u&&(o||(o=[])).push(l.copy(c,u))}}if(o){let a=new De(o.sort(lo),jo);return r?new N2([a,r]):a}return r||Ot}eq(e){if(this==e)return!0;if(!(e instanceof De)||this.local.length!=e.local.length||this.children.length!=e.children.length)return!1;for(let n=0;n<this.local.length;n++)if(!this.local[n].eq(e.local[n]))return!1;for(let n=0;n<this.children.length;n+=3)if(this.children[n]!=e.children[n]||this.children[n+1]!=e.children[n+1]||!this.children[n+2].eq(e.children[n+2]))return!1;return!0}locals(e){return Tf(this.localsInner(e))}localsInner(e){if(this==Ot)return jo;if(e.inlineContent||!this.local.some(ts.is))return this.local;let n=[];for(let r=0;r<this.local.length;r++)this.local[r].type instanceof ts||n.push(this.local[r]);return n}forEachSet(e){e(this)}}De.empty=new De([],[]);De.removeOverlap=Tf;const Ot=De.empty;let N2=class qo{constructor(e){this.members=e}map(e,n){const r=this.members.map(o=>o.map(e,n,ao));return qo.from(r)}forChild(e,n){if(n.isLeaf)return De.empty;let r=[];for(let o=0;o<this.members.length;o++){let i=this.members[o].forChild(e,n);i!=Ot&&(i instanceof qo?r=r.concat(i.members):r.push(i))}return qo.from(r)}eq(e){if(!(e instanceof qo)||e.members.length!=this.members.length)return!1;for(let n=0;n<this.members.length;n++)if(!this.members[n].eq(e.members[n]))return!1;return!0}locals(e){let n,r=!0;for(let o=0;o<this.members.length;o++){let i=this.members[o].localsInner(e);if(i.length)if(!n)n=i;else{r&&(n=n.slice(),r=!1);for(let s=0;s<i.length;s++)n.push(i[s])}}return n?Tf(r?n:n.sort(lo)):jo}static from(e){switch(e.length){case 0:return Ot;case 1:return e[0];default:return new qo(e.every(n=>n instanceof De)?e:e.reduce((n,r)=>n.concat(r instanceof De?r:r.members),[]))}}forEachSet(e){for(let n=0;n<this.members.length;n++)this.members[n].forEachSet(e)}};function w5(t,e,n,r,o,i,s){let a=t.slice();for(let c=0,u=i;c<n.maps.length;c++){let d=0;n.maps[c].forEach((p,f,h,m)=>{let y=m-h-(f-p);for(let g=0;g<a.length;g+=3){let v=a[g+1];if(v<0||p>v+u-d)continue;let k=a[g]+u-d;f>=k?a[g+1]=p<=k?-2:-1:p>=u&&y&&(a[g]+=y,a[g+1]+=y)}d+=y}),u=n.maps[c].map(u,-1)}let l=!1;for(let c=0;c<a.length;c+=3)if(a[c+1]<0){if(a[c+1]==-2){l=!0,a[c+1]=-1;continue}let u=n.map(t[c]+i),d=u-o;if(d<0||d>=r.content.size){l=!0;continue}let p=n.map(t[c+1]+i,-1),f=p-o,{index:h,offset:m}=r.content.findIndex(d),y=r.maybeChild(h);if(y&&m==d&&m+y.nodeSize==f){let g=a[c+2].mapInner(n,y,u+1,t[c]+i+1,s);g!=Ot?(a[c]=d,a[c+1]=f,a[c+2]=g):(a[c+1]=-2,l=!0)}else l=!0}if(l){let c=b5(a,t,e,n,o,i,s),u=Sl(c,r,0,s);e=u.local;for(let d=0;d<a.length;d+=3)a[d+1]<0&&(a.splice(d,3),d-=3);for(let d=0,p=0;d<u.children.length;d+=3){let f=u.children[d];for(;p<a.length&&a[p]<f;)p+=3;a.splice(p,0,u.children[d],u.children[d+1],u.children[d+2])}}return new De(e.sort(lo),a)}function I2(t,e){if(!e||!t.length)return t;let n=[];for(let r=0;r<t.length;r++){let o=t[r];n.push(new Le(o.from+e,o.to+e,o.type))}return n}function b5(t,e,n,r,o,i,s){function a(l,c){for(let u=0;u<l.local.length;u++){let d=l.local[u].map(r,o,c);d?n.push(d):s.onRemove&&s.onRemove(l.local[u].spec)}for(let u=0;u<l.children.length;u+=3)a(l.children[u+2],l.children[u]+c+1)}for(let l=0;l<t.length;l+=3)t[l+1]==-1&&a(t[l+2],e[l]+i+1);return n}function F2(t,e,n){if(e.isLeaf)return null;let r=n+e.nodeSize,o=null;for(let i=0,s;i<t.length;i++)(s=t[i])&&s.from>n&&s.to<r&&((o||(o=[])).push(s),t[i]=null);return o}function R2(t){let e=[];for(let n=0;n<t.length;n++)t[n]!=null&&e.push(t[n]);return e}function Sl(t,e,n,r){let o=[],i=!1;e.forEach((a,l)=>{let c=F2(t,a,l+n);if(c){i=!0;let u=Sl(c,a,n+l+1,r);u!=Ot&&o.push(l,l+a.nodeSize,u)}});let s=I2(i?R2(t):t,-n).sort(lo);for(let a=0;a<s.length;a++)s[a].type.valid(e,s[a])||(r.onRemove&&r.onRemove(s[a].spec),s.splice(a--,1));return s.length||o.length?new De(s,o):Ot}function lo(t,e){return t.from-e.from||t.to-e.to}function Tf(t){let e=t;for(let n=0;n<e.length-1;n++){let r=e[n];if(r.from!=r.to)for(let o=n+1;o<e.length;o++){let i=e[o];if(i.from==r.from){i.to!=r.to&&(e==t&&(e=t.slice()),e[o]=i.copy(i.from,r.to),yy(e,o+1,i.copy(r.to,i.to)));continue}else{i.from<r.to&&(e==t&&(e=t.slice()),e[n]=r.copy(r.from,i.from),yy(e,o,r.copy(i.from,r.to)));break}}}return e}function yy(t,e,n){for(;e<t.length&&lo(n,t[e])>0;)e++;t.splice(e,0,n)}function Nu(t){let e=[];return t.someProp("decorations",n=>{let r=n(t.state);r&&r!=Ot&&e.push(r)}),t.cursorWrapper&&e.push(De.create(t.state.doc,[t.cursorWrapper.deco])),N2.from(e)}const v5={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},x5=Jt&&Or<=11;class k5{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}set(e){this.anchorNode=e.anchorNode,this.anchorOffset=e.anchorOffset,this.focusNode=e.focusNode,this.focusOffset=e.focusOffset}clear(){this.anchorNode=this.focusNode=null}eq(e){return e.anchorNode==this.anchorNode&&e.anchorOffset==this.anchorOffset&&e.focusNode==this.focusNode&&e.focusOffset==this.focusOffset}}class S5{constructor(e,n){this.view=e,this.handleDOMChange=n,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new k5,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.lastChangedTextNode=null,this.observer=window.MutationObserver&&new window.MutationObserver(r=>{for(let o=0;o<r.length;o++)this.queue.push(r[o]);Jt&&Or<=11&&r.some(o=>o.type=="childList"&&o.removedNodes.length||o.type=="characterData"&&o.oldValue.length>o.target.nodeValue.length)?this.flushSoon():this.flush()}),x5&&(this.onCharData=r=>{this.queue.push({target:r.target,type:"characterData",oldValue:r.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this)}flushSoon(){this.flushingSoon<0&&(this.flushingSoon=window.setTimeout(()=>{this.flushingSoon=-1,this.flush()},20))}forceFlush(){this.flushingSoon>-1&&(window.clearTimeout(this.flushingSoon),this.flushingSoon=-1,this.flush())}start(){this.observer&&(this.observer.takeRecords(),this.observer.observe(this.view.dom,v5)),this.onCharData&&this.view.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.connectSelection()}stop(){if(this.observer){let e=this.observer.takeRecords();if(e.length){for(let n=0;n<e.length;n++)this.queue.push(e[n]);window.setTimeout(()=>this.flush(),20)}this.observer.disconnect()}this.onCharData&&this.view.dom.removeEventListener("DOMCharacterDataModified",this.onCharData),this.disconnectSelection()}connectSelection(){this.view.dom.ownerDocument.addEventListener("selectionchange",this.onSelectionChange)}disconnectSelection(){this.view.dom.ownerDocument.removeEventListener("selectionchange",this.onSelectionChange)}suppressSelectionUpdates(){this.suppressingSelectionUpdates=!0,setTimeout(()=>this.suppressingSelectionUpdates=!1,50)}onSelectionChange(){if(ly(this.view)){if(this.suppressingSelectionUpdates)return or(this.view);if(Jt&&Or<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&yo(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset))return this.flushSoon()}this.flush()}}setCurSelection(){this.currentSelection.set(this.view.domSelectionRange())}ignoreSelectionChange(e){if(!e.focusNode)return!0;let n=new Set,r;for(let i=e.focusNode;i;i=ci(i))n.add(i);for(let i=e.anchorNode;i;i=ci(i))if(n.has(i)){r=i;break}let o=r&&this.view.docView.nearestDesc(r);if(o&&o.ignoreMutation({type:"selection",target:r.nodeType==3?r.parentNode:r}))return this.setCurSelection(),!0}pendingRecords(){if(this.observer)for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}flush(){let{view:e}=this;if(!e.docView||this.flushingSoon>-1)return;let n=this.pendingRecords();n.length&&(this.queue=[]);let r=e.domSelectionRange(),o=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(r)&&ly(e)&&!this.ignoreSelectionChange(r),i=-1,s=-1,a=!1,l=[];if(e.editable)for(let u=0;u<n.length;u++){let d=this.registerMutation(n[u],l);d&&(i=i<0?d.from:Math.min(d.from,i),s=s<0?d.to:Math.max(d.to,s),d.typeOver&&(a=!0))}if(xn&&l.length){let u=l.filter(d=>d.nodeName=="BR");if(u.length==2){let[d,p]=u;d.parentNode&&d.parentNode.parentNode==p.parentNode?p.remove():d.remove()}else{let{focusNode:d}=this.currentSelection;for(let p of u){let f=p.parentNode;f&&f.nodeName=="LI"&&(!d||E5(e,d)!=f)&&p.remove()}}}let c=null;i<0&&o&&e.input.lastFocus>Date.now()-200&&Math.max(e.input.lastTouch,e.input.lastClick.time)<Date.now()-300&&ic(r)&&(c=vf(e))&&c.eq(je.near(e.state.doc.resolve(0),1))?(e.input.lastFocus=0,or(e),this.currentSelection.set(r),e.scrollToSelection()):(i>-1||o)&&(i>-1&&(e.docView.markDirty(i,s),A5(e)),this.handleDOMChange(i,s,a,l),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(r)||or(e),this.currentSelection.set(r))}registerMutation(e,n){if(n.indexOf(e.target)>-1)return null;let r=this.view.docView.nearestDesc(e.target);if(e.type=="attributes"&&(r==this.view.docView||e.attributeName=="contenteditable"||e.attributeName=="style"&&!e.oldValue&&!e.target.getAttribute("style"))||!r||r.ignoreMutation(e))return null;if(e.type=="childList"){for(let u=0;u<e.addedNodes.length;u++){let d=e.addedNodes[u];n.push(d),d.nodeType==3&&(this.lastChangedTextNode=d)}if(r.contentDOM&&r.contentDOM!=r.dom&&!r.contentDOM.contains(e.target))return{from:r.posBefore,to:r.posAfter};let o=e.previousSibling,i=e.nextSibling;if(Jt&&Or<=11&&e.addedNodes.length)for(let u=0;u<e.addedNodes.length;u++){let{previousSibling:d,nextSibling:p}=e.addedNodes[u];(!d||Array.prototype.indexOf.call(e.addedNodes,d)<0)&&(o=d),(!p||Array.prototype.indexOf.call(e.addedNodes,p)<0)&&(i=p)}let s=o&&o.parentNode==e.target?Ct(o)+1:0,a=r.localPosFromDOM(e.target,s,-1),l=i&&i.parentNode==e.target?Ct(i):e.target.childNodes.length,c=r.localPosFromDOM(e.target,l,1);return{from:a,to:c}}else return e.type=="attributes"?{from:r.posAtStart-r.border,to:r.posAtEnd+r.border}:(this.lastChangedTextNode=e.target,{from:r.posAtStart,to:r.posAtEnd,typeOver:e.target.nodeValue==e.oldValue})}}let wy=new WeakMap,by=!1;function A5(t){if(!wy.has(t)&&(wy.set(t,null),["normal","nowrap","pre-line"].indexOf(getComputedStyle(t.dom).whiteSpace)!==-1)){if(t.requiresGeckoHackNode=xn,by)return;console.warn("ProseMirror expects the CSS white-space property to be set, preferably to 'pre-wrap'. It is recommended to load style/prosemirror.css from the prosemirror-view package."),by=!0}}function vy(t,e){let n=e.startContainer,r=e.startOffset,o=e.endContainer,i=e.endOffset,s=t.domAtPos(t.state.selection.anchor);return yo(s.node,s.offset,o,i)&&([n,r,o,i]=[o,i,n,r]),{anchorNode:n,anchorOffset:r,focusNode:o,focusOffset:i}}function C5(t,e){if(e.getComposedRanges){let o=e.getComposedRanges(t.root)[0];if(o)return vy(t,o)}let n;function r(o){o.preventDefault(),o.stopImmediatePropagation(),n=o.getTargetRanges()[0]}return t.dom.addEventListener("beforeinput",r,!0),document.execCommand("indent"),t.dom.removeEventListener("beforeinput",r,!0),n?vy(t,n):null}function E5(t,e){for(let n=e.parentNode;n&&n!=t.dom;n=n.parentNode){let r=t.docView.nearestDesc(n,!0);if(r&&r.node.isBlock)return n}return null}function T5(t,e,n){let{node:r,fromOffset:o,toOffset:i,from:s,to:a}=t.docView.parseRange(e,n),l=t.domSelectionRange(),c,u=l.anchorNode;if(u&&t.dom.contains(u.nodeType==1?u:u.parentNode)&&(c=[{node:u,offset:l.anchorOffset}],ic(l)||c.push({node:l.focusNode,offset:l.focusOffset})),Dt&&t.input.lastKeyCode===8)for(let y=i;y>o;y--){let g=r.childNodes[y-1],v=g.pmViewDesc;if(g.nodeName=="BR"&&!v){i=y;break}if(!v||v.size)break}let d=t.state.doc,p=t.someProp("domParser")||er.fromSchema(t.state.schema),f=d.resolve(s),h=null,m=p.parse(r,{topNode:f.parent,topMatch:f.parent.contentMatchAt(f.index()),topOpen:!0,from:o,to:i,preserveWhitespace:f.parent.type.whitespace=="pre"?"full":!0,findPositions:c,ruleFromNode:$5,context:f});if(c&&c[0].pos!=null){let y=c[0].pos,g=c[1]&&c[1].pos;g==null&&(g=y),h={anchor:y+s,head:g+s}}return{doc:m,sel:h,from:s,to:a}}function $5(t){let e=t.pmViewDesc;if(e)return e.parseRule();if(t.nodeName=="BR"&&t.parentNode){if(qt&&/^(ul|ol)$/i.test(t.parentNode.nodeName)){let n=document.createElement("div");return n.appendChild(document.createElement("li")),{skip:n}}else if(t.parentNode.lastChild==t||qt&&/^(tr|table)$/i.test(t.parentNode.nodeName))return{ignore:!0}}else if(t.nodeName=="IMG"&&t.getAttribute("mark-placeholder"))return{ignore:!0};return null}const O5=/^(a|abbr|acronym|b|bd[io]|big|br|button|cite|code|data(list)?|del|dfn|em|i|ins|kbd|label|map|mark|meter|output|q|ruby|s|samp|small|span|strong|su[bp]|time|u|tt|var)$/i;function M5(t,e,n,r,o){let i=t.input.compositionPendingChanges||(t.composing?t.input.compositionID:0);if(t.input.compositionPendingChanges=0,e<0){let E=t.input.lastSelectionTime>Date.now()-50?t.input.lastSelectionOrigin:null,G=vf(t,E);if(G&&!t.state.selection.eq(G)){if(Dt&&Qn&&t.input.lastKeyCode===13&&Date.now()-100<t.input.lastKeyCodeTime&&t.someProp("handleKeyDown",N=>N(t,Xr(13,"Enter"))))return;let oe=t.state.tr.setSelection(G);E=="pointer"?oe.setMeta("pointer",!0):E=="key"&&oe.scrollIntoView(),i&&oe.setMeta("composition",i),t.dispatch(oe)}return}let s=t.state.doc.resolve(e),a=s.sharedDepth(n);e=s.before(a+1),n=t.state.doc.resolve(n).after(a+1);let l=t.state.selection,c=T5(t,e,n),u=t.state.doc,d=u.slice(c.from,c.to),p,f;t.input.lastKeyCode===8&&Date.now()-100<t.input.lastKeyCodeTime?(p=t.state.selection.to,f="end"):(p=t.state.selection.from,f="start"),t.input.lastKeyCode=null;let h=N5(d.content,c.doc.content,c.from,p,f);if(h&&t.input.domChangeCount++,(ui&&t.input.lastIOSEnter>Date.now()-225||Qn)&&o.some(E=>E.nodeType==1&&!O5.test(E.nodeName))&&(!h||h.endA>=h.endB)&&t.someProp("handleKeyDown",E=>E(t,Xr(13,"Enter")))){t.input.lastIOSEnter=0;return}if(!h)if(r&&l instanceof Pe&&!l.empty&&l.$head.sameParent(l.$anchor)&&!t.composing&&!(c.sel&&c.sel.anchor!=c.sel.head))h={start:l.from,endA:l.to,endB:l.to};else{if(c.sel){let E=xy(t,t.state.doc,c.sel);if(E&&!E.eq(t.state.selection)){let G=t.state.tr.setSelection(E);i&&G.setMeta("composition",i),t.dispatch(G)}}return}t.state.selection.from<t.state.selection.to&&h.start==h.endB&&t.state.selection instanceof Pe&&(h.start>t.state.selection.from&&h.start<=t.state.selection.from+2&&t.state.selection.from>=c.from?h.start=t.state.selection.from:h.endA<t.state.selection.to&&h.endA>=t.state.selection.to-2&&t.state.selection.to<=c.to&&(h.endB+=t.state.selection.to-h.endA,h.endA=t.state.selection.to)),Jt&&Or<=11&&h.endB==h.start+1&&h.endA==h.start&&h.start>c.from&&c.doc.textBetween(h.start-c.from-1,h.start-c.from+1)==" "&&(h.start--,h.endA--,h.endB--);let m=c.doc.resolveNoCache(h.start-c.from),y=c.doc.resolveNoCache(h.endB-c.from),g=u.resolve(h.start),v=m.sameParent(y)&&m.parent.inlineContent&&g.end()>=h.endA,k;if((ui&&t.input.lastIOSEnter>Date.now()-225&&(!v||o.some(E=>E.nodeName=="DIV"||E.nodeName=="P"))||!v&&m.pos<c.doc.content.size&&(!m.sameParent(y)||!m.parent.inlineContent)&&!/\S/.test(c.doc.textBetween(m.pos,y.pos,"",""))&&(k=je.findFrom(c.doc.resolve(m.pos+1),1,!0))&&k.head>m.pos)&&t.someProp("handleKeyDown",E=>E(t,Xr(13,"Enter")))){t.input.lastIOSEnter=0;return}if(t.state.selection.anchor>h.start&&_5(u,h.start,h.endA,m,y)&&t.someProp("handleKeyDown",E=>E(t,Xr(8,"Backspace")))){Qn&&Dt&&t.domObserver.suppressSelectionUpdates();return}Dt&&h.endB==h.start&&(t.input.lastChromeDelete=Date.now()),Qn&&!v&&m.start()!=y.start()&&y.parentOffset==0&&m.depth==y.depth&&c.sel&&c.sel.anchor==c.sel.head&&c.sel.head==h.endA&&(h.endB-=2,y=c.doc.resolveNoCache(h.endB-c.from),setTimeout(()=>{t.someProp("handleKeyDown",function(E){return E(t,Xr(13,"Enter"))})},20));let b=h.start,C=h.endA,D,M,I;if(v){if(m.pos==y.pos)Jt&&Or<=11&&m.parentOffset==0&&(t.domObserver.suppressSelectionUpdates(),setTimeout(()=>or(t),20)),D=t.state.tr.delete(b,C),M=u.resolve(h.start).marksAcross(u.resolve(h.endA));else if(h.endA==h.endB&&(I=D5(m.parent.content.cut(m.parentOffset,y.parentOffset),g.parent.content.cut(g.parentOffset,h.endA-g.start()))))D=t.state.tr,I.type=="add"?D.addMark(b,C,I.mark):D.removeMark(b,C,I.mark);else if(m.parent.child(m.index()).isText&&m.index()==y.index()-(y.textOffset?0:1)){let E=m.parent.textBetween(m.parentOffset,y.parentOffset);if(t.someProp("handleTextInput",G=>G(t,b,C,E)))return;D=t.state.tr.insertText(E,b,C)}}if(D||(D=t.state.tr.replace(b,C,c.doc.slice(h.start-c.from,h.endB-c.from))),c.sel){let E=xy(t,D.doc,c.sel);E&&!(Dt&&t.composing&&E.empty&&(h.start!=h.endB||t.input.lastChromeDelete<Date.now()-100)&&(E.head==b||E.head==D.mapping.map(C)-1)||Jt&&E.empty&&E.head==b)&&D.setSelection(E)}M&&D.ensureMarks(M),i&&D.setMeta("composition",i),t.dispatch(D.scrollIntoView())}function xy(t,e,n){return Math.max(n.anchor,n.head)>e.content.size?null:xf(t,e.resolve(n.anchor),e.resolve(n.head))}function D5(t,e){let n=t.firstChild.marks,r=e.firstChild.marks,o=n,i=r,s,a,l;for(let u=0;u<r.length;u++)o=r[u].removeFromSet(o);for(let u=0;u<n.length;u++)i=n[u].removeFromSet(i);if(o.length==1&&i.length==0)a=o[0],s="add",l=u=>u.mark(a.addToSet(u.marks));else if(o.length==0&&i.length==1)a=i[0],s="remove",l=u=>u.mark(a.removeFromSet(u.marks));else return null;let c=[];for(let u=0;u<e.childCount;u++)c.push(l(e.child(u)));if(ye.from(c).eq(t))return{mark:a,type:s}}function _5(t,e,n,r,o){if(n-e<=o.pos-r.pos||Iu(r,!0,!1)<o.pos)return!1;let i=t.resolve(e);if(!r.parent.isTextblock){let a=i.nodeAfter;return a!=null&&n==e+a.nodeSize}if(i.parentOffset<i.parent.content.size||!i.parent.isTextblock)return!1;let s=t.resolve(Iu(i,!0,!0));return!s.parent.isTextblock||s.pos>n||Iu(s,!0,!1)<n?!1:r.parent.content.cut(r.parentOffset).eq(s.parent.content)}function Iu(t,e,n){let r=t.depth,o=e?t.end():t.pos;for(;r>0&&(e||t.indexAfter(r)==t.node(r).childCount);)r--,o++,e=!1;if(n){let i=t.node(r).maybeChild(t.indexAfter(r));for(;i&&!i.isLeaf;)i=i.firstChild,o++}return o}function N5(t,e,n,r,o){let i=t.findDiffStart(e,n);if(i==null)return null;let{a:s,b:a}=t.findDiffEnd(e,n+t.size,n+e.size);if(o=="end"){let l=Math.max(0,i-Math.min(s,a));r-=s+l-i}if(s<i&&t.size<e.size){let l=r<=i&&r>=s?i-r:0;i-=l,i&&i<e.size&&ky(e.textBetween(i-1,i+1))&&(i+=l?1:-1),a=i+(a-s),s=i}else if(a<i){let l=r<=i&&r>=a?i-r:0;i-=l,i&&i<t.size&&ky(t.textBetween(i-1,i+1))&&(i+=l?1:-1),s=i+(s-a),a=i}return{start:i,endA:s,endB:a}}function ky(t){if(t.length!=2)return!1;let e=t.charCodeAt(0),n=t.charCodeAt(1);return e>=56320&&e<=57343&&n>=55296&&n<=56319}let B2=class{constructor(e,n){this._root=null,this.focused=!1,this.trackWrites=null,this.mounted=!1,this.markCursor=null,this.cursorWrapper=null,this.lastSelectedViewDesc=void 0,this.input=new ZO,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=n,this.state=n.state,this.directPlugins=n.plugins||[],this.directPlugins.forEach(Ty),this.dispatch=this.dispatch.bind(this),this.dom=e&&e.mount||document.createElement("div"),e&&(e.appendChild?e.appendChild(this.dom):typeof e=="function"?e(this.dom):e.mount&&(this.mounted=!0)),this.editable=Cy(this),Ay(this),this.nodeViews=Ey(this),this.docView=ny(this.state.doc,Sy(this),Nu(this),this.dom,this),this.domObserver=new S5(this,(r,o,i,s)=>M5(this,r,o,i,s)),this.domObserver.start(),QO(this),this.updatePluginViews()}get composing(){return this.input.composing}get props(){if(this._props.state!=this.state){let e=this._props;this._props={};for(let n in e)this._props[n]=e[n];this._props.state=this.state}return this._props}update(e){e.handleDOMEvents!=this._props.handleDOMEvents&&tp(this);let n=this._props;this._props=e,e.plugins&&(e.plugins.forEach(Ty),this.directPlugins=e.plugins),this.updateStateInner(e.state,n)}setProps(e){let n={};for(let r in this._props)n[r]=this._props[r];n.state=this.state;for(let r in e)n[r]=e[r];this.update(n)}updateState(e){this.updateStateInner(e,this._props)}updateStateInner(e,n){var r;let o=this.state,i=!1,s=!1;e.storedMarks&&this.composing&&($2(this),s=!0),this.state=e;let a=o.plugins!=e.plugins||this._props.plugins!=n.plugins;if(a||this._props.plugins!=n.plugins||this._props.nodeViews!=n.nodeViews){let f=Ey(this);F5(f,this.nodeViews)&&(this.nodeViews=f,i=!0)}(a||n.handleDOMEvents!=this._props.handleDOMEvents)&&tp(this),this.editable=Cy(this),Ay(this);let l=Nu(this),c=Sy(this),u=o.plugins!=e.plugins&&!o.doc.eq(e.doc)?"reset":e.scrollToSelection>o.scrollToSelection?"to selection":"preserve",d=i||!this.docView.matchesNode(e.doc,c,l);(d||!e.selection.eq(o.selection))&&(s=!0);let p=u=="preserve"&&s&&this.dom.style.overflowAnchor==null&&fO(this);if(s){this.domObserver.stop();let f=d&&(Jt||Dt)&&!this.composing&&!o.selection.empty&&!e.selection.empty&&I5(o.selection,e.selection);if(d){let h=Dt?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=p5(this)),(i||!this.docView.update(e.doc,c,l,this))&&(this.docView.updateOuterDeco(c),this.docView.destroy(),this.docView=ny(e.doc,c,l,this.dom,this)),h&&!this.trackWrites&&(f=!0)}f||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&BO(this))?or(this,f):(g2(this,e.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(o),!((r=this.dragging)===null||r===void 0)&&r.node&&!o.doc.eq(e.doc)&&this.updateDraggedNode(this.dragging,o),u=="reset"?this.dom.scrollTop=0:u=="to selection"?this.scrollToSelection():p&&hO(p)}scrollToSelection(){let e=this.domSelectionRange().focusNode;if(!(!e||!this.dom.contains(e.nodeType==1?e:e.parentNode))&&!this.someProp("handleScrollToSelection",n=>n(this)))if(this.state.selection instanceof _e){let n=this.docView.domAfterPos(this.state.selection.from);n.nodeType==1&&Xg(this,n.getBoundingClientRect(),e)}else Xg(this,this.coordsAtPos(this.state.selection.head,1),e)}destroyPluginViews(){let e;for(;e=this.pluginViews.pop();)e.destroy&&e.destroy()}updatePluginViews(e){if(!e||e.plugins!=this.state.plugins||this.directPlugins!=this.prevDirectPlugins){this.prevDirectPlugins=this.directPlugins,this.destroyPluginViews();for(let n=0;n<this.directPlugins.length;n++){let r=this.directPlugins[n];r.spec.view&&this.pluginViews.push(r.spec.view(this))}for(let n=0;n<this.state.plugins.length;n++){let r=this.state.plugins[n];r.spec.view&&this.pluginViews.push(r.spec.view(this))}}else for(let n=0;n<this.pluginViews.length;n++){let r=this.pluginViews[n];r.update&&r.update(this,e)}}updateDraggedNode(e,n){let r=e.node,o=-1;if(this.state.doc.nodeAt(r.from)==r.node)o=r.from;else{let i=r.from+(this.state.doc.content.size-n.doc.content.size);(i>0&&this.state.doc.nodeAt(i))==r.node&&(o=i)}this.dragging=new M2(e.slice,e.move,o<0?void 0:_e.create(this.state.doc,o))}someProp(e,n){let r=this._props&&this._props[e],o;if(r!=null&&(o=n?n(r):r))return o;for(let s=0;s<this.directPlugins.length;s++){let a=this.directPlugins[s].props[e];if(a!=null&&(o=n?n(a):a))return o}let i=this.state.plugins;if(i)for(let s=0;s<i.length;s++){let a=i[s].props[e];if(a!=null&&(o=n?n(a):a))return o}}hasFocus(){if(Jt){let e=this.root.activeElement;if(e==this.dom)return!0;if(!e||!this.dom.contains(e))return!1;for(;e&&this.dom!=e&&this.dom.contains(e);){if(e.contentEditable=="false")return!1;e=e.parentElement}return!0}return this.root.activeElement==this.dom}focus(){this.domObserver.stop(),this.editable&&mO(this.dom),or(this),this.domObserver.start()}get root(){let e=this._root;if(e==null){for(let n=this.dom.parentNode;n;n=n.parentNode)if(n.nodeType==9||n.nodeType==11&&n.host)return n.getSelection||(Object.getPrototypeOf(n).getSelection=()=>n.ownerDocument.getSelection()),this._root=n}return e||document}updateRoot(){this._root=null}posAtCoords(e){return vO(this,e)}coordsAtPos(e,n=1){return i2(this,e,n)}domAtPos(e,n=0){return this.docView.domFromPos(e,n)}nodeDOM(e){let n=this.docView.descAt(e);return n?n.nodeDOM:null}posAtDOM(e,n,r=-1){let o=this.docView.posFromDOM(e,n,r);if(o==null)throw new RangeError("DOM position not inside the editor");return o}endOfTextblock(e,n){return CO(this,n||this.state,e)}pasteHTML(e,n){return xs(this,"",e,!1,n||new ClipboardEvent("paste"))}pasteText(e,n){return xs(this,e,null,!0,n||new ClipboardEvent("paste"))}serializeForClipboard(e){return kf(this,e)}destroy(){this.docView&&(e5(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],Nu(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,nO())}get isDestroyed(){return this.docView==null}dispatchEvent(e){return n5(this,e)}dispatch(e){let n=this._props.dispatchTransaction;n?n.call(this,e):this.updateState(this.state.apply(e))}domSelectionRange(){let e=this.domSelection();return e?qt&&this.root.nodeType===11&&aO(this.dom.ownerDocument)==this.dom&&C5(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}};function Sy(t){let e=Object.create(null);return e.class="ProseMirror",e.contenteditable=String(t.editable),t.someProp("attributes",n=>{if(typeof n=="function"&&(n=n(t.state)),n)for(let r in n)r=="class"?e.class+=" "+n[r]:r=="style"?e.style=(e.style?e.style+";":"")+n[r]:!e[r]&&r!="contenteditable"&&r!="nodeName"&&(e[r]=String(n[r]))}),e.translate||(e.translate="no"),[Le.node(0,t.state.doc.content.size,e)]}function Ay(t){if(t.markCursor){let e=document.createElement("img");e.className="ProseMirror-separator",e.setAttribute("mark-placeholder","true"),e.setAttribute("alt",""),t.cursorWrapper={dom:e,deco:Le.widget(t.state.selection.from,e,{raw:!0,marks:t.markCursor})}}else t.cursorWrapper=null}function Cy(t){return!t.someProp("editable",e=>e(t.state)===!1)}function I5(t,e){let n=Math.min(t.$anchor.sharedDepth(t.head),e.$anchor.sharedDepth(e.head));return t.$anchor.start(n)!=e.$anchor.start(n)}function Ey(t){let e=Object.create(null);function n(r){for(let o in r)Object.prototype.hasOwnProperty.call(e,o)||(e[o]=r[o])}return t.someProp("nodeViews",n),t.someProp("markViews",n),e}function F5(t,e){let n=0,r=0;for(let o in t){if(t[o]!=e[o])return!0;n++}for(let o in e)r++;return n!=r}function Ty(t){if(t.spec.state||t.spec.filterTransaction||t.spec.appendTransaction)throw new RangeError("Plugins passed directly to the view must not have a state component")}const Ss=Math.floor,R5=Math.abs,Mr=(t,e)=>t<e?t:e,di=(t,e)=>t>e?t:e,B5=t=>t!==0?t<0:1/t<0,L5=64,As=128,P5=1<<29,$y=63,ns=127,z5=2147483647,j5=Number.isInteger||(t=>typeof t=="number"&&isFinite(t)&&Ss(t)===t),q5=()=>new Set,V5=Array.isArray,U5=String.fromCharCode,H5=t=>t.toLowerCase(),W5=/^\s*/g,G5=t=>t.replace(W5,""),K5=/([A-Z])/g,Oy=(t,e)=>G5(t.replace(K5,n=>`${e}${H5(n)}`)),J5=t=>{const e=unescape(encodeURIComponent(t)),n=e.length,r=new Uint8Array(n);for(let o=0;o<n;o++)r[o]=e.codePointAt(o);return r},Cs=typeof TextEncoder<"u"?new TextEncoder:null,X5=t=>Cs.encode(t),Y5=Cs?X5:J5;let Fu=typeof TextDecoder>"u"?null:new TextDecoder("utf-8",{fatal:!0,ignoreBOM:!0});Fu&&Fu.decode(new Uint8Array).length===1&&(Fu=null);class Z5{constructor(){this.cpos=0,this.cbuf=new Uint8Array(100),this.bufs=[]}}const Q5=()=>new Z5,eM=t=>{const e=Q5();return t(e),nM(e)},tM=t=>{let e=t.cpos;for(let n=0;n<t.bufs.length;n++)e+=t.bufs[n].length;return e},nM=t=>{const e=new Uint8Array(tM(t));let n=0;for(let r=0;r<t.bufs.length;r++){const o=t.bufs[r];e.set(o,n),n+=o.length}return e.set(new Uint8Array(t.cbuf.buffer,0,t.cpos),n),e},rM=(t,e)=>{const n=t.cbuf.length;n-t.cpos<e&&(t.bufs.push(new Uint8Array(t.cbuf.buffer,0,t.cpos)),t.cbuf=new Uint8Array(di(n,e)*2),t.cpos=0)},At=(t,e)=>{const n=t.cbuf.length;t.cpos===n&&(t.bufs.push(t.cbuf),t.cbuf=new Uint8Array(n*2),t.cpos=0),t.cbuf[t.cpos++]=e},Es=(t,e)=>{for(;e>ns;)At(t,As|ns&e),e=Ss(e/128);At(t,ns&e)},oM=(t,e)=>{const n=B5(e);for(n&&(e=-e),At(t,(e>$y?As:0)|(n?L5:0)|$y&e),e=Ss(e/64);e>0;)At(t,(e>ns?As:0)|ns&e),e=Ss(e/128)},rp=new Uint8Array(3e4),iM=rp.length/3,sM=(t,e)=>{if(e.length<iM){const n=Cs.encodeInto(e,rp).written||0;Es(t,n);for(let r=0;r<n;r++)At(t,rp[r])}else L2(t,Y5(e))},aM=(t,e)=>{const n=unescape(encodeURIComponent(e)),r=n.length;Es(t,r);for(let o=0;o<r;o++)At(t,n.codePointAt(o))},My=Cs&&Cs.encodeInto?sM:aM,lM=(t,e)=>{const n=t.cbuf.length,r=t.cpos,o=Mr(n-r,e.length),i=e.length-o;t.cbuf.set(e.subarray(0,o),r),t.cpos+=o,i>0&&(t.bufs.push(t.cbuf),t.cbuf=new Uint8Array(di(n*2,i)),t.cbuf.set(e.subarray(o)),t.cpos=i)},L2=(t,e)=>{Es(t,e.byteLength),lM(t,e)},$f=(t,e)=>{rM(t,e);const n=new DataView(t.cbuf.buffer,t.cpos,e);return t.cpos+=e,n},cM=(t,e)=>$f(t,4).setFloat32(0,e,!1),uM=(t,e)=>$f(t,8).setFloat64(0,e,!1),dM=(t,e)=>$f(t,8).setBigInt64(0,e,!1),Dy=new DataView(new ArrayBuffer(4)),pM=t=>(Dy.setFloat32(0,t),Dy.getFloat32(0)===t),op=(t,e)=>{switch(typeof e){case"string":At(t,119),My(t,e);break;case"number":j5(e)&&R5(e)<=z5?(At(t,125),oM(t,e)):pM(e)?(At(t,124),cM(t,e)):(At(t,123),uM(t,e));break;case"bigint":At(t,122),dM(t,e);break;case"object":if(e===null)At(t,126);else if(V5(e)){At(t,117),Es(t,e.length);for(let n=0;n<e.length;n++)op(t,e[n])}else if(e instanceof Uint8Array)At(t,116),L2(t,e);else{At(t,118);const n=Object.keys(e);Es(t,n.length);for(let r=0;r<n.length;r++){const o=n[r];My(t,o),op(t,e[o])}}break;case"boolean":At(t,e?120:121);break;default:At(t,127)}},P2=t=>new Error(t),fM=()=>{throw P2("Method unimplemented")},z2=()=>{throw P2("Unexpected case")},Ha=()=>new Map,j2=(t,e,n)=>{let r=t.get(e);return r===void 0&&t.set(e,r=n()),r},hM=Object.keys,mM=(t,e)=>{for(const n in t)if(!e(t[n],n))return!1;return!0},gM=(t,e)=>e.includes(t),yM=()=>{let t=!0;return(e,n)=>{if(t){t=!1;try{e()}finally{t=!0}}else n!==void 0&&n()}},wM=/[\uD800-\uDBFF]/,bM=/[\uDC00-\uDFFF]/,vM=(t,e)=>{let n=0,r=0;for(;n<t.length&&n<e.length&&t[n]===e[n];)n++;for(n>0&&wM.test(t[n-1])&&n--;r+n<t.length&&r+n<e.length&&t[t.length-r-1]===e[e.length-r-1];)r++;return r>0&&bM.test(t[t.length-r])&&r--,{index:n,remove:t.length-n-r,insert:e.slice(n,e.length-r)}},xM=vM,rt=new Ge("y-sync"),Dr=new Ge("y-undo"),ua=new Ge("yjs-cursor"),kM=Math.random,SM=t=>t[Ss(kM()*t.length)],AM=t=>t===void 0?null:t;class CM{constructor(){this.map=new Map}setItem(e,n){this.map.set(e,n)}getItem(e){return this.map.get(e)}}let q2=new CM,EM=!0;try{typeof localStorage<"u"&&localStorage&&(q2=localStorage,EM=!1)}catch{}const TM=q2,pi=typeof Se<"u"&&Se.release&&/node|io\.js/.test(Se.release.name)&&Object.prototype.toString.call(typeof Se<"u"?Se:0)==="[object process]",V2=typeof window<"u"&&typeof document<"u"&&!pi;let An;const $M=()=>{if(An===void 0)if(pi){An=Ha();const t=Se.argv;let e=null;for(let n=0;n<t.length;n++){const r=t[n];r[0]==="-"?(e!==null&&An.set(e,""),e=r):e!==null&&(An.set(e,r),e=null)}e!==null&&An.set(e,"")}else typeof location=="object"?(An=Ha(),(location.search||"?").slice(1).split("&").forEach(t=>{if(t.length!==0){const[e,n]=t.split("=");An.set(`--${Oy(e,"-")}`,n),An.set(`-${Oy(e,"-")}`,n)}})):An=Ha();return An},ip=t=>$M().has(t),sp=t=>AM(pi?Se.env[t.toUpperCase().replaceAll("-","_")]:TM.getItem(t)),U2=t=>ip("--"+t)||sp(t)!==null;U2("production");const OM=pi&&gM(Se.env.FORCE_COLOR,["true","1","2"]);OM||!ip("--no-colors")&&!U2("no-color")&&(!pi||Se.stdout.isTTY)&&(!pi||ip("--color")||sp("COLORTERM")!==null||(sp("TERM")||"").includes("color"));const MM=typeof document<"u"?document:{};typeof DOMParser<"u"&&new DOMParser;const DM=t=>class{constructor(e){this._=e}destroy(){t(this._)}},_M=DM(clearTimeout),Of=(t,e)=>new _M(setTimeout(e,t)),In=(t,e)=>t>>>e|t<<32-e,NM=t=>In(t,2)^In(t,13)^In(t,22),IM=t=>In(t,6)^In(t,11)^In(t,25),FM=t=>In(t,7)^In(t,18)^t>>>3,RM=t=>In(t,17)^In(t,19)^t>>>10,BM=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),LM=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]);class PM{constructor(){const e=new ArrayBuffer(320);this._H=new Uint32Array(e,0,8),this._H.set(LM),this._W=new Uint32Array(e,64,64)}_updateHash(){const e=this._H,n=this._W;for(let d=16;d<64;d++)n[d]=RM(n[d-2])+n[d-7]+FM(n[d-15])+n[d-16];let r=e[0],o=e[1],i=e[2],s=e[3],a=e[4],l=e[5],c=e[6],u=e[7];for(let d=0,p,f;d<64;d++)p=u+IM(a)+(a&l^~a&c)+BM[d]+n[d]>>>0,f=NM(r)+(r&o^r&i^o&i)>>>0,u=c,c=l,l=a,a=s+p>>>0,s=i,i=o,o=r,r=p+f>>>0;e[0]+=r,e[1]+=o,e[2]+=i,e[3]+=s,e[4]+=a,e[5]+=l,e[6]+=c,e[7]+=u}digest(e){let n=0;for(;n+56<=e.length;){let s=0;for(;s<16&&n+3<e.length;s++)this._W[s]=e[n++]<<24|e[n++]<<16|e[n++]<<8|e[n++];if(n%64!==0){for(this._W.fill(0,s,16);n<e.length;)this._W[s]|=e[n]<<(3-n%4)*8,n++;this._W[s]|=As<<(3-n%4)*8}this._updateHash()}const r=n%64!==0;this._W.fill(0,0,16);let o=0;for(;n<e.length;o++)for(let s=3;s>=0&&n<e.length;s--)this._W[o]|=e[n++]<<s*8;r||(this._W[o-(n%4===0?0:1)]|=As<<(3-n%4)*8),this._W[14]=e.byteLength/P5,this._W[15]=e.byteLength*8,this._updateHash();const i=new Uint8Array(32);for(let s=0;s<this._H.length;s++)for(let a=0;a<4;a++)i[s*4+a]=this._H[s]>>>(3-a)*8;return i}}const zM=t=>new PM().digest(t),jM=t=>{let e="";for(let n=0;n<t.byteLength;n++)e+=U5(t[n]);return btoa(e)},qM=t=>mt.from(t.buffer,t.byteOffset,t.byteLength).toString("base64"),VM=V2?jM:qM,UM=t=>eM(e=>op(e,t)),HM=t=>{for(let e=6;e<t.length;e++)t[e%6]=t[e%6]^t[e];return t.slice(0,6)},WM=t=>VM(HM(zM(UM(t)))),GM=()=>({mapping:new Map,isOMark:new Map}),Al=(t,e)=>e===void 0?!t.deleted:e.sv.has(t.id.client)&&e.sv.get(t.id.client)>t.id.clock&&!Ee.isDeleted(e.ds,t.id),KM=[{light:"#ecd44433",dark:"#ecd444"}],JM=(t,e,n)=>{if(!t.has(n)){if(t.size<e.length){const r=q5();t.forEach(o=>r.add(o)),e=e.filter(o=>!r.has(o))}t.set(n,SM(e))}return t.get(n)},XM=(t,{colors:e=KM,colorMapping:n=new Map,permanentUserData:r=null,onFirstRender:o=()=>{},mapping:i}={})=>{let s=!1;const a=new ZM(t,i),l=new Ue({props:{editable:c=>{const u=rt.getState(c);return u.snapshot==null&&u.prevSnapshot==null}},key:rt,state:{init:(c,u)=>({type:t,doc:t.doc,binding:a,snapshot:null,prevSnapshot:null,isChangeOrigin:!1,isUndoRedoOperation:!1,addToHistory:!0,colors:e,colorMapping:n,permanentUserData:r}),apply:(c,u)=>{const d=c.getMeta(rt);if(d!==void 0){u=Object.assign({},u);for(const p in d)u[p]=d[p]}return u.addToHistory=c.getMeta("addToHistory")!==!1,u.isChangeOrigin=d!==void 0&&!!d.isChangeOrigin,u.isUndoRedoOperation=d!==void 0&&!!d.isChangeOrigin&&!!d.isUndoRedoOperation,a.prosemirrorView!==null&&d!==void 0&&(d.snapshot!=null||d.prevSnapshot!=null)&&Of(0,()=>{a.prosemirrorView!=null&&(d.restore==null?a._renderSnapshot(d.snapshot,d.prevSnapshot,u):(a._renderSnapshot(d.snapshot,d.snapshot,u),delete u.restore,delete u.snapshot,delete u.prevSnapshot,a.mux(()=>{a._prosemirrorChanged(a.prosemirrorView.state.doc)})))}),u}},view:c=>(a.initView(c),i==null&&a._forceRerender(),o(),{update:()=>{const u=l.getState(c.state);if(u.snapshot==null&&u.prevSnapshot==null&&(s||c.state.doc.content.findDiffStart(c.state.doc.type.createAndFill().content)!==null)){if(s=!0,u.addToHistory===!1&&!u.isChangeOrigin){const d=Dr.getState(c.state),p=d&&d.undoManager;p&&p.stopCapturing()}a.mux(()=>{u.doc.transact(d=>{d.meta.set("addToHistory",u.addToHistory),a._prosemirrorChanged(c.state.doc)},rt)})}},destroy:()=>{a.destroy()}})});return l},YM=(t,e,n)=>{if(e!==null&&e.anchor!==null&&e.head!==null)if(e.type==="all")t.setSelection(new Nn(t.doc));else if(e.type==="node"){const r=Zo(n.doc,n.type,e.anchor,n.mapping);t.setSelection(_e.create(t.doc,r))}else{const r=Zo(n.doc,n.type,e.anchor,n.mapping),o=Zo(n.doc,n.type,e.head,n.mapping);r!==null&&o!==null&&t.setSelection(Pe.between(t.doc.resolve(r),t.doc.resolve(o)))}},ap=(t,e)=>({type:e.selection.jsonID,anchor:Tl(e.selection.anchor,t.type,t.mapping),head:Tl(e.selection.head,t.type,t.mapping)});class ZM{constructor(e,n=new Map){this.type=e,this.prosemirrorView=null,this.mux=yM(),this.mapping=n,this.isOMark=new Map,this._observeFunction=this._typeChanged.bind(this),this.doc=e.doc,this.beforeTransactionSelection=null,this.beforeAllTransactions=()=>{this.beforeTransactionSelection===null&&this.prosemirrorView!=null&&(this.beforeTransactionSelection=ap(this,this.prosemirrorView.state))},this.afterAllTransactions=()=>{this.beforeTransactionSelection=null},this._domSelectionInView=null}get _tr(){return this.prosemirrorView.state.tr.setMeta("addToHistory",!1)}_isLocalCursorInView(){return this.prosemirrorView.hasFocus()?(V2&&this._domSelectionInView===null&&(Of(0,()=>{this._domSelectionInView=null}),this._domSelectionInView=this._isDomSelectionInView()),this._domSelectionInView):!1}_isDomSelectionInView(){const e=this.prosemirrorView._root.getSelection();if(e==null||e.anchorNode==null)return!1;const n=this.prosemirrorView._root.createRange();n.setStart(e.anchorNode,e.anchorOffset),n.setEnd(e.focusNode,e.focusOffset),n.getClientRects().length===0&&n.startContainer&&n.collapsed&&n.selectNodeContents(n.startContainer);const r=n.getBoundingClientRect(),o=MM.documentElement;return r.bottom>=0&&r.right>=0&&r.left<=(window.innerWidth||o.clientWidth||0)&&r.top<=(window.innerHeight||o.clientHeight||0)}renderSnapshot(e,n){n||(n=Ee.createSnapshot(Ee.createDeleteSet(),new Map)),this.prosemirrorView.dispatch(this._tr.setMeta(rt,{snapshot:e,prevSnapshot:n}))}unrenderSnapshot(){this.mapping.clear(),this.mux(()=>{const e=this.type.toArray().map(r=>rs(r,this.prosemirrorView.state.schema,this)).filter(r=>r!==null),n=this._tr.replace(0,this.prosemirrorView.state.doc.content.size,new ve(ye.from(e),0,0));n.setMeta(rt,{snapshot:null,prevSnapshot:null}),this.prosemirrorView.dispatch(n)})}_forceRerender(){this.mapping.clear(),this.mux(()=>{const e=this.beforeTransactionSelection!==null?null:this.prosemirrorView.state.selection,n=this.type.toArray().map(o=>rs(o,this.prosemirrorView.state.schema,this)).filter(o=>o!==null),r=this._tr.replace(0,this.prosemirrorView.state.doc.content.size,new ve(ye.from(n),0,0));if(e){const o=Mr(di(e.anchor,0),r.doc.content.size),i=Mr(di(e.head,0),r.doc.content.size);r.setSelection(Pe.create(r.doc,o,i))}this.prosemirrorView.dispatch(r.setMeta(rt,{isChangeOrigin:!0,binding:this}))})}_renderSnapshot(e,n,r){let o=this.doc,i=this.type;if(e||(e=Ee.snapshot(this.doc)),e instanceof Uint8Array||n instanceof Uint8Array)if((!(e instanceof Uint8Array)||!(n instanceof Uint8Array))&&z2(),o=new Ee.Doc({gc:!1}),Ee.applyUpdateV2(o,n),n=Ee.snapshot(o),Ee.applyUpdateV2(o,e),e=Ee.snapshot(o),i._item===null){const s=Array.from(this.doc.share.keys()).find(a=>this.doc.share.get(a)===this.type);i=o.getXmlFragment(s)}else{const s=o.store.clients.get(i._item.id.client)??[],a=Ee.findIndexSS(s,i._item.id.clock);i=s[a].content.type}this.mapping.clear(),this.mux(()=>{o.transact(s=>{const a=r.permanentUserData;a&&a.dss.forEach(d=>{Ee.iterateDeletedStructs(s,d,p=>{})});const l=(d,p)=>{const f=d==="added"?a.getUserByClientId(p.client):a.getUserByDeletedId(p);return{user:f,type:d,color:JM(r.colorMapping,r.colors,f)}},c=Ee.typeListToArraySnapshot(i,new Ee.Snapshot(n.ds,e.sv)).map(d=>!d._item.deleted||Al(d._item,e)||Al(d._item,n)?rs(d,this.prosemirrorView.state.schema,{mapping:new Map,isOMark:new Map},e,n,l):null).filter(d=>d!==null),u=this._tr.replace(0,this.prosemirrorView.state.doc.content.size,new ve(ye.from(c),0,0));this.prosemirrorView.dispatch(u.setMeta(rt,{isChangeOrigin:!0}))},rt)})}_typeChanged(e,n){if(this.prosemirrorView==null)return;const r=rt.getState(this.prosemirrorView.state);if(e.length===0||r.snapshot!=null||r.prevSnapshot!=null){this.renderSnapshot(r.snapshot,r.prevSnapshot);return}this.mux(()=>{const o=(a,l)=>this.mapping.delete(l);Ee.iterateDeletedStructs(n,n.deleteSet,a=>{if(a.constructor===Ee.Item){const l=a.content.type;l&&this.mapping.delete(l)}}),n.changed.forEach(o),n.changedParentTypes.forEach(o);const i=this.type.toArray().map(a=>H2(a,this.prosemirrorView.state.schema,this)).filter(a=>a!==null);let s=this._tr.replace(0,this.prosemirrorView.state.doc.content.size,new ve(ye.from(i),0,0));YM(s,this.beforeTransactionSelection,this),s=s.setMeta(rt,{isChangeOrigin:!0,isUndoRedoOperation:n.origin instanceof Ee.UndoManager}),this.beforeTransactionSelection!==null&&this._isLocalCursorInView()&&s.scrollIntoView(),this.prosemirrorView.dispatch(s)})}_prosemirrorChanged(e){this.doc.transact(()=>{El(this.doc,this.type,e,this),this.beforeTransactionSelection=ap(this,this.prosemirrorView.state)},rt)}initView(e){this.prosemirrorView!=null&&this.destroy(),this.prosemirrorView=e,this.doc.on("beforeAllTransactions",this.beforeAllTransactions),this.doc.on("afterAllTransactions",this.afterAllTransactions),this.type.observeDeep(this._observeFunction)}destroy(){this.prosemirrorView!=null&&(this.prosemirrorView=null,this.type.unobserveDeep(this._observeFunction),this.doc.off("beforeAllTransactions",this.beforeAllTransactions),this.doc.off("afterAllTransactions",this.afterAllTransactions))}}const H2=(t,e,n,r,o,i)=>{const s=n.mapping.get(t);if(s===void 0){if(t instanceof Ee.XmlElement)return rs(t,e,n,r,o,i);throw fM()}return s},rs=(t,e,n,r,o,i)=>{const s=[],a=l=>{if(l instanceof Ee.XmlElement){const c=H2(l,e,n,r,o,i);c!==null&&s.push(c)}else{const c=l._item.right?.content?.type;c instanceof Ee.Text&&!c._item.deleted&&c._item.id.client===c.doc.clientID&&(l.applyDelta([{retain:l.length},...c.toDelta()]),c.doc.transact(d=>{c._item.delete(d)}));const u=QM(l,e,n,r,o,i);u!==null&&u.forEach(d=>{d!==null&&s.push(d)})}};r===void 0||o===void 0?t.toArray().forEach(a):Ee.typeListToArraySnapshot(t,new Ee.Snapshot(o.ds,r.sv)).forEach(a);try{const l=t.getAttributes(r);r!==void 0&&(Al(t._item,r)?Al(t._item,o)||(l.ychange=i?i("added",t._item.id):{type:"added"}):l.ychange=i?i("removed",t._item.id):{type:"removed"});const c=e.node(t.nodeName,l,s);return n.mapping.set(t,c),c}catch{return t.doc.transact(l=>{t._item.delete(l)},rt),n.mapping.delete(t),null}},QM=(t,e,n,r,o,i)=>{const s=[],a=t.toDelta(r,o,i);try{for(let l=0;l<a.length;l++){const c=a[l];s.push(e.text(c.insert,iD(c.attributes,e)))}}catch{return t.doc.transact(l=>{t._item.delete(l)},rt),null}return s},eD=(t,e)=>{const n=new Ee.XmlText,r=t.map(o=>({insert:o.text,attributes:K2(o.marks,e)}));return n.applyDelta(r),e.mapping.set(n,t),n},tD=(t,e)=>{const n=new Ee.XmlElement(t.type.name);for(const r in t.attrs){const o=t.attrs[r];o!==null&&r!=="ychange"&&n.setAttribute(r,o)}return n.insert(0,ac(t).map(r=>lp(r,e))),e.mapping.set(n,t),n},lp=(t,e)=>t instanceof Array?eD(t,e):tD(t,e),_y=t=>typeof t=="object"&&t!==null,Mf=(t,e)=>{const n=Object.keys(t).filter(o=>t[o]!==null);let r=n.length===(e==null?0:Object.keys(e).filter(o=>e[o]!==null).length);for(let o=0;o<n.length&&r;o++){const i=n[o],s=t[i],a=e[i];r=i==="ychange"||s===a||_y(s)&&_y(a)&&Mf(s,a)}return r},ac=t=>{const e=t.content.content,n=[];for(let r=0;r<e.length;r++){const o=e[r];if(o.isText){const i=[];for(let s=e[r];r<e.length&&s.isText;s=e[++r])i.push(s);r--,n.push(i)}else n.push(o)}return n},W2=(t,e)=>{const n=t.toDelta();return n.length===e.length&&n.every((r,o)=>r.insert===e[o].text&&hM(r.attributes||{}).length===e[o].marks.length&&mM(r.attributes,(i,s)=>{const a=G2(s),l=e[o].marks;return Mf(i,l.find(c=>c.type.name===a)?.attrs)}))},Ts=(t,e)=>{if(t instanceof Ee.XmlElement&&!(e instanceof Array)&&cp(t,e)){const n=ac(e);return t._length===n.length&&Mf(t.getAttributes(),e.attrs)&&t.toArray().every((r,o)=>Ts(r,n[o]))}return t instanceof Ee.XmlText&&e instanceof Array&&W2(t,e)},Cl=(t,e)=>t===e||t instanceof Array&&e instanceof Array&&t.length===e.length&&t.every((n,r)=>e[r]===n),Ny=(t,e,n)=>{const r=t.toArray(),o=ac(e),i=o.length,s=r.length,a=Mr(s,i);let l=0,c=0,u=!1;for(;l<a;l++){const d=r[l],p=o[l];if(Cl(n.mapping.get(d),p))u=!0;else if(!Ts(d,p))break}for(;l+c<a;c++){const d=r[s-c-1],p=o[i-c-1];if(Cl(n.mapping.get(d),p))u=!0;else if(!Ts(d,p))break}return{equalityFactor:l+c,foundMappedChild:u}},nD=t=>{let e="",n=t._start;const r={};for(;n!==null;)n.deleted||(n.countable&&n.content instanceof Ee.ContentString?e+=n.content.str:n.content instanceof Ee.ContentFormat&&(r[n.content.key]=null)),n=n.right;return{str:e,nAttrs:r}},rD=(t,e,n)=>{n.mapping.set(t,e);const{nAttrs:r,str:o}=nD(t),i=e.map(c=>({insert:c.text,attributes:Object.assign({},r,K2(c.marks,n))})),{insert:s,remove:a,index:l}=xM(o,i.map(c=>c.insert).join(""));t.delete(l,a),t.insert(l,s),t.applyDelta(i.map(c=>({retain:c.insert.length,attributes:c.attributes})))},oD=/(.*)(--[a-zA-Z0-9+/=]{8})$/,G2=t=>oD.exec(t)?.[1]??t,iD=(t,e)=>{const n=[];for(const r in t)n.push(e.mark(G2(r),t[r]));return n},K2=(t,e)=>{const n={};return t.forEach(r=>{if(r.type.name!=="ychange"){const o=j2(e.isOMark,r.type,()=>!r.type.excludes(r.type));n[o?`${r.type.name}--${WM(r.toJSON())}`:r.type.name]=r.attrs}}),n},El=(t,e,n,r)=>{if(e instanceof Ee.XmlElement&&e.nodeName!==n.type.name)throw new Error("node name mismatch!");if(r.mapping.set(e,n),e instanceof Ee.XmlElement){const d=e.getAttributes(),p=n.attrs;for(const f in p)p[f]!==null?d[f]!==p[f]&&f!=="ychange"&&e.setAttribute(f,p[f]):e.removeAttribute(f);for(const f in d)p[f]===void 0&&e.removeAttribute(f)}const o=ac(n),i=o.length,s=e.toArray(),a=s.length,l=Mr(i,a);let c=0,u=0;for(;c<l;c++){const d=s[c],p=o[c];if(!Cl(r.mapping.get(d),p))if(Ts(d,p))r.mapping.set(d,p);else break}for(;u+c+1<l;u++){const d=s[a-u-1],p=o[i-u-1];if(!Cl(r.mapping.get(d),p))if(Ts(d,p))r.mapping.set(d,p);else break}t.transact(()=>{for(;a-c-u>0&&i-c-u>0;){const p=s[c],f=o[c],h=s[a-u-1],m=o[i-u-1];if(p instanceof Ee.XmlText&&f instanceof Array)W2(p,f)||rD(p,f,r),c+=1;else{let y=p instanceof Ee.XmlElement&&cp(p,f),g=h instanceof Ee.XmlElement&&cp(h,m);if(y&&g){const v=Ny(p,f,r),k=Ny(h,m,r);v.foundMappedChild&&!k.foundMappedChild?g=!1:!v.foundMappedChild&&k.foundMappedChild||v.equalityFactor<k.equalityFactor?y=!1:g=!1}y?(El(t,p,f,r),c+=1):g?(El(t,h,m,r),u+=1):(r.mapping.delete(e.get(c)),e.delete(c,1),e.insert(c,[lp(f,r)]),c+=1)}}const d=a-c-u;if(a===1&&i===0&&s[0]instanceof Ee.XmlText?(r.mapping.delete(s[0]),s[0].delete(0,s[0].length)):d>0&&(e.slice(c,c+d).forEach(p=>r.mapping.delete(p)),e.delete(c,d)),c+u<i){const p=[];for(let f=c;f<i-u;f++)p.push(lp(o[f],r));e.insert(c,p)}},rt)},cp=(t,e)=>!(e instanceof Array)&&t.nodeName===e.type.name;let is=null;const sD=()=>{const t=is;is=null,t.forEach((e,n)=>{const r=n.state.tr,o=rt.getState(n.state);o&&o.binding&&!o.binding.isDestroyed&&(e.forEach((i,s)=>{r.setMeta(s,i)}),n.dispatch(r))})},aD=(t,e,n)=>{is||(is=new Map,Of(0,sD)),j2(is,t,Ha).set(e,n)},Tl=(t,e,n)=>{if(t===0)return Ee.createRelativePositionFromTypeIndex(e,0,-1);let r=e._first===null?null:e._first.content.type;for(;r!==null&&e!==r;){if(r instanceof Ee.XmlText){if(r._length>=t)return Ee.createRelativePositionFromTypeIndex(r,t,-1);if(t-=r._length,r._item!==null&&r._item.next!==null)r=r._item.next.content.type;else{do r=r._item===null?null:r._item.parent,t--;while(r!==e&&r!==null&&r._item!==null&&r._item.next===null);r!==null&&r!==e&&(r=r._item===null?null:r._item.next.content.type)}}else{const o=(n.get(r)||{nodeSize:0}).nodeSize;if(r._first!==null&&t<o)r=r._first.content.type,t--;else{if(t===1&&r._length===0&&o>1)return new Ee.RelativePosition(r._item===null?null:r._item.id,r._item===null?Ee.findRootTypeKey(r):null,null);if(t-=o,r._item!==null&&r._item.next!==null)r=r._item.next.content.type;else{if(t===0)return r=r._item===null?r:r._item.parent,new Ee.RelativePosition(r._item===null?null:r._item.id,r._item===null?Ee.findRootTypeKey(r):null,null);do r=r._item.parent,t--;while(r!==e&&r._item.next===null);r!==e&&(r=r._item.next.content.type)}}}if(r===null)throw z2();if(t===0&&r.constructor!==Ee.XmlText&&r!==e)return lD(r._item.parent,r._item)}return Ee.createRelativePositionFromTypeIndex(e,e._length,-1)},lD=(t,e)=>{let n=null,r=null;return t._item===null?r=Ee.findRootTypeKey(t):n=Ee.createID(t._item.id.client,t._item.id.clock),new Ee.RelativePosition(n,r,e.id)},Zo=(t,e,n,r)=>{const o=Ee.createAbsolutePositionFromRelativePosition(n,t);if(o===null||o.type!==e&&!Ee.isParentOf(e,o.type._item))return null;let i=o.type,s=0;if(i.constructor===Ee.XmlText)s=o.index;else if(i._item===null||!i._item.deleted){let a=i._first,l=0;for(;l<i._length&&l<o.index&&a!==null;){if(!a.deleted){const c=a.content.type;l++,c instanceof Ee.XmlText?s+=c._length:s+=r.get(c).nodeSize}a=a.right}s+=1}for(;i!==e&&i._item!==null;){const a=i._item.parent;if(a._item===null||!a._item.deleted){s+=1;let l=a._first;for(;l!==null;){const c=l.content.type;if(c===i)break;l.deleted||(c instanceof Ee.XmlText?s+=c._length:s+=r.get(c).nodeSize),l=l.right}}i=a}return s-1},cD=(t,e)=>{const n=t.toArray().map(r=>rs(r,e,GM())).filter(r=>r!==null);return ye.fromArray(n)},uD=(t,e)=>e.topNodeType.create(null,cD(t,e));function dD(t,e="prosemirror"){const n=new Ee.Doc,r=n.get(e,Ee.XmlFragment);return r.doc?(pD(t,r),r.doc):n}function pD(t,e){const n=e||new Ee.XmlFragment,r=n.doc?n.doc:{transact:o=>o(void 0)};return El(r,n,t,{mapping:new Map,isOMark:new Map}),n}const fD=(t,e,n)=>t!==e,hD=t=>{const e=document.createElement("span");e.classList.add("ProseMirror-yjs-cursor"),e.setAttribute("style",`border-color: ${t.color}`);const n=document.createElement("div");n.setAttribute("style",`background-color: ${t.color}`),n.insertBefore(document.createTextNode(t.name),null);const r=document.createTextNode(""),o=document.createTextNode("");return e.insertBefore(r,null),e.insertBefore(n,null),e.insertBefore(o,null),e},mD=t=>({style:`background-color: ${t.color}70`,class:"ProseMirror-yjs-selection"}),gD=/^#[0-9a-fA-F]{6}$/,Iy=(t,e,n,r,o)=>{const i=rt.getState(t),s=i.doc,a=[];return i.snapshot!=null||i.prevSnapshot!=null||i.binding.mapping.size===0?De.create(t.doc,[]):(e.getStates().forEach((l,c)=>{if(n(s.clientID,c,l)&&l.cursor!=null){const u=l.user||{};u.color==null?u.color="#ffa500":gD.test(u.color)||console.warn("A user uses an unsupported color format",u),u.name==null&&(u.name=`User: ${c}`);let d=Zo(s,i.type,Ee.createRelativePositionFromJSON(l.cursor.anchor),i.binding.mapping),p=Zo(s,i.type,Ee.createRelativePositionFromJSON(l.cursor.head),i.binding.mapping);if(d!==null&&p!==null){const f=di(t.doc.content.size-1,0);d=Mr(d,f),p=Mr(p,f),a.push(Le.widget(p,()=>r(u,c),{key:c+"",side:10}));const h=Mr(d,p),m=di(d,p);a.push(Le.inline(h,m,o(u,c),{inclusiveEnd:!0,inclusiveStart:!1}))}}}),De.create(t.doc,a))},yD=(t,{awarenessStateFilter:e=fD,cursorBuilder:n=hD,selectionBuilder:r=mD,getSelection:o=s=>s.selection}={},i="cursor")=>new Ue({key:ua,state:{init(s,a){return Iy(a,t,e,n,r)},apply(s,a,l,c){const u=rt.getState(c),d=s.getMeta(ua);return u&&u.isChangeOrigin||d&&d.awarenessUpdated?Iy(c,t,e,n,r):a.map(s.mapping,s.doc)}},props:{decorations:s=>ua.getState(s)},view:s=>{const a=()=>{s.docView&&aD(s,ua,{awarenessUpdated:!0})},l=()=>{const c=rt.getState(s.state),u=t.getLocalState()||{};if(s.hasFocus()){const d=o(s.state),p=Tl(d.anchor,c.type,c.binding.mapping),f=Tl(d.head,c.type,c.binding.mapping);(u.cursor==null||!Ee.compareRelativePositions(Ee.createRelativePositionFromJSON(u.cursor.anchor),p)||!Ee.compareRelativePositions(Ee.createRelativePositionFromJSON(u.cursor.head),f))&&t.setLocalStateField(i,{anchor:p,head:f})}else u.cursor!=null&&Zo(c.doc,c.type,Ee.createRelativePositionFromJSON(u.cursor.anchor),c.binding.mapping)!==null&&t.setLocalStateField(i,null)};return t.on("change",a),s.dom.addEventListener("focusin",l),s.dom.addEventListener("focusout",l),{update:l,destroy:()=>{s.dom.removeEventListener("focusin",l),s.dom.removeEventListener("focusout",l),t.off("change",a),t.setLocalStateField(i,null)}}}}),wD=t=>Dr.getState(t)?.undoManager?.undo()!=null,bD=t=>Dr.getState(t)?.undoManager?.redo()!=null,vD=new Set(["paragraph"]),xD=(t,e)=>!(t instanceof Yr.Item)||!(t.content instanceof Yr.ContentType)||!(t.content.type instanceof Yr.Text||t.content.type instanceof Yr.XmlElement&&e.has(t.content.type.nodeName))||t.content.type._length===0,kD=({protectedNodes:t=vD,trackedOrigins:e=[],undoManager:n=null}={})=>new Ue({key:Dr,state:{init:(r,o)=>{const i=rt.getState(o),s=n||new Yr.UndoManager(i.type,{trackedOrigins:new Set([rt].concat(e)),deleteFilter:a=>xD(a,t),captureTransaction:a=>a.meta.get("addToHistory")!==!1});return{undoManager:s,prevSel:null,hasUndoOps:s.undoStack.length>0,hasRedoOps:s.redoStack.length>0}},apply:(r,o,i,s)=>{const a=rt.getState(s).binding,l=o.undoManager,c=l.undoStack.length>0,u=l.redoStack.length>0;return a?{undoManager:l,prevSel:ap(a,i),hasUndoOps:c,hasRedoOps:u}:c!==o.hasUndoOps||u!==o.hasRedoOps?Object.assign({},o,{hasUndoOps:l.undoStack.length>0,hasRedoOps:l.redoStack.length>0}):o}},view:r=>{const o=rt.getState(r.state),i=Dr.getState(r.state).undoManager;return i.on("stack-item-added",({stackItem:s})=>{const a=o.binding;a&&s.meta.set(a,Dr.getState(r.state).prevSel)}),i.on("stack-item-popped",({stackItem:s})=>{const a=o.binding;a&&(a.beforeTransactionSelection=s.meta.get(a)||a.beforeTransactionSelection)}),{destroy:()=>{i.destroy()}}}});var Wn;class SD{constructor(){$r(this,Wn,new Map)}on(e,n){const r=Xn(this,Wn).get(e);r?r.push(n):Xn(this,Wn).set(e,[n])}emit(e,...n){const r=Xn(this,Wn).get(e);if(r)for(const o of r)o.apply(this,n)}off(e,n){const r=Xn(this,Wn).get(e);r&&(n?Xn(this,Wn).set(e,r.filter(o=>o!==n)):Xn(this,Wn).delete(e))}removeAllListeners(){w1(this,Wn,new Map)}}Wn=new WeakMap;var Ir={8:"Backspace",9:"Tab",10:"Enter",12:"NumLock",13:"Enter",16:"Shift",17:"Control",18:"Alt",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",44:"PrintScreen",45:"Insert",46:"Delete",59:";",61:"=",91:"Meta",92:"Meta",106:"*",107:"+",108:",",109:"-",110:".",111:"/",144:"NumLock",145:"ScrollLock",160:"Shift",161:"Shift",162:"Control",163:"Control",164:"Alt",165:"Alt",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},$l={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},AD=typeof navigator<"u"&&/Mac/.test(navigator.platform),CD=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var Et=0;Et<10;Et++)Ir[48+Et]=Ir[96+Et]=String(Et);for(var Et=1;Et<=24;Et++)Ir[Et+111]="F"+Et;for(var Et=65;Et<=90;Et++)Ir[Et]=String.fromCharCode(Et+32),$l[Et]=String.fromCharCode(Et);for(var Ru in Ir)$l.hasOwnProperty(Ru)||($l[Ru]=Ir[Ru]);function ED(t){var e=AD&&t.metaKey&&t.shiftKey&&!t.ctrlKey&&!t.altKey||CD&&t.shiftKey&&t.key&&t.key.length==1||t.key=="Unidentified",n=!e&&t.key||(t.shiftKey?$l:Ir)[t.keyCode]||t.key||"Unidentified";return n=="Esc"&&(n="Escape"),n=="Del"&&(n="Delete"),n=="Left"&&(n="ArrowLeft"),n=="Up"&&(n="ArrowUp"),n=="Right"&&(n="ArrowRight"),n=="Down"&&(n="ArrowDown"),n}const TD=typeof navigator<"u"&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),$D=typeof navigator<"u"&&/Win/.test(navigator.platform);function OD(t){let e=t.split(/-(?!$)/),n=e[e.length-1];n=="Space"&&(n=" ");let r,o,i,s;for(let a=0;a<e.length-1;a++){let l=e[a];if(/^(cmd|meta|m)$/i.test(l))s=!0;else if(/^a(lt)?$/i.test(l))r=!0;else if(/^(c|ctrl|control)$/i.test(l))o=!0;else if(/^s(hift)?$/i.test(l))i=!0;else if(/^mod$/i.test(l))TD?s=!0:o=!0;else throw new Error("Unrecognized modifier name: "+l)}return r&&(n="Alt-"+n),o&&(n="Ctrl-"+n),s&&(n="Meta-"+n),i&&(n="Shift-"+n),n}function MD(t){let e=Object.create(null);for(let n in t)e[OD(n)]=t[n];return e}function Bu(t,e,n=!0){return e.altKey&&(t="Alt-"+t),e.ctrlKey&&(t="Ctrl-"+t),e.metaKey&&(t="Meta-"+t),n&&e.shiftKey&&(t="Shift-"+t),t}function DD(t){return new Ue({props:{handleKeyDown:Df(t)}})}function Df(t){let e=MD(t);return function(n,r){let o=ED(r),i,s=e[Bu(o,r)];if(s&&s(n.state,n.dispatch,n))return!0;if(o.length==1&&o!=" "){if(r.shiftKey){let a=e[Bu(o,r,!1)];if(a&&a(n.state,n.dispatch,n))return!0}if((r.altKey||r.metaKey||r.ctrlKey)&&!($D&&r.ctrlKey&&r.altKey)&&(i=Ir[r.keyCode])&&i!=o){let a=e[Bu(i,r)];if(a&&a(n.state,n.dispatch,n))return!0}}return!1}}function _D(t,e){return Array.isArray(e)?e.some(n=>(typeof n=="string"?n:n.name)===t.name):e}function ND(t,e){const n=xi.fromSchema(e).serializeFragment(t),r=document.implementation.createHTMLDocument().createElement("div");return r.appendChild(n),r.innerHTML}const ID=(t,e=500)=>{let n="";const r=t.parentOffset;return t.parent.nodesBetween(Math.max(0,r-e),r,(o,i,s,a)=>{const l=o.type.spec.toText?.({node:o,pos:i,parent:s,index:a})||o.textContent||"%leaf%";n+=o.isAtom&&!o.isText?l:l.slice(0,Math.max(0,r-i))}),n},FD=(t,e,n,r)=>{const{converter:o}=e;if(!o||!o.convertedXml)return handleHtmlPaste(t,e,n,r);const i=J2(t),s=document.createElement("div");s.innerHTML=i,s.querySelectorAll("p").forEach(c=>{if(!c.innerHTML.includes("<!--[if !supportLists]"))return;const u=(c.getAttribute("style")||"").match(/mso-list:\s*l(\d+)\s+level(\d+)/);if(u){const[,d,p]=u,f=BD(d,e);if(!f)return;const h=LD(d,e),{lvlText:m,start:y,numFmt:g}=RD(h,p-1);c.setAttribute("data-num-id",f),c.setAttribute("data-list-level",p-1),c.setAttribute("data-start",y),c.setAttribute("data-lvl-text",m),c.setAttribute("data-num-fmt",g)}jD(c)}),PD(s);const a=er.fromSchema(e.schema).parse(s);s.remove();const{dispatch:l}=e.view;return l?(l(n.state.tr.replaceSelectionWith(a,!0)),!0):!1},RD=(t,e)=>{if(!t||!t.elements)return null;const n=t.elements.find(a=>a.name==="w:lvl"&&a.attributes?.["w:ilvl"]==e);if(!n)return null;const{elements:r}=n,o=r.find(a=>a.name==="w:lvlText")?.attributes?.["w:val"],i=r.find(a=>a.name==="w:start")?.attributes?.["w:val"],s=r.find(a=>a.name==="w:numFmt")?.attributes?.["w:val"];return{lvlText:o,start:i,numFmt:s,elements:r}},BD=(t,e)=>{const{definitions:n}=e?.converter?.numbering;return n?Object.values(n).find(r=>r.elements.some(o=>o.name==="w:abstractNumId"&&o.attributes?.["w:val"]==t))?.attributes?.["w:numId"]:null},LD=(t,e)=>{const{abstracts:n={}}=e?.converter?.numbering;return n[t]||null},PD=t=>{const e=Array.from(t.querySelectorAll("p[data-num-id]")),n=new Map,r={};for(const o of e){const i=o.getAttribute("data-num-id"),s=parseInt(o.getAttribute("data-list-level")),a=o.getAttribute("data-num-fmt"),l=o.getAttribute("data-start"),c=o.getAttribute("data-lvl-text");n.has(i)||n.set(i,[]),n.get(i).push({p:o,level:s,numFmt:a,start:l,lvlText:c})}for(const[o,i]of n.entries()){r[o]||(r[o]={stack:[],counts:{},prevLevel:null});const s=[];i.forEach(({p:a,level:l,numFmt:c,start:u,lvlText:d},p)=>{const f=zD(r,o,l),h=document.createElement("li");h.innerHTML=a.innerHTML,h.setAttribute("data-list-level",JSON.stringify(f)),h.setAttribute("data-num-id",o),h.setAttribute("data-lvl-text",d),h.setAttribute("data-num-fmt",c),a.hasAttribute("data-font-family")&&h.setAttribute("data-font-family",a.getAttribute("data-font-family")),a.hasAttribute("data-font-size")&&h.setAttribute("data-font-size",a.getAttribute("data-font-size"));const m=a.parentNode;let y=s[l];if(!y){const g=document.createElement("ol");if(g.setAttribute("data-list-id",o),g.level=l,l>0){const v=s[l-1]?.querySelector("li:last-child");v&&v.appendChild(g)}else m.insertBefore(g,a);s[l]=g,s.length=l+1,y=g}y.appendChild(h),a.remove()})}};function zD(t,e,n){const r=t[e];return r.stack||(r.stack=[]),r.prevLevel===void 0&&(r.prevLevel=null),r.prevLevel===null?r.stack=Array(n).fill(1).concat(1):n>r.prevLevel?r.stack.push(1):n===r.prevLevel?r.stack[r.stack.length-1]++:(r.stack=r.stack.slice(0,n+1),r.stack[n]=(r.stack[n]||1)+1),r.prevLevel=n,[...r.stack]}function jD(t){const e=Array.from(t.childNodes);let n=null,r=null,o=-1,i=-1;if(e.forEach((s,a)=>{s.nodeType===Node.COMMENT_NODE&&s.nodeValue.includes("[if !supportLists]")&&(o=a),o!==-1&&s.nodeType===Node.COMMENT_NODE&&s.nodeValue.includes("[endif]")&&(i=a)}),o!==-1&&i!==-1){for(let s=o+1;s<i;s++){const a=e[s];a.nodeType===Node.ELEMENT_NODE&&a.style&&(n=n||a.style.fontFamily,r=r||a.style.fontSize)}for(let s=i;s>=o;s--)t.removeChild(t.childNodes[s]);n&&t.setAttribute("data-font-family",n),r&&t.setAttribute("data-font-size",r)}}class qD{constructor(e){Re(this,"match"),Re(this,"handler"),this.match=e.match,this.handler=e.handler}}const VD=(t,e)=>{if(Iv(e))return e.exec(t);const n=e(t);if(!n)return null;const r=[n.text];return r.index=n.index,r.input=t,r.data=n.data,n.replaceWith&&(n.text.includes(n.replaceWith)||console.warn('[super-editor warn]: "inputRuleMatch.replaceWith" must be part of "inputRuleMatch.text".'),r.push(n.replaceWith)),r},Lu=t=>{const{editor:e,from:n,to:r,text:o,rules:i,plugin:s}=t,{view:a}=e;if(a.composing)return!1;const l=a.state.doc.resolve(n);if(l.parent.type.spec.code||(l.nodeBefore||l.nodeAfter)?.marks.find(d=>d.type.spec.code))return!1;let c=!1;const u=ID(l)+o;return i.forEach(d=>{if(c)return;const p=VD(u,d.match);if(!p)return;const f=a.state.tr,h=pf(f,a.state),m={from:n-(p[0].length-o.length),to:r},{commands:y,chain:g,can:v}=new _1({editor:e,state:h});d.handler({state:h,range:m,match:p,commands:y,chain:g,can:v})===null||!f.steps.length||(f.setMeta(s,{transform:f,from:n,to:r,text:o}),a.dispatch(f),c=!0)}),c},UD=({editor:t,rules:e})=>{const n=new Ue({key:new Ge("inputRulesPlugin"),state:{init(){return null},apply(r,o,i){const s=r.getMeta(n);if(s)return s;const a=r.getMeta("applyInputRules");return a&&setTimeout(()=>{let{text:l}=a;typeof l!="string"&&(l=ND(ye.from(l),i.schema));const{from:c}=a,u=c+l.length;Lu({editor:t,from:c,to:u,text:l,rules:e,plugin:n})}),r.selectionSet||r.docChanged?null:o}},props:{handleTextInput(r,o,i,s){return Lu({editor:t,from:o,to:i,text:s,rules:e,plugin:n})},handleKeyDown(r,o){if(o.key!=="Enter")return!1;const{$cursor:i}=r.state.selection;return i?Lu({editor:t,from:i.pos,to:i.pos,text:`
|
|
45
|
-
`,rules:e,plugin:n}):!1},handlePaste(r,o,i){const s=o.clipboardData,a=s.getData("text/html");s.getData("text/plain");let l;switch(a?HD(a)?l="word-html":l="browser-html":l="plain-text",l){case"plain-text":break;case"word-html":if(t.options.mode==="docx")return FD(a,t,r,n);case"browser-html":return WD(a,t)}return!1}},isInputRules:!0});return n};function HD(t){return/class=["']?Mso|xmlns:o=["']?urn:schemas-microsoft-com|<!--\[if gte mso|<meta[^>]+name=["']?Generator["']?[^>]+Word/i.test(t)}const WD=(t,e,n)=>{const r=J2(t),o=document.createElement("div");o.innerHTML=r;const i=er.fromSchema(e.schema).parse(o);o.remove();const{dispatch:s}=e.view;return s?(s(e.view.state.tr.replaceSelectionWith(i,!0)),!0):!1},J2=t=>t.replace(/font-size\s*:\s*([\d.]+)em/gi,(e,n)=>{const r=parseFloat(n);return`font-size: ${Math.round(r*12*100)/100}pt`});var Ol,X2,Fy;const GD=class Hi{constructor(e,n,r){$r(this,Ol),Re(this,"editor"),Re(this,"schema"),Re(this,"extensions"),Re(this,"externalExtensions",[]),Re(this,"splittableMarks",[]),this.editor=r,this.externalExtensions=n||[],this.externalExtensions=this.externalExtensions.map(o=>({...o,isExternal:!0})),this.extensions=Hi.getResolvedExtensions([...e,...this.externalExtensions]),this.schema=LT.createSchemaByExtensions(this.extensions,r),Ae(this,Ol,X2).call(this)}static create(...e){return new Hi(...e)}static getResolvedExtensions(e){return Hi.sortByPriority(e)}static sortByPriority(e){return e.sort((n,r)=>{const o=Fe(n,"priority")||100,i=Fe(r,"priority")||100;return o>i?-1:o<i?1:0})}get attributes(){return Te.getAttributesFromExtensions(this.extensions)}get commands(){let e={};for(const n of this.extensions){const r={name:n.name,options:n.options,storage:n.storage,editor:this.editor,type:bs(n.name,this.schema)},o=Fe(n,"addCommands",r);o&&(e={...e,...o()})}return e}get plugins(){const e=this.editor,n=Hi.sortByPriority([...this.extensions].reverse()),r=[],o=n.map(i=>{const s={name:i.name,options:i.options,storage:i.storage,editor:e,type:bs(i.name,this.schema)},a=[],l=Fe(i,"addShortcuts",s);let c={};if(l){const p=Object.entries(l()).map(([f,h])=>[f,(...m)=>h({editor:e,keymapArgs:m})]);c={...Object.fromEntries(p)}}a.push(DD(c));const u=Fe(i,"addInputRules",s);_D(i,e.options.enableInputRules)&&u&&r.push(...u());const d=Fe(i,"addPmPlugins",s);if(d){const p=d();a.push(...p)}return a}).flat();return[UD({editor:e,rules:r}),...o]}get nodeViews(){const{editor:e}=this,n=this.extensions.filter(r=>r.type==="node").filter(r=>!!Fe(r,"addNodeView")).map(r=>{const o=this.attributes.filter(l=>l.type===r.name),i={name:r.name,options:r.options,storage:r.storage,editor:e,type:pt(r.name,this.schema)},s=Fe(r,"addNodeView",i);if(!s)return[];const a=(l,c,u,d)=>{const p=Te.getAttributesToRender(l,o);return s()({editor:e,node:l,getPos:u,decorations:d,htmlAttributes:p,extension:r})};return[r.name,a]});return Object.fromEntries(n)}};Ol=new WeakSet,X2=function(){for(const t of this.extensions){this.editor.extensionStorage[t.name]=t.storage;const e={name:t.name,options:t.options,storage:t.storage,editor:this.editor,type:bs(t.name,this.schema)};t.type==="mark"&&(Ke(Fe(t,"keepOnSplit",e))??!0)&&this.splittableMarks.push(t.name),Ae(this,Ol,Fy).call(this,t)}},Fy=function(t){const e={name:t.name,options:t.options,storage:t.storage,editor:this.editor,type:bs(t.name,this.schema)},n=Fe(t,"onBeforeCreate",e),r=Fe(t,"onCreate",e),o=Fe(t,"onUpdate",e),i=Fe(t,"onSelectionUpdate",e),s=Fe(t,"onTransaction",e),a=Fe(t,"onFocus",e),l=Fe(t,"onBlur",e),c=Fe(t,"onDestroy",e);n&&this.editor.on("beforeCreate",n),r&&this.editor.on("create",r),o&&this.editor.on("update",o),i&&this.editor.on("selectionUpdate",i),s&&this.editor.on("transaction",s),a&&this.editor.on("focus",a),l&&this.editor.on("blur",l),c&&this.editor.on("destroy",c)};let KD=GD;const _f=({tr:t,from:e,to:n,markName:r,attrs:o={},offset:i=1})=>{const{doc:s}=t,a=Math.max(e-i,0),l=Math.min(n+i,s.content.size);let c;return s.nodesBetween(a,l,(u,d)=>{if(!u||u?.nodeSize===void 0)return;const p=u.marks.find(f=>f.type.name===r&&Object.keys(o).every(h=>f.attrs[h]===o[h]));p&&!c&&(c={from:d,to:d+u.nodeSize,mark:p})}),c},Y2=({tr:t,from:e,to:n,user:r,date:o})=>{t.removeMark(e,n,t.doc.type.schema.marks[ut]),t.removeMark(e,n,t.doc.type.schema.marks[It]);let i=_f({tr:t,from:e,to:n,markName:It,attrs:{authorEmail:r.email}}),s;i?s=i.mark.attrs.id:s=Lr();const a=t.doc.type.schema.marks[It].create({id:s,author:r.name,authorEmail:r.email,date:o});return t.addMark(e,n,a),t.doc.nodesBetween(e,n,(l,c)=>{if(c<e||["bulletList","orderedList"].includes(l.type.name))return!0;if(l.isInline||["tableRow","tableCell"].includes(l.type.name)||(l.attrs.track,l.type.name==="table"))return!1}),a},Z2=({tr:t,from:e,to:n,user:r,date:o})=>{let i=_f({tr:t,from:e,to:n,markName:ut,attrs:{authorEmail:r.email}}),s;i?s=i.mark.attrs.id:s=Lr();const a=t.doc.type.schema.marks[ut].create({id:s,author:r.name,authorEmail:r.email,date:o}),l=new ni;let c=[];return t.doc.nodesBetween(e,n,(u,d)=>{if(!u.type.name.includes("table"))if(u.isInline&&u.marks.find(p=>p.type.name===It&&p.attrs.authorEmail===r.email)){const p=new Tt(l.map(Math.max(e,d)),l.map(Math.min(n,d+u.nodeSize)),ve.empty);t.maybeStep(p).failed||l.appendMap(p.getMap())}else u.isInline&&!u.marks.find(p=>p.type.name===ut)?(c.push(u),t.addMark(l.map(Math.max(e,d)),l.map(Math.min(n,d+u.nodeSize)),a)):u.attrs.track&&!u.attrs.track.find(p=>p.type===ut)&&["bulletList","orderedList"].includes(u.type.name)}),{deletionMark:a,deletionMap:l,nodes:c}},JD=(t,e,n)=>{const r=t.resolve(e),o=r.parent,i=o.childAfter(r.parentOffset);if(!i.node)return null;const s=i.node.marks.find(d=>d.type.name===n);let a=r.index(),l=r.start()+i.offset;for(;a>0&&s.isInSet(o.child(a-1).marks);)l-=o.child(--a).nodeSize;let c=r.index()+1,u=r.start()+i.offset+i.node.nodeSize;for(;c<o.childCount&&s.isInSet(o.child(c).marks);)u+=o.child(c++).nodeSize;return{from:l,to:u,attrs:s.attrs}},Q2=(t,e=!0)=>{if(!t)throw new Error('Invalid "node" parameter');const n=[];return t.descendants((r,o)=>{if(n.push({node:r,pos:o}),!e)return!1}),n},ex=(t,e,n)=>{if(t){if(!e)throw new Error('Invalid "predicate" parameter')}else throw new Error('Invalid "node" parameter');return Q2(t,n).filter(r=>e(r.node))},tx=(t,e)=>ex(t,n=>n.isInline,e),XD=Object.freeze(Object.defineProperty({__proto__:null,findChildren:ex,findInlineNodes:tx,findMarkPosition:JD,flatten:Q2},Symbol.toStringTag,{value:"Module"})),Nf=(t,e=null)=>{const n=[],r=tx(t.doc);return r.length?(r.forEach(({node:o,pos:i})=>{const{marks:s}=o,a=[It,ut,vt];s.length>0&&s.forEach(l=>{a.includes(l.type.name)&&n.push({mark:l,from:i,to:i+o.nodeSize})})}),e?n.filter(({mark:o})=>o.attrs.id===e):n):n},gt=new Ge("TrackChangesBase"),YD=(t={})=>new Ue({key:gt,state:{init(e,n){return{isTrackChangesActive:!1,onlyOriginalShown:!1,onlyModifiedShown:!1,decorations:Do(n,!1,!1)}},apply(e,n,r,o){const i=e.getMeta(gt);return i?i.type==="TRACK_CHANGES_ENABLE"?{...n,isTrackChangesActive:i.value===!0,decorations:Do(o,n.onlyOriginalShown,n.onlyModifiedShown)}:i.type==="SHOW_ONLY_ORIGINAL"?{...n,onlyOriginalShown:i.value===!0,onlyModifiedShown:!1,decorations:Do(o,i.value===!0,!1)}:i.type==="SHOW_ONLY_MODIFIED"?{...n,onlyOriginalShown:!1,onlyModifiedShown:i.value===!0,decorations:Do(o,!1,i.value===!0)}:{...n,decorations:Do(o,n.onlyOriginalShown,n.onlyModifiedShown)}:{...n,decorations:Do(o,n.onlyOriginalShown,n.onlyModifiedShown)}}},props:{decorations(e){return this.getState(e)?.decorations}}}),Do=(t,e,n)=>{if(!t.doc||!t.doc.nodeSize||n&&e)return De.empty;const r=[],o=Nf(t);return o.length?(o.forEach(({mark:i,from:s,to:a})=>{if(i.type.name===It)if(e){const l=Le.inline(s,a,{class:"track-insert-dec hidden"});r.push(l)}else if(n){const l=Le.inline(s,a,{class:"track-insert-dec normal"});r.push(l)}else{const l=Le.inline(s,a,{class:"track-insert-dec highlighted"});r.push(l)}if(i.type.name===ut)if(e){const l=Le.inline(s,a,{class:"track-delete-dec normal"});r.push(l)}else if(n){const l=Le.inline(s,a,{class:"track-delete-dec hidden"});r.push(l)}else{const l=Le.inline(s,a,{class:"track-delete-dec highlighted"});r.push(l);const c=Le.widget(s,()=>{const u=document.createElement("span");return u.classList.add("track-delete-widget"),u.contentEditable=!1,u},{ignoreSelection:!0});r.push(c)}if(i.type.name===vt)if(e){const l=Le.inline(s,a,{class:"track-format-dec before"});r.push(l)}else if(n){const l=Le.inline(s,a,{class:"track-format-dec normal"});r.push(l)}else{const l=Le.inline(s,a,{class:"track-format-dec highlighted"});r.push(l)}}),De.create(t.doc,r)):De.empty},an="commentMark",Ry=({commentId:t,state:e,tr:n,dispatch:r})=>{ZD(t,e.doc).forEach(({from:o,to:i})=>{n.removeMark(o,i,e.schema.marks[an])}),r(n)},ZD=(t,e)=>{const n=[];return e.descendants((r,o)=>{const{marks:i}=r,s=i.find(a=>a.type.name===an);if(s){const{attrs:a}=s,{commentId:l}=a;t===l&&n.push({from:o,to:o+r.nodeSize})}}),n},QD=(t,e,n,r=[])=>{const o=[],i=[],s=new Set;return t.descendants((a,l)=>{(a.marks?.filter(c=>c.type.name===an)).forEach(c=>{if(c){const{attrs:u={}}=c,{commentId:d}=u;if(d==="pending"||s.has(d))return;s.add(d);const p=By(c.attrs),f=n.nodes.commentRangeStart.create(p);o.push({pos:l,node:f});const h=n.nodes.commentRangeEnd.create(p);i.push({pos:l+a.nodeSize,node:h});const m=d;m&&r.filter(y=>y.parentCommentId===m).sort((y,g)=>y.createdTime-g.createdTime).forEach(y=>{const g=By(y),v=n.nodes.commentRangeStart.create(g);s.add(y.commentId),o.push({pos:l,node:v});const k=n.nodes.commentRangeEnd.create(g);i.push({pos:l+a.nodeSize,node:k})})}})}),o.forEach(a=>{const{pos:l,node:c}=a,u=e.mapping.map(l);e.insert(u,c)}),i.forEach(a=>{const{pos:l,node:c}=a,u=e.mapping.map(l);e.insert(u,c)}),e},By=t=>{const{commentId:e,internal:n}=t;return{"w:id":e,internal:n}},e_=(t,e,n,r)=>{const o=[],i=[];t.descendants((s,a)=>{const{type:l}=s;if(!["commentRangeStart","commentRangeEnd","commentReference"].includes(l.name))return;const c=r.comments?.find(d=>d.importedId==s.attrs["w:id"])||{},{commentId:u}=c;if(u)if(l.name==="commentRangeStart")o.push({"w:id":u,importedId:s.attrs["w:id"],internal:!1,start:a}),i.push({start:a,end:a+1});else if(l.name==="commentRangeEnd"){const d=o.find(h=>h.importedId===s.attrs["w:id"]);if(!d)return;const{start:p}=d,f={commentId:u,importedId:s.attrs["w:id"],internal:d.internal};e.addMark(p,a+1,n.marks[an].create(f)),i.push({start:a,end:a+1})}else l.name==="commentReference"&&i.push({start:a,end:a+1})}),i.sort((s,a)=>a.start-s.start).forEach(({start:s,end:a})=>{e.delete(s,a)})},t_=(t={})=>{const{before:e=[],after:n=[]}=t,r=new Set(e.map(h=>h.type)),o=new Set(n.map(h=>h.type)),i=[...o].filter(h=>!r.has(h)),s=[...r].filter(h=>!o.has(h)),a=[],l=i.filter(h=>!["textStyle","commentMark"].includes(h));l.length&&a.push(`Added formatting: ${l.join(", ")}`);const c=s.filter(h=>!["textStyle","commentMark"].includes(h));c.length&&a.push(`Removed formatting: ${c.join(", ")}`);const u=e.find(h=>h.type==="textStyle")?.attrs||{},d=n.find(h=>h.type==="textStyle")?.attrs||{},p=[],f=h=>h.replace(/([a-z])([A-Z])/g,"$1 $2").toLowerCase();return Object.keys({...u,...d}).forEach(h=>{const m=u[h],y=d[h];if(m!==y){if(y===null)return;if(h==="color")p.push("Changed color");else{const g=f(h);m==null?p.push(`Set ${g} to ${y}`):p.push(`Changed ${g} from ${m} to ${y}`)}}}),p.length&&a.push(`Modified text style: ${p.join(", ")}`),a.length?a.join(". "):"No formatting changes."},n_=({activeThreadId:t,threadId:e,isInternal:n,editor:r})=>{if(!r.options.isInternal&&n)return"transparent";const o=bt.getState(r.state),i=n?o.internalColor:o.externalColor,s=t==e?"44":"22";return`${i}${s}`},_r=new Ge("paginationPlugin"),r_=async t=>{if(!t.converter)return;const e={headers:{},footers:{}},n=t.converter.headerIds.ids,r=t.converter.footerIds.ids;for(let o in n){const i=n[o];if(!i)continue;const s=t.converter.headers[i];e.headers[i]||(e.headers[i]={}),e.headers[i].data=s;const{height:a,sectionEditor:l,sectionContainer:c}=await Ly(t,s);e.headers[i].height=a,e.headers[i].sectionEditor=l,e.headers[i].sectionContainer=c}for(let o in r){const i=r[o];if(!i)continue;const s=t.converter.footers[i];e.headers[i]||(e.footers[i]={}),e.footers[i].data=s;const{height:a,sectionEditor:l,sectionContainer:c}=await Ly(t,s);e.footers[i].height=a,e.footers[i].sectionEditor=l,e.footers[i].sectionContainer=c}return e},Ly=async(t,e)=>e?new Promise(n=>{const r=document.createElement("div");r.className="super-editor",r.style.padding="0",r.style.margin="0";const o=lc({editor:t,data:e,editorContainer:r});o.on("create",()=>{o.setEditable(!1,!1),requestAnimationFrame(()=>{const i=r.offsetHeight;document.body.removeChild(r),n({height:i,sectionEditor:o,sectionContainer:r})})})}):{},lc=({editor:t,data:e,editorContainer:n,appendToBody:r=!0,sectionId:o,type:i,availableHeight:s})=>{const a=t.converter.getDocumentDefaultStyles(),{fontSizePt:l,typeface:c}=a,u=l*1.3333,d=u*1.2;Object.assign(n.style,{padding:"0",margin:"0",border:"none",boxSizing:"border-box",position:"absolute",top:"0",left:"0",width:"auto",maxWidth:"none",fontFamily:c,fontSize:`${u}px`,lineHeight:`${d}px`}),Object.assign(n.style,{padding:"0",margin:"0",border:"none",boxSizing:"border-box",height:s+"px",overflow:"hidden"}),r&&document.body.appendChild(n);const p=new $s({loadFromSchema:!0,mode:"docx",element:n,content:e,extensions:Gf(),documentId:o||"sectionId",media:t.options.media,mediaFiles:t.options.mediaFiles,fonts:t.options.fonts,isHeaderOrFooter:!0,annotations:!0,onCreate:h=>o_(h,t),onBlur:h=>rx(h,t,o,i)}),f=n.querySelector(".ProseMirror");return f.style.maxHeight="100%",f.style.minHeight="100%",f.style.overflow="auto",f.style.outline="none",f.style.border="none",p},nx=(t,e)=>{["fieldAnnotationDropped","fieldAnnotationPaste","fieldAnnotationSelected","fieldAnnotationClicked","fieldAnnotationDoubleClicked","fieldAnnotationDeleted"].forEach(n=>{e.on(n,(...r)=>{t.emit(n,...r),console.debug("broadcastEditorEvents",{eventName:n,args:r})})})},Ml=(t,e,n)=>{t.converter.headerEditors.forEach(r=>{r.editor.setEditable(n,!1)}),t.converter.footerEditors.forEach(r=>{r.editor.setEditable(n,!1)}),n&&document.querySelector(".ProseMirror").classList.add("header-footer-edit"),e&&e.view.focus()},rx=async({editor:t,transaction:e},n,r,o)=>{if(!o||!r)return;const i=t.getUpdatedJson();n.converter[`${o}Editors`].forEach(s=>{s.id===r&&(s.editor.setOptions({media:t.options.media,mediaFiles:t.options.mediaFiles}),s.editor.replaceContent(i)),s.editor.setOptions({lastSelection:e?.selection})}),n.converter[`${o}s`][r]=i,await i_(n)},o_=({editor:t},e)=>{t.setToolbar(e.toolbar)},i_=async t=>{if(!t.options.ydoc)return;const e=t.options.ydoc.getMap("meta"),n=[...e.get("docx")],r=await t.exportDocx({getUpdatedDocs:!0});Object.keys(r).forEach(o=>{if(o.includes("header")||o.includes("footer")){const i=n.findIndex(s=>s.name===o);if(i===-1)return;n.splice(i,1),n.push({name:o,content:r[o]})}}),t.options.ydoc.transact(()=>{e.set("docx",n)})},If=[It,ut,vt],bt=new Ge("comments"),s_=Ye.create({name:"comments",addCommands(){return{insertComment:t=>({tr:e,dispatch:n,state:r})=>{const{selection:o}=e,{$from:i,$to:s}=o,{commentId:a,isInternal:l}=t;return e.setMeta(bt,{event:"add"}),e.addMark(i.pos,s.pos,this.editor.schema.marks[an].create({commentId:a,internal:l})),n(e),!0},removeComment:({commentId:t,importedId:e})=>({tr:n,dispatch:r,state:o})=>{n.setMeta(bt,{event:"deleted"}),Ry({commentId:t,state:o,tr:n,dispatch:r})},setActiveComment:({commentId:t})=>({tr:e,dispatch:n})=>{let r=t;return e.setMeta(bt,{type:"setActiveComment",activeThreadId:r}),!0},setCommentInternal:({commentId:t,isInternal:e})=>({tr:n,dispatch:r,state:o})=>{const{doc:i}=o;let s,a;return n.setMeta(bt,{event:"update"}),i.descendants((l,c)=>{if(s)return;const{marks:u=[]}=l,d=u.find(p=>p.type.name===an);if(d){const{attrs:p}=d;p.commentId===t&&(s=l,a=c)}}),s?(n.addMark(a,a+s.nodeSize,this.editor.schema.marks[an].create({commentId:t,internal:e})),n.setMeta(bt,{type:"setCommentInternal"}),r(n),!0):!1},resolveComment:({commentId:t})=>({tr:e,dispatch:n,state:r})=>{e.setMeta(bt,{event:"update"}),Ry({commentId:t,state:r,tr:e,dispatch:n})}}},addPmPlugins(){const t=this.editor;let e,n;return t.options.isHeadless?[]:[new Ue({key:bt,state:{init(){return{activeThreadId:null,externalColor:"#B1124B",internalColor:"#078383",decorations:De.empty,allCommentPositions:{},allCommentIds:[],changedActiveThread:!1,trackedChanges:{}}},apply(r,o,i,s){const a=r.getMeta(_r)?.isReadyToInit;a&&(e=!0);const l=r.getMeta(bt),{type:c}=l||{};if(c==="force"&&(e=!0),!a&&!e&&l&&l.decorations)return{...o,decorations:l.decorations,allCommentPositions:l.allCommentPositions};const u=r.getMeta(gt),d=o.trackedChanges;u&&(o.trackedChanges=l_(u,d,s,t));const p=l?.type==="setActiveComment";if(!r.docChanged&&r.selectionSet||p){const{selection:f}=r;let h=a_(s.doc,f);if(p&&(h=l.activeThreadId),n!==h){n=h;const m={type:qa.SELECTED,activeCommentId:n||null};e=!0,t.emit("commentsUpdate",m);const{tr:y}=t.view.state,{dispatch:g}=t.view;y.setMeta(bt,{type:"force"}),g(y)}}return o}},props:{decorations(r){return this.getState(r).decorations}},view(r){let o;return{update(i,s){const{state:a}=i,{doc:l,tr:c}=a;if(o&&!o.eq(l)&&(e=!0),!e)return;o=l,e=!1;const u=[],d={};l.descendants((f,h)=>{const{marks:m=[]}=f,y=m.filter(k=>k.type.name===an);let g=!1;y.forEach(k=>{const{attrs:b}=k,C=b.commentId||b.importedId,D=i.coordsAtPos(h);Py({allCommentPositions:d,threadId:C,pos:h,currentBounds:D,node:f});const M=b.internal;g||(g=n===C);let I=n_({activeThreadId:n,threadId:C,isInternal:M,editor:t});const E=Le.inline(h,h+f.nodeSize,{style:`background-color: ${I};`,"data-thread-id":C,class:"sd-editor-comment-highlight"});g&&n!==C||u.push(E)});const v=ox({doc:l,from:h,to:h+f.nodeSize});if(v){const k=i.coordsAtPos(h),{id:b}=v.mark.attrs;Py({allCommentPositions:d,threadId:b,pos:h,currentBounds:k,node:f})}});const p=De.create(l,u);if(!bt.getState(a).decorations.eq(p)){const f=a.tr.setMeta(bt,{decorations:p,allCommentPositions:d});i.dispatch(f)}t.emit("comment-positions",{allCommentPositions:d})}}}})]}}),Py=({allCommentPositions:t,threadId:e,pos:n,currentBounds:r,node:o})=>{let i={};if(r instanceof DOMRect?i={top:r.top,bottom:r.bottom,left:r.left,right:r.right}:i={...r},!t[e])t[e]={threadId:e,start:n,end:n+o.nodeSize,bounds:i};else{const s=t[e];s.start=Math.min(s.start,n),s.end=Math.max(s.end,n+o.nodeSize),s.bounds.top=Math.min(s.bounds.top,r.top),s.bounds.bottom=Math.max(s.bounds.bottom,r.bottom)}},a_=(t,e)=>{if(!e)return;const{$from:n,$to:r}=e;if(n.pos!==r.pos||!t.nodeAt(n.pos))return;const o=ox({doc:t,from:n.pos,to:r.pos});if(o)return o.mark.attrs.id;const i=[];let s=!1;t.descendants((d,p)=>{if(s)return;const f=p+d.nodeSize;if(n.pos<p||n.pos>=f)return;const{marks:h=[]}=d;h.find(m=>m.type.name===an)&&i.push({node:d,pos:p,size:d.nodeSize}),p>n.pos&&(s=!0)});let a=null,l=null;i.forEach(({pos:d,node:p})=>{a||(a=n.pos-d);const f=n.pos-d;f>=0&&f<=a&&(l=p,a=f)});const{marks:c=[]}=l||{},u=c.find(d=>d.type.name===an);return u?.attrs?.commentId||u?.attrs?.importedId},ox=({doc:t,from:e,to:n,offset:r=1})=>{const o=Math.max(e-r,0),i=Math.min(n+r,t.content.size);let s;return t.nodesBetween(o,i,(a,l)=>{if(!a||a?.nodeSize===void 0)return;const c=a.marks.find(u=>If.includes(u.type.name));c&&!s&&(s={from:l,to:l+a.nodeSize,mark:c})}),s},l_=(t,e,n,r)=>{const{insertedMark:o,deletionMark:i,formatMark:s,deletionNodes:a}=t;if(!o&&!i&&!s)return;const l={...e};let c=o?.attrs?.id||i?.attrs?.id||s?.attrs?.id;if(!c)return e;let u=!1;l[c]||(l[c]={},u=!0),o&&(l[c].insertion=c),i&&(l[c].deletion=i.attrs?.id),s&&(l[c].format=s.attrs?.id);const{step:d}=t;let p=d?.slice?.content?.content||[];p.length||n.doc.descendants((h,m)=>{if(h.marks.find(y=>y.type.name===vt))return p=[h],!1});const f=u_({documentId:r.options.documentId,event:u?"add":"update",marks:{insertedMark:o,deletionMark:i,formatMark:s},deletionNodes:a,nodes:p,newEditorState:n});return f&&r.emit("commentsUpdate",f),l},c_=({state:t,node:e,mark:n,marks:r,trackedChangeType:o,isDeletionInsertion:i,deletionNodes:s=[]})=>{let a="",l="";if(o===It&&(a=e?.text??""),o===vt&&(a=t_(n.attrs)),(o===ut||i)&&(l=e?.text??"",i)){let{id:c}=r.deletionMark.attrs;l=d_(t.doc,u=>{const{marks:d=[]}=u,p=d.filter(f=>If.includes(f.type.name));if(!p.length)return!1;if(p.find(f=>f.attrs.id===c))return!0})?.node.text??""}return{deletionText:l,trackedChangeText:a}},u_=({event:t,marks:e,deletionNodes:n,nodes:r,newEditorState:o,documentId:i})=>{const s=e.insertedMark||e.deletionMark||e.formatMark,{type:a,attrs:l}=s,{name:c}=a,{author:u,authorEmail:d,date:p}=l,f=l.id,h=r[0],m=!!(e.insertedMark&&e.deletionMark);let y;o.doc.descendants((b,C)=>{const{marks:D=[]}=b,M=D.filter(I=>If.includes(I.type.name));if(M.length&&(M.find(I=>I.attrs.id===f)&&(y=b),y))return!1});const{deletionText:g,trackedChangeText:v}=c_({state:o,node:y||h,mark:s,marks:e,trackedChangeType:c,isDeletionInsertion:m,deletionNodes:n});if(!g&&!v)return;const k={event:qa.ADD,type:"trackedChange",documentId:i,changeId:f,trackedChangeType:m?"both":c,trackedChangeText:v,deletedText:e.deletionMark?g:null,author:u,authorEmail:d,date:p};return t==="add"?k.event=qa.ADD:t==="update"&&(k.event=qa.UPDATE),k};function d_(t,e){let n=null;return t.descendants((r,o)=>{if(e(r)&&(n={node:r,pos:o}),n)return!1}),n}const ix=({state:t,tr:e,step:n,newTr:r,map:o,doc:i,user:s,date:a,originalStep:l,originalStepIndex:c})=>{const u=t.schema.marks[ut],d=nc(t,u,!1),p=d?d.to:n.to,f=new Tt(p,p,n.slice,n.structure),h=l.invert(e.docs[c]).map(o);o.appendMap(h.getMap());const m={};if(f){const y=t.apply(r).tr;if(y.maybeStep(f).failed)return;const g=f.getMap().map(f.to),v=Y2({tr:y,from:f.from,to:g,user:s,date:a}),k=new Tt(f.from,f.to,y.doc.slice(f.from,g));r.step(k);const b=o.maps.length-1;o.appendMap(k.getMap(),b),f.from!==g&&(m.insertedMark=v,m.step=k),r.selection.eq(y.selection)||r.setSelection(y.selection)}if(n.from!==n.to){const{deletionMark:y,deletionMap:g,nodes:v}=Z2({tr:r,from:n.from,to:n.to,user:s,date:a});m.deletionNodes=v,m.deletionMark=y,o.appendMapping(g)}r.setMeta(gt,m),r.setMeta(bt,{type:"force"})},p_=()=>{},f_=()=>{},sx=({state:t,tr:e,step:n,newTr:r,map:o,doc:i,user:s,date:a})=>{const l={};i.nodesBetween(n.from,n.to,(c,u)=>{if(!c.isInline)return;if(c.marks.find(f=>f.type.name===ut))return!1;const d=c.marks.find(f=>[ut,vt].includes(f.type.name)),p=d?d.attrs.id:Lr();if(r.addMark(Math.max(n.from,u),Math.min(n.to,u+c.nodeSize),n.mark),["bold","italic","strike","underline","textStyle"].includes(n.mark.type.name)&&!c.marks.find(f=>f.type===n.mark.type)){const f=c.marks.find(y=>y.type.name===vt);let h=[],m=[];if(f?f.attrs.before.find(y=>y.type==="textStyle"?y.type===n.mark.type.name&&oi(y.attrs,n.mark.attrs):y.type===n.mark.type.name)?(m=[...f.attrs.before.filter(y=>y.type!==n.mark.type.name)],h=[...f.attrs.after]):(m=[...f.attrs.before],h=[...f.attrs.after,{type:n.mark.type.name,attrs:{...n.mark.attrs}}]):(m=c.marks.map(y=>({type:y.type.name,attrs:{...y.attrs}})),h=[{type:n.mark.type.name,attrs:{...n.mark.attrs}}]),h.length||m.length){const y=t.schema.marks[vt].create({id:p,author:s.name,authorEmail:s.email,date:a,before:m,after:h});r.addMark(n.from,n.to,y),l.formatMark=y,l.step=n,r.setMeta(gt,l),r.setMeta(bt,{type:"force"})}else f&&r.removeMark(Math.max(n.from,u),Math.min(n.to,u+c.nodeSize),f)}})},ax=({state:t,tr:e,step:n,newTr:r,map:o,doc:i,user:s,date:a})=>{const l={};i.nodesBetween(n.from,n.to,(c,u)=>{if(!c.isInline)return!0;if(c.marks.find(d=>d.type.name===ut))return!1;if(r.removeMark(Math.max(n.from,u),Math.min(n.to,u+c.nodeSize),n.mark),["bold","italic","strike","underline","textStyle"].includes(n.mark.type.name)&&c.marks.find(d=>d.type===n.mark.type)){const d=c.marks.find(h=>h.type.name===vt);let p=[],f=[];if(d?d.attrs.after.find(h=>h.type===n.mark.type.name)?(p=[...d.attrs.after.filter(h=>h.type!==n.mark.type.name)],f=[...d.attrs.before]):(p=[...d.attrs.after],f=[...d.attrs.before,{type:n.mark.type.name,attrs:{...n.mark.attrs}}]):(p=[],f=[{type:n.mark.type.name,attrs:{...n.mark.attrs}}]),p.length||f.length){const h=t.schema.marks[vt].create({id:Lr(),author:s.name,authorEmail:s.email,date:a,before:f,after:p});r.addMark(Math.max(n.from,u),Math.min(n.to,u+c.nodeSize),h),l.formatMark=h,l.step=n,r.setMeta(gt,l),r.setMeta(bt,{type:"force"})}else d&&r.removeMark(Math.max(n.from,u),Math.min(n.to,u+c.nodeSize),d)}})},lx=({tr:t,state:e,user:n})=>{const r=["inputType","uiEvent","paste","pointer"],o=["historyUndo","historyRedo","acceptReject"];if(!t.steps.length||t.meta&&!Object.keys(t.meta).every(c=>r.includes(c))||o.includes(t.getMeta("inputType"))||t.getMeta(bt))return t;const i=e.tr,s=new ni,a=Math.floor(Date.now()/6e5)*6e5,l=new Date(a).toISOString();if(t.steps.forEach((c,u)=>{const d=c.map(s),{doc:p}=i;d&&(d instanceof Tt?(ix({state:e,tr:t,step:d,newTr:i,map:s,doc:p,user:n,date:l,originalStep:c,originalStepIndex:u}),console.debug("[track-changes]: replaceStep")):d instanceof Vs?(sx({state:e,tr:t,step:d,newTr:i,map:s,doc:p,user:n,date:l}),console.debug("[track-changes]: addMarkStep")):d instanceof vn?(ax({state:e,tr:t,step:d,newTr:i,map:s,doc:p,user:n,date:l}),console.debug("[track-changes]: removeMarkStep")):(i.step(d),console.log("[track-changes]: otherStep")))}),t.getMeta("inputType")&&i.setMeta(t.getMeta("inputType")),t.getMeta("uiEvent")&&i.setMeta(t.getMeta("uiEvent")),t.selectionSet){const c=e.schema.marks[ut],u=nc(e,c,!1);if(t.selection instanceof Pe&&(t.selection.from<e.selection.from||t.getMeta("inputType")==="deleteContentBackward")){const d=s.map(t.selection.from,-1);i.setSelection(new Pe(i.doc.resolve(d)))}else if(t.selection.from>e.selection.from&&u){const d=s.map(u.to+1,1);i.setSelection(new Pe(i.doc.resolve(d)))}else i.setSelection(t.selection.map(i.doc,s))}else if(e.selection.from-t.selection.from>1&&t.selection.$head.depth>1){const c=s.map(t.selection.from-2,-1);i.setSelection(new Pe(i.doc.resolve(c)))}return t.storedMarksSet&&i.setStoredMarks(t.storedMarks),t.scrolledIntoView&&i.scrollIntoView(),i},h_=t=>{const{state:e}=t,{dispatch:n}=t.view,{tr:r}=e;if(n)return e.doc.descendants((o,i)=>{if(o.type.name==="paragraph"){const{attrs:s}=o,{spacing:a}=s;if(!a)return;const l={line:Jo(at(a.line)),lineSpaceBefore:Jo(at(a.lineSpaceBefore)),lineSpaceAfter:Jo(at(a.lineSpaceAfter))};r.setNodeMarkup(i,void 0,{...s,spacing:{...a,...l}})}}),n(r),!0},m_={initial:h_},zy=t=>{if(t==="initial"||t==="0.4.14")return Object.values(m_)},Ff=(t,e,n)=>{const{type:r}=t.attrs,o={html:g_,text:y_,checkbox:b_,image:w_,link:x_,yesno:k_,date:v_}[r];return o?o(e,n):{}},g_=t=>({rawHtml:t}),y_=t=>({displayLabel:t}),w_=t=>({imageSrc:t}),b_=t=>({displayLabel:t}),v_=(t,e)=>({displayLabel:E_(t,e.input_format)}),x_=t=>(t.startsWith("http")||(t=`http://${t}`),{linkUrl:t}),k_=t=>({displayLabel:{YES:"Yes",NO:"No"}[t[0].toUpperCase()]}),S_=({editor:t,tr:e,annotationValues:n})=>{const{state:r}=t,{doc:o}=r,i=[];return o.descendants((s,a)=>{s.type.name==="table"&&i.push({node:s,pos:a})}),i.reverse().forEach(({pos:s})=>{const a=e.doc.nodeAt(s);!a||a.type.name!=="table"||A_({tableNode:{node:a,pos:s},annotationValues:n,tr:e,editor:t})}),e},A_=({tableNode:t,annotationValues:e,tr:n,editor:r})=>{let o=null,i=null;const{tableRow:s,tableCell:a,fieldAnnotation:l,paragraph:c}=r.schema.nodes;if(t.node.descendants((v,k)=>{if(o)return!0;if(v.type===s&&(i={node:v,pos:k}),v.type===l){const b=Pu(v.attrs.fieldId,e);Array.isArray(b)&&v.attrs.generatorIndex===null&&(o=i)}}),!o)return;const{node:u,pos:d}=o,p=n.mapping.map(t.pos+d),f=p+u.nodeSize;let h=0;if(u.descendants((v,k)=>{if(v.type===l){const b=Pu(v.attrs.fieldId,e);Array.isArray(b)&&(h=Math.max(h,b.length))}}),h<=1)return;const m=(v,k)=>{const b=v.content.content.map(C=>{if(C.type!==c)return C;const D=C.content.content.map(M=>{if(M.type!==l)return M;let I=Pu(M.attrs.fieldId,e);Array.isArray(I)||(I=[I]);const E=I?.[k],G=Ff(M,E);return l.create({...M.attrs,...G,generatorIndex:k},M.content,M.marks)});return c.create(C.attrs,ye.from(D),C.marks)});return a.create(v.attrs,ye.from(b),v.marks)};for(let v=h-1;v>=0;v--){const k=n.mapping.map(f)+1,b=u.content.content.map(D=>m(D,v)),C=s.create(u.attrs,ye.from(b),u.marks);n.insert(k,ye.from(C))}const y=n.mapping.map(p),g=y+u.nodeSize;n.delete(y-1,g+1)},Pu=(t,e)=>e.find(n=>n.input_id===t)?.input_value||null,cx=({editor:t,annotationValues:e=[],hiddenFieldIds:n=[]})=>{const r={header:t.converter.headers||{},footer:t.converter.footers||{}};Object.entries(r).forEach(([o,i])=>{const s=`${o}Editors`;Object.entries(i).forEach(([a,l])=>{let c=t.converter[s][a];c||(c={id:a,editor:lc({editor:t,data:l,editorContainer:document.createElement("div"),appendToBody:!1,sectionId:a,type:o})},t.converter[s].push(c)),c.editor.annotate(e,n),rx({editor:c.editor},t,a,o)})})},C_=({annotationValues:t=[],hiddenFieldIds:e=[],schema:n,tr:r,editor:o})=>{cx({editor:o,annotationValues:t,hiddenFieldIds:e});const i=[],s=n.nodes.fieldAnnotation;r.doc.descendants((l,c)=>{l.type===s&&i.push({node:l,pos:c,size:l.nodeSize})});const a=new Set;if(e.length)for(const{node:l,pos:c}of i)e.includes(l.attrs.fieldId)&&a.add(c);for(const{node:l,pos:c}of i){const{type:u,fieldType:d,fieldId:p}=l.attrs;if(a.has(c))continue;let f=null;const h=t.find(m=>m.input_id===p);if(!h){const m=t.filter(y=>y.input_field_type==="CHECKBOXINPUT");e:for(const y of m)for(const g of y.input_options)if(g.itemid===p){f=y.input_link_value[g.itemid]||" ";break e}}if(f=f||h?.input_value||null,!(Array.isArray(f)&&l.attrs.generatorIndex!=null))if((u==="checkbox"||d==="CHECKBOXINPUT")&&(!f||typeof f=="string"&&f.codePointAt(0)===9744)&&(f=" "),!f)a.add(c);else{const m=Ff(l,f,h);r=r.setNodeMarkup(c,void 0,{...l.attrs,...m})}}return Array.from(a).sort((l,c)=>c-l).forEach(l=>{const c=i.find(u=>u.pos===l);c&&(r=r.delete(l,l+c.node.nodeSize))}),r},E_=(t=null,e="")=>{const n=t?new Date(t):new Date;return isNaN(n.getTime())?t:e?dateFormat(n,e):n.toLocaleDateString("en-US",{month:"short",day:"2-digit",year:"numeric"})},da={getFieldAttrs:Ff,processTables:S_,annotateDocument:C_,annotateHeadersAndFooters:cx},T_=new Ge("collaboration"),$_=Ye.create({name:"collaboration",priority:1e3,addOptions(){return{ydoc:null,field:"supereditor",fragment:null,isReady:!1}},addPmPlugins(){if(!this.editor.options.ydoc)return[];this.options.ydoc=this.editor.options.ydoc;const t=M_();D_(this.options.ydoc,this.editor),__(this.options.ydoc,this.editor,this);const[e,n]=O_(this.options.ydoc,this.editor);this.options.fragment=n;const r=this.options.ydoc.getMap("media");return r.observe(o=>{o.changes.keys.forEach((i,s)=>{if(!(s in this.editor.storage.image.media)){const a=r.get(s);this.editor.storage.image.media[s]=a}})}),[e,t]},addCommands(){return{undo:()=>({tr:t,state:e,dispatch:n})=>(t.setMeta("preventDispatch",!0),t.setMeta("inputType","historyUndo"),Dr.getState(e).undoManager.undoStack.length===0?!1:n?wD(e):!0),redo:()=>({tr:t,state:e,dispatch:n})=>(t.setMeta("preventDispatch",!0),t.setMeta("inputType","historyRedo"),Dr.getState(e).undoManager.redoStack.length===0?!1:n?bD(e):!0),addImageToCollaboration:({mediaPath:t,fileData:e})=>()=>{this.options.ydoc&&this.options.ydoc.getMap("media").set(t,e)}}},addShortcuts(){return{"Mod-z":()=>this.editor.commands.undo(),"Mod-Shift-z":()=>this.editor.commands.redo(),"Mod-y":()=>this.editor.commands.redo()}}}),O_=(t,e)=>{const n=t.getXmlFragment("supereditor");return[XM(n,{onFirstRender:()=>{e.options.isNewFile&&ux(t,e)}}),n]},ux=(t,e)=>{const n=t.getMap("meta");n.set("docx",e.options.content),n.set("fonts",e.options.fonts)},M_=()=>kD(),D_=(t,e)=>{const n=t.getMap("meta");n.observe(r=>{const o=n.get("lockedBy"),i=n.get("locked");if(!e.options.user||!o)return;const s=o?.email!==e.options.user?.email,a=e.options.editable!==!i;!s||!a||(i?console.debug("--- Locking editor ---",o,e.options.user):console.debug("--- Unlocking editor ---",o),e.setEditable(!i),e.emit("locked",{editor:e,isLocked:i,lockedBy:o}))})},__=(t,e,n)=>{const r=e.options.collaborationProvider;if(!r)return;const o=()=>{n.options.isReady=!0,r.off("synced",o),e.emit("collaborationReady",{editor:e,ydoc:t})};if(r.synced){setTimeout(()=>{o()},250);return}r.on("synced",o)},N_=t=>{const e=dD(t.state.doc,"supereditor");return ux(e,t),Yr.encodeStateAsUpdate(e)};var Wo,dx,Ie,px,fx,up,zu,hx,Wa,dp,ju,qu,ss,Dl,jy,Vu,Ga,Ka,Uu,qy,Wi,Gi,Vy,Hu,pp,mx;const I_=class gx extends SD{constructor(e){super(),$r(this,Ie),$r(this,Wo),Re(this,"extensionService"),Re(this,"extensionStorage",{}),Re(this,"schema"),Re(this,"view"),Re(this,"isFocused",!1),$r(this,dx),Re(this,"options",{element:null,selector:null,isHeadless:!1,mockDocument:null,mockWindow:null,content:"",user:null,users:[],media:{},mediaFiles:{},fonts:{},documentMode:"editing",mode:"docx",role:"editor",colors:[],converter:null,fileSource:null,initialState:null,documentId:null,extensions:[],editable:!0,editorProps:{},parseOptions:{},coreExtensionOptions:{},enableInputRules:!0,isCommentsEnabled:!1,isNewFile:!1,scale:1,annotations:!1,isInternal:!1,externalExtensions:[],numbering:{},isHeaderOrFooter:!1,lastSelection:null,htmlOverride:!1,onBeforeCreate:()=>null,onCreate:()=>null,onUpdate:()=>null,onSelectionUpdate:()=>null,onTransaction:()=>null,onFocus:()=>null,onBlur:()=>null,onDestroy:()=>null,onContentError:({error:r})=>{throw r},onTrackedChangesUpdate:()=>null,onCommentsUpdate:()=>null,onCommentsLoaded:()=>null,onCommentClicked:()=>null,onCommentLocationsUpdate:()=>null,onDocumentLocked:()=>null,onFirstRender:()=>null,onCollaborationReady:()=>null,onPaginationUpdate:()=>null,onException:()=>null,handleImageUpload:null,telemetry:null}),Ae(this,Ie,px).call(this,e),Ae(this,Ie,hx).call(this,e),this.setOptions(e);let n={docx:()=>Ae(this,Ie,fx).call(this,this.options),text:()=>Ae(this,Ie,up).call(this,this.options),html:()=>Ae(this,Ie,up).call(this,this.options),default:()=>{console.log("Not implemented.")}};(n[this.options.mode]??n.default)()}setToolbar(e){this.toolbar=e}focus(){this.view?.focus()}get state(){return this.view?.state}get storage(){return this.extensionStorage}get commands(){return Xn(this,Wo)?.commands}get isEditable(){return this.options.editable&&this.view&&this.view.editable}get isDestroyed(){return this.view.isDestroyed}get element(){return this.options.element}get users(){return this.options.users}chain(){return Xn(this,Wo).chain()}can(){return Xn(this,Wo).can()}setDocumentMode(e){let n=e?.toLowerCase()||"editing";this.extensionService&&(this.options.role==="viewer"&&(n="viewing"),this.options.role==="suggester"&&n==="editing"&&(n="suggesting"),n==="viewing"?(this.commands.toggleTrackChangesShowOriginal(),this.setEditable(!1,!1),this.setOptions({documentMode:"viewing"}),Ml(this,null,!1)):n==="suggesting"?(Ae(this,Ie,dp).call(this,"TrackChangesBase"),this.commands.disableTrackChangesShowOriginal(),this.commands.enableTrackChanges(),this.setOptions({documentMode:"suggesting"}),this.setEditable(!0,!1)):n==="editing"&&(Ae(this,Ie,dp).call(this,"TrackChangesBase"),this.commands.disableTrackChangesShowOriginal(),this.commands.disableTrackChanges(),this.setEditable(!0,!1),this.setOptions({documentMode:"editing"}),Ml(this,null,!1)))}generateCollaborationUpdate(){return N_(this)}initializeCollaborationData(){if(!this.options.isNewFile||!this.options.collaborationProvider)return;const{collaborationProvider:e}=this.options,n=()=>{e.off("synced",n),Ae(this,Ie,Wa).call(this)};e.synced?Ae(this,Ie,Wa).call(this):e.on("synced",n)}replaceContent(e){this.setOptions({content:e}),Ae(this,Ie,ss).call(this),this.initDefaultStyles(),Ae(this,Ie,ss).call(this),Ae(this,Ie,Dl).call(this);const n=Ae(this,Ie,Ga).call(this),r=this.state.tr.replaceWith(0,this.state.doc.content.size,n);this.view.dispatch(r)}setOptions(e={}){if(this.options={...this.options,...e},this.options.collaborationProvider&&this.options.ydoc){const n=this.options.extensions.findIndex(r=>r.name==="history");n!==-1&&this.options.extensions.splice(n,1)}(this.options.isNewFile||!this.options.ydoc)&&this.options.isCommentsEnabled&&(this.options.shouldLoadComments=!0),!(!this.view||!this.state||this.ifsDestroyed)&&(this.options.editorProps&&this.view.setProps(this.options.editorProps),this.view.updateState(this.state))}setEditable(e=!0,n=!0){this.setOptions({editable:e}),n&&this.emit("update",{editor:this,transaction:this.state.tr})}registerPlugin(e,n){const r=typeof n=="function"?n(e,[...this.state.plugins]):[...this.state.plugins,e],o=this.state.reconfigure({plugins:r});this.view.updateState(o)}unregisterPlugin(e){if(this.isDestroyed)return;const n=typeof nameOrPluginKey=="string"?`${nameOrPluginKey}$`:nameOrPluginKey.key,r=this.state.reconfigure({plugins:this.state.plugins.filter(o=>!o.key.startsWith(n))});this.view.updateState(r)}static async loadXmlData(e,n=!1){if(!e)return;const r=new Pd,o=await r.getDocxData(e,n),i=r.media;return[o,i,r.mediaFiles,r.fonts]}static getDocumentVersion(e){return Nr.getStoredSuperdocVersion(e)}static updateDocumentVersion(e,n){return Nr.updateDocumentVersion(e,n)}createNodeViews(){this.view.setProps({nodeViews:this.extensionService.nodeViews})}getMaxContentSize(){if(!this.converter)return{};const{pageSize:e={},pageMargins:n={}}=this.converter.pageStyles??{},{width:r,height:o}=e,{top:i=0,bottom:s=0,left:a=0,right:l=0}=n;if(!r||!o)return{};const c=o*96-i*96-s*96-50;return{width:r*96-a*96-l*96-20,height:c}}initDefaultStyles(e=this.element){if(this.options.isHeadless||this.options.htmlOverride)return;const n=e?.querySelector(".ProseMirror"),{pageSize:r,pageMargins:o}=this.converter.pageStyles??{};if(!n||!r||!o)return;e.style.width=r.width+"in",e.style.minWidth=r.width+"in",e.style.minHeight=r.height+"in",e.style.paddingLeft=o.left+"in",e.style.paddingRight=o.right+"in",e.style.boxSizing="border-box",e.style.isolation="isolate",n.style.outline="none",n.style.border="none";const{typeface:i,fontSizePt:s}=this.converter.getDocumentDefaultStyles()??{};i&&(e.style.fontFamily=i),s&&(e.style.fontSize=`${s}pt`),e.style.transformOrigin="top left",e.style.touchAction="auto",e.style.webkitOverflowScrolling="touch";const a=1.2;n.style.lineHeight=a,this.options.extensions.find(l=>l.name==="pagination")||(n.style.paddingTop="1in",n.style.paddingBottom="1in"),this.initMobileStyles(e)}initMobileStyles(e){if(!e)return;const n=e.offsetWidth,r=()=>{const i=n,s=document.documentElement.clientWidth-10;this.options.scale=Math.min(1,s/i);const a=e.closest(".super-editor"),l=e.closest(".super-editor-container");!a||!l||(this.options.scale<1?(a.style.maxWidth=`${i*this.options.scale}px`,l.style.minWidth="0px",e.style.transform=`scale(${this.options.scale})`):(a.style.maxWidth="",l.style.minWidth="",e.style.transform="none"))};r();const o=()=>{setTimeout(()=>{r()},150)};"orientation"in screen&&"addEventListener"in screen.orientation?screen.orientation.addEventListener("change",o):window.matchMedia("(orientation: portrait)").addEventListener("change",o),window.addEventListener("resize",()=>o)}getAttributes(e){return Te.getAttributes(this.state,e)}isActive(e,n){const r=typeof e=="string"?e:null,o=typeof e=="string"?n:e;return Y1(this.state,r,o)}getJSON(){return this.state.doc.toJSON()}getHTML(){const e=document.createElement("div"),n=xi.fromSchema(this.schema).serializeFragment(this.state.doc.content);return e.appendChild(n),e.innerHTML}getPageStyles(){return this.converter?.pageStyles||{}}updatePageStyle({pageMargins:e}){if(!this.converter)return;let n=!1;if(e&&(this.converter.pageStyles.pageMargins=e,this.initDefaultStyles(),n=!0),n){const r=this.view.state.tr;r.setMeta("forceUpdatePagination",!0),this.view.dispatch(r)}}getUpdatedJson(){return Ae(this,Ie,pp).call(this)}async exportDocx({isFinalDoc:e=!1,commentsType:n="external",comments:r=[],getUpdatedDocs:o=!1}={}){const i=Ae(this,Ie,pp).call(this,r),s=await this.converter.exportToDocx(i,this.schema,this.storage.image.media,e,n,r,this),a=this.converter.schemaToXml(this.converter.convertedXml["docProps/custom.xml"].elements[0]),l=this.converter.schemaToXml(this.converter.convertedXml["word/styles.xml"].elements[0]),c=this.converter.schemaToXml(this.converter.convertedXml["word/settings.xml"].elements[0]),u=this.converter.schemaToXml(this.converter.convertedXml["word/_rels/document.xml.rels"].elements[0]),d=this.converter.addedMedia,p={};Object.entries(this.converter.convertedXml).forEach(([g,v])=>{if(g.includes("header")||g.includes("footer")){const k=this.converter.schemaToXml(v.elements[0]);p[g]=String(k)}});const f=this.converter.convertedXml["word/numbering.xml"],h=this.converter.schemaToXml(f.elements[0]),m={"word/document.xml":String(s),"docProps/custom.xml":String(a),"word/settings.xml":String(c),"word/_rels/document.xml.rels":String(u),"word/numbering.xml":String(h),"word/styles.xml":String(l).replace(/&/gi,"&"),...p};if(r.length){const g=this.converter.schemaToXml(this.converter.convertedXml["word/comments.xml"].elements[0]),v=this.converter.schemaToXml(this.converter.convertedXml["word/commentsExtended.xml"].elements[0]),k=this.converter.schemaToXml(this.converter.convertedXml["word/commentsExtensible.xml"].elements[0]),b=this.converter.schemaToXml(this.converter.convertedXml["word/commentsIds.xml"].elements[0]);m["word/comments.xml"]=String(g),m["word/commentsExtended.xml"]=String(v),m["word/commentsExtensible.xml"]=String(k),m["word/commentsIds.xml"]=String(b)}if(o)return m;const y=await new Pd().updateZip({docx:this.options.content,updatedDocs:m,originalDocxFile:this.options.fileSource,media:d,fonts:this.options.fonts,isHeadless:this.options.isHeadless});return this.options.telemetry?.trackUsage("document_export",{documentType:"docx",timestamp:new Date().toISOString()}),y}destroy(){this.emit("destroy"),this.view&&this.view.destroy(),Ae(this,Ie,mx).call(this),this.removeAllListeners()}static checkIfMigrationsNeeded(e){version||(version="initial");const n=zy(version)||[];return console.debug("[checkVersionMigrations] Migrations needed:",version,n.length),n.length>0}processCollaborationMigrations(){if(console.debug("[checkVersionMigrations] Current editor version","0.12.10"),!this.options.ydoc)return;let e=this.options.ydoc.getMap("meta").get("version");e||(e="initial"),console.debug("[checkVersionMigrations] Document version",e);const n=zy(e)||[],r=this.state.plugins.find(i=>i.key.startsWith("y-sync"));if(!r)return this.options.ydoc;let o=!1;for(let i of n)if(console.debug("🏃♂️ Running migration",i.name),i(this))o=!0;else throw new Error("Migration failed at "+i.name);return o?(r?.getState(this.state)).doc:void 0}async replaceFile(e){this.setOptions({annotations:!0});const[n,r,o,i]=await gx.loadXmlData(newFile);this.setOptions({fileSource:newFile,content:n,media:r,mediaFiles:o,fonts:i,isNewFile:!0,shouldLoadComments:!0,replacedFile:!0}),Ae(this,Ie,ss).call(this),Ae(this,Ie,Dl).call(this),this.initDefaultStyles(),this.options.ydoc&&this.options.collaborationProvider?this.initializeCollaborationData(!0):Ae(this,Ie,Wa).call(this),this.options.ydoc||(Ae(this,Ie,Gi).call(this),Ae(this,Ie,Wi).call(this))}getNodesOfType(e){const{findChildren:n}=oc;return n(this.state.doc,r=>r.type.name===e)}replaceNodeWithHTML(e,n){const{tr:r}=this.state,{dispatch:o}=this.view;if(!e||!n)return;const i=e.pos,s=i+e.node.nodeSize,a=Ae(this,Ie,Ka).call(this,n);r.replaceWith(i,s,a),o(r)}prepareForAnnotations(e=[]){const{tr:n}=this.state,{dispatch:r}=this.view,o=da.processTables({editor:this,tr:n,annotationValues:e});this.view.dispatch(o),da.annotateHeadersAndFooters({editor:this,annotationValues:e})}annotate(e=[],n=[]){const{state:r,view:o,schema:i}=this;let s=r.tr;s=da.processTables({editor:this,tr:s,annotationValues:e}),s=da.annotateDocument({tr:s,schema:i,annotationValues:e,hiddenFieldIds:n,editor:this}),s.docChanged&&o.dispatch(s.scrollIntoView())}};Wo=new WeakMap,dx=new WeakMap,Ie=new WeakSet,px=function(t){if(!t.element&&t.selector){const{selector:e}=t;e.startsWith("#")||e.startsWith(".")?t.element=document.querySelector(e):t.element=document.getElementById(e),["text","html"].includes(t.mode)&&t.element&&t.element.classList.add("sd-super-editor-html")}t.element=t.isHeadless?null:t.element||document.createElement("div")},fx=function(t){Ae(this,Ie,ju).call(this),Ae(this,Ie,qu).call(this),Ae(this,Ie,Vu).call(this),Ae(this,Ie,ss).call(this),Ae(this,Ie,Dl).call(this),this.options.isHeadless||Ae(this,Ie,jy).call(this),this.on("beforeCreate",this.options.onBeforeCreate),this.emit("beforeCreate",{editor:this}),this.on("contentError",this.options.onContentError),this.on("exception",this.options.onException),Ae(this,Ie,Uu).call(this),this.initDefaultStyles(),this.setDocumentMode(t.documentMode),!this.options.isHeadless&&(this.on("create",this.options.onCreate),this.on("update",this.options.onUpdate),this.on("selectionUpdate",this.options.onSelectionUpdate),this.on("transaction",this.options.onTransaction),this.on("focus",Ae(this,Ie,zu)),this.on("blur",this.options.onBlur),this.on("destroy",this.options.onDestroy),this.on("trackedChangesUpdate",this.options.onTrackedChangesUpdate),this.on("commentsLoaded",this.options.onCommentsLoaded),this.on("commentClick",this.options.onCommentClicked),this.on("commentsUpdate",this.options.onCommentsUpdate),this.on("locked",this.options.onDocumentLocked),this.on("collaborationReady",Ae(this,Ie,qy)),this.on("paginationUpdate",this.options.onPaginationUpdate),this.on("comment-positions",this.options.onCommentLocationsUpdate),this.initializeCollaborationData(),this.options.ydoc||(Ae(this,Ie,Gi).call(this),Ae(this,Ie,Wi).call(this)),window.setTimeout(()=>{this.isDestroyed||this.emit("create",{editor:this})},0))},up=function(t){(!t.extensions||!t.extensions.length)&&(this.options.extensions=Wf()),Ae(this,Ie,ju).call(this),Ae(this,Ie,qu).call(this),Ae(this,Ie,Vu).call(this),this.on("beforeCreate",this.options.onBeforeCreate),this.emit("beforeCreate",{editor:this}),this.on("contentError",this.options.onContentError),Ae(this,Ie,Uu).call(this),this.on("create",this.options.onCreate),this.on("update",this.options.onUpdate),this.on("selectionUpdate",this.options.onSelectionUpdate),this.on("transaction",this.options.onTransaction),this.on("focus",Ae(this,Ie,zu)),this.on("blur",this.options.onBlur),this.on("destroy",this.options.onDestroy),this.on("commentsLoaded",this.options.onCommentsLoaded),this.on("commentClick",this.options.onCommentClicked),this.on("locked",this.options.onDocumentLocked),window.setTimeout(()=>{this.isDestroyed||this.emit("create",{editor:this})},0)},zu=function({editor:t,event:e}){this.toolbar?.setActiveEditor(t),this.options.onFocus({editor:t,event:e})},hx=function(t){t.isHeadless&&(typeof navigator>"u"&&(Qr.navigator={isHeadless:!0}),t.mockDocument&&(Qr.document=t.mockDocument,Qr.window=t.mockWindow))},Wa=function(){if(!this.options.isNewFile)return;this.options.isNewFile=!1;const t=Ae(this,Ie,Ga).call(this),e=this.state.tr.replaceWith(0,this.state.doc.content.size,t);this.view.dispatch(e),setTimeout(()=>{Ae(this,Ie,Gi).call(this),Ae(this,Ie,Wi).call(this)},50)},dp=function(t){const e=this.extensionService?.plugins.find(r=>r.key.startsWith(t)),n=this.state.plugins.find(r=>r.key.startsWith(t));return e&&!n&&this.registerPlugin(e),e?.key},ju=function(){const t=["extension","node","mark"],e=[Z$,J$,Q$,Y$],n=this.options.externalExtensions||[],r=[...e,...this.options.extensions].filter(o=>t.includes(o?.type));this.extensionService=KD.create(r,n,this)},qu=function(){w1(this,Wo,_1.create({editor:this}))},ss=function(){this.options.converter?this.converter=this.options.converter:this.converter=new Nr({docx:this.options.content,media:this.options.mediaFiles,fonts:this.options.fonts,debug:!0,telemetry:this.options.telemetry,fileSource:this.options.fileSource,documentId:this.options.documentId})},Dl=function(){if(!this.options.ydoc)return this.storage.image.media=this.options.mediaFiles;const t=this.options.ydoc.getMap("media");this.options.isNewFile?(Object.entries(this.options.mediaFiles).forEach(([e,n])=>{t.set(e,n)}),this.storage.image.media=this.options.mediaFiles):this.storage.image.media=Object.fromEntries(t.entries())},jy=function(){const t=this.converter.getDocumentFonts();if(t?.length){const e=document.createElement("style");e.textContent=t,document.head.appendChild(e)}},Vu=function(){this.schema=this.extensionService.schema},Ga=function(){let t;try{const{mode:e,fragment:n,isHeadless:r,content:o,loadFromSchema:i}=this.options;e==="docx"?i?(t=this.schema.nodeFromJSON(o),t=Ae(this,Ie,Hu).call(this,t)):(t=X1(this.converter,this.schema,this),t=Ae(this,Ie,Hu).call(this,t),this.options.html&&(t=Ae(this,Ie,Ka).call(this,this.options.html)),n&&(t=uD(n,this.schema))):(e==="text"||e==="html")&&(i?t=this.schema.nodeFromJSON(o):o?t=Ae(this,Ie,Ka).call(this,o):t=this.schema.topNodeType.createAndFill())}catch(e){console.error(e),this.emit("contentError",{editor:this,error:e})}return t},Ka=function(t){let e=t;if(typeof t=="string"){const n=document.createElement("div");n.innerHTML=t,e=n,n.remove()}return er.fromSchema(this.schema).parse(e)},Uu=function(){let t=Ae(this,Ie,Ga).call(this);const e={schema:this.schema};this.options.ydoc||(e.doc=t),this.view=new B2(this.options.element,{...this.options.editorProps,dispatchTransaction:Ae(this,Ie,Vy).bind(this),state:Zi.create(e),handleDoubleClick:async(o,i,s)=>{if(this.options.documentMode!=="editing")return;const a=Id(s.target,"pagination-section-header"),l=Id(s.target,"pagination-section-footer");if(a||l){const c=new s.constructor(s.type);s.target.dispatchEvent(c);return}s.stopPropagation(),this.options.editable||(this.setEditable(!0,!1),Ml(this,null,!1),document.querySelector(".ProseMirror").classList.remove("header-footer-edit"))}});const n=this.state.reconfigure({plugins:[...this.extensionService.plugins]});this.view.updateState(n),this.createNodeViews();const r=this.view.dom;r.editor=this,this.options.telemetry?.sendReport()},qy=function({editor:t,ydoc:e}){this.options.collaborationIsReady||(console.debug("🔗 [super-editor] Collaboration ready"),this.options.onCollaborationReady({editor:t,ydoc:e}),this.options.collaborationIsReady=!0,this.options.isNewFile||(Ae(this,Ie,Gi).call(this),Ae(this,Ie,Wi).call(this)))},Wi=function(){if(!this.options.isCommentsEnabled||this.options.isHeadless||!this.options.shouldLoadComments)return;const t=this.options.replacedFile;this.emit("commentsLoaded",{editor:this,replacedFile:t,comments:this.converter.comments||[]}),setTimeout(()=>{this.options.replacedFile=!1;const{state:e,dispatch:n}=this.view,r=e.tr.setMeta(bt,{type:"force"});n(r)},50)},Gi=async function(){if(!(this.options.isHeadless||!this.extensionService)&&this.options.extensions.find(t=>t.name==="pagination")&&this.options.pagination){console.debug("🔗 [super-editor] Initializing pagination");const t=await r_(this);this.storage.pagination.sectionData=t;const{state:e,dispatch:n}=this.view,r=e.tr.setMeta(_r,{isReadyToInit:!0});n(r)}},Vy=function(t){if(this.view.isDestroyed)return;let e;try{const i=gt.getState(this.view.state)?.isTrackChangesActive??!1?lx({tr:t,state:this.state,user:this.options.user}):t,{state:s}=this.view.state.applyTransaction(i);e=s}catch(i){e=this.state.apply(t),console.log(i)}const n=!this.state.selection.eq(e.selection);this.view.updateState(e),this.emit("transaction",{editor:this,transaction:t}),n&&this.emit("selectionUpdate",{editor:this,transaction:t});const r=t.getMeta("focus");r&&this.emit("focus",{editor:this,event:r.event,transaction:t});const o=t.getMeta("blur");o&&this.emit("blur",{editor:this,event:o.event,transaction:t}),t.docChanged&&this.emit("update",{editor:this,transaction:t})},Hu=function(t){const e=Zi.create({schema:this.schema,doc:t}),{tr:n,doc:r}=e;return e_(r,n,this.schema,this.converter),e.apply(n).doc},pp=function(t=[]){const e=Zi.create({schema:this.schema,doc:this.state.doc,plugins:this.state.plugins}),{tr:n,doc:r}=e;return QD(r,n,this.schema,t),e.apply(n).doc.toJSON()},mx=function(){if(this.options.ydoc)try{console.debug("🔗 [super-editor] Ending collaboration"),this.options.collaborationProvider&&this.options.collaborationProvider.disconnect(),this.options.ydoc&&this.options.ydoc.destroy()}catch{}};let $s=I_;const yx=Ye.create({name:"color",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{color:{default:null,parseDOM:t=>t.style.color?.replace(/['"]+/g,""),renderDOM:t=>t.color?{style:`color: ${t.color}`}:{}}}}]},addCommands(){return{setColor:t=>({chain:e})=>e().setMark("textStyle",{color:t}).run(),unsetColor:()=>({chain:t})=>t().setMark("textStyle",{color:null}).removeEmptyTextStyle().run()}}}),wx=Ye.create({name:"fontFamily",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{fontFamily:{default:null,parseDOM:t=>t.style.fontFamily?.replace(/['"]+/g,""),renderDOM:t=>t.fontFamily?{style:`font-family: ${t.fontFamily}`}:{}}}}]},addCommands(){return{setFontFamily:t=>({chain:e})=>e().setMark("textStyle",{fontFamily:t}).run(),unsetFontFamily:()=>({chain:t})=>t().setMark("textStyle",{fontFamily:null}).removeEmptyTextStyle().run()}}}),bx=Ye.create({name:"fontSize",addOptions(){return{types:["textStyle","tableCell"],defaults:{value:12,unit:"pt",min:8,max:96}}},addGlobalAttributes(){return[{types:this.options.types,attributes:{fontSize:{default:null,parseDOM:t=>t.style.fontSize,renderDOM:t=>{if(!t.fontSize)return{};let[e,n]=nr(t.fontSize);return Number.isNaN(e)?{}:(n=n||this.options.defaults.unit,{style:`font-size: ${e}${n}`})}}}}]},addCommands(){return{setFontSize:t=>({chain:e})=>{let[n,r]=nr(t);if(Number.isNaN(n))return!1;let{min:o,max:i,unit:s}=this.options.defaults;return n=pl(n,o,i),r=r||s,e().setMark("textStyle",{fontSize:`${n}${r}`}).run()},unsetFontSize:()=>({chain:t})=>t().setMark("textStyle",{fontSize:null}).removeEmptyTextStyle().run()}}}),vx=Ye.create({name:"textAlign",addOptions(){return{types:["heading","paragraph"],alignments:["left","center","right","justify"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{textAlign:{default:this.options.defaultAlignment,parseDOM:t=>{const e=t.style.textAlign||this.options.defaultAlignment;return this.options.alignments.includes(e)?e:this.options.defaultAlignment},renderDOM:t=>{if(t.textAlign===this.options.defaultAlignment)return{};const e=t.textAlign==="both"?"justify":t.textAlign;return e?{style:`text-align: ${e}`}:{}}}}}]},addCommands(){return{setTextAlign:t=>({commands:e})=>this.options.alignments.includes(t)?this.options.types.map(n=>e.updateAttributes(n,{textAlign:t})).every(n=>n):!1,unsetTextAlign:()=>({commands:t})=>this.options.types.map(e=>t.resetAttributes(e,"textAlign")).every(e=>e)}},addShortcuts(){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")}}}),xx=Ye.create({name:"textIndent",addOptions(){return{types:["heading","paragraph"],defaults:{unit:"in",increment:.125}}},addGlobalAttributes(){return[{types:this.options.types,attributes:{textIndent:{default:null,parseDOM:t=>t.style.textIndent,renderDOM:t=>{if(!t.textIndent)return{};let[e,n]=nr(t.textIndent);return Number.isNaN(e)||!e?{}:(n=n||this.options.defaults.unit,{style:`margin-left: ${e}${n}`})}}}}]},addCommands(){return{setTextIndent:t=>({commands:e})=>t?this.options.types.map(n=>e.updateAttributes(n,{textIndent:t})).every(n=>n):!1,unsetTextIndent:()=>({commands:t})=>this.options.types.map(e=>t.resetAttributes(e,"textIndent")).every(e=>e),increaseTextIndent:()=>({commands:t})=>this.options.types.map(e=>{let{textIndent:n}=this.editor.getAttributes(e);if(!n){let{increment:i,unit:s}=this.options.defaults;return t.updateAttributes(e,{textIndent:`${i}${s}`})}let[r,o]=nr(n);return r=r+this.options.defaults.increment,o=o||this.options.defaults.unit,Number.isNaN(r)?!1:t.updateAttributes(e,{textIndent:`${r}${o}`})}).every(e=>e),decreaseTextIndent:()=>({commands:t})=>this.options.types.map(e=>{let{textIndent:n}=this.editor.getAttributes(e);if(!n)return!1;let[r,o]=nr(n);return r=r-this.options.defaults.increment,o=o||this.options.defaults.unit,Number.isNaN(r)?!1:r<=0?t.unsetTextIndent():t.updateAttributes(e,{textIndent:`${r}${o}`})}).every(e=>e)}}}),kx=Ye.create({name:"lineHeight",addOptions(){return{types:["heading","paragraph"],defaults:{unit:""}}},addGlobalAttributes(){return[{types:this.options.types,attributes:{lineHeight:{default:null,parseDOM:t=>t.style.lineHeight,renderDOM:t=>t.lineHeight?{style:Zl(t.lineHeight,this.options.defaults.unit,t.spacing?.lineRule)}:{}}}}]},addCommands(){return{setLineHeight:t=>({commands:e})=>t?this.options.types.map(n=>e.updateAttributes(n,{lineHeight:t})).every(n=>n):!1,unsetLineHeight:()=>({commands:t})=>this.options.types.map(e=>t.resetAttributes(e,"lineHeight")).every(e=>e)}}}),Sx=Ye.create({name:"formatCommands",addOptions(){return{}},addStorage(){return{storedStyle:null}},addCommands(){return{clearFormat:()=>({chain:t})=>t().clearNodes().unsetAllMarks().run(),clearMarksFormat:()=>({chain:t})=>t().unsetAllMarks().run(),clearNodesFormat:()=>({chain:t})=>t().clearNodes().run(),copyFormat:()=>({chain:t})=>{if(!this.storage.storedStyle){const i=Ws(this.editor.state);return this.storage.storedStyle=i,!0}if(!this.storage.storedStyle.length)return this.storage.storedStyle=null,t().clearFormat().run();const e=this.storage.storedStyle,n=[];e.forEach(i=>{const{type:s,attrs:a}=i,{name:l}=s;l==="textStyle"?Object.keys(a).forEach(c=>{if(!a[c])return;const u={};u[c]=a[c],n.push({name:c,attrs:u})}):n.push({name:l,attrs:a})});const r={bold:["setBold","unsetBold"],italic:["setItalic","unsetItalic"],underline:["setUnderline","unsetUnderline"],color:["setColor","setColor",null],fontSize:["setFontSize","unsetFontSize"],fontFamily:["setFontFamily","unsetFontFamily"]};let o=t();return Object.keys(r).forEach(i=>{const[s,a,l]=r[i],c=n.find(p=>p.name===i),u=c?.attrs&&c?.attrs[i];let d={};!c&&!u?d={command:a,argument:l}:d={command:s,argument:c.attrs[i]||l},o=o[d.command](d.argument)}),this.storage.storedStyle=null,o}}},addShortcuts(){return{"Mod-Alt-c":()=>this.editor.commands.clearFormat()}}});function F_(t={}){return new Ue({view(e){return new R_(e,t)}})}let R_=class{constructor(e,n){var r;this.editorView=e,this.cursorPos=null,this.element=null,this.timeout=-1,this.width=(r=n.width)!==null&&r!==void 0?r:1,this.color=n.color===!1?void 0:n.color||"black",this.class=n.class,this.handlers=["dragover","dragend","drop","dragleave"].map(o=>{let i=s=>{this[o](s)};return e.dom.addEventListener(o,i),{name:o,handler:i}})}destroy(){this.handlers.forEach(({name:e,handler:n})=>this.editorView.dom.removeEventListener(e,n))}update(e,n){this.cursorPos!=null&&n.doc!=e.state.doc&&(this.cursorPos>e.state.doc.content.size?this.setCursor(null):this.updateOverlay())}setCursor(e){e!=this.cursorPos&&(this.cursorPos=e,e==null?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())}updateOverlay(){let e=this.editorView.state.doc.resolve(this.cursorPos),n=!e.parent.inlineContent,r,o=this.editorView.dom,i=o.getBoundingClientRect(),s=i.width/o.offsetWidth,a=i.height/o.offsetHeight;if(n){let d=e.nodeBefore,p=e.nodeAfter;if(d||p){let f=this.editorView.nodeDOM(this.cursorPos-(d?d.nodeSize:0));if(f){let h=f.getBoundingClientRect(),m=d?h.bottom:h.top;d&&p&&(m=(m+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let y=this.width/2*a;r={left:h.left,right:h.right,top:m-y,bottom:m+y}}}}if(!r){let d=this.editorView.coordsAtPos(this.cursorPos),p=this.width/2*s;r={left:d.left-p,right:d.left+p,top:d.top,bottom:d.bottom}}let l=this.editorView.dom.offsetParent;this.element||(this.element=l.appendChild(document.createElement("div")),this.class&&(this.element.className=this.class),this.element.style.cssText="position: absolute; z-index: 50; pointer-events: none;",this.color&&(this.element.style.backgroundColor=this.color)),this.element.classList.toggle("prosemirror-dropcursor-block",n),this.element.classList.toggle("prosemirror-dropcursor-inline",!n);let c,u;if(!l||l==document.body&&getComputedStyle(l).position=="static")c=-pageXOffset,u=-pageYOffset;else{let d=l.getBoundingClientRect(),p=d.width/l.offsetWidth,f=d.height/l.offsetHeight;c=d.left-l.scrollLeft*p,u=d.top-l.scrollTop*f}this.element.style.left=(r.left-c)/s+"px",this.element.style.top=(r.top-u)/a+"px",this.element.style.width=(r.right-r.left)/s+"px",this.element.style.height=(r.bottom-r.top)/a+"px"}scheduleRemoval(e){clearTimeout(this.timeout),this.timeout=setTimeout(()=>this.setCursor(null),e)}dragover(e){if(!this.editorView.editable)return;let n=this.editorView.posAtCoords({left:e.clientX,top:e.clientY}),r=n&&n.inside>=0&&this.editorView.state.doc.nodeAt(n.inside),o=r&&r.type.spec.disableDropCursor,i=typeof o=="function"?o(this.editorView,n,e):o;if(n&&!i){let s=n.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let a=vv(this.editorView.state.doc,s,this.editorView.dragging.slice);a!=null&&(s=a)}this.setCursor(s),this.scheduleRemoval(5e3)}}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(e){this.editorView.dom.contains(e.relatedTarget)||this.setCursor(null)}};const Ax=Ye.create({name:"dropCursor",addOptions(){return{color:"currentColor",width:2,class:void 0}},addPmPlugins(){return[F_(this.options)]}});let en=class yr extends je{constructor(e){super(e,e)}map(e,n){let r=e.resolve(n.map(this.head));return yr.valid(r)?new yr(r):je.near(r)}content(){return ve.empty}eq(e){return e instanceof yr&&e.head==this.head}toJSON(){return{type:"gapcursor",pos:this.head}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for GapCursor.fromJSON");return new yr(e.resolve(n.pos))}getBookmark(){return new B_(this.anchor)}static valid(e){let n=e.parent;if(n.isTextblock||!L_(e)||!P_(e))return!1;let r=n.type.spec.allowGapCursor;if(r!=null)return r;let o=n.contentMatchAt(e.index()).defaultType;return o&&o.isTextblock}static findGapCursorFrom(e,n,r=!1){e:for(;;){if(!r&&yr.valid(e))return e;let o=e.pos,i=null;for(let s=e.depth;;s--){let a=e.node(s);if(n>0?e.indexAfter(s)<a.childCount:e.index(s)>0){i=a.child(n>0?e.indexAfter(s):e.index(s)-1);break}else if(s==0)return null;o+=n;let l=e.doc.resolve(o);if(yr.valid(l))return l}for(;;){let s=n>0?i.firstChild:i.lastChild;if(!s){if(i.isAtom&&!i.isText&&!_e.isSelectable(i)){e=e.doc.resolve(o+i.nodeSize*n),r=!1;continue e}break}i=s,o+=n;let a=e.doc.resolve(o);if(yr.valid(a))return a}return null}}};en.prototype.visible=!1;en.findFrom=en.findGapCursorFrom;je.jsonID("gapcursor",en);let B_=class Cx{constructor(e){this.pos=e}map(e){return new Cx(e.map(this.pos))}resolve(e){let n=e.resolve(this.pos);return en.valid(n)?new en(n):je.near(n)}};function L_(t){for(let e=t.depth;e>=0;e--){let n=t.index(e),r=t.node(e);if(n==0){if(r.type.spec.isolating)return!0;continue}for(let o=r.child(n-1);;o=o.lastChild){if(o.childCount==0&&!o.inlineContent||o.isAtom||o.type.spec.isolating)return!0;if(o.inlineContent)return!1}}return!0}function P_(t){for(let e=t.depth;e>=0;e--){let n=t.indexAfter(e),r=t.node(e);if(n==r.childCount){if(r.type.spec.isolating)return!0;continue}for(let o=r.child(n);;o=o.firstChild){if(o.childCount==0&&!o.inlineContent||o.isAtom||o.type.spec.isolating)return!0;if(o.inlineContent)return!1}}return!0}function z_(){return new Ue({props:{decorations:U_,createSelectionBetween(t,e,n){return e.pos==n.pos&&en.valid(n)?new en(n):null},handleClick:q_,handleKeyDown:j_,handleDOMEvents:{beforeinput:V_}}})}const j_=Df({ArrowLeft:pa("horiz",-1),ArrowRight:pa("horiz",1),ArrowUp:pa("vert",-1),ArrowDown:pa("vert",1)});function pa(t,e){const n=t=="vert"?e>0?"down":"up":e>0?"right":"left";return function(r,o,i){let s=r.selection,a=e>0?s.$to:s.$from,l=s.empty;if(s instanceof Pe){if(!i.endOfTextblock(n)||a.depth==0)return!1;l=!1,a=r.doc.resolve(e>0?a.after():a.before())}let c=en.findGapCursorFrom(a,e,l);return c?(o&&o(r.tr.setSelection(new en(c))),!0):!1}}function q_(t,e,n){if(!t||!t.editable)return!1;let r=t.state.doc.resolve(e);if(!en.valid(r))return!1;let o=t.posAtCoords({left:n.clientX,top:n.clientY});return o&&o.inside>-1&&_e.isSelectable(t.state.doc.nodeAt(o.inside))?!1:(t.dispatch(t.state.tr.setSelection(new en(r))),!0)}function V_(t,e){if(e.inputType!="insertCompositionText"||!(t.state.selection instanceof en))return!1;let{$from:n}=t.state.selection,r=n.parent.contentMatchAt(n.index()).findWrapping(t.state.schema.nodes.text);if(!r)return!1;let o=ye.empty;for(let s=r.length-1;s>=0;s--)o=ye.from(r[s].createAndFill(null,o));let i=t.state.tr.replace(n.pos,n.pos,new ve(o,0,0));return i.setSelection(Pe.near(i.doc.resolve(n.pos+1))),t.dispatch(i),!1}function U_(t){if(!(t.selection instanceof en))return null;let e=document.createElement("div");return e.className="ProseMirror-gapcursor",De.create(t.doc,[Le.widget(t.selection.head,e,{key:"gapcursor"})])}const H_=Ye.create({name:"gapCursor",addPmPlugins(){return[z_()]},extendNodeSchema(t){return{allowGapCursor:Ke(Fe(t,"allowGapCursor",{name:t.name,options:t.options,storage:t.storage}))??null}}}),W_=Ye.create({name:"collaborationCursor",priority:999,addOptions(){return{provider:null,user:{name:null,color:null}}},addStorage(){return{users:[]}},addPmPlugins(){const{collaborationProvider:t=null}=this.editor.options;return t?[yD(t.awareness,{cursorBuilder:G_})]:[]}}),G_=t=>{const e=document.createElement("span");e.classList.add("ProseMirror-yjs-cursor"),e.setAttribute("style",`border-color: ${t.color}`);const n=document.createElement("div");return n.setAttribute("style",`background-color: ${t.color}`),n.insertBefore(document.createTextNode(t.name||t.email),null),e.insertBefore(n,null),e},Qo="aiMark",fa="aiAnimationMark",Ex="aiLoaderNode",K_=tn.create({name:Qo,group:"ai",inclusive:!1,addOptions(){return{htmlAttributes:{class:"sd-ai-highlight"}}},addAttributes(){return{id:{default:null,rendered:!1}}},parseDOM(){return[{tag:Qo}]},renderDOM({htmlAttributes:t}){return[Qo,Te.mergeAttributes(this.options.htmlAttributes,t)]}}),J_=tn.create({name:fa,group:"ai",inclusive:!1,spanning:!1,excludes:fa,addOptions(){return{htmlAttributes:{}}},addAttributes(){return{id:{default:null,rendered:!1},class:{default:null,rendered:!0},dataMarkId:{default:null,rendered:!0}}},parseDOM(){return[{tag:fa}]},renderDOM({htmlAttributes:t}){return[fa,Te.mergeAttributes(this.options.htmlAttributes,t)]}}),X_="data:image/svg+xml,%3csvg%20fill='hsla(278,%2077.40%25,%2020.80%25,%200.65)'%20viewBox='0%200%2024%2024'%20xmlns='http://www.w3.org/2000/svg'%3e%3ccircle%20cx='4'%20cy='12'%20r='0'%3e%3canimate%20begin='0;spinner_z0Or.end'%20attributeName='r'%20calcMode='spline'%20dur='0.5s'%20keySplines='.36,.6,.31,1'%20values='0;3'%20fill='freeze'/%3e%3canimate%20begin='spinner_OLMs.end'%20attributeName='cx'%20calcMode='spline'%20dur='0.5s'%20keySplines='.36,.6,.31,1'%20values='4;12'%20fill='freeze'/%3e%3canimate%20begin='spinner_UHR2.end'%20attributeName='cx'%20calcMode='spline'%20dur='0.5s'%20keySplines='.36,.6,.31,1'%20values='12;20'%20fill='freeze'/%3e%3canimate%20id='spinner_lo66'%20begin='spinner_Aguh.end'%20attributeName='r'%20calcMode='spline'%20dur='0.5s'%20keySplines='.36,.6,.31,1'%20values='3;0'%20fill='freeze'/%3e%3canimate%20id='spinner_z0Or'%20begin='spinner_lo66.end'%20attributeName='cx'%20dur='0.001s'%20values='20;4'%20fill='freeze'/%3e%3c/circle%3e%3ccircle%20cx='4'%20cy='12'%20r='3'%3e%3canimate%20begin='0;spinner_z0Or.end'%20attributeName='cx'%20calcMode='spline'%20dur='0.5s'%20keySplines='.36,.6,.31,1'%20values='4;12'%20fill='freeze'/%3e%3canimate%20begin='spinner_OLMs.end'%20attributeName='cx'%20calcMode='spline'%20dur='0.5s'%20keySplines='.36,.6,.31,1'%20values='12;20'%20fill='freeze'/%3e%3canimate%20id='spinner_JsnR'%20begin='spinner_UHR2.end'%20attributeName='r'%20calcMode='spline'%20dur='0.5s'%20keySplines='.36,.6,.31,1'%20values='3;0'%20fill='freeze'/%3e%3canimate%20id='spinner_Aguh'%20begin='spinner_JsnR.end'%20attributeName='cx'%20dur='0.001s'%20values='20;4'%20fill='freeze'/%3e%3canimate%20begin='spinner_Aguh.end'%20attributeName='r'%20calcMode='spline'%20dur='0.5s'%20keySplines='.36,.6,.31,1'%20values='0;3'%20fill='freeze'/%3e%3c/circle%3e%3ccircle%20cx='12'%20cy='12'%20r='3'%3e%3canimate%20begin='0;spinner_z0Or.end'%20attributeName='cx'%20calcMode='spline'%20dur='0.5s'%20keySplines='.36,.6,.31,1'%20values='12;20'%20fill='freeze'/%3e%3canimate%20id='spinner_hSjk'%20begin='spinner_OLMs.end'%20attributeName='r'%20calcMode='spline'%20dur='0.5s'%20keySplines='.36,.6,.31,1'%20values='3;0'%20fill='freeze'/%3e%3canimate%20id='spinner_UHR2'%20begin='spinner_hSjk.end'%20attributeName='cx'%20dur='0.001s'%20values='20;4'%20fill='freeze'/%3e%3canimate%20begin='spinner_UHR2.end'%20attributeName='r'%20calcMode='spline'%20dur='0.5s'%20keySplines='.36,.6,.31,1'%20values='0;3'%20fill='freeze'/%3e%3canimate%20begin='spinner_Aguh.end'%20attributeName='cx'%20calcMode='spline'%20dur='0.5s'%20keySplines='.36,.6,.31,1'%20values='4;12'%20fill='freeze'/%3e%3c/circle%3e%3ccircle%20cx='20'%20cy='12'%20r='3'%3e%3canimate%20id='spinner_4v5M'%20begin='0;spinner_z0Or.end'%20attributeName='r'%20calcMode='spline'%20dur='0.5s'%20keySplines='.36,.6,.31,1'%20values='3;0'%20fill='freeze'/%3e%3canimate%20id='spinner_OLMs'%20begin='spinner_4v5M.end'%20attributeName='cx'%20dur='0.001s'%20values='20;4'%20fill='freeze'/%3e%3canimate%20begin='spinner_OLMs.end'%20attributeName='r'%20calcMode='spline'%20dur='0.5s'%20keySplines='.36,.6,.31,1'%20values='0;3'%20fill='freeze'/%3e%3canimate%20begin='spinner_UHR2.end'%20attributeName='cx'%20calcMode='spline'%20dur='0.5s'%20keySplines='.36,.6,.31,1'%20values='4;12'%20fill='freeze'/%3e%3canimate%20begin='spinner_Aguh.end'%20attributeName='cx'%20calcMode='spline'%20dur='0.5s'%20keySplines='.36,.6,.31,1'%20values='12;20'%20fill='freeze'/%3e%3c/circle%3e%3c/svg%3e",Y_=He.create({name:Ex,group:"inline",inline:!0,atom:!0,selectable:!1,draggable:!1,addOptions(){return{htmlAttributes:{class:"sd-ai-loader",contentEditable:"false"}}},parseDOM(){return[{tag:"span.sd-ai-loader"}]},renderDOM({htmlAttributes:t}){const e=document.createElement("span");Object.entries(Te.mergeAttributes(this.options.htmlAttributes,t)).forEach(([r,o])=>e.setAttribute(r,o));const n=document.createElement("img");return n.src=X_,n.alt="loading...",n.width=100,n.height=50,e.appendChild(n),e}}),ha=new Ge("ai"),Tx=Ye.create({name:"ai",addCommands(){return{insertAiMark:()=>({tr:t,dispatch:e,state:n})=>{const{selection:r}=t,{$from:o,$to:i}=r;return o.pos===i.pos?!1:(t.addMark(o.pos,i.pos,this.editor.schema.marks[Qo].create({id:"ai-highlight"})),e&&e(t),!0)},updateAiHighlightStyle:t=>({tr:e,dispatch:n})=>(e.setMeta(ha,{type:"updateStyle",className:t}),n&&n(e),!0),clearAiHighlightStyle:()=>({tr:t,dispatch:e})=>(t.setMeta(ha,{type:"updateStyle",className:null}),e&&e(t),!0),removeAiMark:(t=Qo)=>({tr:e,dispatch:n,state:r})=>{const{doc:o}=r;let i=!1;return o.descendants((s,a)=>{const{marks:l=[]}=s;l.find(c=>c.type.name===t)&&(i=!0,e.removeMark(a,a+s.nodeSize,r.schema.marks[t]))}),i?(n&&n(e),!0):!1},removeAiNode:(t=Ex)=>({tr:e,dispatch:n,state:r})=>{const{doc:o}=r,i=[];return o.descendants((s,a)=>{s.type.name===t&&i.push(a)}),i.length===0?!1:(i.sort((s,a)=>a-s),i.forEach(s=>{const a=o.nodeAt(s);a&&e.delete(s,s+a.nodeSize)}),n&&n(e),!0)}}},addPmPlugins(){const t=this.editor;return[new Ue({key:ha,state:{init(){return{decorations:De.empty,highlightColor:"#6366f1",customClass:null}},apply(e,n,r,o){const i=e.getMeta(ha);let s=n.customClass;if(i&&i.type==="updateStyle"&&(s=i.className),e.docChanged&&s==="sd-ai-highlight-pulse"){let c=!1;e.steps.forEach(u=>{u.slice&&u.slice.content.size>0&&(c=!0)}),c&&(s=null)}if(!e.docChanged&&!i)return n;const{decorations:a}=Z_(t,o.doc,n.highlightColor,s)||{},l=De.create(o.doc,a);return{...n,decorations:l,customClass:s}}},props:{decorations(e){return this.getState(e).decorations}}})]}}),Z_=(t,e,n,r=null)=>{const o=[];return e.descendants((i,s)=>{const{marks:a=[]}=i;if(a.find(l=>l.type.name===Qo)){const l={style:`background-color: ${n}33; border-radius: 4px; transition: background-color 250ms ease;`,class:"sd-ai-highlight-element"};r&&(l.class+=` ${r}`);const c=Le.inline(s,s+i.nodeSize,l);o.push(c)}}),{decorations:o}},$x=He.create({name:"doc",topNode:!0,content:"block+",parseDOM(){return[{tag:"doc"}]},renderDOM(){return["doc",0]},addAttributes(){return{attributes:{rendered:!1}}}}),Ox=He.create({name:"text",group:"inline",inline:!0}),Q_=He.create({name:"run",group:"inline",content:"text*",inline:!0,parseDOM(){return[{tag:"run"}]},renderDOM(){return["run",0]},addAttributes(){return{attributes:{rendered:!1}}}});function _l(t){return new qD({match:t.match,handler:({state:e,range:n,match:r,chain:o})=>{const i=Ke(t.getAttributes,null,r)||{},s=e.tr.delete(n.from,n.to),a=s.doc.resolve(n.from).blockRange(),l=a&&mv(a,t.type,i);if(!l)return null;if(s.wrap(a,l),t.keepMarks&&t.editor){const{selection:u,storedMarks:d}=e,{splittableMarks:p}=t.editor.extensionService,f=d||u.$to.parentOffset&&u.$from.marks();if(f){const h=f.filter(m=>p.includes(m.type.name));s.ensureMarks(h)}}if(t.keepAttributes){const u=t.type.name==="bulletList"||t.type.name==="orderedList"?"listItem":t.type.name;o().updateAttributes(u,i).run()}const c=s.doc.resolve(n.from-1).nodeBefore;c&&c.type===t.type&&Pr(s.doc,n.from-1)&&(!t.joinPredicate||t.joinPredicate(r,c))&&s.join(n.from-1)}})}const Uy=/^\s*([-+*])\s$/,Mx=He.create({name:"bulletList",group:"block list",content(){return`${this.options.itemTypeName}+`},addOptions(){return{itemTypeName:"listItem",htmlAttributes:{},keepMarks:!0,keepAttributes:!1}},parseDOM(){return[{tag:"ul"}]},renderDOM({htmlAttributes:t}){return["ul",Te.mergeAttributes(this.options.htmlAttributes,t),0]},addAttributes(){return{"list-style-type":{default:"bullet",rendered:!1},listId:{rendered:!1},attributes:{rendered:!1,keepOnSplit:!0}}},addCommands(){return{toggleBulletList:()=>t=>{const{commands:e,chain:n}=t;return e.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}}},addShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let t=_l({match:Uy,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(t=_l({match:Uy,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes("textStyle"),editor:this.editor})),[t]}});function eN(t={}){return new Ue({key:new Ge("orderedListSync"),appendTransaction:(e,n,r)=>{if(!(e.some(l=>l.docChanged)&&!n.doc.eq(r.doc)))return;let{doc:o,tr:i}=r,s={};if(o.descendants((l,c)=>{if(l.type.name==="orderedList"&&l.attrs.syncId){let u=l.attrs.syncId;s[u]||(s[u]=[]),s[u].push({node:l,pos:c})}}),!Object.keys(s).length)return;let a=!1;return Object.entries(s).forEach(([l,c])=>{if(c.length<1){let[p]=c;i.setNodeMarkup(p.pos,void 0,{...p.node.attrs,syncId:null}),a=!0;return}let[u]=c,d=u.node.attrs.order;c.forEach((p,f)=>{if(f===0)return;let{node:h,pos:m}=p,y=c[f-1],g=d+y.node.childCount;h.attrs.order!==g&&(i.setNodeMarkup(m,void 0,{...h.attrs,order:g}),a=!0),d=g})}),a?i:null}})}function tN(){return Math.floor(Math.random()*4294967295).toString()}function nN(t){return new Ue({key:new Ge("orderedListMarker"),appendTransaction:(e,n,r)=>{if(!(e.some(l=>l.docChanged)&&!n.doc.eq(r.doc)))return;let{doc:o,tr:i}=r,s=rN(r);if(!s.size)return;let a=!1;return Array.from(s).forEach(([l,c])=>{const u=c[0];let d=c,p=u.node.type.name==="bulletList";u.node.attrs.syncId;let f=u.node.childCount!==d.length;if(p){d.forEach(v=>iN(i,v)),a=!0;return}if(f){let v=oN({state:r,list:u});v.length&&(d=v)}let h=d[0],m=sN({state:r,listItems:d}),y=Dx(),g={lvlText:h.node.attrs.lvlText??y.lvlText,listLevel:h.node.attrs.listLevel??y.listLevel,listNumberingType:h.node.attrs.listNumberingType??y.listNumberingType};g.lvlText===m.lvlText&&g.listNumberingType===m.listNumberingType&&Hy(g.listLevel,m.listLevel)||(i.setNodeMarkup(h.pos,void 0,{...h.node.attrs,...m}),a=!0,g=m),d.forEach((v,k)=>{if(k===0)return;let{node:b,pos:C}=v,{lvlText:D,listLevel:M,listNumberingType:I}=b.attrs;Array.isArray(g.listLevel)||(g.listLevel=JSON.parse(g.listLevel));let E=[...g.listLevel.slice(0,-1),g.listLevel.at(-1)+1];if(!(D===g.lvlText&&I===g.listNumberingType&&Hy(M,E))){let{selection:G,storedMarks:oe}=r,N=oe||G.$to.parentOffset&&G.$from.marks();i.setNodeMarkup(C,void 0,{...b.attrs,listLevel:E,lvlText:g.lvlText,listNumberingType:g.listNumberingType}),N&&i.ensureMarks(N),a=!0}g={...g,listLevel:E}})}),i.setMeta("orderedListMarker",!0),a?i:null}})}function rN(t){let{doc:e}=t,n=new Map;return e.descendants((r,o)=>{let{attrs:i}=r,s=r.type.name==="listItem",a=!!i.listLevel?.length,l=!!i.lvlText,c=i.listNumberingType&&i.listNumberingType!=="bullet";if(s&&a&&l&&c){const u=`${e.resolve(o).parent.attrs.listId}, ${r.attrs.listLevel.slice(0,-1)}`;n.get(u)||n.set(u,[]),n.get(u).push({node:r,pos:o})}}),n}function oN({state:t,list:e}){let{doc:n}=t,r=[];return n.descendants((o,i)=>{let s=o.type.name==="listItem",a=n.resolve(i);s&&a.parent===e&&r.push({node:o,pos:i})}),r}function Dx({lvlText:t="",listLevel:e=[],listNumberingType:n="decimal"}={}){return{lvlText:t,listLevel:e,listNumberingType:n}}function iN(t,e){let{pos:n,node:r}=e;t.setNodeMarkup(n,void 0,{...r.attrs,lvlText:null,listLevel:null,listNumberingType:null})}function Hy(t,e){return t.length===e.length&&t.every((n,r)=>n===e[r])}function sN({state:t,listItems:e}){let{doc:n}=t,r=e[0],{lvlText:o,listLevel:i,listNumberingType:s}=r.node.attrs,a=Dx({lvlText:"%1.",listLevel:[1],listNumberingType:"decimal"}),l=(n.resolve(r.pos).depth-1)/2;if(!(o&&i?.length&&s))({lvlText:o,listLevel:i,listNumberingType:s}=a);else{let c=l>0;c&&l>=3?{lvlText:o,listLevel:i,listNumberingType:s}=a:c&&l<3&&(i=[...i.slice(0,-1),1])}return{lvlText:o,listLevel:i,listNumberingType:s}}const Wy=/^(\d+)\.\s$/,_x=He.create({name:"orderedList",group:"block list",content(){return`${this.options.itemTypeName}+`},addOptions(){return{itemTypeName:"listItem",htmlAttributes:{},keepMarks:!0,keepAttributes:!1,listStyleTypes:["decimal","lowerAlpha","lowerRoman"]}},addAttributes(){return{order:{default:1,parseDOM:t=>t.hasAttribute("start")?parseInt(t.getAttribute("start")||"",10):1,renderDOM:t=>({start:t.order})},syncId:{default:null,parseDOM:t=>t.getAttribute("data-sync-id"),renderDOM:t=>t.syncId?{"data-sync-id":t.syncId}:{}},listId:{default:null,parseDOM:t=>t.getAttribute("data-list-id"),renderDOM:t=>t.listId?{"data-list-id":t.listId}:{}},"list-style-type":{default:"decimal",renderDOM:t=>{let e=t["list-style-type"];return e?(e==="lowerLetter"&&(e="lowerAlpha"),{style:`list-style-type: ${AE(e)};`}):{}}},attributes:{rendered:!1,keepOnSplit:!0}}},parseDOM(){return[{tag:"ol"}]},renderDOM({htmlAttributes:t}){const{start:e,...n}=t;return e===1?["ol",Te.mergeAttributes(this.options.htmlAttributes,n),0]:["ol",Te.mergeAttributes(this.options.htmlAttributes,t),0]},addCommands(){return{toggleOrderedList:()=>({commands:t})=>t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks),getCurrentList:()=>({state:t})=>Kt(e=>e.type.name===this.name)(t.selection),restartListNodes:(t,e)=>({tr:n,state:r})=>{let o=e;return t.map(i=>{const s={node:i,pos:o};return o+=i.nodeSize,s}).forEach(i=>{const{pos:s}=i,a=n.mapping.map(s);n.setNodeMarkup(a,void 0,{})}),!0},updateOrderedListStyleType:()=>({dispatch:t,state:e,tr:n})=>{let r=Kt(o=>o.type.name===this.name)(n.selection);if(!r)return!0;if(t){let o=(r.depth-1)/2,i=this.options.listStyleTypes,s=i[o%i.length],a=r.node.attrs["list-style-type"],l=n.doc.nodeAt(r.pos);a!==s&&l.eq(r.node)&&n.setNodeMarkup(r.pos,void 0,{...r.node.attrs,"list-style-type":s})}return!0},liftEmptyBlockAndContinueListOrder:()=>({editor:t,dispatch:e,state:n,tr:r,commands:o})=>{let i=Kt(d=>d.type.name===this.name)(n.selection);if(!i)return!1;let s=t.can().liftEmptyBlock(),a=i.depth===1,l=i.node.childCount===1,c=n.selection.$from.node(-1),u=i.node.lastChild.eq(c);if(!(s&&a&&!l&&!u))return!1;if(e){let d=i.pos;if(!o.liftEmptyBlock(n,e))return!1;let{$from:p}=r.selection,f=r.doc.nodeAt(d),h=p.after(),m=r.doc.nodeAt(h),y=f?.type.name===this.name,g=m?.type.name===this.name;if(y&&g){let v=f.attrs.order||1,k=f.childCount,b=f.attrs.syncId,C=k+v,D=b||tN();r.setNodeMarkup(h,void 0,{...m.attrs,order:C,syncId:D}),b||r.setNodeMarkup(d,void 0,{...f.attrs,syncId:D})}}return!0}}},addShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList(),Enter:()=>this.editor.commands.liftEmptyBlockAndContinueListOrder()}},addPmPlugins(){return[nN(this.editor),eN()]},addInputRules(){let t=_l({match:Wy,type:this.type,getAttributes:e=>({start:+e[1]}),joinPredicate:(e,n)=>n.childCount+n.attrs.start===+e[1]});return(this.options.keepMarks||this.options.keepAttributes)&&(t=_l({match:Wy,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes("textStyle")}),joinPredicate:(e,n)=>n.childCount+n.attrs.start===+e[1],editor:this.editor})),[t]}}),aN=({listLevel:t,lvlText:e,listNumberingType:n})=>{const r=dN[n];return r?r(t,e):null},lN=(t,e)=>Rf(t,e,String),Nx=(t,e)=>Rf(t,e,fN),cN=(t,e)=>Nx(t,e).toLowerCase(),uN=(t,e)=>Ix(t,e).toLowerCase(),Ix=(t,e)=>Rf(t,e,n=>hN(n)),dN={decimal:lN,lowerRoman:cN,upperRoman:Nx,lowerLetter:uN,upperLetter:Ix},pN=(t,e)=>t.reduce((n,r,o)=>n.replace(`%${o+1}`,r),e),Rf=(t,e,n)=>{const r=t.map(n);return pN(r,e)},fN=t=>{const e=[{value:1e3,numeral:"M"},{value:900,numeral:"CM"},{value:500,numeral:"D"},{value:400,numeral:"CD"},{value:100,numeral:"C"},{value:90,numeral:"XC"},{value:50,numeral:"L"},{value:40,numeral:"XL"},{value:10,numeral:"X"},{value:9,numeral:"IX"},{value:5,numeral:"V"},{value:4,numeral:"IV"},{value:1,numeral:"I"}];let n="";for(const{value:r,numeral:o}of e)for(;t>=r;)n+=o,t-=r;return n},hN=t=>{let e="";const n="ABCDEFGHIJKLMNOPQRSTUVWXYZ";for(;t>0;){let r=(t-1)%26;e=n[r]+e,t=Math.floor((t-1)/26)}return e};function mN(t={}){return new Ue({key:new Ge("styledListMarker"),state:{init(e,n){const r=[...Gy(n),...Ky(n)];return De.create(n.doc,r)},apply(e,n,r,o){if(!e.docChanged||e.getMeta("orderedListMarker"))return n;const i=e.getMeta("splitListItem"),s=[...Gy(o,i),...Ky(o)];return De.create(o.doc,s)}},props:{decorations(e){return this.getState(e)}}})}function Gy(t,e=[]){let{doc:n,storedMarks:r}=t,o=[];Array.isArray(r)&&e.push(...r);let i=yf(n,s=>s.type.name==="listItem");return i.length&&i.forEach(({node:s,pos:a})=>{let l=cr("textStyle",n.type.schema),c=[...e.filter(y=>y.type===l)];if(yN(s)&&e.length){const y=e.filter(g=>g.type===l);c.push(...y)}else{const y=gN(s,n,l);c.push(...y)}let u=null,d=null;c.forEach(y=>{let{attrs:g}=y;if(g.fontSize&&!u){let[v,k]=nr(g.fontSize);Number.isNaN(v)||(k=k??"pt",u=`${v}${k}`)}g.fontFamily&&!d&&(d=g.fontFamily)});let p={style:`--marker-font-size: ${u??"initial"}`},f={style:`--marker-font-family: ${d??"initial"}`},h=Te.mergeAttributes(p,f),m=Le.node(a,a+s.nodeSize,h);o.push(m)}),o}function Ky(t){let{doc:e}=t,n=[],r=yf(e,o=>o.type.name==="listItem");return r.length&&r.forEach(({node:o,pos:i})=>{let s={};if(o.attrs.spacing){const{lineSpaceBefore:l,lineSpaceAfter:c,line:u}=o.attrs.spacing;s={style:`
|
|
45
|
+
`,rules:e,plugin:n}):!1},handlePaste(r,o,i){const s=o.clipboardData,a=s.getData("text/html");s.getData("text/plain");let l;switch(a?HD(a)?l="word-html":l="browser-html":l="plain-text",l){case"plain-text":break;case"word-html":if(t.options.mode==="docx")return FD(a,t,r,n);case"browser-html":return WD(a,t)}return!1}},isInputRules:!0});return n};function HD(t){return/class=["']?Mso|xmlns:o=["']?urn:schemas-microsoft-com|<!--\[if gte mso|<meta[^>]+name=["']?Generator["']?[^>]+Word/i.test(t)}const WD=(t,e,n)=>{const r=J2(t),o=document.createElement("div");o.innerHTML=r;const i=er.fromSchema(e.schema).parse(o);o.remove();const{dispatch:s}=e.view;return s?(s(e.view.state.tr.replaceSelectionWith(i,!0)),!0):!1},J2=t=>t.replace(/font-size\s*:\s*([\d.]+)em/gi,(e,n)=>{const r=parseFloat(n);return`font-size: ${Math.round(r*12*100)/100}pt`});var Ol,X2,Fy;const GD=class Hi{constructor(e,n,r){$r(this,Ol),Re(this,"editor"),Re(this,"schema"),Re(this,"extensions"),Re(this,"externalExtensions",[]),Re(this,"splittableMarks",[]),this.editor=r,this.externalExtensions=n||[],this.externalExtensions=this.externalExtensions.map(o=>({...o,isExternal:!0})),this.extensions=Hi.getResolvedExtensions([...e,...this.externalExtensions]),this.schema=LT.createSchemaByExtensions(this.extensions,r),Ae(this,Ol,X2).call(this)}static create(...e){return new Hi(...e)}static getResolvedExtensions(e){return Hi.sortByPriority(e)}static sortByPriority(e){return e.sort((n,r)=>{const o=Fe(n,"priority")||100,i=Fe(r,"priority")||100;return o>i?-1:o<i?1:0})}get attributes(){return Te.getAttributesFromExtensions(this.extensions)}get commands(){let e={};for(const n of this.extensions){const r={name:n.name,options:n.options,storage:n.storage,editor:this.editor,type:bs(n.name,this.schema)},o=Fe(n,"addCommands",r);o&&(e={...e,...o()})}return e}get plugins(){const e=this.editor,n=Hi.sortByPriority([...this.extensions].reverse()),r=[],o=n.map(i=>{const s={name:i.name,options:i.options,storage:i.storage,editor:e,type:bs(i.name,this.schema)},a=[],l=Fe(i,"addShortcuts",s);let c={};if(l){const p=Object.entries(l()).map(([f,h])=>[f,(...m)=>h({editor:e,keymapArgs:m})]);c={...Object.fromEntries(p)}}a.push(DD(c));const u=Fe(i,"addInputRules",s);_D(i,e.options.enableInputRules)&&u&&r.push(...u());const d=Fe(i,"addPmPlugins",s);if(d){const p=d();a.push(...p)}return a}).flat();return[UD({editor:e,rules:r}),...o]}get nodeViews(){const{editor:e}=this,n=this.extensions.filter(r=>r.type==="node").filter(r=>!!Fe(r,"addNodeView")).map(r=>{const o=this.attributes.filter(l=>l.type===r.name),i={name:r.name,options:r.options,storage:r.storage,editor:e,type:pt(r.name,this.schema)},s=Fe(r,"addNodeView",i);if(!s)return[];const a=(l,c,u,d)=>{const p=Te.getAttributesToRender(l,o);return s()({editor:e,node:l,getPos:u,decorations:d,htmlAttributes:p,extension:r})};return[r.name,a]});return Object.fromEntries(n)}};Ol=new WeakSet,X2=function(){for(const t of this.extensions){this.editor.extensionStorage[t.name]=t.storage;const e={name:t.name,options:t.options,storage:t.storage,editor:this.editor,type:bs(t.name,this.schema)};t.type==="mark"&&(Ke(Fe(t,"keepOnSplit",e))??!0)&&this.splittableMarks.push(t.name),Ae(this,Ol,Fy).call(this,t)}},Fy=function(t){const e={name:t.name,options:t.options,storage:t.storage,editor:this.editor,type:bs(t.name,this.schema)},n=Fe(t,"onBeforeCreate",e),r=Fe(t,"onCreate",e),o=Fe(t,"onUpdate",e),i=Fe(t,"onSelectionUpdate",e),s=Fe(t,"onTransaction",e),a=Fe(t,"onFocus",e),l=Fe(t,"onBlur",e),c=Fe(t,"onDestroy",e);n&&this.editor.on("beforeCreate",n),r&&this.editor.on("create",r),o&&this.editor.on("update",o),i&&this.editor.on("selectionUpdate",i),s&&this.editor.on("transaction",s),a&&this.editor.on("focus",a),l&&this.editor.on("blur",l),c&&this.editor.on("destroy",c)};let KD=GD;const _f=({tr:t,from:e,to:n,markName:r,attrs:o={},offset:i=1})=>{const{doc:s}=t,a=Math.max(e-i,0),l=Math.min(n+i,s.content.size);let c;return s.nodesBetween(a,l,(u,d)=>{if(!u||u?.nodeSize===void 0)return;const p=u.marks.find(f=>f.type.name===r&&Object.keys(o).every(h=>f.attrs[h]===o[h]));p&&!c&&(c={from:d,to:d+u.nodeSize,mark:p})}),c},Y2=({tr:t,from:e,to:n,user:r,date:o})=>{t.removeMark(e,n,t.doc.type.schema.marks[ut]),t.removeMark(e,n,t.doc.type.schema.marks[It]);let i=_f({tr:t,from:e,to:n,markName:It,attrs:{authorEmail:r.email}}),s;i?s=i.mark.attrs.id:s=Lr();const a=t.doc.type.schema.marks[It].create({id:s,author:r.name,authorEmail:r.email,date:o});return t.addMark(e,n,a),t.doc.nodesBetween(e,n,(l,c)=>{if(c<e||["bulletList","orderedList"].includes(l.type.name))return!0;if(l.isInline||["tableRow","tableCell"].includes(l.type.name)||(l.attrs.track,l.type.name==="table"))return!1}),a},Z2=({tr:t,from:e,to:n,user:r,date:o})=>{let i=_f({tr:t,from:e,to:n,markName:ut,attrs:{authorEmail:r.email}}),s;i?s=i.mark.attrs.id:s=Lr();const a=t.doc.type.schema.marks[ut].create({id:s,author:r.name,authorEmail:r.email,date:o}),l=new ni;let c=[];return t.doc.nodesBetween(e,n,(u,d)=>{if(!u.type.name.includes("table"))if(u.isInline&&u.marks.find(p=>p.type.name===It&&p.attrs.authorEmail===r.email)){const p=new Tt(l.map(Math.max(e,d)),l.map(Math.min(n,d+u.nodeSize)),ve.empty);t.maybeStep(p).failed||l.appendMap(p.getMap())}else u.isInline&&!u.marks.find(p=>p.type.name===ut)?(c.push(u),t.addMark(l.map(Math.max(e,d)),l.map(Math.min(n,d+u.nodeSize)),a)):u.attrs.track&&!u.attrs.track.find(p=>p.type===ut)&&["bulletList","orderedList"].includes(u.type.name)}),{deletionMark:a,deletionMap:l,nodes:c}},JD=(t,e,n)=>{const r=t.resolve(e),o=r.parent,i=o.childAfter(r.parentOffset);if(!i.node)return null;const s=i.node.marks.find(d=>d.type.name===n);let a=r.index(),l=r.start()+i.offset;for(;a>0&&s.isInSet(o.child(a-1).marks);)l-=o.child(--a).nodeSize;let c=r.index()+1,u=r.start()+i.offset+i.node.nodeSize;for(;c<o.childCount&&s.isInSet(o.child(c).marks);)u+=o.child(c++).nodeSize;return{from:l,to:u,attrs:s.attrs}},Q2=(t,e=!0)=>{if(!t)throw new Error('Invalid "node" parameter');const n=[];return t.descendants((r,o)=>{if(n.push({node:r,pos:o}),!e)return!1}),n},ex=(t,e,n)=>{if(t){if(!e)throw new Error('Invalid "predicate" parameter')}else throw new Error('Invalid "node" parameter');return Q2(t,n).filter(r=>e(r.node))},tx=(t,e)=>ex(t,n=>n.isInline,e),XD=Object.freeze(Object.defineProperty({__proto__:null,findChildren:ex,findInlineNodes:tx,findMarkPosition:JD,flatten:Q2},Symbol.toStringTag,{value:"Module"})),Nf=(t,e=null)=>{const n=[],r=tx(t.doc);return r.length?(r.forEach(({node:o,pos:i})=>{const{marks:s}=o,a=[It,ut,vt];s.length>0&&s.forEach(l=>{a.includes(l.type.name)&&n.push({mark:l,from:i,to:i+o.nodeSize})})}),e?n.filter(({mark:o})=>o.attrs.id===e):n):n},gt=new Ge("TrackChangesBase"),YD=(t={})=>new Ue({key:gt,state:{init(e,n){return{isTrackChangesActive:!1,onlyOriginalShown:!1,onlyModifiedShown:!1,decorations:Do(n,!1,!1)}},apply(e,n,r,o){const i=e.getMeta(gt);return i?i.type==="TRACK_CHANGES_ENABLE"?{...n,isTrackChangesActive:i.value===!0,decorations:Do(o,n.onlyOriginalShown,n.onlyModifiedShown)}:i.type==="SHOW_ONLY_ORIGINAL"?{...n,onlyOriginalShown:i.value===!0,onlyModifiedShown:!1,decorations:Do(o,i.value===!0,!1)}:i.type==="SHOW_ONLY_MODIFIED"?{...n,onlyOriginalShown:!1,onlyModifiedShown:i.value===!0,decorations:Do(o,!1,i.value===!0)}:{...n,decorations:Do(o,n.onlyOriginalShown,n.onlyModifiedShown)}:{...n,decorations:Do(o,n.onlyOriginalShown,n.onlyModifiedShown)}}},props:{decorations(e){return this.getState(e)?.decorations}}}),Do=(t,e,n)=>{if(!t.doc||!t.doc.nodeSize||n&&e)return De.empty;const r=[],o=Nf(t);return o.length?(o.forEach(({mark:i,from:s,to:a})=>{if(i.type.name===It)if(e){const l=Le.inline(s,a,{class:"track-insert-dec hidden"});r.push(l)}else if(n){const l=Le.inline(s,a,{class:"track-insert-dec normal"});r.push(l)}else{const l=Le.inline(s,a,{class:"track-insert-dec highlighted"});r.push(l)}if(i.type.name===ut)if(e){const l=Le.inline(s,a,{class:"track-delete-dec normal"});r.push(l)}else if(n){const l=Le.inline(s,a,{class:"track-delete-dec hidden"});r.push(l)}else{const l=Le.inline(s,a,{class:"track-delete-dec highlighted"});r.push(l);const c=Le.widget(s,()=>{const u=document.createElement("span");return u.classList.add("track-delete-widget"),u.contentEditable=!1,u},{ignoreSelection:!0});r.push(c)}if(i.type.name===vt)if(e){const l=Le.inline(s,a,{class:"track-format-dec before"});r.push(l)}else if(n){const l=Le.inline(s,a,{class:"track-format-dec normal"});r.push(l)}else{const l=Le.inline(s,a,{class:"track-format-dec highlighted"});r.push(l)}}),De.create(t.doc,r)):De.empty},an="commentMark",Ry=({commentId:t,state:e,tr:n,dispatch:r})=>{ZD(t,e.doc).forEach(({from:o,to:i})=>{n.removeMark(o,i,e.schema.marks[an])}),r(n)},ZD=(t,e)=>{const n=[];return e.descendants((r,o)=>{const{marks:i}=r,s=i.find(a=>a.type.name===an);if(s){const{attrs:a}=s,{commentId:l}=a;t===l&&n.push({from:o,to:o+r.nodeSize})}}),n},QD=(t,e,n,r=[])=>{const o=[],i=[],s=new Set;return t.descendants((a,l)=>{(a.marks?.filter(c=>c.type.name===an)).forEach(c=>{if(c){const{attrs:u={}}=c,{commentId:d}=u;if(d==="pending"||s.has(d))return;s.add(d);const p=By(c.attrs),f=n.nodes.commentRangeStart.create(p);o.push({pos:l,node:f});const h=n.nodes.commentRangeEnd.create(p);i.push({pos:l+a.nodeSize,node:h});const m=d;m&&r.filter(y=>y.parentCommentId===m).sort((y,g)=>y.createdTime-g.createdTime).forEach(y=>{const g=By(y),v=n.nodes.commentRangeStart.create(g);s.add(y.commentId),o.push({pos:l,node:v});const k=n.nodes.commentRangeEnd.create(g);i.push({pos:l+a.nodeSize,node:k})})}})}),o.forEach(a=>{const{pos:l,node:c}=a,u=e.mapping.map(l);e.insert(u,c)}),i.forEach(a=>{const{pos:l,node:c}=a,u=e.mapping.map(l);e.insert(u,c)}),e},By=t=>{const{commentId:e,internal:n}=t;return{"w:id":e,internal:n}},e_=(t,e,n,r)=>{const o=[],i=[];t.descendants((s,a)=>{const{type:l}=s;if(!["commentRangeStart","commentRangeEnd","commentReference"].includes(l.name))return;const c=r.comments?.find(d=>d.importedId==s.attrs["w:id"])||{},{commentId:u}=c;if(u)if(l.name==="commentRangeStart")o.push({"w:id":u,importedId:s.attrs["w:id"],internal:!1,start:a}),i.push({start:a,end:a+1});else if(l.name==="commentRangeEnd"){const d=o.find(h=>h.importedId===s.attrs["w:id"]);if(!d)return;const{start:p}=d,f={commentId:u,importedId:s.attrs["w:id"],internal:d.internal};e.addMark(p,a+1,n.marks[an].create(f)),i.push({start:a,end:a+1})}else l.name==="commentReference"&&i.push({start:a,end:a+1})}),i.sort((s,a)=>a.start-s.start).forEach(({start:s,end:a})=>{e.delete(s,a)})},t_=(t={})=>{const{before:e=[],after:n=[]}=t,r=new Set(e.map(h=>h.type)),o=new Set(n.map(h=>h.type)),i=[...o].filter(h=>!r.has(h)),s=[...r].filter(h=>!o.has(h)),a=[],l=i.filter(h=>!["textStyle","commentMark"].includes(h));l.length&&a.push(`Added formatting: ${l.join(", ")}`);const c=s.filter(h=>!["textStyle","commentMark"].includes(h));c.length&&a.push(`Removed formatting: ${c.join(", ")}`);const u=e.find(h=>h.type==="textStyle")?.attrs||{},d=n.find(h=>h.type==="textStyle")?.attrs||{},p=[],f=h=>h.replace(/([a-z])([A-Z])/g,"$1 $2").toLowerCase();return Object.keys({...u,...d}).forEach(h=>{const m=u[h],y=d[h];if(m!==y){if(y===null)return;if(h==="color")p.push("Changed color");else{const g=f(h);m==null?p.push(`Set ${g} to ${y}`):p.push(`Changed ${g} from ${m} to ${y}`)}}}),p.length&&a.push(`Modified text style: ${p.join(", ")}`),a.length?a.join(". "):"No formatting changes."},n_=({activeThreadId:t,threadId:e,isInternal:n,editor:r})=>{if(!r.options.isInternal&&n)return"transparent";const o=bt.getState(r.state),i=n?o.internalColor:o.externalColor,s=t==e?"44":"22";return`${i}${s}`},_r=new Ge("paginationPlugin"),r_=async t=>{if(!t.converter)return;const e={headers:{},footers:{}},n=t.converter.headerIds.ids,r=t.converter.footerIds.ids;for(let o in n){const i=n[o];if(!i)continue;const s=t.converter.headers[i];e.headers[i]||(e.headers[i]={}),e.headers[i].data=s;const{height:a,sectionEditor:l,sectionContainer:c}=await Ly(t,s);e.headers[i].height=a,e.headers[i].sectionEditor=l,e.headers[i].sectionContainer=c}for(let o in r){const i=r[o];if(!i)continue;const s=t.converter.footers[i];e.headers[i]||(e.footers[i]={}),e.footers[i].data=s;const{height:a,sectionEditor:l,sectionContainer:c}=await Ly(t,s);e.footers[i].height=a,e.footers[i].sectionEditor=l,e.footers[i].sectionContainer=c}return e},Ly=async(t,e)=>e?new Promise(n=>{const r=document.createElement("div");r.className="super-editor",r.style.padding="0",r.style.margin="0";const o=lc({editor:t,data:e,editorContainer:r});o.on("create",()=>{o.setEditable(!1,!1),requestAnimationFrame(()=>{const i=r.offsetHeight;document.body.removeChild(r),n({height:i,sectionEditor:o,sectionContainer:r})})})}):{},lc=({editor:t,data:e,editorContainer:n,appendToBody:r=!0,sectionId:o,type:i,availableHeight:s})=>{const a=t.converter.getDocumentDefaultStyles(),{fontSizePt:l,typeface:c}=a,u=l*1.3333,d=u*1.2;Object.assign(n.style,{padding:"0",margin:"0",border:"none",boxSizing:"border-box",position:"absolute",top:"0",left:"0",width:"auto",maxWidth:"none",fontFamily:c,fontSize:`${u}px`,lineHeight:`${d}px`}),Object.assign(n.style,{padding:"0",margin:"0",border:"none",boxSizing:"border-box",height:s+"px",overflow:"hidden"}),r&&document.body.appendChild(n);const p=new $s({loadFromSchema:!0,mode:"docx",element:n,content:e,extensions:Gf(),documentId:o||"sectionId",media:t.options.media,mediaFiles:t.options.mediaFiles,fonts:t.options.fonts,isHeaderOrFooter:!0,annotations:!0,onCreate:h=>o_(h,t),onBlur:h=>rx(h,t,o,i)}),f=n.querySelector(".ProseMirror");return f.style.maxHeight="100%",f.style.minHeight="100%",f.style.overflow="auto",f.style.outline="none",f.style.border="none",p},nx=(t,e)=>{["fieldAnnotationDropped","fieldAnnotationPaste","fieldAnnotationSelected","fieldAnnotationClicked","fieldAnnotationDoubleClicked","fieldAnnotationDeleted"].forEach(n=>{e.on(n,(...r)=>{t.emit(n,...r),console.debug("broadcastEditorEvents",{eventName:n,args:r})})})},Ml=(t,e,n)=>{t.converter.headerEditors.forEach(r=>{r.editor.setEditable(n,!1)}),t.converter.footerEditors.forEach(r=>{r.editor.setEditable(n,!1)}),n&&document.querySelector(".ProseMirror").classList.add("header-footer-edit"),e&&e.view.focus()},rx=async({editor:t,transaction:e},n,r,o)=>{if(!o||!r)return;const i=t.getUpdatedJson();n.converter[`${o}Editors`].forEach(s=>{s.id===r&&(s.editor.setOptions({media:t.options.media,mediaFiles:t.options.mediaFiles}),s.editor.replaceContent(i)),s.editor.setOptions({lastSelection:e?.selection})}),n.converter[`${o}s`][r]=i,await i_(n)},o_=({editor:t},e)=>{t.setToolbar(e.toolbar)},i_=async t=>{if(!t.options.ydoc)return;const e=t.options.ydoc.getMap("meta"),n=[...e.get("docx")],r=await t.exportDocx({getUpdatedDocs:!0});Object.keys(r).forEach(o=>{if(o.includes("header")||o.includes("footer")){const i=n.findIndex(s=>s.name===o);if(i===-1)return;n.splice(i,1),n.push({name:o,content:r[o]})}}),t.options.ydoc.transact(()=>{e.set("docx",n)})},If=[It,ut,vt],bt=new Ge("comments"),s_=Ye.create({name:"comments",addCommands(){return{insertComment:t=>({tr:e,dispatch:n,state:r})=>{const{selection:o}=e,{$from:i,$to:s}=o,{commentId:a,isInternal:l}=t;return e.setMeta(bt,{event:"add"}),e.addMark(i.pos,s.pos,this.editor.schema.marks[an].create({commentId:a,internal:l})),n(e),!0},removeComment:({commentId:t,importedId:e})=>({tr:n,dispatch:r,state:o})=>{n.setMeta(bt,{event:"deleted"}),Ry({commentId:t,state:o,tr:n,dispatch:r})},setActiveComment:({commentId:t})=>({tr:e,dispatch:n})=>{let r=t;return e.setMeta(bt,{type:"setActiveComment",activeThreadId:r}),!0},setCommentInternal:({commentId:t,isInternal:e})=>({tr:n,dispatch:r,state:o})=>{const{doc:i}=o;let s,a;return n.setMeta(bt,{event:"update"}),i.descendants((l,c)=>{if(s)return;const{marks:u=[]}=l,d=u.find(p=>p.type.name===an);if(d){const{attrs:p}=d;p.commentId===t&&(s=l,a=c)}}),s?(n.addMark(a,a+s.nodeSize,this.editor.schema.marks[an].create({commentId:t,internal:e})),n.setMeta(bt,{type:"setCommentInternal"}),r(n),!0):!1},resolveComment:({commentId:t})=>({tr:e,dispatch:n,state:r})=>{e.setMeta(bt,{event:"update"}),Ry({commentId:t,state:r,tr:e,dispatch:n})}}},addPmPlugins(){const t=this.editor;let e,n;return t.options.isHeadless?[]:[new Ue({key:bt,state:{init(){return{activeThreadId:null,externalColor:"#B1124B",internalColor:"#078383",decorations:De.empty,allCommentPositions:{},allCommentIds:[],changedActiveThread:!1,trackedChanges:{}}},apply(r,o,i,s){const a=r.getMeta(_r)?.isReadyToInit;a&&(e=!0);const l=r.getMeta(bt),{type:c}=l||{};if(c==="force"&&(e=!0),!a&&!e&&l&&l.decorations)return{...o,decorations:l.decorations,allCommentPositions:l.allCommentPositions};const u=r.getMeta(gt),d=o.trackedChanges;u&&(o.trackedChanges=l_(u,d,s,t));const p=l?.type==="setActiveComment";if(!r.docChanged&&r.selectionSet||p){const{selection:f}=r;let h=a_(s.doc,f);if(p&&(h=l.activeThreadId),n!==h){n=h;const m={type:qa.SELECTED,activeCommentId:n||null};e=!0,t.emit("commentsUpdate",m);const{tr:y}=t.view.state,{dispatch:g}=t.view;y.setMeta(bt,{type:"force"}),g(y)}}return o}},props:{decorations(r){return this.getState(r).decorations}},view(r){let o;return{update(i,s){const{state:a}=i,{doc:l,tr:c}=a;if(o&&!o.eq(l)&&(e=!0),!e)return;o=l,e=!1;const u=[],d={};l.descendants((f,h)=>{const{marks:m=[]}=f,y=m.filter(k=>k.type.name===an);let g=!1;y.forEach(k=>{const{attrs:b}=k,C=b.commentId||b.importedId,D=i.coordsAtPos(h);Py({allCommentPositions:d,threadId:C,pos:h,currentBounds:D,node:f});const M=b.internal;g||(g=n===C);let I=n_({activeThreadId:n,threadId:C,isInternal:M,editor:t});const E=Le.inline(h,h+f.nodeSize,{style:`background-color: ${I};`,"data-thread-id":C,class:"sd-editor-comment-highlight"});g&&n!==C||u.push(E)});const v=ox({doc:l,from:h,to:h+f.nodeSize});if(v){const k=i.coordsAtPos(h),{id:b}=v.mark.attrs;Py({allCommentPositions:d,threadId:b,pos:h,currentBounds:k,node:f})}});const p=De.create(l,u);if(!bt.getState(a).decorations.eq(p)){const f=a.tr.setMeta(bt,{decorations:p,allCommentPositions:d});i.dispatch(f)}t.emit("comment-positions",{allCommentPositions:d})}}}})]}}),Py=({allCommentPositions:t,threadId:e,pos:n,currentBounds:r,node:o})=>{let i={};if(r instanceof DOMRect?i={top:r.top,bottom:r.bottom,left:r.left,right:r.right}:i={...r},!t[e])t[e]={threadId:e,start:n,end:n+o.nodeSize,bounds:i};else{const s=t[e];s.start=Math.min(s.start,n),s.end=Math.max(s.end,n+o.nodeSize),s.bounds.top=Math.min(s.bounds.top,r.top),s.bounds.bottom=Math.max(s.bounds.bottom,r.bottom)}},a_=(t,e)=>{if(!e)return;const{$from:n,$to:r}=e;if(n.pos!==r.pos||!t.nodeAt(n.pos))return;const o=ox({doc:t,from:n.pos,to:r.pos});if(o)return o.mark.attrs.id;const i=[];let s=!1;t.descendants((d,p)=>{if(s)return;const f=p+d.nodeSize;if(n.pos<p||n.pos>=f)return;const{marks:h=[]}=d;h.find(m=>m.type.name===an)&&i.push({node:d,pos:p,size:d.nodeSize}),p>n.pos&&(s=!0)});let a=null,l=null;i.forEach(({pos:d,node:p})=>{a||(a=n.pos-d);const f=n.pos-d;f>=0&&f<=a&&(l=p,a=f)});const{marks:c=[]}=l||{},u=c.find(d=>d.type.name===an);return u?.attrs?.commentId||u?.attrs?.importedId},ox=({doc:t,from:e,to:n,offset:r=1})=>{const o=Math.max(e-r,0),i=Math.min(n+r,t.content.size);let s;return t.nodesBetween(o,i,(a,l)=>{if(!a||a?.nodeSize===void 0)return;const c=a.marks.find(u=>If.includes(u.type.name));c&&!s&&(s={from:l,to:l+a.nodeSize,mark:c})}),s},l_=(t,e,n,r)=>{const{insertedMark:o,deletionMark:i,formatMark:s,deletionNodes:a}=t;if(!o&&!i&&!s)return;const l={...e};let c=o?.attrs?.id||i?.attrs?.id||s?.attrs?.id;if(!c)return e;let u=!1;l[c]||(l[c]={},u=!0),o&&(l[c].insertion=c),i&&(l[c].deletion=i.attrs?.id),s&&(l[c].format=s.attrs?.id);const{step:d}=t;let p=d?.slice?.content?.content||[];p.length||n.doc.descendants((h,m)=>{if(h.marks.find(y=>y.type.name===vt))return p=[h],!1});const f=u_({documentId:r.options.documentId,event:u?"add":"update",marks:{insertedMark:o,deletionMark:i,formatMark:s},deletionNodes:a,nodes:p,newEditorState:n});return f&&r.emit("commentsUpdate",f),l},c_=({state:t,node:e,mark:n,marks:r,trackedChangeType:o,isDeletionInsertion:i,deletionNodes:s=[]})=>{let a="",l="";if(o===It&&(a=e?.text??""),o===vt&&(a=t_(n.attrs)),(o===ut||i)&&(l=e?.text??"",i)){let{id:c}=r.deletionMark.attrs;l=d_(t.doc,u=>{const{marks:d=[]}=u,p=d.filter(f=>If.includes(f.type.name));if(!p.length)return!1;if(p.find(f=>f.attrs.id===c))return!0})?.node.text??""}return{deletionText:l,trackedChangeText:a}},u_=({event:t,marks:e,deletionNodes:n,nodes:r,newEditorState:o,documentId:i})=>{const s=e.insertedMark||e.deletionMark||e.formatMark,{type:a,attrs:l}=s,{name:c}=a,{author:u,authorEmail:d,date:p}=l,f=l.id,h=r[0],m=!!(e.insertedMark&&e.deletionMark);let y;o.doc.descendants((b,C)=>{const{marks:D=[]}=b,M=D.filter(I=>If.includes(I.type.name));if(M.length&&(M.find(I=>I.attrs.id===f)&&(y=b),y))return!1});const{deletionText:g,trackedChangeText:v}=c_({state:o,node:y||h,mark:s,marks:e,trackedChangeType:c,isDeletionInsertion:m,deletionNodes:n});if(!g&&!v)return;const k={event:qa.ADD,type:"trackedChange",documentId:i,changeId:f,trackedChangeType:m?"both":c,trackedChangeText:v,deletedText:e.deletionMark?g:null,author:u,authorEmail:d,date:p};return t==="add"?k.event=qa.ADD:t==="update"&&(k.event=qa.UPDATE),k};function d_(t,e){let n=null;return t.descendants((r,o)=>{if(e(r)&&(n={node:r,pos:o}),n)return!1}),n}const ix=({state:t,tr:e,step:n,newTr:r,map:o,doc:i,user:s,date:a,originalStep:l,originalStepIndex:c})=>{const u=t.schema.marks[ut],d=nc(t,u,!1),p=d?d.to:n.to,f=new Tt(p,p,n.slice,n.structure),h=l.invert(e.docs[c]).map(o);o.appendMap(h.getMap());const m={};if(f){const y=t.apply(r).tr;if(y.maybeStep(f).failed)return;const g=f.getMap().map(f.to),v=Y2({tr:y,from:f.from,to:g,user:s,date:a}),k=new Tt(f.from,f.to,y.doc.slice(f.from,g));r.step(k);const b=o.maps.length-1;o.appendMap(k.getMap(),b),f.from!==g&&(m.insertedMark=v,m.step=k),r.selection.eq(y.selection)||r.setSelection(y.selection)}if(n.from!==n.to){const{deletionMark:y,deletionMap:g,nodes:v}=Z2({tr:r,from:n.from,to:n.to,user:s,date:a});m.deletionNodes=v,m.deletionMark=y,o.appendMapping(g)}r.setMeta(gt,m),r.setMeta(bt,{type:"force"})},p_=()=>{},f_=()=>{},sx=({state:t,tr:e,step:n,newTr:r,map:o,doc:i,user:s,date:a})=>{const l={};i.nodesBetween(n.from,n.to,(c,u)=>{if(!c.isInline)return;if(c.marks.find(f=>f.type.name===ut))return!1;const d=c.marks.find(f=>[ut,vt].includes(f.type.name)),p=d?d.attrs.id:Lr();if(r.addMark(Math.max(n.from,u),Math.min(n.to,u+c.nodeSize),n.mark),["bold","italic","strike","underline","textStyle"].includes(n.mark.type.name)&&!c.marks.find(f=>f.type===n.mark.type)){const f=c.marks.find(y=>y.type.name===vt);let h=[],m=[];if(f?f.attrs.before.find(y=>y.type==="textStyle"?y.type===n.mark.type.name&&oi(y.attrs,n.mark.attrs):y.type===n.mark.type.name)?(m=[...f.attrs.before.filter(y=>y.type!==n.mark.type.name)],h=[...f.attrs.after]):(m=[...f.attrs.before],h=[...f.attrs.after,{type:n.mark.type.name,attrs:{...n.mark.attrs}}]):(m=c.marks.map(y=>({type:y.type.name,attrs:{...y.attrs}})),h=[{type:n.mark.type.name,attrs:{...n.mark.attrs}}]),h.length||m.length){const y=t.schema.marks[vt].create({id:p,author:s.name,authorEmail:s.email,date:a,before:m,after:h});r.addMark(n.from,n.to,y),l.formatMark=y,l.step=n,r.setMeta(gt,l),r.setMeta(bt,{type:"force"})}else f&&r.removeMark(Math.max(n.from,u),Math.min(n.to,u+c.nodeSize),f)}})},ax=({state:t,tr:e,step:n,newTr:r,map:o,doc:i,user:s,date:a})=>{const l={};i.nodesBetween(n.from,n.to,(c,u)=>{if(!c.isInline)return!0;if(c.marks.find(d=>d.type.name===ut))return!1;if(r.removeMark(Math.max(n.from,u),Math.min(n.to,u+c.nodeSize),n.mark),["bold","italic","strike","underline","textStyle"].includes(n.mark.type.name)&&c.marks.find(d=>d.type===n.mark.type)){const d=c.marks.find(h=>h.type.name===vt);let p=[],f=[];if(d?d.attrs.after.find(h=>h.type===n.mark.type.name)?(p=[...d.attrs.after.filter(h=>h.type!==n.mark.type.name)],f=[...d.attrs.before]):(p=[...d.attrs.after],f=[...d.attrs.before,{type:n.mark.type.name,attrs:{...n.mark.attrs}}]):(p=[],f=[{type:n.mark.type.name,attrs:{...n.mark.attrs}}]),p.length||f.length){const h=t.schema.marks[vt].create({id:Lr(),author:s.name,authorEmail:s.email,date:a,before:f,after:p});r.addMark(Math.max(n.from,u),Math.min(n.to,u+c.nodeSize),h),l.formatMark=h,l.step=n,r.setMeta(gt,l),r.setMeta(bt,{type:"force"})}else d&&r.removeMark(Math.max(n.from,u),Math.min(n.to,u+c.nodeSize),d)}})},lx=({tr:t,state:e,user:n})=>{const r=["inputType","uiEvent","paste","pointer"],o=["historyUndo","historyRedo","acceptReject"];if(!t.steps.length||t.meta&&!Object.keys(t.meta).every(c=>r.includes(c))||o.includes(t.getMeta("inputType"))||t.getMeta(bt))return t;const i=e.tr,s=new ni,a=Math.floor(Date.now()/6e5)*6e5,l=new Date(a).toISOString();if(t.steps.forEach((c,u)=>{const d=c.map(s),{doc:p}=i;d&&(d instanceof Tt?(ix({state:e,tr:t,step:d,newTr:i,map:s,doc:p,user:n,date:l,originalStep:c,originalStepIndex:u}),console.debug("[track-changes]: replaceStep")):d instanceof Vs?(sx({state:e,tr:t,step:d,newTr:i,map:s,doc:p,user:n,date:l}),console.debug("[track-changes]: addMarkStep")):d instanceof vn?(ax({state:e,tr:t,step:d,newTr:i,map:s,doc:p,user:n,date:l}),console.debug("[track-changes]: removeMarkStep")):(i.step(d),console.log("[track-changes]: otherStep")))}),t.getMeta("inputType")&&i.setMeta(t.getMeta("inputType")),t.getMeta("uiEvent")&&i.setMeta(t.getMeta("uiEvent")),t.selectionSet){const c=e.schema.marks[ut],u=nc(e,c,!1);if(t.selection instanceof Pe&&(t.selection.from<e.selection.from||t.getMeta("inputType")==="deleteContentBackward")){const d=s.map(t.selection.from,-1);i.setSelection(new Pe(i.doc.resolve(d)))}else if(t.selection.from>e.selection.from&&u){const d=s.map(u.to+1,1);i.setSelection(new Pe(i.doc.resolve(d)))}else i.setSelection(t.selection.map(i.doc,s))}else if(e.selection.from-t.selection.from>1&&t.selection.$head.depth>1){const c=s.map(t.selection.from-2,-1);i.setSelection(new Pe(i.doc.resolve(c)))}return t.storedMarksSet&&i.setStoredMarks(t.storedMarks),t.scrolledIntoView&&i.scrollIntoView(),i},h_=t=>{const{state:e}=t,{dispatch:n}=t.view,{tr:r}=e;if(n)return e.doc.descendants((o,i)=>{if(o.type.name==="paragraph"){const{attrs:s}=o,{spacing:a}=s;if(!a)return;const l={line:Jo(at(a.line)),lineSpaceBefore:Jo(at(a.lineSpaceBefore)),lineSpaceAfter:Jo(at(a.lineSpaceAfter))};r.setNodeMarkup(i,void 0,{...s,spacing:{...a,...l}})}}),n(r),!0},m_={initial:h_},zy=t=>{if(t==="initial"||t==="0.4.14")return Object.values(m_)},Ff=(t,e,n)=>{const{type:r}=t.attrs,o={html:g_,text:y_,checkbox:b_,image:w_,link:x_,yesno:k_,date:v_}[r];return o?o(e,n):{}},g_=t=>({rawHtml:t}),y_=t=>({displayLabel:t}),w_=t=>({imageSrc:t}),b_=t=>({displayLabel:t}),v_=(t,e)=>({displayLabel:E_(t,e.input_format)}),x_=t=>(t.startsWith("http")||(t=`http://${t}`),{linkUrl:t}),k_=t=>({displayLabel:{YES:"Yes",NO:"No"}[t[0].toUpperCase()]}),S_=({state:t,tr:e,annotationValues:n})=>{const{doc:r}=t,o=[];return r.descendants((i,s)=>{i.type.name==="table"&&o.push({node:i,pos:s})}),o.reverse().forEach(({pos:i})=>{const s=e.doc.nodeAt(i);!s||s.type.name!=="table"||A_({tableNode:{node:s,pos:i},annotationValues:n,tr:e,state:t})}),e},A_=({tableNode:t,annotationValues:e,tr:n,state:r})=>{let o=null,i=null;const{tableRow:s,tableCell:a,fieldAnnotation:l,paragraph:c}=r.schema.nodes;if(t.node.descendants((v,k)=>{if(o)return!0;if(v.type===s&&(i={node:v,pos:k}),v.type===l){const b=Pu(v.attrs.fieldId,e);Array.isArray(b)&&v.attrs.generatorIndex===null&&(o=i)}}),!o)return;const{node:u,pos:d}=o,p=n.mapping.map(t.pos+d),f=p+u.nodeSize;let h=0;if(u.descendants((v,k)=>{if(v.type===l){const b=Pu(v.attrs.fieldId,e);Array.isArray(b)&&(h=Math.max(h,b.length))}}),h<=1)return;const m=(v,k)=>{const b=v.content.content.map(C=>{if(C.type!==c)return C;const D=C.content.content.map(M=>{if(M.type!==l)return M;let I=Pu(M.attrs.fieldId,e);Array.isArray(I)||(I=[I]);const E=I?.[k],G=Ff(M,E);return l.create({...M.attrs,...G,generatorIndex:k},M.content,M.marks)});return c.create(C.attrs,ye.from(D),C.marks)});return a.create(v.attrs,ye.from(b),v.marks)};for(let v=h-1;v>=0;v--){const k=n.mapping.map(f)+1,b=u.content.content.map(D=>m(D,v)),C=s.create(u.attrs,ye.from(b),u.marks);n.insert(k,ye.from(C))}const y=n.mapping.map(p),g=y+u.nodeSize;n.delete(y-1,g+1)},Pu=(t,e)=>e.find(n=>n.input_id===t)?.input_value||null,cx=({editor:t,annotationValues:e=[],hiddenFieldIds:n=[]})=>{const r={header:t.converter.headers||{},footer:t.converter.footers||{}};Object.entries(r).forEach(([o,i])=>{const s=`${o}Editors`;Object.entries(i).forEach(([a,l])=>{let c=t.converter[s][a];c||(c={id:a,editor:lc({editor:t,data:l,editorContainer:document.createElement("div"),appendToBody:!1,sectionId:a,type:o})},t.converter[s].push(c)),c.editor.annotate(e,n),rx({editor:c.editor},t,a,o)})})},C_=({annotationValues:t=[],hiddenFieldIds:e=[],schema:n,tr:r,editor:o})=>{cx({editor:o,annotationValues:t,hiddenFieldIds:e});const i=[],s=n.nodes.fieldAnnotation;r.doc.descendants((l,c)=>{l.type===s&&i.push({node:l,pos:c,size:l.nodeSize})});const a=new Set;if(e.length)for(const{node:l,pos:c}of i)e.includes(l.attrs.fieldId)&&a.add(c);for(const{node:l,pos:c}of i){const{type:u,fieldType:d,fieldId:p}=l.attrs;if(a.has(c))continue;let f=null;const h=t.find(m=>m.input_id===p);if(!h){const m=t.filter(y=>y.input_field_type==="CHECKBOXINPUT");e:for(const y of m)for(const g of y.input_options)if(g.itemid===p){f=y.input_link_value[g.itemid]||" ";break e}}if(f=f||h?.input_value||null,!(Array.isArray(f)&&l.attrs.generatorIndex!=null))if((u==="checkbox"||d==="CHECKBOXINPUT")&&(!f||typeof f=="string"&&f.codePointAt(0)===9744)&&(f=" "),!f)a.add(c);else{const m=Ff(l,f,h);r=r.setNodeMarkup(c,void 0,{...l.attrs,...m})}}return Array.from(a).sort((l,c)=>c-l).forEach(l=>{const c=i.find(u=>u.pos===l);c&&(r=r.delete(l,l+c.node.nodeSize))}),r},E_=(t=null,e="")=>{const n=t?new Date(t):new Date;return isNaN(n.getTime())?t:e?dateFormat(n,e):n.toLocaleDateString("en-US",{month:"short",day:"2-digit",year:"numeric"})},da={getFieldAttrs:Ff,processTables:S_,annotateDocument:C_,annotateHeadersAndFooters:cx},T_=new Ge("collaboration"),$_=Ye.create({name:"collaboration",priority:1e3,addOptions(){return{ydoc:null,field:"supereditor",fragment:null,isReady:!1}},addPmPlugins(){if(!this.editor.options.ydoc)return[];this.options.ydoc=this.editor.options.ydoc;const t=M_();D_(this.options.ydoc,this.editor),__(this.options.ydoc,this.editor,this);const[e,n]=O_(this.options.ydoc,this.editor);this.options.fragment=n;const r=this.options.ydoc.getMap("media");return r.observe(o=>{o.changes.keys.forEach((i,s)=>{if(!(s in this.editor.storage.image.media)){const a=r.get(s);this.editor.storage.image.media[s]=a}})}),[e,t]},addCommands(){return{undo:()=>({tr:t,state:e,dispatch:n})=>(t.setMeta("preventDispatch",!0),t.setMeta("inputType","historyUndo"),Dr.getState(e).undoManager.undoStack.length===0?!1:n?wD(e):!0),redo:()=>({tr:t,state:e,dispatch:n})=>(t.setMeta("preventDispatch",!0),t.setMeta("inputType","historyRedo"),Dr.getState(e).undoManager.redoStack.length===0?!1:n?bD(e):!0),addImageToCollaboration:({mediaPath:t,fileData:e})=>()=>{this.options.ydoc&&this.options.ydoc.getMap("media").set(t,e)}}},addShortcuts(){return{"Mod-z":()=>this.editor.commands.undo(),"Mod-Shift-z":()=>this.editor.commands.redo(),"Mod-y":()=>this.editor.commands.redo()}}}),O_=(t,e)=>{const n=t.getXmlFragment("supereditor");return[XM(n,{onFirstRender:()=>{e.options.isNewFile&&ux(t,e)}}),n]},ux=(t,e)=>{const n=t.getMap("meta");n.set("docx",e.options.content),n.set("fonts",e.options.fonts)},M_=()=>kD(),D_=(t,e)=>{const n=t.getMap("meta");n.observe(r=>{const o=n.get("lockedBy"),i=n.get("locked");if(!e.options.user||!o)return;const s=o?.email!==e.options.user?.email,a=e.options.editable!==!i;!s||!a||(i?console.debug("--- Locking editor ---",o,e.options.user):console.debug("--- Unlocking editor ---",o),e.setEditable(!i),e.emit("locked",{editor:e,isLocked:i,lockedBy:o}))})},__=(t,e,n)=>{const r=e.options.collaborationProvider;if(!r)return;const o=()=>{n.options.isReady=!0,r.off("synced",o),e.emit("collaborationReady",{editor:e,ydoc:t})};if(r.synced){setTimeout(()=>{o()},250);return}r.on("synced",o)},N_=t=>{const e=dD(t.state.doc,"supereditor");return ux(e,t),Yr.encodeStateAsUpdate(e)};var Wo,dx,Ie,px,fx,up,zu,hx,Wa,dp,ju,qu,ss,Dl,jy,Vu,Ga,Ka,Uu,qy,Wi,Gi,Vy,Hu,pp,mx;const I_=class gx extends SD{constructor(e){super(),$r(this,Ie),$r(this,Wo),Re(this,"extensionService"),Re(this,"extensionStorage",{}),Re(this,"schema"),Re(this,"view"),Re(this,"isFocused",!1),$r(this,dx),Re(this,"options",{element:null,selector:null,isHeadless:!1,mockDocument:null,mockWindow:null,content:"",user:null,users:[],media:{},mediaFiles:{},fonts:{},documentMode:"editing",mode:"docx",role:"editor",colors:[],converter:null,fileSource:null,initialState:null,documentId:null,extensions:[],editable:!0,editorProps:{},parseOptions:{},coreExtensionOptions:{},enableInputRules:!0,isCommentsEnabled:!1,isNewFile:!1,scale:1,annotations:!1,isInternal:!1,externalExtensions:[],numbering:{},isHeaderOrFooter:!1,lastSelection:null,htmlOverride:!1,onBeforeCreate:()=>null,onCreate:()=>null,onUpdate:()=>null,onSelectionUpdate:()=>null,onTransaction:()=>null,onFocus:()=>null,onBlur:()=>null,onDestroy:()=>null,onContentError:({error:r})=>{throw r},onTrackedChangesUpdate:()=>null,onCommentsUpdate:()=>null,onCommentsLoaded:()=>null,onCommentClicked:()=>null,onCommentLocationsUpdate:()=>null,onDocumentLocked:()=>null,onFirstRender:()=>null,onCollaborationReady:()=>null,onPaginationUpdate:()=>null,onException:()=>null,handleImageUpload:null,telemetry:null}),Ae(this,Ie,px).call(this,e),Ae(this,Ie,hx).call(this,e),this.setOptions(e);let n={docx:()=>Ae(this,Ie,fx).call(this,this.options),text:()=>Ae(this,Ie,up).call(this,this.options),html:()=>Ae(this,Ie,up).call(this,this.options),default:()=>{console.log("Not implemented.")}};(n[this.options.mode]??n.default)()}setToolbar(e){this.toolbar=e}focus(){this.view?.focus()}get state(){return this.view?.state}get storage(){return this.extensionStorage}get commands(){return Xn(this,Wo)?.commands}get isEditable(){return this.options.editable&&this.view&&this.view.editable}get isDestroyed(){return this.view.isDestroyed}get element(){return this.options.element}get users(){return this.options.users}chain(){return Xn(this,Wo).chain()}can(){return Xn(this,Wo).can()}setDocumentMode(e){let n=e?.toLowerCase()||"editing";this.extensionService&&(this.options.role==="viewer"&&(n="viewing"),this.options.role==="suggester"&&n==="editing"&&(n="suggesting"),n==="viewing"?(this.commands.toggleTrackChangesShowOriginal(),this.setEditable(!1,!1),this.setOptions({documentMode:"viewing"}),Ml(this,null,!1)):n==="suggesting"?(Ae(this,Ie,dp).call(this,"TrackChangesBase"),this.commands.disableTrackChangesShowOriginal(),this.commands.enableTrackChanges(),this.setOptions({documentMode:"suggesting"}),this.setEditable(!0,!1)):n==="editing"&&(Ae(this,Ie,dp).call(this,"TrackChangesBase"),this.commands.disableTrackChangesShowOriginal(),this.commands.disableTrackChanges(),this.setEditable(!0,!1),this.setOptions({documentMode:"editing"}),Ml(this,null,!1)))}generateCollaborationUpdate(){return N_(this)}initializeCollaborationData(){if(!this.options.isNewFile||!this.options.collaborationProvider)return;const{collaborationProvider:e}=this.options,n=()=>{e.off("synced",n),Ae(this,Ie,Wa).call(this)};e.synced?Ae(this,Ie,Wa).call(this):e.on("synced",n)}replaceContent(e){this.setOptions({content:e}),Ae(this,Ie,ss).call(this),this.initDefaultStyles(),Ae(this,Ie,ss).call(this),Ae(this,Ie,Dl).call(this);const n=Ae(this,Ie,Ga).call(this),r=this.state.tr.replaceWith(0,this.state.doc.content.size,n);this.view.dispatch(r)}setOptions(e={}){if(this.options={...this.options,...e},this.options.collaborationProvider&&this.options.ydoc){const n=this.options.extensions.findIndex(r=>r.name==="history");n!==-1&&this.options.extensions.splice(n,1)}(this.options.isNewFile||!this.options.ydoc)&&this.options.isCommentsEnabled&&(this.options.shouldLoadComments=!0),!(!this.view||!this.state||this.ifsDestroyed)&&(this.options.editorProps&&this.view.setProps(this.options.editorProps),this.view.updateState(this.state))}setEditable(e=!0,n=!0){this.setOptions({editable:e}),n&&this.emit("update",{editor:this,transaction:this.state.tr})}registerPlugin(e,n){const r=typeof n=="function"?n(e,[...this.state.plugins]):[...this.state.plugins,e],o=this.state.reconfigure({plugins:r});this.view.updateState(o)}unregisterPlugin(e){if(this.isDestroyed)return;const n=typeof nameOrPluginKey=="string"?`${nameOrPluginKey}$`:nameOrPluginKey.key,r=this.state.reconfigure({plugins:this.state.plugins.filter(o=>!o.key.startsWith(n))});this.view.updateState(r)}static async loadXmlData(e,n=!1){if(!e)return;const r=new Pd,o=await r.getDocxData(e,n),i=r.media;return[o,i,r.mediaFiles,r.fonts]}static getDocumentVersion(e){return Nr.getStoredSuperdocVersion(e)}static updateDocumentVersion(e,n){return Nr.updateDocumentVersion(e,n)}createNodeViews(){this.view.setProps({nodeViews:this.extensionService.nodeViews})}getMaxContentSize(){if(!this.converter)return{};const{pageSize:e={},pageMargins:n={}}=this.converter.pageStyles??{},{width:r,height:o}=e,{top:i=0,bottom:s=0,left:a=0,right:l=0}=n;if(!r||!o)return{};const c=o*96-i*96-s*96-50;return{width:r*96-a*96-l*96-20,height:c}}initDefaultStyles(e=this.element){if(this.options.isHeadless||this.options.htmlOverride)return;const n=e?.querySelector(".ProseMirror"),{pageSize:r,pageMargins:o}=this.converter.pageStyles??{};if(!n||!r||!o)return;e.style.width=r.width+"in",e.style.minWidth=r.width+"in",e.style.minHeight=r.height+"in",e.style.paddingLeft=o.left+"in",e.style.paddingRight=o.right+"in",e.style.boxSizing="border-box",e.style.isolation="isolate",n.style.outline="none",n.style.border="none";const{typeface:i,fontSizePt:s}=this.converter.getDocumentDefaultStyles()??{};i&&(e.style.fontFamily=i),s&&(e.style.fontSize=`${s}pt`),e.style.transformOrigin="top left",e.style.touchAction="auto",e.style.webkitOverflowScrolling="touch";const a=1.2;n.style.lineHeight=a,this.options.extensions.find(l=>l.name==="pagination")||(n.style.paddingTop="1in",n.style.paddingBottom="1in"),this.initMobileStyles(e)}initMobileStyles(e){if(!e)return;const n=e.offsetWidth,r=()=>{const i=n,s=document.documentElement.clientWidth-10;this.options.scale=Math.min(1,s/i);const a=e.closest(".super-editor"),l=e.closest(".super-editor-container");!a||!l||(this.options.scale<1?(a.style.maxWidth=`${i*this.options.scale}px`,l.style.minWidth="0px",e.style.transform=`scale(${this.options.scale})`):(a.style.maxWidth="",l.style.minWidth="",e.style.transform="none"))};r();const o=()=>{setTimeout(()=>{r()},150)};"orientation"in screen&&"addEventListener"in screen.orientation?screen.orientation.addEventListener("change",o):window.matchMedia("(orientation: portrait)").addEventListener("change",o),window.addEventListener("resize",()=>o)}getAttributes(e){return Te.getAttributes(this.state,e)}isActive(e,n){const r=typeof e=="string"?e:null,o=typeof e=="string"?n:e;return Y1(this.state,r,o)}getJSON(){return this.state.doc.toJSON()}getHTML(){const e=document.createElement("div"),n=xi.fromSchema(this.schema).serializeFragment(this.state.doc.content);return e.appendChild(n),e.innerHTML}getPageStyles(){return this.converter?.pageStyles||{}}updatePageStyle({pageMargins:e}){if(!this.converter)return;let n=!1;if(e&&(this.converter.pageStyles.pageMargins=e,this.initDefaultStyles(),n=!0),n){const r=this.view.state.tr;r.setMeta("forceUpdatePagination",!0),this.view.dispatch(r)}}getUpdatedJson(){return Ae(this,Ie,pp).call(this)}async exportDocx({isFinalDoc:e=!1,commentsType:n="external",comments:r=[],getUpdatedDocs:o=!1}={}){const i=Ae(this,Ie,pp).call(this,r),s=await this.converter.exportToDocx(i,this.schema,this.storage.image.media,e,n,r,this),a=this.converter.schemaToXml(this.converter.convertedXml["docProps/custom.xml"].elements[0]),l=this.converter.schemaToXml(this.converter.convertedXml["word/styles.xml"].elements[0]),c=this.converter.schemaToXml(this.converter.convertedXml["word/settings.xml"].elements[0]),u=this.converter.schemaToXml(this.converter.convertedXml["word/_rels/document.xml.rels"].elements[0]),d=this.converter.addedMedia,p={};Object.entries(this.converter.convertedXml).forEach(([g,v])=>{if(g.includes("header")||g.includes("footer")){const k=this.converter.schemaToXml(v.elements[0]);p[g]=String(k)}});const f=this.converter.convertedXml["word/numbering.xml"],h=this.converter.schemaToXml(f.elements[0]),m={"word/document.xml":String(s),"docProps/custom.xml":String(a),"word/settings.xml":String(c),"word/_rels/document.xml.rels":String(u),"word/numbering.xml":String(h),"word/styles.xml":String(l).replace(/&/gi,"&"),...p};if(r.length){const g=this.converter.schemaToXml(this.converter.convertedXml["word/comments.xml"].elements[0]),v=this.converter.schemaToXml(this.converter.convertedXml["word/commentsExtended.xml"].elements[0]),k=this.converter.schemaToXml(this.converter.convertedXml["word/commentsExtensible.xml"].elements[0]),b=this.converter.schemaToXml(this.converter.convertedXml["word/commentsIds.xml"].elements[0]);m["word/comments.xml"]=String(g),m["word/commentsExtended.xml"]=String(v),m["word/commentsExtensible.xml"]=String(k),m["word/commentsIds.xml"]=String(b)}if(o)return m;const y=await new Pd().updateZip({docx:this.options.content,updatedDocs:m,originalDocxFile:this.options.fileSource,media:d,fonts:this.options.fonts,isHeadless:this.options.isHeadless});return this.options.telemetry?.trackUsage("document_export",{documentType:"docx",timestamp:new Date().toISOString()}),y}destroy(){this.emit("destroy"),this.view&&this.view.destroy(),Ae(this,Ie,mx).call(this),this.removeAllListeners()}static checkIfMigrationsNeeded(e){version||(version="initial");const n=zy(version)||[];return console.debug("[checkVersionMigrations] Migrations needed:",version,n.length),n.length>0}processCollaborationMigrations(){if(console.debug("[checkVersionMigrations] Current editor version","0.12.11"),!this.options.ydoc)return;let e=this.options.ydoc.getMap("meta").get("version");e||(e="initial"),console.debug("[checkVersionMigrations] Document version",e);const n=zy(e)||[],r=this.state.plugins.find(i=>i.key.startsWith("y-sync"));if(!r)return this.options.ydoc;let o=!1;for(let i of n)if(console.debug("🏃♂️ Running migration",i.name),i(this))o=!0;else throw new Error("Migration failed at "+i.name);return o?(r?.getState(this.state)).doc:void 0}async replaceFile(e){this.setOptions({annotations:!0});const[n,r,o,i]=await gx.loadXmlData(newFile);this.setOptions({fileSource:newFile,content:n,media:r,mediaFiles:o,fonts:i,isNewFile:!0,shouldLoadComments:!0,replacedFile:!0}),Ae(this,Ie,ss).call(this),Ae(this,Ie,Dl).call(this),this.initDefaultStyles(),this.options.ydoc&&this.options.collaborationProvider?this.initializeCollaborationData(!0):Ae(this,Ie,Wa).call(this),this.options.ydoc||(Ae(this,Ie,Gi).call(this),Ae(this,Ie,Wi).call(this))}getNodesOfType(e){const{findChildren:n}=oc;return n(this.state.doc,r=>r.type.name===e)}replaceNodeWithHTML(e,n){const{tr:r}=this.state,{dispatch:o}=this.view;if(!e||!n)return;const i=e.pos,s=i+e.node.nodeSize,a=Ae(this,Ie,Ka).call(this,n);r.replaceWith(i,s,a),o(r)}prepareForAnnotations(e=[]){const{tr:n}=this.state,{dispatch:r}=this.view,o=da.processTables({editor:this,tr:n,annotationValues:e});this.view.dispatch(o),da.annotateHeadersAndFooters({editor:this,annotationValues:e})}annotate(e=[],n=[]){const{state:r,view:o,schema:i}=this;let s=r.tr;s=da.processTables({state:this.state,tr:s,annotationValues:e}),s=da.annotateDocument({tr:s,schema:i,annotationValues:e,hiddenFieldIds:n,editor:this}),s.docChanged&&o.dispatch(s.scrollIntoView())}previewAnnotations(e=[],n=[]){this.originalState=this.view.state,this.annotate(e,n)}closePreview(){this.originalState&&this.view.updateState(this.originalState)}};Wo=new WeakMap,dx=new WeakMap,Ie=new WeakSet,px=function(t){if(!t.element&&t.selector){const{selector:e}=t;e.startsWith("#")||e.startsWith(".")?t.element=document.querySelector(e):t.element=document.getElementById(e),["text","html"].includes(t.mode)&&t.element&&t.element.classList.add("sd-super-editor-html")}t.element=t.isHeadless?null:t.element||document.createElement("div")},fx=function(t){Ae(this,Ie,ju).call(this),Ae(this,Ie,qu).call(this),Ae(this,Ie,Vu).call(this),Ae(this,Ie,ss).call(this),Ae(this,Ie,Dl).call(this),this.options.isHeadless||Ae(this,Ie,jy).call(this),this.on("beforeCreate",this.options.onBeforeCreate),this.emit("beforeCreate",{editor:this}),this.on("contentError",this.options.onContentError),this.on("exception",this.options.onException),Ae(this,Ie,Uu).call(this),this.initDefaultStyles(),this.setDocumentMode(t.documentMode),!this.options.isHeadless&&(this.on("create",this.options.onCreate),this.on("update",this.options.onUpdate),this.on("selectionUpdate",this.options.onSelectionUpdate),this.on("transaction",this.options.onTransaction),this.on("focus",Ae(this,Ie,zu)),this.on("blur",this.options.onBlur),this.on("destroy",this.options.onDestroy),this.on("trackedChangesUpdate",this.options.onTrackedChangesUpdate),this.on("commentsLoaded",this.options.onCommentsLoaded),this.on("commentClick",this.options.onCommentClicked),this.on("commentsUpdate",this.options.onCommentsUpdate),this.on("locked",this.options.onDocumentLocked),this.on("collaborationReady",Ae(this,Ie,qy)),this.on("paginationUpdate",this.options.onPaginationUpdate),this.on("comment-positions",this.options.onCommentLocationsUpdate),this.initializeCollaborationData(),this.options.ydoc||(Ae(this,Ie,Gi).call(this),Ae(this,Ie,Wi).call(this)),window.setTimeout(()=>{this.isDestroyed||this.emit("create",{editor:this})},0))},up=function(t){(!t.extensions||!t.extensions.length)&&(this.options.extensions=Wf()),Ae(this,Ie,ju).call(this),Ae(this,Ie,qu).call(this),Ae(this,Ie,Vu).call(this),this.on("beforeCreate",this.options.onBeforeCreate),this.emit("beforeCreate",{editor:this}),this.on("contentError",this.options.onContentError),Ae(this,Ie,Uu).call(this),this.on("create",this.options.onCreate),this.on("update",this.options.onUpdate),this.on("selectionUpdate",this.options.onSelectionUpdate),this.on("transaction",this.options.onTransaction),this.on("focus",Ae(this,Ie,zu)),this.on("blur",this.options.onBlur),this.on("destroy",this.options.onDestroy),this.on("commentsLoaded",this.options.onCommentsLoaded),this.on("commentClick",this.options.onCommentClicked),this.on("locked",this.options.onDocumentLocked),window.setTimeout(()=>{this.isDestroyed||this.emit("create",{editor:this})},0)},zu=function({editor:t,event:e}){this.toolbar?.setActiveEditor(t),this.options.onFocus({editor:t,event:e})},hx=function(t){t.isHeadless&&(typeof navigator>"u"&&(Qr.navigator={isHeadless:!0}),t.mockDocument&&(Qr.document=t.mockDocument,Qr.window=t.mockWindow))},Wa=function(){if(!this.options.isNewFile)return;this.options.isNewFile=!1;const t=Ae(this,Ie,Ga).call(this),e=this.state.tr.replaceWith(0,this.state.doc.content.size,t);this.view.dispatch(e),setTimeout(()=>{Ae(this,Ie,Gi).call(this),Ae(this,Ie,Wi).call(this)},50)},dp=function(t){const e=this.extensionService?.plugins.find(r=>r.key.startsWith(t)),n=this.state.plugins.find(r=>r.key.startsWith(t));return e&&!n&&this.registerPlugin(e),e?.key},ju=function(){const t=["extension","node","mark"],e=[Z$,J$,Q$,Y$],n=this.options.externalExtensions||[],r=[...e,...this.options.extensions].filter(o=>t.includes(o?.type));this.extensionService=KD.create(r,n,this)},qu=function(){w1(this,Wo,_1.create({editor:this}))},ss=function(){this.options.converter?this.converter=this.options.converter:this.converter=new Nr({docx:this.options.content,media:this.options.mediaFiles,fonts:this.options.fonts,debug:!0,telemetry:this.options.telemetry,fileSource:this.options.fileSource,documentId:this.options.documentId})},Dl=function(){if(!this.options.ydoc)return this.storage.image.media=this.options.mediaFiles;const t=this.options.ydoc.getMap("media");this.options.isNewFile?(Object.entries(this.options.mediaFiles).forEach(([e,n])=>{t.set(e,n)}),this.storage.image.media=this.options.mediaFiles):this.storage.image.media=Object.fromEntries(t.entries())},jy=function(){const t=this.converter.getDocumentFonts();if(t?.length){const e=document.createElement("style");e.textContent=t,document.head.appendChild(e)}},Vu=function(){this.schema=this.extensionService.schema},Ga=function(){let t;try{const{mode:e,fragment:n,isHeadless:r,content:o,loadFromSchema:i}=this.options;e==="docx"?i?(t=this.schema.nodeFromJSON(o),t=Ae(this,Ie,Hu).call(this,t)):(t=X1(this.converter,this.schema,this),t=Ae(this,Ie,Hu).call(this,t),this.options.html&&(t=Ae(this,Ie,Ka).call(this,this.options.html)),n&&(t=uD(n,this.schema))):(e==="text"||e==="html")&&(i?t=this.schema.nodeFromJSON(o):o?t=Ae(this,Ie,Ka).call(this,o):t=this.schema.topNodeType.createAndFill())}catch(e){console.error(e),this.emit("contentError",{editor:this,error:e})}return t},Ka=function(t){let e=t;if(typeof t=="string"){const n=document.createElement("div");n.innerHTML=t,e=n,n.remove()}return er.fromSchema(this.schema).parse(e)},Uu=function(){let t=Ae(this,Ie,Ga).call(this);const e={schema:this.schema};this.options.ydoc||(e.doc=t),this.view=new B2(this.options.element,{...this.options.editorProps,dispatchTransaction:Ae(this,Ie,Vy).bind(this),state:Zi.create(e),handleDoubleClick:async(o,i,s)=>{if(this.options.documentMode!=="editing")return;const a=Id(s.target,"pagination-section-header"),l=Id(s.target,"pagination-section-footer");if(a||l){const c=new s.constructor(s.type);s.target.dispatchEvent(c);return}s.stopPropagation(),this.options.editable||(this.setEditable(!0,!1),Ml(this,null,!1),document.querySelector(".ProseMirror").classList.remove("header-footer-edit"))}});const n=this.state.reconfigure({plugins:[...this.extensionService.plugins]});this.view.updateState(n),this.createNodeViews();const r=this.view.dom;r.editor=this,this.options.telemetry?.sendReport()},qy=function({editor:t,ydoc:e}){this.options.collaborationIsReady||(console.debug("🔗 [super-editor] Collaboration ready"),this.options.onCollaborationReady({editor:t,ydoc:e}),this.options.collaborationIsReady=!0,this.options.isNewFile||(Ae(this,Ie,Gi).call(this),Ae(this,Ie,Wi).call(this)))},Wi=function(){if(!this.options.isCommentsEnabled||this.options.isHeadless||!this.options.shouldLoadComments)return;const t=this.options.replacedFile;this.emit("commentsLoaded",{editor:this,replacedFile:t,comments:this.converter.comments||[]}),setTimeout(()=>{this.options.replacedFile=!1;const{state:e,dispatch:n}=this.view,r=e.tr.setMeta(bt,{type:"force"});n(r)},50)},Gi=async function(){if(!(this.options.isHeadless||!this.extensionService)&&this.options.extensions.find(t=>t.name==="pagination")&&this.options.pagination){console.debug("🔗 [super-editor] Initializing pagination");const t=await r_(this);this.storage.pagination.sectionData=t;const{state:e,dispatch:n}=this.view,r=e.tr.setMeta(_r,{isReadyToInit:!0});n(r)}},Vy=function(t){if(this.view.isDestroyed)return;let e;try{const i=gt.getState(this.view.state)?.isTrackChangesActive??!1?lx({tr:t,state:this.state,user:this.options.user}):t,{state:s}=this.view.state.applyTransaction(i);e=s}catch(i){e=this.state.apply(t),console.log(i)}const n=!this.state.selection.eq(e.selection);this.view.updateState(e),this.emit("transaction",{editor:this,transaction:t}),n&&this.emit("selectionUpdate",{editor:this,transaction:t});const r=t.getMeta("focus");r&&this.emit("focus",{editor:this,event:r.event,transaction:t});const o=t.getMeta("blur");o&&this.emit("blur",{editor:this,event:o.event,transaction:t}),t.docChanged&&this.emit("update",{editor:this,transaction:t})},Hu=function(t){const e=Zi.create({schema:this.schema,doc:t}),{tr:n,doc:r}=e;return e_(r,n,this.schema,this.converter),e.apply(n).doc},pp=function(t=[]){const e=Zi.create({schema:this.schema,doc:this.state.doc,plugins:this.state.plugins}),{tr:n,doc:r}=e;return QD(r,n,this.schema,t),e.apply(n).doc.toJSON()},mx=function(){if(this.options.ydoc)try{console.debug("🔗 [super-editor] Ending collaboration"),this.options.collaborationProvider&&this.options.collaborationProvider.disconnect(),this.options.ydoc&&this.options.ydoc.destroy()}catch{}};let $s=I_;const yx=Ye.create({name:"color",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{color:{default:null,parseDOM:t=>t.style.color?.replace(/['"]+/g,""),renderDOM:t=>t.color?{style:`color: ${t.color}`}:{}}}}]},addCommands(){return{setColor:t=>({chain:e})=>e().setMark("textStyle",{color:t}).run(),unsetColor:()=>({chain:t})=>t().setMark("textStyle",{color:null}).removeEmptyTextStyle().run()}}}),wx=Ye.create({name:"fontFamily",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{fontFamily:{default:null,parseDOM:t=>t.style.fontFamily?.replace(/['"]+/g,""),renderDOM:t=>t.fontFamily?{style:`font-family: ${t.fontFamily}`}:{}}}}]},addCommands(){return{setFontFamily:t=>({chain:e})=>e().setMark("textStyle",{fontFamily:t}).run(),unsetFontFamily:()=>({chain:t})=>t().setMark("textStyle",{fontFamily:null}).removeEmptyTextStyle().run()}}}),bx=Ye.create({name:"fontSize",addOptions(){return{types:["textStyle","tableCell"],defaults:{value:12,unit:"pt",min:8,max:96}}},addGlobalAttributes(){return[{types:this.options.types,attributes:{fontSize:{default:null,parseDOM:t=>t.style.fontSize,renderDOM:t=>{if(!t.fontSize)return{};let[e,n]=nr(t.fontSize);return Number.isNaN(e)?{}:(n=n||this.options.defaults.unit,{style:`font-size: ${e}${n}`})}}}}]},addCommands(){return{setFontSize:t=>({chain:e})=>{let[n,r]=nr(t);if(Number.isNaN(n))return!1;let{min:o,max:i,unit:s}=this.options.defaults;return n=pl(n,o,i),r=r||s,e().setMark("textStyle",{fontSize:`${n}${r}`}).run()},unsetFontSize:()=>({chain:t})=>t().setMark("textStyle",{fontSize:null}).removeEmptyTextStyle().run()}}}),vx=Ye.create({name:"textAlign",addOptions(){return{types:["heading","paragraph"],alignments:["left","center","right","justify"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{textAlign:{default:this.options.defaultAlignment,parseDOM:t=>{const e=t.style.textAlign||this.options.defaultAlignment;return this.options.alignments.includes(e)?e:this.options.defaultAlignment},renderDOM:t=>{if(t.textAlign===this.options.defaultAlignment)return{};const e=t.textAlign==="both"?"justify":t.textAlign;return e?{style:`text-align: ${e}`}:{}}}}}]},addCommands(){return{setTextAlign:t=>({commands:e})=>this.options.alignments.includes(t)?this.options.types.map(n=>e.updateAttributes(n,{textAlign:t})).every(n=>n):!1,unsetTextAlign:()=>({commands:t})=>this.options.types.map(e=>t.resetAttributes(e,"textAlign")).every(e=>e)}},addShortcuts(){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")}}}),xx=Ye.create({name:"textIndent",addOptions(){return{types:["heading","paragraph"],defaults:{unit:"in",increment:.125}}},addGlobalAttributes(){return[{types:this.options.types,attributes:{textIndent:{default:null,parseDOM:t=>t.style.textIndent,renderDOM:t=>{if(!t.textIndent)return{};let[e,n]=nr(t.textIndent);return Number.isNaN(e)||!e?{}:(n=n||this.options.defaults.unit,{style:`margin-left: ${e}${n}`})}}}}]},addCommands(){return{setTextIndent:t=>({commands:e})=>t?this.options.types.map(n=>e.updateAttributes(n,{textIndent:t})).every(n=>n):!1,unsetTextIndent:()=>({commands:t})=>this.options.types.map(e=>t.resetAttributes(e,"textIndent")).every(e=>e),increaseTextIndent:()=>({commands:t})=>this.options.types.map(e=>{let{textIndent:n}=this.editor.getAttributes(e);if(!n){let{increment:i,unit:s}=this.options.defaults;return t.updateAttributes(e,{textIndent:`${i}${s}`})}let[r,o]=nr(n);return r=r+this.options.defaults.increment,o=o||this.options.defaults.unit,Number.isNaN(r)?!1:t.updateAttributes(e,{textIndent:`${r}${o}`})}).every(e=>e),decreaseTextIndent:()=>({commands:t})=>this.options.types.map(e=>{let{textIndent:n}=this.editor.getAttributes(e);if(!n)return!1;let[r,o]=nr(n);return r=r-this.options.defaults.increment,o=o||this.options.defaults.unit,Number.isNaN(r)?!1:r<=0?t.unsetTextIndent():t.updateAttributes(e,{textIndent:`${r}${o}`})}).every(e=>e)}}}),kx=Ye.create({name:"lineHeight",addOptions(){return{types:["heading","paragraph"],defaults:{unit:""}}},addGlobalAttributes(){return[{types:this.options.types,attributes:{lineHeight:{default:null,parseDOM:t=>t.style.lineHeight,renderDOM:t=>t.lineHeight?{style:Zl(t.lineHeight,this.options.defaults.unit,t.spacing?.lineRule)}:{}}}}]},addCommands(){return{setLineHeight:t=>({commands:e})=>t?this.options.types.map(n=>e.updateAttributes(n,{lineHeight:t})).every(n=>n):!1,unsetLineHeight:()=>({commands:t})=>this.options.types.map(e=>t.resetAttributes(e,"lineHeight")).every(e=>e)}}}),Sx=Ye.create({name:"formatCommands",addOptions(){return{}},addStorage(){return{storedStyle:null}},addCommands(){return{clearFormat:()=>({chain:t})=>t().clearNodes().unsetAllMarks().run(),clearMarksFormat:()=>({chain:t})=>t().unsetAllMarks().run(),clearNodesFormat:()=>({chain:t})=>t().clearNodes().run(),copyFormat:()=>({chain:t})=>{if(!this.storage.storedStyle){const i=Ws(this.editor.state);return this.storage.storedStyle=i,!0}if(!this.storage.storedStyle.length)return this.storage.storedStyle=null,t().clearFormat().run();const e=this.storage.storedStyle,n=[];e.forEach(i=>{const{type:s,attrs:a}=i,{name:l}=s;l==="textStyle"?Object.keys(a).forEach(c=>{if(!a[c])return;const u={};u[c]=a[c],n.push({name:c,attrs:u})}):n.push({name:l,attrs:a})});const r={bold:["setBold","unsetBold"],italic:["setItalic","unsetItalic"],underline:["setUnderline","unsetUnderline"],color:["setColor","setColor",null],fontSize:["setFontSize","unsetFontSize"],fontFamily:["setFontFamily","unsetFontFamily"]};let o=t();return Object.keys(r).forEach(i=>{const[s,a,l]=r[i],c=n.find(p=>p.name===i),u=c?.attrs&&c?.attrs[i];let d={};!c&&!u?d={command:a,argument:l}:d={command:s,argument:c.attrs[i]||l},o=o[d.command](d.argument)}),this.storage.storedStyle=null,o}}},addShortcuts(){return{"Mod-Alt-c":()=>this.editor.commands.clearFormat()}}});function F_(t={}){return new Ue({view(e){return new R_(e,t)}})}let R_=class{constructor(e,n){var r;this.editorView=e,this.cursorPos=null,this.element=null,this.timeout=-1,this.width=(r=n.width)!==null&&r!==void 0?r:1,this.color=n.color===!1?void 0:n.color||"black",this.class=n.class,this.handlers=["dragover","dragend","drop","dragleave"].map(o=>{let i=s=>{this[o](s)};return e.dom.addEventListener(o,i),{name:o,handler:i}})}destroy(){this.handlers.forEach(({name:e,handler:n})=>this.editorView.dom.removeEventListener(e,n))}update(e,n){this.cursorPos!=null&&n.doc!=e.state.doc&&(this.cursorPos>e.state.doc.content.size?this.setCursor(null):this.updateOverlay())}setCursor(e){e!=this.cursorPos&&(this.cursorPos=e,e==null?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())}updateOverlay(){let e=this.editorView.state.doc.resolve(this.cursorPos),n=!e.parent.inlineContent,r,o=this.editorView.dom,i=o.getBoundingClientRect(),s=i.width/o.offsetWidth,a=i.height/o.offsetHeight;if(n){let d=e.nodeBefore,p=e.nodeAfter;if(d||p){let f=this.editorView.nodeDOM(this.cursorPos-(d?d.nodeSize:0));if(f){let h=f.getBoundingClientRect(),m=d?h.bottom:h.top;d&&p&&(m=(m+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let y=this.width/2*a;r={left:h.left,right:h.right,top:m-y,bottom:m+y}}}}if(!r){let d=this.editorView.coordsAtPos(this.cursorPos),p=this.width/2*s;r={left:d.left-p,right:d.left+p,top:d.top,bottom:d.bottom}}let l=this.editorView.dom.offsetParent;this.element||(this.element=l.appendChild(document.createElement("div")),this.class&&(this.element.className=this.class),this.element.style.cssText="position: absolute; z-index: 50; pointer-events: none;",this.color&&(this.element.style.backgroundColor=this.color)),this.element.classList.toggle("prosemirror-dropcursor-block",n),this.element.classList.toggle("prosemirror-dropcursor-inline",!n);let c,u;if(!l||l==document.body&&getComputedStyle(l).position=="static")c=-pageXOffset,u=-pageYOffset;else{let d=l.getBoundingClientRect(),p=d.width/l.offsetWidth,f=d.height/l.offsetHeight;c=d.left-l.scrollLeft*p,u=d.top-l.scrollTop*f}this.element.style.left=(r.left-c)/s+"px",this.element.style.top=(r.top-u)/a+"px",this.element.style.width=(r.right-r.left)/s+"px",this.element.style.height=(r.bottom-r.top)/a+"px"}scheduleRemoval(e){clearTimeout(this.timeout),this.timeout=setTimeout(()=>this.setCursor(null),e)}dragover(e){if(!this.editorView.editable)return;let n=this.editorView.posAtCoords({left:e.clientX,top:e.clientY}),r=n&&n.inside>=0&&this.editorView.state.doc.nodeAt(n.inside),o=r&&r.type.spec.disableDropCursor,i=typeof o=="function"?o(this.editorView,n,e):o;if(n&&!i){let s=n.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let a=vv(this.editorView.state.doc,s,this.editorView.dragging.slice);a!=null&&(s=a)}this.setCursor(s),this.scheduleRemoval(5e3)}}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(e){this.editorView.dom.contains(e.relatedTarget)||this.setCursor(null)}};const Ax=Ye.create({name:"dropCursor",addOptions(){return{color:"currentColor",width:2,class:void 0}},addPmPlugins(){return[F_(this.options)]}});let en=class yr extends je{constructor(e){super(e,e)}map(e,n){let r=e.resolve(n.map(this.head));return yr.valid(r)?new yr(r):je.near(r)}content(){return ve.empty}eq(e){return e instanceof yr&&e.head==this.head}toJSON(){return{type:"gapcursor",pos:this.head}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for GapCursor.fromJSON");return new yr(e.resolve(n.pos))}getBookmark(){return new B_(this.anchor)}static valid(e){let n=e.parent;if(n.isTextblock||!L_(e)||!P_(e))return!1;let r=n.type.spec.allowGapCursor;if(r!=null)return r;let o=n.contentMatchAt(e.index()).defaultType;return o&&o.isTextblock}static findGapCursorFrom(e,n,r=!1){e:for(;;){if(!r&&yr.valid(e))return e;let o=e.pos,i=null;for(let s=e.depth;;s--){let a=e.node(s);if(n>0?e.indexAfter(s)<a.childCount:e.index(s)>0){i=a.child(n>0?e.indexAfter(s):e.index(s)-1);break}else if(s==0)return null;o+=n;let l=e.doc.resolve(o);if(yr.valid(l))return l}for(;;){let s=n>0?i.firstChild:i.lastChild;if(!s){if(i.isAtom&&!i.isText&&!_e.isSelectable(i)){e=e.doc.resolve(o+i.nodeSize*n),r=!1;continue e}break}i=s,o+=n;let a=e.doc.resolve(o);if(yr.valid(a))return a}return null}}};en.prototype.visible=!1;en.findFrom=en.findGapCursorFrom;je.jsonID("gapcursor",en);let B_=class Cx{constructor(e){this.pos=e}map(e){return new Cx(e.map(this.pos))}resolve(e){let n=e.resolve(this.pos);return en.valid(n)?new en(n):je.near(n)}};function L_(t){for(let e=t.depth;e>=0;e--){let n=t.index(e),r=t.node(e);if(n==0){if(r.type.spec.isolating)return!0;continue}for(let o=r.child(n-1);;o=o.lastChild){if(o.childCount==0&&!o.inlineContent||o.isAtom||o.type.spec.isolating)return!0;if(o.inlineContent)return!1}}return!0}function P_(t){for(let e=t.depth;e>=0;e--){let n=t.indexAfter(e),r=t.node(e);if(n==r.childCount){if(r.type.spec.isolating)return!0;continue}for(let o=r.child(n);;o=o.firstChild){if(o.childCount==0&&!o.inlineContent||o.isAtom||o.type.spec.isolating)return!0;if(o.inlineContent)return!1}}return!0}function z_(){return new Ue({props:{decorations:U_,createSelectionBetween(t,e,n){return e.pos==n.pos&&en.valid(n)?new en(n):null},handleClick:q_,handleKeyDown:j_,handleDOMEvents:{beforeinput:V_}}})}const j_=Df({ArrowLeft:pa("horiz",-1),ArrowRight:pa("horiz",1),ArrowUp:pa("vert",-1),ArrowDown:pa("vert",1)});function pa(t,e){const n=t=="vert"?e>0?"down":"up":e>0?"right":"left";return function(r,o,i){let s=r.selection,a=e>0?s.$to:s.$from,l=s.empty;if(s instanceof Pe){if(!i.endOfTextblock(n)||a.depth==0)return!1;l=!1,a=r.doc.resolve(e>0?a.after():a.before())}let c=en.findGapCursorFrom(a,e,l);return c?(o&&o(r.tr.setSelection(new en(c))),!0):!1}}function q_(t,e,n){if(!t||!t.editable)return!1;let r=t.state.doc.resolve(e);if(!en.valid(r))return!1;let o=t.posAtCoords({left:n.clientX,top:n.clientY});return o&&o.inside>-1&&_e.isSelectable(t.state.doc.nodeAt(o.inside))?!1:(t.dispatch(t.state.tr.setSelection(new en(r))),!0)}function V_(t,e){if(e.inputType!="insertCompositionText"||!(t.state.selection instanceof en))return!1;let{$from:n}=t.state.selection,r=n.parent.contentMatchAt(n.index()).findWrapping(t.state.schema.nodes.text);if(!r)return!1;let o=ye.empty;for(let s=r.length-1;s>=0;s--)o=ye.from(r[s].createAndFill(null,o));let i=t.state.tr.replace(n.pos,n.pos,new ve(o,0,0));return i.setSelection(Pe.near(i.doc.resolve(n.pos+1))),t.dispatch(i),!1}function U_(t){if(!(t.selection instanceof en))return null;let e=document.createElement("div");return e.className="ProseMirror-gapcursor",De.create(t.doc,[Le.widget(t.selection.head,e,{key:"gapcursor"})])}const H_=Ye.create({name:"gapCursor",addPmPlugins(){return[z_()]},extendNodeSchema(t){return{allowGapCursor:Ke(Fe(t,"allowGapCursor",{name:t.name,options:t.options,storage:t.storage}))??null}}}),W_=Ye.create({name:"collaborationCursor",priority:999,addOptions(){return{provider:null,user:{name:null,color:null}}},addStorage(){return{users:[]}},addPmPlugins(){const{collaborationProvider:t=null}=this.editor.options;return t?[yD(t.awareness,{cursorBuilder:G_})]:[]}}),G_=t=>{const e=document.createElement("span");e.classList.add("ProseMirror-yjs-cursor"),e.setAttribute("style",`border-color: ${t.color}`);const n=document.createElement("div");return n.setAttribute("style",`background-color: ${t.color}`),n.insertBefore(document.createTextNode(t.name||t.email),null),e.insertBefore(n,null),e},Qo="aiMark",fa="aiAnimationMark",Ex="aiLoaderNode",K_=tn.create({name:Qo,group:"ai",inclusive:!1,addOptions(){return{htmlAttributes:{class:"sd-ai-highlight"}}},addAttributes(){return{id:{default:null,rendered:!1}}},parseDOM(){return[{tag:Qo}]},renderDOM({htmlAttributes:t}){return[Qo,Te.mergeAttributes(this.options.htmlAttributes,t)]}}),J_=tn.create({name:fa,group:"ai",inclusive:!1,spanning:!1,excludes:fa,addOptions(){return{htmlAttributes:{}}},addAttributes(){return{id:{default:null,rendered:!1},class:{default:null,rendered:!0},dataMarkId:{default:null,rendered:!0}}},parseDOM(){return[{tag:fa}]},renderDOM({htmlAttributes:t}){return[fa,Te.mergeAttributes(this.options.htmlAttributes,t)]}}),X_="data:image/svg+xml,%3csvg%20fill='hsla(278,%2077.40%25,%2020.80%25,%200.65)'%20viewBox='0%200%2024%2024'%20xmlns='http://www.w3.org/2000/svg'%3e%3ccircle%20cx='4'%20cy='12'%20r='0'%3e%3canimate%20begin='0;spinner_z0Or.end'%20attributeName='r'%20calcMode='spline'%20dur='0.5s'%20keySplines='.36,.6,.31,1'%20values='0;3'%20fill='freeze'/%3e%3canimate%20begin='spinner_OLMs.end'%20attributeName='cx'%20calcMode='spline'%20dur='0.5s'%20keySplines='.36,.6,.31,1'%20values='4;12'%20fill='freeze'/%3e%3canimate%20begin='spinner_UHR2.end'%20attributeName='cx'%20calcMode='spline'%20dur='0.5s'%20keySplines='.36,.6,.31,1'%20values='12;20'%20fill='freeze'/%3e%3canimate%20id='spinner_lo66'%20begin='spinner_Aguh.end'%20attributeName='r'%20calcMode='spline'%20dur='0.5s'%20keySplines='.36,.6,.31,1'%20values='3;0'%20fill='freeze'/%3e%3canimate%20id='spinner_z0Or'%20begin='spinner_lo66.end'%20attributeName='cx'%20dur='0.001s'%20values='20;4'%20fill='freeze'/%3e%3c/circle%3e%3ccircle%20cx='4'%20cy='12'%20r='3'%3e%3canimate%20begin='0;spinner_z0Or.end'%20attributeName='cx'%20calcMode='spline'%20dur='0.5s'%20keySplines='.36,.6,.31,1'%20values='4;12'%20fill='freeze'/%3e%3canimate%20begin='spinner_OLMs.end'%20attributeName='cx'%20calcMode='spline'%20dur='0.5s'%20keySplines='.36,.6,.31,1'%20values='12;20'%20fill='freeze'/%3e%3canimate%20id='spinner_JsnR'%20begin='spinner_UHR2.end'%20attributeName='r'%20calcMode='spline'%20dur='0.5s'%20keySplines='.36,.6,.31,1'%20values='3;0'%20fill='freeze'/%3e%3canimate%20id='spinner_Aguh'%20begin='spinner_JsnR.end'%20attributeName='cx'%20dur='0.001s'%20values='20;4'%20fill='freeze'/%3e%3canimate%20begin='spinner_Aguh.end'%20attributeName='r'%20calcMode='spline'%20dur='0.5s'%20keySplines='.36,.6,.31,1'%20values='0;3'%20fill='freeze'/%3e%3c/circle%3e%3ccircle%20cx='12'%20cy='12'%20r='3'%3e%3canimate%20begin='0;spinner_z0Or.end'%20attributeName='cx'%20calcMode='spline'%20dur='0.5s'%20keySplines='.36,.6,.31,1'%20values='12;20'%20fill='freeze'/%3e%3canimate%20id='spinner_hSjk'%20begin='spinner_OLMs.end'%20attributeName='r'%20calcMode='spline'%20dur='0.5s'%20keySplines='.36,.6,.31,1'%20values='3;0'%20fill='freeze'/%3e%3canimate%20id='spinner_UHR2'%20begin='spinner_hSjk.end'%20attributeName='cx'%20dur='0.001s'%20values='20;4'%20fill='freeze'/%3e%3canimate%20begin='spinner_UHR2.end'%20attributeName='r'%20calcMode='spline'%20dur='0.5s'%20keySplines='.36,.6,.31,1'%20values='0;3'%20fill='freeze'/%3e%3canimate%20begin='spinner_Aguh.end'%20attributeName='cx'%20calcMode='spline'%20dur='0.5s'%20keySplines='.36,.6,.31,1'%20values='4;12'%20fill='freeze'/%3e%3c/circle%3e%3ccircle%20cx='20'%20cy='12'%20r='3'%3e%3canimate%20id='spinner_4v5M'%20begin='0;spinner_z0Or.end'%20attributeName='r'%20calcMode='spline'%20dur='0.5s'%20keySplines='.36,.6,.31,1'%20values='3;0'%20fill='freeze'/%3e%3canimate%20id='spinner_OLMs'%20begin='spinner_4v5M.end'%20attributeName='cx'%20dur='0.001s'%20values='20;4'%20fill='freeze'/%3e%3canimate%20begin='spinner_OLMs.end'%20attributeName='r'%20calcMode='spline'%20dur='0.5s'%20keySplines='.36,.6,.31,1'%20values='0;3'%20fill='freeze'/%3e%3canimate%20begin='spinner_UHR2.end'%20attributeName='cx'%20calcMode='spline'%20dur='0.5s'%20keySplines='.36,.6,.31,1'%20values='4;12'%20fill='freeze'/%3e%3canimate%20begin='spinner_Aguh.end'%20attributeName='cx'%20calcMode='spline'%20dur='0.5s'%20keySplines='.36,.6,.31,1'%20values='12;20'%20fill='freeze'/%3e%3c/circle%3e%3c/svg%3e",Y_=He.create({name:Ex,group:"inline",inline:!0,atom:!0,selectable:!1,draggable:!1,addOptions(){return{htmlAttributes:{class:"sd-ai-loader",contentEditable:"false"}}},parseDOM(){return[{tag:"span.sd-ai-loader"}]},renderDOM({htmlAttributes:t}){const e=document.createElement("span");Object.entries(Te.mergeAttributes(this.options.htmlAttributes,t)).forEach(([r,o])=>e.setAttribute(r,o));const n=document.createElement("img");return n.src=X_,n.alt="loading...",n.width=100,n.height=50,e.appendChild(n),e}}),ha=new Ge("ai"),Tx=Ye.create({name:"ai",addCommands(){return{insertAiMark:()=>({tr:t,dispatch:e,state:n})=>{const{selection:r}=t,{$from:o,$to:i}=r;return o.pos===i.pos?!1:(t.addMark(o.pos,i.pos,this.editor.schema.marks[Qo].create({id:"ai-highlight"})),e&&e(t),!0)},updateAiHighlightStyle:t=>({tr:e,dispatch:n})=>(e.setMeta(ha,{type:"updateStyle",className:t}),n&&n(e),!0),clearAiHighlightStyle:()=>({tr:t,dispatch:e})=>(t.setMeta(ha,{type:"updateStyle",className:null}),e&&e(t),!0),removeAiMark:(t=Qo)=>({tr:e,dispatch:n,state:r})=>{const{doc:o}=r;let i=!1;return o.descendants((s,a)=>{const{marks:l=[]}=s;l.find(c=>c.type.name===t)&&(i=!0,e.removeMark(a,a+s.nodeSize,r.schema.marks[t]))}),i?(n&&n(e),!0):!1},removeAiNode:(t=Ex)=>({tr:e,dispatch:n,state:r})=>{const{doc:o}=r,i=[];return o.descendants((s,a)=>{s.type.name===t&&i.push(a)}),i.length===0?!1:(i.sort((s,a)=>a-s),i.forEach(s=>{const a=o.nodeAt(s);a&&e.delete(s,s+a.nodeSize)}),n&&n(e),!0)}}},addPmPlugins(){const t=this.editor;return[new Ue({key:ha,state:{init(){return{decorations:De.empty,highlightColor:"#6366f1",customClass:null}},apply(e,n,r,o){const i=e.getMeta(ha);let s=n.customClass;if(i&&i.type==="updateStyle"&&(s=i.className),e.docChanged&&s==="sd-ai-highlight-pulse"){let c=!1;e.steps.forEach(u=>{u.slice&&u.slice.content.size>0&&(c=!0)}),c&&(s=null)}if(!e.docChanged&&!i)return n;const{decorations:a}=Z_(t,o.doc,n.highlightColor,s)||{},l=De.create(o.doc,a);return{...n,decorations:l,customClass:s}}},props:{decorations(e){return this.getState(e).decorations}}})]}}),Z_=(t,e,n,r=null)=>{const o=[];return e.descendants((i,s)=>{const{marks:a=[]}=i;if(a.find(l=>l.type.name===Qo)){const l={style:`background-color: ${n}33; border-radius: 4px; transition: background-color 250ms ease;`,class:"sd-ai-highlight-element"};r&&(l.class+=` ${r}`);const c=Le.inline(s,s+i.nodeSize,l);o.push(c)}}),{decorations:o}},$x=He.create({name:"doc",topNode:!0,content:"block+",parseDOM(){return[{tag:"doc"}]},renderDOM(){return["doc",0]},addAttributes(){return{attributes:{rendered:!1}}}}),Ox=He.create({name:"text",group:"inline",inline:!0}),Q_=He.create({name:"run",group:"inline",content:"text*",inline:!0,parseDOM(){return[{tag:"run"}]},renderDOM(){return["run",0]},addAttributes(){return{attributes:{rendered:!1}}}});function _l(t){return new qD({match:t.match,handler:({state:e,range:n,match:r,chain:o})=>{const i=Ke(t.getAttributes,null,r)||{},s=e.tr.delete(n.from,n.to),a=s.doc.resolve(n.from).blockRange(),l=a&&mv(a,t.type,i);if(!l)return null;if(s.wrap(a,l),t.keepMarks&&t.editor){const{selection:u,storedMarks:d}=e,{splittableMarks:p}=t.editor.extensionService,f=d||u.$to.parentOffset&&u.$from.marks();if(f){const h=f.filter(m=>p.includes(m.type.name));s.ensureMarks(h)}}if(t.keepAttributes){const u=t.type.name==="bulletList"||t.type.name==="orderedList"?"listItem":t.type.name;o().updateAttributes(u,i).run()}const c=s.doc.resolve(n.from-1).nodeBefore;c&&c.type===t.type&&Pr(s.doc,n.from-1)&&(!t.joinPredicate||t.joinPredicate(r,c))&&s.join(n.from-1)}})}const Uy=/^\s*([-+*])\s$/,Mx=He.create({name:"bulletList",group:"block list",content(){return`${this.options.itemTypeName}+`},addOptions(){return{itemTypeName:"listItem",htmlAttributes:{},keepMarks:!0,keepAttributes:!1}},parseDOM(){return[{tag:"ul"}]},renderDOM({htmlAttributes:t}){return["ul",Te.mergeAttributes(this.options.htmlAttributes,t),0]},addAttributes(){return{"list-style-type":{default:"bullet",rendered:!1},listId:{rendered:!1},attributes:{rendered:!1,keepOnSplit:!0}}},addCommands(){return{toggleBulletList:()=>t=>{const{commands:e,chain:n}=t;return e.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}}},addShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let t=_l({match:Uy,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(t=_l({match:Uy,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes("textStyle"),editor:this.editor})),[t]}});function eN(t={}){return new Ue({key:new Ge("orderedListSync"),appendTransaction:(e,n,r)=>{if(!(e.some(l=>l.docChanged)&&!n.doc.eq(r.doc)))return;let{doc:o,tr:i}=r,s={};if(o.descendants((l,c)=>{if(l.type.name==="orderedList"&&l.attrs.syncId){let u=l.attrs.syncId;s[u]||(s[u]=[]),s[u].push({node:l,pos:c})}}),!Object.keys(s).length)return;let a=!1;return Object.entries(s).forEach(([l,c])=>{if(c.length<1){let[p]=c;i.setNodeMarkup(p.pos,void 0,{...p.node.attrs,syncId:null}),a=!0;return}let[u]=c,d=u.node.attrs.order;c.forEach((p,f)=>{if(f===0)return;let{node:h,pos:m}=p,y=c[f-1],g=d+y.node.childCount;h.attrs.order!==g&&(i.setNodeMarkup(m,void 0,{...h.attrs,order:g}),a=!0),d=g})}),a?i:null}})}function tN(){return Math.floor(Math.random()*4294967295).toString()}function nN(t){return new Ue({key:new Ge("orderedListMarker"),appendTransaction:(e,n,r)=>{if(!(e.some(l=>l.docChanged)&&!n.doc.eq(r.doc)))return;let{doc:o,tr:i}=r,s=rN(r);if(!s.size)return;let a=!1;return Array.from(s).forEach(([l,c])=>{const u=c[0];let d=c,p=u.node.type.name==="bulletList";u.node.attrs.syncId;let f=u.node.childCount!==d.length;if(p){d.forEach(v=>iN(i,v)),a=!0;return}if(f){let v=oN({state:r,list:u});v.length&&(d=v)}let h=d[0],m=sN({state:r,listItems:d}),y=Dx(),g={lvlText:h.node.attrs.lvlText??y.lvlText,listLevel:h.node.attrs.listLevel??y.listLevel,listNumberingType:h.node.attrs.listNumberingType??y.listNumberingType};g.lvlText===m.lvlText&&g.listNumberingType===m.listNumberingType&&Hy(g.listLevel,m.listLevel)||(i.setNodeMarkup(h.pos,void 0,{...h.node.attrs,...m}),a=!0,g=m),d.forEach((v,k)=>{if(k===0)return;let{node:b,pos:C}=v,{lvlText:D,listLevel:M,listNumberingType:I}=b.attrs;Array.isArray(g.listLevel)||(g.listLevel=JSON.parse(g.listLevel));let E=[...g.listLevel.slice(0,-1),g.listLevel.at(-1)+1];if(!(D===g.lvlText&&I===g.listNumberingType&&Hy(M,E))){let{selection:G,storedMarks:oe}=r,N=oe||G.$to.parentOffset&&G.$from.marks();i.setNodeMarkup(C,void 0,{...b.attrs,listLevel:E,lvlText:g.lvlText,listNumberingType:g.listNumberingType}),N&&i.ensureMarks(N),a=!0}g={...g,listLevel:E}})}),i.setMeta("orderedListMarker",!0),a?i:null}})}function rN(t){let{doc:e}=t,n=new Map;return e.descendants((r,o)=>{let{attrs:i}=r,s=r.type.name==="listItem",a=!!i.listLevel?.length,l=!!i.lvlText,c=i.listNumberingType&&i.listNumberingType!=="bullet";if(s&&a&&l&&c){const u=`${e.resolve(o).parent.attrs.listId}, ${r.attrs.listLevel.slice(0,-1)}`;n.get(u)||n.set(u,[]),n.get(u).push({node:r,pos:o})}}),n}function oN({state:t,list:e}){let{doc:n}=t,r=[];return n.descendants((o,i)=>{let s=o.type.name==="listItem",a=n.resolve(i);s&&a.parent===e&&r.push({node:o,pos:i})}),r}function Dx({lvlText:t="",listLevel:e=[],listNumberingType:n="decimal"}={}){return{lvlText:t,listLevel:e,listNumberingType:n}}function iN(t,e){let{pos:n,node:r}=e;t.setNodeMarkup(n,void 0,{...r.attrs,lvlText:null,listLevel:null,listNumberingType:null})}function Hy(t,e){return t.length===e.length&&t.every((n,r)=>n===e[r])}function sN({state:t,listItems:e}){let{doc:n}=t,r=e[0],{lvlText:o,listLevel:i,listNumberingType:s}=r.node.attrs,a=Dx({lvlText:"%1.",listLevel:[1],listNumberingType:"decimal"}),l=(n.resolve(r.pos).depth-1)/2;if(!(o&&i?.length&&s))({lvlText:o,listLevel:i,listNumberingType:s}=a);else{let c=l>0;c&&l>=3?{lvlText:o,listLevel:i,listNumberingType:s}=a:c&&l<3&&(i=[...i.slice(0,-1),1])}return{lvlText:o,listLevel:i,listNumberingType:s}}const Wy=/^(\d+)\.\s$/,_x=He.create({name:"orderedList",group:"block list",content(){return`${this.options.itemTypeName}+`},addOptions(){return{itemTypeName:"listItem",htmlAttributes:{},keepMarks:!0,keepAttributes:!1,listStyleTypes:["decimal","lowerAlpha","lowerRoman"]}},addAttributes(){return{order:{default:1,parseDOM:t=>t.hasAttribute("start")?parseInt(t.getAttribute("start")||"",10):1,renderDOM:t=>({start:t.order})},syncId:{default:null,parseDOM:t=>t.getAttribute("data-sync-id"),renderDOM:t=>t.syncId?{"data-sync-id":t.syncId}:{}},listId:{default:null,parseDOM:t=>t.getAttribute("data-list-id"),renderDOM:t=>t.listId?{"data-list-id":t.listId}:{}},"list-style-type":{default:"decimal",renderDOM:t=>{let e=t["list-style-type"];return e?(e==="lowerLetter"&&(e="lowerAlpha"),{style:`list-style-type: ${AE(e)};`}):{}}},attributes:{rendered:!1,keepOnSplit:!0}}},parseDOM(){return[{tag:"ol"}]},renderDOM({htmlAttributes:t}){const{start:e,...n}=t;return e===1?["ol",Te.mergeAttributes(this.options.htmlAttributes,n),0]:["ol",Te.mergeAttributes(this.options.htmlAttributes,t),0]},addCommands(){return{toggleOrderedList:()=>({commands:t})=>t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks),getCurrentList:()=>({state:t})=>Kt(e=>e.type.name===this.name)(t.selection),restartListNodes:(t,e)=>({tr:n,state:r})=>{let o=e;return t.map(i=>{const s={node:i,pos:o};return o+=i.nodeSize,s}).forEach(i=>{const{pos:s}=i,a=n.mapping.map(s);n.setNodeMarkup(a,void 0,{})}),!0},updateOrderedListStyleType:()=>({dispatch:t,state:e,tr:n})=>{let r=Kt(o=>o.type.name===this.name)(n.selection);if(!r)return!0;if(t){let o=(r.depth-1)/2,i=this.options.listStyleTypes,s=i[o%i.length],a=r.node.attrs["list-style-type"],l=n.doc.nodeAt(r.pos);a!==s&&l.eq(r.node)&&n.setNodeMarkup(r.pos,void 0,{...r.node.attrs,"list-style-type":s})}return!0},liftEmptyBlockAndContinueListOrder:()=>({editor:t,dispatch:e,state:n,tr:r,commands:o})=>{let i=Kt(d=>d.type.name===this.name)(n.selection);if(!i)return!1;let s=t.can().liftEmptyBlock(),a=i.depth===1,l=i.node.childCount===1,c=n.selection.$from.node(-1),u=i.node.lastChild.eq(c);if(!(s&&a&&!l&&!u))return!1;if(e){let d=i.pos;if(!o.liftEmptyBlock(n,e))return!1;let{$from:p}=r.selection,f=r.doc.nodeAt(d),h=p.after(),m=r.doc.nodeAt(h),y=f?.type.name===this.name,g=m?.type.name===this.name;if(y&&g){let v=f.attrs.order||1,k=f.childCount,b=f.attrs.syncId,C=k+v,D=b||tN();r.setNodeMarkup(h,void 0,{...m.attrs,order:C,syncId:D}),b||r.setNodeMarkup(d,void 0,{...f.attrs,syncId:D})}}return!0}}},addShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList(),Enter:()=>this.editor.commands.liftEmptyBlockAndContinueListOrder()}},addPmPlugins(){return[nN(this.editor),eN()]},addInputRules(){let t=_l({match:Wy,type:this.type,getAttributes:e=>({start:+e[1]}),joinPredicate:(e,n)=>n.childCount+n.attrs.start===+e[1]});return(this.options.keepMarks||this.options.keepAttributes)&&(t=_l({match:Wy,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes("textStyle")}),joinPredicate:(e,n)=>n.childCount+n.attrs.start===+e[1],editor:this.editor})),[t]}}),aN=({listLevel:t,lvlText:e,listNumberingType:n})=>{const r=dN[n];return r?r(t,e):null},lN=(t,e)=>Rf(t,e,String),Nx=(t,e)=>Rf(t,e,fN),cN=(t,e)=>Nx(t,e).toLowerCase(),uN=(t,e)=>Ix(t,e).toLowerCase(),Ix=(t,e)=>Rf(t,e,n=>hN(n)),dN={decimal:lN,lowerRoman:cN,upperRoman:Nx,lowerLetter:uN,upperLetter:Ix},pN=(t,e)=>t.reduce((n,r,o)=>n.replace(`%${o+1}`,r),e),Rf=(t,e,n)=>{const r=t.map(n);return pN(r,e)},fN=t=>{const e=[{value:1e3,numeral:"M"},{value:900,numeral:"CM"},{value:500,numeral:"D"},{value:400,numeral:"CD"},{value:100,numeral:"C"},{value:90,numeral:"XC"},{value:50,numeral:"L"},{value:40,numeral:"XL"},{value:10,numeral:"X"},{value:9,numeral:"IX"},{value:5,numeral:"V"},{value:4,numeral:"IV"},{value:1,numeral:"I"}];let n="";for(const{value:r,numeral:o}of e)for(;t>=r;)n+=o,t-=r;return n},hN=t=>{let e="";const n="ABCDEFGHIJKLMNOPQRSTUVWXYZ";for(;t>0;){let r=(t-1)%26;e=n[r]+e,t=Math.floor((t-1)/26)}return e};function mN(t={}){return new Ue({key:new Ge("styledListMarker"),state:{init(e,n){const r=[...Gy(n),...Ky(n)];return De.create(n.doc,r)},apply(e,n,r,o){if(!e.docChanged||e.getMeta("orderedListMarker"))return n;const i=e.getMeta("splitListItem"),s=[...Gy(o,i),...Ky(o)];return De.create(o.doc,s)}},props:{decorations(e){return this.getState(e)}}})}function Gy(t,e=[]){let{doc:n,storedMarks:r}=t,o=[];Array.isArray(r)&&e.push(...r);let i=yf(n,s=>s.type.name==="listItem");return i.length&&i.forEach(({node:s,pos:a})=>{let l=cr("textStyle",n.type.schema),c=[...e.filter(y=>y.type===l)];if(yN(s)&&e.length){const y=e.filter(g=>g.type===l);c.push(...y)}else{const y=gN(s,n,l);c.push(...y)}let u=null,d=null;c.forEach(y=>{let{attrs:g}=y;if(g.fontSize&&!u){let[v,k]=nr(g.fontSize);Number.isNaN(v)||(k=k??"pt",u=`${v}${k}`)}g.fontFamily&&!d&&(d=g.fontFamily)});let p={style:`--marker-font-size: ${u??"initial"}`},f={style:`--marker-font-family: ${d??"initial"}`},h=Te.mergeAttributes(p,f),m=Le.node(a,a+s.nodeSize,h);o.push(m)}),o}function Ky(t){let{doc:e}=t,n=[],r=yf(e,o=>o.type.name==="listItem");return r.length&&r.forEach(({node:o,pos:i})=>{let s={};if(o.attrs.spacing){const{lineSpaceBefore:l,lineSpaceAfter:c,line:u}=o.attrs.spacing;s={style:`
|
|
46
46
|
${l?`margin-top: ${l}px;`:""}
|
|
47
47
|
${c?`margin-bottom: ${c}px;`:""}
|
|
48
48
|
${u?Zl(u,""):""}
|