@myissue/vue-website-page-builder 3.5.51 → 3.5.52

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.
@@ -16,12 +16,12 @@ ${m.map(([x,u])=>` ${x}: ${u};`).join(`
16
16
  `)}}Co.empty=new Co(!0);class LI{constructor(e,t){this.string=e,this.nodeTypes=t,this.inline=null,this.pos=0,this.tokens=e.split(/\s*(?=\b|\W|$)/),this.tokens[this.tokens.length-1]==""&&this.tokens.pop(),this.tokens[0]==""&&this.tokens.shift()}get next(){return this.tokens[this.pos]}eat(e){return this.next==e&&(this.pos++||!0)}err(e){throw new SyntaxError(e+" (in content expression '"+this.string+"')")}}function gL(r){let e=[];do e.push(NI(r));while(r.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function NI(r){let e=[];do e.push(AI(r));while(r.next&&r.next!=")"&&r.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function AI(r){let e=zI(r);for(;;)if(r.eat("+"))e={type:"plus",expr:e};else if(r.eat("*"))e={type:"star",expr:e};else if(r.eat("?"))e={type:"opt",expr:e};else if(r.eat("{"))e=_I(r,e);else break;return e}function uL(r){/\D/.test(r.next)&&r.err("Expected number, got '"+r.next+"'");let e=Number(r.next);return r.pos++,e}function _I(r,e){let t=uL(r),i=t;return r.eat(",")&&(r.next!="}"?i=uL(r):i=-1),r.eat("}")||r.err("Unclosed braced range"),{type:"range",min:t,max:i,expr:e}}function DI(r,e){let t=r.nodeTypes,i=t[e];if(i)return[i];let n=[];for(let a in t){let l=t[a];l.isInGroup(e)&&n.push(l)}return n.length==0&&r.err("No node type or group '"+e+"' found"),n}function zI(r){if(r.eat("(")){let e=gL(r);return r.eat(")")||r.err("Missing closing paren"),e}else if(/\W/.test(r.next))r.err("Unexpected token '"+r.next+"'");else{let e=DI(r,r.next).map(t=>(r.inline==null?r.inline=t.isInline:r.inline!=t.isInline&&r.err("Mixing inline and block content"),{type:"name",value:t}));return r.pos++,e.length==1?e[0]:{type:"choice",exprs:e}}}function II(r){let e=[[]];return n(a(r,0),t()),e;function t(){return e.push([])-1}function i(l,s,p){let d={term:p,to:s};return e[l].push(d),d}function n(l,s){l.forEach(p=>p.to=s)}function a(l,s){if(l.type=="choice")return l.exprs.reduce((p,d)=>p.concat(a(d,s)),[]);if(l.type=="seq")for(let p=0;;p++){let d=a(l.exprs[p],s);if(p==l.exprs.length-1)return d;n(d,s=t())}else if(l.type=="star"){let p=t();return i(s,p),n(a(l.expr,p),p),[i(p)]}else if(l.type=="plus"){let p=t();return n(a(l.expr,s),p),n(a(l.expr,p),p),[i(p)]}else{if(l.type=="opt")return[i(s)].concat(a(l.expr,s));if(l.type=="range"){let p=s;for(let d=0;d<l.min;d++){let c=t();n(a(l.expr,p),c),p=c}if(l.max==-1)n(a(l.expr,p),p);else for(let d=l.min;d<l.max;d++){let c=t();i(p,c),n(a(l.expr,p),c),p=c}return[i(p)]}else{if(l.type=="name")return[i(s,void 0,l.value)];throw new Error("Unknown expr type")}}}}function xL(r,e){return e-r}function hL(r,e){let t=[];return i(e),t.sort(xL);function i(n){let a=r[n];if(a.length==1&&!a[0].term)return i(a[0].to);t.push(n);for(let l=0;l<a.length;l++){let{term:s,to:p}=a[l];!s&&t.indexOf(p)==-1&&i(p)}}}function VI(r){let e=Object.create(null);return t(hL(r,0));function t(i){let n=[];i.forEach(l=>{r[l].forEach(({term:s,to:p})=>{if(!s)return;let d;for(let c=0;c<n.length;c++)n[c][0]==s&&(d=n[c][1]);hL(r,p).forEach(c=>{d||n.push([s,d=[]]),d.indexOf(c)==-1&&d.push(c)})})});let a=e[i.join(",")]=new Co(i.indexOf(r.length-1)>-1);for(let l=0;l<n.length;l++){let s=n[l][1].sort(xL);a.next.push({type:n[l][0],next:e[s.join(",")]||t(s)})}return a}}function HI(r,e){for(let t=0,i=[r];t<i.length;t++){let n=i[t],a=!n.validEnd,l=[];for(let s=0;s<n.next.length;s++){let{type:p,next:d}=n.next[s];l.push(p.name),a&&!(p.isText||p.hasRequiredAttrs())&&(a=!1),i.indexOf(d)==-1&&i.push(d)}a&&e.err("Only non-generatable nodes ("+l.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}function fL(r){let e=Object.create(null);for(let t in r){let i=r[t];if(!i.hasDefault)return null;e[t]=i.default}return e}function yL(r,e){let t=Object.create(null);for(let i in r){let n=e&&e[i];if(n===void 0){let a=r[i];if(a.hasDefault)n=a.default;else throw new RangeError("No value supplied for attribute "+i)}t[i]=n}return t}function wL(r,e,t,i){for(let n in e)if(!(n in r))throw new RangeError(`Unsupported attribute ${n} for ${t} of type ${i}`);for(let n in r)r[n].validate&&r[n].validate(e[n])}function vL(r,e){let t=Object.create(null);if(e)for(let i in e)t[i]=new OI(r,i,e[i]);return t}let kL=class Hz{constructor(e,t,i){this.name=e,this.schema=t,this.spec=i,this.markSet=null,this.groups=i.group?i.group.split(" "):[],this.attrs=vL(e,i.attrs),this.defaultAttrs=fL(this.attrs),this.contentMatch=null,this.inlineContent=null,this.isBlock=!(i.inline||e=="text"),this.isText=e=="text"}get isInline(){return!this.isBlock}get isTextblock(){return this.isBlock&&this.inlineContent}get isLeaf(){return this.contentMatch==Co.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:yL(this.attrs,e)}create(e=null,t,i){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new Rr(this,this.computeAttrs(e),G.from(t),ve.setFrom(i))}createChecked(e=null,t,i){return t=G.from(t),this.checkContent(t),new Rr(this,this.computeAttrs(e),t,ve.setFrom(i))}createAndFill(e=null,t,i){if(e=this.computeAttrs(e),t=G.from(t),t.size){let l=this.contentMatch.fillBefore(t);if(!l)return null;t=l.append(t)}let n=this.contentMatch.matchFragment(t),a=n&&n.fillBefore(G.empty,!0);return a?new Rr(this,e,t.append(a),ve.setFrom(i)):null}validContent(e){let t=this.contentMatch.matchFragment(e);if(!t||!t.validEnd)return!1;for(let i=0;i<e.childCount;i++)if(!this.allowsMarks(e.child(i).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){wL(this.attrs,e,"node",this.name)}allowsMarkType(e){return this.markSet==null||this.markSet.indexOf(e)>-1}allowsMarks(e){if(this.markSet==null)return!0;for(let t=0;t<e.length;t++)if(!this.allowsMarkType(e[t].type))return!1;return!0}allowedMarks(e){if(this.markSet==null)return e;let t;for(let i=0;i<e.length;i++)this.allowsMarkType(e[i].type)?t&&t.push(e[i]):t||(t=e.slice(0,i));return t?t.length?t:ve.none:e}static compile(e,t){let i=Object.create(null);e.forEach((a,l)=>i[a]=new Hz(a,t,l));let n=t.spec.topNode||"doc";if(!i[n])throw new RangeError("Schema is missing its top node type ('"+n+"')");if(!i.text)throw new RangeError("Every schema needs a 'text' type");for(let a in i.text.attrs)throw new RangeError("The text node type should not have attributes");return i}};function RI(r,e,t){let i=t.split("|");return n=>{let a=n===null?"null":typeof n;if(i.indexOf(a)<0)throw new RangeError(`Expected value of type ${i} for attribute ${e} on type ${r}, got ${a}`)}}class OI{constructor(e,t,i){this.hasDefault=Object.prototype.hasOwnProperty.call(i,"default"),this.default=i.default,this.validate=typeof i.validate=="string"?RI(e,t,i.validate):i.validate}get isRequired(){return!this.hasDefault}}class ga{constructor(e,t,i,n){this.name=e,this.rank=t,this.schema=i,this.spec=n,this.attrs=vL(e,n.attrs),this.excluded=null;let a=fL(this.attrs);this.instance=a?new ve(this,a):null}create(e=null){return!e&&this.instance?this.instance:new ve(this,yL(this.attrs,e))}static compile(e,t){let i=Object.create(null),n=0;return e.forEach((a,l)=>i[a]=new ga(a,n++,t,l)),i}removeFromSet(e){for(var t=0;t<e.length;t++)e[t].type==this&&(e=e.slice(0,t).concat(e.slice(t+1)),t--);return e}isInSet(e){for(let t=0;t<e.length;t++)if(e[t].type==this)return e[t]}checkAttrs(e){wL(this.attrs,e,"mark",this.name)}excludes(e){return this.excluded.indexOf(e)>-1}}class SL{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let t=this.spec={};for(let n in e)t[n]=e[n];t.nodes=Ze.from(e.nodes),t.marks=Ze.from(e.marks||{}),this.nodes=kL.compile(this.spec.nodes,this),this.marks=ga.compile(this.spec.marks,this);let i=Object.create(null);for(let n in this.nodes){if(n in this.marks)throw new RangeError(n+" can not be both a node and a mark");let a=this.nodes[n],l=a.spec.content||"",s=a.spec.marks;if(a.contentMatch=i[l]||(i[l]=Co.parse(l,this.nodes)),a.inlineContent=a.contentMatch.inlineContent,a.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!a.isInline||!a.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=a}a.markSet=s=="_"?null:s?CL(this,s.split(" ")):s==""||!a.inlineContent?[]:null}for(let n in this.marks){let a=this.marks[n],l=a.spec.excludes;a.excluded=l==null?[a]:l==""?[]:CL(this,l.split(" "))}this.nodeFromJSON=n=>Rr.fromJSON(this,n),this.markFromJSON=n=>ve.fromJSON(this,n),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(e,t=null,i,n){if(typeof e=="string")e=this.nodeType(e);else if(e instanceof kL){if(e.schema!=this)throw new RangeError("Node type from different schema used ("+e.name+")")}else throw new RangeError("Invalid node type: "+e);return e.createChecked(t,i,n)}text(e,t){let i=this.nodes.text;return new ma(i,i.defaultAttrs,e,ve.setFrom(t))}mark(e,t){return typeof e=="string"&&(e=this.marks[e]),e.create(t)}nodeType(e){let t=this.nodes[e];if(!t)throw new RangeError("Unknown node type: "+e);return t}}function CL(r,e){let t=[];for(let i=0;i<e.length;i++){let n=e[i],a=r.marks[n],l=a;if(a)t.push(a);else for(let s in r.marks){let p=r.marks[s];(n=="_"||p.spec.group&&p.spec.group.split(" ").indexOf(n)>-1)&&t.push(l=p)}if(!l)throw new SyntaxError("Unknown mark type: '"+e[i]+"'")}return t}function FI(r){return r.tag!=null}function jI(r){return r.style!=null}let Wi=class wc{constructor(e,t){this.schema=e,this.rules=t,this.tags=[],this.styles=[];let i=this.matchedStyles=[];t.forEach(n=>{if(FI(n))this.tags.push(n);else if(jI(n)){let a=/[^=]*/.exec(n.style)[0];i.indexOf(a)<0&&i.push(a),this.styles.push(n)}}),this.normalizeLists=!this.tags.some(n=>{if(!/^(ul|ol)\b/.test(n.tag)||!n.node)return!1;let a=e.nodes[n.node];return a.contentMatch.matchType(a)})}parse(e,t={}){let i=new PL(this,t,!1);return i.addAll(e,ve.none,t.from,t.to),i.finish()}parseSlice(e,t={}){let i=new PL(this,t,!0);return i.addAll(e,ve.none,t.from,t.to),$.maxOpen(i.finish())}matchTag(e,t,i){for(let n=i?this.tags.indexOf(i)+1:0;n<this.tags.length;n++){let a=this.tags[n];if(WI(e,a.tag)&&(a.namespace===void 0||e.namespaceURI==a.namespace)&&(!a.context||t.matchesContext(a.context))){if(a.getAttrs){let l=a.getAttrs(e);if(l===!1)continue;a.attrs=l||void 0}return a}}}matchStyle(e,t,i,n){for(let a=n?this.styles.indexOf(n)+1:0;a<this.styles.length;a++){let l=this.styles[a],s=l.style;if(!(s.indexOf(e)!=0||l.context&&!i.matchesContext(l.context)||s.length>e.length&&(s.charCodeAt(e.length)!=61||s.slice(e.length+1)!=t))){if(l.getAttrs){let p=l.getAttrs(t);if(p===!1)continue;l.attrs=p||void 0}return l}}}static schemaRules(e){let t=[];function i(n){let a=n.priority==null?50:n.priority,l=0;for(;l<t.length;l++){let s=t[l];if((s.priority==null?50:s.priority)<a)break}t.splice(l,0,n)}for(let n in e.marks){let a=e.marks[n].spec.parseDOM;a&&a.forEach(l=>{i(l=BL(l)),l.mark||l.ignore||l.clearMark||(l.mark=n)})}for(let n in e.nodes){let a=e.nodes[n].spec.parseDOM;a&&a.forEach(l=>{i(l=BL(l)),l.node||l.ignore||l.mark||(l.node=n)})}return t}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new wc(e,wc.schemaRules(e)))}};const TL={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},qI={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},EL={ol:!0,ul:!0},Gi=1,Ds=2,Ki=4;function ML(r,e,t){return e!=null?(e?Gi:0)|(e==="full"?Ds:0):r&&r.whitespace=="pre"?Gi|Ds:t&~Ki}class ua{constructor(e,t,i,n,a,l){this.type=e,this.attrs=t,this.marks=i,this.solid=n,this.options=l,this.content=[],this.activeMarks=ve.none,this.match=a||(l&Ki?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let t=this.type.contentMatch.fillBefore(G.from(e));if(t)this.match=this.type.contentMatch.matchFragment(t);else{let i=this.type.contentMatch,n;return(n=i.findWrapping(e.type))?(this.match=i,n):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&Gi)){let i=this.content[this.content.length-1],n;if(i&&i.isText&&(n=/[ \t\r\n\u000c]+$/.exec(i.text))){let a=i;i.text.length==n[0].length?this.content.pop():this.content[this.content.length-1]=a.withText(a.text.slice(0,a.text.length-n[0].length))}}let t=G.from(this.content);return!e&&this.match&&(t=t.append(this.match.fillBefore(G.empty,!0))),this.type?this.type.create(this.attrs,t,this.marks):t}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!TL.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class PL{constructor(e,t,i){this.parser=e,this.options=t,this.isOpen=i,this.open=0,this.localPreserveWS=!1;let n=t.topNode,a,l=ML(null,t.preserveWhitespace,0)|(i?Ki:0);n?a=new ua(n.type,n.attrs,ve.none,!0,t.topMatch||n.type.contentMatch,l):i?a=new ua(null,null,ve.none,!0,null,l):a=new ua(e.schema.topNodeType,null,ve.none,!0,null,l),this.nodes=[a],this.find=t.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e,t){e.nodeType==3?this.addTextNode(e,t):e.nodeType==1&&this.addElement(e,t)}addTextNode(e,t){let i=e.nodeValue,n=this.top,a=n.options&Ds?"full":this.localPreserveWS||(n.options&Gi)>0,{schema:l}=this.parser;if(a==="full"||n.inlineContext(e)||/[^ \t\r\n\u000c]/.test(i)){if(a)if(a==="full")i=i.replace(/\r\n?/g,`
17
17
  `);else if(l.linebreakReplacement&&/[\r\n]/.test(i)&&this.top.findWrapping(l.linebreakReplacement.create())){let s=i.split(/\r?\n|\r/);for(let p=0;p<s.length;p++)p&&this.insertNode(l.linebreakReplacement.create(),t,!0),s[p]&&this.insertNode(l.text(s[p]),t,!/\S/.test(s[p]));i=""}else i=i.replace(/\r?\n|\r/g," ");else if(i=i.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(i)&&this.open==this.nodes.length-1){let s=n.content[n.content.length-1],p=e.previousSibling;(!s||p&&p.nodeName=="BR"||s.isText&&/[ \t\r\n\u000c]$/.test(s.text))&&(i=i.slice(1))}i&&this.insertNode(l.text(i),t,!/\S/.test(i)),this.findInText(e)}else this.findInside(e)}addElement(e,t,i){let n=this.localPreserveWS,a=this.top;(e.tagName=="PRE"||/pre/.test(e.style&&e.style.whiteSpace))&&(this.localPreserveWS=!0);let l=e.nodeName.toLowerCase(),s;EL.hasOwnProperty(l)&&this.parser.normalizeLists&&UI(e);let p=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(s=this.parser.matchTag(e,this,i));e:if(p?p.ignore:qI.hasOwnProperty(l))this.findInside(e),this.ignoreFallback(e,t);else if(!p||p.skip||p.closeParent){p&&p.closeParent?this.open=Math.max(0,this.open-1):p&&p.skip.nodeType&&(e=p.skip);let d,c=this.needsBlock;if(TL.hasOwnProperty(l))a.content.length&&a.content[0].isInline&&this.open&&(this.open--,a=this.top),d=!0,a.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e,t);break e}let b=p&&p.skip?t:this.readStyles(e,t);b&&this.addAll(e,b),d&&this.sync(a),this.needsBlock=c}else{let d=this.readStyles(e,t);d&&this.addElementByRule(e,p,d,p.consuming===!1?s:void 0)}this.localPreserveWS=n}leafFallback(e,t){e.nodeName=="BR"&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode(`
18
18
  `),t)}ignoreFallback(e,t){e.nodeName=="BR"&&(!this.top.type||!this.top.type.inlineContent)&&this.findPlace(this.parser.schema.text("-"),t,!0)}readStyles(e,t){let i=e.style;if(i&&i.length)for(let n=0;n<this.parser.matchedStyles.length;n++){let a=this.parser.matchedStyles[n],l=i.getPropertyValue(a);if(l)for(let s=void 0;;){let p=this.parser.matchStyle(a,l,this,s);if(!p)break;if(p.ignore)return null;if(p.clearMark?t=t.filter(d=>!p.clearMark(d)):t=t.concat(this.parser.schema.marks[p.mark].create(p.attrs)),p.consuming===!1)s=p;else break}}return t}addElementByRule(e,t,i,n){let a,l;if(t.node)if(l=this.parser.schema.nodes[t.node],l.isLeaf)this.insertNode(l.create(t.attrs),i,e.nodeName=="BR")||this.leafFallback(e,i);else{let p=this.enter(l,t.attrs||null,i,t.preserveWhitespace);p&&(a=!0,i=p)}else{let p=this.parser.schema.marks[t.mark];i=i.concat(p.create(t.attrs))}let s=this.top;if(l&&l.isLeaf)this.findInside(e);else if(n)this.addElement(e,i,n);else if(t.getContent)this.findInside(e),t.getContent(e,this.parser.schema).forEach(p=>this.insertNode(p,i,!1));else{let p=e;typeof t.contentElement=="string"?p=e.querySelector(t.contentElement):typeof t.contentElement=="function"?p=t.contentElement(e):t.contentElement&&(p=t.contentElement),this.findAround(e,p,!0),this.addAll(p,i),this.findAround(e,p,!1)}a&&this.sync(s)&&this.open--}addAll(e,t,i,n){let a=i||0;for(let l=i?e.childNodes[i]:e.firstChild,s=n==null?null:e.childNodes[n];l!=s;l=l.nextSibling,++a)this.findAtPoint(e,a),this.addDOM(l,t);this.findAtPoint(e,a)}findPlace(e,t,i){let n,a;for(let l=this.open,s=0;l>=0;l--){let p=this.nodes[l],d=p.findWrapping(e);if(d&&(!n||n.length>d.length+s)&&(n=d,a=p,!d.length))break;if(p.solid){if(i)break;s+=2}}if(!n)return null;this.sync(a);for(let l=0;l<n.length;l++)t=this.enterInner(n[l],null,t,!1);return t}insertNode(e,t,i){if(e.isInline&&this.needsBlock&&!this.top.type){let a=this.textblockFromContext();a&&(t=this.enterInner(a,null,t))}let n=this.findPlace(e,t,i);if(n){this.closeExtra();let a=this.top;a.match&&(a.match=a.match.matchType(e.type));let l=ve.none;for(let s of n.concat(e.marks))(a.type?a.type.allowsMarkType(s.type):LL(s.type,e.type))&&(l=s.addToSet(l));return a.content.push(e.mark(l)),!0}return!1}enter(e,t,i,n){let a=this.findPlace(e.create(t),i,!1);return a&&(a=this.enterInner(e,t,i,!0,n)),a}enterInner(e,t,i,n=!1,a){this.closeExtra();let l=this.top;l.match=l.match&&l.match.matchType(e);let s=ML(e,a,l.options);l.options&Ki&&l.content.length==0&&(s|=Ki);let p=ve.none;return i=i.filter(d=>(l.type?l.type.allowsMarkType(d.type):LL(d.type,e))?(p=d.addToSet(p),!1):!0),this.nodes.push(new ua(e,t,p,n,null,s)),this.open++,i}closeExtra(e=!1){let t=this.nodes.length-1;if(t>this.open){for(;t>this.open;t--)this.nodes[t-1].content.push(this.nodes[t].finish(e));this.nodes.length=this.open+1}}finish(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(!!(this.isOpen||this.options.topOpen))}sync(e){for(let t=this.open;t>=0;t--){if(this.nodes[t]==e)return this.open=t,!0;this.localPreserveWS&&(this.nodes[t].options|=Gi)}return!1}get currentPos(){this.closeExtra();let e=0;for(let t=this.open;t>=0;t--){let i=this.nodes[t].content;for(let n=i.length-1;n>=0;n--)e+=i[n].nodeSize;t&&e++}return e}findAtPoint(e,t){if(this.find)for(let i=0;i<this.find.length;i++)this.find[i].node==e&&this.find[i].offset==t&&(this.find[i].pos=this.currentPos)}findInside(e){if(this.find)for(let t=0;t<this.find.length;t++)this.find[t].pos==null&&e.nodeType==1&&e.contains(this.find[t].node)&&(this.find[t].pos=this.currentPos)}findAround(e,t,i){if(e!=t&&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)&&t.compareDocumentPosition(this.find[n].node)&(i?2:4)&&(this.find[n].pos=this.currentPos)}findInText(e){if(this.find)for(let t=0;t<this.find.length;t++)this.find[t].node==e&&(this.find[t].pos=this.currentPos-(e.nodeValue.length-this.find[t].offset))}matchesContext(e){if(e.indexOf("|")>-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let t=e.split("/"),i=this.options.context,n=!this.isOpen&&(!i||i.parent.type==this.nodes[0].type),a=-(i?i.depth+1:0)+(n?0:1),l=(s,p)=>{for(;s>=0;s--){let d=t[s];if(d==""){if(s==t.length-1||s==0)continue;for(;p>=a;p--)if(l(s-1,p))return!0;return!1}else{let c=p>0||p==0&&n?this.nodes[p].type:i&&p>=a?i.node(p-a).type:null;if(!c||c.name!=d&&!c.isInGroup(d))return!1;p--}}return!0};return l(t.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let t=e.depth;t>=0;t--){let i=e.node(t).contentMatchAt(e.indexAfter(t)).defaultType;if(i&&i.isTextblock&&i.defaultAttrs)return i}for(let t in this.parser.schema.nodes){let i=this.parser.schema.nodes[t];if(i.isTextblock&&i.defaultAttrs)return i}}}function UI(r){for(let e=r.firstChild,t=null;e;e=e.nextSibling){let i=e.nodeType==1?e.nodeName.toLowerCase():null;i&&EL.hasOwnProperty(i)&&t?(t.appendChild(e),e=t):i=="li"?t=e:i&&(t=null)}}function WI(r,e){return(r.matches||r.msMatchesSelector||r.webkitMatchesSelector||r.mozMatchesSelector).call(r,e)}function BL(r){let e={};for(let t in r)e[t]=r[t];return e}function LL(r,e){let t=e.schema.nodes;for(let i in t){let n=t[i];if(!n.allowsMarkType(r))continue;let a=[],l=s=>{a.push(s);for(let p=0;p<s.edgeCount;p++){let{type:d,next:c}=s.edge(p);if(d==e||a.indexOf(c)<0&&l(c))return!0}};if(l(n.contentMatch))return!0}}class To{constructor(e,t){this.nodes=e,this.marks=t}serializeFragment(e,t={},i){i||(i=xa(t).createDocumentFragment());let n=i,a=[];return e.forEach(l=>{if(a.length||l.marks.length){let s=0,p=0;for(;s<a.length&&p<l.marks.length;){let d=l.marks[p];if(!this.marks[d.type.name]){p++;continue}if(!d.eq(a[s][0])||d.type.spec.spanning===!1)break;s++,p++}for(;s<a.length;)n=a.pop()[1];for(;p<l.marks.length;){let d=l.marks[p++],c=this.serializeMark(d,l.isInline,t);c&&(a.push([d,n]),n.appendChild(c.dom),n=c.contentDOM||c.dom)}}n.appendChild(this.serializeNodeInner(l,t))}),i}serializeNodeInner(e,t){if(e.isText)return xa(t).createTextNode(e.text);let{dom:i,contentDOM:n}=ha(xa(t),this.nodes[e.type.name](e),null,e.attrs);if(n){if(e.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(e.content,t,n)}return i}serializeNode(e,t={}){let i=this.serializeNodeInner(e,t);for(let n=e.marks.length-1;n>=0;n--){let a=this.serializeMark(e.marks[n],e.isInline,t);a&&((a.contentDOM||a.dom).appendChild(i),i=a.dom)}return i}serializeMark(e,t,i={}){let n=this.marks[e.type.name];return n&&ha(xa(i),n(e,t),null,e.attrs)}static renderSpec(e,t,i=null,n){return typeof t=="string"?{dom:e.createTextNode(t)}:ha(e,t,i,n)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new To(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let t=NL(e.nodes);return t.text||(t.text=i=>i.text),t}static marksFromSchema(e){return NL(e.marks)}}function NL(r){let e={};for(let t in r){let i=r[t].spec.toDOM;i&&(e[t]=i)}return e}function xa(r){return r.document||window.document}const AL=new WeakMap;function GI(r){let e=AL.get(r);return e===void 0&&AL.set(r,e=KI(r)),e}function KI(r){let e=null;function t(i){if(i&&typeof i=="object")if(Array.isArray(i))if(typeof i[0]=="string")e||(e=[]),e.push(i);else for(let n=0;n<i.length;n++)t(i[n]);else for(let n in i)t(i[n])}return t(r),e}function ha(r,e,t,i){if(e.nodeType==1)return{dom:e};if(e.dom&&e.dom.nodeType==1)return e;let n=e[0],a;if(typeof n!="string")throw new RangeError("Invalid array passed to renderSpec");if(i&&(a=GI(i))&&a.indexOf(e)>-1)throw new RangeError("Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.");let l=n.indexOf(" ");l>0&&(t=n.slice(0,l),n=n.slice(l+1));let s,p=t?r.createElementNS(t,n):r.createElement(n),d=e[1],c=1;if(d&&typeof d=="object"&&d.nodeType==null&&!Array.isArray(d)){c=2;for(let b in d)if(d[b]!=null){let m=b.indexOf(" ");m>0?p.setAttributeNS(b.slice(0,m),b.slice(m+1),d[b]):b=="style"&&p.style?p.style.cssText=d[b]:p.setAttribute(b,d[b])}}for(let b=c;b<e.length;b++){let m=e[b];if(m===0){if(b<e.length-1||b>c)throw new RangeError("Content hole must be the only child of its parent node");return{dom:p,contentDOM:p}}else if(typeof m=="string")p.appendChild(r.createTextNode(m));else{let{dom:g,contentDOM:x}=ha(r,m,t,i);if(p.appendChild(g),x){if(s)throw new RangeError("Multiple content holes");s=x}}}return{dom:p,contentDOM:s}}const _L=65535,DL=Math.pow(2,16);function JI(r,e){return r+e*DL}function zL(r){return r&_L}function YI(r){return(r-(r&_L))/DL}const IL=1,VL=2,fa=4,HL=8;let zs=class{constructor(e,t,i){this.pos=e,this.delInfo=t,this.recover=i}get deleted(){return(this.delInfo&HL)>0}get deletedBefore(){return(this.delInfo&(IL|fa))>0}get deletedAfter(){return(this.delInfo&(VL|fa))>0}get deletedAcross(){return(this.delInfo&fa)>0}},Eo=class Ri{constructor(e,t=!1){if(this.ranges=e,this.inverted=t,!e.length&&Ri.empty)return Ri.empty}recover(e){let t=0,i=zL(e);if(!this.inverted)for(let n=0;n<i;n++)t+=this.ranges[n*3+2]-this.ranges[n*3+1];return this.ranges[i*3]+t+YI(e)}mapResult(e,t=1){return this._map(e,t,!1)}map(e,t=1){return this._map(e,t,!0)}_map(e,t,i){let n=0,a=this.inverted?2:1,l=this.inverted?1:2;for(let s=0;s<this.ranges.length;s+=3){let p=this.ranges[s]-(this.inverted?n:0);if(p>e)break;let d=this.ranges[s+a],c=this.ranges[s+l],b=p+d;if(e<=b){let m=d?e==p?-1:e==b?1:t:t,g=p+n+(m<0?0:c);if(i)return g;let x=e==(t<0?p:b)?null:JI(s/3,e-p),u=e==p?VL:e==b?IL:fa;return(t<0?e!=p:e!=b)&&(u|=HL),new zs(g,u,x)}n+=c-d}return i?e+n:new zs(e+n,0,null)}touches(e,t){let i=0,n=zL(t),a=this.inverted?2:1,l=this.inverted?1:2;for(let s=0;s<this.ranges.length;s+=3){let p=this.ranges[s]-(this.inverted?i:0);if(p>e)break;let d=this.ranges[s+a],c=p+d;if(e<=c&&s==n*3)return!0;i+=this.ranges[s+l]-d}return!1}forEach(e){let t=this.inverted?2:1,i=this.inverted?1:2;for(let n=0,a=0;n<this.ranges.length;n+=3){let l=this.ranges[n],s=l-(this.inverted?a:0),p=l+(this.inverted?0:a),d=this.ranges[n+t],c=this.ranges[n+i];e(s,s+d,p,p+c),a+=c-d}}invert(){return new Ri(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?Ri.empty:new Ri(e<0?[0,-e,0]:[0,0,e])}};Eo.empty=new Eo([]);class Ji{constructor(e,t,i=0,n=e?e.length:0){this.mirror=t,this.from=i,this.to=n,this._maps=e||[],this.ownData=!(e||t)}get maps(){return this._maps}slice(e=0,t=this.maps.length){return new Ji(this._maps,this.mirror,e,t)}appendMap(e,t){this.ownData||(this._maps=this._maps.slice(),this.mirror=this.mirror&&this.mirror.slice(),this.ownData=!0),this.to=this._maps.push(e),t!=null&&this.setMirror(this._maps.length-1,t)}appendMapping(e){for(let t=0,i=this._maps.length;t<e._maps.length;t++){let n=e.getMirror(t);this.appendMap(e._maps[t],n!=null&&n<t?i+n:void 0)}}getMirror(e){if(this.mirror){for(let t=0;t<this.mirror.length;t++)if(this.mirror[t]==e)return this.mirror[t+(t%2?-1:1)]}}setMirror(e,t){this.mirror||(this.mirror=[]),this.mirror.push(e,t)}appendMappingInverted(e){for(let t=e.maps.length-1,i=this._maps.length+e._maps.length;t>=0;t--){let n=e.getMirror(t);this.appendMap(e._maps[t].invert(),n!=null&&n>t?i-n-1:void 0)}}invert(){let e=new Ji;return e.appendMappingInverted(this),e}map(e,t=1){if(this.mirror)return this._map(e,t,!0);for(let i=this.from;i<this.to;i++)e=this._maps[i].map(e,t);return e}mapResult(e,t=1){return this._map(e,t,!1)}_map(e,t,i){let n=0;for(let a=this.from;a<this.to;a++){let l=this._maps[a],s=l.mapResult(e,t);if(s.recover!=null){let p=this.getMirror(a);if(p!=null&&p>a&&p<this.to){a=p,e=this._maps[p].recover(s.recover);continue}}n|=s.delInfo,e=s.pos}return i?e:new zs(e,n,null)}}const Is=Object.create(null);let nt=class{getMap(){return Eo.empty}merge(e){return null}static fromJSON(e,t){if(!t||!t.stepType)throw new RangeError("Invalid input for Step.fromJSON");let i=Is[t.stepType];if(!i)throw new RangeError(`No step type ${t.stepType} defined`);return i.fromJSON(e,t)}static jsonID(e,t){if(e in Is)throw new RangeError("Duplicate use of step JSON ID "+e);return Is[e]=t,t.prototype.jsonID=e,t}},ut=class Yn{constructor(e,t){this.doc=e,this.failed=t}static ok(e){return new Yn(e,null)}static fail(e){return new Yn(null,e)}static fromReplace(e,t,i,n){try{return Yn.ok(e.replace(t,i,n))}catch(a){if(a instanceof ji)return Yn.fail(a.message);throw a}}};function Vs(r,e,t){let i=[];for(let n=0;n<r.childCount;n++){let a=r.child(n);a.content.size&&(a=a.copy(Vs(a.content,e,a))),a.isInline&&(a=e(a,t,n)),i.push(a)}return G.fromArray(i)}let Hs=class Qn extends nt{constructor(e,t,i){super(),this.from=e,this.to=t,this.mark=i}apply(e){let t=e.slice(this.from,this.to),i=e.resolve(this.from),n=i.node(i.sharedDepth(this.to)),a=new $(Vs(t.content,(l,s)=>!l.isAtom||!s.type.allowsMarkType(this.mark.type)?l:l.mark(this.mark.addToSet(l.marks)),n),t.openStart,t.openEnd);return ut.fromReplace(e,this.from,this.to,a)}invert(){return new ei(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),i=e.mapResult(this.to,-1);return t.deleted&&i.deleted||t.pos>=i.pos?null:new Qn(t.pos,i.pos,this.mark)}merge(e){return e instanceof Qn&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Qn(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new Qn(t.from,t.to,e.markFromJSON(t.mark))}};nt.jsonID("addMark",Hs);let ei=class Xn extends nt{constructor(e,t,i){super(),this.from=e,this.to=t,this.mark=i}apply(e){let t=e.slice(this.from,this.to),i=new $(Vs(t.content,n=>n.mark(this.mark.removeFromSet(n.marks)),e),t.openStart,t.openEnd);return ut.fromReplace(e,this.from,this.to,i)}invert(){return new Hs(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),i=e.mapResult(this.to,-1);return t.deleted&&i.deleted||t.pos>=i.pos?null:new Xn(t.pos,i.pos,this.mark)}merge(e){return e instanceof Xn&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Xn(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new Xn(t.from,t.to,e.markFromJSON(t.mark))}};nt.jsonID("removeMark",ei);let Rs=class Zn extends nt{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return ut.fail("No node at mark step's position");let i=t.type.create(t.attrs,null,this.mark.addToSet(t.marks));return ut.fromReplace(e,this.pos,this.pos+1,new $(G.from(i),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);if(t){let i=this.mark.addToSet(t.marks);if(i.length==t.marks.length){for(let n=0;n<t.marks.length;n++)if(!t.marks[n].isInSet(i))return new Zn(this.pos,t.marks[n]);return new Zn(this.pos,this.mark)}}return new ya(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new Zn(t.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,t){if(typeof t.pos!="number")throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new Zn(t.pos,e.markFromJSON(t.mark))}};nt.jsonID("addNodeMark",Rs);let ya=class vc extends nt{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return ut.fail("No node at mark step's position");let i=t.type.create(t.attrs,null,this.mark.removeFromSet(t.marks));return ut.fromReplace(e,this.pos,this.pos+1,new $(G.from(i),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);return!t||!this.mark.isInSet(t.marks)?this:new Rs(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new vc(t.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,t){if(typeof t.pos!="number")throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new vc(t.pos,e.markFromJSON(t.mark))}};nt.jsonID("removeNodeMark",ya);let _t=class yo extends nt{constructor(e,t,i,n=!1){super(),this.from=e,this.to=t,this.slice=i,this.structure=n}apply(e){return this.structure&&Os(e,this.from,this.to)?ut.fail("Structure replace would overwrite content"):ut.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new Eo([this.from,this.to-this.from,this.slice.size])}invert(e){return new yo(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let t=e.mapResult(this.to,-1),i=this.from==this.to&&yo.MAP_BIAS<0?t:e.mapResult(this.from,1);return i.deletedAcross&&t.deletedAcross?null:new yo(i.pos,Math.max(i.pos,t.pos),this.slice,this.structure)}merge(e){if(!(e instanceof yo)||e.structure||this.structure)return null;if(this.from+this.slice.size==e.from&&!this.slice.openEnd&&!e.slice.openStart){let t=this.slice.size+e.slice.size==0?$.empty:new $(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new yo(this.from,this.to+(e.to-e.from),t,this.structure)}else if(e.to==this.from&&!this.slice.openStart&&!e.slice.openEnd){let t=this.slice.size+e.slice.size==0?$.empty:new $(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new yo(e.from,this.to,t,this.structure)}else return null}toJSON(){let e={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new yo(t.from,t.to,$.fromJSON(e,t.slice),!!t.structure)}};_t.MAP_BIAS=1,nt.jsonID("replace",_t);let Mt=class Ts extends nt{constructor(e,t,i,n,a,l,s=!1){super(),this.from=e,this.to=t,this.gapFrom=i,this.gapTo=n,this.slice=a,this.insert=l,this.structure=s}apply(e){if(this.structure&&(Os(e,this.from,this.gapFrom)||Os(e,this.gapTo,this.to)))return ut.fail("Structure gap-replace would overwrite content");let t=e.slice(this.gapFrom,this.gapTo);if(t.openStart||t.openEnd)return ut.fail("Gap is not a flat range");let i=this.slice.insertAt(this.insert,t.content);return i?ut.fromReplace(e,this.from,this.to,i):ut.fail("Content does not fit in gap")}getMap(){return new Eo([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(e){let t=this.gapTo-this.gapFrom;return new Ts(this.from,this.from+this.slice.size+t,this.from+this.insert,this.from+this.insert+t,e.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(e){let t=e.mapResult(this.from,1),i=e.mapResult(this.to,-1),n=this.from==this.gapFrom?t.pos:e.map(this.gapFrom,-1),a=this.to==this.gapTo?i.pos:e.map(this.gapTo,1);return t.deletedAcross&&i.deletedAcross||n<t.pos||a>i.pos?null:new Ts(t.pos,i.pos,n,a,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number"||typeof t.gapFrom!="number"||typeof t.gapTo!="number"||typeof t.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new Ts(t.from,t.to,t.gapFrom,t.gapTo,$.fromJSON(e,t.slice),t.insert,!!t.structure)}};nt.jsonID("replaceAround",Mt);function Os(r,e,t){let i=r.resolve(e),n=t-e,a=i.depth;for(;n>0&&a>0&&i.indexAfter(a)==i.node(a).childCount;)a--,n--;if(n>0){let l=i.node(a).maybeChild(i.indexAfter(a));for(;n>0;){if(!l||l.isLeaf)return!0;l=l.firstChild,n--}}return!1}function QI(r,e,t,i){let n=[],a=[],l,s;r.doc.nodesBetween(e,t,(p,d,c)=>{if(!p.isInline)return;let b=p.marks;if(!i.isInSet(b)&&c.type.allowsMarkType(i.type)){let m=Math.max(d,e),g=Math.min(d+p.nodeSize,t),x=i.addToSet(b);for(let u=0;u<b.length;u++)b[u].isInSet(x)||(l&&l.to==m&&l.mark.eq(b[u])?l.to=g:n.push(l=new ei(m,g,b[u])));s&&s.to==m?s.to=g:a.push(s=new Hs(m,g,i))}}),n.forEach(p=>r.step(p)),a.forEach(p=>r.step(p))}function XI(r,e,t,i){let n=[],a=0;r.doc.nodesBetween(e,t,(l,s)=>{if(!l.isInline)return;a++;let p=null;if(i instanceof ga){let d=l.marks,c;for(;c=i.isInSet(d);)(p||(p=[])).push(c),d=c.removeFromSet(d)}else i?i.isInSet(l.marks)&&(p=[i]):p=l.marks;if(p&&p.length){let d=Math.min(s+l.nodeSize,t);for(let c=0;c<p.length;c++){let b=p[c],m;for(let g=0;g<n.length;g++){let x=n[g];x.step==a-1&&b.eq(n[g].style)&&(m=x)}m?(m.to=d,m.step=a):n.push({style:b,from:Math.max(s,e),to:d,step:a})}}}),n.forEach(l=>r.step(new ei(l.from,l.to,l.style)))}function Fs(r,e,t,i=t.contentMatch,n=!0){let a=r.doc.nodeAt(e),l=[],s=e+1;for(let p=0;p<a.childCount;p++){let d=a.child(p),c=s+d.nodeSize,b=i.matchType(d.type);if(!b)l.push(new _t(s,c,$.empty));else{i=b;for(let m=0;m<d.marks.length;m++)t.allowsMarkType(d.marks[m].type)||r.step(new ei(s,c,d.marks[m]));if(n&&d.isText&&t.whitespace!="pre"){let m,g=/\r?\n|\r/g,x;for(;m=g.exec(d.text);)x||(x=new $(G.from(t.schema.text(" ",t.allowedMarks(d.marks))),0,0)),l.push(new _t(s+m.index,s+m.index+m[0].length,x))}}s=c}if(!i.validEnd){let p=i.fillBefore(G.empty,!0);r.replace(s,s,new $(p,0,0))}for(let p=l.length-1;p>=0;p--)r.step(l[p])}function ZI(r,e,t){return(e==0||r.canReplace(e,r.childCount))&&(t==r.childCount||r.canReplace(0,t))}function ti(r){let t=r.parent.content.cutByIndex(r.startIndex,r.endIndex);for(let i=r.depth,n=0,a=0;;--i){let l=r.$from.node(i),s=r.$from.index(i)+n,p=r.$to.indexAfter(i)-a;if(i<r.depth&&l.canReplace(s,p,t))return i;if(i==0||l.type.spec.isolating||!ZI(l,s,p))break;s&&(n=1),p<l.childCount&&(a=1)}return null}function $I(r,e,t){let{$from:i,$to:n,depth:a}=e,l=i.before(a+1),s=n.after(a+1),p=l,d=s,c=G.empty,b=0;for(let x=a,u=!1;x>t;x--)u||i.index(x)>0?(u=!0,c=G.from(i.node(x).copy(c)),b++):p--;let m=G.empty,g=0;for(let x=a,u=!1;x>t;x--)u||n.after(x+1)<n.end(x)?(u=!0,m=G.from(n.node(x).copy(m)),g++):d++;r.step(new Mt(p,d,l,s,new $(c.append(m),b,g),c.size-b,!0))}function js(r,e,t=null,i=r){let n=eV(r,e),a=n&&tV(i,e);return a?n.map(RL).concat({type:e,attrs:t}).concat(a.map(RL)):null}function RL(r){return{type:r,attrs:null}}function eV(r,e){let{parent:t,startIndex:i,endIndex:n}=r,a=t.contentMatchAt(i).findWrapping(e);if(!a)return null;let l=a.length?a[0]:e;return t.canReplaceWith(i,n,l)?a:null}function tV(r,e){let{parent:t,startIndex:i,endIndex:n}=r,a=t.child(i),l=e.contentMatch.findWrapping(a.type);if(!l)return null;let p=(l.length?l[l.length-1]:e).contentMatch;for(let d=i;p&&d<n;d++)p=p.matchType(t.child(d).type);return!p||!p.validEnd?null:l}function rV(r,e,t){let i=G.empty;for(let l=t.length-1;l>=0;l--){if(i.size){let s=t[l].type.contentMatch.matchFragment(i);if(!s||!s.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}i=G.from(t[l].type.create(t[l].attrs,i))}let n=e.start,a=e.end;r.step(new Mt(n,a,n,a,new $(i,0,0),t.length,!0))}function oV(r,e,t,i,n){if(!i.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let a=r.steps.length;r.doc.nodesBetween(e,t,(l,s)=>{let p=typeof n=="function"?n(l):n;if(l.isTextblock&&!l.hasMarkup(i,p)&&iV(r.doc,r.mapping.slice(a).map(s),i)){let d=null;if(i.schema.linebreakReplacement){let g=i.whitespace=="pre",x=!!i.contentMatch.matchType(i.schema.linebreakReplacement);g&&!x?d=!1:!g&&x&&(d=!0)}d===!1&&FL(r,l,s,a),Fs(r,r.mapping.slice(a).map(s,1),i,void 0,d===null);let c=r.mapping.slice(a),b=c.map(s,1),m=c.map(s+l.nodeSize,1);return r.step(new Mt(b,m,b+1,m-1,new $(G.from(i.create(p,null,l.marks)),0,0),1,!0)),d===!0&&OL(r,l,s,a),!1}})}function OL(r,e,t,i){e.forEach((n,a)=>{if(n.isText){let l,s=/\r?\n|\r/g;for(;l=s.exec(n.text);){let p=r.mapping.slice(i).map(t+1+a+l.index);r.replaceWith(p,p+1,e.type.schema.linebreakReplacement.create())}}})}function FL(r,e,t,i){e.forEach((n,a)=>{if(n.type==n.type.schema.linebreakReplacement){let l=r.mapping.slice(i).map(t+1+a);r.replaceWith(l,l+1,e.type.schema.text(`
19
- `))}})}function iV(r,e,t){let i=r.resolve(e),n=i.index();return i.parent.canReplaceWith(n,n+1,t)}function nV(r,e,t,i,n){let a=r.doc.nodeAt(e);if(!a)throw new RangeError("No node at given position");t||(t=a.type);let l=t.create(i,null,n||a.marks);if(a.isLeaf)return r.replaceWith(e,e+a.nodeSize,l);if(!t.validContent(a.content))throw new RangeError("Invalid content for node type "+t.name);r.step(new Mt(e,e+a.nodeSize,e+1,e+a.nodeSize-1,new $(G.from(l),0,0),1,!0))}function mr(r,e,t=1,i){let n=r.resolve(e),a=n.depth-t,l=i&&i[i.length-1]||n.parent;if(a<0||n.parent.type.spec.isolating||!n.parent.canReplace(n.index(),n.parent.childCount)||!l.type.validContent(n.parent.content.cutByIndex(n.index(),n.parent.childCount)))return!1;for(let d=n.depth-1,c=t-2;d>a;d--,c--){let b=n.node(d),m=n.index(d);if(b.type.spec.isolating)return!1;let g=b.content.cutByIndex(m,b.childCount),x=i&&i[c+1];x&&(g=g.replaceChild(0,x.type.create(x.attrs)));let u=i&&i[c]||b;if(!b.canReplace(m+1,b.childCount)||!u.type.validContent(g))return!1}let s=n.indexAfter(a),p=i&&i[0];return n.node(a).canReplaceWith(s,s,p?p.type:n.node(a+1).type)}function aV(r,e,t=1,i){let n=r.doc.resolve(e),a=G.empty,l=G.empty;for(let s=n.depth,p=n.depth-t,d=t-1;s>p;s--,d--){a=G.from(n.node(s).copy(a));let c=i&&i[d];l=G.from(c?c.type.create(c.attrs,l):n.node(s).copy(l))}r.step(new _t(e,e,new $(a.append(l),t,t),!0))}function Or(r,e){let t=r.resolve(e),i=t.index();return jL(t.nodeBefore,t.nodeAfter)&&t.parent.canReplace(i,i+1)}function lV(r,e){e.content.size||r.type.compatibleContent(e.type);let t=r.contentMatchAt(r.childCount),{linebreakReplacement:i}=r.type.schema;for(let n=0;n<e.childCount;n++){let a=e.child(n),l=a.type==i?r.type.schema.nodes.text:a.type;if(t=t.matchType(l),!t||!r.type.allowsMarks(a.marks))return!1}return t.validEnd}function jL(r,e){return!!(r&&e&&!r.isLeaf&&lV(r,e))}function wa(r,e,t=-1){let i=r.resolve(e);for(let n=i.depth;;n--){let a,l,s=i.index(n);if(n==i.depth?(a=i.nodeBefore,l=i.nodeAfter):t>0?(a=i.node(n+1),s++,l=i.node(n).maybeChild(s)):(a=i.node(n).maybeChild(s-1),l=i.node(n+1)),a&&!a.isTextblock&&jL(a,l)&&i.node(n).canReplace(s,s+1))return e;if(n==0)break;e=t<0?i.before(n):i.after(n)}}function sV(r,e,t){let i=null,{linebreakReplacement:n}=r.doc.type.schema,a=r.doc.resolve(e-t),l=a.node().type;if(n&&l.inlineContent){let c=l.whitespace=="pre",b=!!l.contentMatch.matchType(n);c&&!b?i=!1:!c&&b&&(i=!0)}let s=r.steps.length;if(i===!1){let c=r.doc.resolve(e+t);FL(r,c.node(),c.before(),s)}l.inlineContent&&Fs(r,e+t-1,l,a.node().contentMatchAt(a.index()),i==null);let p=r.mapping.slice(s),d=p.map(e-t);if(r.step(new _t(d,p.map(e+t,-1),$.empty,!0)),i===!0){let c=r.doc.resolve(d);OL(r,c.node(),c.before(),r.steps.length)}return r}function pV(r,e,t){let i=r.resolve(e);if(i.parent.canReplaceWith(i.index(),i.index(),t))return e;if(i.parentOffset==0)for(let n=i.depth-1;n>=0;n--){let a=i.index(n);if(i.node(n).canReplaceWith(a,a,t))return i.before(n+1);if(a>0)return null}if(i.parentOffset==i.parent.content.size)for(let n=i.depth-1;n>=0;n--){let a=i.indexAfter(n);if(i.node(n).canReplaceWith(a,a,t))return i.after(n+1);if(a<i.node(n).childCount)return null}return null}function qL(r,e,t){let i=r.resolve(e);if(!t.content.size)return e;let n=t.content;for(let a=0;a<t.openStart;a++)n=n.firstChild.content;for(let a=1;a<=(t.openStart==0&&t.size?2:1);a++)for(let l=i.depth;l>=0;l--){let s=l==i.depth?0:i.pos<=(i.start(l+1)+i.end(l+1))/2?-1:1,p=i.index(l)+(s>0?1:0),d=i.node(l),c=!1;if(a==1)c=d.canReplace(p,p,n);else{let b=d.contentMatchAt(p).findWrapping(n.firstChild.type);c=b&&d.canReplaceWith(p,p,b[0])}if(c)return s==0?i.pos:s<0?i.before(l+1):i.after(l+1)}return null}function va(r,e,t=e,i=$.empty){if(e==t&&!i.size)return null;let n=r.resolve(e),a=r.resolve(t);return UL(n,a,i)?new _t(e,t,i):new dV(n,a,i).fit()}function UL(r,e,t){return!t.openStart&&!t.openEnd&&r.start()==e.start()&&r.parent.canReplace(r.index(),e.index(),t.content)}class dV{constructor(e,t,i){this.$from=e,this.$to=t,this.unplaced=i,this.frontier=[],this.placed=G.empty;for(let n=0;n<=e.depth;n++){let a=e.node(n);this.frontier.push({type:a.type,match:a.contentMatchAt(e.indexAfter(n))})}for(let n=e.depth;n>0;n--)this.placed=G.from(e.node(n).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let d=this.findFittable();d?this.placeNodes(d):this.openMore()||this.dropNode()}let e=this.mustMoveInline(),t=this.placed.size-this.depth-this.$from.depth,i=this.$from,n=this.close(e<0?this.$to:i.doc.resolve(e));if(!n)return null;let a=this.placed,l=i.depth,s=n.depth;for(;l&&s&&a.childCount==1;)a=a.firstChild.content,l--,s--;let p=new $(a,l,s);return e>-1?new Mt(i.pos,e,this.$to.pos,this.$to.end(),p,t):p.size||i.pos!=this.$to.pos?new _t(i.pos,n.pos,p):null}findFittable(){let e=this.unplaced.openStart;for(let t=this.unplaced.content,i=0,n=this.unplaced.openEnd;i<e;i++){let a=t.firstChild;if(t.childCount>1&&(n=0),a.type.spec.isolating&&n<=i){e=i;break}t=a.content}for(let t=1;t<=2;t++)for(let i=t==1?e:this.unplaced.openStart;i>=0;i--){let n,a=null;i?(a=qs(this.unplaced.content,i-1).firstChild,n=a.content):n=this.unplaced.content;let l=n.firstChild;for(let s=this.depth;s>=0;s--){let{type:p,match:d}=this.frontier[s],c,b=null;if(t==1&&(l?d.matchType(l.type)||(b=d.fillBefore(G.from(l),!1)):a&&p.compatibleContent(a.type)))return{sliceDepth:i,frontierDepth:s,parent:a,inject:b};if(t==2&&l&&(c=d.findWrapping(l.type)))return{sliceDepth:i,frontierDepth:s,parent:a,wrap:c};if(a&&d.matchType(a.type))break}}}openMore(){let{content:e,openStart:t,openEnd:i}=this.unplaced,n=qs(e,t);return!n.childCount||n.firstChild.isLeaf?!1:(this.unplaced=new $(e,t+1,Math.max(i,n.size+t>=e.size-i?t+1:0)),!0)}dropNode(){let{content:e,openStart:t,openEnd:i}=this.unplaced,n=qs(e,t);if(n.childCount<=1&&t>0){let a=e.size-t<=t+n.size;this.unplaced=new $(Yi(e,t-1,1),t-1,a?t-1:i)}else this.unplaced=new $(Yi(e,t,1),t,i)}placeNodes({sliceDepth:e,frontierDepth:t,parent:i,inject:n,wrap:a}){for(;this.depth>t;)this.closeFrontierNode();if(a)for(let u=0;u<a.length;u++)this.openFrontierNode(a[u]);let l=this.unplaced,s=i?i.content:l.content,p=l.openStart-e,d=0,c=[],{match:b,type:m}=this.frontier[t];if(n){for(let u=0;u<n.childCount;u++)c.push(n.child(u));b=b.matchFragment(n)}let g=s.size+e-(l.content.size-l.openEnd);for(;d<s.childCount;){let u=s.child(d),h=b.matchType(u.type);if(!h)break;d++,(d>1||p==0||u.content.size)&&(b=h,c.push(WL(u.mark(m.allowedMarks(u.marks)),d==1?p:0,d==s.childCount?g:-1)))}let x=d==s.childCount;x||(g=-1),this.placed=Qi(this.placed,t,G.from(c)),this.frontier[t].match=b,x&&g<0&&i&&i.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let u=0,h=s;u<g;u++){let f=h.lastChild;this.frontier.push({type:f.type,match:f.contentMatchAt(f.childCount)}),h=f.content}this.unplaced=x?e==0?$.empty:new $(Yi(l.content,e-1,1),e-1,g<0?l.openEnd:e-1):new $(Yi(l.content,e,d),l.openStart,l.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let e=this.frontier[this.depth],t;if(!e.type.isTextblock||!Us(this.$to,this.$to.depth,e.type,e.match,!1)||this.$to.depth==this.depth&&(t=this.findCloseLevel(this.$to))&&t.depth==this.depth)return-1;let{depth:i}=this.$to,n=this.$to.after(i);for(;i>1&&n==this.$to.end(--i);)++n;return n}findCloseLevel(e){e:for(let t=Math.min(this.depth,e.depth);t>=0;t--){let{match:i,type:n}=this.frontier[t],a=t<e.depth&&e.end(t+1)==e.pos+(e.depth-(t+1)),l=Us(e,t,n,i,a);if(l){for(let s=t-1;s>=0;s--){let{match:p,type:d}=this.frontier[s],c=Us(e,s,d,p,!0);if(!c||c.childCount)continue e}return{depth:t,fit:l,move:a?e.doc.resolve(e.after(t+1)):e}}}}close(e){let t=this.findCloseLevel(e);if(!t)return null;for(;this.depth>t.depth;)this.closeFrontierNode();t.fit.childCount&&(this.placed=Qi(this.placed,t.depth,t.fit)),e=t.move;for(let i=t.depth+1;i<=e.depth;i++){let n=e.node(i),a=n.type.contentMatch.fillBefore(n.content,!0,e.index(i));this.openFrontierNode(n.type,n.attrs,a)}return e}openFrontierNode(e,t=null,i){let n=this.frontier[this.depth];n.match=n.match.matchType(e),this.placed=Qi(this.placed,this.depth,G.from(e.create(t,i))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let t=this.frontier.pop().match.fillBefore(G.empty,!0);t.childCount&&(this.placed=Qi(this.placed,this.frontier.length,t))}}function Yi(r,e,t){return e==0?r.cutByIndex(t,r.childCount):r.replaceChild(0,r.firstChild.copy(Yi(r.firstChild.content,e-1,t)))}function Qi(r,e,t){return e==0?r.append(t):r.replaceChild(r.childCount-1,r.lastChild.copy(Qi(r.lastChild.content,e-1,t)))}function qs(r,e){for(let t=0;t<e;t++)r=r.firstChild.content;return r}function WL(r,e,t){if(e<=0)return r;let i=r.content;return e>1&&(i=i.replaceChild(0,WL(i.firstChild,e-1,i.childCount==1?t-1:0))),e>0&&(i=r.type.contentMatch.fillBefore(i).append(i),t<=0&&(i=i.append(r.type.contentMatch.matchFragment(i).fillBefore(G.empty,!0)))),r.copy(i)}function Us(r,e,t,i,n){let a=r.node(e),l=n?r.indexAfter(e):r.index(e);if(l==a.childCount&&!t.compatibleContent(a.type))return null;let s=i.fillBefore(a.content,!0,l);return s&&!cV(t,a.content,l)?s:null}function cV(r,e,t){for(let i=t;i<e.childCount;i++)if(!r.allowsMarks(e.child(i).marks))return!0;return!1}function bV(r){return r.spec.defining||r.spec.definingForContent}function mV(r,e,t,i){if(!i.size)return r.deleteRange(e,t);let n=r.doc.resolve(e),a=r.doc.resolve(t);if(UL(n,a,i))return r.step(new _t(e,t,i));let l=KL(n,a);l[l.length-1]==0&&l.pop();let s=-(n.depth+1);l.unshift(s);for(let m=n.depth,g=n.pos-1;m>0;m--,g--){let x=n.node(m).type.spec;if(x.defining||x.definingAsContext||x.isolating)break;l.indexOf(m)>-1?s=m:n.before(m)==g&&l.splice(1,0,-m)}let p=l.indexOf(s),d=[],c=i.openStart;for(let m=i.content,g=0;;g++){let x=m.firstChild;if(d.push(x),g==i.openStart)break;m=x.content}for(let m=c-1;m>=0;m--){let g=d[m],x=bV(g.type);if(x&&!g.sameMarkup(n.node(Math.abs(s)-1)))c=m;else if(x||!g.type.isTextblock)break}for(let m=i.openStart;m>=0;m--){let g=(m+c+1)%(i.openStart+1),x=d[g];if(x)for(let u=0;u<l.length;u++){let h=l[(u+p)%l.length],f=!0;h<0&&(f=!1,h=-h);let w=n.node(h-1),y=n.index(h-1);if(w.canReplaceWith(y,y,x.type,x.marks))return r.replace(n.before(h),f?a.after(h):t,new $(GL(i.content,0,i.openStart,g),g,i.openEnd))}}let b=r.steps.length;for(let m=l.length-1;m>=0&&(r.replace(e,t,i),!(r.steps.length>b));m--){let g=l[m];g<0||(e=n.before(g),t=a.after(g))}}function GL(r,e,t,i,n){if(e<t){let a=r.firstChild;r=r.replaceChild(0,a.copy(GL(a.content,e+1,t,i,a)))}if(e>i){let a=n.contentMatchAt(0),l=a.fillBefore(r).append(r);r=l.append(a.matchFragment(l).fillBefore(G.empty,!0))}return r}function gV(r,e,t,i){if(!i.isInline&&e==t&&r.doc.resolve(e).parent.content.size){let n=pV(r.doc,e,i.type);n!=null&&(e=t=n)}r.replaceRange(e,t,new $(G.from(i),0,0))}function uV(r,e,t){let i=r.doc.resolve(e),n=r.doc.resolve(t);if(i.parent.isTextblock&&n.parent.isTextblock&&i.start()!=n.start()&&i.parentOffset==0&&n.parentOffset==0){let l=i.sharedDepth(t),s=!1;for(let p=i.depth;p>l;p--)i.node(p).type.spec.isolating&&(s=!0);for(let p=n.depth;p>l;p--)n.node(p).type.spec.isolating&&(s=!0);if(!s){for(let p=i.depth;p>0&&e==i.start(p);p--)e=i.before(p);for(let p=n.depth;p>0&&t==n.start(p);p--)t=n.before(p);i=r.doc.resolve(e),n=r.doc.resolve(t)}}let a=KL(i,n);for(let l=0;l<a.length;l++){let s=a[l],p=l==a.length-1;if(p&&s==0||i.node(s).type.contentMatch.validEnd)return r.delete(i.start(s),n.end(s));if(s>0&&(p||i.node(s-1).canReplace(i.index(s-1),n.indexAfter(s-1))))return r.delete(i.before(s),n.after(s))}for(let l=1;l<=i.depth&&l<=n.depth;l++)if(e-i.start(l)==i.depth-l&&t>i.end(l)&&n.end(l)-t!=n.depth-l&&i.start(l-1)==n.start(l-1)&&i.node(l-1).canReplace(i.index(l-1),n.index(l-1)))return r.delete(i.before(l),t);r.delete(e,t)}function KL(r,e){let t=[],i=Math.min(r.depth,e.depth);for(let n=i;n>=0;n--){let a=r.start(n);if(a<r.pos-(r.depth-n)||e.end(n)>e.pos+(e.depth-n)||r.node(n).type.spec.isolating||e.node(n).type.spec.isolating)break;(a==e.start(n)||n==r.depth&&n==e.depth&&r.parent.inlineContent&&e.parent.inlineContent&&n&&e.start(n-1)==a-1)&&t.push(n)}return t}let JL=class Es extends nt{constructor(e,t,i){super(),this.pos=e,this.attr=t,this.value=i}apply(e){let t=e.nodeAt(this.pos);if(!t)return ut.fail("No node at attribute step's position");let i=Object.create(null);for(let a in t.attrs)i[a]=t.attrs[a];i[this.attr]=this.value;let n=t.type.create(i,null,t.marks);return ut.fromReplace(e,this.pos,this.pos+1,new $(G.from(n),0,t.isLeaf?0:1))}getMap(){return Eo.empty}invert(e){return new Es(this.pos,this.attr,e.nodeAt(this.pos).attrs[this.attr])}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new Es(t.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(e,t){if(typeof t.pos!="number"||typeof t.attr!="string")throw new RangeError("Invalid input for AttrStep.fromJSON");return new Es(t.pos,t.attr,t.value)}};nt.jsonID("attr",JL);let YL=class kc extends nt{constructor(e,t){super(),this.attr=e,this.value=t}apply(e){let t=Object.create(null);for(let n in e.attrs)t[n]=e.attrs[n];t[this.attr]=this.value;let i=e.type.create(t,e.content,e.marks);return ut.ok(i)}getMap(){return Eo.empty}invert(e){return new kc(this.attr,e.attrs[this.attr])}map(e){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(e,t){if(typeof t.attr!="string")throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new kc(t.attr,t.value)}};nt.jsonID("docAttr",YL);let ri=class extends Error{};ri=function r(e){let t=Error.call(this,e);return t.__proto__=r.prototype,t},ri.prototype=Object.create(Error.prototype),ri.prototype.constructor=ri,ri.prototype.name="TransformError";class QL{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new Ji}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let t=this.maybeStep(e);if(t.failed)throw new ri(t.failed);return this}maybeStep(e){let t=e.apply(this.doc);return t.failed||this.addStep(e,t.doc),t}get docChanged(){return this.steps.length>0}changedRange(){let e=1e9,t=-1e9;for(let i=0;i<this.mapping.maps.length;i++){let n=this.mapping.maps[i];i&&(e=n.map(e,1),t=n.map(t,-1)),n.forEach((a,l,s,p)=>{e=Math.min(e,s),t=Math.max(t,p)})}return e==1e9?null:{from:e,to:t}}addStep(e,t){this.docs.push(this.doc),this.steps.push(e),this.mapping.appendMap(e.getMap()),this.doc=t}replace(e,t=e,i=$.empty){let n=va(this.doc,e,t,i);return n&&this.step(n),this}replaceWith(e,t,i){return this.replace(e,t,new $(G.from(i),0,0))}delete(e,t){return this.replace(e,t,$.empty)}insert(e,t){return this.replaceWith(e,e,t)}replaceRange(e,t,i){return mV(this,e,t,i),this}replaceRangeWith(e,t,i){return gV(this,e,t,i),this}deleteRange(e,t){return uV(this,e,t),this}lift(e,t){return $I(this,e,t),this}join(e,t=1){return sV(this,e,t),this}wrap(e,t){return rV(this,e,t),this}setBlockType(e,t=e,i,n=null){return oV(this,e,t,i,n),this}setNodeMarkup(e,t,i=null,n){return nV(this,e,t,i,n),this}setNodeAttribute(e,t,i){return this.step(new JL(e,t,i)),this}setDocAttribute(e,t){return this.step(new YL(e,t)),this}addNodeMark(e,t){return this.step(new Rs(e,t)),this}removeNodeMark(e,t){let i=this.doc.nodeAt(e);if(!i)throw new RangeError("No node at position "+e);if(t instanceof ve)t.isInSet(i.marks)&&this.step(new ya(e,t));else{let n=i.marks,a,l=[];for(;a=t.isInSet(n);)l.push(new ya(e,a)),n=a.removeFromSet(n);for(let s=l.length-1;s>=0;s--)this.step(l[s])}return this}split(e,t=1,i){return aV(this,e,t,i),this}addMark(e,t,i){return QI(this,e,t,i),this}removeMark(e,t,i){return XI(this,e,t,i),this}clearIncompatible(e,t,i){return Fs(this,e,t,i),this}}const Ws=Object.create(null);let de=class{constructor(e,t,i){this.$anchor=e,this.$head=t,this.ranges=i||[new xV(e.min(t),e.max(t))]}get anchor(){return this.$anchor.pos}get head(){return this.$head.pos}get from(){return this.$from.pos}get to(){return this.$to.pos}get $from(){return this.ranges[0].$from}get $to(){return this.ranges[0].$to}get empty(){let e=this.ranges;for(let t=0;t<e.length;t++)if(e[t].$from.pos!=e[t].$to.pos)return!1;return!0}content(){return this.$from.doc.slice(this.from,this.to,!0)}replace(e,t=$.empty){let i=t.content.lastChild,n=null;for(let s=0;s<t.openEnd;s++)n=i,i=i.lastChild;let a=e.steps.length,l=this.ranges;for(let s=0;s<l.length;s++){let{$from:p,$to:d}=l[s],c=e.mapping.slice(a);e.replaceRange(c.map(p.pos),c.map(d.pos),s?$.empty:t),s==0&&eN(e,a,(i?i.isInline:n&&n.isTextblock)?-1:1)}}replaceWith(e,t){let i=e.steps.length,n=this.ranges;for(let a=0;a<n.length;a++){let{$from:l,$to:s}=n[a],p=e.mapping.slice(i),d=p.map(l.pos),c=p.map(s.pos);a?e.deleteRange(d,c):(e.replaceRangeWith(d,c,t),eN(e,i,t.isInline?-1:1))}}static findFrom(e,t,i=!1){let n=e.parent.inlineContent?new pe(e):oi(e.node(0),e.parent,e.pos,e.index(),t,i);if(n)return n;for(let a=e.depth-1;a>=0;a--){let l=t<0?oi(e.node(0),e.node(a),e.before(a+1),e.index(a),t,i):oi(e.node(0),e.node(a),e.after(a+1),e.index(a)+1,t,i);if(l)return l}return null}static near(e,t=1){return this.findFrom(e,t)||this.findFrom(e,-t)||new gr(e.node(0))}static atStart(e){return oi(e,e,0,0,1)||new gr(e)}static atEnd(e){return oi(e,e,e.content.size,e.childCount,-1)||new gr(e)}static fromJSON(e,t){if(!t||!t.type)throw new RangeError("Invalid input for Selection.fromJSON");let i=Ws[t.type];if(!i)throw new RangeError(`No selection type ${t.type} defined`);return i.fromJSON(e,t)}static jsonID(e,t){if(e in Ws)throw new RangeError("Duplicate use of selection JSON ID "+e);return Ws[e]=t,t.prototype.jsonID=e,t}getBookmark(){return pe.between(this.$anchor,this.$head).getBookmark()}};de.prototype.visible=!0;let xV=class{constructor(e,t){this.$from=e,this.$to=t}},XL=!1;function ZL(r){!XL&&!r.parent.inlineContent&&(XL=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+r.parent.type.name+")"))}let pe=class $n extends de{constructor(e,t=e){ZL(e),ZL(t),super(e,t)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(e,t){let i=e.resolve(t.map(this.head));if(!i.parent.inlineContent)return de.near(i);let n=e.resolve(t.map(this.anchor));return new $n(n.parent.inlineContent?n:i,i)}replace(e,t=$.empty){if(super.replace(e,t),t==$.empty){let i=this.$from.marksAcross(this.$to);i&&e.ensureMarks(i)}}eq(e){return e instanceof $n&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new $L(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(e,t){if(typeof t.anchor!="number"||typeof t.head!="number")throw new RangeError("Invalid input for TextSelection.fromJSON");return new $n(e.resolve(t.anchor),e.resolve(t.head))}static create(e,t,i=t){let n=e.resolve(t);return new this(n,i==t?n:e.resolve(i))}static between(e,t,i){let n=e.pos-t.pos;if((!i||n)&&(i=n>=0?1:-1),!t.parent.inlineContent){let a=de.findFrom(t,i,!0)||de.findFrom(t,-i,!0);if(a)t=a.$head;else return de.near(t,i)}return e.parent.inlineContent||(n==0?e=t:(e=(de.findFrom(e,-i,!0)||de.findFrom(e,i,!0)).$anchor,e.pos<t.pos!=n<0&&(e=t))),new $n(e,t)}};de.jsonID("text",pe);let $L=class Rz{constructor(e,t){this.anchor=e,this.head=t}map(e){return new Rz(e.map(this.anchor),e.map(this.head))}resolve(e){return pe.between(e.resolve(this.anchor),e.resolve(this.head))}},ae=class ea extends de{constructor(e){let t=e.nodeAfter,i=e.node(0).resolve(e.pos+t.nodeSize);super(e,i),this.node=t}map(e,t){let{deleted:i,pos:n}=t.mapResult(this.anchor),a=e.resolve(n);return i?de.near(a):new ea(a)}content(){return new $(G.from(this.node),0,0)}eq(e){return e instanceof ea&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new hV(this.anchor)}static fromJSON(e,t){if(typeof t.anchor!="number")throw new RangeError("Invalid input for NodeSelection.fromJSON");return new ea(e.resolve(t.anchor))}static create(e,t){return new ea(e.resolve(t))}static isSelectable(e){return!e.isText&&e.type.spec.selectable!==!1}};ae.prototype.visible=!1,de.jsonID("node",ae);let hV=class Oz{constructor(e){this.anchor=e}map(e){let{deleted:t,pos:i}=e.mapResult(this.anchor);return t?new $L(i,i):new Oz(i)}resolve(e){let t=e.resolve(this.anchor),i=t.nodeAfter;return i&&ae.isSelectable(i)?new ae(t):de.near(t)}},gr=class Ms extends de{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,t=$.empty){if(t==$.empty){e.delete(0,e.doc.content.size);let i=de.atStart(e.doc);i.eq(e.selection)||e.setSelection(i)}else super.replace(e,t)}toJSON(){return{type:"all"}}static fromJSON(e){return new Ms(e)}map(e){return new Ms(e)}eq(e){return e instanceof Ms}getBookmark(){return fV}};de.jsonID("all",gr);const fV={map(){return this},resolve(r){return new gr(r)}};function oi(r,e,t,i,n,a=!1){if(e.inlineContent)return pe.create(r,t);for(let l=i-(n>0?0:1);n>0?l<e.childCount:l>=0;l+=n){let s=e.child(l);if(s.isAtom){if(!a&&ae.isSelectable(s))return ae.create(r,t-(n<0?s.nodeSize:0))}else{let p=oi(r,s,t+n,n<0?s.childCount:0,n,a);if(p)return p}t+=s.nodeSize*n}return null}function eN(r,e,t){let i=r.steps.length-1;if(i<e)return;let n=r.steps[i];if(!(n instanceof _t||n instanceof Mt))return;let a=r.mapping.maps[i],l;a.forEach((s,p,d,c)=>{l==null&&(l=c)}),r.setSelection(de.near(r.doc.resolve(l),t))}const tN=1,ka=2,rN=4;class yV extends QL{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|tN)&~ka,this.storedMarks=null,this}get selectionSet(){return(this.updated&tN)>0}setStoredMarks(e){return this.storedMarks=e,this.updated|=ka,this}ensureMarks(e){return ve.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&ka)>0}addStep(e,t){super.addStep(e,t),this.updated=this.updated&~ka,this.storedMarks=null}setTime(e){return this.time=e,this}replaceSelection(e){return this.selection.replace(this,e),this}replaceSelectionWith(e,t=!0){let i=this.selection;return t&&(e=e.mark(this.storedMarks||(i.empty?i.$from.marks():i.$from.marksAcross(i.$to)||ve.none))),i.replaceWith(this,e),this}deleteSelection(){return this.selection.replace(this),this}insertText(e,t,i){let n=this.doc.type.schema;if(t==null)return e?this.replaceSelectionWith(n.text(e),!0):this.deleteSelection();{if(i==null&&(i=t),!e)return this.deleteRange(t,i);let a=this.storedMarks;if(!a){let l=this.doc.resolve(t);a=i==t?l.marks():l.marksAcross(this.doc.resolve(i))}return this.replaceRangeWith(t,i,n.text(e,a)),!this.selection.empty&&this.selection.to==t+e.length&&this.setSelection(de.near(this.selection.$to)),this}}setMeta(e,t){return this.meta[typeof e=="string"?e:e.key]=t,this}getMeta(e){return this.meta[typeof e=="string"?e:e.key]}get isGeneric(){for(let e in this.meta)return!1;return!0}scrollIntoView(){return this.updated|=rN,this}get scrolledIntoView(){return(this.updated&rN)>0}}function oN(r,e){return!e||!r?r:r.bind(e)}let Xi=class{constructor(e,t,i){this.name=e,this.init=oN(t.init,i),this.apply=oN(t.apply,i)}};const wV=[new Xi("doc",{init(r){return r.doc||r.schema.topNodeType.createAndFill()},apply(r){return r.doc}}),new Xi("selection",{init(r,e){return r.selection||de.atStart(e.doc)},apply(r){return r.selection}}),new Xi("storedMarks",{init(r){return r.storedMarks||null},apply(r,e,t,i){return i.selection.$cursor?r.storedMarks:null}}),new Xi("scrollToSelection",{init(){return 0},apply(r,e){return r.scrolledIntoView?e+1:e}})];class Gs{constructor(e,t){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=wV.slice(),t&&t.forEach(i=>{if(this.pluginsByKey[i.key])throw new RangeError("Adding different instances of a keyed plugin ("+i.key+")");this.plugins.push(i),this.pluginsByKey[i.key]=i,i.spec.state&&this.fields.push(new Xi(i.key,i.spec.state,i))})}}class ii{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,t=-1){for(let i=0;i<this.config.plugins.length;i++)if(i!=t){let n=this.config.plugins[i];if(n.spec.filterTransaction&&!n.spec.filterTransaction.call(n,e,this))return!1}return!0}applyTransaction(e){if(!this.filterTransaction(e))return{state:this,transactions:[]};let t=[e],i=this.applyInner(e),n=null;for(;;){let a=!1;for(let l=0;l<this.config.plugins.length;l++){let s=this.config.plugins[l];if(s.spec.appendTransaction){let p=n?n[l].n:0,d=n?n[l].state:this,c=p<t.length&&s.spec.appendTransaction.call(s,p?t.slice(p):t,d,i);if(c&&i.filterTransaction(c,l)){if(c.setMeta("appendedTransaction",e),!n){n=[];for(let b=0;b<this.config.plugins.length;b++)n.push(b<l?{state:i,n:t.length}:{state:this,n:0})}t.push(c),i=i.applyInner(c),a=!0}n&&(n[l]={state:i,n:t.length})}}if(!a)return{state:i,transactions:t}}}applyInner(e){if(!e.before.eq(this.doc))throw new RangeError("Applying a mismatched transaction");let t=new ii(this.config),i=this.config.fields;for(let n=0;n<i.length;n++){let a=i[n];t[a.name]=a.apply(e,this[a.name],this,t)}return t}get tr(){return new yV(this)}static create(e){let t=new Gs(e.doc?e.doc.type.schema:e.schema,e.plugins),i=new ii(t);for(let n=0;n<t.fields.length;n++)i[t.fields[n].name]=t.fields[n].init(e,i);return i}reconfigure(e){let t=new Gs(this.schema,e.plugins),i=t.fields,n=new ii(t);for(let a=0;a<i.length;a++){let l=i[a].name;n[l]=this.hasOwnProperty(l)?this[l]:i[a].init(e,n)}return n}toJSON(e){let t={doc:this.doc.toJSON(),selection:this.selection.toJSON()};if(this.storedMarks&&(t.storedMarks=this.storedMarks.map(i=>i.toJSON())),e&&typeof e=="object")for(let i in e){if(i=="doc"||i=="selection")throw new RangeError("The JSON fields `doc` and `selection` are reserved");let n=e[i],a=n.spec.state;a&&a.toJSON&&(t[i]=a.toJSON.call(n,this[n.key]))}return t}static fromJSON(e,t,i){if(!t)throw new RangeError("Invalid input for EditorState.fromJSON");if(!e.schema)throw new RangeError("Required config field 'schema' missing");let n=new Gs(e.schema,e.plugins),a=new ii(n);return n.fields.forEach(l=>{if(l.name=="doc")a.doc=Rr.fromJSON(e.schema,t.doc);else if(l.name=="selection")a.selection=de.fromJSON(a.doc,t.selection);else if(l.name=="storedMarks")t.storedMarks&&(a.storedMarks=t.storedMarks.map(e.schema.markFromJSON));else{if(i)for(let s in i){let p=i[s],d=p.spec.state;if(p.key==l.name&&d&&d.fromJSON&&Object.prototype.hasOwnProperty.call(t,s)){a[l.name]=d.fromJSON.call(p,e,t[s],a);return}}a[l.name]=l.init(e,a)}}),a}}function iN(r,e,t){for(let i in r){let n=r[i];n instanceof Function?n=n.bind(e):i=="handleDOMEvents"&&(n=iN(n,e,{})),t[i]=n}return t}class Me{constructor(e){this.spec=e,this.props={},e.props&&iN(e.props,this,this.props),this.key=e.key?e.key.key:nN("plugin")}getState(e){return e[this.key]}}const Ks=Object.create(null);function nN(r){return r in Ks?r+"$"+ ++Ks[r]:(Ks[r]=0,r+"$")}class Oe{constructor(e="key"){this.key=nN(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}const aN=(r,e)=>r.selection.empty?!1:(e&&e(r.tr.deleteSelection().scrollIntoView()),!0);function lN(r,e){let{$cursor:t}=r.selection;return!t||(e?!e.endOfTextblock("backward",r):t.parentOffset>0)?null:t}const sN=(r,e,t)=>{let i=lN(r,t);if(!i)return!1;let n=Js(i);if(!n){let l=i.blockRange(),s=l&&ti(l);return s==null?!1:(e&&e(r.tr.lift(l,s).scrollIntoView()),!0)}let a=n.nodeBefore;if(hN(r,n,e,-1))return!0;if(i.parent.content.size==0&&(ni(a,"end")||ae.isSelectable(a)))for(let l=i.depth;;l--){let s=va(r.doc,i.before(l),i.after(l),$.empty);if(s&&s.slice.size<s.to-s.from){if(e){let p=r.tr.step(s);p.setSelection(ni(a,"end")?de.findFrom(p.doc.resolve(p.mapping.map(n.pos,-1)),-1):ae.create(p.doc,n.pos-a.nodeSize)),e(p.scrollIntoView())}return!0}if(l==1||i.node(l-1).childCount>1)break}return a.isAtom&&n.depth==i.depth-1?(e&&e(r.tr.delete(n.pos-a.nodeSize,n.pos).scrollIntoView()),!0):!1},vV=(r,e,t)=>{let i=lN(r,t);if(!i)return!1;let n=Js(i);return n?pN(r,n,e):!1},kV=(r,e,t)=>{let i=cN(r,t);if(!i)return!1;let n=Ys(i);return n?pN(r,n,e):!1};function pN(r,e,t){let i=e.nodeBefore,n=i,a=e.pos-1;for(;!n.isTextblock;a--){if(n.type.spec.isolating)return!1;let c=n.lastChild;if(!c)return!1;n=c}let l=e.nodeAfter,s=l,p=e.pos+1;for(;!s.isTextblock;p++){if(s.type.spec.isolating)return!1;let c=s.firstChild;if(!c)return!1;s=c}let d=va(r.doc,a,p,$.empty);if(!d||d.from!=a||d instanceof _t&&d.slice.size>=p-a)return!1;if(t){let c=r.tr.step(d);c.setSelection(pe.create(c.doc,a)),t(c.scrollIntoView())}return!0}function ni(r,e,t=!1){for(let i=r;i;i=e=="start"?i.firstChild:i.lastChild){if(i.isTextblock)return!0;if(t&&i.childCount!=1)return!1}return!1}const dN=(r,e,t)=>{let{$head:i,empty:n}=r.selection,a=i;if(!n)return!1;if(i.parent.isTextblock){if(t?!t.endOfTextblock("backward",r):i.parentOffset>0)return!1;a=Js(i)}let l=a&&a.nodeBefore;return!l||!ae.isSelectable(l)?!1:(e&&e(r.tr.setSelection(ae.create(r.doc,a.pos-l.nodeSize)).scrollIntoView()),!0)};function Js(r){if(!r.parent.type.spec.isolating)for(let e=r.depth-1;e>=0;e--){if(r.index(e)>0)return r.doc.resolve(r.before(e+1));if(r.node(e).type.spec.isolating)break}return null}function cN(r,e){let{$cursor:t}=r.selection;return!t||(e?!e.endOfTextblock("forward",r):t.parentOffset<t.parent.content.size)?null:t}const bN=(r,e,t)=>{let i=cN(r,t);if(!i)return!1;let n=Ys(i);if(!n)return!1;let a=n.nodeAfter;if(hN(r,n,e,1))return!0;if(i.parent.content.size==0&&(ni(a,"start")||ae.isSelectable(a))){let l=va(r.doc,i.before(),i.after(),$.empty);if(l&&l.slice.size<l.to-l.from){if(e){let s=r.tr.step(l);s.setSelection(ni(a,"start")?de.findFrom(s.doc.resolve(s.mapping.map(n.pos)),1):ae.create(s.doc,s.mapping.map(n.pos))),e(s.scrollIntoView())}return!0}}return a.isAtom&&n.depth==i.depth-1?(e&&e(r.tr.delete(n.pos,n.pos+a.nodeSize).scrollIntoView()),!0):!1},mN=(r,e,t)=>{let{$head:i,empty:n}=r.selection,a=i;if(!n)return!1;if(i.parent.isTextblock){if(t?!t.endOfTextblock("forward",r):i.parentOffset<i.parent.content.size)return!1;a=Ys(i)}let l=a&&a.nodeAfter;return!l||!ae.isSelectable(l)?!1:(e&&e(r.tr.setSelection(ae.create(r.doc,a.pos)).scrollIntoView()),!0)};function Ys(r){if(!r.parent.type.spec.isolating)for(let e=r.depth-1;e>=0;e--){let t=r.node(e);if(r.index(e)+1<t.childCount)return r.doc.resolve(r.after(e+1));if(t.type.spec.isolating)break}return null}const SV=(r,e)=>{let t=r.selection,i=t instanceof ae,n;if(i){if(t.node.isTextblock||!Or(r.doc,t.from))return!1;n=t.from}else if(n=wa(r.doc,t.from,-1),n==null)return!1;if(e){let a=r.tr.join(n);i&&a.setSelection(ae.create(a.doc,n-r.doc.resolve(n).nodeBefore.nodeSize)),e(a.scrollIntoView())}return!0},CV=(r,e)=>{let t=r.selection,i;if(t instanceof ae){if(t.node.isTextblock||!Or(r.doc,t.to))return!1;i=t.to}else if(i=wa(r.doc,t.to,1),i==null)return!1;return e&&e(r.tr.join(i).scrollIntoView()),!0},TV=(r,e)=>{let{$from:t,$to:i}=r.selection,n=t.blockRange(i),a=n&&ti(n);return a==null?!1:(e&&e(r.tr.lift(n,a).scrollIntoView()),!0)},gN=(r,e)=>{let{$head:t,$anchor:i}=r.selection;return!t.parent.type.spec.code||!t.sameParent(i)?!1:(e&&e(r.tr.insertText(`
19
+ `))}})}function iV(r,e,t){let i=r.resolve(e),n=i.index();return i.parent.canReplaceWith(n,n+1,t)}function nV(r,e,t,i,n){let a=r.doc.nodeAt(e);if(!a)throw new RangeError("No node at given position");t||(t=a.type);let l=t.create(i,null,n||a.marks);if(a.isLeaf)return r.replaceWith(e,e+a.nodeSize,l);if(!t.validContent(a.content))throw new RangeError("Invalid content for node type "+t.name);r.step(new Mt(e,e+a.nodeSize,e+1,e+a.nodeSize-1,new $(G.from(l),0,0),1,!0))}function mr(r,e,t=1,i){let n=r.resolve(e),a=n.depth-t,l=i&&i[i.length-1]||n.parent;if(a<0||n.parent.type.spec.isolating||!n.parent.canReplace(n.index(),n.parent.childCount)||!l.type.validContent(n.parent.content.cutByIndex(n.index(),n.parent.childCount)))return!1;for(let d=n.depth-1,c=t-2;d>a;d--,c--){let b=n.node(d),m=n.index(d);if(b.type.spec.isolating)return!1;let g=b.content.cutByIndex(m,b.childCount),x=i&&i[c+1];x&&(g=g.replaceChild(0,x.type.create(x.attrs)));let u=i&&i[c]||b;if(!b.canReplace(m+1,b.childCount)||!u.type.validContent(g))return!1}let s=n.indexAfter(a),p=i&&i[0];return n.node(a).canReplaceWith(s,s,p?p.type:n.node(a+1).type)}function aV(r,e,t=1,i){let n=r.doc.resolve(e),a=G.empty,l=G.empty;for(let s=n.depth,p=n.depth-t,d=t-1;s>p;s--,d--){a=G.from(n.node(s).copy(a));let c=i&&i[d];l=G.from(c?c.type.create(c.attrs,l):n.node(s).copy(l))}r.step(new _t(e,e,new $(a.append(l),t,t),!0))}function Or(r,e){let t=r.resolve(e),i=t.index();return jL(t.nodeBefore,t.nodeAfter)&&t.parent.canReplace(i,i+1)}function lV(r,e){e.content.size||r.type.compatibleContent(e.type);let t=r.contentMatchAt(r.childCount),{linebreakReplacement:i}=r.type.schema;for(let n=0;n<e.childCount;n++){let a=e.child(n),l=a.type==i?r.type.schema.nodes.text:a.type;if(t=t.matchType(l),!t||!r.type.allowsMarks(a.marks))return!1}return t.validEnd}function jL(r,e){return!!(r&&e&&!r.isLeaf&&lV(r,e))}function wa(r,e,t=-1){let i=r.resolve(e);for(let n=i.depth;;n--){let a,l,s=i.index(n);if(n==i.depth?(a=i.nodeBefore,l=i.nodeAfter):t>0?(a=i.node(n+1),s++,l=i.node(n).maybeChild(s)):(a=i.node(n).maybeChild(s-1),l=i.node(n+1)),a&&!a.isTextblock&&jL(a,l)&&i.node(n).canReplace(s,s+1))return e;if(n==0)break;e=t<0?i.before(n):i.after(n)}}function sV(r,e,t){let i=null,{linebreakReplacement:n}=r.doc.type.schema,a=r.doc.resolve(e-t),l=a.node().type;if(n&&l.inlineContent){let c=l.whitespace=="pre",b=!!l.contentMatch.matchType(n);c&&!b?i=!1:!c&&b&&(i=!0)}let s=r.steps.length;if(i===!1){let c=r.doc.resolve(e+t);FL(r,c.node(),c.before(),s)}l.inlineContent&&Fs(r,e+t-1,l,a.node().contentMatchAt(a.index()),i==null);let p=r.mapping.slice(s),d=p.map(e-t);if(r.step(new _t(d,p.map(e+t,-1),$.empty,!0)),i===!0){let c=r.doc.resolve(d);OL(r,c.node(),c.before(),r.steps.length)}return r}function pV(r,e,t){let i=r.resolve(e);if(i.parent.canReplaceWith(i.index(),i.index(),t))return e;if(i.parentOffset==0)for(let n=i.depth-1;n>=0;n--){let a=i.index(n);if(i.node(n).canReplaceWith(a,a,t))return i.before(n+1);if(a>0)return null}if(i.parentOffset==i.parent.content.size)for(let n=i.depth-1;n>=0;n--){let a=i.indexAfter(n);if(i.node(n).canReplaceWith(a,a,t))return i.after(n+1);if(a<i.node(n).childCount)return null}return null}function qL(r,e,t){let i=r.resolve(e);if(!t.content.size)return e;let n=t.content;for(let a=0;a<t.openStart;a++)n=n.firstChild.content;for(let a=1;a<=(t.openStart==0&&t.size?2:1);a++)for(let l=i.depth;l>=0;l--){let s=l==i.depth?0:i.pos<=(i.start(l+1)+i.end(l+1))/2?-1:1,p=i.index(l)+(s>0?1:0),d=i.node(l),c=!1;if(a==1)c=d.canReplace(p,p,n);else{let b=d.contentMatchAt(p).findWrapping(n.firstChild.type);c=b&&d.canReplaceWith(p,p,b[0])}if(c)return s==0?i.pos:s<0?i.before(l+1):i.after(l+1)}return null}function va(r,e,t=e,i=$.empty){if(e==t&&!i.size)return null;let n=r.resolve(e),a=r.resolve(t);return UL(n,a,i)?new _t(e,t,i):new dV(n,a,i).fit()}function UL(r,e,t){return!t.openStart&&!t.openEnd&&r.start()==e.start()&&r.parent.canReplace(r.index(),e.index(),t.content)}class dV{constructor(e,t,i){this.$from=e,this.$to=t,this.unplaced=i,this.frontier=[],this.placed=G.empty;for(let n=0;n<=e.depth;n++){let a=e.node(n);this.frontier.push({type:a.type,match:a.contentMatchAt(e.indexAfter(n))})}for(let n=e.depth;n>0;n--)this.placed=G.from(e.node(n).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let d=this.findFittable();d?this.placeNodes(d):this.openMore()||this.dropNode()}let e=this.mustMoveInline(),t=this.placed.size-this.depth-this.$from.depth,i=this.$from,n=this.close(e<0?this.$to:i.doc.resolve(e));if(!n)return null;let a=this.placed,l=i.depth,s=n.depth;for(;l&&s&&a.childCount==1;)a=a.firstChild.content,l--,s--;let p=new $(a,l,s);return e>-1?new Mt(i.pos,e,this.$to.pos,this.$to.end(),p,t):p.size||i.pos!=this.$to.pos?new _t(i.pos,n.pos,p):null}findFittable(){let e=this.unplaced.openStart;for(let t=this.unplaced.content,i=0,n=this.unplaced.openEnd;i<e;i++){let a=t.firstChild;if(t.childCount>1&&(n=0),a.type.spec.isolating&&n<=i){e=i;break}t=a.content}for(let t=1;t<=2;t++)for(let i=t==1?e:this.unplaced.openStart;i>=0;i--){let n,a=null;i?(a=qs(this.unplaced.content,i-1).firstChild,n=a.content):n=this.unplaced.content;let l=n.firstChild;for(let s=this.depth;s>=0;s--){let{type:p,match:d}=this.frontier[s],c,b=null;if(t==1&&(l?d.matchType(l.type)||(b=d.fillBefore(G.from(l),!1)):a&&p.compatibleContent(a.type)))return{sliceDepth:i,frontierDepth:s,parent:a,inject:b};if(t==2&&l&&(c=d.findWrapping(l.type)))return{sliceDepth:i,frontierDepth:s,parent:a,wrap:c};if(a&&d.matchType(a.type))break}}}openMore(){let{content:e,openStart:t,openEnd:i}=this.unplaced,n=qs(e,t);return!n.childCount||n.firstChild.isLeaf?!1:(this.unplaced=new $(e,t+1,Math.max(i,n.size+t>=e.size-i?t+1:0)),!0)}dropNode(){let{content:e,openStart:t,openEnd:i}=this.unplaced,n=qs(e,t);if(n.childCount<=1&&t>0){let a=e.size-t<=t+n.size;this.unplaced=new $(Yi(e,t-1,1),t-1,a?t-1:i)}else this.unplaced=new $(Yi(e,t,1),t,i)}placeNodes({sliceDepth:e,frontierDepth:t,parent:i,inject:n,wrap:a}){for(;this.depth>t;)this.closeFrontierNode();if(a)for(let u=0;u<a.length;u++)this.openFrontierNode(a[u]);let l=this.unplaced,s=i?i.content:l.content,p=l.openStart-e,d=0,c=[],{match:b,type:m}=this.frontier[t];if(n){for(let u=0;u<n.childCount;u++)c.push(n.child(u));b=b.matchFragment(n)}let g=s.size+e-(l.content.size-l.openEnd);for(;d<s.childCount;){let u=s.child(d),h=b.matchType(u.type);if(!h)break;d++,(d>1||p==0||u.content.size)&&(b=h,c.push(WL(u.mark(m.allowedMarks(u.marks)),d==1?p:0,d==s.childCount?g:-1)))}let x=d==s.childCount;x||(g=-1),this.placed=Qi(this.placed,t,G.from(c)),this.frontier[t].match=b,x&&g<0&&i&&i.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let u=0,h=s;u<g;u++){let f=h.lastChild;this.frontier.push({type:f.type,match:f.contentMatchAt(f.childCount)}),h=f.content}this.unplaced=x?e==0?$.empty:new $(Yi(l.content,e-1,1),e-1,g<0?l.openEnd:e-1):new $(Yi(l.content,e,d),l.openStart,l.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let e=this.frontier[this.depth],t;if(!e.type.isTextblock||!Us(this.$to,this.$to.depth,e.type,e.match,!1)||this.$to.depth==this.depth&&(t=this.findCloseLevel(this.$to))&&t.depth==this.depth)return-1;let{depth:i}=this.$to,n=this.$to.after(i);for(;i>1&&n==this.$to.end(--i);)++n;return n}findCloseLevel(e){e:for(let t=Math.min(this.depth,e.depth);t>=0;t--){let{match:i,type:n}=this.frontier[t],a=t<e.depth&&e.end(t+1)==e.pos+(e.depth-(t+1)),l=Us(e,t,n,i,a);if(l){for(let s=t-1;s>=0;s--){let{match:p,type:d}=this.frontier[s],c=Us(e,s,d,p,!0);if(!c||c.childCount)continue e}return{depth:t,fit:l,move:a?e.doc.resolve(e.after(t+1)):e}}}}close(e){let t=this.findCloseLevel(e);if(!t)return null;for(;this.depth>t.depth;)this.closeFrontierNode();t.fit.childCount&&(this.placed=Qi(this.placed,t.depth,t.fit)),e=t.move;for(let i=t.depth+1;i<=e.depth;i++){let n=e.node(i),a=n.type.contentMatch.fillBefore(n.content,!0,e.index(i));this.openFrontierNode(n.type,n.attrs,a)}return e}openFrontierNode(e,t=null,i){let n=this.frontier[this.depth];n.match=n.match.matchType(e),this.placed=Qi(this.placed,this.depth,G.from(e.create(t,i))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let t=this.frontier.pop().match.fillBefore(G.empty,!0);t.childCount&&(this.placed=Qi(this.placed,this.frontier.length,t))}}function Yi(r,e,t){return e==0?r.cutByIndex(t,r.childCount):r.replaceChild(0,r.firstChild.copy(Yi(r.firstChild.content,e-1,t)))}function Qi(r,e,t){return e==0?r.append(t):r.replaceChild(r.childCount-1,r.lastChild.copy(Qi(r.lastChild.content,e-1,t)))}function qs(r,e){for(let t=0;t<e;t++)r=r.firstChild.content;return r}function WL(r,e,t){if(e<=0)return r;let i=r.content;return e>1&&(i=i.replaceChild(0,WL(i.firstChild,e-1,i.childCount==1?t-1:0))),e>0&&(i=r.type.contentMatch.fillBefore(i).append(i),t<=0&&(i=i.append(r.type.contentMatch.matchFragment(i).fillBefore(G.empty,!0)))),r.copy(i)}function Us(r,e,t,i,n){let a=r.node(e),l=n?r.indexAfter(e):r.index(e);if(l==a.childCount&&!t.compatibleContent(a.type))return null;let s=i.fillBefore(a.content,!0,l);return s&&!cV(t,a.content,l)?s:null}function cV(r,e,t){for(let i=t;i<e.childCount;i++)if(!r.allowsMarks(e.child(i).marks))return!0;return!1}function bV(r){return r.spec.defining||r.spec.definingForContent}function mV(r,e,t,i){if(!i.size)return r.deleteRange(e,t);let n=r.doc.resolve(e),a=r.doc.resolve(t);if(UL(n,a,i))return r.step(new _t(e,t,i));let l=KL(n,a);l[l.length-1]==0&&l.pop();let s=-(n.depth+1);l.unshift(s);for(let m=n.depth,g=n.pos-1;m>0;m--,g--){let x=n.node(m).type.spec;if(x.defining||x.definingAsContext||x.isolating)break;l.indexOf(m)>-1?s=m:n.before(m)==g&&l.splice(1,0,-m)}let p=l.indexOf(s),d=[],c=i.openStart;for(let m=i.content,g=0;;g++){let x=m.firstChild;if(d.push(x),g==i.openStart)break;m=x.content}for(let m=c-1;m>=0;m--){let g=d[m],x=bV(g.type);if(x&&!g.sameMarkup(n.node(Math.abs(s)-1)))c=m;else if(x||!g.type.isTextblock)break}for(let m=i.openStart;m>=0;m--){let g=(m+c+1)%(i.openStart+1),x=d[g];if(x)for(let u=0;u<l.length;u++){let h=l[(u+p)%l.length],f=!0;h<0&&(f=!1,h=-h);let w=n.node(h-1),y=n.index(h-1);if(w.canReplaceWith(y,y,x.type,x.marks))return r.replace(n.before(h),f?a.after(h):t,new $(GL(i.content,0,i.openStart,g),g,i.openEnd))}}let b=r.steps.length;for(let m=l.length-1;m>=0&&(r.replace(e,t,i),!(r.steps.length>b));m--){let g=l[m];g<0||(e=n.before(g),t=a.after(g))}}function GL(r,e,t,i,n){if(e<t){let a=r.firstChild;r=r.replaceChild(0,a.copy(GL(a.content,e+1,t,i,a)))}if(e>i){let a=n.contentMatchAt(0),l=a.fillBefore(r).append(r);r=l.append(a.matchFragment(l).fillBefore(G.empty,!0))}return r}function gV(r,e,t,i){if(!i.isInline&&e==t&&r.doc.resolve(e).parent.content.size){let n=pV(r.doc,e,i.type);n!=null&&(e=t=n)}r.replaceRange(e,t,new $(G.from(i),0,0))}function uV(r,e,t){let i=r.doc.resolve(e),n=r.doc.resolve(t);if(i.parent.isTextblock&&n.parent.isTextblock&&i.start()!=n.start()&&i.parentOffset==0&&n.parentOffset==0){let l=i.sharedDepth(t),s=!1;for(let p=i.depth;p>l;p--)i.node(p).type.spec.isolating&&(s=!0);for(let p=n.depth;p>l;p--)n.node(p).type.spec.isolating&&(s=!0);if(!s){for(let p=i.depth;p>0&&e==i.start(p);p--)e=i.before(p);for(let p=n.depth;p>0&&t==n.start(p);p--)t=n.before(p);i=r.doc.resolve(e),n=r.doc.resolve(t)}}let a=KL(i,n);for(let l=0;l<a.length;l++){let s=a[l],p=l==a.length-1;if(p&&s==0||i.node(s).type.contentMatch.validEnd)return r.delete(i.start(s),n.end(s));if(s>0&&(p||i.node(s-1).canReplace(i.index(s-1),n.indexAfter(s-1))))return r.delete(i.before(s),n.after(s))}for(let l=1;l<=i.depth&&l<=n.depth;l++)if(e-i.start(l)==i.depth-l&&t>i.end(l)&&n.end(l)-t!=n.depth-l&&i.start(l-1)==n.start(l-1)&&i.node(l-1).canReplace(i.index(l-1),n.index(l-1)))return r.delete(i.before(l),t);r.delete(e,t)}function KL(r,e){let t=[],i=Math.min(r.depth,e.depth);for(let n=i;n>=0;n--){let a=r.start(n);if(a<r.pos-(r.depth-n)||e.end(n)>e.pos+(e.depth-n)||r.node(n).type.spec.isolating||e.node(n).type.spec.isolating)break;(a==e.start(n)||n==r.depth&&n==e.depth&&r.parent.inlineContent&&e.parent.inlineContent&&n&&e.start(n-1)==a-1)&&t.push(n)}return t}let JL=class Es extends nt{constructor(e,t,i){super(),this.pos=e,this.attr=t,this.value=i}apply(e){let t=e.nodeAt(this.pos);if(!t)return ut.fail("No node at attribute step's position");let i=Object.create(null);for(let a in t.attrs)i[a]=t.attrs[a];i[this.attr]=this.value;let n=t.type.create(i,null,t.marks);return ut.fromReplace(e,this.pos,this.pos+1,new $(G.from(n),0,t.isLeaf?0:1))}getMap(){return Eo.empty}invert(e){return new Es(this.pos,this.attr,e.nodeAt(this.pos).attrs[this.attr])}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new Es(t.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(e,t){if(typeof t.pos!="number"||typeof t.attr!="string")throw new RangeError("Invalid input for AttrStep.fromJSON");return new Es(t.pos,t.attr,t.value)}};nt.jsonID("attr",JL);let YL=class kc extends nt{constructor(e,t){super(),this.attr=e,this.value=t}apply(e){let t=Object.create(null);for(let n in e.attrs)t[n]=e.attrs[n];t[this.attr]=this.value;let i=e.type.create(t,e.content,e.marks);return ut.ok(i)}getMap(){return Eo.empty}invert(e){return new kc(this.attr,e.attrs[this.attr])}map(e){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(e,t){if(typeof t.attr!="string")throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new kc(t.attr,t.value)}};nt.jsonID("docAttr",YL);let ri=class extends Error{};ri=function r(e){let t=Error.call(this,e);return t.__proto__=r.prototype,t},ri.prototype=Object.create(Error.prototype),ri.prototype.constructor=ri,ri.prototype.name="TransformError";class QL{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new Ji}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let t=this.maybeStep(e);if(t.failed)throw new ri(t.failed);return this}maybeStep(e){let t=e.apply(this.doc);return t.failed||this.addStep(e,t.doc),t}get docChanged(){return this.steps.length>0}changedRange(){let e=1e9,t=-1e9;for(let i=0;i<this.mapping.maps.length;i++){let n=this.mapping.maps[i];i&&(e=n.map(e,1),t=n.map(t,-1)),n.forEach((a,l,s,p)=>{e=Math.min(e,s),t=Math.max(t,p)})}return e==1e9?null:{from:e,to:t}}addStep(e,t){this.docs.push(this.doc),this.steps.push(e),this.mapping.appendMap(e.getMap()),this.doc=t}replace(e,t=e,i=$.empty){let n=va(this.doc,e,t,i);return n&&this.step(n),this}replaceWith(e,t,i){return this.replace(e,t,new $(G.from(i),0,0))}delete(e,t){return this.replace(e,t,$.empty)}insert(e,t){return this.replaceWith(e,e,t)}replaceRange(e,t,i){return mV(this,e,t,i),this}replaceRangeWith(e,t,i){return gV(this,e,t,i),this}deleteRange(e,t){return uV(this,e,t),this}lift(e,t){return $I(this,e,t),this}join(e,t=1){return sV(this,e,t),this}wrap(e,t){return rV(this,e,t),this}setBlockType(e,t=e,i,n=null){return oV(this,e,t,i,n),this}setNodeMarkup(e,t,i=null,n){return nV(this,e,t,i,n),this}setNodeAttribute(e,t,i){return this.step(new JL(e,t,i)),this}setDocAttribute(e,t){return this.step(new YL(e,t)),this}addNodeMark(e,t){return this.step(new Rs(e,t)),this}removeNodeMark(e,t){let i=this.doc.nodeAt(e);if(!i)throw new RangeError("No node at position "+e);if(t instanceof ve)t.isInSet(i.marks)&&this.step(new ya(e,t));else{let n=i.marks,a,l=[];for(;a=t.isInSet(n);)l.push(new ya(e,a)),n=a.removeFromSet(n);for(let s=l.length-1;s>=0;s--)this.step(l[s])}return this}split(e,t=1,i){return aV(this,e,t,i),this}addMark(e,t,i){return QI(this,e,t,i),this}removeMark(e,t,i){return XI(this,e,t,i),this}clearIncompatible(e,t,i){return Fs(this,e,t,i),this}}const Ws=Object.create(null);let de=class{constructor(e,t,i){this.$anchor=e,this.$head=t,this.ranges=i||[new xV(e.min(t),e.max(t))]}get anchor(){return this.$anchor.pos}get head(){return this.$head.pos}get from(){return this.$from.pos}get to(){return this.$to.pos}get $from(){return this.ranges[0].$from}get $to(){return this.ranges[0].$to}get empty(){let e=this.ranges;for(let t=0;t<e.length;t++)if(e[t].$from.pos!=e[t].$to.pos)return!1;return!0}content(){return this.$from.doc.slice(this.from,this.to,!0)}replace(e,t=$.empty){let i=t.content.lastChild,n=null;for(let s=0;s<t.openEnd;s++)n=i,i=i.lastChild;let a=e.steps.length,l=this.ranges;for(let s=0;s<l.length;s++){let{$from:p,$to:d}=l[s],c=e.mapping.slice(a);e.replaceRange(c.map(p.pos),c.map(d.pos),s?$.empty:t),s==0&&eN(e,a,(i?i.isInline:n&&n.isTextblock)?-1:1)}}replaceWith(e,t){let i=e.steps.length,n=this.ranges;for(let a=0;a<n.length;a++){let{$from:l,$to:s}=n[a],p=e.mapping.slice(i),d=p.map(l.pos),c=p.map(s.pos);a?e.deleteRange(d,c):(e.replaceRangeWith(d,c,t),eN(e,i,t.isInline?-1:1))}}static findFrom(e,t,i=!1){let n=e.parent.inlineContent?new pe(e):oi(e.node(0),e.parent,e.pos,e.index(),t,i);if(n)return n;for(let a=e.depth-1;a>=0;a--){let l=t<0?oi(e.node(0),e.node(a),e.before(a+1),e.index(a),t,i):oi(e.node(0),e.node(a),e.after(a+1),e.index(a)+1,t,i);if(l)return l}return null}static near(e,t=1){return this.findFrom(e,t)||this.findFrom(e,-t)||new gr(e.node(0))}static atStart(e){return oi(e,e,0,0,1)||new gr(e)}static atEnd(e){return oi(e,e,e.content.size,e.childCount,-1)||new gr(e)}static fromJSON(e,t){if(!t||!t.type)throw new RangeError("Invalid input for Selection.fromJSON");let i=Ws[t.type];if(!i)throw new RangeError(`No selection type ${t.type} defined`);return i.fromJSON(e,t)}static jsonID(e,t){if(e in Ws)throw new RangeError("Duplicate use of selection JSON ID "+e);return Ws[e]=t,t.prototype.jsonID=e,t}getBookmark(){return pe.between(this.$anchor,this.$head).getBookmark()}};de.prototype.visible=!0;let xV=class{constructor(e,t){this.$from=e,this.$to=t}},XL=!1;function ZL(r){!XL&&!r.parent.inlineContent&&(XL=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+r.parent.type.name+")"))}let pe=class $n extends de{constructor(e,t=e){ZL(e),ZL(t),super(e,t)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(e,t){let i=e.resolve(t.map(this.head));if(!i.parent.inlineContent)return de.near(i);let n=e.resolve(t.map(this.anchor));return new $n(n.parent.inlineContent?n:i,i)}replace(e,t=$.empty){if(super.replace(e,t),t==$.empty){let i=this.$from.marksAcross(this.$to);i&&e.ensureMarks(i)}}eq(e){return e instanceof $n&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new $L(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(e,t){if(typeof t.anchor!="number"||typeof t.head!="number")throw new RangeError("Invalid input for TextSelection.fromJSON");return new $n(e.resolve(t.anchor),e.resolve(t.head))}static create(e,t,i=t){let n=e.resolve(t);return new this(n,i==t?n:e.resolve(i))}static between(e,t,i){let n=e.pos-t.pos;if((!i||n)&&(i=n>=0?1:-1),!t.parent.inlineContent){let a=de.findFrom(t,i,!0)||de.findFrom(t,-i,!0);if(a)t=a.$head;else return de.near(t,i)}return e.parent.inlineContent||(n==0?e=t:(e=(de.findFrom(e,-i,!0)||de.findFrom(e,i,!0)).$anchor,e.pos<t.pos!=n<0&&(e=t))),new $n(e,t)}};de.jsonID("text",pe);let $L=class Rz{constructor(e,t){this.anchor=e,this.head=t}map(e){return new Rz(e.map(this.anchor),e.map(this.head))}resolve(e){return pe.between(e.resolve(this.anchor),e.resolve(this.head))}},ae=class ea extends de{constructor(e){let t=e.nodeAfter,i=e.node(0).resolve(e.pos+t.nodeSize);super(e,i),this.node=t}map(e,t){let{deleted:i,pos:n}=t.mapResult(this.anchor),a=e.resolve(n);return i?de.near(a):new ea(a)}content(){return new $(G.from(this.node),0,0)}eq(e){return e instanceof ea&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new hV(this.anchor)}static fromJSON(e,t){if(typeof t.anchor!="number")throw new RangeError("Invalid input for NodeSelection.fromJSON");return new ea(e.resolve(t.anchor))}static create(e,t){return new ea(e.resolve(t))}static isSelectable(e){return!e.isText&&e.type.spec.selectable!==!1}};ae.prototype.visible=!1,de.jsonID("node",ae);let hV=class Oz{constructor(e){this.anchor=e}map(e){let{deleted:t,pos:i}=e.mapResult(this.anchor);return t?new $L(i,i):new Oz(i)}resolve(e){let t=e.resolve(this.anchor),i=t.nodeAfter;return i&&ae.isSelectable(i)?new ae(t):de.near(t)}},gr=class Ms extends de{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,t=$.empty){if(t==$.empty){e.delete(0,e.doc.content.size);let i=de.atStart(e.doc);i.eq(e.selection)||e.setSelection(i)}else super.replace(e,t)}toJSON(){return{type:"all"}}static fromJSON(e){return new Ms(e)}map(e){return new Ms(e)}eq(e){return e instanceof Ms}getBookmark(){return fV}};de.jsonID("all",gr);const fV={map(){return this},resolve(r){return new gr(r)}};function oi(r,e,t,i,n,a=!1){if(e.inlineContent)return pe.create(r,t);for(let l=i-(n>0?0:1);n>0?l<e.childCount:l>=0;l+=n){let s=e.child(l);if(s.isAtom){if(!a&&ae.isSelectable(s))return ae.create(r,t-(n<0?s.nodeSize:0))}else{let p=oi(r,s,t+n,n<0?s.childCount:0,n,a);if(p)return p}t+=s.nodeSize*n}return null}function eN(r,e,t){let i=r.steps.length-1;if(i<e)return;let n=r.steps[i];if(!(n instanceof _t||n instanceof Mt))return;let a=r.mapping.maps[i],l;a.forEach((s,p,d,c)=>{l==null&&(l=c)}),r.setSelection(de.near(r.doc.resolve(l),t))}const tN=1,ka=2,rN=4;class yV extends QL{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|tN)&~ka,this.storedMarks=null,this}get selectionSet(){return(this.updated&tN)>0}setStoredMarks(e){return this.storedMarks=e,this.updated|=ka,this}ensureMarks(e){return ve.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&ka)>0}addStep(e,t){super.addStep(e,t),this.updated=this.updated&~ka,this.storedMarks=null}setTime(e){return this.time=e,this}replaceSelection(e){return this.selection.replace(this,e),this}replaceSelectionWith(e,t=!0){let i=this.selection;return t&&(e=e.mark(this.storedMarks||(i.empty?i.$from.marks():i.$from.marksAcross(i.$to)||ve.none))),i.replaceWith(this,e),this}deleteSelection(){return this.selection.replace(this),this}insertText(e,t,i){let n=this.doc.type.schema;if(t==null)return e?this.replaceSelectionWith(n.text(e),!0):this.deleteSelection();{if(i==null&&(i=t),!e)return this.deleteRange(t,i);let a=this.storedMarks;if(!a){let l=this.doc.resolve(t);a=i==t?l.marks():l.marksAcross(this.doc.resolve(i))}return this.replaceRangeWith(t,i,n.text(e,a)),!this.selection.empty&&this.selection.to==t+e.length&&this.setSelection(de.near(this.selection.$to)),this}}setMeta(e,t){return this.meta[typeof e=="string"?e:e.key]=t,this}getMeta(e){return this.meta[typeof e=="string"?e:e.key]}get isGeneric(){for(let e in this.meta)return!1;return!0}scrollIntoView(){return this.updated|=rN,this}get scrolledIntoView(){return(this.updated&rN)>0}}function oN(r,e){return!e||!r?r:r.bind(e)}let Xi=class{constructor(e,t,i){this.name=e,this.init=oN(t.init,i),this.apply=oN(t.apply,i)}};const wV=[new Xi("doc",{init(r){return r.doc||r.schema.topNodeType.createAndFill()},apply(r){return r.doc}}),new Xi("selection",{init(r,e){return r.selection||de.atStart(e.doc)},apply(r){return r.selection}}),new Xi("storedMarks",{init(r){return r.storedMarks||null},apply(r,e,t,i){return i.selection.$cursor?r.storedMarks:null}}),new Xi("scrollToSelection",{init(){return 0},apply(r,e){return r.scrolledIntoView?e+1:e}})];class Gs{constructor(e,t){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=wV.slice(),t&&t.forEach(i=>{if(this.pluginsByKey[i.key])throw new RangeError("Adding different instances of a keyed plugin ("+i.key+")");this.plugins.push(i),this.pluginsByKey[i.key]=i,i.spec.state&&this.fields.push(new Xi(i.key,i.spec.state,i))})}}class ii{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,t=-1){for(let i=0;i<this.config.plugins.length;i++)if(i!=t){let n=this.config.plugins[i];if(n.spec.filterTransaction&&!n.spec.filterTransaction.call(n,e,this))return!1}return!0}applyTransaction(e){if(!this.filterTransaction(e))return{state:this,transactions:[]};let t=[e],i=this.applyInner(e),n=null;for(;;){let a=!1;for(let l=0;l<this.config.plugins.length;l++){let s=this.config.plugins[l];if(s.spec.appendTransaction){let p=n?n[l].n:0,d=n?n[l].state:this,c=p<t.length&&s.spec.appendTransaction.call(s,p?t.slice(p):t,d,i);if(c&&i.filterTransaction(c,l)){if(c.setMeta("appendedTransaction",e),!n){n=[];for(let b=0;b<this.config.plugins.length;b++)n.push(b<l?{state:i,n:t.length}:{state:this,n:0})}t.push(c),i=i.applyInner(c),a=!0}n&&(n[l]={state:i,n:t.length})}}if(!a)return{state:i,transactions:t}}}applyInner(e){if(!e.before.eq(this.doc))throw new RangeError("Applying a mismatched transaction");let t=new ii(this.config),i=this.config.fields;for(let n=0;n<i.length;n++){let a=i[n];t[a.name]=a.apply(e,this[a.name],this,t)}return t}get tr(){return new yV(this)}static create(e){let t=new Gs(e.doc?e.doc.type.schema:e.schema,e.plugins),i=new ii(t);for(let n=0;n<t.fields.length;n++)i[t.fields[n].name]=t.fields[n].init(e,i);return i}reconfigure(e){let t=new Gs(this.schema,e.plugins),i=t.fields,n=new ii(t);for(let a=0;a<i.length;a++){let l=i[a].name;n[l]=this.hasOwnProperty(l)?this[l]:i[a].init(e,n)}return n}toJSON(e){let t={doc:this.doc.toJSON(),selection:this.selection.toJSON()};if(this.storedMarks&&(t.storedMarks=this.storedMarks.map(i=>i.toJSON())),e&&typeof e=="object")for(let i in e){if(i=="doc"||i=="selection")throw new RangeError("The JSON fields `doc` and `selection` are reserved");let n=e[i],a=n.spec.state;a&&a.toJSON&&(t[i]=a.toJSON.call(n,this[n.key]))}return t}static fromJSON(e,t,i){if(!t)throw new RangeError("Invalid input for EditorState.fromJSON");if(!e.schema)throw new RangeError("Required config field 'schema' missing");let n=new Gs(e.schema,e.plugins),a=new ii(n);return n.fields.forEach(l=>{if(l.name=="doc")a.doc=Rr.fromJSON(e.schema,t.doc);else if(l.name=="selection")a.selection=de.fromJSON(a.doc,t.selection);else if(l.name=="storedMarks")t.storedMarks&&(a.storedMarks=t.storedMarks.map(e.schema.markFromJSON));else{if(i)for(let s in i){let p=i[s],d=p.spec.state;if(p.key==l.name&&d&&d.fromJSON&&Object.prototype.hasOwnProperty.call(t,s)){a[l.name]=d.fromJSON.call(p,e,t[s],a);return}}a[l.name]=l.init(e,a)}}),a}}function iN(r,e,t){for(let i in r){let n=r[i];n instanceof Function?n=n.bind(e):i=="handleDOMEvents"&&(n=iN(n,e,{})),t[i]=n}return t}class Me{constructor(e){this.spec=e,this.props={},e.props&&iN(e.props,this,this.props),this.key=e.key?e.key.key:nN("plugin")}getState(e){return e[this.key]}}const Ks=Object.create(null);function nN(r){return r in Ks?r+"$"+ ++Ks[r]:(Ks[r]=0,r+"$")}class Fe{constructor(e="key"){this.key=nN(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}const aN=(r,e)=>r.selection.empty?!1:(e&&e(r.tr.deleteSelection().scrollIntoView()),!0);function lN(r,e){let{$cursor:t}=r.selection;return!t||(e?!e.endOfTextblock("backward",r):t.parentOffset>0)?null:t}const sN=(r,e,t)=>{let i=lN(r,t);if(!i)return!1;let n=Js(i);if(!n){let l=i.blockRange(),s=l&&ti(l);return s==null?!1:(e&&e(r.tr.lift(l,s).scrollIntoView()),!0)}let a=n.nodeBefore;if(hN(r,n,e,-1))return!0;if(i.parent.content.size==0&&(ni(a,"end")||ae.isSelectable(a)))for(let l=i.depth;;l--){let s=va(r.doc,i.before(l),i.after(l),$.empty);if(s&&s.slice.size<s.to-s.from){if(e){let p=r.tr.step(s);p.setSelection(ni(a,"end")?de.findFrom(p.doc.resolve(p.mapping.map(n.pos,-1)),-1):ae.create(p.doc,n.pos-a.nodeSize)),e(p.scrollIntoView())}return!0}if(l==1||i.node(l-1).childCount>1)break}return a.isAtom&&n.depth==i.depth-1?(e&&e(r.tr.delete(n.pos-a.nodeSize,n.pos).scrollIntoView()),!0):!1},vV=(r,e,t)=>{let i=lN(r,t);if(!i)return!1;let n=Js(i);return n?pN(r,n,e):!1},kV=(r,e,t)=>{let i=cN(r,t);if(!i)return!1;let n=Ys(i);return n?pN(r,n,e):!1};function pN(r,e,t){let i=e.nodeBefore,n=i,a=e.pos-1;for(;!n.isTextblock;a--){if(n.type.spec.isolating)return!1;let c=n.lastChild;if(!c)return!1;n=c}let l=e.nodeAfter,s=l,p=e.pos+1;for(;!s.isTextblock;p++){if(s.type.spec.isolating)return!1;let c=s.firstChild;if(!c)return!1;s=c}let d=va(r.doc,a,p,$.empty);if(!d||d.from!=a||d instanceof _t&&d.slice.size>=p-a)return!1;if(t){let c=r.tr.step(d);c.setSelection(pe.create(c.doc,a)),t(c.scrollIntoView())}return!0}function ni(r,e,t=!1){for(let i=r;i;i=e=="start"?i.firstChild:i.lastChild){if(i.isTextblock)return!0;if(t&&i.childCount!=1)return!1}return!1}const dN=(r,e,t)=>{let{$head:i,empty:n}=r.selection,a=i;if(!n)return!1;if(i.parent.isTextblock){if(t?!t.endOfTextblock("backward",r):i.parentOffset>0)return!1;a=Js(i)}let l=a&&a.nodeBefore;return!l||!ae.isSelectable(l)?!1:(e&&e(r.tr.setSelection(ae.create(r.doc,a.pos-l.nodeSize)).scrollIntoView()),!0)};function Js(r){if(!r.parent.type.spec.isolating)for(let e=r.depth-1;e>=0;e--){if(r.index(e)>0)return r.doc.resolve(r.before(e+1));if(r.node(e).type.spec.isolating)break}return null}function cN(r,e){let{$cursor:t}=r.selection;return!t||(e?!e.endOfTextblock("forward",r):t.parentOffset<t.parent.content.size)?null:t}const bN=(r,e,t)=>{let i=cN(r,t);if(!i)return!1;let n=Ys(i);if(!n)return!1;let a=n.nodeAfter;if(hN(r,n,e,1))return!0;if(i.parent.content.size==0&&(ni(a,"start")||ae.isSelectable(a))){let l=va(r.doc,i.before(),i.after(),$.empty);if(l&&l.slice.size<l.to-l.from){if(e){let s=r.tr.step(l);s.setSelection(ni(a,"start")?de.findFrom(s.doc.resolve(s.mapping.map(n.pos)),1):ae.create(s.doc,s.mapping.map(n.pos))),e(s.scrollIntoView())}return!0}}return a.isAtom&&n.depth==i.depth-1?(e&&e(r.tr.delete(n.pos,n.pos+a.nodeSize).scrollIntoView()),!0):!1},mN=(r,e,t)=>{let{$head:i,empty:n}=r.selection,a=i;if(!n)return!1;if(i.parent.isTextblock){if(t?!t.endOfTextblock("forward",r):i.parentOffset<i.parent.content.size)return!1;a=Ys(i)}let l=a&&a.nodeAfter;return!l||!ae.isSelectable(l)?!1:(e&&e(r.tr.setSelection(ae.create(r.doc,a.pos)).scrollIntoView()),!0)};function Ys(r){if(!r.parent.type.spec.isolating)for(let e=r.depth-1;e>=0;e--){let t=r.node(e);if(r.index(e)+1<t.childCount)return r.doc.resolve(r.after(e+1));if(t.type.spec.isolating)break}return null}const SV=(r,e)=>{let t=r.selection,i=t instanceof ae,n;if(i){if(t.node.isTextblock||!Or(r.doc,t.from))return!1;n=t.from}else if(n=wa(r.doc,t.from,-1),n==null)return!1;if(e){let a=r.tr.join(n);i&&a.setSelection(ae.create(a.doc,n-r.doc.resolve(n).nodeBefore.nodeSize)),e(a.scrollIntoView())}return!0},CV=(r,e)=>{let t=r.selection,i;if(t instanceof ae){if(t.node.isTextblock||!Or(r.doc,t.to))return!1;i=t.to}else if(i=wa(r.doc,t.to,1),i==null)return!1;return e&&e(r.tr.join(i).scrollIntoView()),!0},TV=(r,e)=>{let{$from:t,$to:i}=r.selection,n=t.blockRange(i),a=n&&ti(n);return a==null?!1:(e&&e(r.tr.lift(n,a).scrollIntoView()),!0)},gN=(r,e)=>{let{$head:t,$anchor:i}=r.selection;return!t.parent.type.spec.code||!t.sameParent(i)?!1:(e&&e(r.tr.insertText(`
20
20
  `).scrollIntoView()),!0)};function Qs(r){for(let e=0;e<r.edgeCount;e++){let{type:t}=r.edge(e);if(t.isTextblock&&!t.hasRequiredAttrs())return t}return null}const EV=(r,e)=>{let{$head:t,$anchor:i}=r.selection;if(!t.parent.type.spec.code||!t.sameParent(i))return!1;let n=t.node(-1),a=t.indexAfter(-1),l=Qs(n.contentMatchAt(a));if(!l||!n.canReplaceWith(a,a,l))return!1;if(e){let s=t.after(),p=r.tr.replaceWith(s,s,l.createAndFill());p.setSelection(de.near(p.doc.resolve(s),1)),e(p.scrollIntoView())}return!0},uN=(r,e)=>{let t=r.selection,{$from:i,$to:n}=t;if(t instanceof gr||i.parent.inlineContent||n.parent.inlineContent)return!1;let a=Qs(n.parent.contentMatchAt(n.indexAfter()));if(!a||!a.isTextblock)return!1;if(e){let l=(!i.parentOffset&&n.index()<n.parent.childCount?i:n).pos,s=r.tr.insert(l,a.createAndFill());s.setSelection(pe.create(s.doc,l+1)),e(s.scrollIntoView())}return!0},xN=(r,e)=>{let{$cursor:t}=r.selection;if(!t||t.parent.content.size)return!1;if(t.depth>1&&t.after()!=t.end(-1)){let a=t.before();if(mr(r.doc,a))return e&&e(r.tr.split(a).scrollIntoView()),!0}let i=t.blockRange(),n=i&&ti(i);return n==null?!1:(e&&e(r.tr.lift(i,n).scrollIntoView()),!0)};function MV(r){return(e,t)=>{let{$from:i,$to:n}=e.selection;if(e.selection instanceof ae&&e.selection.node.isBlock)return!i.parentOffset||!mr(e.doc,i.pos)?!1:(t&&t(e.tr.split(i.pos).scrollIntoView()),!0);if(!i.depth)return!1;let a=[],l,s,p=!1,d=!1;for(let g=i.depth;;g--)if(i.node(g).isBlock){p=i.end(g)==i.pos+(i.depth-g),d=i.start(g)==i.pos-(i.depth-g),s=Qs(i.node(g-1).contentMatchAt(i.indexAfter(g-1))),a.unshift(p&&s?{type:s}:null),l=g;break}else{if(g==1)return!1;a.unshift(null)}let c=e.tr;(e.selection instanceof pe||e.selection instanceof gr)&&c.deleteSelection();let b=c.mapping.map(i.pos),m=mr(c.doc,b,a.length,a);if(m||(a[0]=s?{type:s}:null,m=mr(c.doc,b,a.length,a)),!m)return!1;if(c.split(b,a.length,a),!p&&d&&i.node(l).type!=s){let g=c.mapping.map(i.before(l)),x=c.doc.resolve(g);s&&i.node(l-1).canReplaceWith(x.index(),x.index()+1,s)&&c.setNodeMarkup(c.mapping.map(i.before(l)),s)}return t&&t(c.scrollIntoView()),!0}}const PV=MV(),BV=(r,e)=>{let{$from:t,to:i}=r.selection,n,a=t.sharedDepth(i);return a==0?!1:(n=t.before(a),e&&e(r.tr.setSelection(ae.create(r.doc,n))),!0)};function LV(r,e,t){let i=e.nodeBefore,n=e.nodeAfter,a=e.index();return!i||!n||!i.type.compatibleContent(n.type)?!1:!i.content.size&&e.parent.canReplace(a-1,a)?(t&&t(r.tr.delete(e.pos-i.nodeSize,e.pos).scrollIntoView()),!0):!e.parent.canReplace(a,a+1)||!(n.isTextblock||Or(r.doc,e.pos))?!1:(t&&t(r.tr.join(e.pos).scrollIntoView()),!0)}function hN(r,e,t,i){let n=e.nodeBefore,a=e.nodeAfter,l,s,p=n.type.spec.isolating||a.type.spec.isolating;if(!p&&LV(r,e,t))return!0;let d=!p&&e.parent.canReplace(e.index(),e.index()+1);if(d&&(l=(s=n.contentMatchAt(n.childCount)).findWrapping(a.type))&&s.matchType(l[0]||a.type).validEnd){if(t){let g=e.pos+a.nodeSize,x=G.empty;for(let f=l.length-1;f>=0;f--)x=G.from(l[f].create(null,x));x=G.from(n.copy(x));let u=r.tr.step(new Mt(e.pos-1,g,e.pos,g,new $(x,1,0),l.length,!0)),h=u.doc.resolve(g+2*l.length);h.nodeAfter&&h.nodeAfter.type==n.type&&Or(u.doc,h.pos)&&u.join(h.pos),t(u.scrollIntoView())}return!0}let c=a.type.spec.isolating||i>0&&p?null:de.findFrom(e,1),b=c&&c.$from.blockRange(c.$to),m=b&&ti(b);if(m!=null&&m>=e.depth)return t&&t(r.tr.lift(b,m).scrollIntoView()),!0;if(d&&ni(a,"start",!0)&&ni(n,"end")){let g=n,x=[];for(;x.push(g),!g.isTextblock;)g=g.lastChild;let u=a,h=1;for(;!u.isTextblock;u=u.firstChild)h++;if(g.canReplace(g.childCount,g.childCount,u.content)){if(t){let f=G.empty;for(let y=x.length-1;y>=0;y--)f=G.from(x[y].copy(f));let w=r.tr.step(new Mt(e.pos-x.length,e.pos+a.nodeSize,e.pos+h,e.pos+a.nodeSize-h,new $(f,x.length,0),0,!0));t(w.scrollIntoView())}return!0}}return!1}function fN(r){return function(e,t){let i=e.selection,n=r<0?i.$from:i.$to,a=n.depth;for(;n.node(a).isInline;){if(!a)return!1;a--}return n.node(a).isTextblock?(t&&t(e.tr.setSelection(pe.create(e.doc,r<0?n.start(a):n.end(a)))),!0):!1}}const NV=fN(-1),AV=fN(1);function _V(r,e=null){return function(t,i){let{$from:n,$to:a}=t.selection,l=n.blockRange(a),s=l&&js(l,r,e);return s?(i&&i(t.tr.wrap(l,s).scrollIntoView()),!0):!1}}function yN(r,e=null){return function(t,i){let n=!1;for(let a=0;a<t.selection.ranges.length&&!n;a++){let{$from:{pos:l},$to:{pos:s}}=t.selection.ranges[a];t.doc.nodesBetween(l,s,(p,d)=>{if(n)return!1;if(!(!p.isTextblock||p.hasMarkup(r,e)))if(p.type==r)n=!0;else{let c=t.doc.resolve(d),b=c.index();n=c.parent.canReplaceWith(b,b+1,r)}})}if(!n)return!1;if(i){let a=t.tr;for(let l=0;l<t.selection.ranges.length;l++){let{$from:{pos:s},$to:{pos:p}}=t.selection.ranges[l];a.setBlockType(s,p,r,e)}i(a.scrollIntoView())}return!0}}function Xs(...r){return function(e,t,i){for(let n=0;n<r.length;n++)if(r[n](e,t,i))return!0;return!1}}Xs(aN,sN,dN),Xs(aN,bN,mN),Xs(gN,uN,xN,PV),typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):typeof os<"u"&&os.platform&&os.platform()=="darwin";function DV(r,e=null){return function(t,i){let{$from:n,$to:a}=t.selection,l=n.blockRange(a);if(!l)return!1;let s=i?t.tr:null;return zV(s,l,r,e)?(i&&i(s.scrollIntoView()),!0):!1}}function zV(r,e,t,i=null){let n=!1,a=e,l=e.$from.doc;if(e.depth>=2&&e.$from.node(e.depth-1).type.compatibleContent(t)&&e.startIndex==0){if(e.$from.index(e.depth-1)==0)return!1;let p=l.resolve(e.start-2);a=new ba(p,p,e.depth),e.endIndex<e.parent.childCount&&(e=new ba(e.$from,l.resolve(e.$to.end(e.depth)),e.depth)),n=!0}let s=js(a,t,i,e);return s?(r&&IV(r,e,s,n,t),!0):!1}function IV(r,e,t,i,n){let a=G.empty;for(let c=t.length-1;c>=0;c--)a=G.from(t[c].type.create(t[c].attrs,a));r.step(new Mt(e.start-(i?2:0),e.end,e.start,e.end,new $(a,0,0),t.length,!0));let l=0;for(let c=0;c<t.length;c++)t[c].type==n&&(l=c+1);let s=t.length-l,p=e.start+t.length-(i?2:0),d=e.parent;for(let c=e.startIndex,b=e.endIndex,m=!0;c<b;c++,m=!1)!m&&mr(r.doc,p,s)&&(r.split(p,s),p+=2*s),p+=d.child(c).nodeSize;return r}function VV(r){return function(e,t){let{$from:i,$to:n}=e.selection,a=i.blockRange(n,l=>l.childCount>0&&l.firstChild.type==r);return a?t?i.node(a.depth-1).type==r?HV(e,t,r,a):RV(e,t,a):!0:!1}}function HV(r,e,t,i){let n=r.tr,a=i.end,l=i.$to.end(i.depth);a<l&&(n.step(new Mt(a-1,l,a,l,new $(G.from(t.create(null,i.parent.copy())),1,0),1,!0)),i=new ba(n.doc.resolve(i.$from.pos),n.doc.resolve(l),i.depth));const s=ti(i);if(s==null)return!1;n.lift(i,s);let p=n.doc.resolve(n.mapping.map(a,-1)-1);return Or(n.doc,p.pos)&&p.nodeBefore.type==p.nodeAfter.type&&n.join(p.pos),e(n.scrollIntoView()),!0}function RV(r,e,t){let i=r.tr,n=t.parent;for(let g=t.end,x=t.endIndex-1,u=t.startIndex;x>u;x--)g-=n.child(x).nodeSize,i.delete(g-1,g+1);let a=i.doc.resolve(t.start),l=a.nodeAfter;if(i.mapping.map(t.end)!=t.start+a.nodeAfter.nodeSize)return!1;let s=t.startIndex==0,p=t.endIndex==n.childCount,d=a.node(-1),c=a.index(-1);if(!d.canReplace(c+(s?0:1),c+1,l.content.append(p?G.empty:G.from(n))))return!1;let b=a.pos,m=b+l.nodeSize;return i.step(new Mt(b-(s?1:0),m+(p?1:0),b+1,m-1,new $((s?G.empty:G.from(n.copy(G.empty))).append(p?G.empty:G.from(n.copy(G.empty))),s?0:1,p?0:1),s?0:1)),e(i.scrollIntoView()),!0}function OV(r){return function(e,t){let{$from:i,$to:n}=e.selection,a=i.blockRange(n,d=>d.childCount>0&&d.firstChild.type==r);if(!a)return!1;let l=a.startIndex;if(l==0)return!1;let s=a.parent,p=s.child(l-1);if(p.type!=r)return!1;if(t){let d=p.lastChild&&p.lastChild.type==s.type,c=G.from(d?r.create():null),b=new $(G.from(r.create(null,G.from(s.type.create(null,c)))),d?3:1,0),m=a.start,g=a.end;t(e.tr.step(new Mt(m-(d?3:1),g,m,g,b,1,!0)).scrollIntoView())}return!0}}const $e=function(r){for(var e=0;;e++)if(r=r.previousSibling,!r)return e},ai=function(r){let e=r.assignedSlot||r.parentNode;return e&&e.nodeType==11?e.host:e};let Zs=null;const ur=function(r,e,t){let i=Zs||(Zs=document.createRange());return i.setEnd(r,t??r.nodeValue.length),i.setStart(r,e||0),i},FV=function(){Zs=null},Mo=function(r,e,t,i){return t&&(wN(r,e,t,i,-1)||wN(r,e,t,i,1))},jV=/^(img|br|input|textarea|hr)$/i;function wN(r,e,t,i,n){for(var a;;){if(r==t&&e==i)return!0;if(e==(n<0?0:Dt(r))){let l=r.parentNode;if(!l||l.nodeType!=1||Zi(r)||jV.test(r.nodeName)||r.contentEditable=="false")return!1;e=$e(r)+(n<0?0:1),r=l}else if(r.nodeType==1){let l=r.childNodes[e+(n<0?-1:0)];if(l.nodeType==1&&l.contentEditable=="false")if(!((a=l.pmViewDesc)===null||a===void 0)&&a.ignoreForSelection)e+=n;else return!1;else r=l,e=n<0?Dt(r):0}else return!1}}function Dt(r){return r.nodeType==3?r.nodeValue.length:r.childNodes.length}function qV(r,e){for(;;){if(r.nodeType==3&&e)return r;if(r.nodeType==1&&e>0){if(r.contentEditable=="false")return null;r=r.childNodes[e-1],e=Dt(r)}else if(r.parentNode&&!Zi(r))e=$e(r),r=r.parentNode;else return null}}function UV(r,e){for(;;){if(r.nodeType==3&&e<r.nodeValue.length)return r;if(r.nodeType==1&&e<r.childNodes.length){if(r.contentEditable=="false")return null;r=r.childNodes[e],e=0}else if(r.parentNode&&!Zi(r))e=$e(r)+1,r=r.parentNode;else return null}}function WV(r,e,t){for(let i=e==0,n=e==Dt(r);i||n;){if(r==t)return!0;let a=$e(r);if(r=r.parentNode,!r)return!1;i=i&&a==0,n=n&&a==Dt(r)}}function Zi(r){let e;for(let t=r;t&&!(e=t.pmViewDesc);t=t.parentNode);return e&&e.node&&e.node.isBlock&&(e.dom==r||e.contentDOM==r)}const Sa=function(r){return r.focusNode&&Mo(r.focusNode,r.focusOffset,r.anchorNode,r.anchorOffset)};function Po(r,e){let t=document.createEvent("Event");return t.initEvent("keydown",!0,!0),t.keyCode=r,t.key=t.code=e,t}function GV(r){let e=r.activeElement;for(;e&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e}function KV(r,e,t){if(r.caretPositionFromPoint)try{let i=r.caretPositionFromPoint(e,t);if(i)return{node:i.offsetNode,offset:Math.min(Dt(i.offsetNode),i.offset)}}catch{}if(r.caretRangeFromPoint){let i=r.caretRangeFromPoint(e,t);if(i)return{node:i.startContainer,offset:Math.min(Dt(i.startContainer),i.startOffset)}}}const rr=typeof navigator<"u"?navigator:null,vN=typeof document<"u"?document:null,Fr=rr&&rr.userAgent||"",$s=/Edge\/(\d+)/.exec(Fr),kN=/MSIE \d/.exec(Fr),ep=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Fr),Pt=!!(kN||ep||$s),jr=kN?document.documentMode:ep?+ep[1]:$s?+$s[1]:0,zt=!Pt&&/gecko\/(\d+)/i.test(Fr);zt&&+(/Firefox\/(\d+)/.exec(Fr)||[0,0])[1];const tp=!Pt&&/Chrome\/(\d+)/.exec(Fr),Ue=!!tp,SN=tp?+tp[1]:0,at=!Pt&&!!rr&&/Apple Computer/.test(rr.vendor),li=at&&(/Mobile\/\w+/.test(Fr)||!!rr&&rr.maxTouchPoints>2),It=li||(rr?/Mac/.test(rr.platform):!1),CN=rr?/Win/.test(rr.platform):!1,xr=/Android \d/.test(Fr),$i=!!vN&&"webkitFontSmoothing"in vN.documentElement.style,JV=$i?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function YV(r){let e=r.defaultView&&r.defaultView.visualViewport;return e?{left:0,right:e.width,top:0,bottom:e.height}:{left:0,right:r.documentElement.clientWidth,top:0,bottom:r.documentElement.clientHeight}}function hr(r,e){return typeof r=="number"?r:r[e]}function QV(r){let e=r.getBoundingClientRect(),t=e.width/r.offsetWidth||1,i=e.height/r.offsetHeight||1;return{left:e.left,right:e.left+r.clientWidth*t,top:e.top,bottom:e.top+r.clientHeight*i}}function TN(r,e,t){let i=r.someProp("scrollThreshold")||0,n=r.someProp("scrollMargin")||5,a=r.dom.ownerDocument;for(let l=t||r.dom;l;){if(l.nodeType!=1){l=ai(l);continue}let s=l,p=s==a.body,d=p?YV(a):QV(s),c=0,b=0;if(e.top<d.top+hr(i,"top")?b=-(d.top-e.top+hr(n,"top")):e.bottom>d.bottom-hr(i,"bottom")&&(b=e.bottom-e.top>d.bottom-d.top?e.top+hr(n,"top")-d.top:e.bottom-d.bottom+hr(n,"bottom")),e.left<d.left+hr(i,"left")?c=-(d.left-e.left+hr(n,"left")):e.right>d.right-hr(i,"right")&&(c=e.right-d.right+hr(n,"right")),c||b)if(p)a.defaultView.scrollBy(c,b);else{let g=s.scrollLeft,x=s.scrollTop;b&&(s.scrollTop+=b),c&&(s.scrollLeft+=c);let u=s.scrollLeft-g,h=s.scrollTop-x;e={left:e.left-u,top:e.top-h,right:e.right-u,bottom:e.bottom-h}}let m=p?"fixed":getComputedStyle(l).position;if(/^(fixed|sticky)$/.test(m))break;l=m=="absolute"?l.offsetParent:ai(l)}}function XV(r){let e=r.dom.getBoundingClientRect(),t=Math.max(0,e.top),i,n;for(let a=(e.left+e.right)/2,l=t+1;l<Math.min(innerHeight,e.bottom);l+=5){let s=r.root.elementFromPoint(a,l);if(!s||s==r.dom||!r.dom.contains(s))continue;let p=s.getBoundingClientRect();if(p.top>=t-20){i=s,n=p.top;break}}return{refDOM:i,refTop:n,stack:EN(r.dom)}}function EN(r){let e=[],t=r.ownerDocument;for(let i=r;i&&(e.push({dom:i,top:i.scrollTop,left:i.scrollLeft}),r!=t);i=ai(i));return e}function ZV({refDOM:r,refTop:e,stack:t}){let i=r?r.getBoundingClientRect().top:0;MN(t,i==0?0:i-e)}function MN(r,e){for(let t=0;t<r.length;t++){let{dom:i,top:n,left:a}=r[t];i.scrollTop!=n+e&&(i.scrollTop=n+e),i.scrollLeft!=a&&(i.scrollLeft=a)}}let si=null;function $V(r){if(r.setActive)return r.setActive();if(si)return r.focus(si);let e=EN(r);r.focus(si==null?{get preventScroll(){return si={preventScroll:!0},!0}}:void 0),si||(si=!1,MN(e,0))}function PN(r,e){let t,i=2e8,n,a=0,l=e.top,s=e.top,p,d;for(let c=r.firstChild,b=0;c;c=c.nextSibling,b++){let m;if(c.nodeType==1)m=c.getClientRects();else if(c.nodeType==3)m=ur(c).getClientRects();else continue;for(let g=0;g<m.length;g++){let x=m[g];if(x.top<=l&&x.bottom>=s){l=Math.max(x.bottom,l),s=Math.min(x.top,s);let u=x.left>e.left?x.left-e.left:x.right<e.left?e.left-x.right:0;if(u<i){t=c,i=u,n=u&&t.nodeType==3?{left:x.right<e.left?x.right:x.left,top:e.top}:e,c.nodeType==1&&u&&(a=b+(e.left>=(x.left+x.right)/2?1:0));continue}}else x.top>e.top&&!p&&x.left<=e.left&&x.right>=e.left&&(p=c,d={left:Math.max(x.left,Math.min(x.right,e.left)),top:x.top});!t&&(e.left>=x.right&&e.top>=x.top||e.left>=x.left&&e.top>=x.bottom)&&(a=b+1)}}return!t&&p&&(t=p,n=d,i=0),t&&t.nodeType==3?eH(t,n):!t||i&&t.nodeType==1?{node:r,offset:a}:PN(t,n)}function eH(r,e){let t=r.nodeValue.length,i=document.createRange(),n;for(let a=0;a<t;a++){i.setEnd(r,a+1),i.setStart(r,a);let l=qr(i,1);if(l.top!=l.bottom&&rp(e,l)){n={node:r,offset:a+(e.left>=(l.left+l.right)/2?1:0)};break}}return i.detach(),n||{node:r,offset:0}}function rp(r,e){return r.left>=e.left-1&&r.left<=e.right+1&&r.top>=e.top-1&&r.top<=e.bottom+1}function tH(r,e){let t=r.parentNode;return t&&/^li$/i.test(t.nodeName)&&e.left<r.getBoundingClientRect().left?t:r}function rH(r,e,t){let{node:i,offset:n}=PN(e,t),a=-1;if(i.nodeType==1&&!i.firstChild){let l=i.getBoundingClientRect();a=l.left!=l.right&&t.left>(l.left+l.right)/2?1:-1}return r.docView.posFromDOM(i,n,a)}function oH(r,e,t,i){let n=-1;for(let a=e,l=!1;a!=r.dom;){let s=r.docView.nearestDesc(a,!0),p;if(!s)return null;if(s.dom.nodeType==1&&(s.node.isBlock&&s.parent||!s.contentDOM)&&((p=s.dom.getBoundingClientRect()).width||p.height)&&(s.node.isBlock&&s.parent&&!/^T(R|BODY|HEAD|FOOT)$/.test(s.dom.nodeName)&&(!l&&p.left>i.left||p.top>i.top?n=s.posBefore:(!l&&p.right<i.left||p.bottom<i.top)&&(n=s.posAfter),l=!0),!s.contentDOM&&n<0&&!s.node.isText))return(s.node.isBlock?i.top<(p.top+p.bottom)/2:i.left<(p.left+p.right)/2)?s.posBefore:s.posAfter;a=s.dom.parentNode}return n>-1?n:r.docView.posFromDOM(e,t,-1)}function BN(r,e,t){let i=r.childNodes.length;if(i&&t.top<t.bottom)for(let n=Math.max(0,Math.min(i-1,Math.floor(i*(e.top-t.top)/(t.bottom-t.top))-2)),a=n;;){let l=r.childNodes[a];if(l.nodeType==1){let s=l.getClientRects();for(let p=0;p<s.length;p++){let d=s[p];if(rp(e,d))return BN(l,e,d)}}if((a=(a+1)%i)==n)break}return r}function iH(r,e){let t=r.dom.ownerDocument,i,n=0,a=KV(t,e.left,e.top);a&&({node:i,offset:n}=a);let l=(r.root.elementFromPoint?r.root:t).elementFromPoint(e.left,e.top),s;if(!l||!r.dom.contains(l.nodeType!=1?l.parentNode:l)){let d=r.dom.getBoundingClientRect();if(!rp(e,d)||(l=BN(r.dom,e,d),!l))return null}if(at)for(let d=l;i&&d;d=ai(d))d.draggable&&(i=void 0);if(l=tH(l,e),i){if(zt&&i.nodeType==1&&(n=Math.min(n,i.childNodes.length),n<i.childNodes.length)){let c=i.childNodes[n],b;c.nodeName=="IMG"&&(b=c.getBoundingClientRect()).right<=e.left&&b.bottom>e.top&&n++}let d;$i&&n&&i.nodeType==1&&(d=i.childNodes[n-1]).nodeType==1&&d.contentEditable=="false"&&d.getBoundingClientRect().top>=e.top&&n--,i==r.dom&&n==i.childNodes.length-1&&i.lastChild.nodeType==1&&e.top>i.lastChild.getBoundingClientRect().bottom?s=r.state.doc.content.size:(n==0||i.nodeType!=1||i.childNodes[n-1].nodeName!="BR")&&(s=oH(r,i,n,e))}s==null&&(s=rH(r,l,e));let p=r.docView.nearestDesc(l,!0);return{pos:s,inside:p?p.posAtStart-p.border:-1}}function LN(r){return r.top<r.bottom||r.left<r.right}function qr(r,e){let t=r.getClientRects();if(t.length){let i=t[e<0?0:t.length-1];if(LN(i))return i}return Array.prototype.find.call(t,LN)||r.getBoundingClientRect()}const nH=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function NN(r,e,t){let{node:i,offset:n,atom:a}=r.docView.domFromPos(e,t<0?-1:1),l=$i||zt;if(i.nodeType==3)if(l&&(nH.test(i.nodeValue)||(t<0?!n:n==i.nodeValue.length))){let p=qr(ur(i,n,n),t);if(zt&&n&&/\s/.test(i.nodeValue[n-1])&&n<i.nodeValue.length){let d=qr(ur(i,n-1,n-1),-1);if(d.top==p.top){let c=qr(ur(i,n,n+1),-1);if(c.top!=p.top)return en(c,c.left<d.left)}}return p}else{let p=n,d=n,c=t<0?1:-1;return t<0&&!n?(d++,c=-1):t>=0&&n==i.nodeValue.length?(p--,c=1):t<0?p--:d++,en(qr(ur(i,p,d),c),c<0)}if(!r.state.doc.resolve(e-(a||0)).parent.inlineContent){if(a==null&&n&&(t<0||n==Dt(i))){let p=i.childNodes[n-1];if(p.nodeType==1)return op(p.getBoundingClientRect(),!1)}if(a==null&&n<Dt(i)){let p=i.childNodes[n];if(p.nodeType==1)return op(p.getBoundingClientRect(),!0)}return op(i.getBoundingClientRect(),t>=0)}if(a==null&&n&&(t<0||n==Dt(i))){let p=i.childNodes[n-1],d=p.nodeType==3?ur(p,Dt(p)-(l?0:1)):p.nodeType==1&&(p.nodeName!="BR"||!p.nextSibling)?p:null;if(d)return en(qr(d,1),!1)}if(a==null&&n<Dt(i)){let p=i.childNodes[n];for(;p.pmViewDesc&&p.pmViewDesc.ignoreForCoords;)p=p.nextSibling;let d=p?p.nodeType==3?ur(p,0,l?0:1):p.nodeType==1?p:null:null;if(d)return en(qr(d,-1),!0)}return en(qr(i.nodeType==3?ur(i):i,-t),t>=0)}function en(r,e){if(r.width==0)return r;let t=e?r.left:r.right;return{top:r.top,bottom:r.bottom,left:t,right:t}}function op(r,e){if(r.height==0)return r;let t=e?r.top:r.bottom;return{top:t,bottom:t,left:r.left,right:r.right}}function AN(r,e,t){let i=r.state,n=r.root.activeElement;i!=e&&r.updateState(e),n!=r.dom&&r.focus();try{return t()}finally{i!=e&&r.updateState(i),n!=r.dom&&n&&n.focus()}}function aH(r,e,t){let i=e.selection,n=t=="up"?i.$from:i.$to;return AN(r,e,()=>{let{node:a}=r.docView.domFromPos(n.pos,t=="up"?-1:1);for(;;){let s=r.docView.nearestDesc(a,!0);if(!s)break;if(s.node.isBlock){a=s.contentDOM||s.dom;break}a=s.dom.parentNode}let l=NN(r,n.pos,1);for(let s=a.firstChild;s;s=s.nextSibling){let p;if(s.nodeType==1)p=s.getClientRects();else if(s.nodeType==3)p=ur(s,0,s.nodeValue.length).getClientRects();else continue;for(let d=0;d<p.length;d++){let c=p[d];if(c.bottom>c.top+1&&(t=="up"?l.top-c.top>(c.bottom-l.top)*2:c.bottom-l.bottom>(l.bottom-c.top)*2))return!1}}return!0})}const lH=/[\u0590-\u08ac]/;function sH(r,e,t){let{$head:i}=e.selection;if(!i.parent.isTextblock)return!1;let n=i.parentOffset,a=!n,l=n==i.parent.content.size,s=r.domSelection();return s?!lH.test(i.parent.textContent)||!s.modify?t=="left"||t=="backward"?a:l:AN(r,e,()=>{let{focusNode:p,focusOffset:d,anchorNode:c,anchorOffset:b}=r.domSelectionRange(),m=s.caretBidiLevel;s.modify("move",t,"character");let g=i.depth?r.docView.domAfterPos(i.before()):r.dom,{focusNode:x,focusOffset:u}=r.domSelectionRange(),h=x&&!g.contains(x.nodeType==1?x:x.parentNode)||p==x&&d==u;try{s.collapse(c,b),p&&(p!=c||d!=b)&&s.extend&&s.extend(p,d)}catch{}return m!=null&&(s.caretBidiLevel=m),h}):i.pos==i.start()||i.pos==i.end()}let _N=null,DN=null,zN=!1;function pH(r,e,t){return _N==e&&DN==t?zN:(_N=e,DN=t,zN=t=="up"||t=="down"?aH(r,e,t):sH(r,e,t))}const Vt=0,IN=1,Bo=2,qt=3;class tn{constructor(e,t,i,n){this.parent=e,this.children=t,this.dom=i,this.contentDOM=n,this.dirty=Vt,i.pmViewDesc=this}matchesWidget(e){return!1}matchesMark(e){return!1}matchesNode(e,t,i){return!1}matchesHack(e){return!1}parseRule(){return null}stopEvent(e){return!1}get size(){let e=0;for(let t=0;t<this.children.length;t++)e+=this.children[t].size;return e}get border(){return 0}destroy(){this.parent=void 0,this.dom.pmViewDesc==this&&(this.dom.pmViewDesc=void 0);for(let e=0;e<this.children.length;e++)this.children[e].destroy()}posBeforeChild(e){for(let t=0,i=this.posAtStart;;t++){let n=this.children[t];if(n==e)return i;i+=n.size}}get posBefore(){return this.parent.posBeforeChild(this)}get posAtStart(){return this.parent?this.parent.posBeforeChild(this)+this.border:0}get posAfter(){return this.posBefore+this.size}get posAtEnd(){return this.posAtStart+this.size-2*this.border}localPosFromDOM(e,t,i){if(this.contentDOM&&this.contentDOM.contains(e.nodeType==1?e:e.parentNode))if(i<0){let a,l;if(e==this.contentDOM)a=e.childNodes[t-1];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;a=e.previousSibling}for(;a&&!((l=a.pmViewDesc)&&l.parent==this);)a=a.previousSibling;return a?this.posBeforeChild(l)+l.size:this.posAtStart}else{let a,l;if(e==this.contentDOM)a=e.childNodes[t];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;a=e.nextSibling}for(;a&&!((l=a.pmViewDesc)&&l.parent==this);)a=a.nextSibling;return a?this.posBeforeChild(l):this.posAtEnd}let n;if(e==this.dom&&this.contentDOM)n=t>$e(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))n=e.compareDocumentPosition(this.contentDOM)&2;else if(this.dom.firstChild){if(t==0)for(let a=e;;a=a.parentNode){if(a==this.dom){n=!1;break}if(a.previousSibling)break}if(n==null&&t==e.childNodes.length)for(let a=e;;a=a.parentNode){if(a==this.dom){n=!0;break}if(a.nextSibling)break}}return n??i>0?this.posAtEnd:this.posAtStart}nearestDesc(e,t=!1){for(let i=!0,n=e;n;n=n.parentNode){let a=this.getDesc(n),l;if(a&&(!t||a.node))if(i&&(l=a.nodeDOM)&&!(l.nodeType==1?l.contains(e.nodeType==1?e:e.parentNode):l==e))i=!1;else return a}}getDesc(e){let t=e.pmViewDesc;for(let i=t;i;i=i.parent)if(i==this)return t}posFromDOM(e,t,i){for(let n=e;n;n=n.parentNode){let a=this.getDesc(n);if(a)return a.localPosFromDOM(e,t,i)}return-1}descAt(e){for(let t=0,i=0;t<this.children.length;t++){let n=this.children[t],a=i+n.size;if(i==e&&a!=i){for(;!n.border&&n.children.length;)for(let l=0;l<n.children.length;l++){let s=n.children[l];if(s.size){n=s;break}}return n}if(e<a)return n.descAt(e-i-n.border);i=a}}domFromPos(e,t){if(!this.contentDOM)return{node:this.dom,offset:0,atom:e+1};let i=0,n=0;for(let a=0;i<this.children.length;i++){let l=this.children[i],s=a+l.size;if(s>e||l instanceof RN){n=e-a;break}a=s}if(n)return this.children[i].domFromPos(n-this.children[i].border,t);for(let a;i&&!(a=this.children[i-1]).size&&a instanceof VN&&a.side>=0;i--);if(t<=0){let a,l=!0;for(;a=i?this.children[i-1]:null,!(!a||a.dom.parentNode==this.contentDOM);i--,l=!1);return a&&t&&l&&!a.border&&!a.domAtom?a.domFromPos(a.size,t):{node:this.contentDOM,offset:a?$e(a.dom)+1:0}}else{let a,l=!0;for(;a=i<this.children.length?this.children[i]:null,!(!a||a.dom.parentNode==this.contentDOM);i++,l=!1);return a&&l&&!a.border&&!a.domAtom?a.domFromPos(0,t):{node:this.contentDOM,offset:a?$e(a.dom):this.contentDOM.childNodes.length}}}parseRange(e,t,i=0){if(this.children.length==0)return{node:this.contentDOM,from:e,to:t,fromOffset:0,toOffset:this.contentDOM.childNodes.length};let n=-1,a=-1;for(let l=i,s=0;;s++){let p=this.children[s],d=l+p.size;if(n==-1&&e<=d){let c=l+p.border;if(e>=c&&t<=d-p.border&&p.node&&p.contentDOM&&this.contentDOM.contains(p.contentDOM))return p.parseRange(e,t,c);e=l;for(let b=s;b>0;b--){let m=this.children[b-1];if(m.size&&m.dom.parentNode==this.contentDOM&&!m.emptyChildAt(1)){n=$e(m.dom)+1;break}e-=m.size}n==-1&&(n=0)}if(n>-1&&(d>t||s==this.children.length-1)){t=d;for(let c=s+1;c<this.children.length;c++){let b=this.children[c];if(b.size&&b.dom.parentNode==this.contentDOM&&!b.emptyChildAt(-1)){a=$e(b.dom);break}t+=b.size}a==-1&&(a=this.contentDOM.childNodes.length);break}l=d}return{node:this.contentDOM,from:e,to:t,fromOffset:n,toOffset:a}}emptyChildAt(e){if(this.border||!this.contentDOM||!this.children.length)return!1;let t=this.children[e<0?0:this.children.length-1];return t.size==0||t.emptyChildAt(e)}domAfterPos(e){let{node:t,offset:i}=this.domFromPos(e,0);if(t.nodeType!=1||i==t.childNodes.length)throw new RangeError("No node after pos "+e);return t.childNodes[i]}setSelection(e,t,i,n=!1){let a=Math.min(e,t),l=Math.max(e,t);for(let g=0,x=0;g<this.children.length;g++){let u=this.children[g],h=x+u.size;if(a>x&&l<h)return u.setSelection(e-x-u.border,t-x-u.border,i,n);x=h}let s=this.domFromPos(e,e?-1:1),p=t==e?s:this.domFromPos(t,t?-1:1),d=i.root.getSelection(),c=i.domSelectionRange(),b=!1;if((zt||at)&&e==t){let{node:g,offset:x}=s;if(g.nodeType==3){if(b=!!(x&&g.nodeValue[x-1]==`
21
21
  `),b&&x==g.nodeValue.length)for(let u=g,h;u;u=u.parentNode){if(h=u.nextSibling){h.nodeName=="BR"&&(s=p={node:h.parentNode,offset:$e(h)+1});break}let f=u.pmViewDesc;if(f&&f.node&&f.node.isBlock)break}}else{let u=g.childNodes[x-1];b=u&&(u.nodeName=="BR"||u.contentEditable=="false")}}if(zt&&c.focusNode&&c.focusNode!=p.node&&c.focusNode.nodeType==1){let g=c.focusNode.childNodes[c.focusOffset];g&&g.contentEditable=="false"&&(n=!0)}if(!(n||b&&at)&&Mo(s.node,s.offset,c.anchorNode,c.anchorOffset)&&Mo(p.node,p.offset,c.focusNode,c.focusOffset))return;let m=!1;if((d.extend||e==t)&&!(b&&zt)){d.collapse(s.node,s.offset);try{e!=t&&d.extend(p.node,p.offset),m=!0}catch{}}if(!m){if(e>t){let x=s;s=p,p=x}let g=document.createRange();g.setEnd(p.node,p.offset),g.setStart(s.node,s.offset),d.removeAllRanges(),d.addRange(g)}}ignoreMutation(e){return!this.contentDOM&&e.type!="selection"}get contentLost(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}markDirty(e,t){for(let i=0,n=0;n<this.children.length;n++){let a=this.children[n],l=i+a.size;if(i==l?e<=l&&t>=i:e<l&&t>i){let s=i+a.border,p=l-a.border;if(e>=s&&t<=p){this.dirty=e==i||t==l?Bo:IN,e==s&&t==p&&(a.contentLost||a.dom.parentNode!=this.contentDOM)?a.dirty=qt:a.markDirty(e-s,t-s);return}else a.dirty=a.dom==a.contentDOM&&a.dom.parentNode==this.contentDOM&&!a.children.length?Bo:qt}i=l}this.dirty=Bo}markParentsDirty(){let e=1;for(let t=this.parent;t;t=t.parent,e++){let i=e==1?Bo:IN;t.dirty<i&&(t.dirty=i)}}get domAtom(){return!1}get ignoreForCoords(){return!1}get ignoreForSelection(){return!1}isText(e){return!1}}class VN extends tn{constructor(e,t,i,n){let a,l=t.type.toDOM;if(typeof l=="function"&&(l=l(i,()=>{if(!a)return n;if(a.parent)return a.parent.posBeforeChild(a)})),!t.type.spec.raw){if(l.nodeType!=1){let s=document.createElement("span");s.appendChild(l),l=s}l.contentEditable="false",l.classList.add("ProseMirror-widget")}super(e,[],l,null),this.widget=t,this.widget=t,a=this}matchesWidget(e){return this.dirty==Vt&&e.type.eq(this.widget.type)}parseRule(){return{ignore:!0}}stopEvent(e){let t=this.widget.spec.stopEvent;return t?t(e):!1}ignoreMutation(e){return e.type!="selection"||this.widget.spec.ignoreSelection}destroy(){this.widget.type.destroy(this.dom),super.destroy()}get domAtom(){return!0}get ignoreForSelection(){return!!this.widget.type.spec.relaxedSide}get side(){return this.widget.type.side}}class dH extends tn{constructor(e,t,i,n){super(e,[],t,null),this.textDOM=i,this.text=n}get size(){return this.text.length}localPosFromDOM(e,t){return e!=this.textDOM?this.posAtStart+(t?this.size:0):this.posAtStart+t}domFromPos(e){return{node:this.textDOM,offset:e}}ignoreMutation(e){return e.type==="characterData"&&e.target.nodeValue==e.oldValue}}class Ur extends tn{constructor(e,t,i,n,a){super(e,[],i,n),this.mark=t,this.spec=a}static create(e,t,i,n){let a=n.nodeViews[t.type.name],l=a&&a(t,n,i);return(!l||!l.dom)&&(l=To.renderSpec(document,t.type.spec.toDOM(t,i),null,t.attrs)),new Ur(e,t,l.dom,l.contentDOM||l.dom,l)}parseRule(){return this.dirty&qt||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return this.dirty!=qt&&this.mark.eq(e)}markDirty(e,t){if(super.markDirty(e,t),this.dirty!=Vt){let i=this.parent;for(;!i.node;)i=i.parent;i.dirty<this.dirty&&(i.dirty=this.dirty),this.dirty=Vt}}slice(e,t,i){let n=Ur.create(this.parent,this.mark,!0,i),a=this.children,l=this.size;t<l&&(a=np(a,t,l,i)),e>0&&(a=np(a,0,e,i));for(let s=0;s<a.length;s++)a[s].parent=n;return n.children=a,n}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}}class Wr extends tn{constructor(e,t,i,n,a,l,s){super(e,[],a,l),this.node=t,this.outerDeco=i,this.innerDeco=n,this.nodeDOM=s}static create(e,t,i,n,a,l){let s=a.nodeViews[t.type.name],p,d=s&&s(t,a,()=>{if(!p)return l;if(p.parent)return p.parent.posBeforeChild(p)},i,n),c=d&&d.dom,b=d&&d.contentDOM;if(t.isText){if(!c)c=document.createTextNode(t.text);else if(c.nodeType!=3)throw new RangeError("Text must be rendered as a DOM text node")}else c||({dom:c,contentDOM:b}=To.renderSpec(document,t.type.spec.toDOM(t),null,t.attrs));!b&&!t.isText&&c.nodeName!="BR"&&(c.hasAttribute("contenteditable")||(c.contentEditable="false"),t.type.spec.draggable&&(c.draggable=!0));let m=c;return c=jN(c,i,t),d?p=new cH(e,t,i,n,c,b||null,m,d):t.isText?new Ca(e,t,i,n,c,m):new Wr(e,t,i,n,c,b||null,m)}parseRule(){if(this.node.type.spec.reparseInView)return null;let e={node:this.node.type.name,attrs:this.node.attrs};if(this.node.type.whitespace=="pre"&&(e.preserveWhitespace="full"),!this.contentDOM)e.getContent=()=>this.node.content;else if(!this.contentLost)e.contentElement=this.contentDOM;else{for(let t=this.children.length-1;t>=0;t--){let i=this.children[t];if(this.dom.contains(i.dom.parentNode)){e.contentElement=i.dom.parentNode;break}}e.contentElement||(e.getContent=()=>G.empty)}return e}matchesNode(e,t,i){return this.dirty==Vt&&e.eq(this.node)&&Ta(t,this.outerDeco)&&i.eq(this.innerDeco)}get size(){return this.node.nodeSize}get border(){return this.node.isLeaf?0:1}updateChildren(e,t){let i=this.node.inlineContent,n=t,a=e.composing?this.localCompositionInfo(e,t):null,l=a&&a.pos>-1?a:null,s=a&&a.pos<0,p=new mH(this,l&&l.node,e);xH(this.node,this.innerDeco,(d,c,b)=>{d.spec.marks?p.syncToMarks(d.spec.marks,i,e,c):d.type.side>=0&&!b&&p.syncToMarks(c==this.node.childCount?ve.none:this.node.child(c).marks,i,e,c),p.placeWidget(d,e,n)},(d,c,b,m)=>{p.syncToMarks(d.marks,i,e,m);let g;p.findNodeMatch(d,c,b,m)||s&&e.state.selection.from>n&&e.state.selection.to<n+d.nodeSize&&(g=p.findIndexWithChild(a.node))>-1&&p.updateNodeAt(d,c,b,g,e)||p.updateNextNode(d,c,b,e,m,n)||p.addNode(d,c,b,e,n),n+=d.nodeSize}),p.syncToMarks([],i,e,0),this.node.isTextblock&&p.addTextblockHacks(),p.destroyRest(),(p.changed||this.dirty==Bo)&&(l&&this.protectLocalComposition(e,l),ON(this.contentDOM,this.children,e),li&&hH(this.dom))}localCompositionInfo(e,t){let{from:i,to:n}=e.state.selection;if(!(e.state.selection instanceof pe)||i<t||n>t+this.node.content.size)return null;let a=e.input.compositionNode;if(!a||!this.dom.contains(a.parentNode))return null;if(this.node.inlineContent){let l=a.nodeValue,s=fH(this.node.content,l,i-t,n-t);return s<0?null:{node:a,pos:s,text:l}}else return{node:a,pos:-1,text:""}}protectLocalComposition(e,{node:t,pos:i,text:n}){if(this.getDesc(t))return;let a=t;for(;a.parentNode!=this.contentDOM;a=a.parentNode){for(;a.previousSibling;)a.parentNode.removeChild(a.previousSibling);for(;a.nextSibling;)a.parentNode.removeChild(a.nextSibling);a.pmViewDesc&&(a.pmViewDesc=void 0)}let l=new dH(this,a,t,n);e.input.compositionNodes.push(l),this.children=np(this.children,i,i+n.length,e,l)}update(e,t,i,n){return this.dirty==qt||!e.sameMarkup(this.node)?!1:(this.updateInner(e,t,i,n),!0)}updateInner(e,t,i,n){this.updateOuterDeco(t),this.node=e,this.innerDeco=i,this.contentDOM&&this.updateChildren(n,this.posAtStart),this.dirty=Vt}updateOuterDeco(e){if(Ta(e,this.outerDeco))return;let t=this.nodeDOM.nodeType!=1,i=this.dom;this.dom=FN(this.dom,this.nodeDOM,ip(this.outerDeco,this.node,t),ip(e,this.node,t)),this.dom!=i&&(i.pmViewDesc=void 0,this.dom.pmViewDesc=this),this.outerDeco=e}selectNode(){this.nodeDOM.nodeType==1&&(this.nodeDOM.classList.add("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&(this.nodeDOM.draggable=!0))}deselectNode(){this.nodeDOM.nodeType==1&&(this.nodeDOM.classList.remove("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&this.nodeDOM.removeAttribute("draggable"))}get domAtom(){return this.node.isAtom}}function HN(r,e,t,i,n){jN(i,e,r);let a=new Wr(void 0,r,e,t,i,i,i);return a.contentDOM&&a.updateChildren(n,0),a}class Ca extends Wr{constructor(e,t,i,n,a,l){super(e,t,i,n,a,null,l)}parseRule(){let e=this.nodeDOM.parentNode;for(;e&&e!=this.dom&&!e.pmIsDeco;)e=e.parentNode;return{skip:e||!0}}update(e,t,i,n){return this.dirty==qt||this.dirty!=Vt&&!this.inParent()||!e.sameMarkup(this.node)?!1:(this.updateOuterDeco(t),(this.dirty!=Vt||e.text!=this.node.text)&&e.text!=this.nodeDOM.nodeValue&&(this.nodeDOM.nodeValue=e.text,n.trackWrites==this.nodeDOM&&(n.trackWrites=null)),this.node=e,this.dirty=Vt,!0)}inParent(){let e=this.parent.contentDOM;for(let t=this.nodeDOM;t;t=t.parentNode)if(t==e)return!0;return!1}domFromPos(e){return{node:this.nodeDOM,offset:e}}localPosFromDOM(e,t,i){return e==this.nodeDOM?this.posAtStart+Math.min(t,this.node.text.length):super.localPosFromDOM(e,t,i)}ignoreMutation(e){return e.type!="characterData"&&e.type!="selection"}slice(e,t,i){let n=this.node.cut(e,t),a=document.createTextNode(n.text);return new Ca(this.parent,n,this.outerDeco,this.innerDeco,a,a)}markDirty(e,t){super.markDirty(e,t),this.dom!=this.nodeDOM&&(e==0||t==this.nodeDOM.nodeValue.length)&&(this.dirty=qt)}get domAtom(){return!1}isText(e){return this.node.text==e}}class RN extends tn{parseRule(){return{ignore:!0}}matchesHack(e){return this.dirty==Vt&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}}class cH extends Wr{constructor(e,t,i,n,a,l,s,p){super(e,t,i,n,a,l,s),this.spec=p}update(e,t,i,n){if(this.dirty==qt)return!1;if(this.spec.update&&(this.node.type==e.type||this.spec.multiType)){let a=this.spec.update(e,t,i);return a&&this.updateInner(e,t,i,n),a}else return!this.contentDOM&&!e.isLeaf?!1:super.update(e,t,i,n)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(e,t,i,n){this.spec.setSelection?this.spec.setSelection(e,t,i.root):super.setSelection(e,t,i,n)}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 ON(r,e,t){let i=r.firstChild,n=!1;for(let a=0;a<e.length;a++){let l=e[a],s=l.dom;if(s.parentNode==r){for(;s!=i;)i=qN(i),n=!0;i=i.nextSibling}else n=!0,r.insertBefore(s,i);if(l instanceof Ur){let p=i?i.previousSibling:r.lastChild;ON(l.contentDOM,l.children,t),i=p?p.nextSibling:r.firstChild}}for(;i;)i=qN(i),n=!0;n&&t.trackWrites==r&&(t.trackWrites=null)}const rn=function(r){r&&(this.nodeName=r)};rn.prototype=Object.create(null);const Lo=[new rn];function ip(r,e,t){if(r.length==0)return Lo;let i=t?Lo[0]:new rn,n=[i];for(let a=0;a<r.length;a++){let l=r[a].type.attrs;if(l){l.nodeName&&n.push(i=new rn(l.nodeName));for(let s in l){let p=l[s];p!=null&&(t&&n.length==1&&n.push(i=new rn(e.isInline?"span":"div")),s=="class"?i.class=(i.class?i.class+" ":"")+p:s=="style"?i.style=(i.style?i.style+";":"")+p:s!="nodeName"&&(i[s]=p))}}}return n}function FN(r,e,t,i){if(t==Lo&&i==Lo)return e;let n=e;for(let a=0;a<i.length;a++){let l=i[a],s=t[a];if(a){let p;s&&s.nodeName==l.nodeName&&n!=r&&(p=n.parentNode)&&p.nodeName.toLowerCase()==l.nodeName||(p=document.createElement(l.nodeName),p.pmIsDeco=!0,p.appendChild(n),s=Lo[0]),n=p}bH(n,s||Lo[0],l)}return n}function bH(r,e,t){for(let i in e)i!="class"&&i!="style"&&i!="nodeName"&&!(i in t)&&r.removeAttribute(i);for(let i in t)i!="class"&&i!="style"&&i!="nodeName"&&t[i]!=e[i]&&r.setAttribute(i,t[i]);if(e.class!=t.class){let i=e.class?e.class.split(" ").filter(Boolean):[],n=t.class?t.class.split(" ").filter(Boolean):[];for(let a=0;a<i.length;a++)n.indexOf(i[a])==-1&&r.classList.remove(i[a]);for(let a=0;a<n.length;a++)i.indexOf(n[a])==-1&&r.classList.add(n[a]);r.classList.length==0&&r.removeAttribute("class")}if(e.style!=t.style){if(e.style){let i=/\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g,n;for(;n=i.exec(e.style);)r.style.removeProperty(n[1])}t.style&&(r.style.cssText+=t.style)}}function jN(r,e,t){return FN(r,r,Lo,ip(e,t,r.nodeType!=1))}function Ta(r,e){if(r.length!=e.length)return!1;for(let t=0;t<r.length;t++)if(!r[t].type.eq(e[t].type))return!1;return!0}function qN(r){let e=r.nextSibling;return r.parentNode.removeChild(r),e}class mH{constructor(e,t,i){this.lock=t,this.view=i,this.index=0,this.stack=[],this.changed=!1,this.top=e,this.preMatch=gH(e.node.content,e)}destroyBetween(e,t){if(e!=t){for(let i=e;i<t;i++)this.top.children[i].destroy();this.top.children.splice(e,t-e),this.changed=!0}}destroyRest(){this.destroyBetween(this.index,this.top.children.length)}syncToMarks(e,t,i,n){let a=0,l=this.stack.length>>1,s=Math.min(l,e.length);for(;a<s&&(a==l-1?this.top:this.stack[a+1<<1]).matchesMark(e[a])&&e[a].type.spec.spanning!==!1;)a++;for(;a<l;)this.destroyRest(),this.top.dirty=Vt,this.index=this.stack.pop(),this.top=this.stack.pop(),l--;for(;l<e.length;){this.stack.push(this.top,this.index+1);let p=-1,d=this.top.children.length;n<this.preMatch.index&&(d=Math.min(this.index+3,d));for(let c=this.index;c<d;c++){let b=this.top.children[c];if(b.matchesMark(e[l])&&!this.isLocked(b.dom)){p=c;break}}if(p<0&&this.index<this.top.children.length){let c=this.top.children[this.index];c instanceof Ur&&c.dirty!=qt&&c.mark.type==e[l].type&&c.spec.update&&!this.isLocked(c.dom)&&c.spec.update(e[l])&&(c.mark=e[l],p=this.index,this.changed=!0)}if(p>-1)p>this.index&&(this.changed=!0,this.destroyBetween(this.index,p)),this.top=this.top.children[this.index];else{let c=Ur.create(this.top,e[l],t,i);this.top.children.splice(this.index,0,c),this.top=c,this.changed=!0}this.index=0,l++}}findNodeMatch(e,t,i,n){let a=-1,l;if(n>=this.preMatch.index&&(l=this.preMatch.matches[n-this.preMatch.index]).parent==this.top&&l.matchesNode(e,t,i))a=this.top.children.indexOf(l,this.index);else for(let s=this.index,p=Math.min(this.top.children.length,s+5);s<p;s++){let d=this.top.children[s];if(d.matchesNode(e,t,i)&&!this.preMatch.matched.has(d)){a=s;break}}return a<0?!1:(this.destroyBetween(this.index,a),this.index++,!0)}updateNodeAt(e,t,i,n,a){let l=this.top.children[n];return l.dirty==qt&&l.dom==l.contentDOM&&(l.dirty=Bo),l.update(e,t,i,a)?(this.destroyBetween(this.index,n),this.index++,!0):!1}findIndexWithChild(e){for(;;){let t=e.parentNode;if(!t)return-1;if(t==this.top.contentDOM){let i=e.pmViewDesc;if(i){for(let n=this.index;n<this.top.children.length;n++)if(this.top.children[n]==i)return n}return-1}e=t}}updateNextNode(e,t,i,n,a,l){for(let s=this.index;s<this.top.children.length;s++){let p=this.top.children[s];if(p instanceof Wr){let d=this.preMatch.matched.get(p);if(d!=null&&d!=a)return!1;let c=p.dom,b,m=this.isLocked(c)&&!(e.isText&&p.node&&p.node.isText&&p.nodeDOM.nodeValue==e.text&&p.dirty!=qt&&Ta(t,p.outerDeco));if(!m&&p.update(e,t,i,n))return this.destroyBetween(this.index,s),p.dom!=c&&(this.changed=!0),this.index++,!0;if(!m&&(b=this.recreateWrapper(p,e,t,i,n,l)))return this.destroyBetween(this.index,s),this.top.children[this.index]=b,b.contentDOM&&(b.dirty=Bo,b.updateChildren(n,l+1),b.dirty=Vt),this.changed=!0,this.index++,!0;break}}return!1}recreateWrapper(e,t,i,n,a,l){if(e.dirty||t.isAtom||!e.children.length||!e.node.content.eq(t.content)||!Ta(i,e.outerDeco)||!n.eq(e.innerDeco))return null;let s=Wr.create(this.top,t,i,n,a,l);if(s.contentDOM){s.children=e.children,e.children=[];for(let p of s.children)p.parent=s}return e.destroy(),s}addNode(e,t,i,n,a){let l=Wr.create(this.top,e,t,i,n,a);l.contentDOM&&l.updateChildren(n,a+1),this.top.children.splice(this.index++,0,l),this.changed=!0}placeWidget(e,t,i){let n=this.index<this.top.children.length?this.top.children[this.index]:null;if(n&&n.matchesWidget(e)&&(e==n.widget||!n.widget.type.toDOM.parentNode))this.index++;else{let a=new VN(this.top,e,t,i);this.top.children.splice(this.index++,0,a),this.changed=!0}}addTextblockHacks(){let e=this.top.children[this.index-1],t=this.top;for(;e instanceof Ur;)t=e,e=t.children[t.children.length-1];(!e||!(e instanceof Ca)||/\n$/.test(e.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(e.node.text))&&((at||Ue)&&e&&e.dom.contentEditable=="false"&&this.addHackNode("IMG",t),this.addHackNode("BR",this.top))}addHackNode(e,t){if(t==this.top&&this.index<t.children.length&&t.children[this.index].matchesHack(e))this.index++;else{let i=document.createElement(e);e=="IMG"&&(i.className="ProseMirror-separator",i.alt=""),e=="BR"&&(i.className="ProseMirror-trailingBreak");let n=new RN(this.top,[],i,null);t!=this.top?t.children.push(n):t.children.splice(this.index++,0,n),this.changed=!0}}isLocked(e){return this.lock&&(e==this.lock||e.nodeType==1&&e.contains(this.lock.parentNode))}}function gH(r,e){let t=e,i=t.children.length,n=r.childCount,a=new Map,l=[];e:for(;n>0;){let s;for(;;)if(i){let d=t.children[i-1];if(d instanceof Ur)t=d,i=d.children.length;else{s=d,i--;break}}else{if(t==e)break e;i=t.parent.children.indexOf(t),t=t.parent}let p=s.node;if(p){if(p!=r.child(n-1))break;--n,a.set(s,n),l.push(s)}}return{index:n,matched:a,matches:l.reverse()}}function uH(r,e){return r.type.side-e.type.side}function xH(r,e,t,i){let n=e.locals(r),a=0;if(n.length==0){for(let d=0;d<r.childCount;d++){let c=r.child(d);i(c,n,e.forChild(a,c),d),a+=c.nodeSize}return}let l=0,s=[],p=null;for(let d=0;;){let c,b;for(;l<n.length&&n[l].to==a;){let h=n[l++];h.widget&&(c?(b||(b=[c])).push(h):c=h)}if(c)if(b){b.sort(uH);for(let h=0;h<b.length;h++)t(b[h],d,!!p)}else t(c,d,!!p);let m,g;if(p)g=-1,m=p,p=null;else if(d<r.childCount)g=d,m=r.child(d++);else break;for(let h=0;h<s.length;h++)s[h].to<=a&&s.splice(h--,1);for(;l<n.length&&n[l].from<=a&&n[l].to>a;)s.push(n[l++]);let x=a+m.nodeSize;if(m.isText){let h=x;l<n.length&&n[l].from<h&&(h=n[l].from);for(let f=0;f<s.length;f++)s[f].to<h&&(h=s[f].to);h<x&&(p=m.cut(h-a),m=m.cut(0,h-a),x=h,g=-1)}else for(;l<n.length&&n[l].to<x;)l++;let u=m.isInline&&!m.isLeaf?s.filter(h=>!h.inline):s.slice();i(m,u,e.forChild(a,m),g),a=x}}function hH(r){if(r.nodeName=="UL"||r.nodeName=="OL"){let e=r.style.cssText;r.style.cssText=e+"; list-style: square !important",window.getComputedStyle(r).listStyle,r.style.cssText=e}}function fH(r,e,t,i){for(let n=0,a=0;n<r.childCount&&a<=i;){let l=r.child(n++),s=a;if(a+=l.nodeSize,!l.isText)continue;let p=l.text;for(;n<r.childCount;){let d=r.child(n++);if(a+=d.nodeSize,!d.isText)break;p+=d.text}if(a>=t){if(a>=i&&p.slice(i-e.length-s,i-s)==e)return i-e.length;let d=s<i?p.lastIndexOf(e,i-s-1):-1;if(d>=0&&d+e.length+s>=t)return s+d;if(t==i&&p.length>=i+e.length-s&&p.slice(i-s,i-s+e.length)==e)return i}}return-1}function np(r,e,t,i,n){let a=[];for(let l=0,s=0;l<r.length;l++){let p=r[l],d=s,c=s+=p.size;d>=t||c<=e?a.push(p):(d<e&&a.push(p.slice(0,e-d,i)),n&&(a.push(n),n=void 0),c>t&&a.push(p.slice(t-d,p.size,i)))}return a}function ap(r,e=null){let t=r.domSelectionRange(),i=r.state.doc;if(!t.focusNode)return null;let n=r.docView.nearestDesc(t.focusNode),a=n&&n.size==0,l=r.docView.posFromDOM(t.focusNode,t.focusOffset,1);if(l<0)return null;let s=i.resolve(l),p,d;if(Sa(t)){for(p=l;n&&!n.node;)n=n.parent;let b=n.node;if(n&&b.isAtom&&ae.isSelectable(b)&&n.parent&&!(b.isInline&&WV(t.focusNode,t.focusOffset,n.dom))){let m=n.posBefore;d=new ae(l==m?s:i.resolve(m))}}else{if(t instanceof r.dom.ownerDocument.defaultView.Selection&&t.rangeCount>1){let b=l,m=l;for(let g=0;g<t.rangeCount;g++){let x=t.getRangeAt(g);b=Math.min(b,r.docView.posFromDOM(x.startContainer,x.startOffset,1)),m=Math.max(m,r.docView.posFromDOM(x.endContainer,x.endOffset,-1))}if(b<0)return null;[p,l]=m==r.state.selection.anchor?[m,b]:[b,m],s=i.resolve(l)}else p=r.docView.posFromDOM(t.anchorNode,t.anchorOffset,1);if(p<0)return null}let c=i.resolve(p);if(!d){let b=e=="pointer"||r.state.selection.head<s.pos&&!a?1:-1;d=sp(r,c,s,b)}return d}function UN(r){return r.editable?r.hasFocus():XN(r)&&document.activeElement&&document.activeElement.contains(r.dom)}function fr(r,e=!1){let t=r.state.selection;if(JN(r,t),!UN(r))return;let i=r.input.mouseDown;if(!e&&Ue&&i){let n=r.domSelectionRange(),a=r.domObserver.currentSelection;if(n.anchorNode&&a.anchorNode&&Mo(n.anchorNode,n.anchorOffset,a.anchorNode,a.anchorOffset)&&i.delaySelUpdate()){r.domObserver.setCurSelection();return}}if(r.domObserver.disconnectSelection(),r.cursorWrapper)wH(r);else{let{anchor:n,head:a}=t,l,s;WN&&!(t instanceof pe)&&(t.$from.parent.inlineContent||(l=GN(r,t.from)),!t.empty&&!t.$from.parent.inlineContent&&(s=GN(r,t.to))),r.docView.setSelection(n,a,r,e),WN&&(l&&KN(l),s&&KN(s)),t.visible?r.dom.classList.remove("ProseMirror-hideselection"):(r.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&yH(r))}r.domObserver.setCurSelection(),r.domObserver.connectSelection()}const WN=at||Ue&&SN<63;function GN(r,e){let{node:t,offset:i}=r.docView.domFromPos(e,0),n=i<t.childNodes.length?t.childNodes[i]:null,a=i?t.childNodes[i-1]:null;if(at&&n&&n.contentEditable=="false")return lp(n);if((!n||n.contentEditable=="false")&&(!a||a.contentEditable=="false")){if(n)return lp(n);if(a)return lp(a)}}function lp(r){return r.contentEditable="true",at&&r.draggable&&(r.draggable=!1,r.wasDraggable=!0),r}function KN(r){r.contentEditable="false",r.wasDraggable&&(r.draggable=!0,r.wasDraggable=null)}function yH(r){let e=r.dom.ownerDocument;e.removeEventListener("selectionchange",r.input.hideSelectionGuard);let t=r.domSelectionRange(),i=t.anchorNode,n=t.anchorOffset;e.addEventListener("selectionchange",r.input.hideSelectionGuard=()=>{(t.anchorNode!=i||t.anchorOffset!=n)&&(e.removeEventListener("selectionchange",r.input.hideSelectionGuard),setTimeout(()=>{(!UN(r)||r.state.selection.visible)&&r.dom.classList.remove("ProseMirror-hideselection")},20))})}function wH(r){let e=r.domSelection();if(!e)return;let t=r.cursorWrapper.dom,i=t.nodeName=="IMG";i?e.collapse(t.parentNode,$e(t)+1):e.collapse(t,0),!i&&!r.state.selection.visible&&Pt&&jr<=11&&(t.disabled=!0,t.disabled=!1)}function JN(r,e){if(e instanceof ae){let t=r.docView.descAt(e.from);t!=r.lastSelectedViewDesc&&(YN(r),t&&t.selectNode(),r.lastSelectedViewDesc=t)}else YN(r)}function YN(r){r.lastSelectedViewDesc&&(r.lastSelectedViewDesc.parent&&r.lastSelectedViewDesc.deselectNode(),r.lastSelectedViewDesc=void 0)}function sp(r,e,t,i){return r.someProp("createSelectionBetween",n=>n(r,e,t))||pe.between(e,t,i)}function QN(r){return r.editable&&!r.hasFocus()?!1:XN(r)}function XN(r){let e=r.domSelectionRange();if(!e.anchorNode)return!1;try{return r.dom.contains(e.anchorNode.nodeType==3?e.anchorNode.parentNode:e.anchorNode)&&(r.editable||r.dom.contains(e.focusNode.nodeType==3?e.focusNode.parentNode:e.focusNode))}catch{return!1}}function vH(r){let e=r.docView.domFromPos(r.state.selection.anchor,0),t=r.domSelectionRange();return Mo(e.node,e.offset,t.anchorNode,t.anchorOffset)}function pp(r,e){let{$anchor:t,$head:i}=r.selection,n=e>0?t.max(i):t.min(i),a=n.parent.inlineContent?n.depth?r.doc.resolve(e>0?n.after():n.before()):null:n;return a&&de.findFrom(a,e)}function Gr(r,e){return r.dispatch(r.state.tr.setSelection(e).scrollIntoView()),!0}function ZN(r,e,t){let i=r.state.selection;if(i instanceof pe)if(t.indexOf("s")>-1){let{$head:n}=i,a=n.textOffset?null:e<0?n.nodeBefore:n.nodeAfter;if(!a||a.isText||!a.isLeaf)return!1;let l=r.state.doc.resolve(n.pos+a.nodeSize*(e<0?-1:1));return Gr(r,new pe(i.$anchor,l))}else if(i.empty){if(r.endOfTextblock(e>0?"forward":"backward")){let n=pp(r.state,e);return n&&n instanceof ae?Gr(r,n):!1}else if(!(It&&t.indexOf("m")>-1)){let n=i.$head,a=n.textOffset?null:e<0?n.nodeBefore:n.nodeAfter,l;if(!a||a.isText)return!1;let s=e<0?n.pos-a.nodeSize:n.pos;return a.isAtom||(l=r.docView.descAt(s))&&!l.contentDOM?ae.isSelectable(a)?Gr(r,new ae(e<0?r.state.doc.resolve(n.pos-a.nodeSize):n)):$i?Gr(r,new pe(r.state.doc.resolve(e<0?s:s+a.nodeSize))):!1:!1}}else return!1;else{if(i instanceof ae&&i.node.isInline)return Gr(r,new pe(e>0?i.$to:i.$from));{let n=pp(r.state,e);return n?Gr(r,n):!1}}}function Ea(r){return r.nodeType==3?r.nodeValue.length:r.childNodes.length}function on(r,e){let t=r.pmViewDesc;return t&&t.size==0&&(e<0||r.nextSibling||r.nodeName!="BR")}function pi(r,e){return e<0?kH(r):SH(r)}function kH(r){let e=r.domSelectionRange(),t=e.focusNode,i=e.focusOffset;if(!t)return;let n,a,l=!1;for(zt&&t.nodeType==1&&i<Ea(t)&&on(t.childNodes[i],-1)&&(l=!0);;)if(i>0){if(t.nodeType!=1)break;{let s=t.childNodes[i-1];if(on(s,-1))n=t,a=--i;else if(s.nodeType==3)t=s,i=t.nodeValue.length;else break}}else{if($N(t))break;{let s=t.previousSibling;for(;s&&on(s,-1);)n=t.parentNode,a=$e(s),s=s.previousSibling;if(s)t=s,i=Ea(t);else{if(t=t.parentNode,t==r.dom)break;i=0}}}l?dp(r,t,i):n&&dp(r,n,a)}function SH(r){let e=r.domSelectionRange(),t=e.focusNode,i=e.focusOffset;if(!t)return;let n=Ea(t),a,l;for(;;)if(i<n){if(t.nodeType!=1)break;let s=t.childNodes[i];if(on(s,1))a=t,l=++i;else break}else{if($N(t))break;{let s=t.nextSibling;for(;s&&on(s,1);)a=s.parentNode,l=$e(s)+1,s=s.nextSibling;if(s)t=s,i=0,n=Ea(t);else{if(t=t.parentNode,t==r.dom)break;i=n=0}}}a&&dp(r,a,l)}function $N(r){let e=r.pmViewDesc;return e&&e.node&&e.node.isBlock}function CH(r,e){for(;r&&e==r.childNodes.length&&!Zi(r);)e=$e(r)+1,r=r.parentNode;for(;r&&e<r.childNodes.length;){let t=r.childNodes[e];if(t.nodeType==3)return t;if(t.nodeType==1&&t.contentEditable=="false")break;r=t,e=0}}function TH(r,e){for(;r&&!e&&!Zi(r);)e=$e(r),r=r.parentNode;for(;r&&e;){let t=r.childNodes[e-1];if(t.nodeType==3)return t;if(t.nodeType==1&&t.contentEditable=="false")break;r=t,e=r.childNodes.length}}function dp(r,e,t){if(e.nodeType!=3){let a,l;(l=CH(e,t))?(e=l,t=0):(a=TH(e,t))&&(e=a,t=a.nodeValue.length)}let i=r.domSelection();if(!i)return;if(Sa(i)){let a=document.createRange();a.setEnd(e,t),a.setStart(e,t),i.removeAllRanges(),i.addRange(a)}else i.extend&&i.extend(e,t);r.domObserver.setCurSelection();let{state:n}=r;setTimeout(()=>{r.state==n&&fr(r)},50)}function eA(r,e){let t=r.state.doc.resolve(e);if(!(Ue||CN)&&t.parent.inlineContent){let n=r.coordsAtPos(e);if(e>t.start()){let a=r.coordsAtPos(e-1),l=(a.top+a.bottom)/2;if(l>n.top&&l<n.bottom&&Math.abs(a.left-n.left)>1)return a.left<n.left?"ltr":"rtl"}if(e<t.end()){let a=r.coordsAtPos(e+1),l=(a.top+a.bottom)/2;if(l>n.top&&l<n.bottom&&Math.abs(a.left-n.left)>1)return a.left>n.left?"ltr":"rtl"}}return getComputedStyle(r.dom).direction=="rtl"?"rtl":"ltr"}function tA(r,e,t){let i=r.state.selection;if(i instanceof pe&&!i.empty||t.indexOf("s")>-1||It&&t.indexOf("m")>-1)return!1;let{$from:n,$to:a}=i;if(!n.parent.inlineContent||r.endOfTextblock(e<0?"up":"down")){let l=pp(r.state,e);if(l&&l instanceof ae)return Gr(r,l)}if(!n.parent.inlineContent){let l=e<0?n:a,s=i instanceof gr?de.near(l,e):de.findFrom(l,e);return s?Gr(r,s):!1}return!1}function rA(r,e){if(!(r.state.selection instanceof pe))return!0;let{$head:t,$anchor:i,empty:n}=r.state.selection;if(!t.sameParent(i))return!0;if(!n)return!1;if(r.endOfTextblock(e>0?"forward":"backward"))return!0;let a=!t.textOffset&&(e<0?t.nodeBefore:t.nodeAfter);if(a&&!a.isText){let l=r.state.tr;return e<0?l.delete(t.pos-a.nodeSize,t.pos):l.delete(t.pos,t.pos+a.nodeSize),r.dispatch(l),!0}return!1}function oA(r,e,t){r.domObserver.stop(),e.contentEditable=t,r.domObserver.start()}function EH(r){if(!at||r.state.selection.$head.parentOffset>0)return!1;let{focusNode:e,focusOffset:t}=r.domSelectionRange();if(e&&e.nodeType==1&&t==0&&e.firstChild&&e.firstChild.contentEditable=="false"){let i=e.firstChild;oA(r,i,"true"),setTimeout(()=>oA(r,i,"false"),20)}return!1}function MH(r){let e="";return r.ctrlKey&&(e+="c"),r.metaKey&&(e+="m"),r.altKey&&(e+="a"),r.shiftKey&&(e+="s"),e}function PH(r,e){let t=e.keyCode,i=MH(e);if(t==8||It&&t==72&&i=="c")return rA(r,-1)||pi(r,-1);if(t==46&&!e.shiftKey||It&&t==68&&i=="c")return rA(r,1)||pi(r,1);if(t==13||t==27)return!0;if(t==37||It&&t==66&&i=="c"){let n=t==37?eA(r,r.state.selection.from)=="ltr"?-1:1:-1;return ZN(r,n,i)||pi(r,n)}else if(t==39||It&&t==70&&i=="c"){let n=t==39?eA(r,r.state.selection.from)=="ltr"?1:-1:1;return ZN(r,n,i)||pi(r,n)}else{if(t==38||It&&t==80&&i=="c")return tA(r,-1,i)||pi(r,-1);if(t==40||It&&t==78&&i=="c")return EH(r)||tA(r,1,i)||pi(r,1);if(i==(It?"m":"c")&&(t==66||t==73||t==89||t==90))return!0}return!1}function cp(r,e){r.someProp("transformCopied",g=>{e=g(e,r)});let t=[],{content:i,openStart:n,openEnd:a}=e;for(;n>1&&a>1&&i.childCount==1&&i.firstChild.childCount==1;){n--,a--;let g=i.firstChild;t.push(g.type.name,g.attrs!=g.type.defaultAttrs?g.attrs:null),i=g.content}let l=r.someProp("clipboardSerializer")||To.fromSchema(r.state.schema),s=dA(),p=s.createElement("div");p.appendChild(l.serializeFragment(i,{document:s}));let d=p.firstChild,c,b=0;for(;d&&d.nodeType==1&&(c=pA[d.nodeName.toLowerCase()]);){for(let g=c.length-1;g>=0;g--){let x=s.createElement(c[g]);for(;p.firstChild;)x.appendChild(p.firstChild);p.appendChild(x),b++}d=p.firstChild}d&&d.nodeType==1&&d.setAttribute("data-pm-slice",`${n} ${a}${b?` -${b}`:""} ${JSON.stringify(t)}`);let m=r.someProp("clipboardTextSerializer",g=>g(e,r))||e.content.textBetween(0,e.content.size,`
22
22
 
23
23
  `);return{dom:p,text:m,slice:e}}function iA(r,e,t,i,n){let a=n.parent.type.spec.code,l,s;if(!t&&!e)return null;let p=!!e&&(i||a||!t);if(p){if(r.someProp("transformPastedText",m=>{e=m(e,a||i,r)}),a)return s=new $(G.from(r.state.schema.text(e.replace(/\r\n?/g,`
24
- `))),0,0),r.someProp("transformPasted",m=>{s=m(s,r,!0)}),s;let b=r.someProp("clipboardTextParser",m=>m(e,n,i,r));if(b)s=b;else{let m=n.marks(),{schema:g}=r.state,x=To.fromSchema(g);l=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach(u=>{let h=l.appendChild(document.createElement("p"));u&&h.appendChild(x.serializeNode(g.text(u,m)))})}}else r.someProp("transformPastedHTML",b=>{t=b(t,r)}),l=AH(t),$i&&_H(l);let d=l&&l.querySelector("[data-pm-slice]"),c=d&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(d.getAttribute("data-pm-slice")||"");if(c&&c[3])for(let b=+c[3];b>0;b--){let m=l.firstChild;for(;m&&m.nodeType!=1;)m=m.nextSibling;if(!m)break;l=m}if(s||(s=(r.someProp("clipboardParser")||r.someProp("domParser")||Wi.fromSchema(r.state.schema)).parseSlice(l,{preserveWhitespace:!!(p||c),context:n,ruleFromNode(m){return m.nodeName=="BR"&&!m.nextSibling&&m.parentNode&&!BH.test(m.parentNode.nodeName)?{ignore:!0}:null}})),c)s=DH(sA(s,+c[1],+c[2]),c[4]);else if(s=$.maxOpen(LH(s.content,n),!0),s.openStart||s.openEnd){let b=0,m=0;for(let g=s.content.firstChild;b<s.openStart&&!g.type.spec.isolating;b++,g=g.firstChild);for(let g=s.content.lastChild;m<s.openEnd&&!g.type.spec.isolating;m++,g=g.lastChild);s=sA(s,b,m)}return r.someProp("transformPasted",b=>{s=b(s,r,p)}),s}const BH=/^(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 LH(r,e){if(r.childCount<2)return r;for(let t=e.depth;t>=0;t--){let n=e.node(t).contentMatchAt(e.index(t)),a,l=[];if(r.forEach(s=>{if(!l)return;let p=n.findWrapping(s.type),d;if(!p)return l=null;if(d=l.length&&a.length&&aA(p,a,s,l[l.length-1],0))l[l.length-1]=d;else{l.length&&(l[l.length-1]=lA(l[l.length-1],a.length));let c=nA(s,p);l.push(c),n=n.matchType(c.type),a=p}}),l)return G.from(l)}return r}function nA(r,e,t=0){for(let i=e.length-1;i>=t;i--)r=e[i].create(null,G.from(r));return r}function aA(r,e,t,i,n){if(n<r.length&&n<e.length&&r[n]==e[n]){let a=aA(r,e,t,i.lastChild,n+1);if(a)return i.copy(i.content.replaceChild(i.childCount-1,a));if(i.contentMatchAt(i.childCount).matchType(n==r.length-1?t.type:r[n+1]))return i.copy(i.content.append(G.from(nA(t,r,n+1))))}}function lA(r,e){if(e==0)return r;let t=r.content.replaceChild(r.childCount-1,lA(r.lastChild,e-1)),i=r.contentMatchAt(r.childCount).fillBefore(G.empty,!0);return r.copy(t.append(i))}function bp(r,e,t,i,n,a){let l=e<0?r.firstChild:r.lastChild,s=l.content;return r.childCount>1&&(a=0),n<i-1&&(s=bp(s,e,t,i,n+1,a)),n>=t&&(s=e<0?l.contentMatchAt(0).fillBefore(s,a<=n).append(s):s.append(l.contentMatchAt(l.childCount).fillBefore(G.empty,!0))),r.replaceChild(e<0?0:r.childCount-1,l.copy(s))}function sA(r,e,t){return e<r.openStart&&(r=new $(bp(r.content,-1,e,r.openStart,0,r.openEnd),e,r.openEnd)),t<r.openEnd&&(r=new $(bp(r.content,1,t,r.openEnd,0,0),r.openStart,t)),r}const pA={thead:["table"],tbody:["table"],tfoot:["table"],caption:["table"],colgroup:["table"],col:["table","colgroup"],tr:["table","tbody"],td:["table","tbody","tr"],th:["table","tbody","tr"]};function dA(){return document.implementation.createHTMLDocument("title")}let mp=null;function NH(r){let e=window.trustedTypes;return e?(mp||(mp=e.defaultPolicy||e.createPolicy("ProseMirrorClipboard",{createHTML:t=>t})),mp.createHTML(r)):r}function AH(r){let e=/^(\s*<meta [^>]*>)*/.exec(r);e&&(r=r.slice(e[0].length));let t=dA(),i=t.body,n=/<([a-z][^>\s]+)/i.exec(r),a;if((a=n&&pA[n[1].toLowerCase()])&&(r=a.map(l=>"<"+l+">").join("")+r+a.map(l=>"</"+l+">").reverse().join("")),i.innerHTML=NH(r),a)for(let l=0;l<a.length;l++)i=i.querySelector(a[l])||i;for(let l=0;l<t.styleSheets.length;l++){let s=t.styleSheets[l];for(let p=0;p<s.rules.length;p++){let d=s.rules[p];if(d instanceof CSSStyleRule){let c=i.querySelectorAll(d.selectorText);for(let b=0;b<c.length;b++)c[b].style.cssText+=d.style.cssText}}}return i}function _H(r){let e=r.querySelectorAll(Ue?"span:not([class]):not([style])":"span.Apple-converted-space");for(let t=0;t<e.length;t++){let i=e[t];i.childNodes.length==1&&i.textContent==" "&&i.parentNode&&i.parentNode.replaceChild(r.ownerDocument.createTextNode(" "),i)}}function DH(r,e){if(!r.size)return r;let t=r.content.firstChild.type.schema,i;try{i=JSON.parse(e)}catch{return r}let{content:n,openStart:a,openEnd:l}=r;for(let s=i.length-2;s>=0;s-=2){let p=t.nodes[i[s]];if(!p||p.hasRequiredAttrs())break;n=G.from(p.create(i[s+1],n)),a++,l++}return new $(n,a,l)}const xt={},ht={},zH={touchstart:!0,touchmove:!0};class IH{constructor(){this.shiftKey=!1,this.mouseDown=null,this.lastKeyCode=null,this.lastKeyCodeTime=0,this.lastClick={time:0,x:0,y:0,type:"",button:0},this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastIOSEnter=0,this.lastIOSEnterFallbackTimeout=-1,this.lastFocus=0,this.lastTouch=0,this.lastChromeDelete=0,this.composing=!1,this.compositionNode=null,this.composingTimeout=-1,this.compositionNodes=[],this.compositionEndedAt=-2e8,this.compositionID=1,this.badSafariComposition=!1,this.compositionPendingChanges=0,this.domChangeCount=0,this.eventHandlers=Object.create(null),this.hideSelectionGuard=null}}function VH(r){for(let e in xt){let t=xt[e];r.dom.addEventListener(e,r.input.eventHandlers[e]=i=>{RH(r,i)&&!up(r,i)&&(r.editable||!(i.type in ht))&&t(r,i)},zH[e]?{passive:!0}:void 0)}at&&r.dom.addEventListener("input",()=>null),gp(r)}function yr(r,e){r.input.lastSelectionOrigin=e,r.input.lastSelectionTime=Date.now()}function HH(r){r.input.mouseDown&&r.input.mouseDown.done(),r.domObserver.stop();for(let e in r.input.eventHandlers)r.dom.removeEventListener(e,r.input.eventHandlers[e]);clearTimeout(r.input.composingTimeout),clearTimeout(r.input.lastIOSEnterFallbackTimeout)}function gp(r){r.someProp("handleDOMEvents",e=>{for(let t in e)r.input.eventHandlers[t]||r.dom.addEventListener(t,r.input.eventHandlers[t]=i=>up(r,i))})}function up(r,e){return r.someProp("handleDOMEvents",t=>{let i=t[e.type];return i?i(r,e)||e.defaultPrevented:!1})}function RH(r,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let t=e.target;t!=r.dom;t=t.parentNode)if(!t||t.nodeType==11||t.pmViewDesc&&t.pmViewDesc.stopEvent(e))return!1;return!0}function OH(r,e){!up(r,e)&&xt[e.type]&&(r.editable||!(e.type in ht))&&xt[e.type](r,e)}ht.keydown=(r,e)=>{let t=e;if(r.input.shiftKey=t.keyCode==16||t.shiftKey,!gA(r)&&(r.input.lastKeyCode=t.keyCode,r.input.lastKeyCodeTime=Date.now(),!(xr&&Ue&&t.keyCode==13)))if(t.keyCode!=229&&r.domObserver.forceFlush(),li&&t.keyCode==13&&!t.ctrlKey&&!t.altKey&&!t.metaKey){let i=Date.now();r.input.lastIOSEnter=i,r.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{r.input.lastIOSEnter==i&&(r.someProp("handleKeyDown",n=>n(r,Po(13,"Enter"))),r.input.lastIOSEnter=0)},200)}else r.someProp("handleKeyDown",i=>i(r,t))||PH(r,t)?t.preventDefault():yr(r,"key")},ht.keyup=(r,e)=>{e.keyCode==16&&(r.input.shiftKey=!1)},ht.keypress=(r,e)=>{let t=e;if(gA(r)||!t.charCode||t.ctrlKey&&!t.altKey||It&&t.metaKey)return;if(r.someProp("handleKeyPress",n=>n(r,t))){t.preventDefault();return}let i=r.state.selection;if(!(i instanceof pe)||!i.$from.sameParent(i.$to)){let n=String.fromCharCode(t.charCode),a=()=>r.state.tr.insertText(n).scrollIntoView();!/[\r\n]/.test(n)&&!r.someProp("handleTextInput",l=>l(r,i.$from.pos,i.$to.pos,n,a))&&r.dispatch(a()),t.preventDefault()}};function nn(r){return{left:r.clientX,top:r.clientY}}function FH(r,e){let t=e.x-r.clientX,i=e.y-r.clientY;return t*t+i*i<100}function xp(r,e,t,i,n){if(i==-1)return!1;let a=r.state.doc.resolve(i);for(let l=a.depth+1;l>0;l--)if(r.someProp(e,s=>l>a.depth?s(r,t,a.nodeAfter,a.before(l),n,!0):s(r,t,a.node(l),a.before(l),n,!1)))return!0;return!1}function an(r,e,t){if(r.focused||r.focus(),r.state.selection.eq(e))return;let i=r.state.tr.setSelection(e);i.setMeta("pointer",!0),r.dispatch(i)}function jH(r,e){if(e==-1)return!1;let t=r.state.doc.resolve(e),i=t.nodeAfter;return i&&i.isAtom&&ae.isSelectable(i)?(an(r,new ae(t)),!0):!1}function qH(r,e){if(e==-1)return!1;let t=r.state.selection,i,n;t instanceof ae&&(i=t.node);let a=r.state.doc.resolve(e);for(let l=a.depth+1;l>0;l--){let s=l>a.depth?a.nodeAfter:a.node(l);if(ae.isSelectable(s)){i&&t.$from.depth>0&&l>=t.$from.depth&&a.before(t.$from.depth+1)==t.$from.pos?n=a.before(t.$from.depth):n=a.before(l);break}}return n!=null?(an(r,ae.create(r.state.doc,n)),!0):!1}function UH(r,e,t,i,n){return xp(r,"handleClickOn",e,t,i)||r.someProp("handleClick",a=>a(r,e,i))||(n?qH(r,t):jH(r,t))}function WH(r,e,t,i){return xp(r,"handleDoubleClickOn",e,t,i)||r.someProp("handleDoubleClick",n=>n(r,e,i))}function GH(r,e,t,i){return xp(r,"handleTripleClickOn",e,t,i)||r.someProp("handleTripleClick",n=>n(r,e,i))||KH(r,t,i)}function KH(r,e,t){if(t.button!=0)return!1;let i=cA(r,e,!0),n=r.state.doc;return i?(an(r,i),i instanceof pe&&n.eq(r.state.doc)&&(r.input.mouseDown=new YH(r,i)),!0):!1}function cA(r,e,t){let i=r.state.doc;if(e==-1)return i.inlineContent?pe.create(i,0,i.content.size):null;let n=i.resolve(e);for(let a=n.depth+1;a>0;a--){let l=a>n.depth?n.nodeAfter:n.node(a),s=n.before(a);if(l.inlineContent)return pe.create(i,s+1,s+1+l.content.size);if(t&&ae.isSelectable(l))return ae.create(i,s)}return null}function hp(r){return Ma(r)}const bA=It?"metaKey":"ctrlKey";xt.mousedown=(r,e)=>{let t=e;r.input.shiftKey=t.shiftKey;let i=hp(r),n=Date.now(),a="singleClick";n-r.input.lastClick.time<500&&FH(t,r.input.lastClick)&&!t[bA]&&r.input.lastClick.button==t.button&&(r.input.lastClick.type=="singleClick"?a="doubleClick":r.input.lastClick.type=="doubleClick"&&(a="tripleClick")),r.input.lastClick={time:n,x:t.clientX,y:t.clientY,type:a,button:t.button},r.input.mouseDown&&r.input.mouseDown.done();let l=r.posAtCoords(nn(t));l&&(a=="singleClick"?r.input.mouseDown=new JH(r,l,t,!!i):(a=="doubleClick"?WH:GH)(r,l.pos,l.inside,t)?t.preventDefault():yr(r,"pointer"))};class mA{constructor(e){this.view=e,this.mightDrag=null,e.root.addEventListener("mouseup",this.up=this.up.bind(this)),e.root.addEventListener("mousemove",this.move=this.move.bind(this))}up(e){this.done()}move(e){e.buttons==0&&this.done()}done(){this.view.root.removeEventListener("mouseup",this.up),this.view.root.removeEventListener("mousemove",this.move),this.view.input.mouseDown==this&&(this.view.input.mouseDown=null)}delaySelUpdate(){return!1}}class JH extends mA{constructor(e,t,i,n){super(e),this.pos=t,this.event=i,this.flushed=n,this.delayedSelectionSync=!1,this.startDoc=e.state.doc,this.selectNode=!!i[bA],this.allowDefault=i.shiftKey;let a,l;if(t.inside>-1)a=e.state.doc.nodeAt(t.inside),l=t.inside;else{let c=e.state.doc.resolve(t.pos);a=c.parent,l=c.depth?c.before():0}const s=n?null:i.target,p=s?e.docView.nearestDesc(s,!0):null;this.target=p&&p.nodeDOM.nodeType==1?p.nodeDOM:null;let{selection:d}=e.state;i.button==0&&(a.type.spec.draggable&&a.type.spec.selectable!==!1||d instanceof ae&&d.from<=l&&d.to>l)&&(this.mightDrag={node:a,pos:l,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&zt&&!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()),yr(e,"pointer")}done(){super.done(),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(()=>{this.view.isDestroyed||fr(this.view)})}up(e){if(this.done(),!this.view.dom.contains(e.target))return;let t=this.pos;this.view.state.doc!=this.startDoc&&(t=this.view.posAtCoords(nn(e))),this.updateAllowDefault(e),this.allowDefault||!t?yr(this.view,"pointer"):UH(this.view,t.pos,t.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||at&&this.mightDrag&&!this.mightDrag.node.isAtom||Ue&&!this.view.state.selection.visible&&Math.min(Math.abs(t.pos-this.view.state.selection.from),Math.abs(t.pos-this.view.state.selection.to))<=2)?(an(this.view,de.near(this.view.state.doc.resolve(t.pos))),e.preventDefault()):yr(this.view,"pointer")}move(e){this.updateAllowDefault(e),yr(this.view,"pointer"),super.move(e)}updateAllowDefault(e){!this.allowDefault&&(Math.abs(this.event.x-e.clientX)>4||Math.abs(this.event.y-e.clientY)>4)&&(this.allowDefault=!0)}delaySelUpdate(){return this.allowDefault?(this.delayedSelectionSync=!0,!0):!1}}class YH extends mA{constructor(e,t){super(e),this.startSelection=t,this.startDoc=e.state.doc}move(e){if(e.buttons==0||this.view.isDestroyed||!this.view.state.doc.eq(this.startDoc)){this.done();return}e.preventDefault(),yr(this.view,"pointer");let t=this.view.posAtCoords(nn(e)),i=t&&cA(this.view,t.inside,!1);if(!i)return;let{doc:n}=this.view.state,a=this.startSelection,[l,s]=i.from<a.from?[a.to,i.from]:[a.from,i.to];an(this.view,pe.create(n,l,s))}}xt.touchstart=r=>{r.input.lastTouch=Date.now(),hp(r),yr(r,"pointer")},xt.touchmove=r=>{r.input.lastTouch=Date.now(),yr(r,"pointer")},xt.contextmenu=r=>hp(r);function gA(r,e){return r.composing?!0:at&&Math.abs(Date.now()-r.input.compositionEndedAt)<500?(r.input.compositionEndedAt=-2e8,!0):!1}const QH=xr?5e3:-1;ht.compositionstart=ht.compositionupdate=r=>{if(!r.composing){r.domObserver.flush();let{state:e}=r,t=e.selection.$to;if(e.selection instanceof pe&&(e.storedMarks||!t.textOffset&&t.parentOffset&&t.nodeBefore.marks.some(i=>i.type.spec.inclusive===!1)||Ue&&CN&&XH(r)))r.markCursor=r.state.storedMarks||t.marks(),Ma(r,!0),r.markCursor=null;else if(Ma(r,!e.selection.empty),zt&&e.selection.empty&&t.parentOffset&&!t.textOffset&&t.nodeBefore.marks.length){let i=r.domSelectionRange();for(let n=i.focusNode,a=i.focusOffset;n&&n.nodeType==1&&a!=0;){let l=a<0?n.lastChild:n.childNodes[a-1];if(!l)break;if(l.nodeType==3){let s=r.domSelection();s&&s.collapse(l,l.nodeValue.length);break}else n=l,a=-1}}r.input.composing=!0}uA(r,QH)};function XH(r){let{focusNode:e,focusOffset:t}=r.domSelectionRange();if(!e||e.nodeType!=1||t>=e.childNodes.length)return!1;let i=e.childNodes[t];return i.nodeType==1&&i.contentEditable=="false"}ht.compositionend=(r,e)=>{r.composing&&(r.input.composing=!1,r.input.compositionEndedAt=Date.now(),r.input.compositionPendingChanges=r.domObserver.pendingRecords().length?r.input.compositionID:0,r.input.compositionNode=null,r.input.badSafariComposition?r.domObserver.forceFlush():r.input.compositionPendingChanges&&Promise.resolve().then(()=>r.domObserver.flush()),r.input.compositionID++,uA(r,20))};function uA(r,e){clearTimeout(r.input.composingTimeout),e>-1&&(r.input.composingTimeout=setTimeout(()=>Ma(r),e))}function xA(r){for(r.composing&&(r.input.composing=!1,r.input.compositionEndedAt=Date.now());r.input.compositionNodes.length>0;)r.input.compositionNodes.pop().markParentsDirty()}function ZH(r){let e=r.domSelectionRange();if(!e.focusNode)return null;let t=qV(e.focusNode,e.focusOffset),i=UV(e.focusNode,e.focusOffset);if(t&&i&&t!=i){let n=i.pmViewDesc,a=r.domObserver.lastChangedTextNode;if(t==a||i==a)return a;if(!n||!n.isText(i.nodeValue))return i;if(r.input.compositionNode==i){let l=t.pmViewDesc;if(!(!l||!l.isText(t.nodeValue)))return i}}return t||i}function Ma(r,e=!1){if(!(xr&&r.domObserver.flushingSoon>=0)){if(r.domObserver.forceFlush(),xA(r),e||r.docView&&r.docView.dirty){let t=ap(r),i=r.state.selection;return t&&!t.eq(i)?r.dispatch(r.state.tr.setSelection(t)):(r.markCursor||e)&&!i.$from.node(i.$from.sharedDepth(i.to)).inlineContent?r.dispatch(r.state.tr.deleteSelection()):r.updateState(r.state),!0}return!1}}function $H(r,e){if(!r.dom.parentNode)return;let t=r.dom.parentNode.appendChild(document.createElement("div"));t.appendChild(e),t.style.cssText="position: fixed; left: -10000px; top: 10px";let i=getSelection(),n=document.createRange();n.selectNodeContents(e),r.dom.blur(),i.removeAllRanges(),i.addRange(n),setTimeout(()=>{t.parentNode&&t.parentNode.removeChild(t),r.focus()},50)}const ln=Pt&&jr<15||li&&JV<604;xt.copy=ht.cut=(r,e)=>{let t=e,i=r.state.selection,n=t.type=="cut";if(i.empty)return;let a=ln?null:t.clipboardData,l=i.content(),{dom:s,text:p}=cp(r,l);a?(t.preventDefault(),a.clearData(),a.setData("text/html",s.innerHTML),a.setData("text/plain",p)):$H(r,s),n&&r.dispatch(r.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function eR(r){return r.openStart==0&&r.openEnd==0&&r.content.childCount==1?r.content.firstChild:null}function tR(r,e){if(!r.dom.parentNode)return;let t=r.input.shiftKey||r.state.selection.$from.parent.type.spec.code,i=r.dom.parentNode.appendChild(document.createElement(t?"textarea":"div"));t||(i.contentEditable="true"),i.style.cssText="position: fixed; left: -10000px; top: 10px",i.focus();let n=r.input.shiftKey&&r.input.lastKeyCode!=45;setTimeout(()=>{r.focus(),i.parentNode&&i.parentNode.removeChild(i),t?sn(r,i.value,null,n,e):sn(r,i.textContent,i.innerHTML,n,e)},50)}function sn(r,e,t,i,n){let a=iA(r,e,t,i,r.state.selection.$from);if(r.someProp("handlePaste",p=>p(r,n,a||$.empty)))return!0;if(!a)return!1;let l=eR(a),s=l?r.state.tr.replaceSelectionWith(l,i):r.state.tr.replaceSelection(a);return r.dispatch(s.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function hA(r){let e=r.getData("text/plain")||r.getData("Text");if(e)return e;let t=r.getData("text/uri-list");return t?t.replace(/\r?\n/g," "):""}ht.paste=(r,e)=>{let t=e;if(r.composing&&!xr)return;let i=ln?null:t.clipboardData,n=r.input.shiftKey&&r.input.lastKeyCode!=45;i&&sn(r,hA(i),i.getData("text/html"),n,t)?t.preventDefault():tR(r,t)};class fA{constructor(e,t,i){this.slice=e,this.move=t,this.node=i}}const rR=It?"altKey":"ctrlKey";function yA(r,e){let t;return r.someProp("dragCopies",i=>{t=t||i(e)}),t!=null?!t:!e[rR]}xt.dragstart=(r,e)=>{let t=e,i=r.input.mouseDown;if(i&&i.done(),!t.dataTransfer)return;let n=r.state.selection,a=n.empty?null:r.posAtCoords(nn(t)),l;if(!(a&&a.pos>=n.from&&a.pos<=(n instanceof ae?n.to-1:n.to))){if(i&&i.mightDrag)l=ae.create(r.state.doc,i.mightDrag.pos);else if(t.target&&t.target.nodeType==1){let b=r.docView.nearestDesc(t.target,!0);b&&b.node.type.spec.draggable&&b!=r.docView&&(l=ae.create(r.state.doc,b.posBefore))}}let s=(l||r.state.selection).content(),{dom:p,text:d,slice:c}=cp(r,s);(!t.dataTransfer.files.length||!Ue||SN>120)&&t.dataTransfer.clearData(),t.dataTransfer.setData(ln?"Text":"text/html",p.innerHTML),t.dataTransfer.effectAllowed="copyMove",ln||t.dataTransfer.setData("text/plain",d),r.dragging=new fA(c,yA(r,t),l)},xt.dragend=r=>{let e=r.dragging;window.setTimeout(()=>{r.dragging==e&&(r.dragging=null)},50)},ht.dragover=ht.dragenter=(r,e)=>e.preventDefault(),ht.drop=(r,e)=>{try{oR(r,e,r.dragging)}finally{r.dragging=null}};function oR(r,e,t){if(!e.dataTransfer)return;let i=r.posAtCoords(nn(e));if(!i)return;let n=r.state.doc.resolve(i.pos),a=t&&t.slice;a?r.someProp("transformPasted",g=>{a=g(a,r,!1)}):a=iA(r,hA(e.dataTransfer),ln?null:e.dataTransfer.getData("text/html"),!1,n);let l=!!(t&&yA(r,e));if(r.someProp("handleDrop",g=>g(r,e,a||$.empty,l))){e.preventDefault();return}if(!a)return;e.preventDefault();let s=a?qL(r.state.doc,n.pos,a):n.pos;s==null&&(s=n.pos);let p=r.state.tr;if(l){let{node:g}=t;g?g.replace(p):p.deleteSelection()}let d=p.mapping.map(s),c=a.openStart==0&&a.openEnd==0&&a.content.childCount==1,b=p.doc;if(c?p.replaceRangeWith(d,d,a.content.firstChild):p.replaceRange(d,d,a),p.doc.eq(b))return;let m=p.doc.resolve(d);if(c&&ae.isSelectable(a.content.firstChild)&&m.nodeAfter&&m.nodeAfter.sameMarkup(a.content.firstChild))p.setSelection(new ae(m));else{let g=p.mapping.map(s);p.mapping.maps[p.mapping.maps.length-1].forEach((x,u,h,f)=>g=f),p.setSelection(sp(r,m,p.doc.resolve(g)))}r.focus(),r.dispatch(p.setMeta("uiEvent","drop"))}xt.focus=r=>{r.input.lastFocus=Date.now(),r.focused||(r.domObserver.stop(),r.dom.classList.add("ProseMirror-focused"),r.domObserver.start(),r.focused=!0,setTimeout(()=>{r.docView&&r.hasFocus()&&!r.domObserver.currentSelection.eq(r.domSelectionRange())&&fr(r)},20))},xt.blur=(r,e)=>{let t=e;r.focused&&(r.domObserver.stop(),r.dom.classList.remove("ProseMirror-focused"),r.domObserver.start(),t.relatedTarget&&r.dom.contains(t.relatedTarget)&&r.domObserver.currentSelection.clear(),r.focused=!1)},xt.beforeinput=(r,e)=>{if(Ue&&xr&&e.inputType=="deleteContentBackward"){r.domObserver.flushSoon();let{domChangeCount:i}=r.input;setTimeout(()=>{if(r.input.domChangeCount!=i||(r.dom.blur(),r.focus(),r.someProp("handleKeyDown",a=>a(r,Po(8,"Backspace")))))return;let{$cursor:n}=r.state.selection;n&&n.pos>0&&r.dispatch(r.state.tr.delete(n.pos-1,n.pos).scrollIntoView())},50)}};for(let r in ht)xt[r]=ht[r];function pn(r,e){if(r==e)return!0;for(let t in r)if(r[t]!==e[t])return!1;for(let t in e)if(!(t in r))return!1;return!0}class Pa{constructor(e,t){this.toDOM=e,this.spec=t||No,this.side=this.spec.side||0}map(e,t,i,n){let{pos:a,deleted:l}=e.mapResult(t.from+n,this.side<0?-1:1);return l?null:new ft(a-i,a-i,this)}valid(){return!0}eq(e){return this==e||e instanceof Pa&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&pn(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class Kr{constructor(e,t){this.attrs=e,this.spec=t||No}map(e,t,i,n){let a=e.map(t.from+n,this.spec.inclusiveStart?-1:1)-i,l=e.map(t.to+n,this.spec.inclusiveEnd?1:-1)-i;return a>=l?null:new ft(a,l,this)}valid(e,t){return t.from<t.to}eq(e){return this==e||e instanceof Kr&&pn(this.attrs,e.attrs)&&pn(this.spec,e.spec)}static is(e){return e.type instanceof Kr}destroy(){}}class fp{constructor(e,t){this.attrs=e,this.spec=t||No}map(e,t,i,n){let a=e.mapResult(t.from+n,1);if(a.deleted)return null;let l=e.mapResult(t.to+n,-1);return l.deleted||l.pos<=a.pos?null:new ft(a.pos-i,l.pos-i,this)}valid(e,t){let{index:i,offset:n}=e.content.findIndex(t.from),a;return n==t.from&&!(a=e.child(i)).isText&&n+a.nodeSize==t.to}eq(e){return this==e||e instanceof fp&&pn(this.attrs,e.attrs)&&pn(this.spec,e.spec)}destroy(){}}class ft{constructor(e,t,i){this.from=e,this.to=t,this.type=i}copy(e,t){return new ft(e,t,this.type)}eq(e,t=0){return this.type.eq(e.type)&&this.from+t==e.from&&this.to+t==e.to}map(e,t,i){return this.type.map(e,this,t,i)}static widget(e,t,i){return new ft(e,e,new Pa(t,i))}static inline(e,t,i,n){return new ft(e,t,new Kr(i,n))}static node(e,t,i,n){return new ft(e,t,new fp(i,n))}get spec(){return this.type.spec}get inline(){return this.type instanceof Kr}get widget(){return this.type instanceof Pa}}const di=[],No={};class Pe{constructor(e,t){this.local=e.length?e:di,this.children=t.length?t:di}static create(e,t){return t.length?Ba(t,e,0,No):lt}find(e,t,i){let n=[];return this.findInner(e??0,t??1e9,n,0,i),n}findInner(e,t,i,n,a){for(let l=0;l<this.local.length;l++){let s=this.local[l];s.from<=t&&s.to>=e&&(!a||a(s.spec))&&i.push(s.copy(s.from+n,s.to+n))}for(let l=0;l<this.children.length;l+=3)if(this.children[l]<t&&this.children[l+1]>e){let s=this.children[l]+1;this.children[l+2].findInner(e-s,t-s,i,n+s,a)}}map(e,t,i){return this==lt||e.maps.length==0?this:this.mapInner(e,t,0,0,i||No)}mapInner(e,t,i,n,a){let l;for(let s=0;s<this.local.length;s++){let p=this.local[s].map(e,i,n);p&&p.type.valid(t,p)?(l||(l=[])).push(p):a.onRemove&&a.onRemove(this.local[s].spec)}return this.children.length?iR(this.children,l||[],e,t,i,n,a):l?new Pe(l.sort(Ao),di):lt}add(e,t){return t.length?this==lt?Pe.create(e,t):this.addInner(e,t,0):this}addInner(e,t,i){let n,a=0;e.forEach((s,p)=>{let d=p+i,c;if(c=vA(t,s,d)){for(n||(n=this.children.slice());a<n.length&&n[a]<p;)a+=3;n[a]==p?n[a+2]=n[a+2].addInner(s,c,d+1):n.splice(a,0,p,p+s.nodeSize,Ba(c,s,d+1,No)),a+=3}});let l=wA(a?kA(t):t,-i);for(let s=0;s<l.length;s++)l[s].type.valid(e,l[s])||l.splice(s--,1);return new Pe(l.length?this.local.concat(l).sort(Ao):this.local,n||this.children)}remove(e){return e.length==0||this==lt?this:this.removeInner(e,0)}removeInner(e,t){let i=this.children,n=this.local;for(let a=0;a<i.length;a+=3){let l,s=i[a]+t,p=i[a+1]+t;for(let c=0,b;c<e.length;c++)(b=e[c])&&b.from>s&&b.to<p&&(e[c]=null,(l||(l=[])).push(b));if(!l)continue;i==this.children&&(i=this.children.slice());let d=i[a+2].removeInner(l,s+1);d!=lt?i[a+2]=d:(i.splice(a,3),a-=3)}if(n.length){for(let a=0,l;a<e.length;a++)if(l=e[a])for(let s=0;s<n.length;s++)n[s].eq(l,t)&&(n==this.local&&(n=this.local.slice()),n.splice(s--,1))}return i==this.children&&n==this.local?this:n.length||i.length?new Pe(n,i):lt}forChild(e,t){if(this==lt)return this;if(t.isLeaf)return Pe.empty;let i,n;for(let s=0;s<this.children.length;s+=3)if(this.children[s]>=e){this.children[s]==e&&(i=this.children[s+2]);break}let a=e+1,l=a+t.content.size;for(let s=0;s<this.local.length;s++){let p=this.local[s];if(p.from<l&&p.to>a&&p.type instanceof Kr){let d=Math.max(a,p.from)-a,c=Math.min(l,p.to)-a;d<c&&(n||(n=[])).push(p.copy(d,c))}}if(n){let s=new Pe(n.sort(Ao),di);return i?new Jr([s,i]):s}return i||lt}eq(e){if(this==e)return!0;if(!(e instanceof Pe)||this.local.length!=e.local.length||this.children.length!=e.children.length)return!1;for(let t=0;t<this.local.length;t++)if(!this.local[t].eq(e.local[t]))return!1;for(let t=0;t<this.children.length;t+=3)if(this.children[t]!=e.children[t]||this.children[t+1]!=e.children[t+1]||!this.children[t+2].eq(e.children[t+2]))return!1;return!0}locals(e){return yp(this.localsInner(e))}localsInner(e){if(this==lt)return di;if(e.inlineContent||!this.local.some(Kr.is))return this.local;let t=[];for(let i=0;i<this.local.length;i++)this.local[i].type instanceof Kr||t.push(this.local[i]);return t}forEachSet(e){e(this)}}Pe.empty=new Pe([],[]),Pe.removeOverlap=yp;const lt=Pe.empty;class Jr{constructor(e){this.members=e}map(e,t){const i=this.members.map(n=>n.map(e,t,No));return Jr.from(i)}forChild(e,t){if(t.isLeaf)return Pe.empty;let i=[];for(let n=0;n<this.members.length;n++){let a=this.members[n].forChild(e,t);a!=lt&&(a instanceof Jr?i=i.concat(a.members):i.push(a))}return Jr.from(i)}eq(e){if(!(e instanceof Jr)||e.members.length!=this.members.length)return!1;for(let t=0;t<this.members.length;t++)if(!this.members[t].eq(e.members[t]))return!1;return!0}locals(e){let t,i=!0;for(let n=0;n<this.members.length;n++){let a=this.members[n].localsInner(e);if(a.length)if(!t)t=a;else{i&&(t=t.slice(),i=!1);for(let l=0;l<a.length;l++)t.push(a[l])}}return t?yp(i?t:t.sort(Ao)):di}static from(e){switch(e.length){case 0:return lt;case 1:return e[0];default:return new Jr(e.every(t=>t instanceof Pe)?e:e.reduce((t,i)=>t.concat(i instanceof Pe?i:i.members),[]))}}forEachSet(e){for(let t=0;t<this.members.length;t++)this.members[t].forEachSet(e)}}function iR(r,e,t,i,n,a,l){let s=r.slice();for(let d=0,c=a;d<t.maps.length;d++){let b=0;t.maps[d].forEach((m,g,x,u)=>{let h=u-x-(g-m);for(let f=0;f<s.length;f+=3){let w=s[f+1];if(w<0||m>w+c-b)continue;let y=s[f]+c-b;g>=y?s[f+1]=m<=y?-2:-1:m>=c&&h&&(s[f]+=h,s[f+1]+=h)}b+=h}),c=t.maps[d].map(c,-1)}let p=!1;for(let d=0;d<s.length;d+=3)if(s[d+1]<0){if(s[d+1]==-2){p=!0,s[d+1]=-1;continue}let c=t.map(r[d]+a),b=c-n;if(b<0||b>=i.content.size){p=!0;continue}let m=t.map(r[d+1]+a,-1),g=m-n,{index:x,offset:u}=i.content.findIndex(b),h=i.maybeChild(x);if(h&&u==b&&u+h.nodeSize==g){let f=s[d+2].mapInner(t,h,c+1,r[d]+a+1,l);f!=lt?(s[d]=b,s[d+1]=g,s[d+2]=f):(s[d+1]=-2,p=!0)}else p=!0}if(p){let d=nR(s,r,e,t,n,a,l),c=Ba(d,i,0,l);e=c.local;for(let b=0;b<s.length;b+=3)s[b+1]<0&&(s.splice(b,3),b-=3);for(let b=0,m=0;b<c.children.length;b+=3){let g=c.children[b];for(;m<s.length&&s[m]<g;)m+=3;s.splice(m,0,c.children[b],c.children[b+1],c.children[b+2])}}return new Pe(e.sort(Ao),s)}function wA(r,e){if(!e||!r.length)return r;let t=[];for(let i=0;i<r.length;i++){let n=r[i];t.push(new ft(n.from+e,n.to+e,n.type))}return t}function nR(r,e,t,i,n,a,l){function s(p,d){for(let c=0;c<p.local.length;c++){let b=p.local[c].map(i,n,d);b?t.push(b):l.onRemove&&l.onRemove(p.local[c].spec)}for(let c=0;c<p.children.length;c+=3)s(p.children[c+2],p.children[c]+d+1)}for(let p=0;p<r.length;p+=3)r[p+1]==-1&&s(r[p+2],e[p]+a+1);return t}function vA(r,e,t){if(e.isLeaf)return null;let i=t+e.nodeSize,n=null;for(let a=0,l;a<r.length;a++)(l=r[a])&&l.from>t&&l.to<i&&((n||(n=[])).push(l),r[a]=null);return n}function kA(r){let e=[];for(let t=0;t<r.length;t++)r[t]!=null&&e.push(r[t]);return e}function Ba(r,e,t,i){let n=[],a=!1;e.forEach((s,p)=>{let d=vA(r,s,p+t);if(d){a=!0;let c=Ba(d,s,t+p+1,i);c!=lt&&n.push(p,p+s.nodeSize,c)}});let l=wA(a?kA(r):r,-t).sort(Ao);for(let s=0;s<l.length;s++)l[s].type.valid(e,l[s])||(i.onRemove&&i.onRemove(l[s].spec),l.splice(s--,1));return l.length||n.length?new Pe(l,n):lt}function Ao(r,e){return r.from-e.from||r.to-e.to}function yp(r){let e=r;for(let t=0;t<e.length-1;t++){let i=e[t];if(i.from!=i.to)for(let n=t+1;n<e.length;n++){let a=e[n];if(a.from==i.from){a.to!=i.to&&(e==r&&(e=r.slice()),e[n]=a.copy(a.from,i.to),SA(e,n+1,a.copy(i.to,a.to)));continue}else{a.from<i.to&&(e==r&&(e=r.slice()),e[t]=i.copy(i.from,a.from),SA(e,n,i.copy(a.from,i.to)));break}}}return e}function SA(r,e,t){for(;e<r.length&&Ao(t,r[e])>0;)e++;r.splice(e,0,t)}function wp(r){let e=[];return r.someProp("decorations",t=>{let i=t(r.state);i&&i!=lt&&e.push(i)}),r.cursorWrapper&&e.push(Pe.create(r.state.doc,[r.cursorWrapper.deco])),Jr.from(e)}const aR={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},lR=Pt&&jr<=11;class sR{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 pR{constructor(e,t){this.view=e,this.handleDOMChange=t,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new sR,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.lastChangedTextNode=null,this.observer=window.MutationObserver&&new window.MutationObserver(i=>{for(let n=0;n<i.length;n++)this.queue.push(i[n]);Pt&&jr<=11&&i.some(n=>n.type=="childList"&&n.removedNodes.length||n.type=="characterData"&&n.oldValue.length>n.target.nodeValue.length)?this.flushSoon():at&&e.composing&&i.some(n=>n.type=="childList"&&n.target.nodeName=="TR")?(e.input.badSafariComposition=!0,this.flushSoon()):this.flush()}),lR&&(this.onCharData=i=>{this.queue.push({target:i.target,type:"characterData",oldValue:i.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,aR)),this.onCharData&&this.view.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.connectSelection()}stop(){if(this.observer){let e=this.observer.takeRecords();if(e.length){for(let t=0;t<e.length;t++)this.queue.push(e[t]);window.setTimeout(()=>this.flush(),20)}this.observer.disconnect()}this.onCharData&&this.view.dom.removeEventListener("DOMCharacterDataModified",this.onCharData),this.disconnectSelection()}connectSelection(){this.view.dom.ownerDocument.addEventListener("selectionchange",this.onSelectionChange)}disconnectSelection(){this.view.dom.ownerDocument.removeEventListener("selectionchange",this.onSelectionChange)}suppressSelectionUpdates(){this.suppressingSelectionUpdates=!0,setTimeout(()=>this.suppressingSelectionUpdates=!1,50)}onSelectionChange(){if(QN(this.view)){if(this.suppressingSelectionUpdates)return fr(this.view);if(Pt&&jr<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&Mo(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset))return this.flushSoon()}this.flush()}}setCurSelection(){this.currentSelection.set(this.view.domSelectionRange())}ignoreSelectionChange(e){if(!e.focusNode)return!0;let t=new Set,i;for(let a=e.focusNode;a;a=ai(a))t.add(a);for(let a=e.anchorNode;a;a=ai(a))if(t.has(a)){i=a;break}let n=i&&this.view.docView.nearestDesc(i);if(n&&n.ignoreMutation({type:"selection",target:i.nodeType==3?i.parentNode:i}))return this.setCurSelection(),!0}pendingRecords(){if(this.observer)for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}flush(){let{view:e}=this;if(!e.docView||this.flushingSoon>-1)return;let t=this.pendingRecords();t.length&&(this.queue=[]);let i=e.domSelectionRange(),n=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(i)&&QN(e)&&!this.ignoreSelectionChange(i),a=-1,l=-1,s=!1,p=[];if(e.editable)for(let c=0;c<t.length;c++){let b=this.registerMutation(t[c],p);b&&(a=a<0?b.from:Math.min(b.from,a),l=l<0?b.to:Math.max(b.to,l),b.typeOver&&(s=!0))}if(p.some(c=>c.nodeName=="BR")&&(e.input.lastKeyCode==8||e.input.lastKeyCode==46||Ue&&(e.composing||e.input.compositionEndedAt>Date.now()-50)&&t.some(c=>c.type=="childList"&&c.removedNodes.length))){for(let c of p)if(c.nodeName=="BR"&&c.parentNode){let b=c.nextSibling;for(;b&&b.nodeType==1;){if(b.contentEditable=="false"){c.parentNode.removeChild(c);break}b=b.firstChild}}}else if(zt&&p.length){let c=p.filter(b=>b.nodeName=="BR");if(c.length==2){let[b,m]=c;b.parentNode&&b.parentNode.parentNode==m.parentNode?m.remove():b.remove()}else{let{focusNode:b}=this.currentSelection;for(let m of c){let g=m.parentNode;g&&g.nodeName=="LI"&&(!b||bR(e,b)!=g)&&m.remove()}}}let d=null;a<0&&n&&e.input.lastFocus>Date.now()-200&&Math.max(e.input.lastTouch,e.input.lastClick.time)<Date.now()-300&&Sa(i)&&(d=ap(e))&&d.eq(de.near(e.state.doc.resolve(0),1))?(e.input.lastFocus=0,fr(e),this.currentSelection.set(i),e.scrollToSelection()):(a>-1||n)&&(a>-1&&(e.docView.markDirty(a,l),dR(e)),e.input.badSafariComposition&&(e.input.badSafariComposition=!1,mR(e,p)),this.handleDOMChange(a,l,s,p),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(i)||fr(e),this.currentSelection.set(i))}registerMutation(e,t){if(t.indexOf(e.target)>-1)return null;let i=this.view.docView.nearestDesc(e.target);if(e.type=="attributes"&&(i==this.view.docView||e.attributeName=="contenteditable"||e.attributeName=="style"&&!e.oldValue&&!e.target.getAttribute("style"))||!i||i.ignoreMutation(e))return null;if(e.type=="childList"){for(let c=0;c<e.addedNodes.length;c++){let b=e.addedNodes[c];t.push(b),b.nodeType==3&&(this.lastChangedTextNode=b)}if(i.contentDOM&&i.contentDOM!=i.dom&&!i.contentDOM.contains(e.target))return{from:i.posBefore,to:i.posAfter};let n=e.previousSibling,a=e.nextSibling;if(Pt&&jr<=11&&e.addedNodes.length)for(let c=0;c<e.addedNodes.length;c++){let{previousSibling:b,nextSibling:m}=e.addedNodes[c];(!b||Array.prototype.indexOf.call(e.addedNodes,b)<0)&&(n=b),(!m||Array.prototype.indexOf.call(e.addedNodes,m)<0)&&(a=m)}let l=n&&n.parentNode==e.target?$e(n)+1:0,s=i.localPosFromDOM(e.target,l,-1),p=a&&a.parentNode==e.target?$e(a):e.target.childNodes.length,d=i.localPosFromDOM(e.target,p,1);return{from:s,to:d}}else return e.type=="attributes"?{from:i.posAtStart-i.border,to:i.posAtEnd+i.border}:(this.lastChangedTextNode=e.target,{from:i.posAtStart,to:i.posAtEnd,typeOver:e.target.nodeValue==e.oldValue})}}let CA=new WeakMap,TA=!1;function dR(r){if(!CA.has(r)&&(CA.set(r,null),["normal","nowrap","pre-line"].indexOf(getComputedStyle(r.dom).whiteSpace)!==-1)){if(r.requiresGeckoHackNode=zt,TA)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."),TA=!0}}function EA(r,e){let t=e.startContainer,i=e.startOffset,n=e.endContainer,a=e.endOffset,l=r.domAtPos(r.state.selection.anchor);return Mo(l.node,l.offset,n,a)&&([t,i,n,a]=[n,a,t,i]),{anchorNode:t,anchorOffset:i,focusNode:n,focusOffset:a}}function cR(r,e){if(e.getComposedRanges){let n=e.getComposedRanges(r.root)[0];if(n)return EA(r,n)}let t;function i(n){n.preventDefault(),n.stopImmediatePropagation(),t=n.getTargetRanges()[0]}return r.dom.addEventListener("beforeinput",i,!0),document.execCommand("indent"),r.dom.removeEventListener("beforeinput",i,!0),t?EA(r,t):null}function bR(r,e){for(let t=e.parentNode;t&&t!=r.dom;t=t.parentNode){let i=r.docView.nearestDesc(t,!0);if(i&&i.node.isBlock)return t}return null}function mR(r,e){var t;let{focusNode:i,focusOffset:n}=r.domSelectionRange();for(let a of e)if(((t=a.parentNode)===null||t===void 0?void 0:t.nodeName)=="TR"){let l=a.nextSibling;for(;l&&l.nodeName!="TD"&&l.nodeName!="TH";)l=l.nextSibling;if(l){let s=l;for(;;){let p=s.firstChild;if(!p||p.nodeType!=1||p.contentEditable=="false"||/^(BR|IMG)$/.test(p.nodeName))break;s=p}s.insertBefore(a,s.firstChild),i==a&&r.domSelection().collapse(a,n)}else a.parentNode.removeChild(a)}}function gR(r,e,t){let{node:i,fromOffset:n,toOffset:a,from:l,to:s}=r.docView.parseRange(e,t),p=r.domSelectionRange(),d,c=p.anchorNode;if(c&&r.dom.contains(c.nodeType==1?c:c.parentNode)&&(d=[{node:c,offset:p.anchorOffset}],Sa(p)||d.push({node:p.focusNode,offset:p.focusOffset})),Ue&&r.input.lastKeyCode===8)for(let h=a;h>n;h--){let f=i.childNodes[h-1],w=f.pmViewDesc;if(f.nodeName=="BR"&&!w){a=h;break}if(!w||w.size)break}let b=r.state.doc,m=r.someProp("domParser")||Wi.fromSchema(r.state.schema),g=b.resolve(l),x=null,u=m.parse(i,{topNode:g.parent,topMatch:g.parent.contentMatchAt(g.index()),topOpen:!0,from:n,to:a,preserveWhitespace:g.parent.type.whitespace=="pre"?"full":!0,findPositions:d,ruleFromNode:uR,context:g});if(d&&d[0].pos!=null){let h=d[0].pos,f=d[1]&&d[1].pos;f==null&&(f=h),x={anchor:h+l,head:f+l}}return{doc:u,sel:x,from:l,to:s}}function uR(r){let e=r.pmViewDesc;if(e)return e.parseRule();if(r.nodeName=="BR"&&r.parentNode){if(at&&/^(ul|ol)$/i.test(r.parentNode.nodeName)){let t=document.createElement("div");return t.appendChild(document.createElement("li")),{skip:t}}else if(r.parentNode.lastChild==r||at&&/^(tr|table)$/i.test(r.parentNode.nodeName))return{ignore:!0}}else if(r.nodeName=="IMG"&&r.getAttribute("mark-placeholder"))return{ignore:!0};return null}const xR=/^(a|abbr|acronym|b|bd[io]|big|br|button|cite|code|data(list)?|del|dfn|em|i|img|ins|kbd|label|map|mark|meter|output|q|ruby|s|samp|small|span|strong|su[bp]|time|u|tt|var)$/i;function hR(r,e,t,i,n){let a=r.input.compositionPendingChanges||(r.composing?r.input.compositionID:0);if(r.input.compositionPendingChanges=0,e<0){let v=r.input.lastSelectionTime>Date.now()-50?r.input.lastSelectionOrigin:null,M=ap(r,v);if(M&&!r.state.selection.eq(M)){if(Ue&&xr&&r.input.lastKeyCode===13&&Date.now()-100<r.input.lastKeyCodeTime&&r.someProp("handleKeyDown",k=>k(r,Po(13,"Enter"))))return;let C=r.state.tr.setSelection(M);v=="pointer"?C.setMeta("pointer",!0):v=="key"&&C.scrollIntoView(),a&&C.setMeta("composition",a),r.dispatch(C)}return}let l=r.state.doc.resolve(e),s=l.sharedDepth(t);e=l.before(s+1),t=r.state.doc.resolve(t).after(s+1);let p=r.state.selection,d=gR(r,e,t),c=r.state.doc,b=c.slice(d.from,d.to),m,g;r.input.lastKeyCode===8&&Date.now()-100<r.input.lastKeyCodeTime?(m=r.state.selection.to,g="end"):(m=r.state.selection.from,g="start"),r.input.lastKeyCode=null;let x=wR(b.content,d.doc.content,d.from,m,g);if(x&&r.input.domChangeCount++,(li&&r.input.lastIOSEnter>Date.now()-225||xr)&&n.some(v=>v.nodeType==1&&!xR.test(v.nodeName))&&(!x||x.endA>=x.endB)&&r.someProp("handleKeyDown",v=>v(r,Po(13,"Enter")))){r.input.lastIOSEnter=0;return}if(!x)if(i&&p instanceof pe&&!p.empty&&p.$head.sameParent(p.$anchor)&&!r.composing&&!(d.sel&&d.sel.anchor!=d.sel.head))x={start:p.from,endA:p.to,endB:p.to};else{if(d.sel){let v=MA(r,r.state.doc,d.sel);if(v&&!v.eq(r.state.selection)){let M=r.state.tr.setSelection(v);a&&M.setMeta("composition",a),r.dispatch(M)}}return}r.state.selection.from<r.state.selection.to&&x.start==x.endB&&r.state.selection instanceof pe&&(x.start>r.state.selection.from&&x.start<=r.state.selection.from+2&&r.state.selection.from>=d.from?x.start=r.state.selection.from:x.endA<r.state.selection.to&&x.endA>=r.state.selection.to-2&&r.state.selection.to<=d.to&&(x.endB+=r.state.selection.to-x.endA,x.endA=r.state.selection.to)),Pt&&jr<=11&&x.endB==x.start+1&&x.endA==x.start&&x.start>d.from&&d.doc.textBetween(x.start-d.from-1,x.start-d.from+1)=="  "&&(x.start--,x.endA--,x.endB--);let u=d.doc.resolveNoCache(x.start-d.from),h=d.doc.resolveNoCache(x.endB-d.from),f=c.resolve(x.start),w=u.sameParent(h)&&u.parent.inlineContent&&f.end()>=x.endA;if((li&&r.input.lastIOSEnter>Date.now()-225&&(!w||n.some(v=>v.nodeName=="DIV"||v.nodeName=="P"))||!w&&u.pos<d.doc.content.size&&(!u.sameParent(h)||!u.parent.inlineContent)&&u.pos<h.pos&&!/\S/.test(d.doc.textBetween(u.pos,h.pos,"","")))&&r.someProp("handleKeyDown",v=>v(r,Po(13,"Enter")))){r.input.lastIOSEnter=0;return}if(r.state.selection.anchor>x.start&&yR(c,x.start,x.endA,u,h)&&r.someProp("handleKeyDown",v=>v(r,Po(8,"Backspace")))){xr&&Ue&&r.domObserver.suppressSelectionUpdates();return}Ue&&x.endB==x.start&&(r.input.lastChromeDelete=Date.now()),xr&&!w&&u.start()!=h.start()&&h.parentOffset==0&&u.depth==h.depth&&d.sel&&d.sel.anchor==d.sel.head&&d.sel.head==x.endA&&(x.endB-=2,h=d.doc.resolveNoCache(x.endB-d.from),setTimeout(()=>{r.someProp("handleKeyDown",function(v){return v(r,Po(13,"Enter"))})},20));let y=x.start,E=x.endA,S=v=>{let M=v||r.state.tr.replace(y,E,d.doc.slice(x.start-d.from,x.endB-d.from));if(d.sel){let C=MA(r,M.doc,d.sel);C&&!(Ue&&r.composing&&C.empty&&(x.start!=x.endB||r.input.lastChromeDelete<Date.now()-100)&&(C.head==y||C.head==M.mapping.map(E)-1)||Pt&&C.empty&&C.head==y)&&M.setSelection(C)}return a&&M.setMeta("composition",a),M.scrollIntoView()},P;if(w)if(u.pos==h.pos){Pt&&jr<=11&&u.parentOffset==0&&(r.domObserver.suppressSelectionUpdates(),setTimeout(()=>fr(r),20));let v=S(r.state.tr.delete(y,E)),M=c.resolve(x.start).marksAcross(c.resolve(x.endA));M&&v.ensureMarks(M),r.dispatch(v)}else if(x.endA==x.endB&&(P=fR(u.parent.content.cut(u.parentOffset,h.parentOffset),f.parent.content.cut(f.parentOffset,x.endA-f.start())))){let v=S(r.state.tr);P.type=="add"?v.addMark(y,E,P.mark):v.removeMark(y,E,P.mark),r.dispatch(v)}else if(u.parent.child(u.index()).isText&&u.index()==h.index()-(h.textOffset?0:1)){let v=u.parent.textBetween(u.parentOffset,h.parentOffset),M=()=>S(r.state.tr.insertText(v,y,E));r.someProp("handleTextInput",C=>C(r,y,E,v,M))||r.dispatch(M())}else r.dispatch(S());else r.dispatch(S())}function MA(r,e,t){return Math.max(t.anchor,t.head)>e.content.size?null:sp(r,e.resolve(t.anchor),e.resolve(t.head))}function fR(r,e){let t=r.firstChild.marks,i=e.firstChild.marks,n=t,a=i,l,s,p;for(let c=0;c<i.length;c++)n=i[c].removeFromSet(n);for(let c=0;c<t.length;c++)a=t[c].removeFromSet(a);if(n.length==1&&a.length==0)s=n[0],l="add",p=c=>c.mark(s.addToSet(c.marks));else if(n.length==0&&a.length==1)s=a[0],l="remove",p=c=>c.mark(s.removeFromSet(c.marks));else return null;let d=[];for(let c=0;c<e.childCount;c++)d.push(p(e.child(c)));if(G.from(d).eq(r))return{mark:s,type:l}}function yR(r,e,t,i,n){if(t-e<=n.pos-i.pos||vp(i,!0,!1)<n.pos)return!1;let a=r.resolve(e);if(!i.parent.isTextblock){let s=a.nodeAfter;return s!=null&&t==e+s.nodeSize}if(a.parentOffset<a.parent.content.size||!a.parent.isTextblock)return!1;let l=r.resolve(vp(a,!0,!0));return!l.parent.isTextblock||l.pos>t||vp(l,!0,!1)<t?!1:i.parent.content.cut(i.parentOffset).eq(l.parent.content)}function vp(r,e,t){let i=r.depth,n=e?r.end():r.pos;for(;i>0&&(e||r.indexAfter(i)==r.node(i).childCount);)i--,n++,e=!1;if(t){let a=r.node(i).maybeChild(r.indexAfter(i));for(;a&&!a.isLeaf;)a=a.firstChild,n++}return n}function wR(r,e,t,i,n){let a=r.findDiffStart(e,t),l=t+r.size,s=t+e.size;if(a==null)return null;let{a:p,b:d}=r.findDiffEnd(e,l,s);if(n=="end"){let c=Math.max(0,a-Math.min(p,d));i-=p+c-a}if(p<a&&l<s){let c=i<=a&&i>=p?a-i:0;a-=c,d=a+(d-p),p=a}else if(d<a){let c=i<=a&&i>=d?a-i:0;a-=c,p=a+(p-d),d=a}return{start:a,endA:p,endB:d}}class PA{constructor(e,t){this._root=null,this.focused=!1,this.trackWrites=null,this.mounted=!1,this.markCursor=null,this.cursorWrapper=null,this.lastSelectedViewDesc=void 0,this.input=new IH,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=t,this.state=t.state,this.directPlugins=t.plugins||[],this.directPlugins.forEach(_A),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=NA(this),LA(this),this.nodeViews=AA(this),this.docView=HN(this.state.doc,BA(this),wp(this),this.dom,this),this.domObserver=new pR(this,(i,n,a,l)=>hR(this,i,n,a,l)),this.domObserver.start(),VH(this),this.updatePluginViews()}get composing(){return this.input.composing}get props(){if(this._props.state!=this.state){let e=this._props;this._props={};for(let t in e)this._props[t]=e[t];this._props.state=this.state}return this._props}update(e){e.handleDOMEvents!=this._props.handleDOMEvents&&gp(this);let t=this._props;this._props=e,e.plugins&&(e.plugins.forEach(_A),this.directPlugins=e.plugins),this.updateStateInner(e.state,t)}setProps(e){let t={};for(let i in this._props)t[i]=this._props[i];t.state=this.state;for(let i in e)t[i]=e[i];this.update(t)}updateState(e){this.updateStateInner(e,this._props)}updateStateInner(e,t){var i;let n=this.state,a=!1,l=!1;e.storedMarks&&this.composing&&(xA(this),l=!0),this.state=e;let s=n.plugins!=e.plugins||this._props.plugins!=t.plugins;if(s||this._props.plugins!=t.plugins||this._props.nodeViews!=t.nodeViews){let g=AA(this);kR(g,this.nodeViews)&&(this.nodeViews=g,a=!0)}(s||t.handleDOMEvents!=this._props.handleDOMEvents)&&gp(this),this.editable=NA(this),LA(this);let p=wp(this),d=BA(this),c=n.plugins!=e.plugins&&!n.doc.eq(e.doc)?"reset":e.scrollToSelection>n.scrollToSelection?"to selection":"preserve",b=a||!this.docView.matchesNode(e.doc,d,p);(b||!e.selection.eq(n.selection))&&(l=!0);let m=c=="preserve"&&l&&this.dom.style.overflowAnchor==null&&XV(this);if(l){this.domObserver.stop();let g=b&&(Pt||Ue)&&!this.composing&&!n.selection.empty&&!e.selection.empty&&vR(n.selection,e.selection);if(b){let u=Ue?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=ZH(this)),(a||!this.docView.update(e.doc,d,p,this))&&(this.docView.updateOuterDeco(d),this.docView.destroy(),this.docView=HN(e.doc,d,p,this.dom,this)),u&&(!this.trackWrites||!this.dom.contains(this.trackWrites))&&(g=!0)}let x=this.input.mouseDown;g||!(x&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&vH(this)&&x.delaySelUpdate())?fr(this,g):(JN(this,e.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(n),!((i=this.dragging)===null||i===void 0)&&i.node&&!n.doc.eq(e.doc)&&this.updateDraggedNode(this.dragging,n),c=="reset"?this.dom.scrollTop=0:c=="to selection"?this.scrollToSelection():m&&ZV(m)}scrollToSelection(){let e=this.domSelectionRange().focusNode;if(!(!e||!this.dom.contains(e.nodeType==1?e:e.parentNode))){if(!this.someProp("handleScrollToSelection",t=>t(this)))if(this.state.selection instanceof ae){let t=this.docView.domAfterPos(this.state.selection.from);t.nodeType==1&&TN(this,t.getBoundingClientRect(),e)}else TN(this,this.coordsAtPos(this.state.selection.head,1),e)}}destroyPluginViews(){let e;for(;e=this.pluginViews.pop();)e.destroy&&e.destroy()}updatePluginViews(e){if(!e||e.plugins!=this.state.plugins||this.directPlugins!=this.prevDirectPlugins){this.prevDirectPlugins=this.directPlugins,this.destroyPluginViews();for(let t=0;t<this.directPlugins.length;t++){let i=this.directPlugins[t];i.spec.view&&this.pluginViews.push(i.spec.view(this))}for(let t=0;t<this.state.plugins.length;t++){let i=this.state.plugins[t];i.spec.view&&this.pluginViews.push(i.spec.view(this))}}else for(let t=0;t<this.pluginViews.length;t++){let i=this.pluginViews[t];i.update&&i.update(this,e)}}updateDraggedNode(e,t){let i=e.node,n=-1;if(i.from<this.state.doc.content.size&&this.state.doc.nodeAt(i.from)==i.node)n=i.from;else{let a=i.from+(this.state.doc.content.size-t.doc.content.size);(a>0&&a<this.state.doc.content.size&&this.state.doc.nodeAt(a))==i.node&&(n=a)}this.dragging=new fA(e.slice,e.move,n<0?void 0:ae.create(this.state.doc,n))}someProp(e,t){let i=this._props&&this._props[e],n;if(i!=null&&(n=t?t(i):i))return n;for(let l=0;l<this.directPlugins.length;l++){let s=this.directPlugins[l].props[e];if(s!=null&&(n=t?t(s):s))return n}let a=this.state.plugins;if(a)for(let l=0;l<a.length;l++){let s=a[l].props[e];if(s!=null&&(n=t?t(s):s))return n}}hasFocus(){if(Pt){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&&$V(this.dom),fr(this),this.domObserver.start()}get root(){let e=this._root;if(e==null){for(let t=this.dom.parentNode;t;t=t.parentNode)if(t.nodeType==9||t.nodeType==11&&t.host)return t.getSelection||(Object.getPrototypeOf(t).getSelection=()=>t.ownerDocument.getSelection()),this._root=t}return e||document}updateRoot(){this._root=null}posAtCoords(e){return iH(this,e)}coordsAtPos(e,t=1){return NN(this,e,t)}domAtPos(e,t=0){return this.docView.domFromPos(e,t)}nodeDOM(e){let t=this.docView.descAt(e);return t?t.nodeDOM:null}posAtDOM(e,t,i=-1){let n=this.docView.posFromDOM(e,t,i);if(n==null)throw new RangeError("DOM position not inside the editor");return n}endOfTextblock(e,t){return pH(this,t||this.state,e)}pasteHTML(e,t){return sn(this,"",e,!1,t||new ClipboardEvent("paste"))}pasteText(e,t){return sn(this,e,null,!0,t||new ClipboardEvent("paste"))}serializeForClipboard(e){return cp(this,e)}destroy(){this.docView&&(HH(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],wp(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,FV())}get isDestroyed(){return this.docView==null}dispatchEvent(e){return OH(this,e)}domSelectionRange(){let e=this.domSelection();return e?at&&this.root.nodeType===11&&GV(this.dom.ownerDocument)==this.dom&&cR(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}PA.prototype.dispatch=function(r){let e=this._props.dispatchTransaction;e?e.call(this,r):this.updateState(this.state.apply(r))};function BA(r){let e=Object.create(null);return e.class="ProseMirror",e.contenteditable=String(r.editable),r.someProp("attributes",t=>{if(typeof t=="function"&&(t=t(r.state)),t)for(let i in t)i=="class"?e.class+=" "+t[i]:i=="style"?e.style=(e.style?e.style+";":"")+t[i]:!e[i]&&i!="contenteditable"&&i!="nodeName"&&(e[i]=String(t[i]))}),e.translate||(e.translate="no"),[ft.node(0,r.state.doc.content.size,e)]}function LA(r){if(r.markCursor){let e=document.createElement("img");e.className="ProseMirror-separator",e.setAttribute("mark-placeholder","true"),e.setAttribute("alt",""),r.cursorWrapper={dom:e,deco:ft.widget(r.state.selection.from,e,{raw:!0,marks:r.markCursor})}}else r.cursorWrapper=null}function NA(r){return!r.someProp("editable",e=>e(r.state)===!1)}function vR(r,e){let t=Math.min(r.$anchor.sharedDepth(r.head),e.$anchor.sharedDepth(e.head));return r.$anchor.start(t)!=e.$anchor.start(t)}function AA(r){let e=Object.create(null);function t(i){for(let n in i)Object.prototype.hasOwnProperty.call(e,n)||(e[n]=i[n])}return r.someProp("nodeViews",t),r.someProp("markViews",t),e}function kR(r,e){let t=0,i=0;for(let n in r){if(r[n]!=e[n])return!0;t++}for(let n in e)i++;return t!=i}function _A(r){if(r.spec.state||r.spec.filterTransaction||r.spec.appendTransaction)throw new RangeError("Plugins passed directly to the view must not have a state component")}for(var Yr={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:"'"},La={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},SR=typeof navigator<"u"&&/Mac/.test(navigator.platform),CR=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),et=0;et<10;et++)Yr[48+et]=Yr[96+et]=String(et);for(var et=1;et<=24;et++)Yr[et+111]="F"+et;for(var et=65;et<=90;et++)Yr[et]=String.fromCharCode(et+32),La[et]=String.fromCharCode(et);for(var kp in Yr)La.hasOwnProperty(kp)||(La[kp]=Yr[kp]);function TR(r){var e=SR&&r.metaKey&&r.shiftKey&&!r.ctrlKey&&!r.altKey||CR&&r.shiftKey&&r.key&&r.key.length==1||r.key=="Unidentified",t=!e&&r.key||(r.shiftKey?La:Yr)[r.keyCode]||r.key||"Unidentified";return t=="Esc"&&(t="Escape"),t=="Del"&&(t="Delete"),t=="Left"&&(t="ArrowLeft"),t=="Up"&&(t="ArrowUp"),t=="Right"&&(t="ArrowRight"),t=="Down"&&(t="ArrowDown"),t}const ER=typeof navigator<"u"&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),MR=typeof navigator<"u"&&/Win/.test(navigator.platform);function PR(r){let e=r.split(/-(?!$)/),t=e[e.length-1];t=="Space"&&(t=" ");let i,n,a,l;for(let s=0;s<e.length-1;s++){let p=e[s];if(/^(cmd|meta|m)$/i.test(p))l=!0;else if(/^a(lt)?$/i.test(p))i=!0;else if(/^(c|ctrl|control)$/i.test(p))n=!0;else if(/^s(hift)?$/i.test(p))a=!0;else if(/^mod$/i.test(p))ER?l=!0:n=!0;else throw new Error("Unrecognized modifier name: "+p)}return i&&(t="Alt-"+t),n&&(t="Ctrl-"+t),l&&(t="Meta-"+t),a&&(t="Shift-"+t),t}function BR(r){let e=Object.create(null);for(let t in r)e[PR(t)]=r[t];return e}function Sp(r,e,t=!0){return e.altKey&&(r="Alt-"+r),e.ctrlKey&&(r="Ctrl-"+r),e.metaKey&&(r="Meta-"+r),t&&e.shiftKey&&(r="Shift-"+r),r}function LR(r){return new Me({props:{handleKeyDown:DA(r)}})}function DA(r){let e=BR(r);return function(t,i){let n=TR(i),a,l=e[Sp(n,i)];if(l&&l(t.state,t.dispatch,t))return!0;if(n.length==1&&n!=" "){if(i.shiftKey){let s=e[Sp(n,i,!1)];if(s&&s(t.state,t.dispatch,t))return!0}if((i.altKey||i.metaKey||i.ctrlKey)&&!(MR&&i.ctrlKey&&i.altKey)&&(a=Yr[i.keyCode])&&a!=n){let s=e[Sp(a,i)];if(s&&s(t.state,t.dispatch,t))return!0}}return!1}}var NR=Object.defineProperty,Cp=(r,e)=>{for(var t in e)NR(r,t,{get:e[t],enumerable:!0})};function Na(r){const{state:e,transaction:t}=r;let{selection:i}=t,{doc:n}=t,{storedMarks:a}=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 a},get selection(){return i},get doc(){return n},get tr(){return i=t.selection,n=t.doc,a=t.storedMarks,t}}}var Aa=class{constructor(r){this.editor=r.editor,this.rawCommands=this.editor.extensionManager.commands,this.customState=r.state}get hasCustomState(){return!!this.customState}get state(){return this.customState||this.editor.state}get commands(){const{rawCommands:r,editor:e,state:t}=this,{view:i}=e,{tr:n}=t,a=this.buildProps(n);return Object.fromEntries(Object.entries(r).map(([l,s])=>[l,(...d)=>{const c=s(...d)(a);return!n.getMeta("preventDispatch")&&!this.hasCustomState&&i.dispatch(n),c}]))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(r,e=!0){const{rawCommands:t,editor:i,state:n}=this,{view:a}=i,l=[],s=!!r,p=r||n.tr,d=()=>(!s&&e&&!p.getMeta("preventDispatch")&&!this.hasCustomState&&a.dispatch(p),l.every(b=>b===!0)),c={...Object.fromEntries(Object.entries(t).map(([b,m])=>[b,(...x)=>{const u=this.buildProps(p,e),h=m(...x)(u);return l.push(h),c}])),run:d};return c}createCan(r){const{rawCommands:e,state:t}=this,i=!1,n=r||t.tr,a=this.buildProps(n,i);return{...Object.fromEntries(Object.entries(e).map(([s,p])=>[s,(...d)=>p(...d)({...a,dispatch:void 0})])),chain:()=>this.createChain(n,i)}}buildProps(r,e=!0){const{rawCommands:t,editor:i,state:n}=this,{view:a}=i,l={tr:r,editor:i,view:a,state:Na({state:n,transaction:r}),dispatch:e?()=>{}:void 0,chain:()=>this.createChain(r,e),can:()=>this.createCan(r),get commands(){return Object.fromEntries(Object.entries(t).map(([s,p])=>[s,(...d)=>p(...d)(l)]))}};return l}},zA={};Cp(zA,{blur:()=>AR,clearContent:()=>_R,clearNodes:()=>DR,command:()=>zR,createParagraphNear:()=>IR,cut:()=>VR,deleteCurrentNode:()=>HR,deleteNode:()=>RR,deleteRange:()=>OR,deleteSelection:()=>qR,enter:()=>UR,exitCode:()=>WR,extendMarkRange:()=>GR,first:()=>KR,focus:()=>YR,forEach:()=>QR,insertContent:()=>XR,insertContentAt:()=>eO,joinBackward:()=>oO,joinDown:()=>rO,joinForward:()=>iO,joinItemBackward:()=>nO,joinItemForward:()=>aO,joinTextblockBackward:()=>lO,joinTextblockForward:()=>sO,joinUp:()=>tO,keyboardShortcut:()=>dO,lift:()=>cO,liftEmptyBlock:()=>bO,liftListItem:()=>mO,newlineInCode:()=>gO,resetAttributes:()=>uO,scrollIntoView:()=>xO,selectAll:()=>hO,selectNodeBackward:()=>fO,selectNodeForward:()=>yO,selectParentNode:()=>wO,selectTextblockEnd:()=>vO,selectTextblockStart:()=>kO,setContent:()=>SO,setMark:()=>UO,setMeta:()=>WO,setNode:()=>GO,setNodeSelection:()=>KO,setTextDirection:()=>JO,setTextSelection:()=>YO,sinkListItem:()=>QO,splitBlock:()=>XO,splitListItem:()=>ZO,toggleList:()=>eF,toggleMark:()=>tF,toggleNode:()=>rF,toggleWrap:()=>oF,undoInputRule:()=>iF,unsetAllMarks:()=>nF,unsetMark:()=>aF,unsetTextDirection:()=>lF,updateAttributes:()=>sF,wrapIn:()=>pF,wrapInList:()=>dF});var AR=()=>({editor:r,view:e})=>(requestAnimationFrame(()=>{var t;r.isDestroyed||(e.dom.blur(),(t=window==null?void 0:window.getSelection())==null||t.removeAllRanges())}),!0),_R=(r=!0)=>({commands:e})=>e.setContent("",{emitUpdate:r}),DR=()=>({state:r,tr:e,dispatch:t})=>{const{selection:i}=e,{ranges:n}=i;return t&&n.forEach(({$from:a,$to:l})=>{r.doc.nodesBetween(a.pos,l.pos,(s,p)=>{if(s.type.isText)return;const{doc:d,mapping:c}=e,b=d.resolve(c.map(p)),m=d.resolve(c.map(p+s.nodeSize)),g=b.blockRange(m);if(!g)return;const x=ti(g);if(s.type.isTextblock){const{defaultType:u}=b.parent.contentMatchAt(b.index());e.setNodeMarkup(g.start,u)}(x||x===0)&&e.lift(g,x)})}),!0},zR=r=>e=>r(e),IR=()=>({state:r,dispatch:e})=>uN(r,e),VR=(r,e)=>({editor:t,tr:i})=>{const{state:n}=t,a=n.doc.slice(r.from,r.to);i.deleteRange(r.from,r.to);const l=i.mapping.map(e);return i.insert(l,a.content),i.setSelection(new pe(i.doc.resolve(Math.max(l-1,0)))),!0},HR=()=>({tr:r,dispatch:e})=>{const{selection:t}=r,i=t.$anchor.node();if(i.content.size>0)return!1;const n=r.selection.$anchor;for(let a=n.depth;a>0;a-=1)if(n.node(a).type===i.type){if(e){const s=n.before(a),p=n.after(a);r.delete(s,p).scrollIntoView()}return!0}return!1};function Ie(r,e){if(typeof r=="string"){if(!e.nodes[r])throw Error(`There is no node type named '${r}'. Maybe you forgot to add the extension?`);return e.nodes[r]}return r}var RR=r=>({tr:e,state:t,dispatch:i})=>{const n=Ie(r,t.schema),a=e.selection.$anchor;for(let l=a.depth;l>0;l-=1)if(a.node(l).type===n){if(i){const p=a.before(l),d=a.after(l);e.delete(p,d).scrollIntoView()}return!0}return!1},OR=r=>({tr:e,dispatch:t})=>{const{from:i,to:n}=r;return t&&e.delete(i,n),!0},FR=r=>r.content?/^text(\*|\+)/.test(r.content):!1,IA=(r,e,t)=>{if(!r.parent.isInline||t==="left"&&r.pos>r.start()||t==="right"&&r.pos<r.end())return r.pos;const i=e.nodes[r.parent.type.name].spec;return FR(i)?t==="left"?r.start()-1:r.end()+1:r.pos},jR=(r,e,t)=>{const i=IA(r,t,"left"),n=IA(e,t,"right");return{from:i,to:n}},qR=()=>({state:r,dispatch:e})=>{const{$from:t,$to:i}=r.selection;if(r.selection.empty)return!1;const{from:n,to:a}=jR(t,i,r.schema);return e&&(r.tr.deleteRange(n,a).scrollIntoView(),e(r.tr)),!0},UR=()=>({commands:r})=>r.keyboardShortcut("Enter"),WR=()=>({state:r,dispatch:e})=>EV(r,e);function Tp(r){return Object.prototype.toString.call(r)==="[object RegExp]"}function _a(r,e,t={strict:!0}){const i=Object.keys(e);return i.length?i.every(n=>t.strict?e[n]===r[n]:Tp(e[n])?e[n].test(r[n]):e[n]===r[n]):!0}function VA(r,e,t={}){return r.find(i=>i.type===e&&_a(Object.fromEntries(Object.keys(t).map(n=>[n,i.attrs[n]])),t))}function HA(r,e,t={}){return!!VA(r,e,t)}function Ep(r,e,t){if(!r||!e)return;let i=r.parent.childAfter(r.parentOffset);if((!i.node||!i.node.marks.some(d=>d.type===e))&&(i=r.parent.childBefore(r.parentOffset)),!i.node||!i.node.marks.some(d=>d.type===e))return;if(!t){const d=i.node.marks.find(c=>c.type===e);d&&(t=d.attrs)}if(!VA([...i.node.marks],e,t))return;let a=i.index,l=r.start()+i.offset,s=a+1,p=l+i.node.nodeSize;for(;a>0&&HA([...r.parent.child(a-1).marks],e,t);)a-=1,l-=r.parent.child(a).nodeSize;for(;s<r.parent.childCount&&HA([...r.parent.child(s).marks],e,t);)p+=r.parent.child(s).nodeSize,s+=1;return{from:l,to:p}}function wr(r,e){if(typeof r=="string"){if(!e.marks[r])throw Error(`There is no mark type named '${r}'. Maybe you forgot to add the extension?`);return e.marks[r]}return r}var GR=(r,e)=>({tr:t,state:i,dispatch:n})=>{const a=wr(r,i.schema),{doc:l,selection:s}=t,{$from:p,from:d,to:c}=s;if(n){const b=Ep(p,a,e);if(b&&b.from<=d&&b.to>=c){const m=pe.create(l,b.from,b.to);t.setSelection(m)}}return!0},KR=r=>e=>{const t=typeof r=="function"?r(e):r;for(let i=0;i<t.length;i+=1)if(t[i](e))return!0;return!1};function RA(r){return r instanceof pe}function _o(r=0,e=0,t=0){return Math.min(Math.max(r,e),t)}function OA(r,e=null){if(!e)return null;const t=de.atStart(r),i=de.atEnd(r);if(e==="start"||e===!0)return t;if(e==="end")return i;const n=t.from,a=i.to;return e==="all"?pe.create(r,_o(0,n,a),_o(r.content.size,n,a)):pe.create(r,_o(e,n,a),_o(e,n,a))}function FA(){return navigator.platform==="Android"||/android/i.test(navigator.userAgent)}function Da(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}function JR(){return typeof navigator<"u"?/^((?!chrome|android).)*safari/i.test(navigator.userAgent):!1}var YR=(r=null,e={})=>({editor:t,view:i,tr:n,dispatch:a})=>{e={scrollIntoView:!0,...e};const l=()=>{(Da()||FA())&&i.dom.focus(),JR()&&!Da()&&!FA()&&i.dom.focus({preventScroll:!0}),requestAnimationFrame(()=>{t.isDestroyed||(i.focus(),e!=null&&e.scrollIntoView&&t.commands.scrollIntoView())})};try{if(i.hasFocus()&&r===null||r===!1)return!0}catch{return!1}if(a&&r===null&&!RA(t.state.selection))return l(),!0;const s=OA(n.doc,r)||t.state.selection,p=t.state.selection.eq(s);return a&&(p||n.setSelection(s),p&&n.storedMarks&&n.setStoredMarks(n.storedMarks),l()),!0},QR=(r,e)=>t=>r.every((i,n)=>e(i,{...t,index:n})),XR=(r,e)=>({tr:t,commands:i})=>i.insertContentAt({from:t.selection.from,to:t.selection.to},r,e),jA=r=>{const e=r.childNodes;for(let t=e.length-1;t>=0;t-=1){const i=e[t];i.nodeType===3&&i.nodeValue&&/^(\n\s\s|\n)$/.test(i.nodeValue)?r.removeChild(i):i.nodeType===1&&jA(i)}return r};function za(r){if(typeof window>"u")throw new Error("[tiptap error]: there is no window object available, so this function cannot be used");const e=`<body>${r}</body>`,t=new window.DOMParser().parseFromString(e,"text/html").body;return jA(t)}function dn(r,e,t){if(r instanceof Rr||r instanceof G)return r;t={slice:!0,parseOptions:{},...t};const i=typeof r=="object"&&r!==null,n=typeof r=="string";if(i)try{if(Array.isArray(r)&&r.length>0)return G.fromArray(r.map(s=>e.nodeFromJSON(s)));const l=e.nodeFromJSON(r);return t.errorOnInvalidContent&&l.check(),l}catch(a){if(t.errorOnInvalidContent)throw new Error("[tiptap error]: Invalid JSON content",{cause:a});return console.warn("[tiptap warn]: Invalid content.","Passed value:",r,"Error:",a),dn("",e,t)}if(n){if(t.errorOnInvalidContent){let l=!1,s="";const p=new SL({topNode:e.spec.topNode,marks:e.spec.marks,nodes:e.spec.nodes.append({__tiptap__private__unknown__catch__all__node:{content:"inline*",group:"block",parseDOM:[{tag:"*",getAttrs:d=>(l=!0,s=typeof d=="string"?d:d.outerHTML,null)}]}})});if(t.slice?Wi.fromSchema(p).parseSlice(za(r),t.parseOptions):Wi.fromSchema(p).parse(za(r),t.parseOptions),t.errorOnInvalidContent&&l)throw new Error("[tiptap error]: Invalid HTML content",{cause:new Error(`Invalid element found: ${s}`)})}const a=Wi.fromSchema(e);return t.slice?a.parseSlice(za(r),t.parseOptions).content:a.parse(za(r),t.parseOptions)}return dn("",e,t)}function ZR(r,e,t){const i=r.steps.length-1;if(i<e)return;const n=r.steps[i];if(!(n instanceof _t||n instanceof Mt))return;const a=r.mapping.maps[i];let l=0;a.forEach((s,p,d,c)=>{l===0&&(l=c)}),r.setSelection(de.near(r.doc.resolve(l),t))}var $R=r=>!("type"in r),eO=(r,e,t)=>({tr:i,dispatch:n,editor:a})=>{var l;if(n){t={parseOptions:a.options.parseOptions,updateSelection:!0,applyInputRules:!1,applyPasteRules:!1,...t};let s;const p=h=>{a.emit("contentError",{editor:a,error:h,disableCollaboration:()=>{"collaboration"in a.storage&&typeof a.storage.collaboration=="object"&&a.storage.collaboration&&(a.storage.collaboration.isDisabled=!0)}})},d={preserveWhitespace:"full",...t.parseOptions};if(!t.errorOnInvalidContent&&!a.options.enableContentCheck&&a.options.emitContentError)try{dn(e,a.schema,{parseOptions:d,errorOnInvalidContent:!0})}catch(h){p(h)}try{s=dn(e,a.schema,{parseOptions:d,errorOnInvalidContent:(l=t.errorOnInvalidContent)!=null?l:a.options.enableContentCheck})}catch(h){return p(h),!1}let{from:c,to:b}=typeof r=="number"?{from:r,to:r}:{from:r.from,to:r.to},m=!0,g=!0;if(($R(s)?s:[s]).forEach(h=>{h.check(),m=m?h.isText&&h.marks.length===0:!1,g=g?h.isBlock:!1}),c===b&&g){const{parent:h}=i.doc.resolve(c);h.isTextblock&&!h.type.spec.code&&!h.childCount&&(c-=1,b+=1)}let u;if(m){if(Array.isArray(e))u=e.map(h=>h.text||"").join("");else if(e instanceof G){let h="";e.forEach(f=>{f.text&&(h+=f.text)}),u=h}else typeof e=="object"&&e&&e.text?u=e.text:u=e;i.insertText(u,c,b)}else{u=s;const h=i.doc.resolve(c),f=h.node(),w=h.parentOffset===0,y=f.isText||f.isTextblock,E=f.content.size>0;w&&y&&E&&g&&(c=Math.max(0,c-1)),i.replaceWith(c,b,u)}t.updateSelection&&ZR(i,i.steps.length-1,-1),t.applyInputRules&&i.setMeta("applyInputRules",{from:c,text:u}),t.applyPasteRules&&i.setMeta("applyPasteRules",{from:c,text:u})}return!0},tO=()=>({state:r,dispatch:e})=>SV(r,e),rO=()=>({state:r,dispatch:e})=>CV(r,e),oO=()=>({state:r,dispatch:e})=>sN(r,e),iO=()=>({state:r,dispatch:e})=>bN(r,e),nO=()=>({state:r,dispatch:e,tr:t})=>{try{const i=wa(r.doc,r.selection.$from.pos,-1);return i==null?!1:(t.join(i,2),e&&e(t),!0)}catch{return!1}},aO=()=>({state:r,dispatch:e,tr:t})=>{try{const i=wa(r.doc,r.selection.$from.pos,1);return i==null?!1:(t.join(i,2),e&&e(t),!0)}catch{return!1}},lO=()=>({state:r,dispatch:e})=>vV(r,e),sO=()=>({state:r,dispatch:e})=>kV(r,e);function qA(){return typeof navigator<"u"?/Mac/.test(navigator.platform):!1}function pO(r){const e=r.split(/-(?!$)/);let t=e[e.length-1];t==="Space"&&(t=" ");let i,n,a,l;for(let s=0;s<e.length-1;s+=1){const p=e[s];if(/^(cmd|meta|m)$/i.test(p))l=!0;else if(/^a(lt)?$/i.test(p))i=!0;else if(/^(c|ctrl|control)$/i.test(p))n=!0;else if(/^s(hift)?$/i.test(p))a=!0;else if(/^mod$/i.test(p))Da()||qA()?l=!0:n=!0;else throw new Error(`Unrecognized modifier name: ${p}`)}return i&&(t=`Alt-${t}`),n&&(t=`Ctrl-${t}`),l&&(t=`Meta-${t}`),a&&(t=`Shift-${t}`),t}var dO=r=>({editor:e,view:t,tr:i,dispatch:n})=>{const a=pO(r).split(/-(?!$)/),l=a.find(d=>!["Alt","Ctrl","Meta","Shift"].includes(d)),s=new KeyboardEvent("keydown",{key:l==="Space"?" ":l,altKey:a.includes("Alt"),ctrlKey:a.includes("Ctrl"),metaKey:a.includes("Meta"),shiftKey:a.includes("Shift"),bubbles:!0,cancelable:!0}),p=e.captureTransaction(()=>{t.someProp("handleKeyDown",d=>d(t,s))});return p==null||p.steps.forEach(d=>{const c=d.map(i.mapping);c&&n&&i.maybeStep(c)}),!0};function Qr(r,e,t={}){const{from:i,to:n,empty:a}=r.selection,l=e?Ie(e,r.schema):null,s=[];r.doc.nodesBetween(i,n,(b,m)=>{if(b.isText)return;const g=Math.max(i,m),x=Math.min(n,m+b.nodeSize);s.push({node:b,from:g,to:x})});const p=n-i,d=s.filter(b=>l?l.name===b.node.type.name:!0).filter(b=>_a(b.node.attrs,t,{strict:!1}));return a?!!d.length:d.reduce((b,m)=>b+m.to-m.from,0)>=p}var cO=(r,e={})=>({state:t,dispatch:i})=>{const n=Ie(r,t.schema);return Qr(t,n,e)?TV(t,i):!1},bO=()=>({state:r,dispatch:e})=>xN(r,e),mO=r=>({state:e,dispatch:t})=>{const i=Ie(r,e.schema);return VV(i)(e,t)},gO=()=>({state:r,dispatch:e})=>gN(r,e);function Ia(r,e){return e.nodes[r]?"node":e.marks[r]?"mark":null}function UA(r,e){const t=typeof e=="string"?[e]:e;return Object.keys(r).reduce((i,n)=>(t.includes(n)||(i[n]=r[n]),i),{})}var uO=(r,e)=>({tr:t,state:i,dispatch:n})=>{let a=null,l=null;const s=Ia(typeof r=="string"?r:r.name,i.schema);if(!s)return!1;s==="node"&&(a=Ie(r,i.schema)),s==="mark"&&(l=wr(r,i.schema));let p=!1;return t.selection.ranges.forEach(d=>{i.doc.nodesBetween(d.$from.pos,d.$to.pos,(c,b)=>{a&&a===c.type&&(p=!0,n&&t.setNodeMarkup(b,void 0,UA(c.attrs,e))),l&&c.marks.length&&c.marks.forEach(m=>{l===m.type&&(p=!0,n&&t.addMark(b,b+c.nodeSize,l.create(UA(m.attrs,e))))})})}),p},xO=()=>({tr:r,dispatch:e})=>(e&&r.scrollIntoView(),!0),hO=()=>({tr:r,dispatch:e})=>{if(e){const t=new gr(r.doc);r.setSelection(t)}return!0},fO=()=>({state:r,dispatch:e})=>dN(r,e),yO=()=>({state:r,dispatch:e})=>mN(r,e),wO=()=>({state:r,dispatch:e})=>BV(r,e),vO=()=>({state:r,dispatch:e})=>AV(r,e),kO=()=>({state:r,dispatch:e})=>NV(r,e);function Mp(r,e,t={},i={}){return dn(r,e,{slice:!1,parseOptions:t,errorOnInvalidContent:i.errorOnInvalidContent})}var SO=(r,{errorOnInvalidContent:e,emitUpdate:t=!0,parseOptions:i={}}={})=>({editor:n,tr:a,dispatch:l,commands:s})=>{const{doc:p}=a;if(i.preserveWhitespace!=="full"){const d=Mp(r,n.schema,i,{errorOnInvalidContent:e??n.options.enableContentCheck});return l&&a.replaceWith(0,p.content.size,d).setMeta("preventUpdate",!t),!0}return l&&a.setMeta("preventUpdate",!t),s.insertContentAt({from:0,to:p.content.size},r,{parseOptions:i,errorOnInvalidContent:e??n.options.enableContentCheck})};function WA(r,e){const t=wr(e,r.schema),{from:i,to:n,empty:a}=r.selection,l=[];a?(r.storedMarks&&l.push(...r.storedMarks),l.push(...r.selection.$head.marks())):r.doc.nodesBetween(i,n,p=>{l.push(...p.marks)});const s=l.find(p=>p.type.name===t.name);return s?{...s.attrs}:{}}function GA(r,e){const t=new QL(r);return e.forEach(i=>{i.steps.forEach(n=>{t.step(n)})}),t}function CO(r){for(let e=0;e<r.edgeCount;e+=1){const{type:t}=r.edge(e);if(t.isTextblock&&!t.hasRequiredAttrs())return t}return null}function TO(r,e,t){const i=[];return r.nodesBetween(e.from,e.to,(n,a)=>{t(n)&&i.push({node:n,pos:a})}),i}function EO(r,e){for(let t=r.depth;t>0;t-=1){const i=r.node(t);if(e(i))return{pos:t>0?r.before(t):0,start:r.start(t),depth:t,node:i}}}function Va(r){return e=>EO(e.$from,r)}function te(r,e,t){return r.config[e]===void 0&&r.parent?te(r.parent,e,t):typeof r.config[e]=="function"?r.config[e].bind({...t,parent:r.parent?te(r.parent,e,t):null}):r.config[e]}function Pp(r){return r.map(e=>{const t={name:e.name,options:e.options,storage:e.storage},i=te(e,"addExtensions",t);return i?[e,...Pp(i())]:e}).flat(10)}function Bp(r,e){const t=To.fromSchema(e).serializeFragment(r),n=document.implementation.createHTMLDocument().createElement("div");return n.appendChild(t),n.innerHTML}function KA(r){return typeof r=="function"}function he(r,e=void 0,...t){return KA(r)?e?r.bind(e)(...t):r(...t):r}function MO(r={}){return Object.keys(r).length===0&&r.constructor===Object}function ci(r){const e=r.filter(n=>n.type==="extension"),t=r.filter(n=>n.type==="node"),i=r.filter(n=>n.type==="mark");return{baseExtensions:e,nodeExtensions:t,markExtensions:i}}function JA(r){const e=[],{nodeExtensions:t,markExtensions:i}=ci(r),n=[...t,...i],a={default:null,validate:void 0,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1},l=t.filter(d=>d.name!=="text").map(d=>d.name),s=i.map(d=>d.name),p=[...l,...s];return r.forEach(d=>{const c={name:d.name,options:d.options,storage:d.storage,extensions:n},b=te(d,"addGlobalAttributes",c);if(!b)return;b().forEach(g=>{let x;Array.isArray(g.types)?x=g.types:g.types==="*"?x=p:g.types==="nodes"?x=l:g.types==="marks"?x=s:x=[],x.forEach(u=>{Object.entries(g.attributes).forEach(([h,f])=>{e.push({type:u,name:h,attribute:{...a,...f}})})})})}),n.forEach(d=>{const c={name:d.name,options:d.options,storage:d.storage},b=te(d,"addAttributes",c);if(!b)return;const m=b();Object.entries(m).forEach(([g,x])=>{const u={...a,...x};typeof(u==null?void 0:u.default)=="function"&&(u.default=u.default()),u!=null&&u.isRequired&&(u==null?void 0:u.default)===void 0&&delete u.default,e.push({type:d.name,name:g,attribute:u})})}),e}function PO(r){const e=[];let t="",i=!1,n=!1,a=0;const l=r.length;for(let s=0;s<l;s+=1){const p=r[s];if(p==="'"&&!n){i=!i,t+=p;continue}if(p==='"'&&!i){n=!n,t+=p;continue}if(!i&&!n){if(p==="("){a+=1,t+=p;continue}if(p===")"&&a>0){a-=1,t+=p;continue}if(p===";"&&a===0){e.push(t),t="";continue}}t+=p}return t&&e.push(t),e}function YA(r){const e=[],t=PO(r||""),i=t.length;for(let n=0;n<i;n+=1){const a=t[n],l=a.indexOf(":");if(l===-1)continue;const s=a.slice(0,l).trim(),p=a.slice(l+1).trim();s&&p&&e.push([s,p])}return e}function Fe(...r){return r.filter(e=>!!e).reduce((e,t)=>{const i={...e};return Object.entries(t).forEach(([n,a])=>{if(!i[n]){i[n]=a;return}if(n==="class"){const s=a?String(a).split(" "):[],p=i[n]?i[n].split(" "):[],d=s.filter(c=>!p.includes(c));i[n]=[...p,...d].join(" ")}else if(n==="style"){const s=new Map([...YA(i[n]),...YA(a)]);i[n]=Array.from(s.entries()).map(([p,d])=>`${p}: ${d}`).join("; ")}else i[n]=a}),i},{})}function cn(r,e){return e.filter(t=>t.type===r.type.name).filter(t=>t.attribute.rendered).map(t=>t.attribute.renderHTML?t.attribute.renderHTML(r.attrs)||{}:{[t.name]:r.attrs[t.name]}).reduce((t,i)=>Fe(t,i),{})}function BO(r){return typeof r!="string"?r:r.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(r):r==="true"?!0:r==="false"?!1:r}function QA(r,e){return"style"in r?r:{...r,getAttrs:t=>{const i=r.getAttrs?r.getAttrs(t):r.attrs;if(i===!1)return!1;const n=e.reduce((a,l)=>{const s=l.attribute.parseHTML?l.attribute.parseHTML(t):BO(t.getAttribute(l.name));return s==null?a:{...a,[l.name]:s}},{});return{...i,...n}}}}function XA(r){return Object.fromEntries(Object.entries(r).filter(([e,t])=>e==="attrs"&&MO(t)?!1:t!=null))}function ZA(r){var e,t;const i={};return!((e=r==null?void 0:r.attribute)!=null&&e.isRequired)&&"default"in((r==null?void 0:r.attribute)||{})&&(i.default=r.attribute.default),((t=r==null?void 0:r.attribute)==null?void 0:t.validate)!==void 0&&(i.validate=r.attribute.validate),[r.name,i]}function LO(r,e){var t;const i=JA(r),{nodeExtensions:n,markExtensions:a}=ci(r),l=(t=n.find(d=>te(d,"topNode")))==null?void 0:t.name,s=Object.fromEntries(n.map(d=>{const c=i.filter(f=>f.type===d.name),b={name:d.name,options:d.options,storage:d.storage,editor:e},m=r.reduce((f,w)=>{const y=te(w,"extendNodeSchema",b);return{...f,...y?y(d):{}}},{}),g=XA({...m,content:he(te(d,"content",b)),marks:he(te(d,"marks",b)),group:he(te(d,"group",b)),inline:he(te(d,"inline",b)),atom:he(te(d,"atom",b)),selectable:he(te(d,"selectable",b)),draggable:he(te(d,"draggable",b)),code:he(te(d,"code",b)),whitespace:he(te(d,"whitespace",b)),linebreakReplacement:he(te(d,"linebreakReplacement",b)),defining:he(te(d,"defining",b)),isolating:he(te(d,"isolating",b)),attrs:Object.fromEntries(c.map(ZA))}),x=he(te(d,"parseHTML",b));x&&(g.parseDOM=x.map(f=>QA(f,c)));const u=te(d,"renderHTML",b);u&&(g.toDOM=f=>u({node:f,HTMLAttributes:cn(f,c)}));const h=te(d,"renderText",b);return h&&(g.toText=h),[d.name,g]})),p=Object.fromEntries(a.map(d=>{const c=i.filter(h=>h.type===d.name),b={name:d.name,options:d.options,storage:d.storage,editor:e},m=r.reduce((h,f)=>{const w=te(f,"extendMarkSchema",b);return{...h,...w?w(d):{}}},{}),g=XA({...m,inclusive:he(te(d,"inclusive",b)),excludes:he(te(d,"excludes",b)),group:he(te(d,"group",b)),spanning:he(te(d,"spanning",b)),code:he(te(d,"code",b)),attrs:Object.fromEntries(c.map(ZA))}),x=he(te(d,"parseHTML",b));x&&(g.parseDOM=x.map(h=>QA(h,c)));const u=te(d,"renderHTML",b);return u&&(g.toDOM=h=>u({mark:h,HTMLAttributes:cn(h,c)})),[d.name,g]}));return new SL({topNode:l,nodes:s,marks:p})}function NO(r){const e=r.filter((t,i)=>r.indexOf(t)!==i);return Array.from(new Set(e))}function bn(r){return r.sort((t,i)=>{const n=te(t,"priority")||100,a=te(i,"priority")||100;return n>a?-1:n<a?1:0})}function $A(r){const e=bn(Pp(r)),t=NO(e.map(i=>i.name));return t.length&&console.warn(`[tiptap warn]: Duplicate extension names found: [${t.map(i=>`'${i}'`).join(", ")}]. This can lead to issues.`),e}function e9(r,e,t){const{from:i,to:n}=e,{blockSeparator:a=`
24
+ `))),0,0),r.someProp("transformPasted",m=>{s=m(s,r,!0)}),s;let b=r.someProp("clipboardTextParser",m=>m(e,n,i,r));if(b)s=b;else{let m=n.marks(),{schema:g}=r.state,x=To.fromSchema(g);l=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach(u=>{let h=l.appendChild(document.createElement("p"));u&&h.appendChild(x.serializeNode(g.text(u,m)))})}}else r.someProp("transformPastedHTML",b=>{t=b(t,r)}),l=AH(t),$i&&_H(l);let d=l&&l.querySelector("[data-pm-slice]"),c=d&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(d.getAttribute("data-pm-slice")||"");if(c&&c[3])for(let b=+c[3];b>0;b--){let m=l.firstChild;for(;m&&m.nodeType!=1;)m=m.nextSibling;if(!m)break;l=m}if(s||(s=(r.someProp("clipboardParser")||r.someProp("domParser")||Wi.fromSchema(r.state.schema)).parseSlice(l,{preserveWhitespace:!!(p||c),context:n,ruleFromNode(m){return m.nodeName=="BR"&&!m.nextSibling&&m.parentNode&&!BH.test(m.parentNode.nodeName)?{ignore:!0}:null}})),c)s=DH(sA(s,+c[1],+c[2]),c[4]);else if(s=$.maxOpen(LH(s.content,n),!0),s.openStart||s.openEnd){let b=0,m=0;for(let g=s.content.firstChild;b<s.openStart&&!g.type.spec.isolating;b++,g=g.firstChild);for(let g=s.content.lastChild;m<s.openEnd&&!g.type.spec.isolating;m++,g=g.lastChild);s=sA(s,b,m)}return r.someProp("transformPasted",b=>{s=b(s,r,p)}),s}const BH=/^(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 LH(r,e){if(r.childCount<2)return r;for(let t=e.depth;t>=0;t--){let n=e.node(t).contentMatchAt(e.index(t)),a,l=[];if(r.forEach(s=>{if(!l)return;let p=n.findWrapping(s.type),d;if(!p)return l=null;if(d=l.length&&a.length&&aA(p,a,s,l[l.length-1],0))l[l.length-1]=d;else{l.length&&(l[l.length-1]=lA(l[l.length-1],a.length));let c=nA(s,p);l.push(c),n=n.matchType(c.type),a=p}}),l)return G.from(l)}return r}function nA(r,e,t=0){for(let i=e.length-1;i>=t;i--)r=e[i].create(null,G.from(r));return r}function aA(r,e,t,i,n){if(n<r.length&&n<e.length&&r[n]==e[n]){let a=aA(r,e,t,i.lastChild,n+1);if(a)return i.copy(i.content.replaceChild(i.childCount-1,a));if(i.contentMatchAt(i.childCount).matchType(n==r.length-1?t.type:r[n+1]))return i.copy(i.content.append(G.from(nA(t,r,n+1))))}}function lA(r,e){if(e==0)return r;let t=r.content.replaceChild(r.childCount-1,lA(r.lastChild,e-1)),i=r.contentMatchAt(r.childCount).fillBefore(G.empty,!0);return r.copy(t.append(i))}function bp(r,e,t,i,n,a){let l=e<0?r.firstChild:r.lastChild,s=l.content;return r.childCount>1&&(a=0),n<i-1&&(s=bp(s,e,t,i,n+1,a)),n>=t&&(s=e<0?l.contentMatchAt(0).fillBefore(s,a<=n).append(s):s.append(l.contentMatchAt(l.childCount).fillBefore(G.empty,!0))),r.replaceChild(e<0?0:r.childCount-1,l.copy(s))}function sA(r,e,t){return e<r.openStart&&(r=new $(bp(r.content,-1,e,r.openStart,0,r.openEnd),e,r.openEnd)),t<r.openEnd&&(r=new $(bp(r.content,1,t,r.openEnd,0,0),r.openStart,t)),r}const pA={thead:["table"],tbody:["table"],tfoot:["table"],caption:["table"],colgroup:["table"],col:["table","colgroup"],tr:["table","tbody"],td:["table","tbody","tr"],th:["table","tbody","tr"]};function dA(){return document.implementation.createHTMLDocument("title")}let mp=null;function NH(r){let e=window.trustedTypes;return e?(mp||(mp=e.defaultPolicy||e.createPolicy("ProseMirrorClipboard",{createHTML:t=>t})),mp.createHTML(r)):r}function AH(r){let e=/^(\s*<meta [^>]*>)*/.exec(r);e&&(r=r.slice(e[0].length));let t=dA(),i=t.body,n=/<([a-z][^>\s]+)/i.exec(r),a;if((a=n&&pA[n[1].toLowerCase()])&&(r=a.map(l=>"<"+l+">").join("")+r+a.map(l=>"</"+l+">").reverse().join("")),i.innerHTML=NH(r),a)for(let l=0;l<a.length;l++)i=i.querySelector(a[l])||i;for(let l=0;l<t.styleSheets.length;l++){let s=t.styleSheets[l];for(let p=0;p<s.rules.length;p++){let d=s.rules[p];if(d instanceof CSSStyleRule){let c=i.querySelectorAll(d.selectorText);for(let b=0;b<c.length;b++)c[b].style.cssText+=d.style.cssText}}}return i}function _H(r){let e=r.querySelectorAll(Ue?"span:not([class]):not([style])":"span.Apple-converted-space");for(let t=0;t<e.length;t++){let i=e[t];i.childNodes.length==1&&i.textContent==" "&&i.parentNode&&i.parentNode.replaceChild(r.ownerDocument.createTextNode(" "),i)}}function DH(r,e){if(!r.size)return r;let t=r.content.firstChild.type.schema,i;try{i=JSON.parse(e)}catch{return r}let{content:n,openStart:a,openEnd:l}=r;for(let s=i.length-2;s>=0;s-=2){let p=t.nodes[i[s]];if(!p||p.hasRequiredAttrs())break;n=G.from(p.create(i[s+1],n)),a++,l++}return new $(n,a,l)}const xt={},ht={},zH={touchstart:!0,touchmove:!0};class IH{constructor(){this.shiftKey=!1,this.mouseDown=null,this.lastKeyCode=null,this.lastKeyCodeTime=0,this.lastClick={time:0,x:0,y:0,type:"",button:0},this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastIOSEnter=0,this.lastIOSEnterFallbackTimeout=-1,this.lastFocus=0,this.lastTouch=0,this.lastChromeDelete=0,this.composing=!1,this.compositionNode=null,this.composingTimeout=-1,this.compositionNodes=[],this.compositionEndedAt=-2e8,this.compositionID=1,this.badSafariComposition=!1,this.compositionPendingChanges=0,this.domChangeCount=0,this.eventHandlers=Object.create(null),this.hideSelectionGuard=null}}function VH(r){for(let e in xt){let t=xt[e];r.dom.addEventListener(e,r.input.eventHandlers[e]=i=>{RH(r,i)&&!up(r,i)&&(r.editable||!(i.type in ht))&&t(r,i)},zH[e]?{passive:!0}:void 0)}at&&r.dom.addEventListener("input",()=>null),gp(r)}function yr(r,e){r.input.lastSelectionOrigin=e,r.input.lastSelectionTime=Date.now()}function HH(r){r.input.mouseDown&&r.input.mouseDown.done(),r.domObserver.stop();for(let e in r.input.eventHandlers)r.dom.removeEventListener(e,r.input.eventHandlers[e]);clearTimeout(r.input.composingTimeout),clearTimeout(r.input.lastIOSEnterFallbackTimeout)}function gp(r){r.someProp("handleDOMEvents",e=>{for(let t in e)r.input.eventHandlers[t]||r.dom.addEventListener(t,r.input.eventHandlers[t]=i=>up(r,i))})}function up(r,e){return r.someProp("handleDOMEvents",t=>{let i=t[e.type];return i?i(r,e)||e.defaultPrevented:!1})}function RH(r,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let t=e.target;t!=r.dom;t=t.parentNode)if(!t||t.nodeType==11||t.pmViewDesc&&t.pmViewDesc.stopEvent(e))return!1;return!0}function OH(r,e){!up(r,e)&&xt[e.type]&&(r.editable||!(e.type in ht))&&xt[e.type](r,e)}ht.keydown=(r,e)=>{let t=e;if(r.input.shiftKey=t.keyCode==16||t.shiftKey,!gA(r)&&(r.input.lastKeyCode=t.keyCode,r.input.lastKeyCodeTime=Date.now(),!(xr&&Ue&&t.keyCode==13)))if(t.keyCode!=229&&r.domObserver.forceFlush(),li&&t.keyCode==13&&!t.ctrlKey&&!t.altKey&&!t.metaKey){let i=Date.now();r.input.lastIOSEnter=i,r.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{r.input.lastIOSEnter==i&&(r.someProp("handleKeyDown",n=>n(r,Po(13,"Enter"))),r.input.lastIOSEnter=0)},200)}else r.someProp("handleKeyDown",i=>i(r,t))||PH(r,t)?t.preventDefault():yr(r,"key")},ht.keyup=(r,e)=>{e.keyCode==16&&(r.input.shiftKey=!1)},ht.keypress=(r,e)=>{let t=e;if(gA(r)||!t.charCode||t.ctrlKey&&!t.altKey||It&&t.metaKey)return;if(r.someProp("handleKeyPress",n=>n(r,t))){t.preventDefault();return}let i=r.state.selection;if(!(i instanceof pe)||!i.$from.sameParent(i.$to)){let n=String.fromCharCode(t.charCode),a=()=>r.state.tr.insertText(n).scrollIntoView();!/[\r\n]/.test(n)&&!r.someProp("handleTextInput",l=>l(r,i.$from.pos,i.$to.pos,n,a))&&r.dispatch(a()),t.preventDefault()}};function nn(r){return{left:r.clientX,top:r.clientY}}function FH(r,e){let t=e.x-r.clientX,i=e.y-r.clientY;return t*t+i*i<100}function xp(r,e,t,i,n){if(i==-1)return!1;let a=r.state.doc.resolve(i);for(let l=a.depth+1;l>0;l--)if(r.someProp(e,s=>l>a.depth?s(r,t,a.nodeAfter,a.before(l),n,!0):s(r,t,a.node(l),a.before(l),n,!1)))return!0;return!1}function an(r,e,t){if(r.focused||r.focus(),r.state.selection.eq(e))return;let i=r.state.tr.setSelection(e);i.setMeta("pointer",!0),r.dispatch(i)}function jH(r,e){if(e==-1)return!1;let t=r.state.doc.resolve(e),i=t.nodeAfter;return i&&i.isAtom&&ae.isSelectable(i)?(an(r,new ae(t)),!0):!1}function qH(r,e){if(e==-1)return!1;let t=r.state.selection,i,n;t instanceof ae&&(i=t.node);let a=r.state.doc.resolve(e);for(let l=a.depth+1;l>0;l--){let s=l>a.depth?a.nodeAfter:a.node(l);if(ae.isSelectable(s)){i&&t.$from.depth>0&&l>=t.$from.depth&&a.before(t.$from.depth+1)==t.$from.pos?n=a.before(t.$from.depth):n=a.before(l);break}}return n!=null?(an(r,ae.create(r.state.doc,n)),!0):!1}function UH(r,e,t,i,n){return xp(r,"handleClickOn",e,t,i)||r.someProp("handleClick",a=>a(r,e,i))||(n?qH(r,t):jH(r,t))}function WH(r,e,t,i){return xp(r,"handleDoubleClickOn",e,t,i)||r.someProp("handleDoubleClick",n=>n(r,e,i))}function GH(r,e,t,i){return xp(r,"handleTripleClickOn",e,t,i)||r.someProp("handleTripleClick",n=>n(r,e,i))||KH(r,t,i)}function KH(r,e,t){if(t.button!=0)return!1;let i=cA(r,e,!0),n=r.state.doc;return i?(an(r,i),i instanceof pe&&n.eq(r.state.doc)&&(r.input.mouseDown=new YH(r,i)),!0):!1}function cA(r,e,t){let i=r.state.doc;if(e==-1)return i.inlineContent?pe.create(i,0,i.content.size):null;let n=i.resolve(e);for(let a=n.depth+1;a>0;a--){let l=a>n.depth?n.nodeAfter:n.node(a),s=n.before(a);if(l.inlineContent)return pe.create(i,s+1,s+1+l.content.size);if(t&&ae.isSelectable(l))return ae.create(i,s)}return null}function hp(r){return Ma(r)}const bA=It?"metaKey":"ctrlKey";xt.mousedown=(r,e)=>{let t=e;r.input.shiftKey=t.shiftKey;let i=hp(r),n=Date.now(),a="singleClick";n-r.input.lastClick.time<500&&FH(t,r.input.lastClick)&&!t[bA]&&r.input.lastClick.button==t.button&&(r.input.lastClick.type=="singleClick"?a="doubleClick":r.input.lastClick.type=="doubleClick"&&(a="tripleClick")),r.input.lastClick={time:n,x:t.clientX,y:t.clientY,type:a,button:t.button},r.input.mouseDown&&r.input.mouseDown.done();let l=r.posAtCoords(nn(t));l&&(a=="singleClick"?r.input.mouseDown=new JH(r,l,t,!!i):(a=="doubleClick"?WH:GH)(r,l.pos,l.inside,t)?t.preventDefault():yr(r,"pointer"))};class mA{constructor(e){this.view=e,this.mightDrag=null,e.root.addEventListener("mouseup",this.up=this.up.bind(this)),e.root.addEventListener("mousemove",this.move=this.move.bind(this))}up(e){this.done()}move(e){e.buttons==0&&this.done()}done(){this.view.root.removeEventListener("mouseup",this.up),this.view.root.removeEventListener("mousemove",this.move),this.view.input.mouseDown==this&&(this.view.input.mouseDown=null)}delaySelUpdate(){return!1}}class JH extends mA{constructor(e,t,i,n){super(e),this.pos=t,this.event=i,this.flushed=n,this.delayedSelectionSync=!1,this.startDoc=e.state.doc,this.selectNode=!!i[bA],this.allowDefault=i.shiftKey;let a,l;if(t.inside>-1)a=e.state.doc.nodeAt(t.inside),l=t.inside;else{let c=e.state.doc.resolve(t.pos);a=c.parent,l=c.depth?c.before():0}const s=n?null:i.target,p=s?e.docView.nearestDesc(s,!0):null;this.target=p&&p.nodeDOM.nodeType==1?p.nodeDOM:null;let{selection:d}=e.state;i.button==0&&(a.type.spec.draggable&&a.type.spec.selectable!==!1||d instanceof ae&&d.from<=l&&d.to>l)&&(this.mightDrag={node:a,pos:l,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&zt&&!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()),yr(e,"pointer")}done(){super.done(),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(()=>{this.view.isDestroyed||fr(this.view)})}up(e){if(this.done(),!this.view.dom.contains(e.target))return;let t=this.pos;this.view.state.doc!=this.startDoc&&(t=this.view.posAtCoords(nn(e))),this.updateAllowDefault(e),this.allowDefault||!t?yr(this.view,"pointer"):UH(this.view,t.pos,t.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||at&&this.mightDrag&&!this.mightDrag.node.isAtom||Ue&&!this.view.state.selection.visible&&Math.min(Math.abs(t.pos-this.view.state.selection.from),Math.abs(t.pos-this.view.state.selection.to))<=2)?(an(this.view,de.near(this.view.state.doc.resolve(t.pos))),e.preventDefault()):yr(this.view,"pointer")}move(e){this.updateAllowDefault(e),yr(this.view,"pointer"),super.move(e)}updateAllowDefault(e){!this.allowDefault&&(Math.abs(this.event.x-e.clientX)>4||Math.abs(this.event.y-e.clientY)>4)&&(this.allowDefault=!0)}delaySelUpdate(){return this.allowDefault?(this.delayedSelectionSync=!0,!0):!1}}class YH extends mA{constructor(e,t){super(e),this.startSelection=t,this.startDoc=e.state.doc}move(e){if(e.buttons==0||this.view.isDestroyed||!this.view.state.doc.eq(this.startDoc)){this.done();return}e.preventDefault(),yr(this.view,"pointer");let t=this.view.posAtCoords(nn(e)),i=t&&cA(this.view,t.inside,!1);if(!i)return;let{doc:n}=this.view.state,a=this.startSelection,[l,s]=i.from<a.from?[a.to,i.from]:[a.from,i.to];an(this.view,pe.create(n,l,s))}}xt.touchstart=r=>{r.input.lastTouch=Date.now(),hp(r),yr(r,"pointer")},xt.touchmove=r=>{r.input.lastTouch=Date.now(),yr(r,"pointer")},xt.contextmenu=r=>hp(r);function gA(r,e){return r.composing?!0:at&&Math.abs(Date.now()-r.input.compositionEndedAt)<500?(r.input.compositionEndedAt=-2e8,!0):!1}const QH=xr?5e3:-1;ht.compositionstart=ht.compositionupdate=r=>{if(!r.composing){r.domObserver.flush();let{state:e}=r,t=e.selection.$to;if(e.selection instanceof pe&&(e.storedMarks||!t.textOffset&&t.parentOffset&&t.nodeBefore.marks.some(i=>i.type.spec.inclusive===!1)||Ue&&CN&&XH(r)))r.markCursor=r.state.storedMarks||t.marks(),Ma(r,!0),r.markCursor=null;else if(Ma(r,!e.selection.empty),zt&&e.selection.empty&&t.parentOffset&&!t.textOffset&&t.nodeBefore.marks.length){let i=r.domSelectionRange();for(let n=i.focusNode,a=i.focusOffset;n&&n.nodeType==1&&a!=0;){let l=a<0?n.lastChild:n.childNodes[a-1];if(!l)break;if(l.nodeType==3){let s=r.domSelection();s&&s.collapse(l,l.nodeValue.length);break}else n=l,a=-1}}r.input.composing=!0}uA(r,QH)};function XH(r){let{focusNode:e,focusOffset:t}=r.domSelectionRange();if(!e||e.nodeType!=1||t>=e.childNodes.length)return!1;let i=e.childNodes[t];return i.nodeType==1&&i.contentEditable=="false"}ht.compositionend=(r,e)=>{r.composing&&(r.input.composing=!1,r.input.compositionEndedAt=Date.now(),r.input.compositionPendingChanges=r.domObserver.pendingRecords().length?r.input.compositionID:0,r.input.compositionNode=null,r.input.badSafariComposition?r.domObserver.forceFlush():r.input.compositionPendingChanges&&Promise.resolve().then(()=>r.domObserver.flush()),r.input.compositionID++,uA(r,20))};function uA(r,e){clearTimeout(r.input.composingTimeout),e>-1&&(r.input.composingTimeout=setTimeout(()=>Ma(r),e))}function xA(r){for(r.composing&&(r.input.composing=!1,r.input.compositionEndedAt=Date.now());r.input.compositionNodes.length>0;)r.input.compositionNodes.pop().markParentsDirty()}function ZH(r){let e=r.domSelectionRange();if(!e.focusNode)return null;let t=qV(e.focusNode,e.focusOffset),i=UV(e.focusNode,e.focusOffset);if(t&&i&&t!=i){let n=i.pmViewDesc,a=r.domObserver.lastChangedTextNode;if(t==a||i==a)return a;if(!n||!n.isText(i.nodeValue))return i;if(r.input.compositionNode==i){let l=t.pmViewDesc;if(!(!l||!l.isText(t.nodeValue)))return i}}return t||i}function Ma(r,e=!1){if(!(xr&&r.domObserver.flushingSoon>=0)){if(r.domObserver.forceFlush(),xA(r),e||r.docView&&r.docView.dirty){let t=ap(r),i=r.state.selection;return t&&!t.eq(i)?r.dispatch(r.state.tr.setSelection(t)):(r.markCursor||e)&&!i.$from.node(i.$from.sharedDepth(i.to)).inlineContent?r.dispatch(r.state.tr.deleteSelection()):r.updateState(r.state),!0}return!1}}function $H(r,e){if(!r.dom.parentNode)return;let t=r.dom.parentNode.appendChild(document.createElement("div"));t.appendChild(e),t.style.cssText="position: fixed; left: -10000px; top: 10px";let i=getSelection(),n=document.createRange();n.selectNodeContents(e),r.dom.blur(),i.removeAllRanges(),i.addRange(n),setTimeout(()=>{t.parentNode&&t.parentNode.removeChild(t),r.focus()},50)}const ln=Pt&&jr<15||li&&JV<604;xt.copy=ht.cut=(r,e)=>{let t=e,i=r.state.selection,n=t.type=="cut";if(i.empty)return;let a=ln?null:t.clipboardData,l=i.content(),{dom:s,text:p}=cp(r,l);a?(t.preventDefault(),a.clearData(),a.setData("text/html",s.innerHTML),a.setData("text/plain",p)):$H(r,s),n&&r.dispatch(r.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function eR(r){return r.openStart==0&&r.openEnd==0&&r.content.childCount==1?r.content.firstChild:null}function tR(r,e){if(!r.dom.parentNode)return;let t=r.input.shiftKey||r.state.selection.$from.parent.type.spec.code,i=r.dom.parentNode.appendChild(document.createElement(t?"textarea":"div"));t||(i.contentEditable="true"),i.style.cssText="position: fixed; left: -10000px; top: 10px",i.focus();let n=r.input.shiftKey&&r.input.lastKeyCode!=45;setTimeout(()=>{r.focus(),i.parentNode&&i.parentNode.removeChild(i),t?sn(r,i.value,null,n,e):sn(r,i.textContent,i.innerHTML,n,e)},50)}function sn(r,e,t,i,n){let a=iA(r,e,t,i,r.state.selection.$from);if(r.someProp("handlePaste",p=>p(r,n,a||$.empty)))return!0;if(!a)return!1;let l=eR(a),s=l?r.state.tr.replaceSelectionWith(l,i):r.state.tr.replaceSelection(a);return r.dispatch(s.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function hA(r){let e=r.getData("text/plain")||r.getData("Text");if(e)return e;let t=r.getData("text/uri-list");return t?t.replace(/\r?\n/g," "):""}ht.paste=(r,e)=>{let t=e;if(r.composing&&!xr)return;let i=ln?null:t.clipboardData,n=r.input.shiftKey&&r.input.lastKeyCode!=45;i&&sn(r,hA(i),i.getData("text/html"),n,t)?t.preventDefault():tR(r,t)};class fA{constructor(e,t,i){this.slice=e,this.move=t,this.node=i}}const rR=It?"altKey":"ctrlKey";function yA(r,e){let t;return r.someProp("dragCopies",i=>{t=t||i(e)}),t!=null?!t:!e[rR]}xt.dragstart=(r,e)=>{let t=e,i=r.input.mouseDown;if(i&&i.done(),!t.dataTransfer)return;let n=r.state.selection,a=n.empty?null:r.posAtCoords(nn(t)),l;if(!(a&&a.pos>=n.from&&a.pos<=(n instanceof ae?n.to-1:n.to))){if(i&&i.mightDrag)l=ae.create(r.state.doc,i.mightDrag.pos);else if(t.target&&t.target.nodeType==1){let b=r.docView.nearestDesc(t.target,!0);b&&b.node.type.spec.draggable&&b!=r.docView&&(l=ae.create(r.state.doc,b.posBefore))}}let s=(l||r.state.selection).content(),{dom:p,text:d,slice:c}=cp(r,s);(!t.dataTransfer.files.length||!Ue||SN>120)&&t.dataTransfer.clearData(),t.dataTransfer.setData(ln?"Text":"text/html",p.innerHTML),t.dataTransfer.effectAllowed="copyMove",ln||t.dataTransfer.setData("text/plain",d),r.dragging=new fA(c,yA(r,t),l)},xt.dragend=r=>{let e=r.dragging;window.setTimeout(()=>{r.dragging==e&&(r.dragging=null)},50)},ht.dragover=ht.dragenter=(r,e)=>e.preventDefault(),ht.drop=(r,e)=>{try{oR(r,e,r.dragging)}finally{r.dragging=null}};function oR(r,e,t){if(!e.dataTransfer)return;let i=r.posAtCoords(nn(e));if(!i)return;let n=r.state.doc.resolve(i.pos),a=t&&t.slice;a?r.someProp("transformPasted",g=>{a=g(a,r,!1)}):a=iA(r,hA(e.dataTransfer),ln?null:e.dataTransfer.getData("text/html"),!1,n);let l=!!(t&&yA(r,e));if(r.someProp("handleDrop",g=>g(r,e,a||$.empty,l))){e.preventDefault();return}if(!a)return;e.preventDefault();let s=a?qL(r.state.doc,n.pos,a):n.pos;s==null&&(s=n.pos);let p=r.state.tr;if(l){let{node:g}=t;g?g.replace(p):p.deleteSelection()}let d=p.mapping.map(s),c=a.openStart==0&&a.openEnd==0&&a.content.childCount==1,b=p.doc;if(c?p.replaceRangeWith(d,d,a.content.firstChild):p.replaceRange(d,d,a),p.doc.eq(b))return;let m=p.doc.resolve(d);if(c&&ae.isSelectable(a.content.firstChild)&&m.nodeAfter&&m.nodeAfter.sameMarkup(a.content.firstChild))p.setSelection(new ae(m));else{let g=p.mapping.map(s);p.mapping.maps[p.mapping.maps.length-1].forEach((x,u,h,f)=>g=f),p.setSelection(sp(r,m,p.doc.resolve(g)))}r.focus(),r.dispatch(p.setMeta("uiEvent","drop"))}xt.focus=r=>{r.input.lastFocus=Date.now(),r.focused||(r.domObserver.stop(),r.dom.classList.add("ProseMirror-focused"),r.domObserver.start(),r.focused=!0,setTimeout(()=>{r.docView&&r.hasFocus()&&!r.domObserver.currentSelection.eq(r.domSelectionRange())&&fr(r)},20))},xt.blur=(r,e)=>{let t=e;r.focused&&(r.domObserver.stop(),r.dom.classList.remove("ProseMirror-focused"),r.domObserver.start(),t.relatedTarget&&r.dom.contains(t.relatedTarget)&&r.domObserver.currentSelection.clear(),r.focused=!1)},xt.beforeinput=(r,e)=>{if(Ue&&xr&&e.inputType=="deleteContentBackward"){r.domObserver.flushSoon();let{domChangeCount:i}=r.input;setTimeout(()=>{if(r.input.domChangeCount!=i||(r.dom.blur(),r.focus(),r.someProp("handleKeyDown",a=>a(r,Po(8,"Backspace")))))return;let{$cursor:n}=r.state.selection;n&&n.pos>0&&r.dispatch(r.state.tr.delete(n.pos-1,n.pos).scrollIntoView())},50)}};for(let r in ht)xt[r]=ht[r];function pn(r,e){if(r==e)return!0;for(let t in r)if(r[t]!==e[t])return!1;for(let t in e)if(!(t in r))return!1;return!0}class Pa{constructor(e,t){this.toDOM=e,this.spec=t||No,this.side=this.spec.side||0}map(e,t,i,n){let{pos:a,deleted:l}=e.mapResult(t.from+n,this.side<0?-1:1);return l?null:new ft(a-i,a-i,this)}valid(){return!0}eq(e){return this==e||e instanceof Pa&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&pn(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class Kr{constructor(e,t){this.attrs=e,this.spec=t||No}map(e,t,i,n){let a=e.map(t.from+n,this.spec.inclusiveStart?-1:1)-i,l=e.map(t.to+n,this.spec.inclusiveEnd?1:-1)-i;return a>=l?null:new ft(a,l,this)}valid(e,t){return t.from<t.to}eq(e){return this==e||e instanceof Kr&&pn(this.attrs,e.attrs)&&pn(this.spec,e.spec)}static is(e){return e.type instanceof Kr}destroy(){}}class fp{constructor(e,t){this.attrs=e,this.spec=t||No}map(e,t,i,n){let a=e.mapResult(t.from+n,1);if(a.deleted)return null;let l=e.mapResult(t.to+n,-1);return l.deleted||l.pos<=a.pos?null:new ft(a.pos-i,l.pos-i,this)}valid(e,t){let{index:i,offset:n}=e.content.findIndex(t.from),a;return n==t.from&&!(a=e.child(i)).isText&&n+a.nodeSize==t.to}eq(e){return this==e||e instanceof fp&&pn(this.attrs,e.attrs)&&pn(this.spec,e.spec)}destroy(){}}class ft{constructor(e,t,i){this.from=e,this.to=t,this.type=i}copy(e,t){return new ft(e,t,this.type)}eq(e,t=0){return this.type.eq(e.type)&&this.from+t==e.from&&this.to+t==e.to}map(e,t,i){return this.type.map(e,this,t,i)}static widget(e,t,i){return new ft(e,e,new Pa(t,i))}static inline(e,t,i,n){return new ft(e,t,new Kr(i,n))}static node(e,t,i,n){return new ft(e,t,new fp(i,n))}get spec(){return this.type.spec}get inline(){return this.type instanceof Kr}get widget(){return this.type instanceof Pa}}const di=[],No={};class Pe{constructor(e,t){this.local=e.length?e:di,this.children=t.length?t:di}static create(e,t){return t.length?Ba(t,e,0,No):lt}find(e,t,i){let n=[];return this.findInner(e??0,t??1e9,n,0,i),n}findInner(e,t,i,n,a){for(let l=0;l<this.local.length;l++){let s=this.local[l];s.from<=t&&s.to>=e&&(!a||a(s.spec))&&i.push(s.copy(s.from+n,s.to+n))}for(let l=0;l<this.children.length;l+=3)if(this.children[l]<t&&this.children[l+1]>e){let s=this.children[l]+1;this.children[l+2].findInner(e-s,t-s,i,n+s,a)}}map(e,t,i){return this==lt||e.maps.length==0?this:this.mapInner(e,t,0,0,i||No)}mapInner(e,t,i,n,a){let l;for(let s=0;s<this.local.length;s++){let p=this.local[s].map(e,i,n);p&&p.type.valid(t,p)?(l||(l=[])).push(p):a.onRemove&&a.onRemove(this.local[s].spec)}return this.children.length?iR(this.children,l||[],e,t,i,n,a):l?new Pe(l.sort(Ao),di):lt}add(e,t){return t.length?this==lt?Pe.create(e,t):this.addInner(e,t,0):this}addInner(e,t,i){let n,a=0;e.forEach((s,p)=>{let d=p+i,c;if(c=vA(t,s,d)){for(n||(n=this.children.slice());a<n.length&&n[a]<p;)a+=3;n[a]==p?n[a+2]=n[a+2].addInner(s,c,d+1):n.splice(a,0,p,p+s.nodeSize,Ba(c,s,d+1,No)),a+=3}});let l=wA(a?kA(t):t,-i);for(let s=0;s<l.length;s++)l[s].type.valid(e,l[s])||l.splice(s--,1);return new Pe(l.length?this.local.concat(l).sort(Ao):this.local,n||this.children)}remove(e){return e.length==0||this==lt?this:this.removeInner(e,0)}removeInner(e,t){let i=this.children,n=this.local;for(let a=0;a<i.length;a+=3){let l,s=i[a]+t,p=i[a+1]+t;for(let c=0,b;c<e.length;c++)(b=e[c])&&b.from>s&&b.to<p&&(e[c]=null,(l||(l=[])).push(b));if(!l)continue;i==this.children&&(i=this.children.slice());let d=i[a+2].removeInner(l,s+1);d!=lt?i[a+2]=d:(i.splice(a,3),a-=3)}if(n.length){for(let a=0,l;a<e.length;a++)if(l=e[a])for(let s=0;s<n.length;s++)n[s].eq(l,t)&&(n==this.local&&(n=this.local.slice()),n.splice(s--,1))}return i==this.children&&n==this.local?this:n.length||i.length?new Pe(n,i):lt}forChild(e,t){if(this==lt)return this;if(t.isLeaf)return Pe.empty;let i,n;for(let s=0;s<this.children.length;s+=3)if(this.children[s]>=e){this.children[s]==e&&(i=this.children[s+2]);break}let a=e+1,l=a+t.content.size;for(let s=0;s<this.local.length;s++){let p=this.local[s];if(p.from<l&&p.to>a&&p.type instanceof Kr){let d=Math.max(a,p.from)-a,c=Math.min(l,p.to)-a;d<c&&(n||(n=[])).push(p.copy(d,c))}}if(n){let s=new Pe(n.sort(Ao),di);return i?new Jr([s,i]):s}return i||lt}eq(e){if(this==e)return!0;if(!(e instanceof Pe)||this.local.length!=e.local.length||this.children.length!=e.children.length)return!1;for(let t=0;t<this.local.length;t++)if(!this.local[t].eq(e.local[t]))return!1;for(let t=0;t<this.children.length;t+=3)if(this.children[t]!=e.children[t]||this.children[t+1]!=e.children[t+1]||!this.children[t+2].eq(e.children[t+2]))return!1;return!0}locals(e){return yp(this.localsInner(e))}localsInner(e){if(this==lt)return di;if(e.inlineContent||!this.local.some(Kr.is))return this.local;let t=[];for(let i=0;i<this.local.length;i++)this.local[i].type instanceof Kr||t.push(this.local[i]);return t}forEachSet(e){e(this)}}Pe.empty=new Pe([],[]),Pe.removeOverlap=yp;const lt=Pe.empty;class Jr{constructor(e){this.members=e}map(e,t){const i=this.members.map(n=>n.map(e,t,No));return Jr.from(i)}forChild(e,t){if(t.isLeaf)return Pe.empty;let i=[];for(let n=0;n<this.members.length;n++){let a=this.members[n].forChild(e,t);a!=lt&&(a instanceof Jr?i=i.concat(a.members):i.push(a))}return Jr.from(i)}eq(e){if(!(e instanceof Jr)||e.members.length!=this.members.length)return!1;for(let t=0;t<this.members.length;t++)if(!this.members[t].eq(e.members[t]))return!1;return!0}locals(e){let t,i=!0;for(let n=0;n<this.members.length;n++){let a=this.members[n].localsInner(e);if(a.length)if(!t)t=a;else{i&&(t=t.slice(),i=!1);for(let l=0;l<a.length;l++)t.push(a[l])}}return t?yp(i?t:t.sort(Ao)):di}static from(e){switch(e.length){case 0:return lt;case 1:return e[0];default:return new Jr(e.every(t=>t instanceof Pe)?e:e.reduce((t,i)=>t.concat(i instanceof Pe?i:i.members),[]))}}forEachSet(e){for(let t=0;t<this.members.length;t++)this.members[t].forEachSet(e)}}function iR(r,e,t,i,n,a,l){let s=r.slice();for(let d=0,c=a;d<t.maps.length;d++){let b=0;t.maps[d].forEach((m,g,x,u)=>{let h=u-x-(g-m);for(let f=0;f<s.length;f+=3){let w=s[f+1];if(w<0||m>w+c-b)continue;let y=s[f]+c-b;g>=y?s[f+1]=m<=y?-2:-1:m>=c&&h&&(s[f]+=h,s[f+1]+=h)}b+=h}),c=t.maps[d].map(c,-1)}let p=!1;for(let d=0;d<s.length;d+=3)if(s[d+1]<0){if(s[d+1]==-2){p=!0,s[d+1]=-1;continue}let c=t.map(r[d]+a),b=c-n;if(b<0||b>=i.content.size){p=!0;continue}let m=t.map(r[d+1]+a,-1),g=m-n,{index:x,offset:u}=i.content.findIndex(b),h=i.maybeChild(x);if(h&&u==b&&u+h.nodeSize==g){let f=s[d+2].mapInner(t,h,c+1,r[d]+a+1,l);f!=lt?(s[d]=b,s[d+1]=g,s[d+2]=f):(s[d+1]=-2,p=!0)}else p=!0}if(p){let d=nR(s,r,e,t,n,a,l),c=Ba(d,i,0,l);e=c.local;for(let b=0;b<s.length;b+=3)s[b+1]<0&&(s.splice(b,3),b-=3);for(let b=0,m=0;b<c.children.length;b+=3){let g=c.children[b];for(;m<s.length&&s[m]<g;)m+=3;s.splice(m,0,c.children[b],c.children[b+1],c.children[b+2])}}return new Pe(e.sort(Ao),s)}function wA(r,e){if(!e||!r.length)return r;let t=[];for(let i=0;i<r.length;i++){let n=r[i];t.push(new ft(n.from+e,n.to+e,n.type))}return t}function nR(r,e,t,i,n,a,l){function s(p,d){for(let c=0;c<p.local.length;c++){let b=p.local[c].map(i,n,d);b?t.push(b):l.onRemove&&l.onRemove(p.local[c].spec)}for(let c=0;c<p.children.length;c+=3)s(p.children[c+2],p.children[c]+d+1)}for(let p=0;p<r.length;p+=3)r[p+1]==-1&&s(r[p+2],e[p]+a+1);return t}function vA(r,e,t){if(e.isLeaf)return null;let i=t+e.nodeSize,n=null;for(let a=0,l;a<r.length;a++)(l=r[a])&&l.from>t&&l.to<i&&((n||(n=[])).push(l),r[a]=null);return n}function kA(r){let e=[];for(let t=0;t<r.length;t++)r[t]!=null&&e.push(r[t]);return e}function Ba(r,e,t,i){let n=[],a=!1;e.forEach((s,p)=>{let d=vA(r,s,p+t);if(d){a=!0;let c=Ba(d,s,t+p+1,i);c!=lt&&n.push(p,p+s.nodeSize,c)}});let l=wA(a?kA(r):r,-t).sort(Ao);for(let s=0;s<l.length;s++)l[s].type.valid(e,l[s])||(i.onRemove&&i.onRemove(l[s].spec),l.splice(s--,1));return l.length||n.length?new Pe(l,n):lt}function Ao(r,e){return r.from-e.from||r.to-e.to}function yp(r){let e=r;for(let t=0;t<e.length-1;t++){let i=e[t];if(i.from!=i.to)for(let n=t+1;n<e.length;n++){let a=e[n];if(a.from==i.from){a.to!=i.to&&(e==r&&(e=r.slice()),e[n]=a.copy(a.from,i.to),SA(e,n+1,a.copy(i.to,a.to)));continue}else{a.from<i.to&&(e==r&&(e=r.slice()),e[t]=i.copy(i.from,a.from),SA(e,n,i.copy(a.from,i.to)));break}}}return e}function SA(r,e,t){for(;e<r.length&&Ao(t,r[e])>0;)e++;r.splice(e,0,t)}function wp(r){let e=[];return r.someProp("decorations",t=>{let i=t(r.state);i&&i!=lt&&e.push(i)}),r.cursorWrapper&&e.push(Pe.create(r.state.doc,[r.cursorWrapper.deco])),Jr.from(e)}const aR={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},lR=Pt&&jr<=11;class sR{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 pR{constructor(e,t){this.view=e,this.handleDOMChange=t,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new sR,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.lastChangedTextNode=null,this.observer=window.MutationObserver&&new window.MutationObserver(i=>{for(let n=0;n<i.length;n++)this.queue.push(i[n]);Pt&&jr<=11&&i.some(n=>n.type=="childList"&&n.removedNodes.length||n.type=="characterData"&&n.oldValue.length>n.target.nodeValue.length)?this.flushSoon():at&&e.composing&&i.some(n=>n.type=="childList"&&n.target.nodeName=="TR")?(e.input.badSafariComposition=!0,this.flushSoon()):this.flush()}),lR&&(this.onCharData=i=>{this.queue.push({target:i.target,type:"characterData",oldValue:i.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,aR)),this.onCharData&&this.view.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.connectSelection()}stop(){if(this.observer){let e=this.observer.takeRecords();if(e.length){for(let t=0;t<e.length;t++)this.queue.push(e[t]);window.setTimeout(()=>this.flush(),20)}this.observer.disconnect()}this.onCharData&&this.view.dom.removeEventListener("DOMCharacterDataModified",this.onCharData),this.disconnectSelection()}connectSelection(){this.view.dom.ownerDocument.addEventListener("selectionchange",this.onSelectionChange)}disconnectSelection(){this.view.dom.ownerDocument.removeEventListener("selectionchange",this.onSelectionChange)}suppressSelectionUpdates(){this.suppressingSelectionUpdates=!0,setTimeout(()=>this.suppressingSelectionUpdates=!1,50)}onSelectionChange(){if(QN(this.view)){if(this.suppressingSelectionUpdates)return fr(this.view);if(Pt&&jr<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&Mo(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset))return this.flushSoon()}this.flush()}}setCurSelection(){this.currentSelection.set(this.view.domSelectionRange())}ignoreSelectionChange(e){if(!e.focusNode)return!0;let t=new Set,i;for(let a=e.focusNode;a;a=ai(a))t.add(a);for(let a=e.anchorNode;a;a=ai(a))if(t.has(a)){i=a;break}let n=i&&this.view.docView.nearestDesc(i);if(n&&n.ignoreMutation({type:"selection",target:i.nodeType==3?i.parentNode:i}))return this.setCurSelection(),!0}pendingRecords(){if(this.observer)for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}flush(){let{view:e}=this;if(!e.docView||this.flushingSoon>-1)return;let t=this.pendingRecords();t.length&&(this.queue=[]);let i=e.domSelectionRange(),n=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(i)&&QN(e)&&!this.ignoreSelectionChange(i),a=-1,l=-1,s=!1,p=[];if(e.editable)for(let c=0;c<t.length;c++){let b=this.registerMutation(t[c],p);b&&(a=a<0?b.from:Math.min(b.from,a),l=l<0?b.to:Math.max(b.to,l),b.typeOver&&(s=!0))}if(p.some(c=>c.nodeName=="BR")&&(e.input.lastKeyCode==8||e.input.lastKeyCode==46||Ue&&(e.composing||e.input.compositionEndedAt>Date.now()-50)&&t.some(c=>c.type=="childList"&&c.removedNodes.length))){for(let c of p)if(c.nodeName=="BR"&&c.parentNode){let b=c.nextSibling;for(;b&&b.nodeType==1;){if(b.contentEditable=="false"){c.parentNode.removeChild(c);break}b=b.firstChild}}}else if(zt&&p.length){let c=p.filter(b=>b.nodeName=="BR");if(c.length==2){let[b,m]=c;b.parentNode&&b.parentNode.parentNode==m.parentNode?m.remove():b.remove()}else{let{focusNode:b}=this.currentSelection;for(let m of c){let g=m.parentNode;g&&g.nodeName=="LI"&&(!b||bR(e,b)!=g)&&m.remove()}}}let d=null;a<0&&n&&e.input.lastFocus>Date.now()-200&&Math.max(e.input.lastTouch,e.input.lastClick.time)<Date.now()-300&&Sa(i)&&(d=ap(e))&&d.eq(de.near(e.state.doc.resolve(0),1))?(e.input.lastFocus=0,fr(e),this.currentSelection.set(i),e.scrollToSelection()):(a>-1||n)&&(a>-1&&(e.docView.markDirty(a,l),dR(e)),e.input.badSafariComposition&&(e.input.badSafariComposition=!1,mR(e,p)),this.handleDOMChange(a,l,s,p),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(i)||fr(e),this.currentSelection.set(i))}registerMutation(e,t){if(t.indexOf(e.target)>-1)return null;let i=this.view.docView.nearestDesc(e.target);if(e.type=="attributes"&&(i==this.view.docView||e.attributeName=="contenteditable"||e.attributeName=="style"&&!e.oldValue&&!e.target.getAttribute("style"))||!i||i.ignoreMutation(e))return null;if(e.type=="childList"){for(let c=0;c<e.addedNodes.length;c++){let b=e.addedNodes[c];t.push(b),b.nodeType==3&&(this.lastChangedTextNode=b)}if(i.contentDOM&&i.contentDOM!=i.dom&&!i.contentDOM.contains(e.target))return{from:i.posBefore,to:i.posAfter};let n=e.previousSibling,a=e.nextSibling;if(Pt&&jr<=11&&e.addedNodes.length)for(let c=0;c<e.addedNodes.length;c++){let{previousSibling:b,nextSibling:m}=e.addedNodes[c];(!b||Array.prototype.indexOf.call(e.addedNodes,b)<0)&&(n=b),(!m||Array.prototype.indexOf.call(e.addedNodes,m)<0)&&(a=m)}let l=n&&n.parentNode==e.target?$e(n)+1:0,s=i.localPosFromDOM(e.target,l,-1),p=a&&a.parentNode==e.target?$e(a):e.target.childNodes.length,d=i.localPosFromDOM(e.target,p,1);return{from:s,to:d}}else return e.type=="attributes"?{from:i.posAtStart-i.border,to:i.posAtEnd+i.border}:(this.lastChangedTextNode=e.target,{from:i.posAtStart,to:i.posAtEnd,typeOver:e.target.nodeValue==e.oldValue})}}let CA=new WeakMap,TA=!1;function dR(r){if(!CA.has(r)&&(CA.set(r,null),["normal","nowrap","pre-line"].indexOf(getComputedStyle(r.dom).whiteSpace)!==-1)){if(r.requiresGeckoHackNode=zt,TA)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."),TA=!0}}function EA(r,e){let t=e.startContainer,i=e.startOffset,n=e.endContainer,a=e.endOffset,l=r.domAtPos(r.state.selection.anchor);return Mo(l.node,l.offset,n,a)&&([t,i,n,a]=[n,a,t,i]),{anchorNode:t,anchorOffset:i,focusNode:n,focusOffset:a}}function cR(r,e){if(e.getComposedRanges){let n=e.getComposedRanges(r.root)[0];if(n)return EA(r,n)}let t;function i(n){n.preventDefault(),n.stopImmediatePropagation(),t=n.getTargetRanges()[0]}return r.dom.addEventListener("beforeinput",i,!0),document.execCommand("indent"),r.dom.removeEventListener("beforeinput",i,!0),t?EA(r,t):null}function bR(r,e){for(let t=e.parentNode;t&&t!=r.dom;t=t.parentNode){let i=r.docView.nearestDesc(t,!0);if(i&&i.node.isBlock)return t}return null}function mR(r,e){var t;let{focusNode:i,focusOffset:n}=r.domSelectionRange();for(let a of e)if(((t=a.parentNode)===null||t===void 0?void 0:t.nodeName)=="TR"){let l=a.nextSibling;for(;l&&l.nodeName!="TD"&&l.nodeName!="TH";)l=l.nextSibling;if(l){let s=l;for(;;){let p=s.firstChild;if(!p||p.nodeType!=1||p.contentEditable=="false"||/^(BR|IMG)$/.test(p.nodeName))break;s=p}s.insertBefore(a,s.firstChild),i==a&&r.domSelection().collapse(a,n)}else a.parentNode.removeChild(a)}}function gR(r,e,t){let{node:i,fromOffset:n,toOffset:a,from:l,to:s}=r.docView.parseRange(e,t),p=r.domSelectionRange(),d,c=p.anchorNode;if(c&&r.dom.contains(c.nodeType==1?c:c.parentNode)&&(d=[{node:c,offset:p.anchorOffset}],Sa(p)||d.push({node:p.focusNode,offset:p.focusOffset})),Ue&&r.input.lastKeyCode===8)for(let h=a;h>n;h--){let f=i.childNodes[h-1],w=f.pmViewDesc;if(f.nodeName=="BR"&&!w){a=h;break}if(!w||w.size)break}let b=r.state.doc,m=r.someProp("domParser")||Wi.fromSchema(r.state.schema),g=b.resolve(l),x=null,u=m.parse(i,{topNode:g.parent,topMatch:g.parent.contentMatchAt(g.index()),topOpen:!0,from:n,to:a,preserveWhitespace:g.parent.type.whitespace=="pre"?"full":!0,findPositions:d,ruleFromNode:uR,context:g});if(d&&d[0].pos!=null){let h=d[0].pos,f=d[1]&&d[1].pos;f==null&&(f=h),x={anchor:h+l,head:f+l}}return{doc:u,sel:x,from:l,to:s}}function uR(r){let e=r.pmViewDesc;if(e)return e.parseRule();if(r.nodeName=="BR"&&r.parentNode){if(at&&/^(ul|ol)$/i.test(r.parentNode.nodeName)){let t=document.createElement("div");return t.appendChild(document.createElement("li")),{skip:t}}else if(r.parentNode.lastChild==r||at&&/^(tr|table)$/i.test(r.parentNode.nodeName))return{ignore:!0}}else if(r.nodeName=="IMG"&&r.getAttribute("mark-placeholder"))return{ignore:!0};return null}const xR=/^(a|abbr|acronym|b|bd[io]|big|br|button|cite|code|data(list)?|del|dfn|em|i|img|ins|kbd|label|map|mark|meter|output|q|ruby|s|samp|small|span|strong|su[bp]|time|u|tt|var)$/i;function hR(r,e,t,i,n){let a=r.input.compositionPendingChanges||(r.composing?r.input.compositionID:0);if(r.input.compositionPendingChanges=0,e<0){let v=r.input.lastSelectionTime>Date.now()-50?r.input.lastSelectionOrigin:null,M=ap(r,v);if(M&&!r.state.selection.eq(M)){if(Ue&&xr&&r.input.lastKeyCode===13&&Date.now()-100<r.input.lastKeyCodeTime&&r.someProp("handleKeyDown",k=>k(r,Po(13,"Enter"))))return;let C=r.state.tr.setSelection(M);v=="pointer"?C.setMeta("pointer",!0):v=="key"&&C.scrollIntoView(),a&&C.setMeta("composition",a),r.dispatch(C)}return}let l=r.state.doc.resolve(e),s=l.sharedDepth(t);e=l.before(s+1),t=r.state.doc.resolve(t).after(s+1);let p=r.state.selection,d=gR(r,e,t),c=r.state.doc,b=c.slice(d.from,d.to),m,g;r.input.lastKeyCode===8&&Date.now()-100<r.input.lastKeyCodeTime?(m=r.state.selection.to,g="end"):(m=r.state.selection.from,g="start"),r.input.lastKeyCode=null;let x=wR(b.content,d.doc.content,d.from,m,g);if(x&&r.input.domChangeCount++,(li&&r.input.lastIOSEnter>Date.now()-225||xr)&&n.some(v=>v.nodeType==1&&!xR.test(v.nodeName))&&(!x||x.endA>=x.endB)&&r.someProp("handleKeyDown",v=>v(r,Po(13,"Enter")))){r.input.lastIOSEnter=0;return}if(!x)if(i&&p instanceof pe&&!p.empty&&p.$head.sameParent(p.$anchor)&&!r.composing&&!(d.sel&&d.sel.anchor!=d.sel.head))x={start:p.from,endA:p.to,endB:p.to};else{if(d.sel){let v=MA(r,r.state.doc,d.sel);if(v&&!v.eq(r.state.selection)){let M=r.state.tr.setSelection(v);a&&M.setMeta("composition",a),r.dispatch(M)}}return}r.state.selection.from<r.state.selection.to&&x.start==x.endB&&r.state.selection instanceof pe&&(x.start>r.state.selection.from&&x.start<=r.state.selection.from+2&&r.state.selection.from>=d.from?x.start=r.state.selection.from:x.endA<r.state.selection.to&&x.endA>=r.state.selection.to-2&&r.state.selection.to<=d.to&&(x.endB+=r.state.selection.to-x.endA,x.endA=r.state.selection.to)),Pt&&jr<=11&&x.endB==x.start+1&&x.endA==x.start&&x.start>d.from&&d.doc.textBetween(x.start-d.from-1,x.start-d.from+1)=="  "&&(x.start--,x.endA--,x.endB--);let u=d.doc.resolveNoCache(x.start-d.from),h=d.doc.resolveNoCache(x.endB-d.from),f=c.resolve(x.start),w=u.sameParent(h)&&u.parent.inlineContent&&f.end()>=x.endA;if((li&&r.input.lastIOSEnter>Date.now()-225&&(!w||n.some(v=>v.nodeName=="DIV"||v.nodeName=="P"))||!w&&u.pos<d.doc.content.size&&(!u.sameParent(h)||!u.parent.inlineContent)&&u.pos<h.pos&&!/\S/.test(d.doc.textBetween(u.pos,h.pos,"","")))&&r.someProp("handleKeyDown",v=>v(r,Po(13,"Enter")))){r.input.lastIOSEnter=0;return}if(r.state.selection.anchor>x.start&&yR(c,x.start,x.endA,u,h)&&r.someProp("handleKeyDown",v=>v(r,Po(8,"Backspace")))){xr&&Ue&&r.domObserver.suppressSelectionUpdates();return}Ue&&x.endB==x.start&&(r.input.lastChromeDelete=Date.now()),xr&&!w&&u.start()!=h.start()&&h.parentOffset==0&&u.depth==h.depth&&d.sel&&d.sel.anchor==d.sel.head&&d.sel.head==x.endA&&(x.endB-=2,h=d.doc.resolveNoCache(x.endB-d.from),setTimeout(()=>{r.someProp("handleKeyDown",function(v){return v(r,Po(13,"Enter"))})},20));let y=x.start,E=x.endA,S=v=>{let M=v||r.state.tr.replace(y,E,d.doc.slice(x.start-d.from,x.endB-d.from));if(d.sel){let C=MA(r,M.doc,d.sel);C&&!(Ue&&r.composing&&C.empty&&(x.start!=x.endB||r.input.lastChromeDelete<Date.now()-100)&&(C.head==y||C.head==M.mapping.map(E)-1)||Pt&&C.empty&&C.head==y)&&M.setSelection(C)}return a&&M.setMeta("composition",a),M.scrollIntoView()},P;if(w)if(u.pos==h.pos){Pt&&jr<=11&&u.parentOffset==0&&(r.domObserver.suppressSelectionUpdates(),setTimeout(()=>fr(r),20));let v=S(r.state.tr.delete(y,E)),M=c.resolve(x.start).marksAcross(c.resolve(x.endA));M&&v.ensureMarks(M),r.dispatch(v)}else if(x.endA==x.endB&&(P=fR(u.parent.content.cut(u.parentOffset,h.parentOffset),f.parent.content.cut(f.parentOffset,x.endA-f.start())))){let v=S(r.state.tr);P.type=="add"?v.addMark(y,E,P.mark):v.removeMark(y,E,P.mark),r.dispatch(v)}else if(u.parent.child(u.index()).isText&&u.index()==h.index()-(h.textOffset?0:1)){let v=u.parent.textBetween(u.parentOffset,h.parentOffset),M=()=>S(r.state.tr.insertText(v,y,E));r.someProp("handleTextInput",C=>C(r,y,E,v,M))||r.dispatch(M())}else r.dispatch(S());else r.dispatch(S())}function MA(r,e,t){return Math.max(t.anchor,t.head)>e.content.size?null:sp(r,e.resolve(t.anchor),e.resolve(t.head))}function fR(r,e){let t=r.firstChild.marks,i=e.firstChild.marks,n=t,a=i,l,s,p;for(let c=0;c<i.length;c++)n=i[c].removeFromSet(n);for(let c=0;c<t.length;c++)a=t[c].removeFromSet(a);if(n.length==1&&a.length==0)s=n[0],l="add",p=c=>c.mark(s.addToSet(c.marks));else if(n.length==0&&a.length==1)s=a[0],l="remove",p=c=>c.mark(s.removeFromSet(c.marks));else return null;let d=[];for(let c=0;c<e.childCount;c++)d.push(p(e.child(c)));if(G.from(d).eq(r))return{mark:s,type:l}}function yR(r,e,t,i,n){if(t-e<=n.pos-i.pos||vp(i,!0,!1)<n.pos)return!1;let a=r.resolve(e);if(!i.parent.isTextblock){let s=a.nodeAfter;return s!=null&&t==e+s.nodeSize}if(a.parentOffset<a.parent.content.size||!a.parent.isTextblock)return!1;let l=r.resolve(vp(a,!0,!0));return!l.parent.isTextblock||l.pos>t||vp(l,!0,!1)<t?!1:i.parent.content.cut(i.parentOffset).eq(l.parent.content)}function vp(r,e,t){let i=r.depth,n=e?r.end():r.pos;for(;i>0&&(e||r.indexAfter(i)==r.node(i).childCount);)i--,n++,e=!1;if(t){let a=r.node(i).maybeChild(r.indexAfter(i));for(;a&&!a.isLeaf;)a=a.firstChild,n++}return n}function wR(r,e,t,i,n){let a=r.findDiffStart(e,t),l=t+r.size,s=t+e.size;if(a==null)return null;let{a:p,b:d}=r.findDiffEnd(e,l,s);if(n=="end"){let c=Math.max(0,a-Math.min(p,d));i-=p+c-a}if(p<a&&l<s){let c=i<=a&&i>=p?a-i:0;a-=c,d=a+(d-p),p=a}else if(d<a){let c=i<=a&&i>=d?a-i:0;a-=c,p=a+(p-d),d=a}return{start:a,endA:p,endB:d}}class PA{constructor(e,t){this._root=null,this.focused=!1,this.trackWrites=null,this.mounted=!1,this.markCursor=null,this.cursorWrapper=null,this.lastSelectedViewDesc=void 0,this.input=new IH,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=t,this.state=t.state,this.directPlugins=t.plugins||[],this.directPlugins.forEach(_A),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=NA(this),LA(this),this.nodeViews=AA(this),this.docView=HN(this.state.doc,BA(this),wp(this),this.dom,this),this.domObserver=new pR(this,(i,n,a,l)=>hR(this,i,n,a,l)),this.domObserver.start(),VH(this),this.updatePluginViews()}get composing(){return this.input.composing}get props(){if(this._props.state!=this.state){let e=this._props;this._props={};for(let t in e)this._props[t]=e[t];this._props.state=this.state}return this._props}update(e){e.handleDOMEvents!=this._props.handleDOMEvents&&gp(this);let t=this._props;this._props=e,e.plugins&&(e.plugins.forEach(_A),this.directPlugins=e.plugins),this.updateStateInner(e.state,t)}setProps(e){let t={};for(let i in this._props)t[i]=this._props[i];t.state=this.state;for(let i in e)t[i]=e[i];this.update(t)}updateState(e){this.updateStateInner(e,this._props)}updateStateInner(e,t){var i;let n=this.state,a=!1,l=!1;e.storedMarks&&this.composing&&(xA(this),l=!0),this.state=e;let s=n.plugins!=e.plugins||this._props.plugins!=t.plugins;if(s||this._props.plugins!=t.plugins||this._props.nodeViews!=t.nodeViews){let g=AA(this);kR(g,this.nodeViews)&&(this.nodeViews=g,a=!0)}(s||t.handleDOMEvents!=this._props.handleDOMEvents)&&gp(this),this.editable=NA(this),LA(this);let p=wp(this),d=BA(this),c=n.plugins!=e.plugins&&!n.doc.eq(e.doc)?"reset":e.scrollToSelection>n.scrollToSelection?"to selection":"preserve",b=a||!this.docView.matchesNode(e.doc,d,p);(b||!e.selection.eq(n.selection))&&(l=!0);let m=c=="preserve"&&l&&this.dom.style.overflowAnchor==null&&XV(this);if(l){this.domObserver.stop();let g=b&&(Pt||Ue)&&!this.composing&&!n.selection.empty&&!e.selection.empty&&vR(n.selection,e.selection);if(b){let u=Ue?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=ZH(this)),(a||!this.docView.update(e.doc,d,p,this))&&(this.docView.updateOuterDeco(d),this.docView.destroy(),this.docView=HN(e.doc,d,p,this.dom,this)),u&&(!this.trackWrites||!this.dom.contains(this.trackWrites))&&(g=!0)}let x=this.input.mouseDown;g||!(x&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&vH(this)&&x.delaySelUpdate())?fr(this,g):(JN(this,e.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(n),!((i=this.dragging)===null||i===void 0)&&i.node&&!n.doc.eq(e.doc)&&this.updateDraggedNode(this.dragging,n),c=="reset"?this.dom.scrollTop=0:c=="to selection"?this.scrollToSelection():m&&ZV(m)}scrollToSelection(){let e=this.domSelectionRange().focusNode;if(!(!e||!this.dom.contains(e.nodeType==1?e:e.parentNode))){if(!this.someProp("handleScrollToSelection",t=>t(this)))if(this.state.selection instanceof ae){let t=this.docView.domAfterPos(this.state.selection.from);t.nodeType==1&&TN(this,t.getBoundingClientRect(),e)}else TN(this,this.coordsAtPos(this.state.selection.head,1),e)}}destroyPluginViews(){let e;for(;e=this.pluginViews.pop();)e.destroy&&e.destroy()}updatePluginViews(e){if(!e||e.plugins!=this.state.plugins||this.directPlugins!=this.prevDirectPlugins){this.prevDirectPlugins=this.directPlugins,this.destroyPluginViews();for(let t=0;t<this.directPlugins.length;t++){let i=this.directPlugins[t];i.spec.view&&this.pluginViews.push(i.spec.view(this))}for(let t=0;t<this.state.plugins.length;t++){let i=this.state.plugins[t];i.spec.view&&this.pluginViews.push(i.spec.view(this))}}else for(let t=0;t<this.pluginViews.length;t++){let i=this.pluginViews[t];i.update&&i.update(this,e)}}updateDraggedNode(e,t){let i=e.node,n=-1;if(i.from<this.state.doc.content.size&&this.state.doc.nodeAt(i.from)==i.node)n=i.from;else{let a=i.from+(this.state.doc.content.size-t.doc.content.size);(a>0&&a<this.state.doc.content.size&&this.state.doc.nodeAt(a))==i.node&&(n=a)}this.dragging=new fA(e.slice,e.move,n<0?void 0:ae.create(this.state.doc,n))}someProp(e,t){let i=this._props&&this._props[e],n;if(i!=null&&(n=t?t(i):i))return n;for(let l=0;l<this.directPlugins.length;l++){let s=this.directPlugins[l].props[e];if(s!=null&&(n=t?t(s):s))return n}let a=this.state.plugins;if(a)for(let l=0;l<a.length;l++){let s=a[l].props[e];if(s!=null&&(n=t?t(s):s))return n}}hasFocus(){if(Pt){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&&$V(this.dom),fr(this),this.domObserver.start()}get root(){let e=this._root;if(e==null){for(let t=this.dom.parentNode;t;t=t.parentNode)if(t.nodeType==9||t.nodeType==11&&t.host)return t.getSelection||(Object.getPrototypeOf(t).getSelection=()=>t.ownerDocument.getSelection()),this._root=t}return e||document}updateRoot(){this._root=null}posAtCoords(e){return iH(this,e)}coordsAtPos(e,t=1){return NN(this,e,t)}domAtPos(e,t=0){return this.docView.domFromPos(e,t)}nodeDOM(e){let t=this.docView.descAt(e);return t?t.nodeDOM:null}posAtDOM(e,t,i=-1){let n=this.docView.posFromDOM(e,t,i);if(n==null)throw new RangeError("DOM position not inside the editor");return n}endOfTextblock(e,t){return pH(this,t||this.state,e)}pasteHTML(e,t){return sn(this,"",e,!1,t||new ClipboardEvent("paste"))}pasteText(e,t){return sn(this,e,null,!0,t||new ClipboardEvent("paste"))}serializeForClipboard(e){return cp(this,e)}destroy(){this.docView&&(HH(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],wp(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,FV())}get isDestroyed(){return this.docView==null}dispatchEvent(e){return OH(this,e)}domSelectionRange(){let e=this.domSelection();return e?at&&this.root.nodeType===11&&GV(this.dom.ownerDocument)==this.dom&&cR(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}PA.prototype.dispatch=function(r){let e=this._props.dispatchTransaction;e?e.call(this,r):this.updateState(this.state.apply(r))};function BA(r){let e=Object.create(null);return e.class="ProseMirror",e.contenteditable=String(r.editable),r.someProp("attributes",t=>{if(typeof t=="function"&&(t=t(r.state)),t)for(let i in t)i=="class"?e.class+=" "+t[i]:i=="style"?e.style=(e.style?e.style+";":"")+t[i]:!e[i]&&i!="contenteditable"&&i!="nodeName"&&(e[i]=String(t[i]))}),e.translate||(e.translate="no"),[ft.node(0,r.state.doc.content.size,e)]}function LA(r){if(r.markCursor){let e=document.createElement("img");e.className="ProseMirror-separator",e.setAttribute("mark-placeholder","true"),e.setAttribute("alt",""),r.cursorWrapper={dom:e,deco:ft.widget(r.state.selection.from,e,{raw:!0,marks:r.markCursor})}}else r.cursorWrapper=null}function NA(r){return!r.someProp("editable",e=>e(r.state)===!1)}function vR(r,e){let t=Math.min(r.$anchor.sharedDepth(r.head),e.$anchor.sharedDepth(e.head));return r.$anchor.start(t)!=e.$anchor.start(t)}function AA(r){let e=Object.create(null);function t(i){for(let n in i)Object.prototype.hasOwnProperty.call(e,n)||(e[n]=i[n])}return r.someProp("nodeViews",t),r.someProp("markViews",t),e}function kR(r,e){let t=0,i=0;for(let n in r){if(r[n]!=e[n])return!0;t++}for(let n in e)i++;return t!=i}function _A(r){if(r.spec.state||r.spec.filterTransaction||r.spec.appendTransaction)throw new RangeError("Plugins passed directly to the view must not have a state component")}for(var Yr={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:"'"},La={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},SR=typeof navigator<"u"&&/Mac/.test(navigator.platform),CR=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),et=0;et<10;et++)Yr[48+et]=Yr[96+et]=String(et);for(var et=1;et<=24;et++)Yr[et+111]="F"+et;for(var et=65;et<=90;et++)Yr[et]=String.fromCharCode(et+32),La[et]=String.fromCharCode(et);for(var kp in Yr)La.hasOwnProperty(kp)||(La[kp]=Yr[kp]);function TR(r){var e=SR&&r.metaKey&&r.shiftKey&&!r.ctrlKey&&!r.altKey||CR&&r.shiftKey&&r.key&&r.key.length==1||r.key=="Unidentified",t=!e&&r.key||(r.shiftKey?La:Yr)[r.keyCode]||r.key||"Unidentified";return t=="Esc"&&(t="Escape"),t=="Del"&&(t="Delete"),t=="Left"&&(t="ArrowLeft"),t=="Up"&&(t="ArrowUp"),t=="Right"&&(t="ArrowRight"),t=="Down"&&(t="ArrowDown"),t}const ER=typeof navigator<"u"&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),MR=typeof navigator<"u"&&/Win/.test(navigator.platform);function PR(r){let e=r.split(/-(?!$)/),t=e[e.length-1];t=="Space"&&(t=" ");let i,n,a,l;for(let s=0;s<e.length-1;s++){let p=e[s];if(/^(cmd|meta|m)$/i.test(p))l=!0;else if(/^a(lt)?$/i.test(p))i=!0;else if(/^(c|ctrl|control)$/i.test(p))n=!0;else if(/^s(hift)?$/i.test(p))a=!0;else if(/^mod$/i.test(p))ER?l=!0:n=!0;else throw new Error("Unrecognized modifier name: "+p)}return i&&(t="Alt-"+t),n&&(t="Ctrl-"+t),l&&(t="Meta-"+t),a&&(t="Shift-"+t),t}function BR(r){let e=Object.create(null);for(let t in r)e[PR(t)]=r[t];return e}function Sp(r,e,t=!0){return e.altKey&&(r="Alt-"+r),e.ctrlKey&&(r="Ctrl-"+r),e.metaKey&&(r="Meta-"+r),t&&e.shiftKey&&(r="Shift-"+r),r}function LR(r){return new Me({props:{handleKeyDown:DA(r)}})}function DA(r){let e=BR(r);return function(t,i){let n=TR(i),a,l=e[Sp(n,i)];if(l&&l(t.state,t.dispatch,t))return!0;if(n.length==1&&n!=" "){if(i.shiftKey){let s=e[Sp(n,i,!1)];if(s&&s(t.state,t.dispatch,t))return!0}if((i.altKey||i.metaKey||i.ctrlKey)&&!(MR&&i.ctrlKey&&i.altKey)&&(a=Yr[i.keyCode])&&a!=n){let s=e[Sp(a,i)];if(s&&s(t.state,t.dispatch,t))return!0}}return!1}}var NR=Object.defineProperty,Cp=(r,e)=>{for(var t in e)NR(r,t,{get:e[t],enumerable:!0})};function Na(r){const{state:e,transaction:t}=r;let{selection:i}=t,{doc:n}=t,{storedMarks:a}=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 a},get selection(){return i},get doc(){return n},get tr(){return i=t.selection,n=t.doc,a=t.storedMarks,t}}}var Aa=class{constructor(r){this.editor=r.editor,this.rawCommands=this.editor.extensionManager.commands,this.customState=r.state}get hasCustomState(){return!!this.customState}get state(){return this.customState||this.editor.state}get commands(){const{rawCommands:r,editor:e,state:t}=this,{view:i}=e,{tr:n}=t,a=this.buildProps(n);return Object.fromEntries(Object.entries(r).map(([l,s])=>[l,(...d)=>{const c=s(...d)(a);return!n.getMeta("preventDispatch")&&!this.hasCustomState&&i.dispatch(n),c}]))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(r,e=!0){const{rawCommands:t,editor:i,state:n}=this,{view:a}=i,l=[],s=!!r,p=r||n.tr,d=()=>(!s&&e&&!p.getMeta("preventDispatch")&&!this.hasCustomState&&a.dispatch(p),l.every(b=>b===!0)),c={...Object.fromEntries(Object.entries(t).map(([b,m])=>[b,(...x)=>{const u=this.buildProps(p,e),h=m(...x)(u);return l.push(h),c}])),run:d};return c}createCan(r){const{rawCommands:e,state:t}=this,i=!1,n=r||t.tr,a=this.buildProps(n,i);return{...Object.fromEntries(Object.entries(e).map(([s,p])=>[s,(...d)=>p(...d)({...a,dispatch:void 0})])),chain:()=>this.createChain(n,i)}}buildProps(r,e=!0){const{rawCommands:t,editor:i,state:n}=this,{view:a}=i,l={tr:r,editor:i,view:a,state:Na({state:n,transaction:r}),dispatch:e?()=>{}:void 0,chain:()=>this.createChain(r,e),can:()=>this.createCan(r),get commands(){return Object.fromEntries(Object.entries(t).map(([s,p])=>[s,(...d)=>p(...d)(l)]))}};return l}},zA={};Cp(zA,{blur:()=>AR,clearContent:()=>_R,clearNodes:()=>DR,command:()=>zR,createParagraphNear:()=>IR,cut:()=>VR,deleteCurrentNode:()=>HR,deleteNode:()=>RR,deleteRange:()=>OR,deleteSelection:()=>qR,enter:()=>UR,exitCode:()=>WR,extendMarkRange:()=>GR,first:()=>KR,focus:()=>YR,forEach:()=>QR,insertContent:()=>XR,insertContentAt:()=>eO,joinBackward:()=>oO,joinDown:()=>rO,joinForward:()=>iO,joinItemBackward:()=>nO,joinItemForward:()=>aO,joinTextblockBackward:()=>lO,joinTextblockForward:()=>sO,joinUp:()=>tO,keyboardShortcut:()=>dO,lift:()=>cO,liftEmptyBlock:()=>bO,liftListItem:()=>mO,newlineInCode:()=>gO,resetAttributes:()=>uO,scrollIntoView:()=>xO,selectAll:()=>hO,selectNodeBackward:()=>fO,selectNodeForward:()=>yO,selectParentNode:()=>wO,selectTextblockEnd:()=>vO,selectTextblockStart:()=>kO,setContent:()=>SO,setMark:()=>UO,setMeta:()=>WO,setNode:()=>GO,setNodeSelection:()=>KO,setTextDirection:()=>JO,setTextSelection:()=>YO,sinkListItem:()=>QO,splitBlock:()=>XO,splitListItem:()=>ZO,toggleList:()=>eF,toggleMark:()=>tF,toggleNode:()=>rF,toggleWrap:()=>oF,undoInputRule:()=>iF,unsetAllMarks:()=>nF,unsetMark:()=>aF,unsetTextDirection:()=>lF,updateAttributes:()=>sF,wrapIn:()=>pF,wrapInList:()=>dF});var AR=()=>({editor:r,view:e})=>(requestAnimationFrame(()=>{var t;r.isDestroyed||(e.dom.blur(),(t=window==null?void 0:window.getSelection())==null||t.removeAllRanges())}),!0),_R=(r=!0)=>({commands:e})=>e.setContent("",{emitUpdate:r}),DR=()=>({state:r,tr:e,dispatch:t})=>{const{selection:i}=e,{ranges:n}=i;return t&&n.forEach(({$from:a,$to:l})=>{r.doc.nodesBetween(a.pos,l.pos,(s,p)=>{if(s.type.isText)return;const{doc:d,mapping:c}=e,b=d.resolve(c.map(p)),m=d.resolve(c.map(p+s.nodeSize)),g=b.blockRange(m);if(!g)return;const x=ti(g);if(s.type.isTextblock){const{defaultType:u}=b.parent.contentMatchAt(b.index());e.setNodeMarkup(g.start,u)}(x||x===0)&&e.lift(g,x)})}),!0},zR=r=>e=>r(e),IR=()=>({state:r,dispatch:e})=>uN(r,e),VR=(r,e)=>({editor:t,tr:i})=>{const{state:n}=t,a=n.doc.slice(r.from,r.to);i.deleteRange(r.from,r.to);const l=i.mapping.map(e);return i.insert(l,a.content),i.setSelection(new pe(i.doc.resolve(Math.max(l-1,0)))),!0},HR=()=>({tr:r,dispatch:e})=>{const{selection:t}=r,i=t.$anchor.node();if(i.content.size>0)return!1;const n=r.selection.$anchor;for(let a=n.depth;a>0;a-=1)if(n.node(a).type===i.type){if(e){const s=n.before(a),p=n.after(a);r.delete(s,p).scrollIntoView()}return!0}return!1};function Ie(r,e){if(typeof r=="string"){if(!e.nodes[r])throw Error(`There is no node type named '${r}'. Maybe you forgot to add the extension?`);return e.nodes[r]}return r}var RR=r=>({tr:e,state:t,dispatch:i})=>{const n=Ie(r,t.schema),a=e.selection.$anchor;for(let l=a.depth;l>0;l-=1)if(a.node(l).type===n){if(i){const p=a.before(l),d=a.after(l);e.delete(p,d).scrollIntoView()}return!0}return!1},OR=r=>({tr:e,dispatch:t})=>{const{from:i,to:n}=r;return t&&e.delete(i,n),!0},FR=r=>r.content?/^text(\*|\+)/.test(r.content):!1,IA=(r,e,t)=>{if(!r.parent.isInline||t==="left"&&r.pos>r.start()||t==="right"&&r.pos<r.end())return r.pos;const i=e.nodes[r.parent.type.name].spec;return FR(i)?t==="left"?r.start()-1:r.end()+1:r.pos},jR=(r,e,t)=>{const i=IA(r,t,"left"),n=IA(e,t,"right");return{from:i,to:n}},qR=()=>({state:r,dispatch:e})=>{const{$from:t,$to:i}=r.selection;if(r.selection.empty)return!1;const{from:n,to:a}=jR(t,i,r.schema);return e&&(r.tr.deleteRange(n,a).scrollIntoView(),e(r.tr)),!0},UR=()=>({commands:r})=>r.keyboardShortcut("Enter"),WR=()=>({state:r,dispatch:e})=>EV(r,e);function Tp(r){return Object.prototype.toString.call(r)==="[object RegExp]"}function _a(r,e,t={strict:!0}){const i=Object.keys(e);return i.length?i.every(n=>t.strict?e[n]===r[n]:Tp(e[n])?e[n].test(r[n]):e[n]===r[n]):!0}function VA(r,e,t={}){return r.find(i=>i.type===e&&_a(Object.fromEntries(Object.keys(t).map(n=>[n,i.attrs[n]])),t))}function HA(r,e,t={}){return!!VA(r,e,t)}function Ep(r,e,t){if(!r||!e)return;let i=r.parent.childAfter(r.parentOffset);if((!i.node||!i.node.marks.some(d=>d.type===e))&&(i=r.parent.childBefore(r.parentOffset)),!i.node||!i.node.marks.some(d=>d.type===e))return;if(!t){const d=i.node.marks.find(c=>c.type===e);d&&(t=d.attrs)}if(!VA([...i.node.marks],e,t))return;let a=i.index,l=r.start()+i.offset,s=a+1,p=l+i.node.nodeSize;for(;a>0&&HA([...r.parent.child(a-1).marks],e,t);)a-=1,l-=r.parent.child(a).nodeSize;for(;s<r.parent.childCount&&HA([...r.parent.child(s).marks],e,t);)p+=r.parent.child(s).nodeSize,s+=1;return{from:l,to:p}}function wr(r,e){if(typeof r=="string"){if(!e.marks[r])throw Error(`There is no mark type named '${r}'. Maybe you forgot to add the extension?`);return e.marks[r]}return r}var GR=(r,e)=>({tr:t,state:i,dispatch:n})=>{const a=wr(r,i.schema),{doc:l,selection:s}=t,{$from:p,from:d,to:c}=s;if(n){const b=Ep(p,a,e);if(b&&b.from<=d&&b.to>=c){const m=pe.create(l,b.from,b.to);t.setSelection(m)}}return!0},KR=r=>e=>{const t=typeof r=="function"?r(e):r;for(let i=0;i<t.length;i+=1)if(t[i](e))return!0;return!1};function RA(r){return r instanceof pe}function _o(r=0,e=0,t=0){return Math.min(Math.max(r,e),t)}function OA(r,e=null){if(!e)return null;const t=de.atStart(r),i=de.atEnd(r);if(e==="start"||e===!0)return t;if(e==="end")return i;const n=t.from,a=i.to;return e==="all"?pe.create(r,_o(0,n,a),_o(r.content.size,n,a)):pe.create(r,_o(e,n,a),_o(e,n,a))}function FA(){return navigator.platform==="Android"||/android/i.test(navigator.userAgent)}function Da(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}function JR(){return typeof navigator<"u"?/^((?!chrome|android).)*safari/i.test(navigator.userAgent):!1}var YR=(r=null,e={})=>({editor:t,view:i,tr:n,dispatch:a})=>{e={scrollIntoView:!0,...e};const l=()=>{(Da()||FA())&&i.dom.focus(),JR()&&!Da()&&!FA()&&i.dom.focus({preventScroll:!0}),requestAnimationFrame(()=>{t.isDestroyed||(i.focus(),e!=null&&e.scrollIntoView&&t.commands.scrollIntoView())})};try{if(i.hasFocus()&&r===null||r===!1)return!0}catch{return!1}if(a&&r===null&&!RA(t.state.selection))return l(),!0;const s=OA(n.doc,r)||t.state.selection,p=t.state.selection.eq(s);return a&&(p||n.setSelection(s),p&&n.storedMarks&&n.setStoredMarks(n.storedMarks),l()),!0},QR=(r,e)=>t=>r.every((i,n)=>e(i,{...t,index:n})),XR=(r,e)=>({tr:t,commands:i})=>i.insertContentAt({from:t.selection.from,to:t.selection.to},r,e),jA=r=>{const e=r.childNodes;for(let t=e.length-1;t>=0;t-=1){const i=e[t];i.nodeType===3&&i.nodeValue&&/^(\n\s\s|\n)$/.test(i.nodeValue)?r.removeChild(i):i.nodeType===1&&jA(i)}return r};function za(r){if(typeof window>"u")throw new Error("[tiptap error]: there is no window object available, so this function cannot be used");const e=`<body>${r}</body>`,t=new window.DOMParser().parseFromString(e,"text/html").body;return jA(t)}function dn(r,e,t){if(r instanceof Rr||r instanceof G)return r;t={slice:!0,parseOptions:{},...t};const i=typeof r=="object"&&r!==null,n=typeof r=="string";if(i)try{if(Array.isArray(r)&&r.length>0)return G.fromArray(r.map(s=>e.nodeFromJSON(s)));const l=e.nodeFromJSON(r);return t.errorOnInvalidContent&&l.check(),l}catch(a){if(t.errorOnInvalidContent)throw new Error("[tiptap error]: Invalid JSON content",{cause:a});return console.warn("[tiptap warn]: Invalid content.","Passed value:",r,"Error:",a),dn("",e,t)}if(n){if(t.errorOnInvalidContent){let l=!1,s="";const p=new SL({topNode:e.spec.topNode,marks:e.spec.marks,nodes:e.spec.nodes.append({__tiptap__private__unknown__catch__all__node:{content:"inline*",group:"block",parseDOM:[{tag:"*",getAttrs:d=>(l=!0,s=typeof d=="string"?d:d.outerHTML,null)}]}})});if(t.slice?Wi.fromSchema(p).parseSlice(za(r),t.parseOptions):Wi.fromSchema(p).parse(za(r),t.parseOptions),t.errorOnInvalidContent&&l)throw new Error("[tiptap error]: Invalid HTML content",{cause:new Error(`Invalid element found: ${s}`)})}const a=Wi.fromSchema(e);return t.slice?a.parseSlice(za(r),t.parseOptions).content:a.parse(za(r),t.parseOptions)}return dn("",e,t)}function ZR(r,e,t){const i=r.steps.length-1;if(i<e)return;const n=r.steps[i];if(!(n instanceof _t||n instanceof Mt))return;const a=r.mapping.maps[i];let l=0;a.forEach((s,p,d,c)=>{l===0&&(l=c)}),r.setSelection(de.near(r.doc.resolve(l),t))}var $R=r=>!("type"in r),eO=(r,e,t)=>({tr:i,dispatch:n,editor:a})=>{var l;if(n){t={parseOptions:a.options.parseOptions,updateSelection:!0,applyInputRules:!1,applyPasteRules:!1,...t};let s;const p=h=>{a.emit("contentError",{editor:a,error:h,disableCollaboration:()=>{"collaboration"in a.storage&&typeof a.storage.collaboration=="object"&&a.storage.collaboration&&(a.storage.collaboration.isDisabled=!0)}})},d={preserveWhitespace:"full",...t.parseOptions};if(!t.errorOnInvalidContent&&!a.options.enableContentCheck&&a.options.emitContentError)try{dn(e,a.schema,{parseOptions:d,errorOnInvalidContent:!0})}catch(h){p(h)}try{s=dn(e,a.schema,{parseOptions:d,errorOnInvalidContent:(l=t.errorOnInvalidContent)!=null?l:a.options.enableContentCheck})}catch(h){return p(h),!1}let{from:c,to:b}=typeof r=="number"?{from:r,to:r}:{from:r.from,to:r.to},m=!0,g=!0;if(($R(s)?s:[s]).forEach(h=>{h.check(),m=m?h.isText&&h.marks.length===0:!1,g=g?h.isBlock:!1}),c===b&&g){const{parent:h}=i.doc.resolve(c);h.isTextblock&&!h.type.spec.code&&!h.childCount&&(c-=1,b+=1)}let u;if(m){if(Array.isArray(e))u=e.map(h=>h.text||"").join("");else if(e instanceof G){let h="";e.forEach(f=>{f.text&&(h+=f.text)}),u=h}else typeof e=="object"&&e&&e.text?u=e.text:u=e;i.insertText(u,c,b)}else{u=s;const h=i.doc.resolve(c),f=h.node(),w=h.parentOffset===0,y=f.isText||f.isTextblock,E=f.content.size>0;w&&y&&E&&g&&(c=Math.max(0,c-1)),i.replaceWith(c,b,u)}t.updateSelection&&ZR(i,i.steps.length-1,-1),t.applyInputRules&&i.setMeta("applyInputRules",{from:c,text:u}),t.applyPasteRules&&i.setMeta("applyPasteRules",{from:c,text:u})}return!0},tO=()=>({state:r,dispatch:e})=>SV(r,e),rO=()=>({state:r,dispatch:e})=>CV(r,e),oO=()=>({state:r,dispatch:e})=>sN(r,e),iO=()=>({state:r,dispatch:e})=>bN(r,e),nO=()=>({state:r,dispatch:e,tr:t})=>{try{const i=wa(r.doc,r.selection.$from.pos,-1);return i==null?!1:(t.join(i,2),e&&e(t),!0)}catch{return!1}},aO=()=>({state:r,dispatch:e,tr:t})=>{try{const i=wa(r.doc,r.selection.$from.pos,1);return i==null?!1:(t.join(i,2),e&&e(t),!0)}catch{return!1}},lO=()=>({state:r,dispatch:e})=>vV(r,e),sO=()=>({state:r,dispatch:e})=>kV(r,e);function qA(){return typeof navigator<"u"?/Mac/.test(navigator.platform):!1}function pO(r){const e=r.split(/-(?!$)/);let t=e[e.length-1];t==="Space"&&(t=" ");let i,n,a,l;for(let s=0;s<e.length-1;s+=1){const p=e[s];if(/^(cmd|meta|m)$/i.test(p))l=!0;else if(/^a(lt)?$/i.test(p))i=!0;else if(/^(c|ctrl|control)$/i.test(p))n=!0;else if(/^s(hift)?$/i.test(p))a=!0;else if(/^mod$/i.test(p))Da()||qA()?l=!0:n=!0;else throw new Error(`Unrecognized modifier name: ${p}`)}return i&&(t=`Alt-${t}`),n&&(t=`Ctrl-${t}`),l&&(t=`Meta-${t}`),a&&(t=`Shift-${t}`),t}var dO=r=>({editor:e,view:t,tr:i,dispatch:n})=>{const a=pO(r).split(/-(?!$)/),l=a.find(d=>!["Alt","Ctrl","Meta","Shift"].includes(d)),s=new KeyboardEvent("keydown",{key:l==="Space"?" ":l,altKey:a.includes("Alt"),ctrlKey:a.includes("Ctrl"),metaKey:a.includes("Meta"),shiftKey:a.includes("Shift"),bubbles:!0,cancelable:!0}),p=e.captureTransaction(()=>{t.someProp("handleKeyDown",d=>d(t,s))});return p==null||p.steps.forEach(d=>{const c=d.map(i.mapping);c&&n&&i.maybeStep(c)}),!0};function Qr(r,e,t={}){const{from:i,to:n,empty:a}=r.selection,l=e?Ie(e,r.schema):null,s=[];r.doc.nodesBetween(i,n,(b,m)=>{if(b.isText)return;const g=Math.max(i,m),x=Math.min(n,m+b.nodeSize);s.push({node:b,from:g,to:x})});const p=n-i,d=s.filter(b=>l?l.name===b.node.type.name:!0).filter(b=>_a(b.node.attrs,t,{strict:!1}));return a?!!d.length:d.reduce((b,m)=>b+m.to-m.from,0)>=p}var cO=(r,e={})=>({state:t,dispatch:i})=>{const n=Ie(r,t.schema);return Qr(t,n,e)?TV(t,i):!1},bO=()=>({state:r,dispatch:e})=>xN(r,e),mO=r=>({state:e,dispatch:t})=>{const i=Ie(r,e.schema);return VV(i)(e,t)},gO=()=>({state:r,dispatch:e})=>gN(r,e);function Ia(r,e){return e.nodes[r]?"node":e.marks[r]?"mark":null}function UA(r,e){const t=typeof e=="string"?[e]:e;return Object.keys(r).reduce((i,n)=>(t.includes(n)||(i[n]=r[n]),i),{})}var uO=(r,e)=>({tr:t,state:i,dispatch:n})=>{let a=null,l=null;const s=Ia(typeof r=="string"?r:r.name,i.schema);if(!s)return!1;s==="node"&&(a=Ie(r,i.schema)),s==="mark"&&(l=wr(r,i.schema));let p=!1;return t.selection.ranges.forEach(d=>{i.doc.nodesBetween(d.$from.pos,d.$to.pos,(c,b)=>{a&&a===c.type&&(p=!0,n&&t.setNodeMarkup(b,void 0,UA(c.attrs,e))),l&&c.marks.length&&c.marks.forEach(m=>{l===m.type&&(p=!0,n&&t.addMark(b,b+c.nodeSize,l.create(UA(m.attrs,e))))})})}),p},xO=()=>({tr:r,dispatch:e})=>(e&&r.scrollIntoView(),!0),hO=()=>({tr:r,dispatch:e})=>{if(e){const t=new gr(r.doc);r.setSelection(t)}return!0},fO=()=>({state:r,dispatch:e})=>dN(r,e),yO=()=>({state:r,dispatch:e})=>mN(r,e),wO=()=>({state:r,dispatch:e})=>BV(r,e),vO=()=>({state:r,dispatch:e})=>AV(r,e),kO=()=>({state:r,dispatch:e})=>NV(r,e);function Mp(r,e,t={},i={}){return dn(r,e,{slice:!1,parseOptions:t,errorOnInvalidContent:i.errorOnInvalidContent})}var SO=(r,{errorOnInvalidContent:e,emitUpdate:t=!0,parseOptions:i={}}={})=>({editor:n,tr:a,dispatch:l,commands:s})=>{const{doc:p}=a;if(i.preserveWhitespace!=="full"){const d=Mp(r,n.schema,i,{errorOnInvalidContent:e??n.options.enableContentCheck});return l&&a.replaceWith(0,p.content.size,d).setMeta("preventUpdate",!t),!0}return l&&a.setMeta("preventUpdate",!t),s.insertContentAt({from:0,to:p.content.size},r,{parseOptions:i,errorOnInvalidContent:e??n.options.enableContentCheck})};function WA(r,e){const t=wr(e,r.schema),{from:i,to:n,empty:a}=r.selection,l=[];a?(r.storedMarks&&l.push(...r.storedMarks),l.push(...r.selection.$head.marks())):r.doc.nodesBetween(i,n,p=>{l.push(...p.marks)});const s=l.find(p=>p.type.name===t.name);return s?{...s.attrs}:{}}function GA(r,e){const t=new QL(r);return e.forEach(i=>{i.steps.forEach(n=>{t.step(n)})}),t}function CO(r){for(let e=0;e<r.edgeCount;e+=1){const{type:t}=r.edge(e);if(t.isTextblock&&!t.hasRequiredAttrs())return t}return null}function TO(r,e,t){const i=[];return r.nodesBetween(e.from,e.to,(n,a)=>{t(n)&&i.push({node:n,pos:a})}),i}function EO(r,e){for(let t=r.depth;t>0;t-=1){const i=r.node(t);if(e(i))return{pos:t>0?r.before(t):0,start:r.start(t),depth:t,node:i}}}function Va(r){return e=>EO(e.$from,r)}function te(r,e,t){return r.config[e]===void 0&&r.parent?te(r.parent,e,t):typeof r.config[e]=="function"?r.config[e].bind({...t,parent:r.parent?te(r.parent,e,t):null}):r.config[e]}function Pp(r){return r.map(e=>{const t={name:e.name,options:e.options,storage:e.storage},i=te(e,"addExtensions",t);return i?[e,...Pp(i())]:e}).flat(10)}function Bp(r,e){const t=To.fromSchema(e).serializeFragment(r),n=document.implementation.createHTMLDocument().createElement("div");return n.appendChild(t),n.innerHTML}function KA(r){return typeof r=="function"}function he(r,e=void 0,...t){return KA(r)?e?r.bind(e)(...t):r(...t):r}function MO(r={}){return Object.keys(r).length===0&&r.constructor===Object}function ci(r){const e=r.filter(n=>n.type==="extension"),t=r.filter(n=>n.type==="node"),i=r.filter(n=>n.type==="mark");return{baseExtensions:e,nodeExtensions:t,markExtensions:i}}function JA(r){const e=[],{nodeExtensions:t,markExtensions:i}=ci(r),n=[...t,...i],a={default:null,validate:void 0,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1},l=t.filter(d=>d.name!=="text").map(d=>d.name),s=i.map(d=>d.name),p=[...l,...s];return r.forEach(d=>{const c={name:d.name,options:d.options,storage:d.storage,extensions:n},b=te(d,"addGlobalAttributes",c);if(!b)return;b().forEach(g=>{let x;Array.isArray(g.types)?x=g.types:g.types==="*"?x=p:g.types==="nodes"?x=l:g.types==="marks"?x=s:x=[],x.forEach(u=>{Object.entries(g.attributes).forEach(([h,f])=>{e.push({type:u,name:h,attribute:{...a,...f}})})})})}),n.forEach(d=>{const c={name:d.name,options:d.options,storage:d.storage},b=te(d,"addAttributes",c);if(!b)return;const m=b();Object.entries(m).forEach(([g,x])=>{const u={...a,...x};typeof(u==null?void 0:u.default)=="function"&&(u.default=u.default()),u!=null&&u.isRequired&&(u==null?void 0:u.default)===void 0&&delete u.default,e.push({type:d.name,name:g,attribute:u})})}),e}function PO(r){const e=[];let t="",i=!1,n=!1,a=0;const l=r.length;for(let s=0;s<l;s+=1){const p=r[s];if(p==="'"&&!n){i=!i,t+=p;continue}if(p==='"'&&!i){n=!n,t+=p;continue}if(!i&&!n){if(p==="("){a+=1,t+=p;continue}if(p===")"&&a>0){a-=1,t+=p;continue}if(p===";"&&a===0){e.push(t),t="";continue}}t+=p}return t&&e.push(t),e}function YA(r){const e=[],t=PO(r||""),i=t.length;for(let n=0;n<i;n+=1){const a=t[n],l=a.indexOf(":");if(l===-1)continue;const s=a.slice(0,l).trim(),p=a.slice(l+1).trim();s&&p&&e.push([s,p])}return e}function je(...r){return r.filter(e=>!!e).reduce((e,t)=>{const i={...e};return Object.entries(t).forEach(([n,a])=>{if(!i[n]){i[n]=a;return}if(n==="class"){const s=a?String(a).split(" "):[],p=i[n]?i[n].split(" "):[],d=s.filter(c=>!p.includes(c));i[n]=[...p,...d].join(" ")}else if(n==="style"){const s=new Map([...YA(i[n]),...YA(a)]);i[n]=Array.from(s.entries()).map(([p,d])=>`${p}: ${d}`).join("; ")}else i[n]=a}),i},{})}function cn(r,e){return e.filter(t=>t.type===r.type.name).filter(t=>t.attribute.rendered).map(t=>t.attribute.renderHTML?t.attribute.renderHTML(r.attrs)||{}:{[t.name]:r.attrs[t.name]}).reduce((t,i)=>je(t,i),{})}function BO(r){return typeof r!="string"?r:r.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(r):r==="true"?!0:r==="false"?!1:r}function QA(r,e){return"style"in r?r:{...r,getAttrs:t=>{const i=r.getAttrs?r.getAttrs(t):r.attrs;if(i===!1)return!1;const n=e.reduce((a,l)=>{const s=l.attribute.parseHTML?l.attribute.parseHTML(t):BO(t.getAttribute(l.name));return s==null?a:{...a,[l.name]:s}},{});return{...i,...n}}}}function XA(r){return Object.fromEntries(Object.entries(r).filter(([e,t])=>e==="attrs"&&MO(t)?!1:t!=null))}function ZA(r){var e,t;const i={};return!((e=r==null?void 0:r.attribute)!=null&&e.isRequired)&&"default"in((r==null?void 0:r.attribute)||{})&&(i.default=r.attribute.default),((t=r==null?void 0:r.attribute)==null?void 0:t.validate)!==void 0&&(i.validate=r.attribute.validate),[r.name,i]}function LO(r,e){var t;const i=JA(r),{nodeExtensions:n,markExtensions:a}=ci(r),l=(t=n.find(d=>te(d,"topNode")))==null?void 0:t.name,s=Object.fromEntries(n.map(d=>{const c=i.filter(f=>f.type===d.name),b={name:d.name,options:d.options,storage:d.storage,editor:e},m=r.reduce((f,w)=>{const y=te(w,"extendNodeSchema",b);return{...f,...y?y(d):{}}},{}),g=XA({...m,content:he(te(d,"content",b)),marks:he(te(d,"marks",b)),group:he(te(d,"group",b)),inline:he(te(d,"inline",b)),atom:he(te(d,"atom",b)),selectable:he(te(d,"selectable",b)),draggable:he(te(d,"draggable",b)),code:he(te(d,"code",b)),whitespace:he(te(d,"whitespace",b)),linebreakReplacement:he(te(d,"linebreakReplacement",b)),defining:he(te(d,"defining",b)),isolating:he(te(d,"isolating",b)),attrs:Object.fromEntries(c.map(ZA))}),x=he(te(d,"parseHTML",b));x&&(g.parseDOM=x.map(f=>QA(f,c)));const u=te(d,"renderHTML",b);u&&(g.toDOM=f=>u({node:f,HTMLAttributes:cn(f,c)}));const h=te(d,"renderText",b);return h&&(g.toText=h),[d.name,g]})),p=Object.fromEntries(a.map(d=>{const c=i.filter(h=>h.type===d.name),b={name:d.name,options:d.options,storage:d.storage,editor:e},m=r.reduce((h,f)=>{const w=te(f,"extendMarkSchema",b);return{...h,...w?w(d):{}}},{}),g=XA({...m,inclusive:he(te(d,"inclusive",b)),excludes:he(te(d,"excludes",b)),group:he(te(d,"group",b)),spanning:he(te(d,"spanning",b)),code:he(te(d,"code",b)),attrs:Object.fromEntries(c.map(ZA))}),x=he(te(d,"parseHTML",b));x&&(g.parseDOM=x.map(h=>QA(h,c)));const u=te(d,"renderHTML",b);return u&&(g.toDOM=h=>u({mark:h,HTMLAttributes:cn(h,c)})),[d.name,g]}));return new SL({topNode:l,nodes:s,marks:p})}function NO(r){const e=r.filter((t,i)=>r.indexOf(t)!==i);return Array.from(new Set(e))}function bn(r){return r.sort((t,i)=>{const n=te(t,"priority")||100,a=te(i,"priority")||100;return n>a?-1:n<a?1:0})}function $A(r){const e=bn(Pp(r)),t=NO(e.map(i=>i.name));return t.length&&console.warn(`[tiptap warn]: Duplicate extension names found: [${t.map(i=>`'${i}'`).join(", ")}]. This can lead to issues.`),e}function e9(r,e,t){const{from:i,to:n}=e,{blockSeparator:a=`
25
25
 
26
26
  `,textSerializers:l={}}=t||{};let s="";return r.nodesBetween(i,n,(p,d,c,b)=>{var m;p.isBlock&&d>i&&(s+=a);const g=l==null?void 0:l[p.type.name];if(g)return c&&(s+=g({node:p,pos:d,parent:c,index:b,range:e})),!1;p.isText&&(s+=(m=p==null?void 0:p.text)==null?void 0:m.slice(Math.max(i,d)-d,n-d))}),s}function AO(r,e){const t={from:0,to:r.content.size};return e9(r,t,e)}function t9(r){return Object.fromEntries(Object.entries(r.nodes).filter(([,e])=>e.spec.toText).map(([e,t])=>[e,t.spec.toText]))}function _O(r,e){const t=Ie(e,r.schema),{from:i,to:n}=r.selection,a=[];r.doc.nodesBetween(i,n,s=>{a.push(s)});const l=a.reverse().find(s=>s.type.name===t.name);return l?{...l.attrs}:{}}function r9(r,e){const t=Ia(typeof e=="string"?e:e.name,r.schema);return t==="node"?_O(r,e):t==="mark"?WA(r,e):{}}function DO(r,e=JSON.stringify){const t={};return r.filter(i=>{const n=e(i);return Object.prototype.hasOwnProperty.call(t,n)?!1:t[n]=!0})}function zO(r){const e=DO(r);return e.length===1?e:e.filter((t,i)=>!e.filter((a,l)=>l!==i).some(a=>t.oldRange.from>=a.oldRange.from&&t.oldRange.to<=a.oldRange.to&&t.newRange.from>=a.newRange.from&&t.newRange.to<=a.newRange.to))}function o9(r){const{mapping:e,steps:t}=r,i=[];return e.maps.forEach((n,a)=>{const l=[];if(n.ranges.length)n.forEach((s,p)=>{l.push({from:s,to:p})});else{const{from:s,to:p}=t[a];if(s===void 0||p===void 0)return;l.push({from:s,to:p})}l.forEach(({from:s,to:p})=>{const d=e.slice(a).map(s,-1),c=e.slice(a).map(p),b=e.invert().map(d,-1),m=e.invert().map(c);i.push({oldRange:{from:b,to:m},newRange:{from:d,to:c}})})}),zO(i)}function Lp(r,e,t){const i=[];return r===e?t.resolve(r).marks().forEach(n=>{const a=t.resolve(r),l=Ep(a,n.type);l&&i.push({mark:n,...l})}):t.nodesBetween(r,e,(n,a)=>{!n||(n==null?void 0:n.nodeSize)===void 0||i.push(...n.marks.map(l=>({from:a,to:a+n.nodeSize,mark:l})))}),i}var IO=(r,e,t,i=20)=>{const n=r.doc.resolve(t);let a=i,l=null;for(;a>0&&l===null;){const s=n.node(a);(s==null?void 0:s.type.name)===e?l=s:a-=1}return[l,a]};function mn(r,e){return e.nodes[r]||e.marks[r]||null}function Ha(r,e,t){return Object.fromEntries(Object.entries(t).filter(([i])=>{const n=r.find(a=>a.type===e&&a.name===i);return n?n.attribute.keepOnSplit:!1}))}var VO=(r,e=500)=>{let t="";const i=r.parentOffset;return r.parent.nodesBetween(Math.max(0,i-e),i,(n,a,l,s)=>{var p,d;const c=((d=(p=n.type.spec).toText)==null?void 0:d.call(p,{node:n,pos:a,parent:l,index:s}))||n.textContent||"%leaf%";t+=n.isAtom&&!n.isText?c:c.slice(0,Math.max(0,i-a))}),t};function Np(r,e,t={}){const{empty:i,ranges:n}=r.selection,a=e?wr(e,r.schema):null;if(i)return!!(r.storedMarks||r.selection.$from.marks()).filter(b=>a?a.name===b.type.name:!0).find(b=>_a(b.attrs,t,{strict:!1}));let l=0;const s=[];if(n.forEach(({$from:b,$to:m})=>{const g=b.pos,x=m.pos;r.doc.nodesBetween(g,x,(u,h)=>{if(a&&u.inlineContent&&!u.type.allowsMarkType(a))return!1;if(!u.isText&&!u.marks.length)return;const f=Math.max(g,h),w=Math.min(x,h+u.nodeSize),y=w-f;l+=y,s.push(...u.marks.map(E=>({mark:E,from:f,to:w})))})}),l===0)return!1;const p=s.filter(b=>a?a.name===b.mark.type.name:!0).filter(b=>_a(b.mark.attrs,t,{strict:!1})).reduce((b,m)=>b+m.to-m.from,0),d=s.filter(b=>a?b.mark.type!==a&&b.mark.type.excludes(a):!0).reduce((b,m)=>b+m.to-m.from,0);return(p>0?p+d:p)>=l}function HO(r,e,t={}){if(!e)return Qr(r,null,t)||Np(r,null,t);const i=Ia(e,r.schema);return i==="node"?Qr(r,e,t):i==="mark"?Np(r,e,t):!1}var RO=(r,e)=>{const{$from:t,$to:i,$anchor:n}=r.selection;if(e){const a=Va(s=>s.type.name===e)(r.selection);if(!a)return!1;const l=r.doc.resolve(a.pos+1);return n.pos+1===l.end()}return!(i.parentOffset<i.parent.nodeSize-2||t.pos!==i.pos)},OO=r=>{const{$from:e,$to:t}=r.selection;return!(e.parentOffset>0||e.pos!==t.pos)};function i9(r,e){return Array.isArray(e)?e.some(t=>(typeof t=="string"?t:t.name)===r.name):e}function Ap(r,e){const{nodeExtensions:t}=ci(e),i=t.find(l=>l.name===r);if(!i)return!1;const n={name:i.name,options:i.options,storage:i.storage},a=he(te(i,"group",n));return typeof a!="string"?!1:a.split(" ").includes("list")}function gn(r,{checkChildren:e=!0,ignoreWhitespace:t=!1}={}){var i;if(t){if(r.type.name==="hardBreak")return!0;if(r.isText)return!/\S/.test((i=r.text)!=null?i:"")}if(r.isText)return!r.text;if(r.isAtom||r.isLeaf)return!1;if(r.content.childCount===0)return!0;if(e){let n=!0;return r.content.forEach(a=>{n!==!1&&(gn(a,{ignoreWhitespace:t,checkChildren:e})||(n=!1))}),n}return!1}function n9(r){return r instanceof ae}var a9=class Fz{constructor(e){this.position=e}static fromJSON(e){return new Fz(e.position)}toJSON(){return{position:this.position}}};function FO(r,e){const t=e.mapping.mapResult(r.position);return{position:new a9(t.pos),mapResult:t}}function jO(r){return new a9(r)}function qO(r,e,t){var i;const{selection:n}=e;let a=null;if(RA(n)&&(a=n.$cursor),a){const s=(i=r.storedMarks)!=null?i:a.marks();return a.parent.type.allowsMarkType(t)&&(!!t.isInSet(s)||!s.some(d=>d.type.excludes(t)))}const{ranges:l}=n;return l.some(({$from:s,$to:p})=>{let d=s.depth===0?r.doc.inlineContent&&r.doc.type.allowsMarkType(t):!1;return r.doc.nodesBetween(s.pos,p.pos,(c,b,m)=>{if(d)return!1;if(c.isInline){const g=!m||m.type.allowsMarkType(t),x=!!t.isInSet(c.marks)||!c.marks.some(u=>u.type.excludes(t));d=g&&x}return!d}),d})}var UO=(r,e={})=>({tr:t,state:i,dispatch:n})=>{const{selection:a}=t,{empty:l,ranges:s}=a,p=wr(r,i.schema);if(n)if(l){const d=WA(i,p);t.addStoredMark(p.create({...d,...e}))}else s.forEach(d=>{const c=d.$from.pos,b=d.$to.pos;i.doc.nodesBetween(c,b,(m,g)=>{const x=Math.max(g,c),u=Math.min(g+m.nodeSize,b);m.marks.find(f=>f.type===p)?m.marks.forEach(f=>{p===f.type&&t.addMark(x,u,p.create({...f.attrs,...e}))}):t.addMark(x,u,p.create(e))})});return qO(i,t,p)},WO=(r,e)=>({tr:t})=>(t.setMeta(r,e),!0),GO=(r,e={})=>({state:t,dispatch:i,chain:n})=>{const a=Ie(r,t.schema);let l;return t.selection.$anchor.sameParent(t.selection.$head)&&(l=t.selection.$anchor.parent.attrs),a.isTextblock?n().command(({commands:s})=>yN(a,{...l,...e})(t)?!0:s.clearNodes()).command(({state:s})=>yN(a,{...l,...e})(s,i)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},KO=r=>({tr:e,dispatch:t})=>{if(t){const{doc:i}=e,n=_o(r,0,i.content.size),a=ae.create(i,n);e.setSelection(a)}return!0},JO=(r,e)=>({tr:t,state:i,dispatch:n})=>{const{selection:a}=i;let l,s;return typeof e=="number"?(l=e,s=e):e&&"from"in e&&"to"in e?(l=e.from,s=e.to):(l=a.from,s=a.to),n&&t.doc.nodesBetween(l,s,(p,d)=>{p.isText||t.setNodeMarkup(d,void 0,{...p.attrs,dir:r})}),!0},YO=r=>({tr:e,dispatch:t})=>{if(t){const{doc:i}=e,{from:n,to:a}=typeof r=="number"?{from:r,to:r}:r,l=pe.atStart(i).from,s=pe.atEnd(i).to,p=_o(n,l,s),d=_o(a,l,s),c=pe.create(i,p,d);e.setSelection(c)}return!0},QO=r=>({state:e,dispatch:t})=>{const i=Ie(r,e.schema);return OV(i)(e,t)};function l9(r,e){const t=r.storedMarks||r.selection.$to.parentOffset&&r.selection.$from.marks();if(t){const i=t.filter(n=>e==null?void 0:e.includes(n.type.name));r.tr.ensureMarks(i)}}var XO=({keepMarks:r=!0}={})=>({tr:e,state:t,dispatch:i,editor:n})=>{const{selection:a,doc:l}=e,{$from:s,$to:p}=a,d=n.extensionManager.attributes,c=Ha(d,s.node().type.name,s.node().attrs);if(a instanceof ae&&a.node.isBlock)return!s.parentOffset||!mr(l,s.pos)?!1:(i&&(r&&l9(t,n.extensionManager.splittableMarks),e.split(s.pos).scrollIntoView()),!0);if(!s.parent.isBlock)return!1;const b=p.parentOffset===p.parent.content.size,m=s.depth===0?void 0:CO(s.node(-1).contentMatchAt(s.indexAfter(-1)));let g=b&&m?[{type:m,attrs:c}]:void 0,x=mr(e.doc,e.mapping.map(s.pos),1,g);if(!g&&!x&&mr(e.doc,e.mapping.map(s.pos),1,m?[{type:m}]:void 0)&&(x=!0,g=m?[{type:m,attrs:c}]:void 0),i){if(x&&(a instanceof pe&&e.deleteSelection(),e.split(e.mapping.map(s.pos),1,g),m&&!b&&!s.parentOffset&&s.parent.type!==m)){const u=e.mapping.map(s.before()),h=e.doc.resolve(u);s.node(-1).canReplaceWith(h.index(),h.index()+1,m)&&e.setNodeMarkup(e.mapping.map(s.before()),m)}r&&l9(t,n.extensionManager.splittableMarks),e.scrollIntoView()}return x},ZO=(r,e={})=>({tr:t,state:i,dispatch:n,editor:a})=>{var l;const s=Ie(r,i.schema),{$from:p,$to:d}=i.selection,c=i.selection.node;if(c&&c.isBlock||p.depth<2||!p.sameParent(d))return!1;const b=p.node(-1);if(b.type!==s)return!1;const m=a.extensionManager.attributes;if(p.parent.content.size===0&&p.node(-1).childCount===p.indexAfter(-1)){if(p.depth===2||p.node(-3).type!==s||p.index(-2)!==p.node(-2).childCount-1)return!1;if(n){let f=G.empty;const w=p.index(-1)?1:p.index(-2)?2:3;for(let M=p.depth-w;M>=p.depth-3;M-=1)f=G.from(p.node(M).copy(f));const y=p.indexAfter(-1)<p.node(-2).childCount?1:p.indexAfter(-2)<p.node(-3).childCount?2:3,E={...Ha(m,p.node().type.name,p.node().attrs),...e},S=((l=s.contentMatch.defaultType)==null?void 0:l.createAndFill(E))||void 0;f=f.append(G.from(s.createAndFill(null,S)||void 0));const P=p.before(p.depth-(w-1));t.replace(P,p.after(-y),new $(f,4-w,0));let v=-1;t.doc.nodesBetween(P,t.doc.content.size,(M,C)=>{if(v>-1)return!1;M.isTextblock&&M.content.size===0&&(v=C+1)}),v>-1&&t.setSelection(pe.near(t.doc.resolve(v))),t.scrollIntoView()}return!0}const g=d.pos===p.end()?b.contentMatchAt(0).defaultType:null,x={...Ha(m,b.type.name,b.attrs),...e},u={...Ha(m,p.node().type.name,p.node().attrs),...e};t.delete(p.pos,d.pos);const h=g?[{type:s,attrs:x},{type:g,attrs:u}]:[{type:s,attrs:x}];if(!mr(t.doc,p.pos,2))return!1;if(n){const{selection:f,storedMarks:w}=i,{splittableMarks:y}=a.extensionManager,E=w||f.$to.parentOffset&&f.$from.marks();if(t.split(p.pos,2,h).scrollIntoView(),!E||!n)return!0;const S=E.filter(P=>y.includes(P.type.name));t.ensureMarks(S)}return!0};function s9(r){return!r||r==="1"?null:r}function p9(r,e){return s9(r)===s9(e)}var _p=(r,e)=>{const t=Va(l=>l.type===e)(r.selection);if(!t)return!0;const i=r.doc.resolve(Math.max(0,t.pos-1)).before(t.depth);if(i===void 0)return!0;const n=r.doc.nodeAt(i);return!(t.node.type===(n==null?void 0:n.type)&&Or(r.doc,t.pos))||!p9(t.node.attrs.type,n==null?void 0:n.attrs.type)||r.join(t.pos),!0},Dp=(r,e)=>{const t=Va(l=>l.type===e)(r.selection);if(!t)return!0;const i=r.doc.resolve(t.start).after(t.depth);if(i===void 0)return!0;const n=r.doc.nodeAt(i);return!(t.node.type===(n==null?void 0:n.type)&&Or(r.doc,i))||!p9(t.node.attrs.type,n==null?void 0:n.attrs.type)||r.join(i),!0};function $O(r){const e=r.doc,t=e.firstChild;if(!t)return null;const i=e.resolve(1),n=e.resolve(t.nodeSize-1);return pe.between(i,n)}var eF=(r,e,t,i={})=>({editor:n,tr:a,state:l,dispatch:s,chain:p,commands:d,can:c})=>{const{extensions:b,splittableMarks:m}=n.extensionManager,g=Ie(r,l.schema),x=Ie(e,l.schema),{selection:u,storedMarks:h}=l,{$from:f,$to:w}=u,y=f.blockRange(w),E=h||u.$to.parentOffset&&u.$from.marks();if(!y)return!1;const S=Va(N=>Ap(N.type.name,b))(u),P=u.from===0&&u.to===l.doc.content.size,v=l.doc.content.content,M=v.length===1?v[0]:null,C=P&&M&&Ap(M.type.name,b)?{node:M,pos:0}:null,k=S??C,T=!!S&&y.depth>=1&&y.depth-S.depth<=1,V=!!C;if((T||V)&&k){if(k.node.type===g)return P&&V?p().command(({tr:N,dispatch:A})=>{const I=$O(N);return I?(N.setSelection(I),A&&A(N),!0):!1}).liftListItem(x).run():d.liftListItem(x);if(Ap(k.node.type.name,b)&&g.validContent(k.node.content))return p().command(()=>(a.setNodeMarkup(k.pos,g),!0)).command(()=>_p(a,g)).command(()=>Dp(a,g)).run()}return!t||!E||!s?p().command(()=>c().wrapInList(g,i)?!0:d.clearNodes()).wrapInList(g,i).command(()=>_p(a,g)).command(()=>Dp(a,g)).run():p().command(()=>{const N=c().wrapInList(g,i),A=E.filter(I=>m.includes(I.type.name));return a.ensureMarks(A),N?!0:d.clearNodes()}).wrapInList(g,i).command(()=>_p(a,g)).command(()=>Dp(a,g)).run()},tF=(r,e={},t={})=>({state:i,commands:n})=>{const{extendEmptyMarkRange:a=!1}=t,l=wr(r,i.schema);return Np(i,l,e)?n.unsetMark(l,{extendEmptyMarkRange:a}):n.setMark(l,e)},rF=(r,e,t={})=>({state:i,commands:n})=>{const a=Ie(r,i.schema),l=Ie(e,i.schema),s=Qr(i,a,t);let p;return i.selection.$anchor.sameParent(i.selection.$head)&&(p=i.selection.$anchor.parent.attrs),s?n.setNode(l,p):n.setNode(a,{...p,...t})},oF=(r,e={})=>({state:t,commands:i})=>{const n=Ie(r,t.schema);return Qr(t,n,e)?i.lift(n):i.wrapIn(n,e)},iF=()=>({state:r,dispatch:e})=>{const t=r.plugins;for(let i=0;i<t.length;i+=1){const n=t[i];let a;if(n.spec.isInputRules&&(a=n.getState(r))){if(e){const l=r.tr,s=a.transform;for(let p=s.steps.length-1;p>=0;p-=1)l.step(s.steps[p].invert(s.docs[p]));if(a.text){const p=l.doc.resolve(a.from).marks();l.replaceWith(a.from,a.to,r.schema.text(a.text,p))}else l.delete(a.from,a.to)}return!0}}return!1},nF=(r={})=>({tr:e,dispatch:t,editor:i})=>{const{ignoreClearable:n=!1}=r,{selection:a}=e,{empty:l,ranges:s}=a;if(l)return!0;const{nonClearableMarks:p}=i.extensionManager;if(t){const d=Object.values(i.schema.marks).filter(c=>n||!p.includes(c.name));s.forEach(c=>{for(const b of d)e.removeMark(c.$from.pos,c.$to.pos,b)})}return!0},aF=(r,e={})=>({tr:t,state:i,dispatch:n})=>{var a;const{extendEmptyMarkRange:l=!1}=e,{selection:s}=t,p=wr(r,i.schema),{$from:d,empty:c,ranges:b}=s;if(!n)return!0;if(c&&l){let{from:m,to:g}=s;const x=(a=d.marks().find(h=>h.type===p))==null?void 0:a.attrs,u=Ep(d,p,x);u&&(m=u.from,g=u.to),t.removeMark(m,g,p)}else b.forEach(m=>{t.removeMark(m.$from.pos,m.$to.pos,p)});return t.removeStoredMark(p),!0},lF=r=>({tr:e,state:t,dispatch:i})=>{const{selection:n}=t;let a,l;return typeof r=="number"?(a=r,l=r):r&&"from"in r&&"to"in r?(a=r.from,l=r.to):(a=n.from,l=n.to),i&&e.doc.nodesBetween(a,l,(s,p)=>{if(s.isText)return;const d={...s.attrs};delete d.dir,e.setNodeMarkup(p,void 0,d)}),!0},sF=(r,e={})=>({tr:t,state:i,dispatch:n})=>{let a=null,l=null;const s=Ia(typeof r=="string"?r:r.name,i.schema);if(!s)return!1;s==="node"&&(a=Ie(r,i.schema)),s==="mark"&&(l=wr(r,i.schema));let p=!1;return t.selection.ranges.forEach(d=>{const c=d.$from.pos,b=d.$to.pos;let m,g,x,u;t.selection.empty?i.doc.nodesBetween(c,b,(h,f)=>{a&&a===h.type&&(p=!0,x=Math.max(f,c),u=Math.min(f+h.nodeSize,b),m=f,g=h)}):i.doc.nodesBetween(c,b,(h,f)=>{f<c&&a&&a===h.type&&(p=!0,x=Math.max(f,c),u=Math.min(f+h.nodeSize,b),m=f,g=h),f>=c&&f<=b&&(a&&a===h.type&&(p=!0,n&&t.setNodeMarkup(f,void 0,{...h.attrs,...e})),l&&h.marks.length&&h.marks.forEach(w=>{if(l===w.type&&(p=!0,n)){const y=Math.max(f,c),E=Math.min(f+h.nodeSize,b);t.addMark(y,E,l.create({...w.attrs,...e}))}}))}),g&&(m!==void 0&&n&&t.setNodeMarkup(m,void 0,{...g.attrs,...e}),l&&g.marks.length&&g.marks.forEach(h=>{l===h.type&&n&&t.addMark(x,u,l.create({...h.attrs,...e}))}))}),p},pF=(r,e={})=>({state:t,dispatch:i})=>{const n=Ie(r,t.schema);return _V(n,e)(t,i)},dF=(r,e={})=>({state:t,dispatch:i})=>{const n=Ie(r,t.schema);return DV(n,e)(t,i)},cF=class{constructor(){this.callbacks={}}on(r,e){return this.callbacks[r]||(this.callbacks[r]=[]),this.callbacks[r].push(e),this}emit(r,...e){const t=this.callbacks[r];return t&&t.forEach(i=>i.apply(this,e)),this}off(r,e){const t=this.callbacks[r];return t&&(e?this.callbacks[r]=t.filter(i=>i!==e):delete this.callbacks[r]),this}once(r,e){const t=(...i)=>{this.off(r,t),e.apply(this,i)};return this.on(r,t)}removeAllListeners(){this.callbacks={}}};function bF(r,e){const{selection:t}=r,{$from:i}=t;if(t instanceof ae){const a=i.index();return i.parent.canReplaceWith(a,a+1,e)}let n=i.depth;for(;n>=0;){const a=i.index(n);if(i.node(n).contentMatchAt(a).matchType(e))return!0;n-=1}return!1}function d9(r,e,t){const i=document.querySelector(`style[data-tiptap-style${t?`-${t}`:""}]`);if(i!==null)return i;const n=document.createElement("style");return e&&n.setAttribute("nonce",e),n.setAttribute(`data-tiptap-style${t?`-${t}`:""}`,""),n.innerHTML=r,document.getElementsByTagName("head")[0].appendChild(n),n}function mF(r){return typeof r=="number"}function gF(r){return Object.prototype.toString.call(r).slice(8,-1)}function Ra(r){return gF(r)!=="Object"?!1:r.constructor===Object&&Object.getPrototypeOf(r)===Object.prototype}var uF={};Cp(uF,{createAtomBlockMarkdownSpec:()=>xF,createBlockMarkdownSpec:()=>hF,createInlineMarkdownSpec:()=>wF,parseAttributes:()=>zp,parseIndentedBlocks:()=>Vp,renderNestedMarkdownContent:()=>Hp,serializeAttributes:()=>Ip});function zp(r){if(!(r!=null&&r.trim()))return{};const e={},t=[],i=r.replace(/["']([^"']*)["']/g,d=>(t.push(d),`__QUOTED_${t.length-1}__`)),n=i.match(/(?:^|\s)\.([\w-]+)/g);if(n){const d=n.map(c=>c.trim().slice(1));e.class=d.join(" ")}const a=i.match(/(?:^|\s)#([\w-]+)/);a&&(e.id=a[1]);const l=/([a-zA-Z][\w-]*)\s*=\s*(__QUOTED_\d+__)/g;Array.from(i.matchAll(l)).forEach(([,d,c])=>{var b;const m=parseInt(((b=c.match(/__QUOTED_(\d+)__/))==null?void 0:b[1])||"0",10),g=t[m];g&&(e[d]=g.slice(1,-1))});const p=i.replace(/(?:^|\s)\.([\w-]+)/g,"").replace(/(?:^|\s)#([\w-]+)/g,"").replace(/([a-zA-Z][\w-]*)\s*=\s*__QUOTED_\d+__/g,"").trim();return p&&p.split(/\s+/).filter(Boolean).forEach(c=>{c.match(/^[a-zA-Z][\w-]*$/)&&(e[c]=!0)}),e}function Ip(r){if(!r||Object.keys(r).length===0)return"";const e=[];return r.class&&String(r.class).split(/\s+/).filter(Boolean).forEach(i=>e.push(`.${i}`)),r.id&&e.push(`#${r.id}`),Object.entries(r).forEach(([t,i])=>{t==="class"||t==="id"||(i===!0?e.push(t):i!==!1&&i!=null&&e.push(`${t}="${String(i)}"`))}),e.join(" ")}function xF(r){const{nodeName:e,name:t,parseAttributes:i=zp,serializeAttributes:n=Ip,defaultAttributes:a={},requiredAttributes:l=[],allowedAttributes:s}=r,p=t||e,d=c=>{if(!s)return c;const b={};return s.forEach(m=>{m in c&&(b[m]=c[m])}),b};return{parseMarkdown:(c,b)=>{const m={...a,...c.attributes};return b.createNode(e,m,[])},markdownTokenizer:{name:e,level:"block",start(c){var b;const m=new RegExp(`^:::${p}(?:\\s|$)`,"m"),g=(b=c.match(m))==null?void 0:b.index;return g!==void 0?g:-1},tokenize(c,b,m){const g=new RegExp(`^:::${p}(?:\\s+\\{([^}]*)\\})?\\s*:::(?:\\n|$)`),x=c.match(g);if(!x)return;const u=x[1]||"",h=i(u);if(!l.find(w=>!(w in h)))return{type:e,raw:x[0],attributes:h}}},renderMarkdown:c=>{const b=d(c.attrs||{}),m=n(b),g=m?` {${m}}`:"";return`:::${p}${g} :::`}}}function hF(r){const{nodeName:e,name:t,getContent:i,parseAttributes:n=zp,serializeAttributes:a=Ip,defaultAttributes:l={},content:s="block",allowedAttributes:p}=r,d=t||e,c=b=>{if(!p)return b;const m={};return p.forEach(g=>{g in b&&(m[g]=b[g])}),m};return{parseMarkdown:(b,m)=>{let g;if(i){const u=i(b);g=typeof u=="string"?[{type:"text",text:u}]:u}else s==="block"?g=m.parseChildren(b.tokens||[]):g=m.parseInline(b.tokens||[]);const x={...l,...b.attributes};return m.createNode(e,x,g)},markdownTokenizer:{name:e,level:"block",start(b){var m;const g=new RegExp(`^:::${d}`,"m"),x=(m=b.match(g))==null?void 0:m.index;return x!==void 0?x:-1},tokenize(b,m,g){var x;const u=new RegExp(`^:::${d}(?:\\s+\\{([^}]*)\\})?\\s*\\n`),h=b.match(u);if(!h)return;const[f,w=""]=h,y=n(w);let E=1;const S=f.length;let P="";const v=/^:::([\w-]*)(\s.*)?/gm,M=b.slice(S);for(v.lastIndex=0;;){const C=v.exec(M);if(C===null)break;const k=C.index,T=C[1];if(!((x=C[2])!=null&&x.endsWith(":::"))){if(T)E+=1;else if(E-=1,E===0){const V=M.slice(0,k);P=V.trim();const N=b.slice(0,S+k+C[0].length);let A=[];if(P)if(s==="block")for(A=g.blockTokens(V),A.forEach(I=>{I.text&&(!I.tokens||I.tokens.length===0)&&(I.tokens=g.inlineTokens(I.text))});A.length>0;){const I=A[A.length-1];if(I.type==="paragraph"&&(!I.text||I.text.trim()===""))A.pop();else break}else A=g.inlineTokens(P);return{type:e,raw:N,attributes:y,content:P,tokens:A}}}}}},renderMarkdown:(b,m)=>{const g=c(b.attrs||{}),x=a(g),u=x?` {${x}}`:"",h=m.renderChildren(b.content||[],`
27
27
 
@@ -41,9 +41,9 @@ ${h}
41
41
 
42
42
  ${x}`:`
43
43
  ${x}`}}),p}function c9(r,e){const t={...r};return Ra(r)&&Ra(e)&&Object.keys(e).forEach(i=>{Ra(e[i])&&Ra(r[i])?t[i]=c9(r[i],e[i]):t[i]=e[i]}),t}function vF(r,e,t={}){const{state:i}=e,{doc:n,tr:a}=i,l=r;n.descendants((s,p)=>{const d=a.mapping.map(p),c=a.mapping.map(p)+s.nodeSize;let b=null;if(s.marks.forEach(g=>{if(g!==l)return!1;b=g}),!b)return;let m=!1;if(Object.keys(t).forEach(g=>{t[g]!==b.attrs[g]&&(m=!0)}),m){const g=r.type.create({...r.attrs,...t});a.removeMark(d,c,r.type),a.addMark(d,c,g)}}),a.docChanged&&e.view.dispatch(a)}var Oa=class{constructor(r){var e;this.find=r.find,this.handler=r.handler,this.undoable=(e=r.undoable)!=null?e:!0}},kF=(r,e)=>{if(Tp(e))return e.exec(r);const t=e(r);if(!t)return null;const i=[t.text];return i.index=t.index,i.input=r,i.data=t.data,t.replaceWith&&(t.text.includes(t.replaceWith)||console.warn('[tiptap warn]: "inputRuleMatch.replaceWith" must be part of "inputRuleMatch.text".'),i.push(t.replaceWith)),i};function Fa(r){var e;const{editor:t,from:i,to:n,text:a,rules:l,plugin:s}=r,{view:p}=t;if(p.composing)return!1;const d=p.state.doc.resolve(i);if(d.parent.type.spec.code||(e=d.nodeBefore||d.nodeAfter)!=null&&e.marks.find(m=>m.type.spec.code))return!1;let c=!1;const b=VO(d)+a;return l.forEach(m=>{if(c)return;const g=kF(b,m.find);if(!g)return;const x=p.state.tr,u=Na({state:p.state,transaction:x}),h={from:i-(g[0].length-a.length),to:n},{commands:f,chain:w,can:y}=new Aa({editor:t,state:u});m.handler({state:u,range:h,match:g,commands:f,chain:w,can:y})===null||!x.steps.length||(m.undoable&&x.setMeta(s,{transform:x,from:i,to:n,text:a}),p.dispatch(x),c=!0)}),c}function SF(r){const{editor:e,rules:t}=r,i=new Me({state:{init(){return null},apply(n,a,l){const s=n.getMeta(i);if(s)return s;const p=n.getMeta("applyInputRules");return!!p&&setTimeout(()=>{let{text:c}=p;typeof c=="string"?c=c:c=Bp(G.from(c),l.schema);const{from:b}=p,m=b+c.length;Fa({editor:e,from:b,to:m,text:c,rules:t,plugin:i})}),n.selectionSet||n.docChanged?null:a}},props:{handleTextInput(n,a,l,s){return Fa({editor:e,from:a,to:l,text:s,rules:t,plugin:i})},handleDOMEvents:{compositionend:n=>(setTimeout(()=>{const{$cursor:a}=n.state.selection;a&&Fa({editor:e,from:a.pos,to:a.pos,text:"",rules:t,plugin:i})}),!1)},handleKeyDown(n,a){if(a.key!=="Enter")return!1;const{$cursor:l}=n.state.selection;return l?Fa({editor:e,from:l.pos,to:l.pos,text:`
44
- `,rules:t,plugin:i}):!1}},isInputRules:!0});return i}var Rp=class{constructor(r={}){this.type="extendable",this.parent=null,this.child=null,this.name="",this.config={name:this.name},this.config={...this.config,...r},this.name=this.config.name}get options(){return{...he(te(this,"addOptions",{name:this.name}))}}get storage(){return{...he(te(this,"addStorage",{name:this.name,options:this.options}))}}configure(r={}){const e=this.extend({...this.config,addOptions:()=>c9(this.options,r)});return e.name=this.name,e.parent=this.parent,this.child=null,e}extend(r={}){const e=new this.constructor({...this.config,...r});return e.parent=this,this.child=e,e.name="name"in r?r.name:e.parent.name,e}},Do=class jz extends Rp{constructor(){super(...arguments),this.type="mark"}static create(e={}){const t=typeof e=="function"?e():e;return new jz(t)}static handleExit({editor:e,mark:t}){const{tr:i}=e.state,n=e.state.selection.$from;if(n.pos===n.end()){const l=n.marks();if(!!!l.find(d=>(d==null?void 0:d.type.name)===t.name))return!1;const p=l.find(d=>(d==null?void 0:d.type.name)===t.name);return p&&i.removeStoredMark(p),i.insertText(" ",n.pos),e.view.dispatch(i),!0}return!1}configure(e){return super.configure(e)}extend(e){const t=typeof e=="function"?e():e;return super.extend(t)}},CF=class{constructor(r){this.find=r.find,this.handler=r.handler}},TF=(r,e,t)=>{if(Tp(e))return[...r.matchAll(e)];const i=e(r,t);return i?i.map(n=>{const a=[n.text];return a.index=n.index,a.input=r,a.data=n.data,n.replaceWith&&(n.text.includes(n.replaceWith)||console.warn('[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".'),a.push(n.replaceWith)),a}):[]};function EF(r){const{editor:e,state:t,from:i,to:n,rule:a,pasteEvent:l,dropEvent:s}=r,{commands:p,chain:d,can:c}=new Aa({editor:e,state:t}),b=[];return t.doc.nodesBetween(i,n,(g,x)=>{var u,h,f,w,y;if((h=(u=g.type)==null?void 0:u.spec)!=null&&h.code||!(g.isText||g.isTextblock||g.isInline))return;const E=(y=(w=(f=g.content)==null?void 0:f.size)!=null?w:g.nodeSize)!=null?y:0,S=Math.max(i,x),P=Math.min(n,x+E);if(S>=P)return;const v=g.isText?g.text||"":g.textBetween(S-x,P-x,void 0,"");TF(v,a.find,l).forEach(C=>{if(C.index===void 0)return;const k=S+C.index+1,T=k+C[0].length,V={from:t.tr.mapping.map(k),to:t.tr.mapping.map(T)},N=a.handler({state:t,range:V,match:C,commands:p,chain:d,can:c,pasteEvent:l,dropEvent:s});b.push(N)})}),b.every(g=>g!==null)}var ja=null,MF=r=>{var e;const t=new ClipboardEvent("paste",{clipboardData:new DataTransfer});return(e=t.clipboardData)==null||e.setData("text/html",r),t};function PF(r){const{editor:e,rules:t}=r;let i=null,n=!1,a=!1,l=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,s;try{s=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{s=null}const p=({state:c,from:b,to:m,rule:g,pasteEvt:x})=>{const u=c.tr,h=Na({state:c,transaction:u});if(!(!EF({editor:e,state:h,from:Math.max(b-1,0),to:m.b-1,rule:g,pasteEvent:x,dropEvent:s})||!u.steps.length)){try{s=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{s=null}return l=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,u}};return t.map(c=>new Me({view(b){const m=x=>{var u;i=(u=b.dom.parentElement)!=null&&u.contains(x.target)?b.dom.parentElement:null,i&&(ja=e)},g=()=>{ja&&(ja=null)};return window.addEventListener("dragstart",m),window.addEventListener("dragend",g),{destroy(){window.removeEventListener("dragstart",m),window.removeEventListener("dragend",g)}}},props:{handleDOMEvents:{drop:(b,m)=>{if(a=i===b.dom.parentElement,s=m,!a){const g=ja;g!=null&&g.isEditable&&setTimeout(()=>{const x=g.state.selection;x&&g.commands.deleteRange({from:x.from,to:x.to})},10)}return!1},paste:(b,m)=>{var g;const x=(g=m.clipboardData)==null?void 0:g.getData("text/html");return l=m,n=!!(x!=null&&x.includes("data-pm-slice")),!1}}},appendTransaction:(b,m,g)=>{const x=b[0],u=x.getMeta("uiEvent")==="paste"&&!n,h=x.getMeta("uiEvent")==="drop"&&!a,f=x.getMeta("applyPasteRules"),w=!!f;if(!u&&!h&&!w)return;if(w){let{text:S}=f;typeof S=="string"?S=S:S=Bp(G.from(S),g.schema);const{from:P}=f,v=P+S.length,M=MF(S);return p({rule:c,state:g,from:P,to:{b:v},pasteEvt:M})}const y=m.doc.content.findDiffStart(g.doc.content),E=m.doc.content.findDiffEnd(g.doc.content);if(!(!mF(y)||!E||y===E.b))return p({rule:c,state:g,from:y,to:E,pasteEvt:l})}}))}var qa=class{constructor(r,e){this.splittableMarks=[],this.nonClearableMarks=[],this.editor=e,this.baseExtensions=r,this.extensions=$A(r),this.schema=LO(this.extensions,e),this.setupExtensions()}get commands(){return this.extensions.reduce((r,e)=>{const t={name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:this.editor,type:mn(e.name,this.schema)},i=te(e,"addCommands",t);return i?{...r,...i()}:r},{})}get plugins(){const{editor:r}=this;return bn([...this.extensions].reverse()).flatMap(i=>{const n={name:i.name,options:i.options,storage:this.editor.extensionStorage[i.name],editor:r,type:mn(i.name,this.schema)},a=[],l=te(i,"addKeyboardShortcuts",n);let s={};if(i.type==="mark"&&te(i,"exitable",n)&&(s.ArrowRight=()=>Do.handleExit({editor:r,mark:i})),l){const m=Object.fromEntries(Object.entries(l()).map(([g,x])=>[g,()=>x({editor:r})]));s={...s,...m}}const p=LR(s);a.push(p);const d=te(i,"addInputRules",n);if(i9(i,r.options.enableInputRules)&&d){const m=d();if(m&&m.length){const g=SF({editor:r,rules:m}),x=Array.isArray(g)?g:[g];a.push(...x)}}const c=te(i,"addPasteRules",n);if(i9(i,r.options.enablePasteRules)&&c){const m=c();if(m&&m.length){const g=PF({editor:r,rules:m});a.push(...g)}}const b=te(i,"addProseMirrorPlugins",n);if(b){const m=b();a.push(...m)}return a})}get attributes(){return JA(this.extensions)}get nodeViews(){const{editor:r}=this,{nodeExtensions:e}=ci(this.extensions);return Object.fromEntries(e.filter(t=>!!te(t,"addNodeView")).map(t=>{const i=this.attributes.filter(p=>p.type===t.name),n={name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:r,type:Ie(t.name,this.schema)},a=te(t,"addNodeView",n);if(!a)return[];const l=a();if(!l)return[];const s=(p,d,c,b,m)=>{const g=cn(p,i);return l({node:p,view:d,getPos:c,decorations:b,innerDecorations:m,editor:r,extension:t,HTMLAttributes:g})};return[t.name,s]}))}dispatchTransaction(r){const{editor:e}=this;return bn([...this.extensions].reverse()).reduceRight((i,n)=>{const a={name:n.name,options:n.options,storage:this.editor.extensionStorage[n.name],editor:e,type:mn(n.name,this.schema)},l=te(n,"dispatchTransaction",a);return l?s=>{l.call(a,{transaction:s,next:i})}:i},r)}transformPastedHTML(r){const{editor:e}=this;return bn([...this.extensions]).reduce((i,n)=>{const a={name:n.name,options:n.options,storage:this.editor.extensionStorage[n.name],editor:e,type:mn(n.name,this.schema)},l=te(n,"transformPastedHTML",a);return l?(s,p)=>{const d=i(s,p);return l.call(a,d)}:i},r||(i=>i))}get markViews(){const{editor:r}=this,{markExtensions:e}=ci(this.extensions);return Object.fromEntries(e.filter(t=>!!te(t,"addMarkView")).map(t=>{const i=this.attributes.filter(s=>s.type===t.name),n={name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:r,type:wr(t.name,this.schema)},a=te(t,"addMarkView",n);if(!a)return[];const l=(s,p,d)=>{const c=cn(s,i);return a()({mark:s,view:p,inline:d,editor:r,extension:t,HTMLAttributes:c,updateAttributes:b=>{vF(s,r,b)}})};return[t.name,l]}))}destroy(){this.extensions.forEach(r=>{let e=r;for(;e.parent;){const t=e.parent;t.child===e&&(t.child=null),e=t}}),this.extensions=[],this.baseExtensions=[],this.schema=null,this.editor=null}setupExtensions(){const r=this.extensions;this.editor.extensionStorage=Object.fromEntries(r.map(e=>[e.name,e.storage])),r.forEach(e=>{var t,i;const n={name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:this.editor,type:mn(e.name,this.schema)};e.type==="mark"&&(((t=he(te(e,"keepOnSplit",n)))==null||t)&&this.splittableMarks.push(e.name),(i=he(te(e,"clearable",n)))==null||i||this.nonClearableMarks.push(e.name));const a=te(e,"onBeforeCreate",n),l=te(e,"onCreate",n),s=te(e,"onUpdate",n),p=te(e,"onSelectionUpdate",n),d=te(e,"onTransaction",n),c=te(e,"onFocus",n),b=te(e,"onBlur",n),m=te(e,"onDestroy",n);a&&this.editor.on("beforeCreate",a),l&&this.editor.on("create",l),s&&this.editor.on("update",s),p&&this.editor.on("selectionUpdate",p),d&&this.editor.on("transaction",d),c&&this.editor.on("focus",c),b&&this.editor.on("blur",b),m&&this.editor.on("destroy",m)})}};qa.resolve=$A,qa.sort=bn,qa.flatten=Pp;var BF={};Cp(BF,{ClipboardTextSerializer:()=>b9,Commands:()=>m9,Delete:()=>g9,Drop:()=>u9,Editable:()=>x9,FocusEvents:()=>f9,Keymap:()=>y9,Paste:()=>w9,Tabindex:()=>v9,TextDirection:()=>k9,focusEventsPluginKey:()=>h9});var Be=class qz extends Rp{constructor(){super(...arguments),this.type="extension"}static create(e={}){const t=typeof e=="function"?e():e;return new qz(t)}configure(e){return super.configure(e)}extend(e){const t=typeof e=="function"?e():e;return super.extend(t)}},b9=Be.create({name:"clipboardTextSerializer",addOptions(){return{blockSeparator:void 0}},addProseMirrorPlugins(){return[new Me({key:new Oe("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{const{editor:r}=this,{state:e,schema:t}=r,{doc:i,selection:n}=e,a=t9(t),{blockSeparator:l}=this.options,s={...l!==void 0?{blockSeparator:l}:{},textSerializers:a};return[...n.ranges].sort((d,c)=>d.$from.pos-c.$from.pos).map(({$from:d,$to:c})=>e9(i,{from:d.pos,to:c.pos},s)).join(l??`
44
+ `,rules:t,plugin:i}):!1}},isInputRules:!0});return i}var Rp=class{constructor(r={}){this.type="extendable",this.parent=null,this.child=null,this.name="",this.config={name:this.name},this.config={...this.config,...r},this.name=this.config.name}get options(){return{...he(te(this,"addOptions",{name:this.name}))}}get storage(){return{...he(te(this,"addStorage",{name:this.name,options:this.options}))}}configure(r={}){const e=this.extend({...this.config,addOptions:()=>c9(this.options,r)});return e.name=this.name,e.parent=this.parent,this.child=null,e}extend(r={}){const e=new this.constructor({...this.config,...r});return e.parent=this,this.child=e,e.name="name"in r?r.name:e.parent.name,e}},Do=class jz extends Rp{constructor(){super(...arguments),this.type="mark"}static create(e={}){const t=typeof e=="function"?e():e;return new jz(t)}static handleExit({editor:e,mark:t}){const{tr:i}=e.state,n=e.state.selection.$from;if(n.pos===n.end()){const l=n.marks();if(!!!l.find(d=>(d==null?void 0:d.type.name)===t.name))return!1;const p=l.find(d=>(d==null?void 0:d.type.name)===t.name);return p&&i.removeStoredMark(p),i.insertText(" ",n.pos),e.view.dispatch(i),!0}return!1}configure(e){return super.configure(e)}extend(e){const t=typeof e=="function"?e():e;return super.extend(t)}},CF=class{constructor(r){this.find=r.find,this.handler=r.handler}},TF=(r,e,t)=>{if(Tp(e))return[...r.matchAll(e)];const i=e(r,t);return i?i.map(n=>{const a=[n.text];return a.index=n.index,a.input=r,a.data=n.data,n.replaceWith&&(n.text.includes(n.replaceWith)||console.warn('[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".'),a.push(n.replaceWith)),a}):[]};function EF(r){const{editor:e,state:t,from:i,to:n,rule:a,pasteEvent:l,dropEvent:s}=r,{commands:p,chain:d,can:c}=new Aa({editor:e,state:t}),b=[];return t.doc.nodesBetween(i,n,(g,x)=>{var u,h,f,w,y;if((h=(u=g.type)==null?void 0:u.spec)!=null&&h.code||!(g.isText||g.isTextblock||g.isInline))return;const E=(y=(w=(f=g.content)==null?void 0:f.size)!=null?w:g.nodeSize)!=null?y:0,S=Math.max(i,x),P=Math.min(n,x+E);if(S>=P)return;const v=g.isText?g.text||"":g.textBetween(S-x,P-x,void 0,"");TF(v,a.find,l).forEach(C=>{if(C.index===void 0)return;const k=S+C.index+1,T=k+C[0].length,V={from:t.tr.mapping.map(k),to:t.tr.mapping.map(T)},N=a.handler({state:t,range:V,match:C,commands:p,chain:d,can:c,pasteEvent:l,dropEvent:s});b.push(N)})}),b.every(g=>g!==null)}var ja=null,MF=r=>{var e;const t=new ClipboardEvent("paste",{clipboardData:new DataTransfer});return(e=t.clipboardData)==null||e.setData("text/html",r),t};function PF(r){const{editor:e,rules:t}=r;let i=null,n=!1,a=!1,l=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,s;try{s=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{s=null}const p=({state:c,from:b,to:m,rule:g,pasteEvt:x})=>{const u=c.tr,h=Na({state:c,transaction:u});if(!(!EF({editor:e,state:h,from:Math.max(b-1,0),to:m.b-1,rule:g,pasteEvent:x,dropEvent:s})||!u.steps.length)){try{s=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{s=null}return l=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,u}};return t.map(c=>new Me({view(b){const m=x=>{var u;i=(u=b.dom.parentElement)!=null&&u.contains(x.target)?b.dom.parentElement:null,i&&(ja=e)},g=()=>{ja&&(ja=null)};return window.addEventListener("dragstart",m),window.addEventListener("dragend",g),{destroy(){window.removeEventListener("dragstart",m),window.removeEventListener("dragend",g)}}},props:{handleDOMEvents:{drop:(b,m)=>{if(a=i===b.dom.parentElement,s=m,!a){const g=ja;g!=null&&g.isEditable&&setTimeout(()=>{const x=g.state.selection;x&&g.commands.deleteRange({from:x.from,to:x.to})},10)}return!1},paste:(b,m)=>{var g;const x=(g=m.clipboardData)==null?void 0:g.getData("text/html");return l=m,n=!!(x!=null&&x.includes("data-pm-slice")),!1}}},appendTransaction:(b,m,g)=>{const x=b[0],u=x.getMeta("uiEvent")==="paste"&&!n,h=x.getMeta("uiEvent")==="drop"&&!a,f=x.getMeta("applyPasteRules"),w=!!f;if(!u&&!h&&!w)return;if(w){let{text:S}=f;typeof S=="string"?S=S:S=Bp(G.from(S),g.schema);const{from:P}=f,v=P+S.length,M=MF(S);return p({rule:c,state:g,from:P,to:{b:v},pasteEvt:M})}const y=m.doc.content.findDiffStart(g.doc.content),E=m.doc.content.findDiffEnd(g.doc.content);if(!(!mF(y)||!E||y===E.b))return p({rule:c,state:g,from:y,to:E,pasteEvt:l})}}))}var qa=class{constructor(r,e){this.splittableMarks=[],this.nonClearableMarks=[],this.editor=e,this.baseExtensions=r,this.extensions=$A(r),this.schema=LO(this.extensions,e),this.setupExtensions()}get commands(){return this.extensions.reduce((r,e)=>{const t={name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:this.editor,type:mn(e.name,this.schema)},i=te(e,"addCommands",t);return i?{...r,...i()}:r},{})}get plugins(){const{editor:r}=this;return bn([...this.extensions].reverse()).flatMap(i=>{const n={name:i.name,options:i.options,storage:this.editor.extensionStorage[i.name],editor:r,type:mn(i.name,this.schema)},a=[],l=te(i,"addKeyboardShortcuts",n);let s={};if(i.type==="mark"&&te(i,"exitable",n)&&(s.ArrowRight=()=>Do.handleExit({editor:r,mark:i})),l){const m=Object.fromEntries(Object.entries(l()).map(([g,x])=>[g,()=>x({editor:r})]));s={...s,...m}}const p=LR(s);a.push(p);const d=te(i,"addInputRules",n);if(i9(i,r.options.enableInputRules)&&d){const m=d();if(m&&m.length){const g=SF({editor:r,rules:m}),x=Array.isArray(g)?g:[g];a.push(...x)}}const c=te(i,"addPasteRules",n);if(i9(i,r.options.enablePasteRules)&&c){const m=c();if(m&&m.length){const g=PF({editor:r,rules:m});a.push(...g)}}const b=te(i,"addProseMirrorPlugins",n);if(b){const m=b();a.push(...m)}return a})}get attributes(){return JA(this.extensions)}get nodeViews(){const{editor:r}=this,{nodeExtensions:e}=ci(this.extensions);return Object.fromEntries(e.filter(t=>!!te(t,"addNodeView")).map(t=>{const i=this.attributes.filter(p=>p.type===t.name),n={name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:r,type:Ie(t.name,this.schema)},a=te(t,"addNodeView",n);if(!a)return[];const l=a();if(!l)return[];const s=(p,d,c,b,m)=>{const g=cn(p,i);return l({node:p,view:d,getPos:c,decorations:b,innerDecorations:m,editor:r,extension:t,HTMLAttributes:g})};return[t.name,s]}))}dispatchTransaction(r){const{editor:e}=this;return bn([...this.extensions].reverse()).reduceRight((i,n)=>{const a={name:n.name,options:n.options,storage:this.editor.extensionStorage[n.name],editor:e,type:mn(n.name,this.schema)},l=te(n,"dispatchTransaction",a);return l?s=>{l.call(a,{transaction:s,next:i})}:i},r)}transformPastedHTML(r){const{editor:e}=this;return bn([...this.extensions]).reduce((i,n)=>{const a={name:n.name,options:n.options,storage:this.editor.extensionStorage[n.name],editor:e,type:mn(n.name,this.schema)},l=te(n,"transformPastedHTML",a);return l?(s,p)=>{const d=i(s,p);return l.call(a,d)}:i},r||(i=>i))}get markViews(){const{editor:r}=this,{markExtensions:e}=ci(this.extensions);return Object.fromEntries(e.filter(t=>!!te(t,"addMarkView")).map(t=>{const i=this.attributes.filter(s=>s.type===t.name),n={name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:r,type:wr(t.name,this.schema)},a=te(t,"addMarkView",n);if(!a)return[];const l=(s,p,d)=>{const c=cn(s,i);return a()({mark:s,view:p,inline:d,editor:r,extension:t,HTMLAttributes:c,updateAttributes:b=>{vF(s,r,b)}})};return[t.name,l]}))}destroy(){this.extensions.forEach(r=>{let e=r;for(;e.parent;){const t=e.parent;t.child===e&&(t.child=null),e=t}}),this.extensions=[],this.baseExtensions=[],this.schema=null,this.editor=null}setupExtensions(){const r=this.extensions;this.editor.extensionStorage=Object.fromEntries(r.map(e=>[e.name,e.storage])),r.forEach(e=>{var t,i;const n={name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:this.editor,type:mn(e.name,this.schema)};e.type==="mark"&&(((t=he(te(e,"keepOnSplit",n)))==null||t)&&this.splittableMarks.push(e.name),(i=he(te(e,"clearable",n)))==null||i||this.nonClearableMarks.push(e.name));const a=te(e,"onBeforeCreate",n),l=te(e,"onCreate",n),s=te(e,"onUpdate",n),p=te(e,"onSelectionUpdate",n),d=te(e,"onTransaction",n),c=te(e,"onFocus",n),b=te(e,"onBlur",n),m=te(e,"onDestroy",n);a&&this.editor.on("beforeCreate",a),l&&this.editor.on("create",l),s&&this.editor.on("update",s),p&&this.editor.on("selectionUpdate",p),d&&this.editor.on("transaction",d),c&&this.editor.on("focus",c),b&&this.editor.on("blur",b),m&&this.editor.on("destroy",m)})}};qa.resolve=$A,qa.sort=bn,qa.flatten=Pp;var BF={};Cp(BF,{ClipboardTextSerializer:()=>b9,Commands:()=>m9,Delete:()=>g9,Drop:()=>u9,Editable:()=>x9,FocusEvents:()=>f9,Keymap:()=>y9,Paste:()=>w9,Tabindex:()=>v9,TextDirection:()=>k9,focusEventsPluginKey:()=>h9});var Be=class qz extends Rp{constructor(){super(...arguments),this.type="extension"}static create(e={}){const t=typeof e=="function"?e():e;return new qz(t)}configure(e){return super.configure(e)}extend(e){const t=typeof e=="function"?e():e;return super.extend(t)}},b9=Be.create({name:"clipboardTextSerializer",addOptions(){return{blockSeparator:void 0}},addProseMirrorPlugins(){return[new Me({key:new Fe("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{const{editor:r}=this,{state:e,schema:t}=r,{doc:i,selection:n}=e,a=t9(t),{blockSeparator:l}=this.options,s={...l!==void 0?{blockSeparator:l}:{},textSerializers:a};return[...n.ranges].sort((d,c)=>d.$from.pos-c.$from.pos).map(({$from:d,$to:c})=>e9(i,{from:d.pos,to:c.pos},s)).join(l??`
45
45
 
46
- `)}}})]}}),m9=Be.create({name:"commands",addCommands(){return{...zA}}}),g9=Be.create({name:"delete",onUpdate({transaction:r,appendedTransactions:e}){var t,i,n;const a=()=>{var l,s,p,d;if((d=(p=(s=(l=this.editor.options.coreExtensionOptions)==null?void 0:l.delete)==null?void 0:s.filterTransaction)==null?void 0:p.call(s,r))!=null?d:r.getMeta("y-sync$"))return;const c=GA(r.before,[r,...e]);o9(c).forEach(g=>{c.mapping.mapResult(g.oldRange.from).deletedAfter&&c.mapping.mapResult(g.oldRange.to).deletedBefore&&c.before.nodesBetween(g.oldRange.from,g.oldRange.to,(x,u)=>{const h=u+x.nodeSize-2,f=g.oldRange.from<=u&&h<=g.oldRange.to;this.editor.emit("delete",{type:"node",node:x,from:u,to:h,newFrom:c.mapping.map(u),newTo:c.mapping.map(h),deletedRange:g.oldRange,newRange:g.newRange,partial:!f,editor:this.editor,transaction:r,combinedTransform:c})})});const m=c.mapping;c.steps.forEach((g,x)=>{var u,h;if(g instanceof ei){const f=m.slice(x).map(g.from,-1),w=m.slice(x).map(g.to),y=m.invert().map(f,-1),E=m.invert().map(w),S=f>0?(u=c.doc.nodeAt(f-1))==null?void 0:u.marks.some(v=>v.eq(g.mark)):!1,P=(h=c.doc.nodeAt(w))==null?void 0:h.marks.some(v=>v.eq(g.mark));this.editor.emit("delete",{type:"mark",mark:g.mark,from:g.from,to:g.to,deletedRange:{from:y,to:E},newRange:{from:f,to:w},partial:!!(P||S),editor:this.editor,transaction:r,combinedTransform:c})}})};(n=(i=(t=this.editor.options.coreExtensionOptions)==null?void 0:t.delete)==null?void 0:i.async)==null||n?setTimeout(a,0):a()}}),u9=Be.create({name:"drop",addProseMirrorPlugins(){return[new Me({key:new Oe("tiptapDrop"),props:{handleDrop:(r,e,t,i)=>{this.editor.emit("drop",{editor:this.editor,event:e,slice:t,moved:i})}}})]}}),x9=Be.create({name:"editable",addProseMirrorPlugins(){return[new Me({key:new Oe("editable"),props:{editable:()=>this.editor.options.editable}})]}}),h9=new Oe("focusEvents"),f9=Be.create({name:"focusEvents",addProseMirrorPlugins(){const{editor:r}=this;return[new Me({key:h9,props:{handleDOMEvents:{focus:(e,t)=>{r.isFocused=!0;const i=r.state.tr.setMeta("focus",{event:t}).setMeta("addToHistory",!1);return e.dispatch(i),!1},blur:(e,t)=>{r.isFocused=!1;const i=r.state.tr.setMeta("blur",{event:t}).setMeta("addToHistory",!1);return e.dispatch(i),!1}}}})]}}),y9=Be.create({name:"keymap",addKeyboardShortcuts(){const r=()=>this.editor.commands.first(({commands:l})=>[()=>l.undoInputRule(),()=>l.command(({tr:s})=>{const{selection:p,doc:d}=s,{empty:c,$anchor:b}=p,{pos:m,parent:g}=b,x=b.parent.isTextblock&&m>0?s.doc.resolve(m-1):b,u=x.parent.type.spec.isolating,h=b.pos-b.parentOffset,f=u&&x.parent.childCount===1?h===b.pos:de.atStart(d).from===m;return!c||!g.type.isTextblock||g.textContent.length||!f||f&&b.parent.type.name==="paragraph"?!1:l.clearNodes()}),()=>l.deleteSelection(),()=>l.joinBackward(),()=>l.selectNodeBackward()]),e=()=>this.editor.commands.first(({commands:l})=>[()=>l.deleteSelection(),()=>l.deleteCurrentNode(),()=>l.joinForward(),()=>l.selectNodeForward()]),i={Enter:()=>this.editor.commands.first(({commands:l})=>[()=>l.newlineInCode(),()=>l.createParagraphNear(),()=>l.liftEmptyBlock(),()=>l.splitBlock()]),"Mod-Enter":()=>this.editor.commands.exitCode(),Backspace:r,"Mod-Backspace":r,"Shift-Backspace":r,Delete:e,"Mod-Delete":e,"Mod-a":()=>this.editor.commands.selectAll()},n={...i},a={...i,"Ctrl-h":r,"Alt-Backspace":r,"Ctrl-d":e,"Ctrl-Alt-Backspace":e,"Alt-Delete":e,"Alt-d":e,"Ctrl-a":()=>this.editor.commands.selectTextblockStart(),"Ctrl-e":()=>this.editor.commands.selectTextblockEnd()};return Da()||qA()?a:n},addProseMirrorPlugins(){return[new Me({key:new Oe("clearDocument"),appendTransaction:(r,e,t)=>{if(r.some(u=>u.getMeta("composition")))return;const i=r.some(u=>u.docChanged)&&!e.doc.eq(t.doc),n=r.some(u=>u.getMeta("preventClearDocument"));if(!i||n)return;const{empty:a,from:l,to:s}=e.selection,p=de.atStart(e.doc).from,d=de.atEnd(e.doc).to;if(a||!(l===p&&s===d)||!gn(t.doc))return;const m=t.tr,g=Na({state:t,transaction:m}),{commands:x}=new Aa({editor:this.editor,state:g});if(x.clearNodes(),!!m.steps.length)return m}})]}}),w9=Be.create({name:"paste",addProseMirrorPlugins(){return[new Me({key:new Oe("tiptapPaste"),props:{handlePaste:(r,e,t)=>{this.editor.emit("paste",{editor:this.editor,event:e,slice:t})}}})]}}),v9=Be.create({name:"tabindex",addOptions(){return{value:void 0}},addProseMirrorPlugins(){return[new Me({key:new Oe("tabindex"),props:{attributes:()=>{var r;return!this.editor.isEditable&&this.options.value===void 0?{}:{tabindex:(r=this.options.value)!=null?r:"0"}}}})]}}),k9=Be.create({name:"textDirection",addOptions(){return{direction:void 0}},addGlobalAttributes(){if(!this.options.direction)return[];const{nodeExtensions:r}=ci(this.extensions);return[{types:r.filter(e=>e.name!=="text").map(e=>e.name),attributes:{dir:{default:this.options.direction,parseHTML:e=>{const t=e.getAttribute("dir");return t&&(t==="ltr"||t==="rtl"||t==="auto")?t:this.options.direction},renderHTML:e=>e.dir?{dir:e.dir}:{}}}}]},addProseMirrorPlugins(){return[new Me({key:new Oe("textDirection"),props:{attributes:()=>{const r=this.options.direction;return r?{dir:r}:{}}}})]}}),LF=class ta{constructor(e,t,i=!1,n=null){this.currentNode=null,this.actualDepth=null,this.isBlock=i,this.resolvedPos=e,this.editor=t,this.currentNode=n}get name(){return this.node.type.name}get node(){return this.currentNode||this.resolvedPos.node()}get element(){return this.editor.view.domAtPos(this.pos).node}get depth(){var e;return(e=this.actualDepth)!=null?e:this.resolvedPos.depth}get pos(){return this.resolvedPos.pos}get content(){return this.node.content}set content(e){let t=this.from,i=this.to;if(this.isBlock){if(this.content.size===0){console.error(`You can’t set content on a block node. Tried to set content on ${this.name} at ${this.pos}`);return}t=this.from+1,i=this.to-1}this.editor.commands.insertContentAt({from:t,to:i},e)}get attributes(){return this.node.attrs}get textContent(){return this.node.textContent}get size(){return this.node.nodeSize}get from(){return this.isBlock?this.pos:this.resolvedPos.start(this.resolvedPos.depth)}get range(){return{from:this.from,to:this.to}}get to(){return this.isBlock?this.pos+this.size:this.resolvedPos.end(this.resolvedPos.depth)+(this.node.isText?0:1)}get parent(){if(this.depth===0)return null;const e=this.resolvedPos.start(this.resolvedPos.depth-1),t=this.resolvedPos.doc.resolve(e);return new ta(t,this.editor)}get before(){let e=this.resolvedPos.doc.resolve(this.from-(this.isBlock?1:2));return e.depth!==this.depth&&(e=this.resolvedPos.doc.resolve(this.from-3)),new ta(e,this.editor)}get after(){let e=this.resolvedPos.doc.resolve(this.to+(this.isBlock?2:1));return e.depth!==this.depth&&(e=this.resolvedPos.doc.resolve(this.to+3)),new ta(e,this.editor)}get children(){const e=[];return this.node.content.forEach((t,i)=>{const n=t.isBlock&&!t.isTextblock,a=t.isAtom&&!t.isText,l=t.isInline,s=this.pos+i+(a?0:1);if(s<0||s>this.resolvedPos.doc.nodeSize-2)return;const p=this.resolvedPos.doc.resolve(s);if(!n&&!l&&p.depth<=this.depth)return;const d=new ta(p,this.editor,n,n||l?t:null);n&&(d.actualDepth=this.depth+1),e.push(d)}),e}get firstChild(){return this.children[0]||null}get lastChild(){const e=this.children;return e[e.length-1]||null}closest(e,t={}){let i=null,n=this.parent;for(;n&&!i;){if(n.node.type.name===e)if(Object.keys(t).length>0){const a=n.node.attrs,l=Object.keys(t);for(let s=0;s<l.length;s+=1){const p=l[s];if(a[p]!==t[p])break}}else i=n;n=n.parent}return i}querySelector(e,t={}){return this.querySelectorAll(e,t,!0)[0]||null}querySelectorAll(e,t={},i=!1){let n=[];if(!this.children||this.children.length===0)return n;const a=Object.keys(t);return this.children.forEach(l=>{i&&n.length>0||(l.node.type.name===e&&a.every(p=>t[p]===l.node.attrs[p])&&n.push(l),!(i&&n.length>0)&&(n=n.concat(l.querySelectorAll(e,t,i))))}),n}setAttribute(e){const{tr:t}=this.editor.state;t.setNodeMarkup(this.from,void 0,{...this.node.attrs,...e}),this.editor.view.dispatch(t)}},NF=`.ProseMirror {
46
+ `)}}})]}}),m9=Be.create({name:"commands",addCommands(){return{...zA}}}),g9=Be.create({name:"delete",onUpdate({transaction:r,appendedTransactions:e}){var t,i,n;const a=()=>{var l,s,p,d;if((d=(p=(s=(l=this.editor.options.coreExtensionOptions)==null?void 0:l.delete)==null?void 0:s.filterTransaction)==null?void 0:p.call(s,r))!=null?d:r.getMeta("y-sync$"))return;const c=GA(r.before,[r,...e]);o9(c).forEach(g=>{c.mapping.mapResult(g.oldRange.from).deletedAfter&&c.mapping.mapResult(g.oldRange.to).deletedBefore&&c.before.nodesBetween(g.oldRange.from,g.oldRange.to,(x,u)=>{const h=u+x.nodeSize-2,f=g.oldRange.from<=u&&h<=g.oldRange.to;this.editor.emit("delete",{type:"node",node:x,from:u,to:h,newFrom:c.mapping.map(u),newTo:c.mapping.map(h),deletedRange:g.oldRange,newRange:g.newRange,partial:!f,editor:this.editor,transaction:r,combinedTransform:c})})});const m=c.mapping;c.steps.forEach((g,x)=>{var u,h;if(g instanceof ei){const f=m.slice(x).map(g.from,-1),w=m.slice(x).map(g.to),y=m.invert().map(f,-1),E=m.invert().map(w),S=f>0?(u=c.doc.nodeAt(f-1))==null?void 0:u.marks.some(v=>v.eq(g.mark)):!1,P=(h=c.doc.nodeAt(w))==null?void 0:h.marks.some(v=>v.eq(g.mark));this.editor.emit("delete",{type:"mark",mark:g.mark,from:g.from,to:g.to,deletedRange:{from:y,to:E},newRange:{from:f,to:w},partial:!!(P||S),editor:this.editor,transaction:r,combinedTransform:c})}})};(n=(i=(t=this.editor.options.coreExtensionOptions)==null?void 0:t.delete)==null?void 0:i.async)==null||n?setTimeout(a,0):a()}}),u9=Be.create({name:"drop",addProseMirrorPlugins(){return[new Me({key:new Fe("tiptapDrop"),props:{handleDrop:(r,e,t,i)=>{this.editor.emit("drop",{editor:this.editor,event:e,slice:t,moved:i})}}})]}}),x9=Be.create({name:"editable",addProseMirrorPlugins(){return[new Me({key:new Fe("editable"),props:{editable:()=>this.editor.options.editable}})]}}),h9=new Fe("focusEvents"),f9=Be.create({name:"focusEvents",addProseMirrorPlugins(){const{editor:r}=this;return[new Me({key:h9,props:{handleDOMEvents:{focus:(e,t)=>{r.isFocused=!0;const i=r.state.tr.setMeta("focus",{event:t}).setMeta("addToHistory",!1);return e.dispatch(i),!1},blur:(e,t)=>{r.isFocused=!1;const i=r.state.tr.setMeta("blur",{event:t}).setMeta("addToHistory",!1);return e.dispatch(i),!1}}}})]}}),y9=Be.create({name:"keymap",addKeyboardShortcuts(){const r=()=>this.editor.commands.first(({commands:l})=>[()=>l.undoInputRule(),()=>l.command(({tr:s})=>{const{selection:p,doc:d}=s,{empty:c,$anchor:b}=p,{pos:m,parent:g}=b,x=b.parent.isTextblock&&m>0?s.doc.resolve(m-1):b,u=x.parent.type.spec.isolating,h=b.pos-b.parentOffset,f=u&&x.parent.childCount===1?h===b.pos:de.atStart(d).from===m;return!c||!g.type.isTextblock||g.textContent.length||!f||f&&b.parent.type.name==="paragraph"?!1:l.clearNodes()}),()=>l.deleteSelection(),()=>l.joinBackward(),()=>l.selectNodeBackward()]),e=()=>this.editor.commands.first(({commands:l})=>[()=>l.deleteSelection(),()=>l.deleteCurrentNode(),()=>l.joinForward(),()=>l.selectNodeForward()]),i={Enter:()=>this.editor.commands.first(({commands:l})=>[()=>l.newlineInCode(),()=>l.createParagraphNear(),()=>l.liftEmptyBlock(),()=>l.splitBlock()]),"Mod-Enter":()=>this.editor.commands.exitCode(),Backspace:r,"Mod-Backspace":r,"Shift-Backspace":r,Delete:e,"Mod-Delete":e,"Mod-a":()=>this.editor.commands.selectAll()},n={...i},a={...i,"Ctrl-h":r,"Alt-Backspace":r,"Ctrl-d":e,"Ctrl-Alt-Backspace":e,"Alt-Delete":e,"Alt-d":e,"Ctrl-a":()=>this.editor.commands.selectTextblockStart(),"Ctrl-e":()=>this.editor.commands.selectTextblockEnd()};return Da()||qA()?a:n},addProseMirrorPlugins(){return[new Me({key:new Fe("clearDocument"),appendTransaction:(r,e,t)=>{if(r.some(u=>u.getMeta("composition")))return;const i=r.some(u=>u.docChanged)&&!e.doc.eq(t.doc),n=r.some(u=>u.getMeta("preventClearDocument"));if(!i||n)return;const{empty:a,from:l,to:s}=e.selection,p=de.atStart(e.doc).from,d=de.atEnd(e.doc).to;if(a||!(l===p&&s===d)||!gn(t.doc))return;const m=t.tr,g=Na({state:t,transaction:m}),{commands:x}=new Aa({editor:this.editor,state:g});if(x.clearNodes(),!!m.steps.length)return m}})]}}),w9=Be.create({name:"paste",addProseMirrorPlugins(){return[new Me({key:new Fe("tiptapPaste"),props:{handlePaste:(r,e,t)=>{this.editor.emit("paste",{editor:this.editor,event:e,slice:t})}}})]}}),v9=Be.create({name:"tabindex",addOptions(){return{value:void 0}},addProseMirrorPlugins(){return[new Me({key:new Fe("tabindex"),props:{attributes:()=>{var r;return!this.editor.isEditable&&this.options.value===void 0?{}:{tabindex:(r=this.options.value)!=null?r:"0"}}}})]}}),k9=Be.create({name:"textDirection",addOptions(){return{direction:void 0}},addGlobalAttributes(){if(!this.options.direction)return[];const{nodeExtensions:r}=ci(this.extensions);return[{types:r.filter(e=>e.name!=="text").map(e=>e.name),attributes:{dir:{default:this.options.direction,parseHTML:e=>{const t=e.getAttribute("dir");return t&&(t==="ltr"||t==="rtl"||t==="auto")?t:this.options.direction},renderHTML:e=>e.dir?{dir:e.dir}:{}}}}]},addProseMirrorPlugins(){return[new Me({key:new Fe("textDirection"),props:{attributes:()=>{const r=this.options.direction;return r?{dir:r}:{}}}})]}}),LF=class ta{constructor(e,t,i=!1,n=null){this.currentNode=null,this.actualDepth=null,this.isBlock=i,this.resolvedPos=e,this.editor=t,this.currentNode=n}get name(){return this.node.type.name}get node(){return this.currentNode||this.resolvedPos.node()}get element(){return this.editor.view.domAtPos(this.pos).node}get depth(){var e;return(e=this.actualDepth)!=null?e:this.resolvedPos.depth}get pos(){return this.resolvedPos.pos}get content(){return this.node.content}set content(e){let t=this.from,i=this.to;if(this.isBlock){if(this.content.size===0){console.error(`You can’t set content on a block node. Tried to set content on ${this.name} at ${this.pos}`);return}t=this.from+1,i=this.to-1}this.editor.commands.insertContentAt({from:t,to:i},e)}get attributes(){return this.node.attrs}get textContent(){return this.node.textContent}get size(){return this.node.nodeSize}get from(){return this.isBlock?this.pos:this.resolvedPos.start(this.resolvedPos.depth)}get range(){return{from:this.from,to:this.to}}get to(){return this.isBlock?this.pos+this.size:this.resolvedPos.end(this.resolvedPos.depth)+(this.node.isText?0:1)}get parent(){if(this.depth===0)return null;const e=this.resolvedPos.start(this.resolvedPos.depth-1),t=this.resolvedPos.doc.resolve(e);return new ta(t,this.editor)}get before(){let e=this.resolvedPos.doc.resolve(this.from-(this.isBlock?1:2));return e.depth!==this.depth&&(e=this.resolvedPos.doc.resolve(this.from-3)),new ta(e,this.editor)}get after(){let e=this.resolvedPos.doc.resolve(this.to+(this.isBlock?2:1));return e.depth!==this.depth&&(e=this.resolvedPos.doc.resolve(this.to+3)),new ta(e,this.editor)}get children(){const e=[];return this.node.content.forEach((t,i)=>{const n=t.isBlock&&!t.isTextblock,a=t.isAtom&&!t.isText,l=t.isInline,s=this.pos+i+(a?0:1);if(s<0||s>this.resolvedPos.doc.nodeSize-2)return;const p=this.resolvedPos.doc.resolve(s);if(!n&&!l&&p.depth<=this.depth)return;const d=new ta(p,this.editor,n,n||l?t:null);n&&(d.actualDepth=this.depth+1),e.push(d)}),e}get firstChild(){return this.children[0]||null}get lastChild(){const e=this.children;return e[e.length-1]||null}closest(e,t={}){let i=null,n=this.parent;for(;n&&!i;){if(n.node.type.name===e)if(Object.keys(t).length>0){const a=n.node.attrs,l=Object.keys(t);for(let s=0;s<l.length;s+=1){const p=l[s];if(a[p]!==t[p])break}}else i=n;n=n.parent}return i}querySelector(e,t={}){return this.querySelectorAll(e,t,!0)[0]||null}querySelectorAll(e,t={},i=!1){let n=[];if(!this.children||this.children.length===0)return n;const a=Object.keys(t);return this.children.forEach(l=>{i&&n.length>0||(l.node.type.name===e&&a.every(p=>t[p]===l.node.attrs[p])&&n.push(l),!(i&&n.length>0)&&(n=n.concat(l.querySelectorAll(e,t,i))))}),n}setAttribute(e){const{tr:t}=this.editor.state;t.setNodeMarkup(this.from,void 0,{...this.node.attrs,...e}),this.editor.view.dispatch(t)}},NF=`.ProseMirror {
47
47
  position: relative;
48
48
  }
49
49
 
@@ -115,11 +115,11 @@ img.ProseMirror-separator {
115
115
  display: block;
116
116
  }`,AF=class extends cF{constructor(e={}){super(),this.css=null,this.className="tiptap",this.editorView=null,this.isFocused=!1,this.destroyed=!1,this.isInitialized=!1,this.extensionStorage={},this.instanceId=Math.random().toString(36).slice(2,9),this.options={element:typeof document<"u"?document.createElement("div"):null,content:"",injectCSS:!0,injectNonce:void 0,extensions:[],autofocus:!1,editable:!0,textDirection:void 0,editorProps:{},parseOptions:{},coreExtensionOptions:{},enableInputRules:!0,enablePasteRules:!0,enableCoreExtensions:!0,enableContentCheck:!1,emitContentError:!1,onBeforeCreate:()=>null,onCreate:()=>null,onMount:()=>null,onUnmount:()=>null,onUpdate:()=>null,onSelectionUpdate:()=>null,onTransaction:()=>null,onFocus:()=>null,onBlur:()=>null,onDestroy:()=>null,onContentError:({error:n})=>{throw n},onPaste:()=>null,onDrop:()=>null,onDelete:()=>null,enableExtensionDispatchTransaction:!0},this.isCapturingTransaction=!1,this.capturedTransaction=null,this.utils={getUpdatedPosition:FO,createMappablePosition:jO},this.setOptions(e),this.createExtensionManager(),this.createCommandManager(),this.createSchema(),this.on("beforeCreate",this.options.onBeforeCreate),this.emit("beforeCreate",{editor:this}),this.on("mount",this.options.onMount),this.on("unmount",this.options.onUnmount),this.on("contentError",this.options.onContentError),this.on("create",this.options.onCreate),this.on("update",this.options.onUpdate),this.on("selectionUpdate",this.options.onSelectionUpdate),this.on("transaction",this.options.onTransaction),this.on("focus",this.options.onFocus),this.on("blur",this.options.onBlur),this.on("destroy",this.options.onDestroy),this.on("drop",({event:n,slice:a,moved:l})=>this.options.onDrop(n,a,l)),this.on("paste",({event:n,slice:a})=>this.options.onPaste(n,a)),this.on("delete",this.options.onDelete);const t=this.createDoc(),i=OA(t,this.options.autofocus);this.editorState=ii.create({doc:t,schema:this.schema,selection:i||void 0}),this.options.element&&this.mount(this.options.element)}mount(e){if(typeof document>"u")throw new Error("[tiptap error]: The editor cannot be mounted because there is no 'document' defined in this environment.");this.createView(e),this.emit("mount",{editor:this}),this.css&&!document.head.contains(this.css)&&document.head.appendChild(this.css),window.setTimeout(()=>{this.isDestroyed||(this.options.autofocus!==!1&&this.options.autofocus!==null&&this.commands.focus(this.options.autofocus),this.emit("create",{editor:this}),this.isInitialized=!0)},0)}unmount(){if(this.editorView){const e=this.editorView.dom;e!=null&&e.editor&&delete e.editor,this.editorView.destroy()}if(this.editorView=null,this.isInitialized=!1,this.css&&!document.querySelectorAll(`.${this.className}`).length)try{typeof this.css.remove=="function"?this.css.remove():this.css.parentNode&&this.css.parentNode.removeChild(this.css)}catch(e){console.warn("Failed to remove CSS element:",e)}this.css=null,this.emit("unmount",{editor:this})}get storage(){return this.extensionStorage}get commands(){return this.commandManager.commands}chain(){return this.commandManager.chain()}can(){return this.commandManager.can()}injectCSS(){this.options.injectCSS&&typeof document<"u"&&(this.css=d9(NF,this.options.injectNonce))}setOptions(e={}){this.options={...this.options,...e},!(!this.editorView||!this.state||this.isDestroyed)&&(this.options.editorProps&&this.view.setProps(this.options.editorProps),this.view.updateState(this.state))}setEditable(e,t=!0){this.setOptions({editable:e}),t&&this.emit("update",{editor:this,transaction:this.state.tr,appendedTransactions:[]})}get isEditable(){return this.options.editable&&this.view&&this.view.editable}get view(){return this.editorView?this.editorView:new Proxy({state:this.editorState,updateState:e=>{this.editorState=e},dispatch:e=>{this.dispatchTransaction(e)},composing:!1,dragging:null,editable:!0,isDestroyed:!1},{get:(e,t)=>{if(this.editorView)return this.editorView[t];if(t==="state")return this.editorState;if(t in e)return Reflect.get(e,t);throw new Error(`[tiptap error]: The editor view is not available. Cannot access view['${t}']. The editor may not be mounted yet.`)}})}get state(){return this.editorView&&(this.editorState=this.view.state),this.editorState}registerPlugin(e,t){const i=KA(t)?t(e,[...this.state.plugins]):[...this.state.plugins,e],n=this.state.reconfigure({plugins:i});return this.view.updateState(n),n}unregisterPlugin(e){if(this.isDestroyed)return;const t=this.state.plugins;let i=t;if([].concat(e).forEach(a=>{const l=typeof a=="string"?`${a}$`:a.key;i=i.filter(s=>!s.key.startsWith(l))}),t.length===i.length)return;const n=this.state.reconfigure({plugins:i});return this.view.updateState(n),n}createExtensionManager(){var e,t,i,n;const l=[...this.options.enableCoreExtensions?[x9,b9.configure({blockSeparator:(t=(e=this.options.coreExtensionOptions)==null?void 0:e.clipboardTextSerializer)==null?void 0:t.blockSeparator}),m9,f9,y9,v9.configure({value:(n=(i=this.options.coreExtensionOptions)==null?void 0:i.tabindex)==null?void 0:n.value}),u9,w9,g9,k9.configure({direction:this.options.textDirection})].filter(s=>typeof this.options.enableCoreExtensions=="object"?this.options.enableCoreExtensions[s.name]!==!1:!0):[],...this.options.extensions].filter(s=>["extension","node","mark"].includes(s==null?void 0:s.type));this.extensionManager=new qa(l,this)}createCommandManager(){this.commandManager=new Aa({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createDoc(){let e;try{e=Mp(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:this.options.enableContentCheck})}catch(t){if(!(t instanceof Error)||!["[tiptap error]: Invalid JSON content","[tiptap error]: Invalid HTML content"].includes(t.message))throw t;this.emit("contentError",{editor:this,error:t,disableCollaboration:()=>{"collaboration"in this.storage&&typeof this.storage.collaboration=="object"&&this.storage.collaboration&&(this.storage.collaboration.isDisabled=!0),this.options.extensions=this.options.extensions.filter(i=>i.name!=="collaboration"),this.createExtensionManager()}}),e=Mp(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:!1})}return e}createView(e){const{editorProps:t,enableExtensionDispatchTransaction:i}=this.options,n=t.dispatchTransaction||this.dispatchTransaction.bind(this),a=i?this.extensionManager.dispatchTransaction(n):n,l=t.transformPastedHTML,s=this.extensionManager.transformPastedHTML(l);this.editorView=new PA(e,{...t,attributes:{role:"textbox",...t==null?void 0:t.attributes},dispatchTransaction:a,transformPastedHTML:s,state:this.editorState,markViews:this.extensionManager.markViews,nodeViews:this.extensionManager.nodeViews});const p=this.state.reconfigure({plugins:this.extensionManager.plugins});this.view.updateState(p),this.prependClass(),this.injectCSS();const d=this.view.dom;d.editor=this}createNodeViews(){this.view.isDestroyed||this.view.setProps({markViews:this.extensionManager.markViews,nodeViews:this.extensionManager.nodeViews})}prependClass(){this.view.dom.className=`${this.className} ${this.view.dom.className}`}captureTransaction(e){this.isCapturingTransaction=!0,e(),this.isCapturingTransaction=!1;const t=this.capturedTransaction;return this.capturedTransaction=null,t}dispatchTransaction(e){if(this.view.isDestroyed)return;if(this.isCapturingTransaction){if(!this.capturedTransaction){this.capturedTransaction=e;return}e.steps.forEach(c=>{var b;return(b=this.capturedTransaction)==null?void 0:b.step(c)});return}const{state:t,transactions:i}=this.state.applyTransaction(e),n=!this.state.selection.eq(t.selection),a=i.includes(e),l=this.state;if(this.emit("beforeTransaction",{editor:this,transaction:e,nextState:t}),!a)return;this.view.updateState(t),this.emit("transaction",{editor:this,transaction:e,appendedTransactions:i.slice(1)}),n&&this.emit("selectionUpdate",{editor:this,transaction:e});const s=i.findLast(c=>c.getMeta("focus")||c.getMeta("blur")),p=s==null?void 0:s.getMeta("focus"),d=s==null?void 0:s.getMeta("blur");p&&this.emit("focus",{editor:this,event:p.event,transaction:s}),d&&this.emit("blur",{editor:this,event:d.event,transaction:s}),!(e.getMeta("preventUpdate")||!i.some(c=>c.docChanged)||l.doc.eq(t.doc))&&this.emit("update",{editor:this,transaction:e,appendedTransactions:i.slice(1)})}getAttributes(e){return r9(this.state,e)}isActive(e,t){const i=typeof e=="string"?e:null,n=typeof e=="string"?t:e;return HO(this.state,i,n)}getJSON(){return this.state.doc.toJSON()}getHTML(){return Bp(this.state.doc.content,this.schema)}getText(e){const{blockSeparator:t=`
117
117
 
118
- `,textSerializers:i={}}=e||{};return AO(this.state.doc,{blockSeparator:t,textSerializers:{...t9(this.schema),...i}})}get isEmpty(){return gn(this.state.doc)}destroy(){this.destroyed||(this.destroyed=!0,this.emit("destroy"),this.unmount(),this.removeAllListeners(),this.extensionManager.destroy(),this.extensionManager=null,this.schema=null,this.commandManager=null,this.extensionStorage={})}get isDestroyed(){var e,t;return(t=(e=this.editorView)==null?void 0:e.isDestroyed)!=null?t:!0}$node(e,t){var i;return((i=this.$doc)==null?void 0:i.querySelector(e,t))||null}$nodes(e,t){var i;return((i=this.$doc)==null?void 0:i.querySelectorAll(e,t))||null}$pos(e){const t=this.state.doc.resolve(e),i=e>0&&t.nodeAfter&&!t.nodeAfter.isText?t.nodeAfter:null;return new LF(t,this,!1,i)}get $doc(){return this.$pos(0)}};function bi(r){return new Oa({find:r.find,handler:({state:e,range:t,match:i})=>{const n=he(r.getAttributes,void 0,i);if(n===!1||n===null)return null;const{tr:a}=e,l=i[i.length-1],s=i[0];if(l){const p=s.search(/\S/),d=t.from+s.indexOf(l),c=d+l.length;if(Lp(t.from,t.to,e.doc).filter(g=>g.mark.type.excluded.find(u=>u===r.type&&u!==g.mark.type)).filter(g=>g.to>d).length)return null;c<t.to&&a.delete(c,t.to),d>t.from&&a.delete(t.from+p,d);const m=t.from+p+l.length;a.addMark(t.from+p,m,r.type.create(n||{})),a.removeStoredMark(r.type)}},undoable:r.undoable})}function _F(r){return new Oa({find:r.find,handler:({state:e,range:t,match:i})=>{const n=he(r.getAttributes,void 0,i)||{},{tr:a}=e,l=t.from;let s=t.to;const p=r.type.create(n);if(i[1]){const d=i[0].lastIndexOf(i[1]);let c=l+d;c>s?c=s:s=c+i[1].length;const b=i[0][i[0].length-1];a.insertText(b,l+i[0].length-1),a.replaceWith(c,s,p)}else if(i[0]){const d=r.type.isInline?l:l-1;a.insert(d,r.type.create(n)).delete(a.mapping.map(l),a.mapping.map(s))}a.scrollIntoView()},undoable:r.undoable})}function Op(r){return new Oa({find:r.find,handler:({state:e,range:t,match:i})=>{const n=e.doc.resolve(t.from),a=he(r.getAttributes,void 0,i)||{};if(!n.node(-1).canReplaceWith(n.index(-1),n.indexAfter(-1),r.type))return null;e.tr.delete(t.from,t.to).setBlockType(t.from,t.from,r.type,a)},undoable:r.undoable})}function mi(r){return new Oa({find:r.find,handler:({state:e,range:t,match:i,chain:n})=>{const a=he(r.getAttributes,void 0,i)||{},l=e.tr.delete(t.from,t.to),p=l.doc.resolve(t.from).blockRange(),d=p&&js(p,r.type,a);if(!d)return null;if(l.wrap(p,d),r.keepMarks&&r.editor){const{selection:b,storedMarks:m}=e,{splittableMarks:g}=r.editor.extensionManager,x=m||b.$to.parentOffset&&b.$from.marks();if(x){const u=x.filter(h=>g.includes(h.type.name));l.ensureMarks(u)}}if(r.keepAttributes){const b=r.type.name==="bulletList"||r.type.name==="orderedList"?"listItem":"taskList";n().updateAttributes(b,a).run()}const c=l.doc.resolve(t.from-1).nodeBefore;c&&c.type===r.type&&Or(l.doc,t.from-1)&&(!r.joinPredicate||r.joinPredicate(i,c))&&l.join(t.from-1)},undoable:r.undoable})}var Nt=class Uz extends Rp{constructor(){super(...arguments),this.type="node"}static create(e={}){const t=typeof e=="function"?e():e;return new Uz(t)}configure(e){return super.configure(e)}extend(e){const t=typeof e=="function"?e():e;return super.extend(t)}};function zo(r){return new CF({find:r.find,handler:({state:e,range:t,match:i,pasteEvent:n})=>{const a=he(r.getAttributes,void 0,i,n);if(a===!1||a===null)return null;const{tr:l}=e,s=i[i.length-1],p=i[0];let d=t.to;if(s){const c=p.search(/\S/),b=t.from+p.indexOf(s),m=b+s.length;if(Lp(t.from,t.to,e.doc).filter(u=>u.mark.type.excluded.find(f=>f===r.type&&f!==u.mark.type)).filter(u=>u.to>b).length)return null;m<t.to&&l.delete(m,t.to),b>t.from&&l.delete(t.from+c,b),d=t.from+c+s.length,l.addMark(t.from+c,d,r.type.create(a||{})),i.index!==void 0&&i.input!==void 0&&i.index+i[0].length>=i.input.length||l.removeStoredMark(r.type)}}})}function S9(r){return o.customRef((e,t)=>({get(){return e(),r},set(i){r=i,requestAnimationFrame(()=>{requestAnimationFrame(()=>{t()})})}}))}var C9=class extends AF{constructor(r={}){return super(r),this.contentComponent=null,this.appContext=null,this.reactiveState=S9(this.view.state),this.reactiveExtensionStorage=S9(this.extensionStorage),this.on("beforeTransaction",({nextState:e})=>{this.reactiveState.value=e,this.reactiveExtensionStorage.value=this.extensionStorage}),o.markRaw(this)}get state(){return this.reactiveState?this.reactiveState.value:this.view.state}get storage(){return this.reactiveExtensionStorage?this.reactiveExtensionStorage.value:super.storage}registerPlugin(r,e){const t=super.registerPlugin(r,e);return this.reactiveState&&(this.reactiveState.value=t),t}unregisterPlugin(r){const e=super.unregisterPlugin(r);return this.reactiveState&&e&&(this.reactiveState.value=e),e}},DF=o.defineComponent({name:"EditorContent",props:{editor:{default:null,type:Object}},setup(r){const e=o.ref(),t=o.getCurrentInstance();return o.watchEffect(()=>{const i=r.editor;i&&i.options.element&&e.value&&o.nextTick(()=>{var n;if(!e.value||!((n=i.view.dom)!=null&&n.parentNode))return;const a=o.unref(e.value);e.value.append(...i.view.dom.parentNode.childNodes),i.contentComponent=t.ctx._,t&&(i.appContext={...t.appContext,provides:t.provides}),i.setOptions({element:a}),i.createNodeViews()})}),o.onBeforeUnmount(()=>{const i=r.editor;i&&(i.contentComponent=null,i.appContext=null)}),{rootEl:e}},render(){return o.h("div",{ref:r=>{this.rootEl=r}})}});o.defineComponent({name:"NodeViewContent",props:{as:{type:String,default:"div"}},inject:{nodeViewContentRef:{default:void 0}},mounted(){const r=this.nodeViewContentRef;r&&this.$el&&r(this.$el)},beforeUnmount(){const r=this.nodeViewContentRef;r&&r(null)},render(){return o.h(this.as,{style:{whiteSpace:"pre-wrap"},"data-node-view-content":""})}}),o.defineComponent({name:"NodeViewWrapper",props:{as:{type:String,default:"div"}},inject:["onDragStart","decorationClasses"],render(){var r,e;return o.h(this.as,{class:this.decorationClasses,style:{whiteSpace:"normal"},"data-node-view-wrapper":"",onDragstart:this.onDragStart},(e=(r=this.$slots).default)==null?void 0:e.call(r))}});var zF=(r={})=>{const e=o.shallowRef();return o.onMounted(()=>{e.value=new C9(r)}),o.onBeforeUnmount(()=>{var t;(t=e.value)==null||t.destroy()}),e};o.defineComponent({name:"MarkViewContent",props:{as:{type:String,default:"span"}},render(){return o.h(this.as,{style:{whiteSpace:"inherit"},"data-mark-view-content":""})}});var Ua=(r,e)=>{if(r==="slot")return 0;if(r instanceof Function)return r(e);const{children:t,...i}=e??{};if(r==="svg")throw new Error("SVG elements are not supported in the JSX syntax, use the array syntax instead");return[r,i,t]};function T9(r,e,t){for(let i=0;;i++){if(i==r.childCount||i==e.childCount)return r.childCount==e.childCount?null:t;let n=r.child(i),a=e.child(i);if(n==a){t+=n.nodeSize;continue}if(!n.sameMarkup(a))return t;if(n.isText&&n.text!=a.text){for(let l=0;n.text[l]==a.text[l];l++)t++;return t}if(n.content.size||a.content.size){let l=T9(n.content,a.content,t+1);if(l!=null)return l}t+=n.nodeSize}}function E9(r,e,t,i){for(let n=r.childCount,a=e.childCount;;){if(n==0||a==0)return n==a?null:{a:t,b:i};let l=r.child(--n),s=e.child(--a),p=l.nodeSize;if(l==s){t-=p,i-=p;continue}if(!l.sameMarkup(s))return{a:t,b:i};if(l.isText&&l.text!=s.text){let d=0,c=Math.min(l.text.length,s.text.length);for(;d<c&&l.text[l.text.length-d-1]==s.text[s.text.length-d-1];)d++,t--,i--;return{a:t,b:i}}if(l.content.size||s.content.size){let d=E9(l.content,s.content,t-1,i-1);if(d)return d}t-=p,i-=p}}var vr=class Tt{constructor(e,t){if(this.content=e,this.size=t||0,t==null)for(let i=0;i<e.length;i++)this.size+=e[i].nodeSize}nodesBetween(e,t,i,n=0,a){for(let l=0,s=0;s<t;l++){let p=this.content[l],d=s+p.nodeSize;if(d>e&&i(p,n+s,a||null,l)!==!1&&p.content.size){let c=s+1;p.nodesBetween(Math.max(0,e-c),Math.min(p.content.size,t-c),i,n+c)}s=d}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,t,i,n){let a="",l=!0;return this.nodesBetween(e,t,(s,p)=>{let d=s.isText?s.text.slice(Math.max(e,p)-p,t-p):s.isLeaf?n?typeof n=="function"?n(s):n:s.type.spec.leafText?s.type.spec.leafText(s):"":"";s.isBlock&&(s.isLeaf&&d||s.isTextblock)&&i&&(l?l=!1:a+=i),a+=d},0),a}append(e){if(!e.size)return this;if(!this.size)return e;let t=this.lastChild,i=e.firstChild,n=this.content.slice(),a=0;for(t.isText&&t.sameMarkup(i)&&(n[n.length-1]=t.withText(t.text+i.text),a=1);a<e.content.length;a++)n.push(e.content[a]);return new Tt(n,this.size+e.size)}cut(e,t=this.size){if(e==0&&t==this.size)return this;let i=[],n=0;if(t>e)for(let a=0,l=0;l<t;a++){let s=this.content[a],p=l+s.nodeSize;p>e&&((l<e||p>t)&&(s.isText?s=s.cut(Math.max(0,e-l),Math.min(s.text.length,t-l)):s=s.cut(Math.max(0,e-l-1),Math.min(s.content.size,t-l-1))),i.push(s),n+=s.nodeSize),l=p}return new Tt(i,n)}cutByIndex(e,t){return e==t?Tt.empty:e==0&&t==this.content.length?this:new Tt(this.content.slice(e,t))}replaceChild(e,t){let i=this.content[e];if(i==t)return this;let n=this.content.slice(),a=this.size+t.nodeSize-i.nodeSize;return n[e]=t,new Tt(n,a)}addToStart(e){return new Tt([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new Tt(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let t=0;t<this.content.length;t++)if(!this.content[t].eq(e.content[t]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(e){let t=this.content[e];if(!t)throw new RangeError("Index "+e+" out of range for "+this);return t}maybeChild(e){return this.content[e]||null}forEach(e){for(let t=0,i=0;t<this.content.length;t++){let n=this.content[t];e(n,i,t),i+=n.nodeSize}}findDiffStart(e,t=0){return T9(this,e,t)}findDiffEnd(e,t=this.size,i=e.size){return E9(this,e,t,i)}findIndex(e){if(e==0)return Wa(0,e);if(e==this.size)return Wa(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let t=0,i=0;;t++){let n=this.child(t),a=i+n.nodeSize;if(a>=e)return a==e?Wa(t+1,a):Wa(t,i);i=a}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,t){if(!t)return Tt.empty;if(!Array.isArray(t))throw new RangeError("Invalid input for Fragment.fromJSON");return Tt.fromArray(t.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return Tt.empty;let t,i=0;for(let n=0;n<e.length;n++){let a=e[n];i+=a.nodeSize,n&&a.isText&&e[n-1].sameMarkup(a)?(t||(t=e.slice(0,n)),t[t.length-1]=a.withText(t[t.length-1].text+a.text)):t&&t.push(a)}return new Tt(t||e,i)}static from(e){if(!e)return Tt.empty;if(e instanceof Tt)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new Tt([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}};vr.empty=new vr([],0);var Fp={index:0,offset:0};function Wa(r,e){return Fp.index=r,Fp.offset=e,Fp}var IF=class extends Error{},Ve=class Oi{constructor(e,t,i){this.content=e,this.openStart=t,this.openEnd=i}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,t){let i=P9(this.content,e+this.openStart,t,this.openStart+1,this.openEnd+1);return i&&new Oi(i,this.openStart,this.openEnd)}removeBetween(e,t){return new Oi(M9(this.content,e+this.openStart,t+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(e,t){if(!t)return Oi.empty;let i=t.openStart||0,n=t.openEnd||0;if(typeof i!="number"||typeof n!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new Oi(vr.fromJSON(e,t.content),i,n)}static maxOpen(e,t=!0){let i=0,n=0;for(let a=e.firstChild;a&&!a.isLeaf&&(t||!a.type.spec.isolating);a=a.firstChild)i++;for(let a=e.lastChild;a&&!a.isLeaf&&(t||!a.type.spec.isolating);a=a.lastChild)n++;return new Oi(e,i,n)}};Ve.empty=new Ve(vr.empty,0,0);function M9(r,e,t){let{index:i,offset:n}=r.findIndex(e),a=r.maybeChild(i),{index:l,offset:s}=r.findIndex(t);if(n==e||a.isText){if(s!=t&&!r.child(l).isText)throw new RangeError("Removing non-flat range");return r.cut(0,e).append(r.cut(t))}if(i!=l)throw new RangeError("Removing non-flat range");return r.replaceChild(i,a.copy(M9(a.content,e-n-1,t-n-1)))}function P9(r,e,t,i,n,a){let{index:l,offset:s}=r.findIndex(e),p=r.maybeChild(l);if(s==e||p.isText)return a&&i<=0&&n<=0&&!a.canReplace(l,l,t)?null:r.cut(0,e).append(t).append(r.cut(e));let d=P9(p.content,e-s-1,t,l==0?i-1:0,l==r.childCount-1?n-1:0,p);return d&&r.replaceChild(l,p.copy(d))}var B9=65535,L9=Math.pow(2,16);function VF(r,e){return r+e*L9}function N9(r){return r&B9}function HF(r){return(r-(r&B9))/L9}var A9=1,_9=2,Ga=4,D9=8,z9=class{constructor(r,e,t){this.pos=r,this.delInfo=e,this.recover=t}get deleted(){return(this.delInfo&D9)>0}get deletedBefore(){return(this.delInfo&(A9|Ga))>0}get deletedAfter(){return(this.delInfo&(_9|Ga))>0}get deletedAcross(){return(this.delInfo&Ga)>0}},Io=class Fi{constructor(e,t=!1){if(this.ranges=e,this.inverted=t,!e.length&&Fi.empty)return Fi.empty}recover(e){let t=0,i=N9(e);if(!this.inverted)for(let n=0;n<i;n++)t+=this.ranges[n*3+2]-this.ranges[n*3+1];return this.ranges[i*3]+t+HF(e)}mapResult(e,t=1){return this._map(e,t,!1)}map(e,t=1){return this._map(e,t,!0)}_map(e,t,i){let n=0,a=this.inverted?2:1,l=this.inverted?1:2;for(let s=0;s<this.ranges.length;s+=3){let p=this.ranges[s]-(this.inverted?n:0);if(p>e)break;let d=this.ranges[s+a],c=this.ranges[s+l],b=p+d;if(e<=b){let m=d?e==p?-1:e==b?1:t:t,g=p+n+(m<0?0:c);if(i)return g;let x=e==(t<0?p:b)?null:VF(s/3,e-p),u=e==p?_9:e==b?A9:Ga;return(t<0?e!=p:e!=b)&&(u|=D9),new z9(g,u,x)}n+=c-d}return i?e+n:new z9(e+n,0,null)}touches(e,t){let i=0,n=N9(t),a=this.inverted?2:1,l=this.inverted?1:2;for(let s=0;s<this.ranges.length;s+=3){let p=this.ranges[s]-(this.inverted?i:0);if(p>e)break;let d=this.ranges[s+a],c=p+d;if(e<=c&&s==n*3)return!0;i+=this.ranges[s+l]-d}return!1}forEach(e){let t=this.inverted?2:1,i=this.inverted?1:2;for(let n=0,a=0;n<this.ranges.length;n+=3){let l=this.ranges[n],s=l-(this.inverted?a:0),p=l+(this.inverted?0:a),d=this.ranges[n+t],c=this.ranges[n+i];e(s,s+d,p,p+c),a+=c-d}}invert(){return new Fi(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?Fi.empty:new Fi(e<0?[0,-e,0]:[0,0,e])}};Io.empty=new Io([]);var jp=Object.create(null),st=class{getMap(){return Io.empty}merge(r){return null}static fromJSON(r,e){if(!e||!e.stepType)throw new RangeError("Invalid input for Step.fromJSON");let t=jp[e.stepType];if(!t)throw new RangeError(`No step type ${e.stepType} defined`);return t.fromJSON(r,e)}static jsonID(r,e){if(r in jp)throw new RangeError("Duplicate use of step JSON ID "+r);return jp[r]=e,e.prototype.jsonID=r,e}},yt=class ra{constructor(e,t){this.doc=e,this.failed=t}static ok(e){return new ra(e,null)}static fail(e){return new ra(null,e)}static fromReplace(e,t,i,n){try{return ra.ok(e.replace(t,i,n))}catch(a){if(a instanceof IF)return ra.fail(a.message);throw a}}};function qp(r,e,t){let i=[];for(let n=0;n<r.childCount;n++){let a=r.child(n);a.content.size&&(a=a.copy(qp(a.content,e,a))),a.isInline&&(a=e(a,t,n)),i.push(a)}return vr.fromArray(i)}var I9=class oa extends st{constructor(e,t,i){super(),this.from=e,this.to=t,this.mark=i}apply(e){let t=e.slice(this.from,this.to),i=e.resolve(this.from),n=i.node(i.sharedDepth(this.to)),a=new Ve(qp(t.content,(l,s)=>!l.isAtom||!s.type.allowsMarkType(this.mark.type)?l:l.mark(this.mark.addToSet(l.marks)),n),t.openStart,t.openEnd);return yt.fromReplace(e,this.from,this.to,a)}invert(){return new V9(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),i=e.mapResult(this.to,-1);return t.deleted&&i.deleted||t.pos>=i.pos?null:new oa(t.pos,i.pos,this.mark)}merge(e){return e instanceof oa&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new oa(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new oa(t.from,t.to,e.markFromJSON(t.mark))}};st.jsonID("addMark",I9);var V9=class ia extends st{constructor(e,t,i){super(),this.from=e,this.to=t,this.mark=i}apply(e){let t=e.slice(this.from,this.to),i=new Ve(qp(t.content,n=>n.mark(this.mark.removeFromSet(n.marks)),e),t.openStart,t.openEnd);return yt.fromReplace(e,this.from,this.to,i)}invert(){return new I9(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),i=e.mapResult(this.to,-1);return t.deleted&&i.deleted||t.pos>=i.pos?null:new ia(t.pos,i.pos,this.mark)}merge(e){return e instanceof ia&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new ia(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new ia(t.from,t.to,e.markFromJSON(t.mark))}};st.jsonID("removeMark",V9);var H9=class na extends st{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return yt.fail("No node at mark step's position");let i=t.type.create(t.attrs,null,this.mark.addToSet(t.marks));return yt.fromReplace(e,this.pos,this.pos+1,new Ve(vr.from(i),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);if(t){let i=this.mark.addToSet(t.marks);if(i.length==t.marks.length){for(let n=0;n<t.marks.length;n++)if(!t.marks[n].isInSet(i))return new na(this.pos,t.marks[n]);return new na(this.pos,this.mark)}}return new R9(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new na(t.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,t){if(typeof t.pos!="number")throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new na(t.pos,e.markFromJSON(t.mark))}};st.jsonID("addNodeMark",H9);var R9=class Sc extends st{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return yt.fail("No node at mark step's position");let i=t.type.create(t.attrs,null,this.mark.removeFromSet(t.marks));return yt.fromReplace(e,this.pos,this.pos+1,new Ve(vr.from(i),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);return!t||!this.mark.isInSet(t.marks)?this:new H9(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new Sc(t.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,t){if(typeof t.pos!="number")throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new Sc(t.pos,e.markFromJSON(t.mark))}};st.jsonID("removeNodeMark",R9);var Up=class wo extends st{constructor(e,t,i,n=!1){super(),this.from=e,this.to=t,this.slice=i,this.structure=n}apply(e){return this.structure&&Wp(e,this.from,this.to)?yt.fail("Structure replace would overwrite content"):yt.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new Io([this.from,this.to-this.from,this.slice.size])}invert(e){return new wo(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let t=e.mapResult(this.to,-1),i=this.from==this.to&&wo.MAP_BIAS<0?t:e.mapResult(this.from,1);return i.deletedAcross&&t.deletedAcross?null:new wo(i.pos,Math.max(i.pos,t.pos),this.slice,this.structure)}merge(e){if(!(e instanceof wo)||e.structure||this.structure)return null;if(this.from+this.slice.size==e.from&&!this.slice.openEnd&&!e.slice.openStart){let t=this.slice.size+e.slice.size==0?Ve.empty:new Ve(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new wo(this.from,this.to+(e.to-e.from),t,this.structure)}else if(e.to==this.from&&!this.slice.openStart&&!e.slice.openEnd){let t=this.slice.size+e.slice.size==0?Ve.empty:new Ve(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new wo(e.from,this.to,t,this.structure)}else return null}toJSON(){let e={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new wo(t.from,t.to,Ve.fromJSON(e,t.slice),!!t.structure)}};Up.MAP_BIAS=1,st.jsonID("replace",Up);var O9=class Ps extends st{constructor(e,t,i,n,a,l,s=!1){super(),this.from=e,this.to=t,this.gapFrom=i,this.gapTo=n,this.slice=a,this.insert=l,this.structure=s}apply(e){if(this.structure&&(Wp(e,this.from,this.gapFrom)||Wp(e,this.gapTo,this.to)))return yt.fail("Structure gap-replace would overwrite content");let t=e.slice(this.gapFrom,this.gapTo);if(t.openStart||t.openEnd)return yt.fail("Gap is not a flat range");let i=this.slice.insertAt(this.insert,t.content);return i?yt.fromReplace(e,this.from,this.to,i):yt.fail("Content does not fit in gap")}getMap(){return new Io([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(e){let t=this.gapTo-this.gapFrom;return new Ps(this.from,this.from+this.slice.size+t,this.from+this.insert,this.from+this.insert+t,e.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(e){let t=e.mapResult(this.from,1),i=e.mapResult(this.to,-1),n=this.from==this.gapFrom?t.pos:e.map(this.gapFrom,-1),a=this.to==this.gapTo?i.pos:e.map(this.gapTo,1);return t.deletedAcross&&i.deletedAcross||n<t.pos||a>i.pos?null:new Ps(t.pos,i.pos,n,a,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number"||typeof t.gapFrom!="number"||typeof t.gapTo!="number"||typeof t.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new Ps(t.from,t.to,t.gapFrom,t.gapTo,Ve.fromJSON(e,t.slice),t.insert,!!t.structure)}};st.jsonID("replaceAround",O9);function Wp(r,e,t){let i=r.resolve(e),n=t-e,a=i.depth;for(;n>0&&a>0&&i.indexAfter(a)==i.node(a).childCount;)a--,n--;if(n>0){let l=i.node(a).maybeChild(i.indexAfter(a));for(;n>0;){if(!l||l.isLeaf)return!0;l=l.firstChild,n--}}return!1}var RF=class Bs extends st{constructor(e,t,i){super(),this.pos=e,this.attr=t,this.value=i}apply(e){let t=e.nodeAt(this.pos);if(!t)return yt.fail("No node at attribute step's position");let i=Object.create(null);for(let a in t.attrs)i[a]=t.attrs[a];i[this.attr]=this.value;let n=t.type.create(i,null,t.marks);return yt.fromReplace(e,this.pos,this.pos+1,new Ve(vr.from(n),0,t.isLeaf?0:1))}getMap(){return Io.empty}invert(e){return new Bs(this.pos,this.attr,e.nodeAt(this.pos).attrs[this.attr])}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new Bs(t.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(e,t){if(typeof t.pos!="number"||typeof t.attr!="string")throw new RangeError("Invalid input for AttrStep.fromJSON");return new Bs(t.pos,t.attr,t.value)}};st.jsonID("attr",RF);var OF=class Cc extends st{constructor(e,t){super(),this.attr=e,this.value=t}apply(e){let t=Object.create(null);for(let n in e.attrs)t[n]=e.attrs[n];t[this.attr]=this.value;let i=e.type.create(t,e.content,e.marks);return yt.ok(i)}getMap(){return Io.empty}invert(e){return new Cc(this.attr,e.attrs[this.attr])}map(e){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(e,t){if(typeof t.attr!="string")throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new Cc(t.attr,t.value)}};st.jsonID("docAttr",OF);var un=class extends Error{};un=function r(e){let t=Error.call(this,e);return t.__proto__=r.prototype,t},un.prototype=Object.create(Error.prototype),un.prototype.constructor=un,un.prototype.name="TransformError";var Gp=Object.create(null),We=class{constructor(r,e,t){this.$anchor=r,this.$head=e,this.ranges=t||[new FF(r.min(e),r.max(e))]}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 r=this.ranges;for(let e=0;e<r.length;e++)if(r[e].$from.pos!=r[e].$to.pos)return!1;return!0}content(){return this.$from.doc.slice(this.from,this.to,!0)}replace(r,e=Ve.empty){let t=e.content.lastChild,i=null;for(let l=0;l<e.openEnd;l++)i=t,t=t.lastChild;let n=r.steps.length,a=this.ranges;for(let l=0;l<a.length;l++){let{$from:s,$to:p}=a[l],d=r.mapping.slice(n);r.replaceRange(d.map(s.pos),d.map(p.pos),l?Ve.empty:e),l==0&&U9(r,n,(t?t.isInline:i&&i.isTextblock)?-1:1)}}replaceWith(r,e){let t=r.steps.length,i=this.ranges;for(let n=0;n<i.length;n++){let{$from:a,$to:l}=i[n],s=r.mapping.slice(t),p=s.map(a.pos),d=s.map(l.pos);n?r.deleteRange(p,d):(r.replaceRangeWith(p,d,e),U9(r,t,e.isInline?-1:1))}}static findFrom(r,e,t=!1){let i=r.parent.inlineContent?new gi(r):xi(r.node(0),r.parent,r.pos,r.index(),e,t);if(i)return i;for(let n=r.depth-1;n>=0;n--){let a=e<0?xi(r.node(0),r.node(n),r.before(n+1),r.index(n),e,t):xi(r.node(0),r.node(n),r.after(n+1),r.index(n)+1,e,t);if(a)return a}return null}static near(r,e=1){return this.findFrom(r,e)||this.findFrom(r,-e)||new xn(r.node(0))}static atStart(r){return xi(r,r,0,0,1)||new xn(r)}static atEnd(r){return xi(r,r,r.content.size,r.childCount,-1)||new xn(r)}static fromJSON(r,e){if(!e||!e.type)throw new RangeError("Invalid input for Selection.fromJSON");let t=Gp[e.type];if(!t)throw new RangeError(`No selection type ${e.type} defined`);return t.fromJSON(r,e)}static jsonID(r,e){if(r in Gp)throw new RangeError("Duplicate use of selection JSON ID "+r);return Gp[r]=e,e.prototype.jsonID=r,e}getBookmark(){return gi.between(this.$anchor,this.$head).getBookmark()}};We.prototype.visible=!0;var FF=class{constructor(r,e){this.$from=r,this.$to=e}},F9=!1;function j9(r){!F9&&!r.parent.inlineContent&&(F9=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+r.parent.type.name+")"))}var gi=class aa extends We{constructor(e,t=e){j9(e),j9(t),super(e,t)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(e,t){let i=e.resolve(t.map(this.head));if(!i.parent.inlineContent)return We.near(i);let n=e.resolve(t.map(this.anchor));return new aa(n.parent.inlineContent?n:i,i)}replace(e,t=Ve.empty){if(super.replace(e,t),t==Ve.empty){let i=this.$from.marksAcross(this.$to);i&&e.ensureMarks(i)}}eq(e){return e instanceof aa&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new q9(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(e,t){if(typeof t.anchor!="number"||typeof t.head!="number")throw new RangeError("Invalid input for TextSelection.fromJSON");return new aa(e.resolve(t.anchor),e.resolve(t.head))}static create(e,t,i=t){let n=e.resolve(t);return new this(n,i==t?n:e.resolve(i))}static between(e,t,i){let n=e.pos-t.pos;if((!i||n)&&(i=n>=0?1:-1),!t.parent.inlineContent){let a=We.findFrom(t,i,!0)||We.findFrom(t,-i,!0);if(a)t=a.$head;else return We.near(t,i)}return e.parent.inlineContent||(n==0?e=t:(e=(We.findFrom(e,-i,!0)||We.findFrom(e,i,!0)).$anchor,e.pos<t.pos!=n<0&&(e=t))),new aa(e,t)}};We.jsonID("text",gi);var q9=class Wz{constructor(e,t){this.anchor=e,this.head=t}map(e){return new Wz(e.map(this.anchor),e.map(this.head))}resolve(e){return gi.between(e.resolve(this.anchor),e.resolve(this.head))}},ui=class la extends We{constructor(e){let t=e.nodeAfter,i=e.node(0).resolve(e.pos+t.nodeSize);super(e,i),this.node=t}map(e,t){let{deleted:i,pos:n}=t.mapResult(this.anchor),a=e.resolve(n);return i?We.near(a):new la(a)}content(){return new Ve(vr.from(this.node),0,0)}eq(e){return e instanceof la&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new jF(this.anchor)}static fromJSON(e,t){if(typeof t.anchor!="number")throw new RangeError("Invalid input for NodeSelection.fromJSON");return new la(e.resolve(t.anchor))}static create(e,t){return new la(e.resolve(t))}static isSelectable(e){return!e.isText&&e.type.spec.selectable!==!1}};ui.prototype.visible=!1,We.jsonID("node",ui);var jF=class Gz{constructor(e){this.anchor=e}map(e){let{deleted:t,pos:i}=e.mapResult(this.anchor);return t?new q9(i,i):new Gz(i)}resolve(e){let t=e.resolve(this.anchor),i=t.nodeAfter;return i&&ui.isSelectable(i)?new ui(t):We.near(t)}},xn=class Ls extends We{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,t=Ve.empty){if(t==Ve.empty){e.delete(0,e.doc.content.size);let i=We.atStart(e.doc);i.eq(e.selection)||e.setSelection(i)}else super.replace(e,t)}toJSON(){return{type:"all"}}static fromJSON(e){return new Ls(e)}map(e){return new Ls(e)}eq(e){return e instanceof Ls}getBookmark(){return qF}};We.jsonID("all",xn);var qF={map(){return this},resolve(r){return new xn(r)}};function xi(r,e,t,i,n,a=!1){if(e.inlineContent)return gi.create(r,t);for(let l=i-(n>0?0:1);n>0?l<e.childCount:l>=0;l+=n){let s=e.child(l);if(s.isAtom){if(!a&&ui.isSelectable(s))return ui.create(r,t-(n<0?s.nodeSize:0))}else{let p=xi(r,s,t+n,n<0?s.childCount:0,n,a);if(p)return p}t+=s.nodeSize*n}return null}function U9(r,e,t){let i=r.steps.length-1;if(i<e)return;let n=r.steps[i];if(!(n instanceof Up||n instanceof O9))return;let a=r.mapping.maps[i],l;a.forEach((s,p,d,c)=>{l==null&&(l=c)}),r.setSelection(We.near(r.doc.resolve(l),t))}function W9(r,e){return!e||!r?r:r.bind(e)}var Ka=class{constructor(r,e,t){this.name=r,this.init=W9(e.init,t),this.apply=W9(e.apply,t)}};new Ka("doc",{init(r){return r.doc||r.schema.topNodeType.createAndFill()},apply(r){return r.doc}}),new Ka("selection",{init(r,e){return r.selection||We.atStart(e.doc)},apply(r){return r.selection}}),new Ka("storedMarks",{init(r){return r.storedMarks||null},apply(r,e,t,i){return i.selection.$cursor?r.storedMarks:null}}),new Ka("scrollToSelection",{init(){return 0},apply(r,e){return r.scrolledIntoView?e+1:e}});var UF=(r,e)=>{var t;const{state:i,view:n}=r,{selection:a}=i;if(!a.empty)return!1;const{$from:l}=a;if(l.parentOffset!==0)return!1;const s=l.depth-1,p=l.node(s),d=l.index(s);if(d===0)return!1;if(p.type===e)return r.commands.lift(e.name);const c=p.child(d-1);if(c.type!==e||!((t=c.lastChild)!=null&&t.isTextblock))return!1;const b=l.before(),g=b-1-1,{tr:x}=i;return x.delete(b,l.after()).insert(g,l.parent.content),x.setSelection(gi.create(x.doc,g)),n.dispatch(x.scrollIntoView()),!0},WF=/^\s*>\s$/,GF=Nt.create({name:"blockquote",addOptions(){return{HTMLAttributes:{}}},content:"block+",group:"block",defining:!0,parseHTML(){return[{tag:"blockquote"}]},renderHTML({HTMLAttributes:r}){return Ua("blockquote",{...Fe(this.options.HTMLAttributes,r),children:Ua("slot",{})})},parseMarkdown:(r,e)=>{var t;const i=(t=e.parseBlockChildren)!=null?t:e.parseChildren;return e.createNode("blockquote",void 0,i(r.tokens||[]))},renderMarkdown:(r,e)=>{if(!r.content)return"";const t=">",i=[];return r.content.forEach((n,a)=>{var l,s;const c=((s=(l=e.renderChild)==null?void 0:l.call(e,n,a))!=null?s:e.renderChildren([n])).split(`
118
+ `,textSerializers:i={}}=e||{};return AO(this.state.doc,{blockSeparator:t,textSerializers:{...t9(this.schema),...i}})}get isEmpty(){return gn(this.state.doc)}destroy(){this.destroyed||(this.destroyed=!0,this.emit("destroy"),this.unmount(),this.removeAllListeners(),this.extensionManager.destroy(),this.extensionManager=null,this.schema=null,this.commandManager=null,this.extensionStorage={})}get isDestroyed(){var e,t;return(t=(e=this.editorView)==null?void 0:e.isDestroyed)!=null?t:!0}$node(e,t){var i;return((i=this.$doc)==null?void 0:i.querySelector(e,t))||null}$nodes(e,t){var i;return((i=this.$doc)==null?void 0:i.querySelectorAll(e,t))||null}$pos(e){const t=this.state.doc.resolve(e),i=e>0&&t.nodeAfter&&!t.nodeAfter.isText?t.nodeAfter:null;return new LF(t,this,!1,i)}get $doc(){return this.$pos(0)}};function bi(r){return new Oa({find:r.find,handler:({state:e,range:t,match:i})=>{const n=he(r.getAttributes,void 0,i);if(n===!1||n===null)return null;const{tr:a}=e,l=i[i.length-1],s=i[0];if(l){const p=s.search(/\S/),d=t.from+s.indexOf(l),c=d+l.length;if(Lp(t.from,t.to,e.doc).filter(g=>g.mark.type.excluded.find(u=>u===r.type&&u!==g.mark.type)).filter(g=>g.to>d).length)return null;c<t.to&&a.delete(c,t.to),d>t.from&&a.delete(t.from+p,d);const m=t.from+p+l.length;a.addMark(t.from+p,m,r.type.create(n||{})),a.removeStoredMark(r.type)}},undoable:r.undoable})}function _F(r){return new Oa({find:r.find,handler:({state:e,range:t,match:i})=>{const n=he(r.getAttributes,void 0,i)||{},{tr:a}=e,l=t.from;let s=t.to;const p=r.type.create(n);if(i[1]){const d=i[0].lastIndexOf(i[1]);let c=l+d;c>s?c=s:s=c+i[1].length;const b=i[0][i[0].length-1];a.insertText(b,l+i[0].length-1),a.replaceWith(c,s,p)}else if(i[0]){const d=r.type.isInline?l:l-1;a.insert(d,r.type.create(n)).delete(a.mapping.map(l),a.mapping.map(s))}a.scrollIntoView()},undoable:r.undoable})}function Op(r){return new Oa({find:r.find,handler:({state:e,range:t,match:i})=>{const n=e.doc.resolve(t.from),a=he(r.getAttributes,void 0,i)||{};if(!n.node(-1).canReplaceWith(n.index(-1),n.indexAfter(-1),r.type))return null;e.tr.delete(t.from,t.to).setBlockType(t.from,t.from,r.type,a)},undoable:r.undoable})}function mi(r){return new Oa({find:r.find,handler:({state:e,range:t,match:i,chain:n})=>{const a=he(r.getAttributes,void 0,i)||{},l=e.tr.delete(t.from,t.to),p=l.doc.resolve(t.from).blockRange(),d=p&&js(p,r.type,a);if(!d)return null;if(l.wrap(p,d),r.keepMarks&&r.editor){const{selection:b,storedMarks:m}=e,{splittableMarks:g}=r.editor.extensionManager,x=m||b.$to.parentOffset&&b.$from.marks();if(x){const u=x.filter(h=>g.includes(h.type.name));l.ensureMarks(u)}}if(r.keepAttributes){const b=r.type.name==="bulletList"||r.type.name==="orderedList"?"listItem":"taskList";n().updateAttributes(b,a).run()}const c=l.doc.resolve(t.from-1).nodeBefore;c&&c.type===r.type&&Or(l.doc,t.from-1)&&(!r.joinPredicate||r.joinPredicate(i,c))&&l.join(t.from-1)},undoable:r.undoable})}var Nt=class Uz extends Rp{constructor(){super(...arguments),this.type="node"}static create(e={}){const t=typeof e=="function"?e():e;return new Uz(t)}configure(e){return super.configure(e)}extend(e){const t=typeof e=="function"?e():e;return super.extend(t)}};function zo(r){return new CF({find:r.find,handler:({state:e,range:t,match:i,pasteEvent:n})=>{const a=he(r.getAttributes,void 0,i,n);if(a===!1||a===null)return null;const{tr:l}=e,s=i[i.length-1],p=i[0];let d=t.to;if(s){const c=p.search(/\S/),b=t.from+p.indexOf(s),m=b+s.length;if(Lp(t.from,t.to,e.doc).filter(u=>u.mark.type.excluded.find(f=>f===r.type&&f!==u.mark.type)).filter(u=>u.to>b).length)return null;m<t.to&&l.delete(m,t.to),b>t.from&&l.delete(t.from+c,b),d=t.from+c+s.length,l.addMark(t.from+c,d,r.type.create(a||{})),i.index!==void 0&&i.input!==void 0&&i.index+i[0].length>=i.input.length||l.removeStoredMark(r.type)}}})}function S9(r){return o.customRef((e,t)=>({get(){return e(),r},set(i){r=i,requestAnimationFrame(()=>{requestAnimationFrame(()=>{t()})})}}))}var C9=class extends AF{constructor(r={}){return super(r),this.contentComponent=null,this.appContext=null,this.reactiveState=S9(this.view.state),this.reactiveExtensionStorage=S9(this.extensionStorage),this.on("beforeTransaction",({nextState:e})=>{this.reactiveState.value=e,this.reactiveExtensionStorage.value=this.extensionStorage}),o.markRaw(this)}get state(){return this.reactiveState?this.reactiveState.value:this.view.state}get storage(){return this.reactiveExtensionStorage?this.reactiveExtensionStorage.value:super.storage}registerPlugin(r,e){const t=super.registerPlugin(r,e);return this.reactiveState&&(this.reactiveState.value=t),t}unregisterPlugin(r){const e=super.unregisterPlugin(r);return this.reactiveState&&e&&(this.reactiveState.value=e),e}},DF=o.defineComponent({name:"EditorContent",props:{editor:{default:null,type:Object}},setup(r){const e=o.ref(),t=o.getCurrentInstance();return o.watchEffect(()=>{const i=r.editor;i&&i.options.element&&e.value&&o.nextTick(()=>{var n;if(!e.value||!((n=i.view.dom)!=null&&n.parentNode))return;const a=o.unref(e.value);e.value.append(...i.view.dom.parentNode.childNodes),i.contentComponent=t.ctx._,t&&(i.appContext={...t.appContext,provides:t.provides}),i.setOptions({element:a}),i.createNodeViews()})}),o.onBeforeUnmount(()=>{const i=r.editor;i&&(i.contentComponent=null,i.appContext=null)}),{rootEl:e}},render(){return o.h("div",{ref:r=>{this.rootEl=r}})}});o.defineComponent({name:"NodeViewContent",props:{as:{type:String,default:"div"}},inject:{nodeViewContentRef:{default:void 0}},mounted(){const r=this.nodeViewContentRef;r&&this.$el&&r(this.$el)},beforeUnmount(){const r=this.nodeViewContentRef;r&&r(null)},render(){return o.h(this.as,{style:{whiteSpace:"pre-wrap"},"data-node-view-content":""})}}),o.defineComponent({name:"NodeViewWrapper",props:{as:{type:String,default:"div"}},inject:["onDragStart","decorationClasses"],render(){var r,e;return o.h(this.as,{class:this.decorationClasses,style:{whiteSpace:"normal"},"data-node-view-wrapper":"",onDragstart:this.onDragStart},(e=(r=this.$slots).default)==null?void 0:e.call(r))}});var zF=(r={})=>{const e=o.shallowRef();return o.onMounted(()=>{e.value=new C9(r)}),o.onBeforeUnmount(()=>{var t;(t=e.value)==null||t.destroy()}),e};o.defineComponent({name:"MarkViewContent",props:{as:{type:String,default:"span"}},render(){return o.h(this.as,{style:{whiteSpace:"inherit"},"data-mark-view-content":""})}});var Ua=(r,e)=>{if(r==="slot")return 0;if(r instanceof Function)return r(e);const{children:t,...i}=e??{};if(r==="svg")throw new Error("SVG elements are not supported in the JSX syntax, use the array syntax instead");return[r,i,t]};function T9(r,e,t){for(let i=0;;i++){if(i==r.childCount||i==e.childCount)return r.childCount==e.childCount?null:t;let n=r.child(i),a=e.child(i);if(n==a){t+=n.nodeSize;continue}if(!n.sameMarkup(a))return t;if(n.isText&&n.text!=a.text){for(let l=0;n.text[l]==a.text[l];l++)t++;return t}if(n.content.size||a.content.size){let l=T9(n.content,a.content,t+1);if(l!=null)return l}t+=n.nodeSize}}function E9(r,e,t,i){for(let n=r.childCount,a=e.childCount;;){if(n==0||a==0)return n==a?null:{a:t,b:i};let l=r.child(--n),s=e.child(--a),p=l.nodeSize;if(l==s){t-=p,i-=p;continue}if(!l.sameMarkup(s))return{a:t,b:i};if(l.isText&&l.text!=s.text){let d=0,c=Math.min(l.text.length,s.text.length);for(;d<c&&l.text[l.text.length-d-1]==s.text[s.text.length-d-1];)d++,t--,i--;return{a:t,b:i}}if(l.content.size||s.content.size){let d=E9(l.content,s.content,t-1,i-1);if(d)return d}t-=p,i-=p}}var vr=class Tt{constructor(e,t){if(this.content=e,this.size=t||0,t==null)for(let i=0;i<e.length;i++)this.size+=e[i].nodeSize}nodesBetween(e,t,i,n=0,a){for(let l=0,s=0;s<t;l++){let p=this.content[l],d=s+p.nodeSize;if(d>e&&i(p,n+s,a||null,l)!==!1&&p.content.size){let c=s+1;p.nodesBetween(Math.max(0,e-c),Math.min(p.content.size,t-c),i,n+c)}s=d}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,t,i,n){let a="",l=!0;return this.nodesBetween(e,t,(s,p)=>{let d=s.isText?s.text.slice(Math.max(e,p)-p,t-p):s.isLeaf?n?typeof n=="function"?n(s):n:s.type.spec.leafText?s.type.spec.leafText(s):"":"";s.isBlock&&(s.isLeaf&&d||s.isTextblock)&&i&&(l?l=!1:a+=i),a+=d},0),a}append(e){if(!e.size)return this;if(!this.size)return e;let t=this.lastChild,i=e.firstChild,n=this.content.slice(),a=0;for(t.isText&&t.sameMarkup(i)&&(n[n.length-1]=t.withText(t.text+i.text),a=1);a<e.content.length;a++)n.push(e.content[a]);return new Tt(n,this.size+e.size)}cut(e,t=this.size){if(e==0&&t==this.size)return this;let i=[],n=0;if(t>e)for(let a=0,l=0;l<t;a++){let s=this.content[a],p=l+s.nodeSize;p>e&&((l<e||p>t)&&(s.isText?s=s.cut(Math.max(0,e-l),Math.min(s.text.length,t-l)):s=s.cut(Math.max(0,e-l-1),Math.min(s.content.size,t-l-1))),i.push(s),n+=s.nodeSize),l=p}return new Tt(i,n)}cutByIndex(e,t){return e==t?Tt.empty:e==0&&t==this.content.length?this:new Tt(this.content.slice(e,t))}replaceChild(e,t){let i=this.content[e];if(i==t)return this;let n=this.content.slice(),a=this.size+t.nodeSize-i.nodeSize;return n[e]=t,new Tt(n,a)}addToStart(e){return new Tt([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new Tt(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let t=0;t<this.content.length;t++)if(!this.content[t].eq(e.content[t]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(e){let t=this.content[e];if(!t)throw new RangeError("Index "+e+" out of range for "+this);return t}maybeChild(e){return this.content[e]||null}forEach(e){for(let t=0,i=0;t<this.content.length;t++){let n=this.content[t];e(n,i,t),i+=n.nodeSize}}findDiffStart(e,t=0){return T9(this,e,t)}findDiffEnd(e,t=this.size,i=e.size){return E9(this,e,t,i)}findIndex(e){if(e==0)return Wa(0,e);if(e==this.size)return Wa(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let t=0,i=0;;t++){let n=this.child(t),a=i+n.nodeSize;if(a>=e)return a==e?Wa(t+1,a):Wa(t,i);i=a}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,t){if(!t)return Tt.empty;if(!Array.isArray(t))throw new RangeError("Invalid input for Fragment.fromJSON");return Tt.fromArray(t.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return Tt.empty;let t,i=0;for(let n=0;n<e.length;n++){let a=e[n];i+=a.nodeSize,n&&a.isText&&e[n-1].sameMarkup(a)?(t||(t=e.slice(0,n)),t[t.length-1]=a.withText(t[t.length-1].text+a.text)):t&&t.push(a)}return new Tt(t||e,i)}static from(e){if(!e)return Tt.empty;if(e instanceof Tt)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new Tt([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}};vr.empty=new vr([],0);var Fp={index:0,offset:0};function Wa(r,e){return Fp.index=r,Fp.offset=e,Fp}var IF=class extends Error{},Ve=class Oi{constructor(e,t,i){this.content=e,this.openStart=t,this.openEnd=i}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,t){let i=P9(this.content,e+this.openStart,t,this.openStart+1,this.openEnd+1);return i&&new Oi(i,this.openStart,this.openEnd)}removeBetween(e,t){return new Oi(M9(this.content,e+this.openStart,t+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(e,t){if(!t)return Oi.empty;let i=t.openStart||0,n=t.openEnd||0;if(typeof i!="number"||typeof n!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new Oi(vr.fromJSON(e,t.content),i,n)}static maxOpen(e,t=!0){let i=0,n=0;for(let a=e.firstChild;a&&!a.isLeaf&&(t||!a.type.spec.isolating);a=a.firstChild)i++;for(let a=e.lastChild;a&&!a.isLeaf&&(t||!a.type.spec.isolating);a=a.lastChild)n++;return new Oi(e,i,n)}};Ve.empty=new Ve(vr.empty,0,0);function M9(r,e,t){let{index:i,offset:n}=r.findIndex(e),a=r.maybeChild(i),{index:l,offset:s}=r.findIndex(t);if(n==e||a.isText){if(s!=t&&!r.child(l).isText)throw new RangeError("Removing non-flat range");return r.cut(0,e).append(r.cut(t))}if(i!=l)throw new RangeError("Removing non-flat range");return r.replaceChild(i,a.copy(M9(a.content,e-n-1,t-n-1)))}function P9(r,e,t,i,n,a){let{index:l,offset:s}=r.findIndex(e),p=r.maybeChild(l);if(s==e||p.isText)return a&&i<=0&&n<=0&&!a.canReplace(l,l,t)?null:r.cut(0,e).append(t).append(r.cut(e));let d=P9(p.content,e-s-1,t,l==0?i-1:0,l==r.childCount-1?n-1:0,p);return d&&r.replaceChild(l,p.copy(d))}var B9=65535,L9=Math.pow(2,16);function VF(r,e){return r+e*L9}function N9(r){return r&B9}function HF(r){return(r-(r&B9))/L9}var A9=1,_9=2,Ga=4,D9=8,z9=class{constructor(r,e,t){this.pos=r,this.delInfo=e,this.recover=t}get deleted(){return(this.delInfo&D9)>0}get deletedBefore(){return(this.delInfo&(A9|Ga))>0}get deletedAfter(){return(this.delInfo&(_9|Ga))>0}get deletedAcross(){return(this.delInfo&Ga)>0}},Io=class Fi{constructor(e,t=!1){if(this.ranges=e,this.inverted=t,!e.length&&Fi.empty)return Fi.empty}recover(e){let t=0,i=N9(e);if(!this.inverted)for(let n=0;n<i;n++)t+=this.ranges[n*3+2]-this.ranges[n*3+1];return this.ranges[i*3]+t+HF(e)}mapResult(e,t=1){return this._map(e,t,!1)}map(e,t=1){return this._map(e,t,!0)}_map(e,t,i){let n=0,a=this.inverted?2:1,l=this.inverted?1:2;for(let s=0;s<this.ranges.length;s+=3){let p=this.ranges[s]-(this.inverted?n:0);if(p>e)break;let d=this.ranges[s+a],c=this.ranges[s+l],b=p+d;if(e<=b){let m=d?e==p?-1:e==b?1:t:t,g=p+n+(m<0?0:c);if(i)return g;let x=e==(t<0?p:b)?null:VF(s/3,e-p),u=e==p?_9:e==b?A9:Ga;return(t<0?e!=p:e!=b)&&(u|=D9),new z9(g,u,x)}n+=c-d}return i?e+n:new z9(e+n,0,null)}touches(e,t){let i=0,n=N9(t),a=this.inverted?2:1,l=this.inverted?1:2;for(let s=0;s<this.ranges.length;s+=3){let p=this.ranges[s]-(this.inverted?i:0);if(p>e)break;let d=this.ranges[s+a],c=p+d;if(e<=c&&s==n*3)return!0;i+=this.ranges[s+l]-d}return!1}forEach(e){let t=this.inverted?2:1,i=this.inverted?1:2;for(let n=0,a=0;n<this.ranges.length;n+=3){let l=this.ranges[n],s=l-(this.inverted?a:0),p=l+(this.inverted?0:a),d=this.ranges[n+t],c=this.ranges[n+i];e(s,s+d,p,p+c),a+=c-d}}invert(){return new Fi(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?Fi.empty:new Fi(e<0?[0,-e,0]:[0,0,e])}};Io.empty=new Io([]);var jp=Object.create(null),st=class{getMap(){return Io.empty}merge(r){return null}static fromJSON(r,e){if(!e||!e.stepType)throw new RangeError("Invalid input for Step.fromJSON");let t=jp[e.stepType];if(!t)throw new RangeError(`No step type ${e.stepType} defined`);return t.fromJSON(r,e)}static jsonID(r,e){if(r in jp)throw new RangeError("Duplicate use of step JSON ID "+r);return jp[r]=e,e.prototype.jsonID=r,e}},yt=class ra{constructor(e,t){this.doc=e,this.failed=t}static ok(e){return new ra(e,null)}static fail(e){return new ra(null,e)}static fromReplace(e,t,i,n){try{return ra.ok(e.replace(t,i,n))}catch(a){if(a instanceof IF)return ra.fail(a.message);throw a}}};function qp(r,e,t){let i=[];for(let n=0;n<r.childCount;n++){let a=r.child(n);a.content.size&&(a=a.copy(qp(a.content,e,a))),a.isInline&&(a=e(a,t,n)),i.push(a)}return vr.fromArray(i)}var I9=class oa extends st{constructor(e,t,i){super(),this.from=e,this.to=t,this.mark=i}apply(e){let t=e.slice(this.from,this.to),i=e.resolve(this.from),n=i.node(i.sharedDepth(this.to)),a=new Ve(qp(t.content,(l,s)=>!l.isAtom||!s.type.allowsMarkType(this.mark.type)?l:l.mark(this.mark.addToSet(l.marks)),n),t.openStart,t.openEnd);return yt.fromReplace(e,this.from,this.to,a)}invert(){return new V9(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),i=e.mapResult(this.to,-1);return t.deleted&&i.deleted||t.pos>=i.pos?null:new oa(t.pos,i.pos,this.mark)}merge(e){return e instanceof oa&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new oa(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new oa(t.from,t.to,e.markFromJSON(t.mark))}};st.jsonID("addMark",I9);var V9=class ia extends st{constructor(e,t,i){super(),this.from=e,this.to=t,this.mark=i}apply(e){let t=e.slice(this.from,this.to),i=new Ve(qp(t.content,n=>n.mark(this.mark.removeFromSet(n.marks)),e),t.openStart,t.openEnd);return yt.fromReplace(e,this.from,this.to,i)}invert(){return new I9(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),i=e.mapResult(this.to,-1);return t.deleted&&i.deleted||t.pos>=i.pos?null:new ia(t.pos,i.pos,this.mark)}merge(e){return e instanceof ia&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new ia(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new ia(t.from,t.to,e.markFromJSON(t.mark))}};st.jsonID("removeMark",V9);var H9=class na extends st{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return yt.fail("No node at mark step's position");let i=t.type.create(t.attrs,null,this.mark.addToSet(t.marks));return yt.fromReplace(e,this.pos,this.pos+1,new Ve(vr.from(i),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);if(t){let i=this.mark.addToSet(t.marks);if(i.length==t.marks.length){for(let n=0;n<t.marks.length;n++)if(!t.marks[n].isInSet(i))return new na(this.pos,t.marks[n]);return new na(this.pos,this.mark)}}return new R9(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new na(t.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,t){if(typeof t.pos!="number")throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new na(t.pos,e.markFromJSON(t.mark))}};st.jsonID("addNodeMark",H9);var R9=class Sc extends st{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return yt.fail("No node at mark step's position");let i=t.type.create(t.attrs,null,this.mark.removeFromSet(t.marks));return yt.fromReplace(e,this.pos,this.pos+1,new Ve(vr.from(i),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);return!t||!this.mark.isInSet(t.marks)?this:new H9(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new Sc(t.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,t){if(typeof t.pos!="number")throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new Sc(t.pos,e.markFromJSON(t.mark))}};st.jsonID("removeNodeMark",R9);var Up=class wo extends st{constructor(e,t,i,n=!1){super(),this.from=e,this.to=t,this.slice=i,this.structure=n}apply(e){return this.structure&&Wp(e,this.from,this.to)?yt.fail("Structure replace would overwrite content"):yt.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new Io([this.from,this.to-this.from,this.slice.size])}invert(e){return new wo(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let t=e.mapResult(this.to,-1),i=this.from==this.to&&wo.MAP_BIAS<0?t:e.mapResult(this.from,1);return i.deletedAcross&&t.deletedAcross?null:new wo(i.pos,Math.max(i.pos,t.pos),this.slice,this.structure)}merge(e){if(!(e instanceof wo)||e.structure||this.structure)return null;if(this.from+this.slice.size==e.from&&!this.slice.openEnd&&!e.slice.openStart){let t=this.slice.size+e.slice.size==0?Ve.empty:new Ve(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new wo(this.from,this.to+(e.to-e.from),t,this.structure)}else if(e.to==this.from&&!this.slice.openStart&&!e.slice.openEnd){let t=this.slice.size+e.slice.size==0?Ve.empty:new Ve(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new wo(e.from,this.to,t,this.structure)}else return null}toJSON(){let e={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new wo(t.from,t.to,Ve.fromJSON(e,t.slice),!!t.structure)}};Up.MAP_BIAS=1,st.jsonID("replace",Up);var O9=class Ps extends st{constructor(e,t,i,n,a,l,s=!1){super(),this.from=e,this.to=t,this.gapFrom=i,this.gapTo=n,this.slice=a,this.insert=l,this.structure=s}apply(e){if(this.structure&&(Wp(e,this.from,this.gapFrom)||Wp(e,this.gapTo,this.to)))return yt.fail("Structure gap-replace would overwrite content");let t=e.slice(this.gapFrom,this.gapTo);if(t.openStart||t.openEnd)return yt.fail("Gap is not a flat range");let i=this.slice.insertAt(this.insert,t.content);return i?yt.fromReplace(e,this.from,this.to,i):yt.fail("Content does not fit in gap")}getMap(){return new Io([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(e){let t=this.gapTo-this.gapFrom;return new Ps(this.from,this.from+this.slice.size+t,this.from+this.insert,this.from+this.insert+t,e.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(e){let t=e.mapResult(this.from,1),i=e.mapResult(this.to,-1),n=this.from==this.gapFrom?t.pos:e.map(this.gapFrom,-1),a=this.to==this.gapTo?i.pos:e.map(this.gapTo,1);return t.deletedAcross&&i.deletedAcross||n<t.pos||a>i.pos?null:new Ps(t.pos,i.pos,n,a,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number"||typeof t.gapFrom!="number"||typeof t.gapTo!="number"||typeof t.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new Ps(t.from,t.to,t.gapFrom,t.gapTo,Ve.fromJSON(e,t.slice),t.insert,!!t.structure)}};st.jsonID("replaceAround",O9);function Wp(r,e,t){let i=r.resolve(e),n=t-e,a=i.depth;for(;n>0&&a>0&&i.indexAfter(a)==i.node(a).childCount;)a--,n--;if(n>0){let l=i.node(a).maybeChild(i.indexAfter(a));for(;n>0;){if(!l||l.isLeaf)return!0;l=l.firstChild,n--}}return!1}var RF=class Bs extends st{constructor(e,t,i){super(),this.pos=e,this.attr=t,this.value=i}apply(e){let t=e.nodeAt(this.pos);if(!t)return yt.fail("No node at attribute step's position");let i=Object.create(null);for(let a in t.attrs)i[a]=t.attrs[a];i[this.attr]=this.value;let n=t.type.create(i,null,t.marks);return yt.fromReplace(e,this.pos,this.pos+1,new Ve(vr.from(n),0,t.isLeaf?0:1))}getMap(){return Io.empty}invert(e){return new Bs(this.pos,this.attr,e.nodeAt(this.pos).attrs[this.attr])}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new Bs(t.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(e,t){if(typeof t.pos!="number"||typeof t.attr!="string")throw new RangeError("Invalid input for AttrStep.fromJSON");return new Bs(t.pos,t.attr,t.value)}};st.jsonID("attr",RF);var OF=class Cc extends st{constructor(e,t){super(),this.attr=e,this.value=t}apply(e){let t=Object.create(null);for(let n in e.attrs)t[n]=e.attrs[n];t[this.attr]=this.value;let i=e.type.create(t,e.content,e.marks);return yt.ok(i)}getMap(){return Io.empty}invert(e){return new Cc(this.attr,e.attrs[this.attr])}map(e){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(e,t){if(typeof t.attr!="string")throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new Cc(t.attr,t.value)}};st.jsonID("docAttr",OF);var un=class extends Error{};un=function r(e){let t=Error.call(this,e);return t.__proto__=r.prototype,t},un.prototype=Object.create(Error.prototype),un.prototype.constructor=un,un.prototype.name="TransformError";var Gp=Object.create(null),We=class{constructor(r,e,t){this.$anchor=r,this.$head=e,this.ranges=t||[new FF(r.min(e),r.max(e))]}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 r=this.ranges;for(let e=0;e<r.length;e++)if(r[e].$from.pos!=r[e].$to.pos)return!1;return!0}content(){return this.$from.doc.slice(this.from,this.to,!0)}replace(r,e=Ve.empty){let t=e.content.lastChild,i=null;for(let l=0;l<e.openEnd;l++)i=t,t=t.lastChild;let n=r.steps.length,a=this.ranges;for(let l=0;l<a.length;l++){let{$from:s,$to:p}=a[l],d=r.mapping.slice(n);r.replaceRange(d.map(s.pos),d.map(p.pos),l?Ve.empty:e),l==0&&U9(r,n,(t?t.isInline:i&&i.isTextblock)?-1:1)}}replaceWith(r,e){let t=r.steps.length,i=this.ranges;for(let n=0;n<i.length;n++){let{$from:a,$to:l}=i[n],s=r.mapping.slice(t),p=s.map(a.pos),d=s.map(l.pos);n?r.deleteRange(p,d):(r.replaceRangeWith(p,d,e),U9(r,t,e.isInline?-1:1))}}static findFrom(r,e,t=!1){let i=r.parent.inlineContent?new gi(r):xi(r.node(0),r.parent,r.pos,r.index(),e,t);if(i)return i;for(let n=r.depth-1;n>=0;n--){let a=e<0?xi(r.node(0),r.node(n),r.before(n+1),r.index(n),e,t):xi(r.node(0),r.node(n),r.after(n+1),r.index(n)+1,e,t);if(a)return a}return null}static near(r,e=1){return this.findFrom(r,e)||this.findFrom(r,-e)||new xn(r.node(0))}static atStart(r){return xi(r,r,0,0,1)||new xn(r)}static atEnd(r){return xi(r,r,r.content.size,r.childCount,-1)||new xn(r)}static fromJSON(r,e){if(!e||!e.type)throw new RangeError("Invalid input for Selection.fromJSON");let t=Gp[e.type];if(!t)throw new RangeError(`No selection type ${e.type} defined`);return t.fromJSON(r,e)}static jsonID(r,e){if(r in Gp)throw new RangeError("Duplicate use of selection JSON ID "+r);return Gp[r]=e,e.prototype.jsonID=r,e}getBookmark(){return gi.between(this.$anchor,this.$head).getBookmark()}};We.prototype.visible=!0;var FF=class{constructor(r,e){this.$from=r,this.$to=e}},F9=!1;function j9(r){!F9&&!r.parent.inlineContent&&(F9=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+r.parent.type.name+")"))}var gi=class aa extends We{constructor(e,t=e){j9(e),j9(t),super(e,t)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(e,t){let i=e.resolve(t.map(this.head));if(!i.parent.inlineContent)return We.near(i);let n=e.resolve(t.map(this.anchor));return new aa(n.parent.inlineContent?n:i,i)}replace(e,t=Ve.empty){if(super.replace(e,t),t==Ve.empty){let i=this.$from.marksAcross(this.$to);i&&e.ensureMarks(i)}}eq(e){return e instanceof aa&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new q9(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(e,t){if(typeof t.anchor!="number"||typeof t.head!="number")throw new RangeError("Invalid input for TextSelection.fromJSON");return new aa(e.resolve(t.anchor),e.resolve(t.head))}static create(e,t,i=t){let n=e.resolve(t);return new this(n,i==t?n:e.resolve(i))}static between(e,t,i){let n=e.pos-t.pos;if((!i||n)&&(i=n>=0?1:-1),!t.parent.inlineContent){let a=We.findFrom(t,i,!0)||We.findFrom(t,-i,!0);if(a)t=a.$head;else return We.near(t,i)}return e.parent.inlineContent||(n==0?e=t:(e=(We.findFrom(e,-i,!0)||We.findFrom(e,i,!0)).$anchor,e.pos<t.pos!=n<0&&(e=t))),new aa(e,t)}};We.jsonID("text",gi);var q9=class Wz{constructor(e,t){this.anchor=e,this.head=t}map(e){return new Wz(e.map(this.anchor),e.map(this.head))}resolve(e){return gi.between(e.resolve(this.anchor),e.resolve(this.head))}},ui=class la extends We{constructor(e){let t=e.nodeAfter,i=e.node(0).resolve(e.pos+t.nodeSize);super(e,i),this.node=t}map(e,t){let{deleted:i,pos:n}=t.mapResult(this.anchor),a=e.resolve(n);return i?We.near(a):new la(a)}content(){return new Ve(vr.from(this.node),0,0)}eq(e){return e instanceof la&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new jF(this.anchor)}static fromJSON(e,t){if(typeof t.anchor!="number")throw new RangeError("Invalid input for NodeSelection.fromJSON");return new la(e.resolve(t.anchor))}static create(e,t){return new la(e.resolve(t))}static isSelectable(e){return!e.isText&&e.type.spec.selectable!==!1}};ui.prototype.visible=!1,We.jsonID("node",ui);var jF=class Gz{constructor(e){this.anchor=e}map(e){let{deleted:t,pos:i}=e.mapResult(this.anchor);return t?new q9(i,i):new Gz(i)}resolve(e){let t=e.resolve(this.anchor),i=t.nodeAfter;return i&&ui.isSelectable(i)?new ui(t):We.near(t)}},xn=class Ls extends We{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,t=Ve.empty){if(t==Ve.empty){e.delete(0,e.doc.content.size);let i=We.atStart(e.doc);i.eq(e.selection)||e.setSelection(i)}else super.replace(e,t)}toJSON(){return{type:"all"}}static fromJSON(e){return new Ls(e)}map(e){return new Ls(e)}eq(e){return e instanceof Ls}getBookmark(){return qF}};We.jsonID("all",xn);var qF={map(){return this},resolve(r){return new xn(r)}};function xi(r,e,t,i,n,a=!1){if(e.inlineContent)return gi.create(r,t);for(let l=i-(n>0?0:1);n>0?l<e.childCount:l>=0;l+=n){let s=e.child(l);if(s.isAtom){if(!a&&ui.isSelectable(s))return ui.create(r,t-(n<0?s.nodeSize:0))}else{let p=xi(r,s,t+n,n<0?s.childCount:0,n,a);if(p)return p}t+=s.nodeSize*n}return null}function U9(r,e,t){let i=r.steps.length-1;if(i<e)return;let n=r.steps[i];if(!(n instanceof Up||n instanceof O9))return;let a=r.mapping.maps[i],l;a.forEach((s,p,d,c)=>{l==null&&(l=c)}),r.setSelection(We.near(r.doc.resolve(l),t))}function W9(r,e){return!e||!r?r:r.bind(e)}var Ka=class{constructor(r,e,t){this.name=r,this.init=W9(e.init,t),this.apply=W9(e.apply,t)}};new Ka("doc",{init(r){return r.doc||r.schema.topNodeType.createAndFill()},apply(r){return r.doc}}),new Ka("selection",{init(r,e){return r.selection||We.atStart(e.doc)},apply(r){return r.selection}}),new Ka("storedMarks",{init(r){return r.storedMarks||null},apply(r,e,t,i){return i.selection.$cursor?r.storedMarks:null}}),new Ka("scrollToSelection",{init(){return 0},apply(r,e){return r.scrolledIntoView?e+1:e}});var UF=(r,e)=>{var t;const{state:i,view:n}=r,{selection:a}=i;if(!a.empty)return!1;const{$from:l}=a;if(l.parentOffset!==0)return!1;const s=l.depth-1,p=l.node(s),d=l.index(s);if(d===0)return!1;if(p.type===e)return r.commands.lift(e.name);const c=p.child(d-1);if(c.type!==e||!((t=c.lastChild)!=null&&t.isTextblock))return!1;const b=l.before(),g=b-1-1,{tr:x}=i;return x.delete(b,l.after()).insert(g,l.parent.content),x.setSelection(gi.create(x.doc,g)),n.dispatch(x.scrollIntoView()),!0},WF=/^\s*>\s$/,GF=Nt.create({name:"blockquote",addOptions(){return{HTMLAttributes:{}}},content:"block+",group:"block",defining:!0,parseHTML(){return[{tag:"blockquote"}]},renderHTML({HTMLAttributes:r}){return Ua("blockquote",{...je(this.options.HTMLAttributes,r),children:Ua("slot",{})})},parseMarkdown:(r,e)=>{var t;const i=(t=e.parseBlockChildren)!=null?t:e.parseChildren;return e.createNode("blockquote",void 0,i(r.tokens||[]))},renderMarkdown:(r,e)=>{if(!r.content)return"";const t=">",i=[];return r.content.forEach((n,a)=>{var l,s;const c=((s=(l=e.renderChild)==null?void 0:l.call(e,n,a))!=null?s:e.renderChildren([n])).split(`
119
119
  `).map(b=>b.trim()===""?t:`${t} ${b}`);i.push(c.join(`
120
120
  `))}),i.join(`
121
121
  ${t}
122
- `)},addCommands(){return{setBlockquote:()=>({commands:r})=>r.wrapIn(this.name),toggleBlockquote:()=>({commands:r})=>r.toggleWrap(this.name),unsetBlockquote:()=>({commands:r})=>r.lift(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-b":()=>this.editor.commands.toggleBlockquote(),Backspace:()=>UF(this.editor,this.type)}},addInputRules(){return[mi({find:WF,type:this.type})]}}),KF=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,JF=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,YF=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,QF=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,XF=Do.create({name:"bold",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"strong"},{tag:"b",getAttrs:r=>r.style.fontWeight!=="normal"&&null},{style:"font-weight=400",clearMark:r=>r.type.name===this.name},{style:"font-weight",getAttrs:r=>/^(bold(er)?|[5-9]\d{2,})$/.test(r)&&null}]},renderHTML({HTMLAttributes:r}){return Ua("strong",{...Fe(this.options.HTMLAttributes,r),children:Ua("slot",{})})},markdownTokenName:"strong",parseMarkdown:(r,e)=>e.applyMark("bold",e.parseInline(r.tokens||[])),markdownOptions:{htmlReopen:{open:"<strong>",close:"</strong>"}},renderMarkdown:(r,e)=>`**${e.renderChildren(r)}**`,addCommands(){return{setBold:()=>({commands:r})=>r.setMark(this.name),toggleBold:()=>({commands:r})=>r.toggleMark(this.name),unsetBold:()=>({commands:r})=>r.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-b":()=>this.editor.commands.toggleBold(),"Mod-B":()=>this.editor.commands.toggleBold()}},addInputRules(){return[bi({find:KF,type:this.type}),bi({find:YF,type:this.type})]},addPasteRules(){return[zo({find:JF,type:this.type}),zo({find:QF,type:this.type})]}}),ZF=r=>{const e=/`([^`]+)`(?!`)$/.exec(r);return!e||e.index>0&&r[e.index-1]==="`"?null:{index:e.index,text:e[0],replaceWith:e[1]}},$F=r=>{const e=/`([^`]+)`(?!`)/g,t=[];let i;for(;(i=e.exec(r))!==null;)i.index>0&&r[i.index-1]==="`"||t.push({index:i.index,text:i[0],replaceWith:i[1]});return t},ej=Do.create({name:"code",addOptions(){return{HTMLAttributes:{}}},excludes:"_",code:!0,exitable:!0,parseHTML(){return[{tag:"code"}]},renderHTML({HTMLAttributes:r}){return["code",Fe(this.options.HTMLAttributes,r),0]},markdownTokenName:"codespan",parseMarkdown:(r,e)=>e.applyMark("code",[{type:"text",text:r.text||""}]),renderMarkdown:(r,e)=>r.content?`\`${e.renderChildren(r.content)}\``:"",addCommands(){return{setCode:()=>({commands:r})=>r.setMark(this.name),toggleCode:()=>({commands:r})=>r.toggleMark(this.name),unsetCode:()=>({commands:r})=>r.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-e":()=>this.editor.commands.toggleCode()}},addInputRules(){return[bi({find:ZF,type:this.type})]},addPasteRules(){return[zo({find:$F,type:this.type})]}}),Kp=4,tj=/^```([a-z]+)?[\s\n]$/,rj=/^~~~([a-z]+)?[\s\n]$/,oj=Nt.create({name:"codeBlock",addOptions(){return{languageClassPrefix:"language-",exitOnTripleEnter:!0,exitOnArrowDown:!0,defaultLanguage:null,enableTabIndentation:!1,tabSize:Kp,HTMLAttributes:{}}},content:"text*",marks:"",group:"block",code:!0,defining:!0,addAttributes(){return{language:{default:this.options.defaultLanguage,parseHTML:r=>{var e;const{languageClassPrefix:t}=this.options;if(!t)return null;const a=[...((e=r.firstElementChild)==null?void 0:e.classList)||[]].filter(l=>l.startsWith(t)).map(l=>l.replace(t,""))[0];return a||null},rendered:!1}}},parseHTML(){return[{tag:"pre",preserveWhitespace:"full"}]},renderHTML({node:r,HTMLAttributes:e}){return["pre",Fe(this.options.HTMLAttributes,e),["code",{class:r.attrs.language?this.options.languageClassPrefix+r.attrs.language:null},0]]},markdownTokenName:"code",parseMarkdown:(r,e)=>{var t,i;return((t=r.raw)==null?void 0:t.startsWith("```"))===!1&&((i=r.raw)==null?void 0:i.startsWith("~~~"))===!1&&r.codeBlockStyle!=="indented"?[]:e.createNode("codeBlock",{language:r.lang||null},r.text?[e.createTextNode(r.text)]:[])},renderMarkdown:(r,e)=>{var t;let i="";const n=((t=r.attrs)==null?void 0:t.language)||"";return r.content?i=[`\`\`\`${n}`,e.renderChildren(r.content),"```"].join(`
122
+ `)},addCommands(){return{setBlockquote:()=>({commands:r})=>r.wrapIn(this.name),toggleBlockquote:()=>({commands:r})=>r.toggleWrap(this.name),unsetBlockquote:()=>({commands:r})=>r.lift(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-b":()=>this.editor.commands.toggleBlockquote(),Backspace:()=>UF(this.editor,this.type)}},addInputRules(){return[mi({find:WF,type:this.type})]}}),KF=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,JF=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,YF=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,QF=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,XF=Do.create({name:"bold",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"strong"},{tag:"b",getAttrs:r=>r.style.fontWeight!=="normal"&&null},{style:"font-weight=400",clearMark:r=>r.type.name===this.name},{style:"font-weight",getAttrs:r=>/^(bold(er)?|[5-9]\d{2,})$/.test(r)&&null}]},renderHTML({HTMLAttributes:r}){return Ua("strong",{...je(this.options.HTMLAttributes,r),children:Ua("slot",{})})},markdownTokenName:"strong",parseMarkdown:(r,e)=>e.applyMark("bold",e.parseInline(r.tokens||[])),markdownOptions:{htmlReopen:{open:"<strong>",close:"</strong>"}},renderMarkdown:(r,e)=>`**${e.renderChildren(r)}**`,addCommands(){return{setBold:()=>({commands:r})=>r.setMark(this.name),toggleBold:()=>({commands:r})=>r.toggleMark(this.name),unsetBold:()=>({commands:r})=>r.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-b":()=>this.editor.commands.toggleBold(),"Mod-B":()=>this.editor.commands.toggleBold()}},addInputRules(){return[bi({find:KF,type:this.type}),bi({find:YF,type:this.type})]},addPasteRules(){return[zo({find:JF,type:this.type}),zo({find:QF,type:this.type})]}}),ZF=r=>{const e=/`([^`]+)`(?!`)$/.exec(r);return!e||e.index>0&&r[e.index-1]==="`"?null:{index:e.index,text:e[0],replaceWith:e[1]}},$F=r=>{const e=/`([^`]+)`(?!`)/g,t=[];let i;for(;(i=e.exec(r))!==null;)i.index>0&&r[i.index-1]==="`"||t.push({index:i.index,text:i[0],replaceWith:i[1]});return t},ej=Do.create({name:"code",addOptions(){return{HTMLAttributes:{}}},excludes:"_",code:!0,exitable:!0,parseHTML(){return[{tag:"code"}]},renderHTML({HTMLAttributes:r}){return["code",je(this.options.HTMLAttributes,r),0]},markdownTokenName:"codespan",parseMarkdown:(r,e)=>e.applyMark("code",[{type:"text",text:r.text||""}]),renderMarkdown:(r,e)=>r.content?`\`${e.renderChildren(r.content)}\``:"",addCommands(){return{setCode:()=>({commands:r})=>r.setMark(this.name),toggleCode:()=>({commands:r})=>r.toggleMark(this.name),unsetCode:()=>({commands:r})=>r.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-e":()=>this.editor.commands.toggleCode()}},addInputRules(){return[bi({find:ZF,type:this.type})]},addPasteRules(){return[zo({find:$F,type:this.type})]}}),Kp=4,tj=/^```([a-z]+)?[\s\n]$/,rj=/^~~~([a-z]+)?[\s\n]$/,oj=Nt.create({name:"codeBlock",addOptions(){return{languageClassPrefix:"language-",exitOnTripleEnter:!0,exitOnArrowDown:!0,defaultLanguage:null,enableTabIndentation:!1,tabSize:Kp,HTMLAttributes:{}}},content:"text*",marks:"",group:"block",code:!0,defining:!0,addAttributes(){return{language:{default:this.options.defaultLanguage,parseHTML:r=>{var e;const{languageClassPrefix:t}=this.options;if(!t)return null;const a=[...((e=r.firstElementChild)==null?void 0:e.classList)||[]].filter(l=>l.startsWith(t)).map(l=>l.replace(t,""))[0];return a||null},rendered:!1}}},parseHTML(){return[{tag:"pre",preserveWhitespace:"full"}]},renderHTML({node:r,HTMLAttributes:e}){return["pre",je(this.options.HTMLAttributes,e),["code",{class:r.attrs.language?this.options.languageClassPrefix+r.attrs.language:null},0]]},markdownTokenName:"code",parseMarkdown:(r,e)=>{var t,i;return((t=r.raw)==null?void 0:t.startsWith("```"))===!1&&((i=r.raw)==null?void 0:i.startsWith("~~~"))===!1&&r.codeBlockStyle!=="indented"?[]:e.createNode("codeBlock",{language:r.lang||null},r.text?[e.createTextNode(r.text)]:[])},renderMarkdown:(r,e)=>{var t;let i="";const n=((t=r.attrs)==null?void 0:t.language)||"";return r.content?i=[`\`\`\`${n}`,e.renderChildren(r.content),"```"].join(`
123
123
  `):i=`\`\`\`${n}
124
124
 
125
125
  \`\`\``,i},addCommands(){return{setCodeBlock:r=>({commands:e})=>e.setNode(this.name,r),toggleCodeBlock:r=>({commands:e})=>e.toggleNode(this.name,"paragraph",r)}},addKeyboardShortcuts(){return{"Mod-Alt-c":()=>this.editor.commands.toggleCodeBlock(),Backspace:()=>{const{empty:r,$anchor:e}=this.editor.state.selection,t=e.pos===1;return!r||e.parent.type.name!==this.name?!1:t||!e.parent.textContent.length?this.editor.commands.clearNodes():!1},Tab:({editor:r})=>{var e;if(!this.options.enableTabIndentation)return!1;const t=(e=this.options.tabSize)!=null?e:Kp,{state:i}=r,{selection:n}=i,{$from:a,empty:l}=n;if(a.parent.type!==this.type)return!1;const s=" ".repeat(t);return l?r.commands.insertContent(s):r.commands.command(({tr:p})=>{const{from:d,to:c}=n,g=i.doc.textBetween(d,c,`
@@ -135,33 +135,33 @@ ${t}
135
135
  `).map(g=>{var x;const u=((x=g.match(/^ */))==null?void 0:x[0])||"",h=Math.min(u.length,t);return g.slice(h)}).join(`
136
136
  `);return s.replaceWith(p,d,i.schema.text(m)),!0})},Enter:({editor:r})=>{if(!this.options.exitOnTripleEnter)return!1;const{state:e}=r,{selection:t}=e,{$from:i,empty:n}=t;if(!n||i.parent.type!==this.type)return!1;const a=i.parentOffset===i.parent.nodeSize-2,l=i.parent.textContent.endsWith(`
137
137
 
138
- `);return!a||!l?!1:r.chain().command(({tr:s})=>(s.delete(i.pos-2,i.pos),!0)).exitCode().run()},ArrowDown:({editor:r})=>{if(!this.options.exitOnArrowDown)return!1;const{state:e}=r,{selection:t,doc:i}=e,{$from:n,empty:a}=t;if(!a||n.parent.type!==this.type||!(n.parentOffset===n.parent.nodeSize-2))return!1;const s=n.after();return s===void 0?!1:i.nodeAt(s)?r.commands.command(({tr:d})=>(d.setSelection(de.near(i.resolve(s))),!0)):r.commands.exitCode()}}},addInputRules(){return[Op({find:tj,type:this.type,getAttributes:r=>({language:r[1]})}),Op({find:rj,type:this.type,getAttributes:r=>({language:r[1]})})]},addProseMirrorPlugins(){return[new Me({key:new Oe("codeBlockVSCodeHandler"),props:{handlePaste:(r,e)=>{if(!e.clipboardData||this.editor.isActive(this.type.name))return!1;const t=e.clipboardData.getData("text/plain"),i=e.clipboardData.getData("vscode-editor-data"),n=i?JSON.parse(i):void 0,a=n==null?void 0:n.mode;if(!t||!a)return!1;const{tr:l,schema:s}=r.state,p=s.text(t.replace(/\r\n?/g,`
138
+ `);return!a||!l?!1:r.chain().command(({tr:s})=>(s.delete(i.pos-2,i.pos),!0)).exitCode().run()},ArrowDown:({editor:r})=>{if(!this.options.exitOnArrowDown)return!1;const{state:e}=r,{selection:t,doc:i}=e,{$from:n,empty:a}=t;if(!a||n.parent.type!==this.type||!(n.parentOffset===n.parent.nodeSize-2))return!1;const s=n.after();return s===void 0?!1:i.nodeAt(s)?r.commands.command(({tr:d})=>(d.setSelection(de.near(i.resolve(s))),!0)):r.commands.exitCode()}}},addInputRules(){return[Op({find:tj,type:this.type,getAttributes:r=>({language:r[1]})}),Op({find:rj,type:this.type,getAttributes:r=>({language:r[1]})})]},addProseMirrorPlugins(){return[new Me({key:new Fe("codeBlockVSCodeHandler"),props:{handlePaste:(r,e)=>{if(!e.clipboardData||this.editor.isActive(this.type.name))return!1;const t=e.clipboardData.getData("text/plain"),i=e.clipboardData.getData("vscode-editor-data"),n=i?JSON.parse(i):void 0,a=n==null?void 0:n.mode;if(!t||!a)return!1;const{tr:l,schema:s}=r.state,p=s.text(t.replace(/\r\n?/g,`
139
139
  `));return l.replaceSelectionWith(this.type.create({language:a},p)),l.selection.$from.parent.type!==this.type&&l.setSelection(pe.near(l.doc.resolve(Math.max(0,l.selection.from-2)))),l.setMeta("paste",!0),r.dispatch(l),!0}}})]}}),ij=Nt.create({name:"doc",topNode:!0,content:"block+",renderMarkdown:(r,e)=>r.content?e.renderChildren(r.content,`
140
140
 
141
- `):""}),nj=Nt.create({name:"hardBreak",markdownTokenName:"br",addOptions(){return{keepMarks:!0,HTMLAttributes:{}}},inline:!0,group:"inline",selectable:!1,linebreakReplacement:!0,parseHTML(){return[{tag:"br"}]},renderHTML({HTMLAttributes:r}){return["br",Fe(this.options.HTMLAttributes,r)]},renderText(){return`
141
+ `):""}),nj=Nt.create({name:"hardBreak",markdownTokenName:"br",addOptions(){return{keepMarks:!0,HTMLAttributes:{}}},inline:!0,group:"inline",selectable:!1,linebreakReplacement:!0,parseHTML(){return[{tag:"br"}]},renderHTML({HTMLAttributes:r}){return["br",je(this.options.HTMLAttributes,r)]},renderText(){return`
142
142
  `},renderMarkdown:()=>`
143
- `,parseMarkdown:()=>({type:"hardBreak"}),addCommands(){return{setHardBreak:()=>({commands:r,chain:e,state:t,editor:i})=>r.first([()=>r.exitCode(),()=>r.command(()=>{const{selection:n,storedMarks:a}=t;if(n.$from.parent.type.spec.isolating)return!1;const{keepMarks:l}=this.options,{splittableMarks:s}=i.extensionManager,p=a||n.$to.parentOffset&&n.$from.marks();return e().insertContent({type:this.name}).command(({tr:d,dispatch:c})=>{if(c&&p&&l){const b=p.filter(m=>s.includes(m.type.name));d.ensureMarks(b)}return!0}).run()})])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}}),aj=Nt.create({name:"heading",addOptions(){return{levels:[1,2,3,4,5,6],HTMLAttributes:{}}},content:"inline*",group:"block",defining:!0,addAttributes(){return{level:{default:1,rendered:!1}}},parseHTML(){return this.options.levels.map(r=>({tag:`h${r}`,attrs:{level:r}}))},renderHTML({node:r,HTMLAttributes:e}){return[`h${this.options.levels.includes(r.attrs.level)?r.attrs.level:this.options.levels[0]}`,Fe(this.options.HTMLAttributes,e),0]},parseMarkdown:(r,e)=>e.createNode("heading",{level:r.depth||1},e.parseInline(r.tokens||[])),renderMarkdown:(r,e)=>{var t;const i=(t=r.attrs)!=null&&t.level?parseInt(r.attrs.level,10):1,n="#".repeat(i);return r.content?`${n} ${e.renderChildren(r.content)}`:""},addCommands(){return{setHeading:r=>({commands:e})=>this.options.levels.includes(r.level)?e.setNode(this.name,r):!1,toggleHeading:r=>({commands:e})=>this.options.levels.includes(r.level)?e.toggleNode(this.name,"paragraph",r):!1}},addKeyboardShortcuts(){return this.options.levels.reduce((r,e)=>({...r,[`Mod-Alt-${e}`]:()=>this.editor.commands.toggleHeading({level:e})}),{})},addInputRules(){return this.options.levels.map(r=>Op({find:new RegExp(`^(#{${Math.min(...this.options.levels)},${r}})\\s$`),type:this.type,getAttributes:{level:r}}))}}),lj=Nt.create({name:"horizontalRule",addOptions(){return{HTMLAttributes:{},nextNodeType:"paragraph"}},group:"block",parseHTML(){return[{tag:"hr"}]},renderHTML({HTMLAttributes:r}){return["hr",Fe(this.options.HTMLAttributes,r)]},markdownTokenName:"hr",parseMarkdown:(r,e)=>e.createNode("horizontalRule"),renderMarkdown:()=>"---",addCommands(){return{setHorizontalRule:()=>({chain:r,state:e})=>{if(!bF(e,e.schema.nodes[this.name]))return!1;const{selection:t}=e,{$to:i}=t,n=r();return n9(t)?n.insertContentAt(i.pos,{type:this.name}):n.insertContent({type:this.name}),n.command(({state:a,tr:l,dispatch:s})=>{if(s){const{$to:p}=l.selection,d=p.end();if(p.nodeAfter)p.nodeAfter.isTextblock?l.setSelection(pe.create(l.doc,p.pos+1)):p.nodeAfter.isBlock?l.setSelection(ae.create(l.doc,p.pos)):l.setSelection(pe.create(l.doc,p.pos));else{const c=a.schema.nodes[this.options.nextNodeType]||p.parent.type.contentMatch.defaultType,b=c==null?void 0:c.create();b&&(l.insert(d,b),l.setSelection(pe.create(l.doc,d+1)))}l.scrollIntoView()}return!0}).run()}}},addInputRules(){return[_F({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type})]}}),sj=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,pj=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,dj=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,cj=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,bj=Do.create({name:"italic",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"em"},{tag:"i",getAttrs:r=>r.style.fontStyle!=="normal"&&null},{style:"font-style=normal",clearMark:r=>r.type.name===this.name},{style:"font-style=italic"}]},renderHTML({HTMLAttributes:r}){return["em",Fe(this.options.HTMLAttributes,r),0]},addCommands(){return{setItalic:()=>({commands:r})=>r.setMark(this.name),toggleItalic:()=>({commands:r})=>r.toggleMark(this.name),unsetItalic:()=>({commands:r})=>r.unsetMark(this.name)}},markdownTokenName:"em",parseMarkdown:(r,e)=>e.applyMark("italic",e.parseInline(r.tokens||[])),markdownOptions:{htmlReopen:{open:"<em>",close:"</em>"}},renderMarkdown:(r,e)=>`*${e.renderChildren(r)}*`,addKeyboardShortcuts(){return{"Mod-i":()=>this.editor.commands.toggleItalic(),"Mod-I":()=>this.editor.commands.toggleItalic()}},addInputRules(){return[bi({find:sj,type:this.type}),bi({find:dj,type:this.type})]},addPasteRules(){return[zo({find:pj,type:this.type}),zo({find:cj,type:this.type})]}});const mj="aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dad1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2odyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3nd0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rck0msd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0axi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp3ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5mögensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2oodside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2",gj="ελ1υ2бг1ел3дети4ею2католик6ом3мкд2он1сква6онлайн5рг3рус2ф2сайт3рб3укр3қаз3հայ3ישראל5קום3ابوظبي5رامكو5لاردن4بحرين5جزائر5سعودية6عليان5مغرب5مارات5یران5بارت2زار4يتك3ھارت5تونس4سودان3رية5شبكة4عراق2ب2مان4فلسطين6قطر3كاثوليك6وم3مصر2ليسيا5وريتانيا7قع4همراه5پاکستان7ڀارت4कॉम3नेट3भारत0म्3ोत5संगठन5বাংলা5ভারত2ৰত4ਭਾਰਤ4ભારત4ଭାରତ4இந்தியா6லங்கை6சிங்கப்பூர்11భారత్5ಭಾರತ4ഭാരതം5ලංකා4คอม3ไทย3ລາວ3გე2みんな3アマゾン4クラウド4グーグル4コム2ストア3セール3ファッション6ポイント4世界2中信1国1國1文网3亚马逊3企业2佛山2信息2健康2八卦2公司1益2台湾1灣2商城1店1标2嘉里0大酒店5在线2大拿2天主教3娱乐2家電2广东2微博2慈善2我爱你3手机2招聘2政务1府2新加坡2闻2时尚2書籍2机构2淡马锡3游戏2澳門2点看2移动2组织机构4网址1店1站1络2联通2谷歌2购物2通販2集团2電訊盈科4飞利浦3食品2餐厅2香格里拉3港2닷넷1컴2삼성2한국2",Jp="numeric",Yp="ascii",Qp="alpha",hn="asciinumeric",fn="alphanumeric",Xp="domain",G9="emoji",uj="scheme",xj="slashscheme",Zp="whitespace";function hj(r,e){return r in e||(e[r]=[]),e[r]}function Vo(r,e,t){e[Jp]&&(e[hn]=!0,e[fn]=!0),e[Yp]&&(e[hn]=!0,e[Qp]=!0),e[hn]&&(e[fn]=!0),e[Qp]&&(e[fn]=!0),e[fn]&&(e[Xp]=!0),e[G9]&&(e[Xp]=!0);for(const i in e){const n=hj(i,t);n.indexOf(r)<0&&n.push(r)}}function fj(r,e){const t={};for(const i in e)e[i].indexOf(r)>=0&&(t[i]=!0);return t}function Bt(r=null){this.j={},this.jr=[],this.jd=null,this.t=r}Bt.groups={},Bt.prototype={accepts(){return!!this.t},go(r){const e=this,t=e.j[r];if(t)return t;for(let i=0;i<e.jr.length;i++){const n=e.jr[i][0],a=e.jr[i][1];if(a&&n.test(r))return a}return e.jd},has(r,e=!1){return e?r in this.j:!!this.go(r)},ta(r,e,t,i){for(let n=0;n<r.length;n++)this.tt(r[n],e,t,i)},tr(r,e,t,i){i=i||Bt.groups;let n;return e&&e.j?n=e:(n=new Bt(e),t&&i&&Vo(e,t,i)),this.jr.push([r,n]),n},ts(r,e,t,i){let n=this;const a=r.length;if(!a)return n;for(let l=0;l<a-1;l++)n=n.tt(r[l]);return n.tt(r[a-1],e,t,i)},tt(r,e,t,i){i=i||Bt.groups;const n=this;if(e&&e.j)return n.j[r]=e,e;const a=e;let l,s=n.go(r);if(s?(l=new Bt,Object.assign(l.j,s.j),l.jr.push.apply(l.jr,s.jr),l.jd=s.jd,l.t=s.t):l=new Bt,a){if(i)if(l.t&&typeof l.t=="string"){const p=Object.assign(fj(l.t,i),t);Vo(a,p,i)}else t&&Vo(a,t,i);l.t=a}return n.j[r]=l,l}};const me=(r,e,t,i,n)=>r.ta(e,t,i,n),Ne=(r,e,t,i,n)=>r.tr(e,t,i,n),K9=(r,e,t,i,n)=>r.ts(e,t,i,n),U=(r,e,t,i,n)=>r.tt(e,t,i,n),kr="WORD",$p="UWORD",J9="ASCIINUMERICAL",Y9="ALPHANUMERICAL",yn="LOCALHOST",ed="TLD",td="UTLD",Ja="SCHEME",hi="SLASH_SCHEME",rd="NUM",od="WS",id="NL",wn="OPENBRACE",vn="CLOSEBRACE",Ya="OPENBRACKET",Qa="CLOSEBRACKET",Xa="OPENPAREN",Za="CLOSEPAREN",$a="OPENANGLEBRACKET",el="CLOSEANGLEBRACKET",tl="FULLWIDTHLEFTPAREN",rl="FULLWIDTHRIGHTPAREN",ol="LEFTCORNERBRACKET",il="RIGHTCORNERBRACKET",nl="LEFTWHITECORNERBRACKET",al="RIGHTWHITECORNERBRACKET",ll="FULLWIDTHLESSTHAN",sl="FULLWIDTHGREATERTHAN",pl="AMPERSAND",dl="APOSTROPHE",cl="ASTERISK",Xr="AT",bl="BACKSLASH",ml="BACKTICK",gl="CARET",Ho="COLON",nd="COMMA",ul="DOLLAR",or="DOT",xl="EQUALS",ad="EXCLAMATION",Ht="HYPHEN",kn="PERCENT",hl="PIPE",fl="PLUS",yl="POUND",Sn="QUERY",ld="QUOTE",Q9="FULLWIDTHMIDDLEDOT",sd="SEMI",ir="SLASH",Cn="TILDE",wl="UNDERSCORE",X9="EMOJI",vl="SYM";var Z9=Object.freeze({__proto__:null,ALPHANUMERICAL:Y9,AMPERSAND:pl,APOSTROPHE:dl,ASCIINUMERICAL:J9,ASTERISK:cl,AT:Xr,BACKSLASH:bl,BACKTICK:ml,CARET:gl,CLOSEANGLEBRACKET:el,CLOSEBRACE:vn,CLOSEBRACKET:Qa,CLOSEPAREN:Za,COLON:Ho,COMMA:nd,DOLLAR:ul,DOT:or,EMOJI:X9,EQUALS:xl,EXCLAMATION:ad,FULLWIDTHGREATERTHAN:sl,FULLWIDTHLEFTPAREN:tl,FULLWIDTHLESSTHAN:ll,FULLWIDTHMIDDLEDOT:Q9,FULLWIDTHRIGHTPAREN:rl,HYPHEN:Ht,LEFTCORNERBRACKET:ol,LEFTWHITECORNERBRACKET:nl,LOCALHOST:yn,NL:id,NUM:rd,OPENANGLEBRACKET:$a,OPENBRACE:wn,OPENBRACKET:Ya,OPENPAREN:Xa,PERCENT:kn,PIPE:hl,PLUS:fl,POUND:yl,QUERY:Sn,QUOTE:ld,RIGHTCORNERBRACKET:il,RIGHTWHITECORNERBRACKET:al,SCHEME:Ja,SEMI:sd,SLASH:ir,SLASH_SCHEME:hi,SYM:vl,TILDE:Cn,TLD:ed,UNDERSCORE:wl,UTLD:td,UWORD:$p,WORD:kr,WS:od});const Sr=/[a-z]/,Tn=new RegExp("\\p{L}","u"),pd=new RegExp("\\p{Emoji}","u"),Cr=/\d/,dd=/\s/,$9="\r",cd=`
143
+ `,parseMarkdown:()=>({type:"hardBreak"}),addCommands(){return{setHardBreak:()=>({commands:r,chain:e,state:t,editor:i})=>r.first([()=>r.exitCode(),()=>r.command(()=>{const{selection:n,storedMarks:a}=t;if(n.$from.parent.type.spec.isolating)return!1;const{keepMarks:l}=this.options,{splittableMarks:s}=i.extensionManager,p=a||n.$to.parentOffset&&n.$from.marks();return e().insertContent({type:this.name}).command(({tr:d,dispatch:c})=>{if(c&&p&&l){const b=p.filter(m=>s.includes(m.type.name));d.ensureMarks(b)}return!0}).run()})])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}}),aj=Nt.create({name:"heading",addOptions(){return{levels:[1,2,3,4,5,6],HTMLAttributes:{}}},content:"inline*",group:"block",defining:!0,addAttributes(){return{level:{default:1,rendered:!1}}},parseHTML(){return this.options.levels.map(r=>({tag:`h${r}`,attrs:{level:r}}))},renderHTML({node:r,HTMLAttributes:e}){return[`h${this.options.levels.includes(r.attrs.level)?r.attrs.level:this.options.levels[0]}`,je(this.options.HTMLAttributes,e),0]},parseMarkdown:(r,e)=>e.createNode("heading",{level:r.depth||1},e.parseInline(r.tokens||[])),renderMarkdown:(r,e)=>{var t;const i=(t=r.attrs)!=null&&t.level?parseInt(r.attrs.level,10):1,n="#".repeat(i);return r.content?`${n} ${e.renderChildren(r.content)}`:""},addCommands(){return{setHeading:r=>({commands:e})=>this.options.levels.includes(r.level)?e.setNode(this.name,r):!1,toggleHeading:r=>({commands:e})=>this.options.levels.includes(r.level)?e.toggleNode(this.name,"paragraph",r):!1}},addKeyboardShortcuts(){return this.options.levels.reduce((r,e)=>({...r,[`Mod-Alt-${e}`]:()=>this.editor.commands.toggleHeading({level:e})}),{})},addInputRules(){return this.options.levels.map(r=>Op({find:new RegExp(`^(#{${Math.min(...this.options.levels)},${r}})\\s$`),type:this.type,getAttributes:{level:r}}))}}),lj=Nt.create({name:"horizontalRule",addOptions(){return{HTMLAttributes:{},nextNodeType:"paragraph"}},group:"block",parseHTML(){return[{tag:"hr"}]},renderHTML({HTMLAttributes:r}){return["hr",je(this.options.HTMLAttributes,r)]},markdownTokenName:"hr",parseMarkdown:(r,e)=>e.createNode("horizontalRule"),renderMarkdown:()=>"---",addCommands(){return{setHorizontalRule:()=>({chain:r,state:e})=>{if(!bF(e,e.schema.nodes[this.name]))return!1;const{selection:t}=e,{$to:i}=t,n=r();return n9(t)?n.insertContentAt(i.pos,{type:this.name}):n.insertContent({type:this.name}),n.command(({state:a,tr:l,dispatch:s})=>{if(s){const{$to:p}=l.selection,d=p.end();if(p.nodeAfter)p.nodeAfter.isTextblock?l.setSelection(pe.create(l.doc,p.pos+1)):p.nodeAfter.isBlock?l.setSelection(ae.create(l.doc,p.pos)):l.setSelection(pe.create(l.doc,p.pos));else{const c=a.schema.nodes[this.options.nextNodeType]||p.parent.type.contentMatch.defaultType,b=c==null?void 0:c.create();b&&(l.insert(d,b),l.setSelection(pe.create(l.doc,d+1)))}l.scrollIntoView()}return!0}).run()}}},addInputRules(){return[_F({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type})]}}),sj=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,pj=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,dj=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,cj=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,bj=Do.create({name:"italic",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"em"},{tag:"i",getAttrs:r=>r.style.fontStyle!=="normal"&&null},{style:"font-style=normal",clearMark:r=>r.type.name===this.name},{style:"font-style=italic"}]},renderHTML({HTMLAttributes:r}){return["em",je(this.options.HTMLAttributes,r),0]},addCommands(){return{setItalic:()=>({commands:r})=>r.setMark(this.name),toggleItalic:()=>({commands:r})=>r.toggleMark(this.name),unsetItalic:()=>({commands:r})=>r.unsetMark(this.name)}},markdownTokenName:"em",parseMarkdown:(r,e)=>e.applyMark("italic",e.parseInline(r.tokens||[])),markdownOptions:{htmlReopen:{open:"<em>",close:"</em>"}},renderMarkdown:(r,e)=>`*${e.renderChildren(r)}*`,addKeyboardShortcuts(){return{"Mod-i":()=>this.editor.commands.toggleItalic(),"Mod-I":()=>this.editor.commands.toggleItalic()}},addInputRules(){return[bi({find:sj,type:this.type}),bi({find:dj,type:this.type})]},addPasteRules(){return[zo({find:pj,type:this.type}),zo({find:cj,type:this.type})]}});const mj="aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dad1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2odyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3nd0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rck0msd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0axi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp3ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5mögensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2oodside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2",gj="ελ1υ2бг1ел3дети4ею2католик6ом3мкд2он1сква6онлайн5рг3рус2ф2сайт3рб3укр3қаз3հայ3ישראל5קום3ابوظبي5رامكو5لاردن4بحرين5جزائر5سعودية6عليان5مغرب5مارات5یران5بارت2زار4يتك3ھارت5تونس4سودان3رية5شبكة4عراق2ب2مان4فلسطين6قطر3كاثوليك6وم3مصر2ليسيا5وريتانيا7قع4همراه5پاکستان7ڀارت4कॉम3नेट3भारत0म्3ोत5संगठन5বাংলা5ভারত2ৰত4ਭਾਰਤ4ભારત4ଭାରତ4இந்தியா6லங்கை6சிங்கப்பூர்11భారత్5ಭಾರತ4ഭാരതം5ලංකා4คอม3ไทย3ລາວ3გე2みんな3アマゾン4クラウド4グーグル4コム2ストア3セール3ファッション6ポイント4世界2中信1国1國1文网3亚马逊3企业2佛山2信息2健康2八卦2公司1益2台湾1灣2商城1店1标2嘉里0大酒店5在线2大拿2天主教3娱乐2家電2广东2微博2慈善2我爱你3手机2招聘2政务1府2新加坡2闻2时尚2書籍2机构2淡马锡3游戏2澳門2点看2移动2组织机构4网址1店1站1络2联通2谷歌2购物2通販2集团2電訊盈科4飞利浦3食品2餐厅2香格里拉3港2닷넷1컴2삼성2한국2",Jp="numeric",Yp="ascii",Qp="alpha",hn="asciinumeric",fn="alphanumeric",Xp="domain",G9="emoji",uj="scheme",xj="slashscheme",Zp="whitespace";function hj(r,e){return r in e||(e[r]=[]),e[r]}function Vo(r,e,t){e[Jp]&&(e[hn]=!0,e[fn]=!0),e[Yp]&&(e[hn]=!0,e[Qp]=!0),e[hn]&&(e[fn]=!0),e[Qp]&&(e[fn]=!0),e[fn]&&(e[Xp]=!0),e[G9]&&(e[Xp]=!0);for(const i in e){const n=hj(i,t);n.indexOf(r)<0&&n.push(r)}}function fj(r,e){const t={};for(const i in e)e[i].indexOf(r)>=0&&(t[i]=!0);return t}function Bt(r=null){this.j={},this.jr=[],this.jd=null,this.t=r}Bt.groups={},Bt.prototype={accepts(){return!!this.t},go(r){const e=this,t=e.j[r];if(t)return t;for(let i=0;i<e.jr.length;i++){const n=e.jr[i][0],a=e.jr[i][1];if(a&&n.test(r))return a}return e.jd},has(r,e=!1){return e?r in this.j:!!this.go(r)},ta(r,e,t,i){for(let n=0;n<r.length;n++)this.tt(r[n],e,t,i)},tr(r,e,t,i){i=i||Bt.groups;let n;return e&&e.j?n=e:(n=new Bt(e),t&&i&&Vo(e,t,i)),this.jr.push([r,n]),n},ts(r,e,t,i){let n=this;const a=r.length;if(!a)return n;for(let l=0;l<a-1;l++)n=n.tt(r[l]);return n.tt(r[a-1],e,t,i)},tt(r,e,t,i){i=i||Bt.groups;const n=this;if(e&&e.j)return n.j[r]=e,e;const a=e;let l,s=n.go(r);if(s?(l=new Bt,Object.assign(l.j,s.j),l.jr.push.apply(l.jr,s.jr),l.jd=s.jd,l.t=s.t):l=new Bt,a){if(i)if(l.t&&typeof l.t=="string"){const p=Object.assign(fj(l.t,i),t);Vo(a,p,i)}else t&&Vo(a,t,i);l.t=a}return n.j[r]=l,l}};const me=(r,e,t,i,n)=>r.ta(e,t,i,n),Ne=(r,e,t,i,n)=>r.tr(e,t,i,n),K9=(r,e,t,i,n)=>r.ts(e,t,i,n),U=(r,e,t,i,n)=>r.tt(e,t,i,n),kr="WORD",$p="UWORD",J9="ASCIINUMERICAL",Y9="ALPHANUMERICAL",yn="LOCALHOST",ed="TLD",td="UTLD",Ja="SCHEME",hi="SLASH_SCHEME",rd="NUM",od="WS",id="NL",wn="OPENBRACE",vn="CLOSEBRACE",Ya="OPENBRACKET",Qa="CLOSEBRACKET",Xa="OPENPAREN",Za="CLOSEPAREN",$a="OPENANGLEBRACKET",el="CLOSEANGLEBRACKET",tl="FULLWIDTHLEFTPAREN",rl="FULLWIDTHRIGHTPAREN",ol="LEFTCORNERBRACKET",il="RIGHTCORNERBRACKET",nl="LEFTWHITECORNERBRACKET",al="RIGHTWHITECORNERBRACKET",ll="FULLWIDTHLESSTHAN",sl="FULLWIDTHGREATERTHAN",pl="AMPERSAND",dl="APOSTROPHE",cl="ASTERISK",Xr="AT",bl="BACKSLASH",ml="BACKTICK",gl="CARET",Ho="COLON",nd="COMMA",ul="DOLLAR",or="DOT",xl="EQUALS",ad="EXCLAMATION",Ht="HYPHEN",kn="PERCENT",hl="PIPE",fl="PLUS",yl="POUND",Sn="QUERY",ld="QUOTE",Q9="FULLWIDTHMIDDLEDOT",sd="SEMI",ir="SLASH",Cn="TILDE",wl="UNDERSCORE",X9="EMOJI",vl="SYM";var Z9=Object.freeze({__proto__:null,ALPHANUMERICAL:Y9,AMPERSAND:pl,APOSTROPHE:dl,ASCIINUMERICAL:J9,ASTERISK:cl,AT:Xr,BACKSLASH:bl,BACKTICK:ml,CARET:gl,CLOSEANGLEBRACKET:el,CLOSEBRACE:vn,CLOSEBRACKET:Qa,CLOSEPAREN:Za,COLON:Ho,COMMA:nd,DOLLAR:ul,DOT:or,EMOJI:X9,EQUALS:xl,EXCLAMATION:ad,FULLWIDTHGREATERTHAN:sl,FULLWIDTHLEFTPAREN:tl,FULLWIDTHLESSTHAN:ll,FULLWIDTHMIDDLEDOT:Q9,FULLWIDTHRIGHTPAREN:rl,HYPHEN:Ht,LEFTCORNERBRACKET:ol,LEFTWHITECORNERBRACKET:nl,LOCALHOST:yn,NL:id,NUM:rd,OPENANGLEBRACKET:$a,OPENBRACE:wn,OPENBRACKET:Ya,OPENPAREN:Xa,PERCENT:kn,PIPE:hl,PLUS:fl,POUND:yl,QUERY:Sn,QUOTE:ld,RIGHTCORNERBRACKET:il,RIGHTWHITECORNERBRACKET:al,SCHEME:Ja,SEMI:sd,SLASH:ir,SLASH_SCHEME:hi,SYM:vl,TILDE:Cn,TLD:ed,UNDERSCORE:wl,UTLD:td,UWORD:$p,WORD:kr,WS:od});const Sr=/[a-z]/,Tn=new RegExp("\\p{L}","u"),pd=new RegExp("\\p{Emoji}","u"),Cr=/\d/,dd=/\s/,$9="\r",cd=`
144
144
  `,yj="️",wj="‍",bd="";let kl=null,Sl=null;function vj(r=[]){const e={};Bt.groups=e;const t=new Bt;kl==null&&(kl=t_(mj)),Sl==null&&(Sl=t_(gj)),U(t,"'",dl),U(t,"{",wn),U(t,"}",vn),U(t,"[",Ya),U(t,"]",Qa),U(t,"(",Xa),U(t,")",Za),U(t,"<",$a),U(t,">",el),U(t,"(",tl),U(t,")",rl),U(t,"「",ol),U(t,"」",il),U(t,"『",nl),U(t,"』",al),U(t,"<",ll),U(t,">",sl),U(t,"&",pl),U(t,"*",cl),U(t,"@",Xr),U(t,"`",ml),U(t,"^",gl),U(t,":",Ho),U(t,",",nd),U(t,"$",ul),U(t,".",or),U(t,"=",xl),U(t,"!",ad),U(t,"-",Ht),U(t,"%",kn),U(t,"|",hl),U(t,"+",fl),U(t,"#",yl),U(t,"?",Sn),U(t,'"',ld),U(t,"/",ir),U(t,";",sd),U(t,"~",Cn),U(t,"_",wl),U(t,"\\",bl),U(t,"・",Q9);const i=Ne(t,Cr,rd,{[Jp]:!0});Ne(i,Cr,i);const n=Ne(i,Sr,J9,{[hn]:!0}),a=Ne(i,Tn,Y9,{[fn]:!0}),l=Ne(t,Sr,kr,{[Yp]:!0});Ne(l,Cr,n),Ne(l,Sr,l),Ne(n,Cr,n),Ne(n,Sr,n);const s=Ne(t,Tn,$p,{[Qp]:!0});Ne(s,Sr),Ne(s,Cr,a),Ne(s,Tn,s),Ne(a,Cr,a),Ne(a,Sr),Ne(a,Tn,a);const p=U(t,cd,id,{[Zp]:!0}),d=U(t,$9,od,{[Zp]:!0}),c=Ne(t,dd,od,{[Zp]:!0});U(t,bd,c),U(d,cd,p),U(d,bd,c),Ne(d,dd,c),U(c,$9),U(c,cd),Ne(c,dd,c),U(c,bd,c);const b=Ne(t,pd,X9,{[G9]:!0});U(b,"#"),Ne(b,pd,b),U(b,yj,b);const m=U(b,wj);U(m,"#"),Ne(m,pd,b);const g=[[Sr,l],[Cr,n]],x=[[Sr,null],[Tn,s],[Cr,a]];for(let u=0;u<kl.length;u++)Zr(t,kl[u],ed,kr,g);for(let u=0;u<Sl.length;u++)Zr(t,Sl[u],td,$p,x);Vo(ed,{tld:!0,ascii:!0},e),Vo(td,{utld:!0,alpha:!0},e),Zr(t,"file",Ja,kr,g),Zr(t,"mailto",Ja,kr,g),Zr(t,"http",hi,kr,g),Zr(t,"https",hi,kr,g),Zr(t,"ftp",hi,kr,g),Zr(t,"ftps",hi,kr,g),Vo(Ja,{scheme:!0,ascii:!0},e),Vo(hi,{slashscheme:!0,ascii:!0},e),r=r.sort((u,h)=>u[0]>h[0]?1:-1);for(let u=0;u<r.length;u++){const h=r[u][0],w=r[u][1]?{[uj]:!0}:{[xj]:!0};h.indexOf("-")>=0?w[Xp]=!0:Sr.test(h)?Cr.test(h)?w[hn]=!0:w[Yp]=!0:w[Jp]=!0,K9(t,h,h,w)}return K9(t,"localhost",yn,{ascii:!0}),t.jd=new Bt(vl),{start:t,tokens:Object.assign({groups:e},Z9)}}function e_(r,e){const t=kj(e.replace(/[A-Z]/g,s=>s.toLowerCase())),i=t.length,n=[];let a=0,l=0;for(;l<i;){let s=r,p=null,d=0,c=null,b=-1,m=-1;for(;l<i&&(p=s.go(t[l]));)s=p,s.accepts()?(b=0,m=0,c=s):b>=0&&(b+=t[l].length,m++),d+=t[l].length,a+=t[l].length,l++;a-=b,l-=m,d-=b,n.push({t:c.t,v:e.slice(a-d,a),s:a-d,e:a})}return n}function kj(r){const e=[],t=r.length;let i=0;for(;i<t;){let n=r.charCodeAt(i),a,l=n<55296||n>56319||i+1===t||(a=r.charCodeAt(i+1))<56320||a>57343?r[i]:r.slice(i,i+2);e.push(l),i+=l.length}return e}function Zr(r,e,t,i,n){let a;const l=e.length;for(let s=0;s<l-1;s++){const p=e[s];r.j[p]?a=r.j[p]:(a=new Bt(i),a.jr=n.slice(),r.j[p]=a),r=a}return a=new Bt(t),a.jr=n.slice(),r.j[e[l-1]]=a,a}function t_(r){const e=[],t=[];let i=0,n="0123456789";for(;i<r.length;){let a=0;for(;n.indexOf(r[i+a])>=0;)a++;if(a>0){e.push(t.join(""));for(let l=parseInt(r.substring(i,i+a),10);l>0;l--)t.pop();i+=a}else t.push(r[i]),i++}return e}const En={defaultProtocol:"http",events:null,format:r_,formatHref:r_,nl2br:!1,tagName:"a",target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function md(r,e=null){let t=Object.assign({},En);r&&(t=Object.assign(t,r instanceof md?r.o:r));const i=t.ignoreTags,n=[];for(let a=0;a<i.length;a++)n.push(i[a].toUpperCase());this.o=t,e&&(this.defaultRender=e),this.ignoreTags=n}md.prototype={o:En,ignoreTags:[],defaultRender(r){return r},check(r){return this.get("validate",r.toString(),r)},get(r,e,t){const i=e!=null;let n=this.o[r];return n&&(typeof n=="object"?(n=t.t in n?n[t.t]:En[r],typeof n=="function"&&i&&(n=n(e,t))):typeof n=="function"&&i&&(n=n(e,t.t,t)),n)},getObj(r,e,t){let i=this.o[r];return typeof i=="function"&&e!=null&&(i=i(e,t.t,t)),i},render(r){const e=r.render(this);return(this.get("render",null,r)||this.defaultRender)(e,r.t,r)}};function r_(r){return r}function o_(r,e){this.t="token",this.v=r,this.tk=e}o_.prototype={isLink:!1,toString(){return this.v},toHref(r){return this.toString()},toFormattedString(r){const e=this.toString(),t=r.get("truncate",e,this),i=r.get("format",e,this);return t&&i.length>t?i.substring(0,t)+"…":i},toFormattedHref(r){return r.get("formatHref",this.toHref(r.get("defaultProtocol")),this)},startIndex(){return this.tk[0].s},endIndex(){return this.tk[this.tk.length-1].e},toObject(r=En.defaultProtocol){return{type:this.t,value:this.toString(),isLink:this.isLink,href:this.toHref(r),start:this.startIndex(),end:this.endIndex()}},toFormattedObject(r){return{type:this.t,value:this.toFormattedString(r),isLink:this.isLink,href:this.toFormattedHref(r),start:this.startIndex(),end:this.endIndex()}},validate(r){return r.get("validate",this.toString(),this)},render(r){const e=this,t=this.toHref(r.get("defaultProtocol")),i=r.get("formatHref",t,this),n=r.get("tagName",t,e),a=this.toFormattedString(r),l={},s=r.get("className",t,e),p=r.get("target",t,e),d=r.get("rel",t,e),c=r.getObj("attributes",t,e),b=r.getObj("events",t,e);return l.href=i,s&&(l.class=s),p&&(l.target=p),d&&(l.rel=d),c&&Object.assign(l,c),{tagName:n,attributes:l,content:a,eventListeners:b}}};function Cl(r,e){class t extends o_{constructor(n,a){super(n,a),this.t=r}}for(const i in e)t.prototype[i]=e[i];return t.t=r,t}const Sj=Cl("email",{isLink:!0,toHref(){return"mailto:"+this.toString()}}),i_=Cl("text"),Cj=Cl("nl"),Tl=Cl("url",{isLink:!0,toHref(r=En.defaultProtocol){return this.hasProtocol()?this.v:`${r}://${this.v}`},hasProtocol(){const r=this.tk;return r.length>=2&&r[0].t!==yn&&r[1].t===Ho}}),Rt=r=>new Bt(r);function Tj({groups:r}){const e=r.domain.concat([pl,cl,Xr,bl,ml,gl,ul,xl,Ht,rd,kn,hl,fl,yl,ir,vl,Cn,wl]),t=[dl,Ho,nd,or,ad,kn,Sn,ld,sd,$a,el,wn,vn,Qa,Ya,Xa,Za,tl,rl,ol,il,nl,al,ll,sl],i=[pl,dl,cl,bl,ml,gl,ul,xl,Ht,wn,vn,kn,hl,fl,yl,Sn,ir,vl,Cn,wl],n=Rt(),a=U(n,Cn);me(a,i,a),me(a,r.domain,a);const l=Rt(),s=Rt(),p=Rt();me(n,r.domain,l),me(n,r.scheme,s),me(n,r.slashscheme,p),me(l,i,a),me(l,r.domain,l);const d=U(l,Xr);U(a,Xr,d),U(s,Xr,d),U(p,Xr,d);const c=U(a,or);me(c,i,a),me(c,r.domain,a);const b=Rt();me(d,r.domain,b),me(b,r.domain,b);const m=U(b,or);me(m,r.domain,b);const g=Rt(Sj);me(m,r.tld,g),me(m,r.utld,g),U(d,yn,g);const x=U(b,Ht);U(x,Ht,x),me(x,r.domain,b),me(g,r.domain,b),U(g,or,m),U(g,Ht,x);const u=U(l,Ht),h=U(l,or);U(u,Ht,u),me(u,r.domain,l),me(h,i,a),me(h,r.domain,l);const f=Rt(Tl);me(h,r.tld,f),me(h,r.utld,f),me(f,r.domain,l),me(f,i,a),U(f,or,h),U(f,Ht,u),U(f,Xr,d);const w=U(f,Ho),y=Rt(Tl);me(w,r.numeric,y);const E=Rt(Tl),S=Rt();me(E,e,E),me(E,t,S),me(S,e,E),me(S,t,S),U(f,ir,E),U(y,ir,E);const P=U(s,Ho),v=U(p,Ho),M=U(v,ir),C=U(M,ir);me(s,r.domain,l),U(s,or,h),U(s,Ht,u),me(p,r.domain,l),U(p,or,h),U(p,Ht,u),me(P,r.domain,E),U(P,ir,E),U(P,Sn,E),me(C,r.domain,E),me(C,e,E),U(C,ir,E);const k=[[wn,vn],[Ya,Qa],[Xa,Za],[$a,el],[tl,rl],[ol,il],[nl,al],[ll,sl]];for(let T=0;T<k.length;T++){const[V,N]=k[T],A=U(E,V);U(S,V,A);const I=Rt(Tl);me(A,e,I);const D=Rt();me(A,t,D),U(A,N,E),me(I,e,I),me(I,t,D),me(D,e,I),me(D,t,D),U(I,N,E),U(D,N,E)}return U(n,yn,f),U(n,id,Cj),{start:n,tokens:Z9}}function Ej(r,e,t){let i=t.length,n=0,a=[],l=[];for(;n<i;){let s=r,p=null,d=null,c=0,b=null,m=-1;for(;n<i&&!(p=s.go(t[n].t));)l.push(t[n++]);for(;n<i&&(d=p||s.go(t[n].t));)p=null,s=d,s.accepts()?(m=0,b=s):m>=0&&m++,n++,c++;if(m<0)n-=c,n<i&&(l.push(t[n]),n++);else{l.length>0&&(a.push(gd(i_,e,l)),l=[]),n-=m,c-=m;const g=b.t,x=t.slice(n-c,n);a.push(gd(g,e,x))}}return l.length>0&&a.push(gd(i_,e,l)),a}function gd(r,e,t){const i=t[0].s,n=t[t.length-1].e,a=e.slice(i,n);return new r(a,t)}const Mj=typeof console<"u"&&console&&console.warn||(()=>{}),Pj="until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.",Ee={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1};function Bj(){return Bt.groups={},Ee.scanner=null,Ee.parser=null,Ee.tokenQueue=[],Ee.pluginQueue=[],Ee.customSchemes=[],Ee.initialized=!1,Ee}function n_(r,e=!1){if(Ee.initialized&&Mj(`linkifyjs: already initialized - will not register custom scheme "${r}" ${Pj}`),!/^[0-9a-z]+(-[0-9a-z]+)*$/.test(r))throw new Error(`linkifyjs: incorrect scheme format.
145
145
  1. Must only contain digits, lowercase ASCII letters or "-"
146
146
  2. Cannot start or end with "-"
147
- 3. "-" cannot repeat`);Ee.customSchemes.push([r,e])}function Lj(){Ee.scanner=vj(Ee.customSchemes);for(let r=0;r<Ee.tokenQueue.length;r++)Ee.tokenQueue[r][1]({scanner:Ee.scanner});Ee.parser=Tj(Ee.scanner.tokens);for(let r=0;r<Ee.pluginQueue.length;r++)Ee.pluginQueue[r][1]({scanner:Ee.scanner,parser:Ee.parser});return Ee.initialized=!0,Ee}function ud(r){return Ee.initialized||Lj(),Ej(Ee.parser.start,r,e_(Ee.scanner.start,r))}ud.scan=e_;function a_(r,e=null,t=null){if(e&&typeof e=="object"){if(t)throw Error(`linkifyjs: Invalid link type ${e}; must be a string`);t=e,e=null}const i=new md(t),n=ud(r),a=[];for(let l=0;l<n.length;l++){const s=n[l];s.isLink&&(!e||s.t===e)&&i.check(s)&&a.push(s.toFormattedObject(i))}return a}var xd="[\0-   ᠎ -\u2029  ]",Nj=new RegExp(xd),Aj=new RegExp(`${xd}$`),_j=new RegExp(xd,"g");function Dj(r){return r.length===1?r[0].isLink:r.length===3&&r[1].isLink?["()","[]"].includes(r[0].value+r[2].value):!1}function zj(r){return new Me({key:new Oe("autolink"),appendTransaction:(e,t,i)=>{const n=e.some(d=>d.docChanged)&&!t.doc.eq(i.doc),a=e.some(d=>d.getMeta("preventAutolink"));if(!n||a)return;const{tr:l}=i,s=GA(t.doc,[...e]);if(o9(s).forEach(({newRange:d})=>{const c=TO(i.doc,d,g=>g.isTextblock);let b,m;if(c.length>1)b=c[0],m=i.doc.textBetween(b.pos,b.pos+b.node.nodeSize,void 0," ");else if(c.length){const g=i.doc.textBetween(d.from,d.to," "," ");if(!Aj.test(g))return;b=c[0],m=i.doc.textBetween(b.pos,d.to,void 0," ")}if(b&&m){const g=m.split(Nj).filter(Boolean);if(g.length<=0)return!1;const x=g[g.length-1],u=b.pos+m.lastIndexOf(x);if(!x)return!1;const h=ud(x).map(f=>f.toObject(r.defaultProtocol));if(!Dj(h))return!1;h.filter(f=>f.isLink).map(f=>({...f,from:u+f.start+1,to:u+f.end+1})).filter(f=>i.schema.marks.code?!i.doc.rangeHasMark(f.from,f.to,i.schema.marks.code):!0).filter(f=>r.validate(f.value)).filter(f=>r.shouldAutoLink(f.value)).forEach(f=>{Lp(f.from,f.to,i.doc).some(w=>w.mark.type===r.type)||l.addMark(f.from,f.to,r.type.create({href:f.href}))})}}),!!l.steps.length)return l}})}function Ij(r){return new Me({key:new Oe("handleClickLink"),props:{handleClick:(e,t,i)=>{var n,a;if(i.button!==0||!e.editable)return!1;let l=null;if(i.target instanceof HTMLAnchorElement)l=i.target;else{const p=i.target;if(!p)return!1;const d=r.editor.view.dom;l=p.closest("a"),l&&!d.contains(l)&&(l=null)}if(!l)return!1;let s=!1;if(r.enableClickSelection&&(s=r.editor.commands.extendMarkRange(r.type.name)),r.openOnClick){const p=r9(e.state,r.type.name),d=(n=l.href)!=null?n:p.href,c=(a=l.target)!=null?a:p.target;d&&(window.open(d,c),s=!0)}return s}}})}function Vj(r){return new Me({key:new Oe("handlePasteLink"),props:{handlePaste:(e,t,i)=>{const{shouldAutoLink:n}=r,{state:a}=e,{selection:l}=a,{empty:s}=l;if(s)return!1;let p="";i.content.forEach(c=>{p+=c.textContent});const d=a_(p,{defaultProtocol:r.defaultProtocol}).find(c=>c.isLink&&c.value===p);return!p||!d||n!==void 0&&!n(d.value)?!1:r.editor.commands.setMark(r.type,{href:d.href})}}})}function Ro(r,e){const t=["http","https","ftp","ftps","mailto","tel","callto","sms","cid","xmpp"];return e&&e.forEach(i=>{const n=typeof i=="string"?i:i.scheme;n&&t.push(n)}),!r||r.replace(_j,"").match(new RegExp(`^(?:(?:${t.map(i=>i.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&")).join("|")}):|[^a-z]|[a-z0-9+.\\-]+(?:[^a-z+.\\-:]|$))`,"i"))}var Hj=Do.create({name:"link",priority:1e3,keepOnSplit:!1,exitable:!0,onCreate(){this.options.validate&&!this.options.shouldAutoLink&&(this.options.shouldAutoLink=this.options.validate,console.warn("The `validate` option is deprecated. Rename to the `shouldAutoLink` option instead.")),this.options.protocols.forEach(r=>{if(typeof r=="string"){n_(r);return}n_(r.scheme,r.optionalSlashes)})},onDestroy(){Bj()},inclusive(){return this.options.autolink},addOptions(){return{openOnClick:!0,enableClickSelection:!1,linkOnPaste:!0,autolink:!0,protocols:[],defaultProtocol:"http",HTMLAttributes:{target:"_blank",rel:"noopener noreferrer nofollow",class:null},isAllowedUri:(r,e)=>!!Ro(r,e.protocols),validate:r=>!!r,shouldAutoLink:r=>{const e=/^[a-z][a-z0-9+.-]*:\/\//i.test(r),t=/^[a-z][a-z0-9+.-]*:/i.test(r);if(e||t&&!r.includes("@"))return!0;const n=(r.includes("@")?r.split("@").pop():r).split(/[/?#:]/)[0];return!(/^\d{1,3}(\.\d{1,3}){3}$/.test(n)||!/\./.test(n))}}},addAttributes(){return{href:{default:null,parseHTML(r){return r.getAttribute("href")}},target:{default:this.options.HTMLAttributes.target},rel:{default:this.options.HTMLAttributes.rel},class:{default:this.options.HTMLAttributes.class},title:{default:null}}},parseHTML(){return[{tag:"a[href]",getAttrs:r=>{const e=r.getAttribute("href");return!e||!this.options.isAllowedUri(e,{defaultValidate:t=>!!Ro(t,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:null}}]},renderHTML({HTMLAttributes:r}){return this.options.isAllowedUri(r.href,{defaultValidate:e=>!!Ro(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?["a",Fe(this.options.HTMLAttributes,r),0]:["a",Fe(this.options.HTMLAttributes,{...r,href:""}),0]},markdownTokenName:"link",parseMarkdown:(r,e)=>e.applyMark("link",e.parseInline(r.tokens||[]),{href:r.href,title:r.title||null}),renderMarkdown:(r,e)=>{var t,i,n,a;const l=(i=(t=r.attrs)==null?void 0:t.href)!=null?i:"",s=(a=(n=r.attrs)==null?void 0:n.title)!=null?a:"",p=e.renderChildren(r);return s?`[${p}](${l} "${s}")`:`[${p}](${l})`},addCommands(){return{setLink:r=>({chain:e})=>{const{href:t}=r;return this.options.isAllowedUri(t,{defaultValidate:i=>!!Ro(i,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?e().setMark(this.name,r).setMeta("preventAutolink",!0).run():!1},toggleLink:r=>({chain:e})=>{const{href:t}=r||{};return t&&!this.options.isAllowedUri(t,{defaultValidate:i=>!!Ro(i,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:e().toggleMark(this.name,r,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()},unsetLink:()=>({chain:r})=>r().unsetMark(this.name,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()}},addPasteRules(){return[zo({find:r=>{const e=[];if(r){const{protocols:t,defaultProtocol:i}=this.options,n=a_(r).filter(a=>a.isLink&&this.options.isAllowedUri(a.value,{defaultValidate:l=>!!Ro(l,t),protocols:t,defaultProtocol:i}));n.length&&n.forEach(a=>{this.options.shouldAutoLink(a.value)&&e.push({text:a.value,data:{href:a.href},index:a.start})})}return e},type:this.type,getAttributes:r=>{var e;return{href:(e=r.data)==null?void 0:e.href}}})]},addProseMirrorPlugins(){const r=[],{protocols:e,defaultProtocol:t}=this.options;return this.options.autolink&&r.push(zj({type:this.type,defaultProtocol:this.options.defaultProtocol,validate:i=>this.options.isAllowedUri(i,{defaultValidate:n=>!!Ro(n,e),protocols:e,defaultProtocol:t}),shouldAutoLink:this.options.shouldAutoLink})),r.push(Ij({type:this.type,editor:this.editor,openOnClick:this.options.openOnClick==="whenNotEditable"?!0:this.options.openOnClick,enableClickSelection:this.options.enableClickSelection})),this.options.linkOnPaste&&r.push(Vj({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type,shouldAutoLink:this.options.shouldAutoLink})),r}}),Rj=Object.defineProperty,Oj=(r,e)=>{for(var t in e)Rj(r,t,{get:e[t],enumerable:!0})},Fj="listItem",l_="textStyle",s_=/^\s*([-+*])\s$/,p_=Nt.create({name:"bulletList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:"ul"}]},renderHTML({HTMLAttributes:r}){return["ul",Fe(this.options.HTMLAttributes,r),0]},markdownTokenName:"list",parseMarkdown:(r,e)=>r.type!=="list"||r.ordered?[]:{type:"bulletList",content:r.items?e.parseChildren(r.items):[]},renderMarkdown:(r,e)=>r.content?e.renderChildren(r.content,`
148
- `):"",markdownOptions:{indentsContent:!0},addCommands(){return{toggleBulletList:()=>({commands:r,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(Fj,this.editor.getAttributes(l_)).run():r.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let r=mi({find:s_,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(r=mi({find:s_,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(l_),editor:this.editor})),[r]}}),jj=(r,e,t)=>{const{selection:i}=r;if(!i.empty)return null;const{$from:n}=i;if(!n.parent.isTextblock||n.parentOffset!==n.parent.content.size)return null;let a=-1;for(let g=n.depth;g>0;g-=1)if(n.node(g).type.name===e){a=g;break}if(a<0)return null;const l=n.node(a),s=n.index(a);if(s+1>=l.childCount)return null;const p=l.child(s+1);if(!t.includes(p.type.name))return null;const d=r.schema.nodes[e];let c=!1;if(p.forEach(g=>{g.type===d&&g.childCount>1&&(c=!0)}),!c)return null;const b=r.doc.resolve(n.after()).nodeAfter;if(!b||!t.includes(b.type.name))return null;const m=[];return b.forEach(g=>{m.push(g)}),m.length===0?null:{listItemDepth:a,nestedList:b,nestedListPos:n.after(),insertPos:n.after(a),items:m}},qj=(r,e,t,i)=>{const n=jj(r,t,i);if(!n)return!1;const{selection:a}=r,{nestedList:l,nestedListPos:s,insertPos:p,items:d}=n,c=r.tr;c.delete(s,s+l.nodeSize);const b=c.mapping.map(p);return c.insert(b,G.from(d)),c.setSelection(a.map(c.doc,c.mapping)),e&&e(c),!0},Uj=(r,e,t)=>qj(r.state,r.view.dispatch,e,t),d_=(r,e)=>Be.create({name:`${r}BranchingDeleteKeymap`,priority:101,addKeyboardShortcuts(){const t=()=>Uj(this.editor,r,e);return{Delete:t,"Mod-Delete":t}}}),c_=[[1e3,"m"],[900,"cm"],[500,"d"],[400,"cd"],[100,"c"],[90,"xc"],[50,"l"],[40,"xl"],[10,"x"],[9,"ix"],[5,"v"],[4,"iv"],[1,"i"]],El="abcdefghijklmnopqrstuvwxyz",Wj="[a-zA-Z]{1,2}",hd=String.raw`\d+|[ivxlcdmIVXLCDM]+|${Wj}`;function Ml(r){let e=r,t="";for(const[i,n]of c_)for(;e>=i;)t+=n,e-=i;return t}function fd(r){return Ml(r).toUpperCase()}function b_(r){const e=r.toLowerCase();let t=0,i=0;for(;t<e.length;){let n=!1;for(const[a,l]of c_)if(e.startsWith(l,t)){i+=a,t+=l.length,n=!0;break}if(!n)return 0}return i}function Gj(r){if(!/^[ivxlcdmIVXLCDM]+$/.test(r))return!1;const e=b_(r);return e<=0?!1:(r===r.toLowerCase()?Ml(e):fd(e))===r}function Kj(r){const e=r.toLowerCase();if(e.length===1)return e.charCodeAt(0)-97+1;if(e.length===2){const t=e.charCodeAt(0)-97,i=e.charCodeAt(1)-97;return(t+1)*26+i+1}return 0}function Pl(r){if(r<=26)return El[r-1];const e=Math.floor((r-1)/26)-1,t=(r-1)%26;return e<0?El[t]:El[e]+El[t]}function Bl(r){if(!(!r||/^\d+$/.test(r))){if(Gj(r))return r===r.toLowerCase()?"i":"I";if(/^[a-z]{1,2}$/.test(r))return"a";if(/^[A-Z]{1,2}$/.test(r))return"A"}}function yd(r){if(/^\d+$/.test(r))return parseInt(r,10);const e=Bl(r);if(e==="i"||e==="I")return b_(r);if(e==="a"||e==="A"){const i=Kj(r);return i>0?i:1}const t=parseInt(r,10);return Number.isNaN(t)?1:t}function Jj(r,e){if(r==="numeric")return String(e);switch(r){case"a":return Pl(e);case"A":return Pl(e).toUpperCase();case"i":return Ml(e);case"I":return fd(e);default:return String(e)}}function Yj(r){var e;if(r.length===0)return!1;const t=(e=Bl(r[0]))!=null?e:"numeric",i=yd(r[0]);if(i<1)return!1;for(let n=0;n<r.length;n++){const a=Jj(t,i+n);if(r[n]!==a)return!1}return!0}function Qj(r){return{type:Bl(r),start:yd(r)}}function Xj(r){const{type:e,start:t}=Qj(r),i={};return e&&(i.type=e),t!==1&&(i.start=t),i}function Zj(r,e,t=". "){const i=e+1;if(!r||r==="1")return`${i}${t}`;switch(r){case"a":return`${Pl(i)}${t}`;case"A":return`${Pl(i).toUpperCase()}${t}`;case"i":return`${Ml(i)}${t}`;case"I":return`${fd(i)}${t}`;default:return`${i}${t}`}}function $j(r){var e,t;const i=(e=r.tokens)==null?void 0:e[0];return!!(r.text&&((t=r.tokens)==null?void 0:t.length)===1&&(i==null?void 0:i.type)==="list"&&i.ordered&&i.raw===r.text)}function eq(r,e){return e.tokenizeInline?e.parseInline(e.tokenizeInline(r)):e.parseInline([{type:"text",raw:r,text:r}])}var m_=Nt.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:r}){return["li",Fe(this.options.HTMLAttributes,r),0]},markdownTokenName:"list_item",parseMarkdown:(r,e)=>{var t;if(r.type!=="list_item")return[];const i=(t=e.parseBlockChildren)!=null?t:e.parseChildren;let n=[];if(r.tokens&&r.tokens.length>0){if($j(r))return{type:"listItem",content:[{type:"paragraph",content:eq(r.text||"",e)}]};if(r.tokens.some(l=>l.type==="paragraph"))n=i(r.tokens);else{const l=r.tokens[0];if(l&&l.type==="text"&&l.tokens&&l.tokens.length>0){if(n=[{type:"paragraph",content:e.parseInline(l.tokens)}],r.tokens.length>1){const p=r.tokens.slice(1),d=i(p);n.push(...d)}}else n=i(r.tokens)}}return n.length===0&&(n=[{type:"paragraph",content:[]}]),{type:"listItem",content:n}},renderMarkdown:(r,e,t)=>Hp(r,e,i=>{var n,a,l,s;if(i.parentType==="bulletList")return"- ";if(i.parentType==="orderedList"){const p=((a=(n=i.meta)==null?void 0:n.parentAttrs)==null?void 0:a.start)||1,d=(s=(l=i.meta)==null?void 0:l.parentAttrs)==null?void 0:s.type,c=p-1+(i.index||0);return Zj(d,c,". ")}return"- "},t),addExtensions(){return[d_(this.name,[this.options.bulletListTypeName,this.options.orderedListTypeName])]},addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)}}}),tq={};Oj(tq,{findListItemPos:()=>Ll,getNextListDepth:()=>wd,handleBackspace:()=>vd,handleDelete:()=>kd,hasListBefore:()=>g_,hasListItemAfter:()=>rq,hasListItemBefore:()=>oq,listItemHasSubList:()=>iq,nextListIsDeeper:()=>u_,nextListIsHigher:()=>x_});var Ll=(r,e)=>{const{$from:t}=e.selection,i=Ie(r,e.schema);let n=null,a=t.depth,l=t.pos,s=null;for(;a>0&&s===null;)n=t.node(a),n.type===i?s=a:(a-=1,l-=1);return s===null?null:{$pos:e.doc.resolve(l),depth:s}},wd=(r,e)=>{const t=Ll(r,e);if(!t)return!1;const[,i]=IO(e,r,t.$pos.pos+4);return i},g_=(r,e,t)=>{const{$anchor:i}=r.selection,n=Math.max(0,i.pos-2),a=r.doc.resolve(n).node();return!(!a||!t.includes(a.type.name))},vd=(r,e,t)=>{if(r.commands.undoInputRule())return!0;if(r.state.selection.from!==r.state.selection.to)return!1;if(!Qr(r.state,e)&&g_(r.state,e,t)){const{$anchor:i}=r.state.selection,n=r.state.doc.resolve(i.before()-1),a=[];n.node().descendants((p,d)=>{p.type.name===e&&a.push({node:p,pos:d})});const l=a.at(-1);if(!l)return!1;const s=r.state.doc.resolve(n.start()+l.pos+1);return r.chain().cut({from:i.start()-1,to:i.end()+1},s.end()).joinForward().run()}return!Qr(r.state,e)||!OO(r.state)?!1:r.chain().liftListItem(e).run()},u_=(r,e)=>{const t=wd(r,e),i=Ll(r,e);return!i||!t?!1:t>i.depth},x_=(r,e)=>{const t=wd(r,e),i=Ll(r,e);return!i||!t?!1:t<i.depth},kd=(r,e)=>{if(!Qr(r.state,e)||!RO(r.state,e))return!1;const{selection:t}=r.state,{$from:i,$to:n}=t;return!t.empty&&i.sameParent(n)?!1:u_(e,r.state)?r.chain().focus(r.state.selection.from+4).lift(e).joinBackward().run():x_(e,r.state)?r.chain().joinForward().joinBackward().run():r.commands.joinItemForward()},rq=(r,e)=>{var t;const{$anchor:i}=e.selection,n=e.doc.resolve(i.pos-i.parentOffset-2);return!(n.index()===n.parent.childCount-1||((t=n.nodeAfter)==null?void 0:t.type.name)!==r)},oq=(r,e)=>{var t;const{$anchor:i}=e.selection,n=e.doc.resolve(i.pos-2);return!(n.index()===0||((t=n.nodeBefore)==null?void 0:t.type.name)!==r)},iq=(r,e,t)=>{if(!t)return!1;const i=Ie(r,e.schema);let n=!1;return t.descendants(a=>{a.type===i&&(n=!0)}),n},h_=Be.create({name:"listKeymap",addOptions(){return{listTypes:[{itemName:"listItem",wrapperNames:["bulletList","orderedList"]},{itemName:"taskItem",wrapperNames:["taskList"]}]}},addKeyboardShortcuts(){return{Delete:({editor:r})=>{let e=!1;return this.options.listTypes.forEach(({itemName:t})=>{r.state.schema.nodes[t]!==void 0&&kd(r,t)&&(e=!0)}),e},"Mod-Delete":({editor:r})=>{let e=!1;return this.options.listTypes.forEach(({itemName:t})=>{r.state.schema.nodes[t]!==void 0&&kd(r,t)&&(e=!0)}),e},Backspace:({editor:r})=>{let e=!1;return this.options.listTypes.forEach(({itemName:t,wrapperNames:i})=>{r.state.schema.nodes[t]!==void 0&&vd(r,t,i)&&(e=!0)}),e},"Mod-Backspace":({editor:r})=>{let e=!1;return this.options.listTypes.forEach(({itemName:t,wrapperNames:i})=>{r.state.schema.nodes[t]!==void 0&&vd(r,t,i)&&(e=!0)}),e}}}}),Sd=new RegExp(`^(\\s*)(${hd})([.)])\\s+(.*)$`),nq=new RegExp(`^(\\s*)(${hd})([.)])\\s+`),aq=/^\s/;function lq(r){return Sd.test(r.trimStart())}function sq(r){const e=r.trimStart();return/^[-+*]\s+/.test(e)||lq(e)||/^>\s?/.test(e)||/^```/.test(e)||/^~~~/.test(e)}function pq(r){const e=[],t=[];let i=!1;return r.forEach(n=>{if(i){t.push(n);return}if(n.trim()===""){i=!0,t.push(n);return}if(e.length>0&&sq(n)){i=!0,t.push(n);return}e.push(n)}),{paragraphLines:e,blockLines:t}}function dq(r){const e=[];let t=0,i=0;for(;t<r.length;){const n=r[t],a=n.match(Sd);if(!a)break;const[,l,s,p,d]=a,c=l.length,b=parseInt(s,10),m=isNaN(b)?Bl(s):void 0,g=isNaN(b)?yd(s):b,x=[d];let u=t+1;const h=[n];let f=!1;for(;u<r.length;){const w=r[u];if(w.match(Sd))break;if(w.trim()==="")h.push(w),x.push(""),f=!0,u+=1;else if(w.match(aq)){const E=w.length-w.trimStart().length,S=c+s.length+1;h.push(w),x.push(w.slice(Math.min(E,S))),u+=1}else{if(f)break;h.push(w),x.push(w),u+=1}}e.push({indent:c,number:g,type:m,content:x.join(`
147
+ 3. "-" cannot repeat`);Ee.customSchemes.push([r,e])}function Lj(){Ee.scanner=vj(Ee.customSchemes);for(let r=0;r<Ee.tokenQueue.length;r++)Ee.tokenQueue[r][1]({scanner:Ee.scanner});Ee.parser=Tj(Ee.scanner.tokens);for(let r=0;r<Ee.pluginQueue.length;r++)Ee.pluginQueue[r][1]({scanner:Ee.scanner,parser:Ee.parser});return Ee.initialized=!0,Ee}function ud(r){return Ee.initialized||Lj(),Ej(Ee.parser.start,r,e_(Ee.scanner.start,r))}ud.scan=e_;function a_(r,e=null,t=null){if(e&&typeof e=="object"){if(t)throw Error(`linkifyjs: Invalid link type ${e}; must be a string`);t=e,e=null}const i=new md(t),n=ud(r),a=[];for(let l=0;l<n.length;l++){const s=n[l];s.isLink&&(!e||s.t===e)&&i.check(s)&&a.push(s.toFormattedObject(i))}return a}var xd="[\0-   ᠎ -\u2029  ]",Nj=new RegExp(xd),Aj=new RegExp(`${xd}$`),_j=new RegExp(xd,"g");function Dj(r){return r.length===1?r[0].isLink:r.length===3&&r[1].isLink?["()","[]"].includes(r[0].value+r[2].value):!1}function zj(r){return new Me({key:new Fe("autolink"),appendTransaction:(e,t,i)=>{const n=e.some(d=>d.docChanged)&&!t.doc.eq(i.doc),a=e.some(d=>d.getMeta("preventAutolink"));if(!n||a)return;const{tr:l}=i,s=GA(t.doc,[...e]);if(o9(s).forEach(({newRange:d})=>{const c=TO(i.doc,d,g=>g.isTextblock);let b,m;if(c.length>1)b=c[0],m=i.doc.textBetween(b.pos,b.pos+b.node.nodeSize,void 0," ");else if(c.length){const g=i.doc.textBetween(d.from,d.to," "," ");if(!Aj.test(g))return;b=c[0],m=i.doc.textBetween(b.pos,d.to,void 0," ")}if(b&&m){const g=m.split(Nj).filter(Boolean);if(g.length<=0)return!1;const x=g[g.length-1],u=b.pos+m.lastIndexOf(x);if(!x)return!1;const h=ud(x).map(f=>f.toObject(r.defaultProtocol));if(!Dj(h))return!1;h.filter(f=>f.isLink).map(f=>({...f,from:u+f.start+1,to:u+f.end+1})).filter(f=>i.schema.marks.code?!i.doc.rangeHasMark(f.from,f.to,i.schema.marks.code):!0).filter(f=>r.validate(f.value)).filter(f=>r.shouldAutoLink(f.value)).forEach(f=>{Lp(f.from,f.to,i.doc).some(w=>w.mark.type===r.type)||l.addMark(f.from,f.to,r.type.create({href:f.href}))})}}),!!l.steps.length)return l}})}function Ij(r){return new Me({key:new Fe("handleClickLink"),props:{handleClick:(e,t,i)=>{var n,a;if(i.button!==0||!e.editable)return!1;let l=null;if(i.target instanceof HTMLAnchorElement)l=i.target;else{const p=i.target;if(!p)return!1;const d=r.editor.view.dom;l=p.closest("a"),l&&!d.contains(l)&&(l=null)}if(!l)return!1;let s=!1;if(r.enableClickSelection&&(s=r.editor.commands.extendMarkRange(r.type.name)),r.openOnClick){const p=r9(e.state,r.type.name),d=(n=l.href)!=null?n:p.href,c=(a=l.target)!=null?a:p.target;d&&(window.open(d,c),s=!0)}return s}}})}function Vj(r){return new Me({key:new Fe("handlePasteLink"),props:{handlePaste:(e,t,i)=>{const{shouldAutoLink:n}=r,{state:a}=e,{selection:l}=a,{empty:s}=l;if(s)return!1;let p="";i.content.forEach(c=>{p+=c.textContent});const d=a_(p,{defaultProtocol:r.defaultProtocol}).find(c=>c.isLink&&c.value===p);return!p||!d||n!==void 0&&!n(d.value)?!1:r.editor.commands.setMark(r.type,{href:d.href})}}})}function Ro(r,e){const t=["http","https","ftp","ftps","mailto","tel","callto","sms","cid","xmpp"];return e&&e.forEach(i=>{const n=typeof i=="string"?i:i.scheme;n&&t.push(n)}),!r||r.replace(_j,"").match(new RegExp(`^(?:(?:${t.map(i=>i.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&")).join("|")}):|[^a-z]|[a-z0-9+.\\-]+(?:[^a-z+.\\-:]|$))`,"i"))}var Hj=Do.create({name:"link",priority:1e3,keepOnSplit:!1,exitable:!0,onCreate(){this.options.validate&&!this.options.shouldAutoLink&&(this.options.shouldAutoLink=this.options.validate,console.warn("The `validate` option is deprecated. Rename to the `shouldAutoLink` option instead.")),this.options.protocols.forEach(r=>{if(typeof r=="string"){n_(r);return}n_(r.scheme,r.optionalSlashes)})},onDestroy(){Bj()},inclusive(){return this.options.autolink},addOptions(){return{openOnClick:!0,enableClickSelection:!1,linkOnPaste:!0,autolink:!0,protocols:[],defaultProtocol:"http",HTMLAttributes:{target:"_blank",rel:"noopener noreferrer nofollow",class:null},isAllowedUri:(r,e)=>!!Ro(r,e.protocols),validate:r=>!!r,shouldAutoLink:r=>{const e=/^[a-z][a-z0-9+.-]*:\/\//i.test(r),t=/^[a-z][a-z0-9+.-]*:/i.test(r);if(e||t&&!r.includes("@"))return!0;const n=(r.includes("@")?r.split("@").pop():r).split(/[/?#:]/)[0];return!(/^\d{1,3}(\.\d{1,3}){3}$/.test(n)||!/\./.test(n))}}},addAttributes(){return{href:{default:null,parseHTML(r){return r.getAttribute("href")}},target:{default:this.options.HTMLAttributes.target},rel:{default:this.options.HTMLAttributes.rel},class:{default:this.options.HTMLAttributes.class},title:{default:null}}},parseHTML(){return[{tag:"a[href]",getAttrs:r=>{const e=r.getAttribute("href");return!e||!this.options.isAllowedUri(e,{defaultValidate:t=>!!Ro(t,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:null}}]},renderHTML({HTMLAttributes:r}){return this.options.isAllowedUri(r.href,{defaultValidate:e=>!!Ro(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?["a",je(this.options.HTMLAttributes,r),0]:["a",je(this.options.HTMLAttributes,{...r,href:""}),0]},markdownTokenName:"link",parseMarkdown:(r,e)=>e.applyMark("link",e.parseInline(r.tokens||[]),{href:r.href,title:r.title||null}),renderMarkdown:(r,e)=>{var t,i,n,a;const l=(i=(t=r.attrs)==null?void 0:t.href)!=null?i:"",s=(a=(n=r.attrs)==null?void 0:n.title)!=null?a:"",p=e.renderChildren(r);return s?`[${p}](${l} "${s}")`:`[${p}](${l})`},addCommands(){return{setLink:r=>({chain:e})=>{const{href:t}=r;return this.options.isAllowedUri(t,{defaultValidate:i=>!!Ro(i,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?e().setMark(this.name,r).setMeta("preventAutolink",!0).run():!1},toggleLink:r=>({chain:e})=>{const{href:t}=r||{};return t&&!this.options.isAllowedUri(t,{defaultValidate:i=>!!Ro(i,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:e().toggleMark(this.name,r,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()},unsetLink:()=>({chain:r})=>r().unsetMark(this.name,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()}},addPasteRules(){return[zo({find:r=>{const e=[];if(r){const{protocols:t,defaultProtocol:i}=this.options,n=a_(r).filter(a=>a.isLink&&this.options.isAllowedUri(a.value,{defaultValidate:l=>!!Ro(l,t),protocols:t,defaultProtocol:i}));n.length&&n.forEach(a=>{this.options.shouldAutoLink(a.value)&&e.push({text:a.value,data:{href:a.href},index:a.start})})}return e},type:this.type,getAttributes:r=>{var e;return{href:(e=r.data)==null?void 0:e.href}}})]},addProseMirrorPlugins(){const r=[],{protocols:e,defaultProtocol:t}=this.options;return this.options.autolink&&r.push(zj({type:this.type,defaultProtocol:this.options.defaultProtocol,validate:i=>this.options.isAllowedUri(i,{defaultValidate:n=>!!Ro(n,e),protocols:e,defaultProtocol:t}),shouldAutoLink:this.options.shouldAutoLink})),r.push(Ij({type:this.type,editor:this.editor,openOnClick:this.options.openOnClick==="whenNotEditable"?!0:this.options.openOnClick,enableClickSelection:this.options.enableClickSelection})),this.options.linkOnPaste&&r.push(Vj({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type,shouldAutoLink:this.options.shouldAutoLink})),r}}),Rj=Object.defineProperty,Oj=(r,e)=>{for(var t in e)Rj(r,t,{get:e[t],enumerable:!0})},Fj="listItem",l_="textStyle",s_=/^\s*([-+*])\s$/,p_=Nt.create({name:"bulletList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:"ul"}]},renderHTML({HTMLAttributes:r}){return["ul",je(this.options.HTMLAttributes,r),0]},markdownTokenName:"list",parseMarkdown:(r,e)=>r.type!=="list"||r.ordered?[]:{type:"bulletList",content:r.items?e.parseChildren(r.items):[]},renderMarkdown:(r,e)=>r.content?e.renderChildren(r.content,`
148
+ `):"",markdownOptions:{indentsContent:!0},addCommands(){return{toggleBulletList:()=>({commands:r,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(Fj,this.editor.getAttributes(l_)).run():r.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let r=mi({find:s_,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(r=mi({find:s_,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(l_),editor:this.editor})),[r]}}),jj=(r,e,t)=>{const{selection:i}=r;if(!i.empty)return null;const{$from:n}=i;if(!n.parent.isTextblock||n.parentOffset!==n.parent.content.size)return null;let a=-1;for(let g=n.depth;g>0;g-=1)if(n.node(g).type.name===e){a=g;break}if(a<0)return null;const l=n.node(a),s=n.index(a);if(s+1>=l.childCount)return null;const p=l.child(s+1);if(!t.includes(p.type.name))return null;const d=r.schema.nodes[e];let c=!1;if(p.forEach(g=>{g.type===d&&g.childCount>1&&(c=!0)}),!c)return null;const b=r.doc.resolve(n.after()).nodeAfter;if(!b||!t.includes(b.type.name))return null;const m=[];return b.forEach(g=>{m.push(g)}),m.length===0?null:{listItemDepth:a,nestedList:b,nestedListPos:n.after(),insertPos:n.after(a),items:m}},qj=(r,e,t,i)=>{const n=jj(r,t,i);if(!n)return!1;const{selection:a}=r,{nestedList:l,nestedListPos:s,insertPos:p,items:d}=n,c=r.tr;c.delete(s,s+l.nodeSize);const b=c.mapping.map(p);return c.insert(b,G.from(d)),c.setSelection(a.map(c.doc,c.mapping)),e&&e(c),!0},Uj=(r,e,t)=>qj(r.state,r.view.dispatch,e,t),d_=(r,e)=>Be.create({name:`${r}BranchingDeleteKeymap`,priority:101,addKeyboardShortcuts(){const t=()=>Uj(this.editor,r,e);return{Delete:t,"Mod-Delete":t}}}),c_=[[1e3,"m"],[900,"cm"],[500,"d"],[400,"cd"],[100,"c"],[90,"xc"],[50,"l"],[40,"xl"],[10,"x"],[9,"ix"],[5,"v"],[4,"iv"],[1,"i"]],El="abcdefghijklmnopqrstuvwxyz",Wj="[a-zA-Z]{1,2}",hd=String.raw`\d+|[ivxlcdmIVXLCDM]+|${Wj}`;function Ml(r){let e=r,t="";for(const[i,n]of c_)for(;e>=i;)t+=n,e-=i;return t}function fd(r){return Ml(r).toUpperCase()}function b_(r){const e=r.toLowerCase();let t=0,i=0;for(;t<e.length;){let n=!1;for(const[a,l]of c_)if(e.startsWith(l,t)){i+=a,t+=l.length,n=!0;break}if(!n)return 0}return i}function Gj(r){if(!/^[ivxlcdmIVXLCDM]+$/.test(r))return!1;const e=b_(r);return e<=0?!1:(r===r.toLowerCase()?Ml(e):fd(e))===r}function Kj(r){const e=r.toLowerCase();if(e.length===1)return e.charCodeAt(0)-97+1;if(e.length===2){const t=e.charCodeAt(0)-97,i=e.charCodeAt(1)-97;return(t+1)*26+i+1}return 0}function Pl(r){if(r<=26)return El[r-1];const e=Math.floor((r-1)/26)-1,t=(r-1)%26;return e<0?El[t]:El[e]+El[t]}function Bl(r){if(!(!r||/^\d+$/.test(r))){if(Gj(r))return r===r.toLowerCase()?"i":"I";if(/^[a-z]{1,2}$/.test(r))return"a";if(/^[A-Z]{1,2}$/.test(r))return"A"}}function yd(r){if(/^\d+$/.test(r))return parseInt(r,10);const e=Bl(r);if(e==="i"||e==="I")return b_(r);if(e==="a"||e==="A"){const i=Kj(r);return i>0?i:1}const t=parseInt(r,10);return Number.isNaN(t)?1:t}function Jj(r,e){if(r==="numeric")return String(e);switch(r){case"a":return Pl(e);case"A":return Pl(e).toUpperCase();case"i":return Ml(e);case"I":return fd(e);default:return String(e)}}function Yj(r){var e;if(r.length===0)return!1;const t=(e=Bl(r[0]))!=null?e:"numeric",i=yd(r[0]);if(i<1)return!1;for(let n=0;n<r.length;n++){const a=Jj(t,i+n);if(r[n]!==a)return!1}return!0}function Qj(r){return{type:Bl(r),start:yd(r)}}function Xj(r){const{type:e,start:t}=Qj(r),i={};return e&&(i.type=e),t!==1&&(i.start=t),i}function Zj(r,e,t=". "){const i=e+1;if(!r||r==="1")return`${i}${t}`;switch(r){case"a":return`${Pl(i)}${t}`;case"A":return`${Pl(i).toUpperCase()}${t}`;case"i":return`${Ml(i)}${t}`;case"I":return`${fd(i)}${t}`;default:return`${i}${t}`}}function $j(r){var e,t;const i=(e=r.tokens)==null?void 0:e[0];return!!(r.text&&((t=r.tokens)==null?void 0:t.length)===1&&(i==null?void 0:i.type)==="list"&&i.ordered&&i.raw===r.text)}function eq(r,e){return e.tokenizeInline?e.parseInline(e.tokenizeInline(r)):e.parseInline([{type:"text",raw:r,text:r}])}var m_=Nt.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:r}){return["li",je(this.options.HTMLAttributes,r),0]},markdownTokenName:"list_item",parseMarkdown:(r,e)=>{var t;if(r.type!=="list_item")return[];const i=(t=e.parseBlockChildren)!=null?t:e.parseChildren;let n=[];if(r.tokens&&r.tokens.length>0){if($j(r))return{type:"listItem",content:[{type:"paragraph",content:eq(r.text||"",e)}]};if(r.tokens.some(l=>l.type==="paragraph"))n=i(r.tokens);else{const l=r.tokens[0];if(l&&l.type==="text"&&l.tokens&&l.tokens.length>0){if(n=[{type:"paragraph",content:e.parseInline(l.tokens)}],r.tokens.length>1){const p=r.tokens.slice(1),d=i(p);n.push(...d)}}else n=i(r.tokens)}}return n.length===0&&(n=[{type:"paragraph",content:[]}]),{type:"listItem",content:n}},renderMarkdown:(r,e,t)=>Hp(r,e,i=>{var n,a,l,s;if(i.parentType==="bulletList")return"- ";if(i.parentType==="orderedList"){const p=((a=(n=i.meta)==null?void 0:n.parentAttrs)==null?void 0:a.start)||1,d=(s=(l=i.meta)==null?void 0:l.parentAttrs)==null?void 0:s.type,c=p-1+(i.index||0);return Zj(d,c,". ")}return"- "},t),addExtensions(){return[d_(this.name,[this.options.bulletListTypeName,this.options.orderedListTypeName])]},addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)}}}),tq={};Oj(tq,{findListItemPos:()=>Ll,getNextListDepth:()=>wd,handleBackspace:()=>vd,handleDelete:()=>kd,hasListBefore:()=>g_,hasListItemAfter:()=>rq,hasListItemBefore:()=>oq,listItemHasSubList:()=>iq,nextListIsDeeper:()=>u_,nextListIsHigher:()=>x_});var Ll=(r,e)=>{const{$from:t}=e.selection,i=Ie(r,e.schema);let n=null,a=t.depth,l=t.pos,s=null;for(;a>0&&s===null;)n=t.node(a),n.type===i?s=a:(a-=1,l-=1);return s===null?null:{$pos:e.doc.resolve(l),depth:s}},wd=(r,e)=>{const t=Ll(r,e);if(!t)return!1;const[,i]=IO(e,r,t.$pos.pos+4);return i},g_=(r,e,t)=>{const{$anchor:i}=r.selection,n=Math.max(0,i.pos-2),a=r.doc.resolve(n).node();return!(!a||!t.includes(a.type.name))},vd=(r,e,t)=>{if(r.commands.undoInputRule())return!0;if(r.state.selection.from!==r.state.selection.to)return!1;if(!Qr(r.state,e)&&g_(r.state,e,t)){const{$anchor:i}=r.state.selection,n=r.state.doc.resolve(i.before()-1),a=[];n.node().descendants((p,d)=>{p.type.name===e&&a.push({node:p,pos:d})});const l=a.at(-1);if(!l)return!1;const s=r.state.doc.resolve(n.start()+l.pos+1);return r.chain().cut({from:i.start()-1,to:i.end()+1},s.end()).joinForward().run()}return!Qr(r.state,e)||!OO(r.state)?!1:r.chain().liftListItem(e).run()},u_=(r,e)=>{const t=wd(r,e),i=Ll(r,e);return!i||!t?!1:t>i.depth},x_=(r,e)=>{const t=wd(r,e),i=Ll(r,e);return!i||!t?!1:t<i.depth},kd=(r,e)=>{if(!Qr(r.state,e)||!RO(r.state,e))return!1;const{selection:t}=r.state,{$from:i,$to:n}=t;return!t.empty&&i.sameParent(n)?!1:u_(e,r.state)?r.chain().focus(r.state.selection.from+4).lift(e).joinBackward().run():x_(e,r.state)?r.chain().joinForward().joinBackward().run():r.commands.joinItemForward()},rq=(r,e)=>{var t;const{$anchor:i}=e.selection,n=e.doc.resolve(i.pos-i.parentOffset-2);return!(n.index()===n.parent.childCount-1||((t=n.nodeAfter)==null?void 0:t.type.name)!==r)},oq=(r,e)=>{var t;const{$anchor:i}=e.selection,n=e.doc.resolve(i.pos-2);return!(n.index()===0||((t=n.nodeBefore)==null?void 0:t.type.name)!==r)},iq=(r,e,t)=>{if(!t)return!1;const i=Ie(r,e.schema);let n=!1;return t.descendants(a=>{a.type===i&&(n=!0)}),n},h_=Be.create({name:"listKeymap",addOptions(){return{listTypes:[{itemName:"listItem",wrapperNames:["bulletList","orderedList"]},{itemName:"taskItem",wrapperNames:["taskList"]}]}},addKeyboardShortcuts(){return{Delete:({editor:r})=>{let e=!1;return this.options.listTypes.forEach(({itemName:t})=>{r.state.schema.nodes[t]!==void 0&&kd(r,t)&&(e=!0)}),e},"Mod-Delete":({editor:r})=>{let e=!1;return this.options.listTypes.forEach(({itemName:t})=>{r.state.schema.nodes[t]!==void 0&&kd(r,t)&&(e=!0)}),e},Backspace:({editor:r})=>{let e=!1;return this.options.listTypes.forEach(({itemName:t,wrapperNames:i})=>{r.state.schema.nodes[t]!==void 0&&vd(r,t,i)&&(e=!0)}),e},"Mod-Backspace":({editor:r})=>{let e=!1;return this.options.listTypes.forEach(({itemName:t,wrapperNames:i})=>{r.state.schema.nodes[t]!==void 0&&vd(r,t,i)&&(e=!0)}),e}}}}),Sd=new RegExp(`^(\\s*)(${hd})([.)])\\s+(.*)$`),nq=new RegExp(`^(\\s*)(${hd})([.)])\\s+`),aq=/^\s/;function lq(r){return Sd.test(r.trimStart())}function sq(r){const e=r.trimStart();return/^[-+*]\s+/.test(e)||lq(e)||/^>\s?/.test(e)||/^```/.test(e)||/^~~~/.test(e)}function pq(r){const e=[],t=[];let i=!1;return r.forEach(n=>{if(i){t.push(n);return}if(n.trim()===""){i=!0,t.push(n);return}if(e.length>0&&sq(n)){i=!0,t.push(n);return}e.push(n)}),{paragraphLines:e,blockLines:t}}function dq(r){const e=[];let t=0,i=0;for(;t<r.length;){const n=r[t],a=n.match(Sd);if(!a)break;const[,l,s,p,d]=a,c=l.length,b=parseInt(s,10),m=isNaN(b)?Bl(s):void 0,g=isNaN(b)?yd(s):b,x=[d];let u=t+1;const h=[n];let f=!1;for(;u<r.length;){const w=r[u];if(w.match(Sd))break;if(w.trim()==="")h.push(w),x.push(""),f=!0,u+=1;else if(w.match(aq)){const E=w.length-w.trimStart().length,S=c+s.length+1;h.push(w),x.push(w.slice(Math.min(E,S))),u+=1}else{if(f)break;h.push(w),x.push(w),u+=1}}e.push({indent:c,number:g,type:m,content:x.join(`
149
149
  `).trim(),contentLines:x,raw:h.join(`
150
150
  `)}),i=u,t=u}return[e,i]}var cq=new RegExp(`^(${hd})([.)])\\s+(.+)$`);function bq(r){const e=r.split(`
151
151
  `).filter(a=>a.trim().length>0);if(e.length===0)return null;const t=[];for(const a of e){const l=a.trim().match(cq);if(!l)return null;t.push({marker:l[1],content:l[3]})}const i=t.map(a=>a.marker);return Yj(i)?{type:"orderedList",attrs:Xj(t[0].marker),content:t.map(a=>({type:"listItem",content:[{type:"paragraph",content:[{type:"text",text:a.content}]}]}))}:null}function f_(r,e,t){const i=[];let n=0;for(;n<r.length;){const a=r[n];if(a.indent===e){const{paragraphLines:l,blockLines:s}=pq(a.contentLines),p=l.join(`
152
152
  `).trim(),d=[];p&&d.push({type:"paragraph",raw:p,tokens:t.inlineTokens(p)});const c=s.join(`
153
153
  `).trim();if(c){const g=t.blockTokens(c);d.push(...g)}let b=n+1;const m=[];for(;b<r.length&&r[b].indent>e;)m.push(r[b]),b+=1;if(m.length>0){const g=Math.min(...m.map(u=>u.indent)),x=f_(m,g,t);d.push({type:"list",ordered:!0,start:m[0].number,typeMarker:m[0].type,items:x,raw:m.map(u=>u.raw).join(`
154
- `)})}i.push({type:"list_item",raw:a.raw,tokens:d}),n=b}else n+=1}return i}function mq(r,e){return r.map(t=>{if(t.type!=="list_item")return e.parseChildren([t])[0];const i=[];return t.tokens&&t.tokens.length>0&&t.tokens.forEach(n=>{if(n.type==="paragraph"||n.type==="list"||n.type==="blockquote"||n.type==="code")i.push(...e.parseChildren([n]));else if(n.type==="text"&&n.tokens){const a=e.parseChildren([n]);i.push({type:"paragraph",content:a})}else{const a=e.parseChildren([n]);a.length>0&&i.push(...a)}}),{type:"listItem",content:i}})}var gq="listItem",y_="textStyle",w_=/^(\d+)\.\s$/;function v_(r){const e=r.match(/list-style-type\s*:\s*([^;]+)/i);if(!e)return null;switch(e[1].trim().toLowerCase()){case"upper-roman":return"I";case"lower-roman":return"i";case"upper-alpha":case"upper-latin":return"A";case"lower-alpha":case"lower-latin":return"a";default:return null}}var k_=Nt.create({name:"orderedList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},addAttributes(){return{start:{default:1,parseHTML:r=>r.hasAttribute("start")?parseInt(r.getAttribute("start")||"",10):1},type:{default:null,parseHTML:r=>{const e=r.getAttribute("type");if(e)return e;const t=r.getAttribute("style");if(t){const n=v_(t);if(n)return n}const i=r.querySelector("li");if(i){const n=i.getAttribute("style");if(n){const a=v_(n);if(a)return a}}return null}}}},parseHTML(){return[{tag:"ol"}]},renderHTML({HTMLAttributes:r}){const{start:e,type:t,...i}=r,n=Fe(this.options.HTMLAttributes,i);return e!==1&&(n.start=e),t&&t!=="1"&&(n.type=t),["ol",n,0]},markdownTokenName:"list",parseMarkdown:(r,e)=>{if(r.type!=="list"||!r.ordered)return[];const t=r.start||1,i=r.typeMarker,n=r.items?mq(r.items,e):[],a={};return t!==1&&(a.start=t),i&&(a.type=i),Object.keys(a).length>0?{type:"orderedList",attrs:a,content:n}:{type:"orderedList",content:n}},renderMarkdown:(r,e)=>r.content?e.renderChildren(r.content,`
154
+ `)})}i.push({type:"list_item",raw:a.raw,tokens:d}),n=b}else n+=1}return i}function mq(r,e){return r.map(t=>{if(t.type!=="list_item")return e.parseChildren([t])[0];const i=[];return t.tokens&&t.tokens.length>0&&t.tokens.forEach(n=>{if(n.type==="paragraph"||n.type==="list"||n.type==="blockquote"||n.type==="code")i.push(...e.parseChildren([n]));else if(n.type==="text"&&n.tokens){const a=e.parseChildren([n]);i.push({type:"paragraph",content:a})}else{const a=e.parseChildren([n]);a.length>0&&i.push(...a)}}),{type:"listItem",content:i}})}var gq="listItem",y_="textStyle",w_=/^(\d+)\.\s$/;function v_(r){const e=r.match(/list-style-type\s*:\s*([^;]+)/i);if(!e)return null;switch(e[1].trim().toLowerCase()){case"upper-roman":return"I";case"lower-roman":return"i";case"upper-alpha":case"upper-latin":return"A";case"lower-alpha":case"lower-latin":return"a";default:return null}}var k_=Nt.create({name:"orderedList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},addAttributes(){return{start:{default:1,parseHTML:r=>r.hasAttribute("start")?parseInt(r.getAttribute("start")||"",10):1},type:{default:null,parseHTML:r=>{const e=r.getAttribute("type");if(e)return e;const t=r.getAttribute("style");if(t){const n=v_(t);if(n)return n}const i=r.querySelector("li");if(i){const n=i.getAttribute("style");if(n){const a=v_(n);if(a)return a}}return null}}}},parseHTML(){return[{tag:"ol"}]},renderHTML({HTMLAttributes:r}){const{start:e,type:t,...i}=r,n=je(this.options.HTMLAttributes,i);return e!==1&&(n.start=e),t&&t!=="1"&&(n.type=t),["ol",n,0]},markdownTokenName:"list",parseMarkdown:(r,e)=>{if(r.type!=="list"||!r.ordered)return[];const t=r.start||1,i=r.typeMarker,n=r.items?mq(r.items,e):[],a={};return t!==1&&(a.start=t),i&&(a.type=i),Object.keys(a).length>0?{type:"orderedList",attrs:a,content:n}:{type:"orderedList",content:n}},renderMarkdown:(r,e)=>r.content?e.renderChildren(r.content,`
155
155
  `):"",markdownTokenizer:{name:"orderedList",level:"block",start:r=>{const e=r.match(nq),t=e==null?void 0:e.index;return t!==void 0?t:-1},tokenize:(r,e,t)=>{var i,n;const a=r.split(`
156
156
  `),[l,s]=dq(a);if(l.length===0)return;const p=f_(l,0,t);if(p.length===0)return;const d=((i=l[0])==null?void 0:i.number)||1,c=(n=l[0])==null?void 0:n.type;return{type:"list",ordered:!0,start:d,typeMarker:c,items:p,raw:a.slice(0,s).join(`
157
- `)}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleOrderedList:()=>({commands:r,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(gq,this.editor.getAttributes(y_)).run():r.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addProseMirrorPlugins(){return[new Me({props:{handlePaste:(r,e)=>{var t,i;const n=(t=e.clipboardData)==null?void 0:t.getData("text/html");if(n!=null&&n.trim())return!1;const a=(i=e.clipboardData)==null?void 0:i.getData("text/plain");if(!a)return!1;const l=bq(a);if(!l)return!1;try{const s=r.state.schema.nodeFromJSON(l),p=r.state.tr.replaceSelectionWith(s);return r.dispatch(p),!0}catch{return!1}}}})]},addInputRules(){const r=(t,i)=>(!i.attrs.type||i.attrs.type==="1")&&i.childCount+i.attrs.start===+t[1];let e=mi({find:w_,type:this.type,getAttributes:t=>({start:+t[1]}),joinPredicate:r});return(this.options.keepMarks||this.options.keepAttributes)&&(e=mi({find:w_,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:t=>({start:+t[1],...this.editor.getAttributes(y_)}),joinPredicate:r,editor:this.editor})),[e]}}),uq=/^\s*(\[([( |x])?\])\s$/,xq=Nt.create({name:"taskItem",addOptions(){return{nested:!1,HTMLAttributes:{},taskListTypeName:"taskList",a11y:void 0}},content(){return this.options.nested?"paragraph block*":"paragraph+"},defining:!0,addAttributes(){return{checked:{default:!1,keepOnSplit:!1,parseHTML:r=>{const e=r.getAttribute("data-checked");return e===""||e==="true"},renderHTML:r=>({"data-checked":r.checked})}}},parseHTML(){return[{tag:`li[data-type="${this.name}"]`,priority:51}]},renderHTML({node:r,HTMLAttributes:e}){return["li",Fe(this.options.HTMLAttributes,e,{"data-type":this.name}),["label",["input",{type:"checkbox",checked:r.attrs.checked?"checked":null}],["span"]],["div",0]]},parseMarkdown:(r,e)=>{const t=[];if(r.tokens&&r.tokens.length>0?t.push(e.createNode("paragraph",{},e.parseInline(r.tokens))):r.text?t.push(e.createNode("paragraph",{},[e.createNode("text",{text:r.text})])):t.push(e.createNode("paragraph",{},[])),r.nestedTokens&&r.nestedTokens.length>0){const i=e.parseChildren(r.nestedTokens);t.push(...i)}return e.createNode("taskItem",{checked:r.checked||!1},t)},renderMarkdown:(r,e)=>{var t;const n=`- [${(t=r.attrs)!=null&&t.checked?"x":" "}] `;return Hp(r,e,n)},addExtensions(){return this.options.nested?[d_(this.name,[this.options.taskListTypeName])]:[]},addKeyboardShortcuts(){const r={Enter:()=>this.editor.commands.splitListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)};return this.options.nested?{...r,Tab:()=>this.editor.commands.sinkListItem(this.name)}:r},addNodeView(){return({node:r,HTMLAttributes:e,getPos:t,editor:i})=>{const n=document.createElement("li"),a=document.createElement("label"),l=document.createElement("span"),s=document.createElement("input"),p=document.createElement("div"),d=b=>{var m,g;s.ariaLabel=((g=(m=this.options.a11y)==null?void 0:m.checkboxLabel)==null?void 0:g.call(m,b,s.checked))||`Task item checkbox for ${b.textContent||"empty task item"}`};d(r),a.contentEditable="false",s.type="checkbox",s.addEventListener("mousedown",b=>b.preventDefault()),s.addEventListener("change",b=>{if(!i.isEditable&&!this.options.onReadOnlyChecked){s.checked=!s.checked;return}const{checked:m}=b.target;i.isEditable&&typeof t=="function"&&i.chain().focus(void 0,{scrollIntoView:!1}).command(({tr:g})=>{const x=t();if(typeof x!="number")return!1;const u=g.doc.nodeAt(x);return g.setNodeMarkup(x,void 0,{...u==null?void 0:u.attrs,checked:m}),!0}).run(),!i.isEditable&&this.options.onReadOnlyChecked&&(this.options.onReadOnlyChecked(r,m)||(s.checked=!s.checked))}),Object.entries(this.options.HTMLAttributes).forEach(([b,m])=>{n.setAttribute(b,m)}),n.dataset.checked=r.attrs.checked,s.checked=r.attrs.checked,a.append(s,l),n.append(a,p),Object.entries(e).forEach(([b,m])=>{n.setAttribute(b,m)});let c=new Set(Object.keys(e));return{dom:n,contentDOM:p,update:b=>{if(b.type!==this.type)return!1;n.dataset.checked=b.attrs.checked,s.checked=b.attrs.checked,d(b);const m=i.extensionManager.attributes,g=cn(b,m),x=new Set(Object.keys(g)),u=this.options.HTMLAttributes;return c.forEach(h=>{x.has(h)||(h in u?n.setAttribute(h,u[h]):n.removeAttribute(h))}),Object.entries(g).forEach(([h,f])=>{f==null?h in u?n.setAttribute(h,u[h]):n.removeAttribute(h):n.setAttribute(h,f)}),c=x,!0}}}},addInputRules(){return[mi({find:uq,type:this.type,getAttributes:r=>({checked:r[r.length-1]==="x"})})]}}),hq=Nt.create({name:"taskList",addOptions(){return{itemTypeName:"taskItem",HTMLAttributes:{}}},group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:`ul[data-type="${this.name}"]`,priority:51}]},renderHTML({HTMLAttributes:r}){return["ul",Fe(this.options.HTMLAttributes,r,{"data-type":this.name}),0]},parseMarkdown:(r,e)=>e.createNode("taskList",{},e.parseChildren(r.items||[])),renderMarkdown:(r,e)=>r.content?e.renderChildren(r.content,`
158
- `):"",markdownTokenizer:{name:"taskList",level:"block",start(r){var e;const t=(e=r.match(/^\s*[-+*]\s+\[([ xX])\]\s+/))==null?void 0:e.index;return t!==void 0?t:-1},tokenize(r,e,t){const i=a=>{const l=Vp(a,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:s=>({indentLevel:s[1].length,mainContent:s[4],checked:s[3].toLowerCase()==="x"}),createToken:(s,p)=>({type:"taskItem",raw:"",mainContent:s.mainContent,indentLevel:s.indentLevel,checked:s.checked,text:s.mainContent,tokens:t.inlineTokens(s.mainContent),nestedTokens:p}),customNestedParser:i},t);return l?[{type:"taskList",raw:l.raw,items:l.items}]:t.blockTokens(a)},n=Vp(r,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:a=>({indentLevel:a[1].length,mainContent:a[4],checked:a[3].toLowerCase()==="x"}),createToken:(a,l)=>({type:"taskItem",raw:"",mainContent:a.mainContent,indentLevel:a.indentLevel,checked:a.checked,text:a.mainContent,tokens:t.inlineTokens(a.mainContent),nestedTokens:l}),customNestedParser:i},t);if(n)return{type:"taskList",raw:n.raw,items:n.items}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleTaskList:()=>({commands:r})=>r.toggleList(this.name,this.options.itemTypeName)}},addKeyboardShortcuts(){return{"Mod-Shift-9":()=>this.editor.commands.toggleTaskList()}}});Be.create({name:"listKit",addExtensions(){const r=[];return this.options.bulletList!==!1&&r.push(p_.configure(this.options.bulletList)),this.options.listItem!==!1&&r.push(m_.configure(this.options.listItem)),this.options.listKeymap!==!1&&r.push(h_.configure(this.options.listKeymap)),this.options.orderedList!==!1&&r.push(k_.configure(this.options.orderedList)),this.options.taskItem!==!1&&r.push(xq.configure(this.options.taskItem)),this.options.taskList!==!1&&r.push(hq.configure(this.options.taskList)),r}});var Nl="&nbsp;",Cd=" ",fq=Nt.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:r}){return["p",Fe(this.options.HTMLAttributes,r),0]},parseMarkdown:(r,e)=>{const t=r.tokens||[];if(t.length===1&&t[0].type==="image")return e.parseChildren([t[0]]);const i=e.parseInline(t);return t.length===1&&t[0].type==="text"&&(t[0].raw===Nl||t[0].text===Nl||t[0].raw===Cd||t[0].text===Cd)&&i.length===1&&i[0].type==="text"&&(i[0].text===Nl||i[0].text===Cd)?e.createNode("paragraph",void 0,[]):e.createNode("paragraph",void 0,i)},renderMarkdown:(r,e,t)=>{var i,n;if(!r)return"";const a=Array.isArray(r.content)?r.content:[];if(a.length===0){const l=Array.isArray((i=t==null?void 0:t.previousNode)==null?void 0:i.content)?t.previousNode.content:[];return((n=t==null?void 0:t.previousNode)==null?void 0:n.type)==="paragraph"&&l.length===0?Nl:""}return e.renderChildren(a)},addCommands(){return{setParagraph:()=>({commands:r})=>r.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),yq=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,wq=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,vq=Do.create({name:"strike",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"s"},{tag:"del"},{tag:"strike"},{style:"text-decoration",consuming:!1,getAttrs:r=>r.includes("line-through")?{}:!1}]},renderHTML({HTMLAttributes:r}){return["s",Fe(this.options.HTMLAttributes,r),0]},markdownTokenName:"del",parseMarkdown:(r,e)=>e.applyMark("strike",e.parseInline(r.tokens||[])),renderMarkdown:(r,e)=>`~~${e.renderChildren(r)}~~`,addCommands(){return{setStrike:()=>({commands:r})=>r.setMark(this.name),toggleStrike:()=>({commands:r})=>r.toggleMark(this.name),unsetStrike:()=>({commands:r})=>r.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-s":()=>this.editor.commands.toggleStrike()}},addInputRules(){return[bi({find:yq,type:this.type})]},addPasteRules(){return[zo({find:wq,type:this.type})]}}),kq=Nt.create({name:"text",group:"inline",parseMarkdown:r=>({type:"text",text:r.text||""}),renderMarkdown:r=>r.text||""}),Sq=Do.create({name:"underline",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"u"},{style:"text-decoration",consuming:!1,getAttrs:r=>r.includes("underline")?{}:!1}]},renderHTML({HTMLAttributes:r}){return["u",Fe(this.options.HTMLAttributes,r),0]},parseMarkdown(r,e){return e.applyMark(this.name||"underline",e.parseInline(r.tokens||[]))},renderMarkdown(r,e){return`++${e.renderChildren(r)}++`},markdownTokenizer:{name:"underline",level:"inline",start(r){return r.indexOf("++")},tokenize(r,e,t){const n=/^(\+\+)([\s\S]+?)(\+\+)/.exec(r);if(!n)return;const a=n[2].trim();return{type:"underline",raw:n[0],text:a,tokens:t.inlineTokens(a)}}},addCommands(){return{setUnderline:()=>({commands:r})=>r.setMark(this.name),toggleUnderline:()=>({commands:r})=>r.toggleMark(this.name),unsetUnderline:()=>({commands:r})=>r.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-u":()=>this.editor.commands.toggleUnderline(),"Mod-U":()=>this.editor.commands.toggleUnderline()}}});function Cq(r={}){return new Me({view(e){return new Tq(e,r)}})}class Tq{constructor(e,t){var i;this.editorView=e,this.cursorPos=null,this.element=null,this.timeout=-1,this.width=(i=t.width)!==null&&i!==void 0?i:1,this.color=t.color===!1?void 0:t.color||"black",this.class=t.class,this.handlers=["dragover","dragend","drop","dragleave"].map(n=>{let a=l=>{this[n](l)};return e.dom.addEventListener(n,a),{name:n,handler:a}})}destroy(){this.handlers.forEach(({name:e,handler:t})=>this.editorView.dom.removeEventListener(e,t))}update(e,t){this.cursorPos!=null&&t.doc!=e.state.doc&&(this.cursorPos>e.state.doc.content.size?this.setCursor(null):this.updateOverlay())}setCursor(e){e!=this.cursorPos&&(this.cursorPos=e,e==null?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())}updateOverlay(){let e=this.editorView.state.doc.resolve(this.cursorPos),t=!e.parent.inlineContent,i,n=this.editorView.dom,a=n.getBoundingClientRect(),l=a.width/n.offsetWidth,s=a.height/n.offsetHeight;if(t){let b=e.nodeBefore,m=e.nodeAfter;if(b||m){let g=this.editorView.nodeDOM(this.cursorPos-(b?b.nodeSize:0));if(g){let x=g.getBoundingClientRect(),u=b?x.bottom:x.top;b&&m&&(u=(u+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let h=this.width/2*s;i={left:x.left,right:x.right,top:u-h,bottom:u+h}}}}if(!i){let b=this.editorView.coordsAtPos(this.cursorPos),m=this.width/2*l;i={left:b.left-m,right:b.left+m,top:b.top,bottom:b.bottom}}let p=this.editorView.dom.offsetParent;this.element||(this.element=p.appendChild(document.createElement("div")),this.class&&(this.element.className=this.class),this.element.style.cssText="position: absolute; z-index: 50; pointer-events: none;",this.color&&(this.element.style.backgroundColor=this.color)),this.element.classList.toggle("prosemirror-dropcursor-block",t),this.element.classList.toggle("prosemirror-dropcursor-inline",!t);let d,c;if(!p||p==document.body&&getComputedStyle(p).position=="static")d=-pageXOffset,c=-pageYOffset;else{let b=p.getBoundingClientRect(),m=b.width/p.offsetWidth,g=b.height/p.offsetHeight;d=b.left-p.scrollLeft*m,c=b.top-p.scrollTop*g}this.element.style.left=(i.left-d)/l+"px",this.element.style.top=(i.top-c)/s+"px",this.element.style.width=(i.right-i.left)/l+"px",this.element.style.height=(i.bottom-i.top)/s+"px"}scheduleRemoval(e){clearTimeout(this.timeout),this.timeout=setTimeout(()=>this.setCursor(null),e)}dragover(e){if(!this.editorView.editable)return;let t=this.editorView.posAtCoords({left:e.clientX,top:e.clientY}),i=t&&t.inside>=0&&this.editorView.state.doc.nodeAt(t.inside),n=i&&i.type.spec.disableDropCursor,a=typeof n=="function"?n(this.editorView,t,e):n;if(t&&!a){let l=t.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let s=qL(this.editorView.state.doc,l,this.editorView.dragging.slice);s!=null&&(l=s)}this.setCursor(l),this.scheduleRemoval(5e3)}}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(e){this.editorView.dom.contains(e.relatedTarget)||this.setCursor(null)}}class Ae extends de{constructor(e){super(e,e)}map(e,t){let i=e.resolve(t.map(this.head));return Ae.valid(i)?new Ae(i):de.near(i)}content(){return $.empty}eq(e){return e instanceof Ae&&e.head==this.head}toJSON(){return{type:"gapcursor",pos:this.head}}static fromJSON(e,t){if(typeof t.pos!="number")throw new RangeError("Invalid input for GapCursor.fromJSON");return new Ae(e.resolve(t.pos))}getBookmark(){return new Td(this.anchor)}static valid(e){let t=e.parent;if(t.inlineContent||!Eq(e)||!Mq(e))return!1;let i=t.type.spec.allowGapCursor;if(i!=null)return i;let n=t.contentMatchAt(e.index()).defaultType;return n&&n.isTextblock}static findGapCursorFrom(e,t,i=!1){e:for(;;){if(!i&&Ae.valid(e))return e;let n=e.pos,a=null;for(let l=e.depth;;l--){let s=e.node(l);if(t>0?e.indexAfter(l)<s.childCount:e.index(l)>0){a=s.child(t>0?e.indexAfter(l):e.index(l)-1);break}else if(l==0)return null;n+=t;let p=e.doc.resolve(n);if(Ae.valid(p))return p}for(;;){let l=t>0?a.firstChild:a.lastChild;if(!l){if(a.isAtom&&!a.isText&&!ae.isSelectable(a)){e=e.doc.resolve(n+a.nodeSize*t),i=!1;continue e}break}a=l,n+=t;let s=e.doc.resolve(n);if(Ae.valid(s))return s}return null}}}Ae.prototype.visible=!1,Ae.findFrom=Ae.findGapCursorFrom,de.jsonID("gapcursor",Ae);class Td{constructor(e){this.pos=e}map(e){return new Td(e.map(this.pos))}resolve(e){let t=e.resolve(this.pos);return Ae.valid(t)?new Ae(t):de.near(t)}}function S_(r){return r.isAtom||r.spec.isolating||r.spec.createGapCursor}function Eq(r){for(let e=r.depth;e>=0;e--){let t=r.index(e),i=r.node(e);if(t==0){if(i.type.spec.isolating)return!0;continue}for(let n=i.child(t-1);;n=n.lastChild){if(n.childCount==0&&!n.inlineContent||S_(n.type))return!0;if(n.inlineContent)return!1}}return!0}function Mq(r){for(let e=r.depth;e>=0;e--){let t=r.indexAfter(e),i=r.node(e);if(t==i.childCount){if(i.type.spec.isolating)return!0;continue}for(let n=i.child(t);;n=n.firstChild){if(n.childCount==0&&!n.inlineContent||S_(n.type))return!0;if(n.inlineContent)return!1}}return!0}function Pq(){return new Me({props:{decorations:Aq,createSelectionBetween(r,e,t){return e.pos==t.pos&&Ae.valid(t)?new Ae(t):null},handleClick:Lq,handleKeyDown:Bq,handleDOMEvents:{beforeinput:Nq}}})}const Bq=DA({ArrowLeft:Al("horiz",-1),ArrowRight:Al("horiz",1),ArrowUp:Al("vert",-1),ArrowDown:Al("vert",1)});function Al(r,e){const t=r=="vert"?e>0?"down":"up":e>0?"right":"left";return function(i,n,a){let l=i.selection,s=e>0?l.$to:l.$from,p=l.empty;if(l instanceof pe){if(!a.endOfTextblock(t)||s.depth==0)return!1;p=!1,s=i.doc.resolve(e>0?s.after():s.before())}let d=Ae.findGapCursorFrom(s,e,p);return d?(n&&n(i.tr.setSelection(new Ae(d))),!0):!1}}function Lq(r,e,t){if(!r||!r.editable)return!1;let i=r.state.doc.resolve(e);if(!Ae.valid(i))return!1;let n=r.posAtCoords({left:t.clientX,top:t.clientY});return n&&n.inside>-1&&ae.isSelectable(r.state.doc.nodeAt(n.inside))?!1:(r.dispatch(r.state.tr.setSelection(new Ae(i))),!0)}function Nq(r,e){if(e.inputType!="insertCompositionText"||!(r.state.selection instanceof Ae))return!1;let{$from:t}=r.state.selection,i=t.parent.contentMatchAt(t.index()).findWrapping(r.state.schema.nodes.text);if(!i)return!1;let n=G.empty;for(let l=i.length-1;l>=0;l--)n=G.from(i[l].createAndFill(null,n));let a=r.state.tr.replace(t.pos,t.pos,new $(n,0,0));return a.setSelection(pe.near(a.doc.resolve(t.pos+1))),r.dispatch(a),!1}function Aq(r){if(!(r.selection instanceof Ae))return null;let e=document.createElement("div");return e.className="ProseMirror-gapcursor",Pe.create(r.doc,[ft.widget(r.selection.head,e,{key:"gapcursor"})])}var _l=200,Ge=function(){};Ge.prototype.append=function(e){return e.length?(e=Ge.from(e),!this.length&&e||e.length<_l&&this.leafAppend(e)||this.length<_l&&e.leafPrepend(this)||this.appendInner(e)):this},Ge.prototype.prepend=function(e){return e.length?Ge.from(e).append(this):this},Ge.prototype.appendInner=function(e){return new _q(this,e)},Ge.prototype.slice=function(e,t){return e===void 0&&(e=0),t===void 0&&(t=this.length),e>=t?Ge.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,t))},Ge.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)},Ge.prototype.forEach=function(e,t,i){t===void 0&&(t=0),i===void 0&&(i=this.length),t<=i?this.forEachInner(e,t,i,0):this.forEachInvertedInner(e,t,i,0)},Ge.prototype.map=function(e,t,i){t===void 0&&(t=0),i===void 0&&(i=this.length);var n=[];return this.forEach(function(a,l){return n.push(e(a,l))},t,i),n},Ge.from=function(e){return e instanceof Ge?e:e&&e.length?new C_(e):Ge.empty};var C_=(function(r){function e(i){r.call(this),this.values=i}r&&(e.__proto__=r),e.prototype=Object.create(r&&r.prototype),e.prototype.constructor=e;var t={length:{configurable:!0},depth:{configurable:!0}};return e.prototype.flatten=function(){return this.values},e.prototype.sliceInner=function(n,a){return n==0&&a==this.length?this:new e(this.values.slice(n,a))},e.prototype.getInner=function(n){return this.values[n]},e.prototype.forEachInner=function(n,a,l,s){for(var p=a;p<l;p++)if(n(this.values[p],s+p)===!1)return!1},e.prototype.forEachInvertedInner=function(n,a,l,s){for(var p=a-1;p>=l;p--)if(n(this.values[p],s+p)===!1)return!1},e.prototype.leafAppend=function(n){if(this.length+n.length<=_l)return new e(this.values.concat(n.flatten()))},e.prototype.leafPrepend=function(n){if(this.length+n.length<=_l)return new e(n.flatten().concat(this.values))},t.length.get=function(){return this.values.length},t.depth.get=function(){return 0},Object.defineProperties(e.prototype,t),e})(Ge);Ge.empty=new C_([]);var _q=(function(r){function e(t,i){r.call(this),this.left=t,this.right=i,this.length=t.length+i.length,this.depth=Math.max(t.depth,i.depth)+1}return r&&(e.__proto__=r),e.prototype=Object.create(r&&r.prototype),e.prototype.constructor=e,e.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},e.prototype.getInner=function(i){return i<this.left.length?this.left.get(i):this.right.get(i-this.left.length)},e.prototype.forEachInner=function(i,n,a,l){var s=this.left.length;if(n<s&&this.left.forEachInner(i,n,Math.min(a,s),l)===!1||a>s&&this.right.forEachInner(i,Math.max(n-s,0),Math.min(this.length,a)-s,l+s)===!1)return!1},e.prototype.forEachInvertedInner=function(i,n,a,l){var s=this.left.length;if(n>s&&this.right.forEachInvertedInner(i,n-s,Math.max(a,s)-s,l+s)===!1||a<s&&this.left.forEachInvertedInner(i,Math.min(n,s),a,l)===!1)return!1},e.prototype.sliceInner=function(i,n){if(i==0&&n==this.length)return this;var a=this.left.length;return n<=a?this.left.slice(i,n):i>=a?this.right.slice(i-a,n-a):this.left.slice(i,a).append(this.right.slice(0,n-a))},e.prototype.leafAppend=function(i){var n=this.right.leafAppend(i);if(n)return new e(this.left,n)},e.prototype.leafPrepend=function(i){var n=this.left.leafPrepend(i);if(n)return new e(n,this.right)},e.prototype.appendInner=function(i){return this.left.depth>=Math.max(this.right.depth,i.depth)+1?new e(this.left,new e(this.right,i)):new e(this,i)},e})(Ge);const Dq=500;class Ut{constructor(e,t){this.items=e,this.eventCount=t}popEvent(e,t){if(this.eventCount==0)return null;let i=this.items.length;for(;;i--)if(this.items.get(i-1).selection){--i;break}let n,a;t&&(n=this.remapping(i,this.items.length),a=n.maps.length);let l=e.tr,s,p,d=[],c=[];return this.items.forEach((b,m)=>{if(!b.step){n||(n=this.remapping(i,m+1),a=n.maps.length),a--,c.push(b);return}if(n){c.push(new nr(b.map));let g=b.step.map(n.slice(a)),x;g&&l.maybeStep(g).doc&&(x=l.mapping.maps[l.mapping.maps.length-1],d.push(new nr(x,void 0,void 0,d.length+c.length))),a--,x&&n.appendMap(x,a)}else l.maybeStep(b.step);if(b.selection)return s=n?b.selection.map(n.slice(a)):b.selection,p=new Ut(this.items.slice(0,i).append(c.reverse().concat(d)),this.eventCount-1),!1},this.items.length,0),{remaining:p,transform:l,selection:s}}addTransform(e,t,i,n){let a=[],l=this.eventCount,s=this.items,p=!n&&s.length?s.get(s.length-1):null;for(let c=0;c<e.steps.length;c++){let b=e.steps[c].invert(e.docs[c]),m=new nr(e.mapping.maps[c],b,t),g;(g=p&&p.merge(m))&&(m=g,c?a.pop():s=s.slice(0,s.length-1)),a.push(m),t&&(l++,t=void 0),n||(p=m)}let d=l-i.depth;return d>Iq&&(s=zq(s,d),l-=d),new Ut(s.append(a),l)}remapping(e,t){let i=new Ji;return this.items.forEach((n,a)=>{let l=n.mirrorOffset!=null&&a-n.mirrorOffset>=e?i.maps.length-n.mirrorOffset:void 0;i.appendMap(n.map,l)},e,t),i}addMaps(e){return this.eventCount==0?this:new Ut(this.items.append(e.map(t=>new nr(t))),this.eventCount)}rebased(e,t){if(!this.eventCount)return this;let i=[],n=Math.max(0,this.items.length-t),a=e.mapping,l=e.steps.length,s=this.eventCount;this.items.forEach(m=>{m.selection&&s--},n);let p=t;this.items.forEach(m=>{let g=a.getMirror(--p);if(g==null)return;l=Math.min(l,g);let x=a.maps[g];if(m.step){let u=e.steps[g].invert(e.docs[g]),h=m.selection&&m.selection.map(a.slice(p+1,g));h&&s++,i.push(new nr(x,u,h))}else i.push(new nr(x))},n);let d=[];for(let m=t;m<l;m++)d.push(new nr(a.maps[m]));let c=this.items.slice(0,n).append(d).append(i),b=new Ut(c,s);return b.emptyItemCount()>Dq&&(b=b.compress(this.items.length-i.length)),b}emptyItemCount(){let e=0;return this.items.forEach(t=>{t.step||e++}),e}compress(e=this.items.length){let t=this.remapping(0,e),i=t.maps.length,n=[],a=0;return this.items.forEach((l,s)=>{if(s>=e)n.push(l),l.selection&&a++;else if(l.step){let p=l.step.map(t.slice(i)),d=p&&p.getMap();if(i--,d&&t.appendMap(d,i),p){let c=l.selection&&l.selection.map(t.slice(i));c&&a++;let b=new nr(d.invert(),p,c),m,g=n.length-1;(m=n.length&&n[g].merge(b))?n[g]=m:n.push(b)}}else l.map&&i--},this.items.length,0),new Ut(Ge.from(n.reverse()),a)}}Ut.empty=new Ut(Ge.empty,0);function zq(r,e){let t;return r.forEach((i,n)=>{if(i.selection&&e--==0)return t=n,!1}),r.slice(t)}class nr{constructor(e,t,i,n){this.map=e,this.step=t,this.selection=i,this.mirrorOffset=n}merge(e){if(this.step&&e.step&&!e.selection){let t=e.step.merge(this.step);if(t)return new nr(t.getMap().invert(),t,this.selection)}}}class $r{constructor(e,t,i,n,a){this.done=e,this.undone=t,this.prevRanges=i,this.prevTime=n,this.prevComposition=a}}const Iq=20;function Vq(r,e,t,i){let n=t.getMeta(Oo),a;if(n)return n.historyState;t.getMeta(Oq)&&(r=new $r(r.done,r.undone,null,0,-1));let l=t.getMeta("appendedTransaction");if(t.steps.length==0)return r;if(l&&l.getMeta(Oo))return l.getMeta(Oo).redo?new $r(r.done.addTransform(t,void 0,i,Dl(e)),r.undone,T_(t.mapping.maps),r.prevTime,r.prevComposition):new $r(r.done,r.undone.addTransform(t,void 0,i,Dl(e)),null,r.prevTime,r.prevComposition);if(t.getMeta("addToHistory")!==!1&&!(l&&l.getMeta("addToHistory")===!1)){let s=t.getMeta("composition"),p=r.prevTime==0||!l&&r.prevComposition!=s&&(r.prevTime<(t.time||0)-i.newGroupDelay||!Hq(t,r.prevRanges)),d=l?Ed(r.prevRanges,t.mapping):T_(t.mapping.maps);return new $r(r.done.addTransform(t,p?e.selection.getBookmark():void 0,i,Dl(e)),Ut.empty,d,t.time,s??r.prevComposition)}else return(a=t.getMeta("rebased"))?new $r(r.done.rebased(t,a),r.undone.rebased(t,a),Ed(r.prevRanges,t.mapping),r.prevTime,r.prevComposition):new $r(r.done.addMaps(t.mapping.maps),r.undone.addMaps(t.mapping.maps),Ed(r.prevRanges,t.mapping),r.prevTime,r.prevComposition)}function Hq(r,e){if(!e)return!1;if(!r.docChanged)return!0;let t=!1;return r.mapping.maps[0].forEach((i,n)=>{for(let a=0;a<e.length;a+=2)i<=e[a+1]&&n>=e[a]&&(t=!0)}),t}function T_(r){let e=[];for(let t=r.length-1;t>=0&&e.length==0;t--)r[t].forEach((i,n,a,l)=>e.push(a,l));return e}function Ed(r,e){if(!r)return null;let t=[];for(let i=0;i<r.length;i+=2){let n=e.map(r[i],1),a=e.map(r[i+1],-1);n<=a&&t.push(n,a)}return t}function Rq(r,e,t){let i=Dl(e),n=Oo.get(e).spec.config,a=(t?r.undone:r.done).popEvent(e,i);if(!a)return null;let l=a.selection.resolve(a.transform.doc),s=(t?r.done:r.undone).addTransform(a.transform,e.selection.getBookmark(),n,i),p=new $r(t?s:a.remaining,t?a.remaining:s,null,0,-1);return a.transform.setSelection(l).setMeta(Oo,{redo:t,historyState:p})}let Md=!1,E_=null;function Dl(r){let e=r.plugins;if(E_!=e){Md=!1,E_=e;for(let t=0;t<e.length;t++)if(e[t].spec.historyPreserveItems){Md=!0;break}}return Md}const Oo=new Oe("history"),Oq=new Oe("closeHistory");function Fq(r={}){return r={depth:r.depth||100,newGroupDelay:r.newGroupDelay||500},new Me({key:Oo,state:{init(){return new $r(Ut.empty,Ut.empty,null,0,-1)},apply(e,t,i){return Vq(t,i,e,r)}},config:r,props:{handleDOMEvents:{beforeinput(e,t){let i=t.inputType,n=i=="historyUndo"?P_:i=="historyRedo"?B_:null;return!n||!e.editable?!1:(t.preventDefault(),n(e.state,e.dispatch))}}}})}function M_(r,e){return(t,i)=>{let n=Oo.getState(t);if(!n||(r?n.undone:n.done).eventCount==0)return!1;if(i){let a=Rq(n,t,r);a&&i(e?a.scrollIntoView():a)}return!0}}const P_=M_(!1,!0),B_=M_(!0,!0);Be.create({name:"characterCount",addOptions(){return{limit:null,autoTrim:!0,mode:"textSize",textCounter:r=>r.length,wordCounter:r=>r.split(" ").filter(e=>e!=="").length}},addStorage(){return{characters:()=>0,words:()=>0}},onBeforeCreate(){this.storage.characters=r=>{const e=(r==null?void 0:r.node)||this.editor.state.doc;if(((r==null?void 0:r.mode)||this.options.mode)==="textSize"){const i=e.textBetween(0,e.content.size,void 0," ");return this.options.textCounter(i)}return e.nodeSize},this.storage.words=r=>{const e=(r==null?void 0:r.node)||this.editor.state.doc,t=e.textBetween(0,e.content.size," "," ");return this.options.wordCounter(t)}},addProseMirrorPlugins(){let r=!1;return[new Me({key:new Oe("characterCount"),appendTransaction:(e,t,i)=>{if(r)return;const n=this.options.limit,a=this.options.autoTrim;if(n==null||n===0||a===!1){r=!0;return}const l=this.storage.characters({node:i.doc});if(l>n){const s=l-n,p=0,d=s;console.warn(`[CharacterCount] Initial content exceeded limit of ${n} characters. Content was automatically trimmed.`);const c=i.tr.deleteRange(p,d);return r=!0,c}r=!0},filterTransaction:(e,t)=>{const i=this.options.limit;if(!e.docChanged||i===0||i===null||i===void 0)return!0;const n=this.storage.characters({node:t.doc}),a=this.storage.characters({node:e.doc});if(a<=i||n>i&&a>i&&a<=n)return!0;if(n>i&&a>i&&a>n||!e.getMeta("paste"))return!1;const s=e.selection.$head.pos,p=a-i,d=s-p,c=s;return e.deleteRange(d,c),!(this.storage.characters({node:e.doc})>i)}})]}});var jq=Be.create({name:"dropCursor",addOptions(){return{color:"currentColor",width:1,class:void 0}},addProseMirrorPlugins(){return[Cq(this.options)]}});Be.create({name:"focus",addOptions(){return{className:"has-focus",mode:"all"}},addProseMirrorPlugins(){return[new Me({key:new Oe("focus"),props:{decorations:({doc:r,selection:e})=>{const{isEditable:t,isFocused:i}=this.editor,{anchor:n}=e,a=[];if(!t||!i)return Pe.create(r,[]);let l=0;this.options.mode==="deepest"&&r.descendants((p,d)=>{if(p.isText)return;if(!(n>=d&&n<=d+p.nodeSize-1))return!1;l+=1});let s=0;return r.descendants((p,d)=>{if(p.isText||!(n>=d&&n<=d+p.nodeSize-1))return!1;if(s+=1,this.options.mode==="deepest"&&l-s>0||this.options.mode==="shallowest"&&s>1)return this.options.mode==="deepest";a.push(ft.node(d,d+p.nodeSize,{class:this.options.className}))}),Pe.create(r,a)}}})]}});var qq=Be.create({name:"gapCursor",addProseMirrorPlugins(){return[Pq()]},extendNodeSchema(r){var e;const t={name:r.name,options:r.options,storage:r.storage};return{allowGapCursor:(e=he(te(r,"allowGapCursor",t)))!=null?e:null}}}),L_="placeholder",Mn=new Oe("tiptap__placeholder"),N_=200;function A_(r){const{editor:e,placeholder:t,dataAttribute:i,pos:n,node:a,isEmptyDoc:l,hasAnchor:s,classes:{emptyNode:p,emptyEditor:d}}=r,c=[p];return l&&c.push(d),ft.node(n,n+a.nodeSize,{class:c.join(" "),[i]:typeof t=="function"?t({editor:e,node:a,pos:n,hasAnchor:s}):t})}function __(r,e){return typeof r=="function"?r(e):r}function Uq({editor:r,options:e,dataAttribute:t,doc:i,selection:n}){var a,l;if(!(r.isEditable||!e.showOnlyWhenEditable))return null;const{anchor:p}=n,d=[],c=r.isEmpty;if(e.showOnlyCurrent&&!e.includeChildren){const m=i.resolve(p),g=m.depth>0?m.node(1):m.nodeAfter,x=m.depth>0?m.before(1):p;if(g&&g.type.isTextblock&&gn(g)){const u=p>=x&&p<=x+g.nodeSize;d.push(A_({editor:r,isEmptyDoc:c,dataAttribute:t,hasAnchor:u,placeholder:e.placeholder,classes:{emptyEditor:e.emptyEditorClass,emptyNode:__(e.emptyNodeClass,{editor:r,node:g,pos:x,hasAnchor:u})},node:g,pos:x}))}}else{const m=Mn.getState(r.state),g=(a=m==null?void 0:m.topPos)!=null?a:0,x=(l=m==null?void 0:m.bottomPos)!=null?l:i.content.size;i.nodesBetween(g,x,(u,h)=>{const f=p>=h&&p<=h+u.nodeSize,w=!u.isLeaf&&gn(u);return u.type.isTextblock&&(f||!e.showOnlyCurrent)&&w&&d.push(A_({editor:r,isEmptyDoc:c,dataAttribute:t,hasAnchor:f,placeholder:e.placeholder,classes:{emptyEditor:e.emptyEditorClass,emptyNode:__(e.emptyNodeClass,{editor:r,node:u,pos:h,hasAnchor:f})},node:u,pos:h})),e.includeChildren})}return Pe.create(i,d)}function Wq(r){return r.replace(/\s+/g,"-").replace(/[^a-zA-Z0-9-]/g,"").replace(/^[0-9-]+/,"").replace(/^-+/,"").toLowerCase()}function Gq(r){const e=getComputedStyle(r),t=`${e.overflow} ${e.overflowY} ${e.overflowX}`;return/auto|scroll|overlay/.test(t)}function Kq(r){let e=r;for(;e;){if(Gq(e))return e;const t=e.parentElement;if(!t){const i=e.getRootNode();if(i instanceof ShadowRoot){e=i.host;continue}return window}e=t}return window}function Jq(r){return r===window?{top:0,bottom:window.innerHeight}:r.getBoundingClientRect()}function Yq({view:r,scrollContainer:e}){const t=r.dom.getBoundingClientRect();if(t.width<=0||t.height<=0)return null;const i=e?Jq(e):{top:0,bottom:window.innerHeight},n=Math.max(t.top,i.top)-N_,a=Math.min(t.bottom,i.bottom)+N_;if(n>=a)return null;const l=t.left+1,s=t.right-1;if(l>s)return null;const d=getComputedStyle(r.dom).direction==="rtl"?t.right-2:t.left+2,c=Math.min(Math.max(d,l),s),b=Math.max(n+2,t.top+1),m=Math.min(a-2,t.bottom-1);if(b>m)return null;const g=r.posAtCoords({left:c,top:b}),x=r.posAtCoords({left:c,top:m});return!g||!x?null:{top:g.pos,bottom:x.pos}}var Qq={init(){return{topPos:null,bottomPos:null}},apply(r,e){const t=r.getMeta(Mn);return t!=null&&t.positions?{topPos:t.positions.top,bottomPos:t.positions.bottom}:r.docChanged?{topPos:e.topPos!==null?r.mapping.map(e.topPos):null,bottomPos:e.bottomPos!==null?r.mapping.map(e.bottomPos):null}:e}};function Xq(r){const e=Kq(r.dom),t=()=>{const d=Yq({view:r,scrollContainer:e});if(d===null)return;const c=Mn.getState(r.state);if((c==null?void 0:c.topPos)===d.top&&(c==null?void 0:c.bottomPos)===d.bottom)return;const b=r.state.tr.setMeta(Mn,{positions:d});r.dispatch(b)};let i=null,n=0;const a=150,l=()=>{i===null&&(i=requestAnimationFrame(()=>{i=null;const d=performance.now();d-n>=a?(n=d,t()):l()}))};e.addEventListener("scroll",l,{passive:!0});const s=typeof ResizeObserver<"u"?new ResizeObserver(l):null;s==null||s.observe(r.dom);const p=typeof IntersectionObserver<"u"?new IntersectionObserver(l):null;return p==null||p.observe(r.dom),r.dom.addEventListener("focus",l),t(),{update(d,c){r.state.doc.content.size!==c.doc.content.size&&l()},destroy:()=>{i!==null&&cancelAnimationFrame(i),e.removeEventListener("scroll",l),s==null||s.disconnect(),p==null||p.disconnect(),r.dom.removeEventListener("focus",l)}}}function Zq({editor:r,options:e}){const t=e.dataAttribute?`data-${Wq(e.dataAttribute)}`:`data-${L_}`;return new Me({key:Mn,state:Qq,view:Xq,props:{decorations:({doc:i,selection:n})=>Uq({editor:r,options:e,dataAttribute:t,doc:i,selection:n})}})}Be.create({name:"placeholder",addOptions(){return{emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",dataAttribute:L_,placeholder:"Write something …",showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){return[Zq({editor:this.editor,options:this.options})]}});var $q=`.ProseMirror:not(.ProseMirror-focused) *::selection {
157
+ `)}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleOrderedList:()=>({commands:r,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(gq,this.editor.getAttributes(y_)).run():r.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addProseMirrorPlugins(){return[new Me({props:{handlePaste:(r,e)=>{var t,i;const n=(t=e.clipboardData)==null?void 0:t.getData("text/html");if(n!=null&&n.trim())return!1;const a=(i=e.clipboardData)==null?void 0:i.getData("text/plain");if(!a)return!1;const l=bq(a);if(!l)return!1;try{const s=r.state.schema.nodeFromJSON(l),p=r.state.tr.replaceSelectionWith(s);return r.dispatch(p),!0}catch{return!1}}}})]},addInputRules(){const r=(t,i)=>(!i.attrs.type||i.attrs.type==="1")&&i.childCount+i.attrs.start===+t[1];let e=mi({find:w_,type:this.type,getAttributes:t=>({start:+t[1]}),joinPredicate:r});return(this.options.keepMarks||this.options.keepAttributes)&&(e=mi({find:w_,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:t=>({start:+t[1],...this.editor.getAttributes(y_)}),joinPredicate:r,editor:this.editor})),[e]}}),uq=/^\s*(\[([( |x])?\])\s$/,xq=Nt.create({name:"taskItem",addOptions(){return{nested:!1,HTMLAttributes:{},taskListTypeName:"taskList",a11y:void 0}},content(){return this.options.nested?"paragraph block*":"paragraph+"},defining:!0,addAttributes(){return{checked:{default:!1,keepOnSplit:!1,parseHTML:r=>{const e=r.getAttribute("data-checked");return e===""||e==="true"},renderHTML:r=>({"data-checked":r.checked})}}},parseHTML(){return[{tag:`li[data-type="${this.name}"]`,priority:51}]},renderHTML({node:r,HTMLAttributes:e}){return["li",je(this.options.HTMLAttributes,e,{"data-type":this.name}),["label",["input",{type:"checkbox",checked:r.attrs.checked?"checked":null}],["span"]],["div",0]]},parseMarkdown:(r,e)=>{const t=[];if(r.tokens&&r.tokens.length>0?t.push(e.createNode("paragraph",{},e.parseInline(r.tokens))):r.text?t.push(e.createNode("paragraph",{},[e.createNode("text",{text:r.text})])):t.push(e.createNode("paragraph",{},[])),r.nestedTokens&&r.nestedTokens.length>0){const i=e.parseChildren(r.nestedTokens);t.push(...i)}return e.createNode("taskItem",{checked:r.checked||!1},t)},renderMarkdown:(r,e)=>{var t;const n=`- [${(t=r.attrs)!=null&&t.checked?"x":" "}] `;return Hp(r,e,n)},addExtensions(){return this.options.nested?[d_(this.name,[this.options.taskListTypeName])]:[]},addKeyboardShortcuts(){const r={Enter:()=>this.editor.commands.splitListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)};return this.options.nested?{...r,Tab:()=>this.editor.commands.sinkListItem(this.name)}:r},addNodeView(){return({node:r,HTMLAttributes:e,getPos:t,editor:i})=>{const n=document.createElement("li"),a=document.createElement("label"),l=document.createElement("span"),s=document.createElement("input"),p=document.createElement("div"),d=b=>{var m,g;s.ariaLabel=((g=(m=this.options.a11y)==null?void 0:m.checkboxLabel)==null?void 0:g.call(m,b,s.checked))||`Task item checkbox for ${b.textContent||"empty task item"}`};d(r),a.contentEditable="false",s.type="checkbox",s.addEventListener("mousedown",b=>b.preventDefault()),s.addEventListener("change",b=>{if(!i.isEditable&&!this.options.onReadOnlyChecked){s.checked=!s.checked;return}const{checked:m}=b.target;i.isEditable&&typeof t=="function"&&i.chain().focus(void 0,{scrollIntoView:!1}).command(({tr:g})=>{const x=t();if(typeof x!="number")return!1;const u=g.doc.nodeAt(x);return g.setNodeMarkup(x,void 0,{...u==null?void 0:u.attrs,checked:m}),!0}).run(),!i.isEditable&&this.options.onReadOnlyChecked&&(this.options.onReadOnlyChecked(r,m)||(s.checked=!s.checked))}),Object.entries(this.options.HTMLAttributes).forEach(([b,m])=>{n.setAttribute(b,m)}),n.dataset.checked=r.attrs.checked,s.checked=r.attrs.checked,a.append(s,l),n.append(a,p),Object.entries(e).forEach(([b,m])=>{n.setAttribute(b,m)});let c=new Set(Object.keys(e));return{dom:n,contentDOM:p,update:b=>{if(b.type!==this.type)return!1;n.dataset.checked=b.attrs.checked,s.checked=b.attrs.checked,d(b);const m=i.extensionManager.attributes,g=cn(b,m),x=new Set(Object.keys(g)),u=this.options.HTMLAttributes;return c.forEach(h=>{x.has(h)||(h in u?n.setAttribute(h,u[h]):n.removeAttribute(h))}),Object.entries(g).forEach(([h,f])=>{f==null?h in u?n.setAttribute(h,u[h]):n.removeAttribute(h):n.setAttribute(h,f)}),c=x,!0}}}},addInputRules(){return[mi({find:uq,type:this.type,getAttributes:r=>({checked:r[r.length-1]==="x"})})]}}),hq=Nt.create({name:"taskList",addOptions(){return{itemTypeName:"taskItem",HTMLAttributes:{}}},group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:`ul[data-type="${this.name}"]`,priority:51}]},renderHTML({HTMLAttributes:r}){return["ul",je(this.options.HTMLAttributes,r,{"data-type":this.name}),0]},parseMarkdown:(r,e)=>e.createNode("taskList",{},e.parseChildren(r.items||[])),renderMarkdown:(r,e)=>r.content?e.renderChildren(r.content,`
158
+ `):"",markdownTokenizer:{name:"taskList",level:"block",start(r){var e;const t=(e=r.match(/^\s*[-+*]\s+\[([ xX])\]\s+/))==null?void 0:e.index;return t!==void 0?t:-1},tokenize(r,e,t){const i=a=>{const l=Vp(a,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:s=>({indentLevel:s[1].length,mainContent:s[4],checked:s[3].toLowerCase()==="x"}),createToken:(s,p)=>({type:"taskItem",raw:"",mainContent:s.mainContent,indentLevel:s.indentLevel,checked:s.checked,text:s.mainContent,tokens:t.inlineTokens(s.mainContent),nestedTokens:p}),customNestedParser:i},t);return l?[{type:"taskList",raw:l.raw,items:l.items}]:t.blockTokens(a)},n=Vp(r,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:a=>({indentLevel:a[1].length,mainContent:a[4],checked:a[3].toLowerCase()==="x"}),createToken:(a,l)=>({type:"taskItem",raw:"",mainContent:a.mainContent,indentLevel:a.indentLevel,checked:a.checked,text:a.mainContent,tokens:t.inlineTokens(a.mainContent),nestedTokens:l}),customNestedParser:i},t);if(n)return{type:"taskList",raw:n.raw,items:n.items}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleTaskList:()=>({commands:r})=>r.toggleList(this.name,this.options.itemTypeName)}},addKeyboardShortcuts(){return{"Mod-Shift-9":()=>this.editor.commands.toggleTaskList()}}});Be.create({name:"listKit",addExtensions(){const r=[];return this.options.bulletList!==!1&&r.push(p_.configure(this.options.bulletList)),this.options.listItem!==!1&&r.push(m_.configure(this.options.listItem)),this.options.listKeymap!==!1&&r.push(h_.configure(this.options.listKeymap)),this.options.orderedList!==!1&&r.push(k_.configure(this.options.orderedList)),this.options.taskItem!==!1&&r.push(xq.configure(this.options.taskItem)),this.options.taskList!==!1&&r.push(hq.configure(this.options.taskList)),r}});var Nl="&nbsp;",Cd=" ",fq=Nt.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:r}){return["p",je(this.options.HTMLAttributes,r),0]},parseMarkdown:(r,e)=>{const t=r.tokens||[];if(t.length===1&&t[0].type==="image")return e.parseChildren([t[0]]);const i=e.parseInline(t);return t.length===1&&t[0].type==="text"&&(t[0].raw===Nl||t[0].text===Nl||t[0].raw===Cd||t[0].text===Cd)&&i.length===1&&i[0].type==="text"&&(i[0].text===Nl||i[0].text===Cd)?e.createNode("paragraph",void 0,[]):e.createNode("paragraph",void 0,i)},renderMarkdown:(r,e,t)=>{var i,n;if(!r)return"";const a=Array.isArray(r.content)?r.content:[];if(a.length===0){const l=Array.isArray((i=t==null?void 0:t.previousNode)==null?void 0:i.content)?t.previousNode.content:[];return((n=t==null?void 0:t.previousNode)==null?void 0:n.type)==="paragraph"&&l.length===0?Nl:""}return e.renderChildren(a)},addCommands(){return{setParagraph:()=>({commands:r})=>r.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),yq=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,wq=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,vq=Do.create({name:"strike",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"s"},{tag:"del"},{tag:"strike"},{style:"text-decoration",consuming:!1,getAttrs:r=>r.includes("line-through")?{}:!1}]},renderHTML({HTMLAttributes:r}){return["s",je(this.options.HTMLAttributes,r),0]},markdownTokenName:"del",parseMarkdown:(r,e)=>e.applyMark("strike",e.parseInline(r.tokens||[])),renderMarkdown:(r,e)=>`~~${e.renderChildren(r)}~~`,addCommands(){return{setStrike:()=>({commands:r})=>r.setMark(this.name),toggleStrike:()=>({commands:r})=>r.toggleMark(this.name),unsetStrike:()=>({commands:r})=>r.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-s":()=>this.editor.commands.toggleStrike()}},addInputRules(){return[bi({find:yq,type:this.type})]},addPasteRules(){return[zo({find:wq,type:this.type})]}}),kq=Nt.create({name:"text",group:"inline",parseMarkdown:r=>({type:"text",text:r.text||""}),renderMarkdown:r=>r.text||""}),Sq=Do.create({name:"underline",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"u"},{style:"text-decoration",consuming:!1,getAttrs:r=>r.includes("underline")?{}:!1}]},renderHTML({HTMLAttributes:r}){return["u",je(this.options.HTMLAttributes,r),0]},parseMarkdown(r,e){return e.applyMark(this.name||"underline",e.parseInline(r.tokens||[]))},renderMarkdown(r,e){return`++${e.renderChildren(r)}++`},markdownTokenizer:{name:"underline",level:"inline",start(r){return r.indexOf("++")},tokenize(r,e,t){const n=/^(\+\+)([\s\S]+?)(\+\+)/.exec(r);if(!n)return;const a=n[2].trim();return{type:"underline",raw:n[0],text:a,tokens:t.inlineTokens(a)}}},addCommands(){return{setUnderline:()=>({commands:r})=>r.setMark(this.name),toggleUnderline:()=>({commands:r})=>r.toggleMark(this.name),unsetUnderline:()=>({commands:r})=>r.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-u":()=>this.editor.commands.toggleUnderline(),"Mod-U":()=>this.editor.commands.toggleUnderline()}}});function Cq(r={}){return new Me({view(e){return new Tq(e,r)}})}class Tq{constructor(e,t){var i;this.editorView=e,this.cursorPos=null,this.element=null,this.timeout=-1,this.width=(i=t.width)!==null&&i!==void 0?i:1,this.color=t.color===!1?void 0:t.color||"black",this.class=t.class,this.handlers=["dragover","dragend","drop","dragleave"].map(n=>{let a=l=>{this[n](l)};return e.dom.addEventListener(n,a),{name:n,handler:a}})}destroy(){this.handlers.forEach(({name:e,handler:t})=>this.editorView.dom.removeEventListener(e,t))}update(e,t){this.cursorPos!=null&&t.doc!=e.state.doc&&(this.cursorPos>e.state.doc.content.size?this.setCursor(null):this.updateOverlay())}setCursor(e){e!=this.cursorPos&&(this.cursorPos=e,e==null?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())}updateOverlay(){let e=this.editorView.state.doc.resolve(this.cursorPos),t=!e.parent.inlineContent,i,n=this.editorView.dom,a=n.getBoundingClientRect(),l=a.width/n.offsetWidth,s=a.height/n.offsetHeight;if(t){let b=e.nodeBefore,m=e.nodeAfter;if(b||m){let g=this.editorView.nodeDOM(this.cursorPos-(b?b.nodeSize:0));if(g){let x=g.getBoundingClientRect(),u=b?x.bottom:x.top;b&&m&&(u=(u+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let h=this.width/2*s;i={left:x.left,right:x.right,top:u-h,bottom:u+h}}}}if(!i){let b=this.editorView.coordsAtPos(this.cursorPos),m=this.width/2*l;i={left:b.left-m,right:b.left+m,top:b.top,bottom:b.bottom}}let p=this.editorView.dom.offsetParent;this.element||(this.element=p.appendChild(document.createElement("div")),this.class&&(this.element.className=this.class),this.element.style.cssText="position: absolute; z-index: 50; pointer-events: none;",this.color&&(this.element.style.backgroundColor=this.color)),this.element.classList.toggle("prosemirror-dropcursor-block",t),this.element.classList.toggle("prosemirror-dropcursor-inline",!t);let d,c;if(!p||p==document.body&&getComputedStyle(p).position=="static")d=-pageXOffset,c=-pageYOffset;else{let b=p.getBoundingClientRect(),m=b.width/p.offsetWidth,g=b.height/p.offsetHeight;d=b.left-p.scrollLeft*m,c=b.top-p.scrollTop*g}this.element.style.left=(i.left-d)/l+"px",this.element.style.top=(i.top-c)/s+"px",this.element.style.width=(i.right-i.left)/l+"px",this.element.style.height=(i.bottom-i.top)/s+"px"}scheduleRemoval(e){clearTimeout(this.timeout),this.timeout=setTimeout(()=>this.setCursor(null),e)}dragover(e){if(!this.editorView.editable)return;let t=this.editorView.posAtCoords({left:e.clientX,top:e.clientY}),i=t&&t.inside>=0&&this.editorView.state.doc.nodeAt(t.inside),n=i&&i.type.spec.disableDropCursor,a=typeof n=="function"?n(this.editorView,t,e):n;if(t&&!a){let l=t.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let s=qL(this.editorView.state.doc,l,this.editorView.dragging.slice);s!=null&&(l=s)}this.setCursor(l),this.scheduleRemoval(5e3)}}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(e){this.editorView.dom.contains(e.relatedTarget)||this.setCursor(null)}}class Ae extends de{constructor(e){super(e,e)}map(e,t){let i=e.resolve(t.map(this.head));return Ae.valid(i)?new Ae(i):de.near(i)}content(){return $.empty}eq(e){return e instanceof Ae&&e.head==this.head}toJSON(){return{type:"gapcursor",pos:this.head}}static fromJSON(e,t){if(typeof t.pos!="number")throw new RangeError("Invalid input for GapCursor.fromJSON");return new Ae(e.resolve(t.pos))}getBookmark(){return new Td(this.anchor)}static valid(e){let t=e.parent;if(t.inlineContent||!Eq(e)||!Mq(e))return!1;let i=t.type.spec.allowGapCursor;if(i!=null)return i;let n=t.contentMatchAt(e.index()).defaultType;return n&&n.isTextblock}static findGapCursorFrom(e,t,i=!1){e:for(;;){if(!i&&Ae.valid(e))return e;let n=e.pos,a=null;for(let l=e.depth;;l--){let s=e.node(l);if(t>0?e.indexAfter(l)<s.childCount:e.index(l)>0){a=s.child(t>0?e.indexAfter(l):e.index(l)-1);break}else if(l==0)return null;n+=t;let p=e.doc.resolve(n);if(Ae.valid(p))return p}for(;;){let l=t>0?a.firstChild:a.lastChild;if(!l){if(a.isAtom&&!a.isText&&!ae.isSelectable(a)){e=e.doc.resolve(n+a.nodeSize*t),i=!1;continue e}break}a=l,n+=t;let s=e.doc.resolve(n);if(Ae.valid(s))return s}return null}}}Ae.prototype.visible=!1,Ae.findFrom=Ae.findGapCursorFrom,de.jsonID("gapcursor",Ae);class Td{constructor(e){this.pos=e}map(e){return new Td(e.map(this.pos))}resolve(e){let t=e.resolve(this.pos);return Ae.valid(t)?new Ae(t):de.near(t)}}function S_(r){return r.isAtom||r.spec.isolating||r.spec.createGapCursor}function Eq(r){for(let e=r.depth;e>=0;e--){let t=r.index(e),i=r.node(e);if(t==0){if(i.type.spec.isolating)return!0;continue}for(let n=i.child(t-1);;n=n.lastChild){if(n.childCount==0&&!n.inlineContent||S_(n.type))return!0;if(n.inlineContent)return!1}}return!0}function Mq(r){for(let e=r.depth;e>=0;e--){let t=r.indexAfter(e),i=r.node(e);if(t==i.childCount){if(i.type.spec.isolating)return!0;continue}for(let n=i.child(t);;n=n.firstChild){if(n.childCount==0&&!n.inlineContent||S_(n.type))return!0;if(n.inlineContent)return!1}}return!0}function Pq(){return new Me({props:{decorations:Aq,createSelectionBetween(r,e,t){return e.pos==t.pos&&Ae.valid(t)?new Ae(t):null},handleClick:Lq,handleKeyDown:Bq,handleDOMEvents:{beforeinput:Nq}}})}const Bq=DA({ArrowLeft:Al("horiz",-1),ArrowRight:Al("horiz",1),ArrowUp:Al("vert",-1),ArrowDown:Al("vert",1)});function Al(r,e){const t=r=="vert"?e>0?"down":"up":e>0?"right":"left";return function(i,n,a){let l=i.selection,s=e>0?l.$to:l.$from,p=l.empty;if(l instanceof pe){if(!a.endOfTextblock(t)||s.depth==0)return!1;p=!1,s=i.doc.resolve(e>0?s.after():s.before())}let d=Ae.findGapCursorFrom(s,e,p);return d?(n&&n(i.tr.setSelection(new Ae(d))),!0):!1}}function Lq(r,e,t){if(!r||!r.editable)return!1;let i=r.state.doc.resolve(e);if(!Ae.valid(i))return!1;let n=r.posAtCoords({left:t.clientX,top:t.clientY});return n&&n.inside>-1&&ae.isSelectable(r.state.doc.nodeAt(n.inside))?!1:(r.dispatch(r.state.tr.setSelection(new Ae(i))),!0)}function Nq(r,e){if(e.inputType!="insertCompositionText"||!(r.state.selection instanceof Ae))return!1;let{$from:t}=r.state.selection,i=t.parent.contentMatchAt(t.index()).findWrapping(r.state.schema.nodes.text);if(!i)return!1;let n=G.empty;for(let l=i.length-1;l>=0;l--)n=G.from(i[l].createAndFill(null,n));let a=r.state.tr.replace(t.pos,t.pos,new $(n,0,0));return a.setSelection(pe.near(a.doc.resolve(t.pos+1))),r.dispatch(a),!1}function Aq(r){if(!(r.selection instanceof Ae))return null;let e=document.createElement("div");return e.className="ProseMirror-gapcursor",Pe.create(r.doc,[ft.widget(r.selection.head,e,{key:"gapcursor"})])}var _l=200,Ge=function(){};Ge.prototype.append=function(e){return e.length?(e=Ge.from(e),!this.length&&e||e.length<_l&&this.leafAppend(e)||this.length<_l&&e.leafPrepend(this)||this.appendInner(e)):this},Ge.prototype.prepend=function(e){return e.length?Ge.from(e).append(this):this},Ge.prototype.appendInner=function(e){return new _q(this,e)},Ge.prototype.slice=function(e,t){return e===void 0&&(e=0),t===void 0&&(t=this.length),e>=t?Ge.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,t))},Ge.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)},Ge.prototype.forEach=function(e,t,i){t===void 0&&(t=0),i===void 0&&(i=this.length),t<=i?this.forEachInner(e,t,i,0):this.forEachInvertedInner(e,t,i,0)},Ge.prototype.map=function(e,t,i){t===void 0&&(t=0),i===void 0&&(i=this.length);var n=[];return this.forEach(function(a,l){return n.push(e(a,l))},t,i),n},Ge.from=function(e){return e instanceof Ge?e:e&&e.length?new C_(e):Ge.empty};var C_=(function(r){function e(i){r.call(this),this.values=i}r&&(e.__proto__=r),e.prototype=Object.create(r&&r.prototype),e.prototype.constructor=e;var t={length:{configurable:!0},depth:{configurable:!0}};return e.prototype.flatten=function(){return this.values},e.prototype.sliceInner=function(n,a){return n==0&&a==this.length?this:new e(this.values.slice(n,a))},e.prototype.getInner=function(n){return this.values[n]},e.prototype.forEachInner=function(n,a,l,s){for(var p=a;p<l;p++)if(n(this.values[p],s+p)===!1)return!1},e.prototype.forEachInvertedInner=function(n,a,l,s){for(var p=a-1;p>=l;p--)if(n(this.values[p],s+p)===!1)return!1},e.prototype.leafAppend=function(n){if(this.length+n.length<=_l)return new e(this.values.concat(n.flatten()))},e.prototype.leafPrepend=function(n){if(this.length+n.length<=_l)return new e(n.flatten().concat(this.values))},t.length.get=function(){return this.values.length},t.depth.get=function(){return 0},Object.defineProperties(e.prototype,t),e})(Ge);Ge.empty=new C_([]);var _q=(function(r){function e(t,i){r.call(this),this.left=t,this.right=i,this.length=t.length+i.length,this.depth=Math.max(t.depth,i.depth)+1}return r&&(e.__proto__=r),e.prototype=Object.create(r&&r.prototype),e.prototype.constructor=e,e.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},e.prototype.getInner=function(i){return i<this.left.length?this.left.get(i):this.right.get(i-this.left.length)},e.prototype.forEachInner=function(i,n,a,l){var s=this.left.length;if(n<s&&this.left.forEachInner(i,n,Math.min(a,s),l)===!1||a>s&&this.right.forEachInner(i,Math.max(n-s,0),Math.min(this.length,a)-s,l+s)===!1)return!1},e.prototype.forEachInvertedInner=function(i,n,a,l){var s=this.left.length;if(n>s&&this.right.forEachInvertedInner(i,n-s,Math.max(a,s)-s,l+s)===!1||a<s&&this.left.forEachInvertedInner(i,Math.min(n,s),a,l)===!1)return!1},e.prototype.sliceInner=function(i,n){if(i==0&&n==this.length)return this;var a=this.left.length;return n<=a?this.left.slice(i,n):i>=a?this.right.slice(i-a,n-a):this.left.slice(i,a).append(this.right.slice(0,n-a))},e.prototype.leafAppend=function(i){var n=this.right.leafAppend(i);if(n)return new e(this.left,n)},e.prototype.leafPrepend=function(i){var n=this.left.leafPrepend(i);if(n)return new e(n,this.right)},e.prototype.appendInner=function(i){return this.left.depth>=Math.max(this.right.depth,i.depth)+1?new e(this.left,new e(this.right,i)):new e(this,i)},e})(Ge);const Dq=500;class Ut{constructor(e,t){this.items=e,this.eventCount=t}popEvent(e,t){if(this.eventCount==0)return null;let i=this.items.length;for(;;i--)if(this.items.get(i-1).selection){--i;break}let n,a;t&&(n=this.remapping(i,this.items.length),a=n.maps.length);let l=e.tr,s,p,d=[],c=[];return this.items.forEach((b,m)=>{if(!b.step){n||(n=this.remapping(i,m+1),a=n.maps.length),a--,c.push(b);return}if(n){c.push(new nr(b.map));let g=b.step.map(n.slice(a)),x;g&&l.maybeStep(g).doc&&(x=l.mapping.maps[l.mapping.maps.length-1],d.push(new nr(x,void 0,void 0,d.length+c.length))),a--,x&&n.appendMap(x,a)}else l.maybeStep(b.step);if(b.selection)return s=n?b.selection.map(n.slice(a)):b.selection,p=new Ut(this.items.slice(0,i).append(c.reverse().concat(d)),this.eventCount-1),!1},this.items.length,0),{remaining:p,transform:l,selection:s}}addTransform(e,t,i,n){let a=[],l=this.eventCount,s=this.items,p=!n&&s.length?s.get(s.length-1):null;for(let c=0;c<e.steps.length;c++){let b=e.steps[c].invert(e.docs[c]),m=new nr(e.mapping.maps[c],b,t),g;(g=p&&p.merge(m))&&(m=g,c?a.pop():s=s.slice(0,s.length-1)),a.push(m),t&&(l++,t=void 0),n||(p=m)}let d=l-i.depth;return d>Iq&&(s=zq(s,d),l-=d),new Ut(s.append(a),l)}remapping(e,t){let i=new Ji;return this.items.forEach((n,a)=>{let l=n.mirrorOffset!=null&&a-n.mirrorOffset>=e?i.maps.length-n.mirrorOffset:void 0;i.appendMap(n.map,l)},e,t),i}addMaps(e){return this.eventCount==0?this:new Ut(this.items.append(e.map(t=>new nr(t))),this.eventCount)}rebased(e,t){if(!this.eventCount)return this;let i=[],n=Math.max(0,this.items.length-t),a=e.mapping,l=e.steps.length,s=this.eventCount;this.items.forEach(m=>{m.selection&&s--},n);let p=t;this.items.forEach(m=>{let g=a.getMirror(--p);if(g==null)return;l=Math.min(l,g);let x=a.maps[g];if(m.step){let u=e.steps[g].invert(e.docs[g]),h=m.selection&&m.selection.map(a.slice(p+1,g));h&&s++,i.push(new nr(x,u,h))}else i.push(new nr(x))},n);let d=[];for(let m=t;m<l;m++)d.push(new nr(a.maps[m]));let c=this.items.slice(0,n).append(d).append(i),b=new Ut(c,s);return b.emptyItemCount()>Dq&&(b=b.compress(this.items.length-i.length)),b}emptyItemCount(){let e=0;return this.items.forEach(t=>{t.step||e++}),e}compress(e=this.items.length){let t=this.remapping(0,e),i=t.maps.length,n=[],a=0;return this.items.forEach((l,s)=>{if(s>=e)n.push(l),l.selection&&a++;else if(l.step){let p=l.step.map(t.slice(i)),d=p&&p.getMap();if(i--,d&&t.appendMap(d,i),p){let c=l.selection&&l.selection.map(t.slice(i));c&&a++;let b=new nr(d.invert(),p,c),m,g=n.length-1;(m=n.length&&n[g].merge(b))?n[g]=m:n.push(b)}}else l.map&&i--},this.items.length,0),new Ut(Ge.from(n.reverse()),a)}}Ut.empty=new Ut(Ge.empty,0);function zq(r,e){let t;return r.forEach((i,n)=>{if(i.selection&&e--==0)return t=n,!1}),r.slice(t)}class nr{constructor(e,t,i,n){this.map=e,this.step=t,this.selection=i,this.mirrorOffset=n}merge(e){if(this.step&&e.step&&!e.selection){let t=e.step.merge(this.step);if(t)return new nr(t.getMap().invert(),t,this.selection)}}}class $r{constructor(e,t,i,n,a){this.done=e,this.undone=t,this.prevRanges=i,this.prevTime=n,this.prevComposition=a}}const Iq=20;function Vq(r,e,t,i){let n=t.getMeta(Oo),a;if(n)return n.historyState;t.getMeta(Oq)&&(r=new $r(r.done,r.undone,null,0,-1));let l=t.getMeta("appendedTransaction");if(t.steps.length==0)return r;if(l&&l.getMeta(Oo))return l.getMeta(Oo).redo?new $r(r.done.addTransform(t,void 0,i,Dl(e)),r.undone,T_(t.mapping.maps),r.prevTime,r.prevComposition):new $r(r.done,r.undone.addTransform(t,void 0,i,Dl(e)),null,r.prevTime,r.prevComposition);if(t.getMeta("addToHistory")!==!1&&!(l&&l.getMeta("addToHistory")===!1)){let s=t.getMeta("composition"),p=r.prevTime==0||!l&&r.prevComposition!=s&&(r.prevTime<(t.time||0)-i.newGroupDelay||!Hq(t,r.prevRanges)),d=l?Ed(r.prevRanges,t.mapping):T_(t.mapping.maps);return new $r(r.done.addTransform(t,p?e.selection.getBookmark():void 0,i,Dl(e)),Ut.empty,d,t.time,s??r.prevComposition)}else return(a=t.getMeta("rebased"))?new $r(r.done.rebased(t,a),r.undone.rebased(t,a),Ed(r.prevRanges,t.mapping),r.prevTime,r.prevComposition):new $r(r.done.addMaps(t.mapping.maps),r.undone.addMaps(t.mapping.maps),Ed(r.prevRanges,t.mapping),r.prevTime,r.prevComposition)}function Hq(r,e){if(!e)return!1;if(!r.docChanged)return!0;let t=!1;return r.mapping.maps[0].forEach((i,n)=>{for(let a=0;a<e.length;a+=2)i<=e[a+1]&&n>=e[a]&&(t=!0)}),t}function T_(r){let e=[];for(let t=r.length-1;t>=0&&e.length==0;t--)r[t].forEach((i,n,a,l)=>e.push(a,l));return e}function Ed(r,e){if(!r)return null;let t=[];for(let i=0;i<r.length;i+=2){let n=e.map(r[i],1),a=e.map(r[i+1],-1);n<=a&&t.push(n,a)}return t}function Rq(r,e,t){let i=Dl(e),n=Oo.get(e).spec.config,a=(t?r.undone:r.done).popEvent(e,i);if(!a)return null;let l=a.selection.resolve(a.transform.doc),s=(t?r.done:r.undone).addTransform(a.transform,e.selection.getBookmark(),n,i),p=new $r(t?s:a.remaining,t?a.remaining:s,null,0,-1);return a.transform.setSelection(l).setMeta(Oo,{redo:t,historyState:p})}let Md=!1,E_=null;function Dl(r){let e=r.plugins;if(E_!=e){Md=!1,E_=e;for(let t=0;t<e.length;t++)if(e[t].spec.historyPreserveItems){Md=!0;break}}return Md}const Oo=new Fe("history"),Oq=new Fe("closeHistory");function Fq(r={}){return r={depth:r.depth||100,newGroupDelay:r.newGroupDelay||500},new Me({key:Oo,state:{init(){return new $r(Ut.empty,Ut.empty,null,0,-1)},apply(e,t,i){return Vq(t,i,e,r)}},config:r,props:{handleDOMEvents:{beforeinput(e,t){let i=t.inputType,n=i=="historyUndo"?P_:i=="historyRedo"?B_:null;return!n||!e.editable?!1:(t.preventDefault(),n(e.state,e.dispatch))}}}})}function M_(r,e){return(t,i)=>{let n=Oo.getState(t);if(!n||(r?n.undone:n.done).eventCount==0)return!1;if(i){let a=Rq(n,t,r);a&&i(e?a.scrollIntoView():a)}return!0}}const P_=M_(!1,!0),B_=M_(!0,!0);Be.create({name:"characterCount",addOptions(){return{limit:null,autoTrim:!0,mode:"textSize",textCounter:r=>r.length,wordCounter:r=>r.split(" ").filter(e=>e!=="").length}},addStorage(){return{characters:()=>0,words:()=>0}},onBeforeCreate(){this.storage.characters=r=>{const e=(r==null?void 0:r.node)||this.editor.state.doc;if(((r==null?void 0:r.mode)||this.options.mode)==="textSize"){const i=e.textBetween(0,e.content.size,void 0," ");return this.options.textCounter(i)}return e.nodeSize},this.storage.words=r=>{const e=(r==null?void 0:r.node)||this.editor.state.doc,t=e.textBetween(0,e.content.size," "," ");return this.options.wordCounter(t)}},addProseMirrorPlugins(){let r=!1;return[new Me({key:new Fe("characterCount"),appendTransaction:(e,t,i)=>{if(r)return;const n=this.options.limit,a=this.options.autoTrim;if(n==null||n===0||a===!1){r=!0;return}const l=this.storage.characters({node:i.doc});if(l>n){const s=l-n,p=0,d=s;console.warn(`[CharacterCount] Initial content exceeded limit of ${n} characters. Content was automatically trimmed.`);const c=i.tr.deleteRange(p,d);return r=!0,c}r=!0},filterTransaction:(e,t)=>{const i=this.options.limit;if(!e.docChanged||i===0||i===null||i===void 0)return!0;const n=this.storage.characters({node:t.doc}),a=this.storage.characters({node:e.doc});if(a<=i||n>i&&a>i&&a<=n)return!0;if(n>i&&a>i&&a>n||!e.getMeta("paste"))return!1;const s=e.selection.$head.pos,p=a-i,d=s-p,c=s;return e.deleteRange(d,c),!(this.storage.characters({node:e.doc})>i)}})]}});var jq=Be.create({name:"dropCursor",addOptions(){return{color:"currentColor",width:1,class:void 0}},addProseMirrorPlugins(){return[Cq(this.options)]}});Be.create({name:"focus",addOptions(){return{className:"has-focus",mode:"all"}},addProseMirrorPlugins(){return[new Me({key:new Fe("focus"),props:{decorations:({doc:r,selection:e})=>{const{isEditable:t,isFocused:i}=this.editor,{anchor:n}=e,a=[];if(!t||!i)return Pe.create(r,[]);let l=0;this.options.mode==="deepest"&&r.descendants((p,d)=>{if(p.isText)return;if(!(n>=d&&n<=d+p.nodeSize-1))return!1;l+=1});let s=0;return r.descendants((p,d)=>{if(p.isText||!(n>=d&&n<=d+p.nodeSize-1))return!1;if(s+=1,this.options.mode==="deepest"&&l-s>0||this.options.mode==="shallowest"&&s>1)return this.options.mode==="deepest";a.push(ft.node(d,d+p.nodeSize,{class:this.options.className}))}),Pe.create(r,a)}}})]}});var qq=Be.create({name:"gapCursor",addProseMirrorPlugins(){return[Pq()]},extendNodeSchema(r){var e;const t={name:r.name,options:r.options,storage:r.storage};return{allowGapCursor:(e=he(te(r,"allowGapCursor",t)))!=null?e:null}}}),L_="placeholder",Mn=new Fe("tiptap__placeholder"),N_=200;function A_(r){const{editor:e,placeholder:t,dataAttribute:i,pos:n,node:a,isEmptyDoc:l,hasAnchor:s,classes:{emptyNode:p,emptyEditor:d}}=r,c=[p];return l&&c.push(d),ft.node(n,n+a.nodeSize,{class:c.join(" "),[i]:typeof t=="function"?t({editor:e,node:a,pos:n,hasAnchor:s}):t})}function __(r,e){return typeof r=="function"?r(e):r}function Uq({editor:r,options:e,dataAttribute:t,doc:i,selection:n}){var a,l;if(!(r.isEditable||!e.showOnlyWhenEditable))return null;const{anchor:p}=n,d=[],c=r.isEmpty;if(e.showOnlyCurrent&&!e.includeChildren){const m=i.resolve(p),g=m.depth>0?m.node(1):m.nodeAfter,x=m.depth>0?m.before(1):p;if(g&&g.type.isTextblock&&gn(g)){const u=p>=x&&p<=x+g.nodeSize;d.push(A_({editor:r,isEmptyDoc:c,dataAttribute:t,hasAnchor:u,placeholder:e.placeholder,classes:{emptyEditor:e.emptyEditorClass,emptyNode:__(e.emptyNodeClass,{editor:r,node:g,pos:x,hasAnchor:u})},node:g,pos:x}))}}else{const m=Mn.getState(r.state),g=(a=m==null?void 0:m.topPos)!=null?a:0,x=(l=m==null?void 0:m.bottomPos)!=null?l:i.content.size;i.nodesBetween(g,x,(u,h)=>{const f=p>=h&&p<=h+u.nodeSize,w=!u.isLeaf&&gn(u);return u.type.isTextblock&&(f||!e.showOnlyCurrent)&&w&&d.push(A_({editor:r,isEmptyDoc:c,dataAttribute:t,hasAnchor:f,placeholder:e.placeholder,classes:{emptyEditor:e.emptyEditorClass,emptyNode:__(e.emptyNodeClass,{editor:r,node:u,pos:h,hasAnchor:f})},node:u,pos:h})),e.includeChildren})}return Pe.create(i,d)}function Wq(r){return r.replace(/\s+/g,"-").replace(/[^a-zA-Z0-9-]/g,"").replace(/^[0-9-]+/,"").replace(/^-+/,"").toLowerCase()}function Gq(r){const e=getComputedStyle(r),t=`${e.overflow} ${e.overflowY} ${e.overflowX}`;return/auto|scroll|overlay/.test(t)}function Kq(r){let e=r;for(;e;){if(Gq(e))return e;const t=e.parentElement;if(!t){const i=e.getRootNode();if(i instanceof ShadowRoot){e=i.host;continue}return window}e=t}return window}function Jq(r){return r===window?{top:0,bottom:window.innerHeight}:r.getBoundingClientRect()}function Yq({view:r,scrollContainer:e}){const t=r.dom.getBoundingClientRect();if(t.width<=0||t.height<=0)return null;const i=e?Jq(e):{top:0,bottom:window.innerHeight},n=Math.max(t.top,i.top)-N_,a=Math.min(t.bottom,i.bottom)+N_;if(n>=a)return null;const l=t.left+1,s=t.right-1;if(l>s)return null;const d=getComputedStyle(r.dom).direction==="rtl"?t.right-2:t.left+2,c=Math.min(Math.max(d,l),s),b=Math.max(n+2,t.top+1),m=Math.min(a-2,t.bottom-1);if(b>m)return null;const g=r.posAtCoords({left:c,top:b}),x=r.posAtCoords({left:c,top:m});return!g||!x?null:{top:g.pos,bottom:x.pos}}var Qq={init(){return{topPos:null,bottomPos:null}},apply(r,e){const t=r.getMeta(Mn);return t!=null&&t.positions?{topPos:t.positions.top,bottomPos:t.positions.bottom}:r.docChanged?{topPos:e.topPos!==null?r.mapping.map(e.topPos):null,bottomPos:e.bottomPos!==null?r.mapping.map(e.bottomPos):null}:e}};function Xq(r){const e=Kq(r.dom),t=()=>{const d=Yq({view:r,scrollContainer:e});if(d===null)return;const c=Mn.getState(r.state);if((c==null?void 0:c.topPos)===d.top&&(c==null?void 0:c.bottomPos)===d.bottom)return;const b=r.state.tr.setMeta(Mn,{positions:d});r.dispatch(b)};let i=null,n=0;const a=150,l=()=>{i===null&&(i=requestAnimationFrame(()=>{i=null;const d=performance.now();d-n>=a?(n=d,t()):l()}))};e.addEventListener("scroll",l,{passive:!0});const s=typeof ResizeObserver<"u"?new ResizeObserver(l):null;s==null||s.observe(r.dom);const p=typeof IntersectionObserver<"u"?new IntersectionObserver(l):null;return p==null||p.observe(r.dom),r.dom.addEventListener("focus",l),t(),{update(d,c){r.state.doc.content.size!==c.doc.content.size&&l()},destroy:()=>{i!==null&&cancelAnimationFrame(i),e.removeEventListener("scroll",l),s==null||s.disconnect(),p==null||p.disconnect(),r.dom.removeEventListener("focus",l)}}}function Zq({editor:r,options:e}){const t=e.dataAttribute?`data-${Wq(e.dataAttribute)}`:`data-${L_}`;return new Me({key:Mn,state:Qq,view:Xq,props:{decorations:({doc:i,selection:n})=>Uq({editor:r,options:e,dataAttribute:t,doc:i,selection:n})}})}Be.create({name:"placeholder",addOptions(){return{emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",dataAttribute:L_,placeholder:"Write something …",showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){return[Zq({editor:this.editor,options:this.options})]}});var $q=`.ProseMirror:not(.ProseMirror-focused) *::selection {
159
159
  background: transparent;
160
160
  }
161
161
 
162
162
  .ProseMirror:not(.ProseMirror-focused) *::-moz-selection {
163
163
  background: transparent;
164
- }`;Be.create({name:"selection",addOptions(){return{className:"selection"}},addProseMirrorPlugins(){const{editor:r,options:e}=this;return r.options.injectCSS&&typeof document<"u"&&d9($q,r.options.injectNonce,"selection"),[new Me({key:new Oe("selection"),props:{decorations(t){return t.selection.empty||r.isFocused||!r.isEditable||n9(t.selection)||r.view.dragging?null:Pe.create(t.doc,[ft.inline(t.selection.from,t.selection.to,{class:e.className})])}}})]}});var eU="skipTrailingNode";function D_({types:r,node:e}){return e&&Array.isArray(r)&&r.includes(e.type)||(e==null?void 0:e.type)===r}var tU=Be.create({name:"trailingNode",addOptions(){return{node:void 0,notAfter:[]}},addProseMirrorPlugins(){var r;const e=new Oe(this.name),t=this.options.node||((r=this.editor.schema.topNodeType.contentMatch.defaultType)==null?void 0:r.name)||"paragraph",i=Object.entries(this.editor.schema.nodes).map(([,n])=>n).filter(n=>(this.options.notAfter||[]).concat(t).includes(n.name));return[new Me({key:e,appendTransaction:(n,a,l)=>{const{doc:s,tr:p,schema:d}=l,c=e.getState(l),b=s.content.size,m=d.nodes[t];if(!n.some(g=>g.getMeta(eU))&&c)return p.insert(b,m.create())},state:{init:(n,a)=>{const l=a.tr.doc.lastChild;return!D_({node:l,types:i})},apply:(n,a)=>{if(!n.docChanged||n.getMeta("__uniqueIDTransaction"))return a;const l=n.doc.lastChild;return!D_({node:l,types:i})}}})]}}),rU=Be.create({name:"undoRedo",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:r,dispatch:e})=>P_(r,e),redo:()=>({state:r,dispatch:e})=>B_(r,e)}},addProseMirrorPlugins(){return[Fq(this.options)]},addKeyboardShortcuts(){return{"Mod-z":()=>this.editor.commands.undo(),"Shift-Mod-z":()=>this.editor.commands.redo(),"Mod-y":()=>this.editor.commands.redo(),"Mod-я":()=>this.editor.commands.undo(),"Shift-Mod-я":()=>this.editor.commands.redo()}}}),oU=Be.create({name:"starterKit",addExtensions(){var r,e,t,i;const n=[];return this.options.bold!==!1&&n.push(XF.configure(this.options.bold)),this.options.blockquote!==!1&&n.push(GF.configure(this.options.blockquote)),this.options.bulletList!==!1&&n.push(p_.configure(this.options.bulletList)),this.options.code!==!1&&n.push(ej.configure(this.options.code)),this.options.codeBlock!==!1&&n.push(oj.configure(this.options.codeBlock)),this.options.document!==!1&&n.push(ij.configure(this.options.document)),this.options.dropcursor!==!1&&n.push(jq.configure(this.options.dropcursor)),this.options.gapcursor!==!1&&n.push(qq.configure(this.options.gapcursor)),this.options.hardBreak!==!1&&n.push(nj.configure(this.options.hardBreak)),this.options.heading!==!1&&n.push(aj.configure(this.options.heading)),this.options.undoRedo!==!1&&n.push(rU.configure(this.options.undoRedo)),this.options.horizontalRule!==!1&&n.push(lj.configure(this.options.horizontalRule)),this.options.italic!==!1&&n.push(bj.configure(this.options.italic)),this.options.listItem!==!1&&n.push(m_.configure(this.options.listItem)),this.options.listKeymap!==!1&&n.push(h_.configure((r=this.options)==null?void 0:r.listKeymap)),this.options.link!==!1&&n.push(Hj.configure((e=this.options)==null?void 0:e.link)),this.options.orderedList!==!1&&n.push(k_.configure(this.options.orderedList)),this.options.paragraph!==!1&&n.push(fq.configure(this.options.paragraph)),this.options.strike!==!1&&n.push(vq.configure(this.options.strike)),this.options.text!==!1&&n.push(kq.configure(this.options.text)),this.options.underline!==!1&&n.push(Sq.configure((t=this.options)==null?void 0:t.underline)),this.options.trailingNode!==!1&&n.push(tU.configure((i=this.options)==null?void 0:i.trailingNode)),n}}),z_=oU;function zl(r,e,t){return Array.isArray(r)?(r.length=Math.max(r.length,e),r.splice(e,1,t),t):(r[e]=t,t)}function Pd(r,e){if(Array.isArray(r)){r.splice(e,1);return}delete r[e]}function iU(){return I_().__VUE_DEVTOOLS_GLOBAL_HOOK__}function I_(){return typeof navigator<"u"&&typeof window<"u"?window:typeof globalThis<"u"?globalThis:{}}const nU=typeof Proxy=="function",aU="devtools-plugin:setup",lU="plugin:settings:set";let fi,Bd;function sU(){var r;return fi!==void 0||(typeof window<"u"&&window.performance?(fi=!0,Bd=window.performance):typeof globalThis<"u"&&(!((r=globalThis.perf_hooks)===null||r===void 0)&&r.performance)?(fi=!0,Bd=globalThis.perf_hooks.performance):fi=!1),fi}function pU(){return sU()?Bd.now():Date.now()}class dU{constructor(e,t){this.target=null,this.targetQueue=[],this.onQueue=[],this.plugin=e,this.hook=t;const i={};if(e.settings)for(const l in e.settings){const s=e.settings[l];i[l]=s.defaultValue}const n=`__vue-devtools-plugin-settings__${e.id}`;let a=Object.assign({},i);try{const l=localStorage.getItem(n),s=JSON.parse(l);Object.assign(a,s)}catch{}this.fallbacks={getSettings(){return a},setSettings(l){try{localStorage.setItem(n,JSON.stringify(l))}catch{}a=l},now(){return pU()}},t&&t.on(lU,(l,s)=>{l===this.plugin.id&&this.fallbacks.setSettings(s)}),this.proxiedOn=new Proxy({},{get:(l,s)=>this.target?this.target.on[s]:(...p)=>{this.onQueue.push({method:s,args:p})}}),this.proxiedTarget=new Proxy({},{get:(l,s)=>this.target?this.target[s]:s==="on"?this.proxiedOn:Object.keys(this.fallbacks).includes(s)?(...p)=>(this.targetQueue.push({method:s,args:p,resolve:()=>{}}),this.fallbacks[s](...p)):(...p)=>new Promise(d=>{this.targetQueue.push({method:s,args:p,resolve:d})})})}async setRealTarget(e){this.target=e;for(const t of this.onQueue)this.target.on[t.method](...t.args);for(const t of this.targetQueue)t.resolve(await this.target[t.method](...t.args))}}function V_(r,e){const t=r,i=I_(),n=iU(),a=nU&&t.enableEarlyProxy;if(n&&(i.__VUE_DEVTOOLS_PLUGIN_API_AVAILABLE__||!a))n.emit(aU,r,e);else{const l=a?new dU(t,n):null;(i.__VUE_DEVTOOLS_PLUGINS__=i.__VUE_DEVTOOLS_PLUGINS__||[]).push({pluginDescriptor:t,setupFn:e,proxy:l}),l&&e(l.proxiedTarget)}}/*!
164
+ }`;Be.create({name:"selection",addOptions(){return{className:"selection"}},addProseMirrorPlugins(){const{editor:r,options:e}=this;return r.options.injectCSS&&typeof document<"u"&&d9($q,r.options.injectNonce,"selection"),[new Me({key:new Fe("selection"),props:{decorations(t){return t.selection.empty||r.isFocused||!r.isEditable||n9(t.selection)||r.view.dragging?null:Pe.create(t.doc,[ft.inline(t.selection.from,t.selection.to,{class:e.className})])}}})]}});var eU="skipTrailingNode";function D_({types:r,node:e}){return e&&Array.isArray(r)&&r.includes(e.type)||(e==null?void 0:e.type)===r}var tU=Be.create({name:"trailingNode",addOptions(){return{node:void 0,notAfter:[]}},addProseMirrorPlugins(){var r;const e=new Fe(this.name),t=this.options.node||((r=this.editor.schema.topNodeType.contentMatch.defaultType)==null?void 0:r.name)||"paragraph",i=Object.entries(this.editor.schema.nodes).map(([,n])=>n).filter(n=>(this.options.notAfter||[]).concat(t).includes(n.name));return[new Me({key:e,appendTransaction:(n,a,l)=>{const{doc:s,tr:p,schema:d}=l,c=e.getState(l),b=s.content.size,m=d.nodes[t];if(!n.some(g=>g.getMeta(eU))&&c)return p.insert(b,m.create())},state:{init:(n,a)=>{const l=a.tr.doc.lastChild;return!D_({node:l,types:i})},apply:(n,a)=>{if(!n.docChanged||n.getMeta("__uniqueIDTransaction"))return a;const l=n.doc.lastChild;return!D_({node:l,types:i})}}})]}}),rU=Be.create({name:"undoRedo",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:r,dispatch:e})=>P_(r,e),redo:()=>({state:r,dispatch:e})=>B_(r,e)}},addProseMirrorPlugins(){return[Fq(this.options)]},addKeyboardShortcuts(){return{"Mod-z":()=>this.editor.commands.undo(),"Shift-Mod-z":()=>this.editor.commands.redo(),"Mod-y":()=>this.editor.commands.redo(),"Mod-я":()=>this.editor.commands.undo(),"Shift-Mod-я":()=>this.editor.commands.redo()}}}),oU=Be.create({name:"starterKit",addExtensions(){var r,e,t,i;const n=[];return this.options.bold!==!1&&n.push(XF.configure(this.options.bold)),this.options.blockquote!==!1&&n.push(GF.configure(this.options.blockquote)),this.options.bulletList!==!1&&n.push(p_.configure(this.options.bulletList)),this.options.code!==!1&&n.push(ej.configure(this.options.code)),this.options.codeBlock!==!1&&n.push(oj.configure(this.options.codeBlock)),this.options.document!==!1&&n.push(ij.configure(this.options.document)),this.options.dropcursor!==!1&&n.push(jq.configure(this.options.dropcursor)),this.options.gapcursor!==!1&&n.push(qq.configure(this.options.gapcursor)),this.options.hardBreak!==!1&&n.push(nj.configure(this.options.hardBreak)),this.options.heading!==!1&&n.push(aj.configure(this.options.heading)),this.options.undoRedo!==!1&&n.push(rU.configure(this.options.undoRedo)),this.options.horizontalRule!==!1&&n.push(lj.configure(this.options.horizontalRule)),this.options.italic!==!1&&n.push(bj.configure(this.options.italic)),this.options.listItem!==!1&&n.push(m_.configure(this.options.listItem)),this.options.listKeymap!==!1&&n.push(h_.configure((r=this.options)==null?void 0:r.listKeymap)),this.options.link!==!1&&n.push(Hj.configure((e=this.options)==null?void 0:e.link)),this.options.orderedList!==!1&&n.push(k_.configure(this.options.orderedList)),this.options.paragraph!==!1&&n.push(fq.configure(this.options.paragraph)),this.options.strike!==!1&&n.push(vq.configure(this.options.strike)),this.options.text!==!1&&n.push(kq.configure(this.options.text)),this.options.underline!==!1&&n.push(Sq.configure((t=this.options)==null?void 0:t.underline)),this.options.trailingNode!==!1&&n.push(tU.configure((i=this.options)==null?void 0:i.trailingNode)),n}}),z_=oU;function zl(r,e,t){return Array.isArray(r)?(r.length=Math.max(r.length,e),r.splice(e,1,t),t):(r[e]=t,t)}function Pd(r,e){if(Array.isArray(r)){r.splice(e,1);return}delete r[e]}function iU(){return I_().__VUE_DEVTOOLS_GLOBAL_HOOK__}function I_(){return typeof navigator<"u"&&typeof window<"u"?window:typeof globalThis<"u"?globalThis:{}}const nU=typeof Proxy=="function",aU="devtools-plugin:setup",lU="plugin:settings:set";let fi,Bd;function sU(){var r;return fi!==void 0||(typeof window<"u"&&window.performance?(fi=!0,Bd=window.performance):typeof globalThis<"u"&&(!((r=globalThis.perf_hooks)===null||r===void 0)&&r.performance)?(fi=!0,Bd=globalThis.perf_hooks.performance):fi=!1),fi}function pU(){return sU()?Bd.now():Date.now()}class dU{constructor(e,t){this.target=null,this.targetQueue=[],this.onQueue=[],this.plugin=e,this.hook=t;const i={};if(e.settings)for(const l in e.settings){const s=e.settings[l];i[l]=s.defaultValue}const n=`__vue-devtools-plugin-settings__${e.id}`;let a=Object.assign({},i);try{const l=localStorage.getItem(n),s=JSON.parse(l);Object.assign(a,s)}catch{}this.fallbacks={getSettings(){return a},setSettings(l){try{localStorage.setItem(n,JSON.stringify(l))}catch{}a=l},now(){return pU()}},t&&t.on(lU,(l,s)=>{l===this.plugin.id&&this.fallbacks.setSettings(s)}),this.proxiedOn=new Proxy({},{get:(l,s)=>this.target?this.target.on[s]:(...p)=>{this.onQueue.push({method:s,args:p})}}),this.proxiedTarget=new Proxy({},{get:(l,s)=>this.target?this.target[s]:s==="on"?this.proxiedOn:Object.keys(this.fallbacks).includes(s)?(...p)=>(this.targetQueue.push({method:s,args:p,resolve:()=>{}}),this.fallbacks[s](...p)):(...p)=>new Promise(d=>{this.targetQueue.push({method:s,args:p,resolve:d})})})}async setRealTarget(e){this.target=e;for(const t of this.onQueue)this.target.on[t.method](...t.args);for(const t of this.targetQueue)t.resolve(await this.target[t.method](...t.args))}}function V_(r,e){const t=r,i=I_(),n=iU(),a=nU&&t.enableEarlyProxy;if(n&&(i.__VUE_DEVTOOLS_PLUGIN_API_AVAILABLE__||!a))n.emit(aU,r,e);else{const l=a?new dU(t,n):null;(i.__VUE_DEVTOOLS_PLUGINS__=i.__VUE_DEVTOOLS_PLUGINS__||[]).push({pluginDescriptor:t,setupFn:e,proxy:l}),l&&e(l.proxiedTarget)}}/*!
165
165
  * pinia v2.3.1
166
166
  * (c) 2025 Eduardo San Martin Morote
167
167
  * @license MIT
@@ -361,9 +361,9 @@ This will fail in production.`);s=Pn,s._s.has(i)||(a?Dd(i,e,n,s):tD(i,n,s),proce
361
361
  <`).trim()}const hz=["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"];function fz(r,e=!1){if(e){const t=hz.map(i=>`&lt;${i}`);return r.endsWith("/&gt;")||t.some(i=>r.startsWith(i))}return r.endsWith("/>")||hz.some(t=>r.startsWith(`<${t}`))}function G$(r){if(!r)return"";const e=xz(r),t=" ";let i=0,n="";return e.split(/(<[\s\S]*?>)/g).forEach(l=>{const s=l.trim();if(!s)return;const p=s.startsWith("<")&&s.endsWith(">"),d=p&&s.startsWith("</");d&&(i=Math.max(0,i-1));const c=t.repeat(i);n+=`${c}${s}
362
362
  `,p&&!d&&!fz(s)&&i++}),n.trimEnd()}function K$(r){const e=r.match(/^&lt;(\/?)([\w-]+)(.*?)(\/?)&gt;$/);if(!e)return r;const[,t,i,n,a]=e,l=t==="/",s=n.trim(),p=l?`<span class="html-tag-symbol">&lt;/</span><span class="html-tag-name">${i}</span>`:`<span class="html-tag-symbol">&lt;</span><span class="html-tag-name">${i}</span>`,d=s.replace(/([\w-]+)=(&quot;[\s\S]*?&quot;)/g,'<span class="html-attribute-name">$1</span><span class="html-operator">=</span><span class="html-attribute-value">$2</span>'),c=a?'<span class="html-tag-symbol"> /&gt;</span>':'<span class="html-tag-symbol">&gt;</span>';return d?`${p} ${d}${c}`:`${p}${c}`}function J$(r){if(!r)return"";const e=xz(r),t=" ";let i=0,n="";return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;").split(/(&lt;[\s\S]*?&gt;)/g).forEach(s=>{const p=s.trim();if(!p)return;const d=p.startsWith("&lt;")&&p.endsWith("&gt;"),c=d&&p.startsWith("&lt;/");c&&(i=Math.max(0,i-1));const b=t.repeat(i);if(!d){n+=`${b}<span class="html-text-content">${p}</span>
363
363
  `;return}n+=b+K$(p)+`
364
- `,!c&&!fz(p,!0)&&i++}),n.trimEnd()}function je(r=200){return new Promise(e=>{setTimeout(e,r)})}const ns=o.ref(!1),yz=o.ref(""),as=o.ref(""),sc=o.ref("element"),Mi=o.ref(!1),Vn=o.ref(null);function ls(){function r(i,n,a="element"){yz.value=i,as.value=G$(n),sc.value=a,Vn.value=null,Mi.value=!1,ns.value=!0}function e(){ns.value=!1,Vn.value=null,Mi.value=!1}async function t(){const i=ke(),{showToast:n}=tt(),{translate:a}=ne();Mi.value=!0,Vn.value=null,await je(300);const l=sc.value==="page"?await i.applyModifiedComponents(as.value):await i.applyModifiedHTML(as.value);if(l){Vn.value=l,n(l,"error"),Mi.value=!1;return}n(a("HTML updated successfully"),"success"),ns.value=!1,Mi.value=!1}return{show:ns,title:yz,html:as,mode:sc,isLoading:Mi,error:Vn,openHtmlEditor:r,closeHtmlEditor:e,saveHtmlEditor:t}}const Y$={class:"pbx-editorSectionDesc"},Q$={class:"pbx-inspectorActionStack"},X$=o.defineComponent({name:"ElementHtmlEditorSettingsEditor",__name:"ElementHtmlEditorSettingsEditor",setup(r){const{translate:e}=ne(),t=fe,{openHtmlViewer:i}=is(),{openHtmlEditor:n}=ls(),a=o.computed(()=>t.getElement),l=()=>{a.value&&n(e("Element HTML"),a.value.outerHTML,"element")},s=()=>{a.value&&i(e("Element HTML"),a.value.outerHTML)};return(p,d)=>(o.openBlock(),o.createBlock(Re,null,{title:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(o.unref(e)("Element HTML")),1)]),content:o.withCtx(()=>[o.createElementVNode("p",Y$,o.toDisplayString(o.unref(e)("Element HTML editor description")),1),o.createElementVNode("div",Q$,[o.createVNode(Mr,{icon:"visibility",label:o.unref(e)("View element HTML"),hint:o.unref(e)("Preview selected element markup"),onClick:s},null,8,["label","hint"]),o.createVNode(Mr,{icon:"deployed_code",label:o.unref(e)("Open element HTML editor"),hint:o.unref(e)("Edit selected element markup"),onClick:l},null,8,["label","hint"])])]),_:1}))}});function Z$(r){return new Promise((e,t)=>{const i=new window.Image;i.onload=e,i.onerror=t,i.src=r})}const $$={class:"pbx-editorFieldGroup"},eee={class:"pbx-editorFieldGroup"},tee=["src"],ree={class:"pbx-editorFieldGroup pbx-rounded-lg pbx-border pbx-border-solid pbx-border-gray-200 pbx-bg-gray-50 pbx-px-4 pbx-py-8 pbx-text-center"},oee={class:"pbx-editorSectionDesc pbx-mb-0"},iee=o.defineComponent({__name:"ImageEditor",setup(r){const{translate:e}=ne(),t=fe,i=o.inject("CustomMediaComponent",null),n=o.ref(null),a=o.ref(!1),l=o.ref(!1),s=o.ref(""),p=o.ref(""),d=o.ref(""),c=o.ref(null),b=o.ref(null),m=o.ref(null),g=o.computed(()=>(t.getBasePrimaryImage&&f(t.getBasePrimaryImage),t.getBasePrimaryImage));function x(w){return w?w.tagName==="IMG"?!0:!!t.getBasePrimaryImage:!1}function u(w){var y;x(w)&&((y=n.value)==null||y.open())}o.watch(()=>t.getElement,w=>{u(w)},{immediate:!0,flush:"post"}),o.watch(()=>t.getBasePrimaryImage,()=>{u(t.getElement)}),o.onMounted(()=>{o.nextTick(()=>{u(t.getElement)})});const h=function(){l.value=!0,s.value=e("Media Library"),p.value=null,d.value=e("Close"),c.value=e("Select image"),m.value=function(){l.value=!1}},f=async function(w){a.value=!0,w&&typeof w=="string"&&w.length>2&&(await Z$(w),await je(200),a.value=!1)};return(w,y)=>(o.openBlock(),o.createElementBlock(o.Fragment,null,[o.createVNode(Re,{ref_key:"imageAccordionRef",ref:n},{title:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(o.unref(e)("Image")),1)]),content:o.withCtx(()=>[o.withDirectives(o.createElementVNode("div",$$,[...y[1]||(y[1]=[o.createElementVNode("div",{class:"pbx-flex pbx-min-h-40 pbx-items-center pbx-justify-center"},[o.createElementVNode("div",{class:"pbx-inline-block pbx-h-8 pbx-w-8 pbx-animate-spin pbx-rounded-full pbx-border-4 pbx-border-solid pbx-border-current pbx-border-r-transparent pbx-align-[-0.125em] motion-reduce:pbx-animate-[spin_1.5s_linear_infinite]"},[o.createElementVNode("span",{class:"!pbx-absolute !pbx-m-px !pbx-h-px !pbx-w-px !pbx-overflow-hidden !pbx-whitespace-nowrap !pbx-border-0 !pbx-p-0 !pbx-[clip:rect(0,0,0,0)]"},"Loading...")])],-1)])],512),[[o.vShow,a.value]]),o.withDirectives(o.createElementVNode("div",eee,[o.createElementVNode("img",{class:"pbx-w-full pbx-cursor-pointer pbx-rounded-lg pbx-object-cover pbx-object-center",src:g.value??void 0,onClick:h,alt:"image"},null,8,tee)],512),[[o.vShow,g.value&&!a.value]]),o.withDirectives(o.createElementVNode("div",ree,[o.createElementVNode("p",oee,o.toDisplayString(o.unref(e)("No image has been selected.")),1)],512),[[o.vShow,!a.value&&!g.value]])]),_:1},512),o.createVNode(TD,{open:l.value,title:s.value,description:p.value,firstButtonText:d.value,secondButtonText:c.value??void 0,thirdButtonText:b.value??void 0,customMediaComponent:o.unref(i)??void 0,onFirstMediaButtonFunction:y[0]||(y[0]=()=>{var E;return(E=m.value)==null?void 0:E.call(m)})},null,8,["open","title","description","firstButtonText","secondButtonText","thirdButtonText","customMediaComponent"])],64))}}),ss={opacities:["none","pbx-opacity-0","pbx-opacity-5","pbx-opacity-10","pbx-opacity-20","pbx-opacity-25","pbx-opacity-30","pbx-opacity-40","pbx-opacity-50","pbx-opacity-60","pbx-opacity-70","pbx-opacity-75","pbx-opacity-80","pbx-opacity-90","pbx-opacity-95","pbx-opacity-100"],backgroundOpacities:["none","pbx-bg-opacity-0","pbx-bg-opacity-5","pbx-bg-opacity-10","pbx-bg-opacity-20","pbx-bg-opacity-25","pbx-bg-opacity-30","pbx-bg-opacity-40","pbx-bg-opacity-50","pbx-bg-opacity-60","pbx-bg-opacity-70","pbx-bg-opacity-75","pbx-bg-opacity-80","pbx-bg-opacity-90","pbx-bg-opacity-95","pbx-bg-opacity-100"]},nee={class:"pbx-editorFieldGroup"},aee={class:"pbx-relative"},lee={class:"pbx-flex pbx-items-center pbx-gap-2"},see={key:0},pee={class:"pbx-flex pbx-items-center"},dee={key:0},cee={key:2,class:"pbx-ml-3"},bee={key:3,class:"pbx-ml-3"},mee=o.defineComponent({__name:"BackgroundOpacityControl",setup(r){const e=ke(),{translate:t}=ne(),i=fe,n=o.ref(null),a=o.computed(()=>i.getBackgroundOpacity);return o.watch(a,async l=>{n.value=l,await e.initializeElementStyles()},{immediate:!0}),(l,s)=>(o.openBlock(),o.createElementBlock("div",nee,[o.createVNode(o.unref(_n),{as:"div",modelValue:n.value,"onUpdate:modelValue":s[0]||(s[0]=p=>n.value=p)},{default:o.withCtx(()=>[o.createElementVNode("div",aee,[o.createVNode(o.unref(Dn),{class:"pbx-myPrimarySelect",id:"bg-opacity"},{default:o.withCtx(()=>[o.createElementVNode("span",lee,[n.value==="none"?(o.openBlock(),o.createElementBlock("div",see,[...s[1]||(s[1]=[o.createElementVNode("div",{class:"pbx-myPrimaryColorPreview pbx-border-none"},[o.createElementVNode("span",{class:"material-symbols-outlined"}," ev_shadow ")],-1)])])):o.createCommentVNode("",!0),n.value!=="none"?(o.openBlock(),o.createElementBlock("div",{key:1,class:o.normalizeClass(["pbx-aspect-square pbx-w-6 pbx-h-6 pbx-bg-gray-950",`${n.value}`])},null,2)):o.createCommentVNode("",!0),o.createElementVNode("span",{class:o.normalizeClass(["pbx-block pbx-truncate",[(n.value!=="none","")]])},o.toDisplayString(n.value==="none"?o.unref(t)("Transparent"):n.value),3)])]),_:1}),o.createVNode(o.Transition,{"leave-active-class":"pbx-transition pbx-ease-in pbx-duration-100","leave-from-class":"pbx-opacity-100","leave-to-class":"pbx-opacity-0"},{default:o.withCtx(()=>[o.createVNode(o.unref(zn),{class:"pbx-absolute pbx-z-10 pbx-mt-1 pbx-max-h-56 pbx-w-full pbx-overflow-auto pbx-rounded-md pbx-bg-white pbx-text-base pbx-shadow-lg pbx-ring-1 pbx-ring-black pbx-ring-opacity-5 focus:pbx-outline-none sm:pbx-text-sm pbx-list-none pbx-p-0 pbx-m-0"},{default:o.withCtx(()=>[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(o.unref(ss).backgroundOpacities,p=>(o.openBlock(),o.createBlock(o.unref(Er),{as:"template",onClick:d=>o.unref(e).handleBackgroundOpacity(p),key:p,value:p},{default:o.withCtx(({active:d})=>[o.createElementVNode("li",{class:o.normalizeClass([d?"pbx-bg-myPrimaryLinkColor text-white":"pbx-text-myPrimaryDarkGrayColor","pbx-relative pbx-cursor-default pbx-select-none pbx-py-2 pbx-pl-3 pbx-pr-9"])},[o.createElementVNode("div",pee,[p==="none"?(o.openBlock(),o.createElementBlock("div",dee,[...s[2]||(s[2]=[o.createElementVNode("div",{class:"pbx-myPrimaryColorPreview pbx-border-none"},[o.createElementVNode("span",{class:"material-symbols-outlined"}," ev_shadow ")],-1)])])):o.createCommentVNode("",!0),p!=="none"?(o.openBlock(),o.createElementBlock("div",{key:1,class:o.normalizeClass(["pbx-aspect-square pbx-w-6 pbx-h-6 pbx-bg-gray-950",`${p}`])},null,2)):o.createCommentVNode("",!0),p==="none"?(o.openBlock(),o.createElementBlock("span",cee,o.toDisplayString(o.unref(t)("Transparent")),1)):o.createCommentVNode("",!0),p!=="none"?(o.openBlock(),o.createElementBlock("span",bee,o.toDisplayString(p),1)):o.createCommentVNode("",!0)])],2)]),_:2},1032,["onClick","value"]))),128))]),_:1})]),_:1})])]),_:1},8,["modelValue"])]))}}),gee={class:"pbx-editorFieldGroup"},uee={class:"pbx-relative"},xee={class:"pbx-flex pbx-items-center pbx-gap-2"},hee={key:0},fee={class:"pbx-flex pbx-items-center"},yee={key:0},wee={key:2,class:"pbx-ml-3"},vee={key:3,class:"pbx-ml-3"},kee=o.defineComponent({__name:"OpacityControl",setup(r){const e=ke(),{translate:t}=ne(),i=fe,n=o.ref(null),a=o.computed(()=>i.getOpacity);return o.watch(a,async l=>{n.value=l,await e.initializeElementStyles()},{immediate:!0}),(l,s)=>(o.openBlock(),o.createElementBlock("div",gee,[o.createVNode(o.unref(_n),{as:"div",modelValue:n.value,"onUpdate:modelValue":s[0]||(s[0]=p=>n.value=p)},{default:o.withCtx(()=>[o.createElementVNode("div",uee,[o.createVNode(o.unref(Dn),{class:"pbx-myPrimarySelect",id:"default-opacity"},{default:o.withCtx(()=>[o.createElementVNode("span",xee,[n.value==="none"?(o.openBlock(),o.createElementBlock("div",hee,[...s[1]||(s[1]=[o.createElementVNode("div",{class:"pbx-myPrimaryColorPreview pbx-border-none"},[o.createElementVNode("span",{class:"material-symbols-outlined"}," ev_shadow ")],-1)])])):o.createCommentVNode("",!0),n.value!=="none"?(o.openBlock(),o.createElementBlock("div",{key:1,class:o.normalizeClass(["pbx-aspect-square pbx-w-6 pbx-h-6 pbx-bg-gray-950",`${n.value}`])},null,2)):o.createCommentVNode("",!0),o.createElementVNode("span",{class:o.normalizeClass(["pbx-block pbx-truncate",[(n.value!=="none","")]])},o.toDisplayString(n.value==="none"?o.unref(t)("Transparent"):n.value),3)])]),_:1}),o.createVNode(o.Transition,{"leave-active-class":"pbx-transition pbx-ease-in pbx-duration-100","leave-from-class":"pbx-opacity-100","leave-to-class":"pbx-opacity-0"},{default:o.withCtx(()=>[o.createVNode(o.unref(zn),{class:"pbx-absolute pbx-z-10 pbx-mt-1 pbx-max-h-56 pbx-w-full pbx-overflow-auto pbx-rounded-md pbx-bg-white pbx-text-base pbx-shadow-lg pbx-ring-1 pbx-ring-black pbx-ring-opacity-5 focus:pbx-outline-none sm:pbx-text-sm pbx-list-none pbx-p-0 pbx-m-0"},{default:o.withCtx(()=>[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(o.unref(ss).opacities,p=>(o.openBlock(),o.createBlock(o.unref(Er),{as:"template",onClick:d=>o.unref(e).handleOpacity(p),key:p,value:p},{default:o.withCtx(({active:d})=>[o.createElementVNode("li",{class:o.normalizeClass([d?"pbx-bg-myPrimaryLinkColor text-white":"pbx-text-myPrimaryDarkGrayColor","pbx-relative pbx-cursor-default pbx-select-none pbx-py-2 pbx-pl-3 pbx-pr-9"])},[o.createElementVNode("div",fee,[p==="none"?(o.openBlock(),o.createElementBlock("div",yee,[...s[2]||(s[2]=[o.createElementVNode("div",{class:"pbx-myPrimaryColorPreview pbx-border-none"},[o.createElementVNode("span",{class:"material-symbols-outlined"}," ev_shadow ")],-1)])])):o.createCommentVNode("",!0),p!=="none"?(o.openBlock(),o.createElementBlock("div",{key:1,class:o.normalizeClass(["pbx-aspect-square pbx-w-6 pbx-h-6 pbx-bg-gray-950",`${p}`])},null,2)):o.createCommentVNode("",!0),p==="none"?(o.openBlock(),o.createElementBlock("span",wee,o.toDisplayString(o.unref(t)("Transparent")),1)):o.createCommentVNode("",!0),p!=="none"?(o.openBlock(),o.createElementBlock("span",vee,o.toDisplayString(p),1)):o.createCommentVNode("",!0)])],2)]),_:2},1032,["onClick","value"]))),128))]),_:1})]),_:1})])]),_:1},8,["modelValue"])]))}}),See={class:"pbx-editorSectionTitle"},Cee={class:"pbx-editorSectionTitle"},Tee=o.defineComponent({__name:"OpacityEditor",setup(r){const{translate:e}=ne();return(t,i)=>(o.openBlock(),o.createBlock(Re,null,{title:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(o.unref(e)("Opacity & Transparency")),1)]),content:o.withCtx(()=>[o.createElementVNode("p",See,o.toDisplayString(o.unref(e)("Opacity")),1),o.createVNode(kee),i[0]||(i[0]=o.createElementVNode("hr",null,null,-1)),o.createElementVNode("p",Cee,o.toDisplayString(o.unref(e)("Background Opacity")),1),o.createVNode(mee)]),_:1}))}}),Eee={key:0,class:"pbx-text-[9px] pbx-font-medium pbx-uppercase pbx-tracking-wide pbx-text-gray-400 pbx-leading-none"},Pi=o.defineComponent({__name:"SpacingStepper",props:{value:{},sideLabel:{},compact:{type:Boolean}},emits:["decrement","increment"],setup(r){return(e,t)=>(o.openBlock(),o.createElementBlock("div",{class:o.normalizeClass(["pbx-flex pbx-items-center pbx-gap-0.5 pbx-rounded-lg pbx-bg-gray-100/80 pbx-p-0.5",r.compact?"pbx-scale-90 pbx-origin-center":""])},[o.createElementVNode("button",{type:"button",class:"pbx-flex pbx-h-7 pbx-w-7 pbx-shrink-0 pbx-cursor-pointer pbx-items-center pbx-justify-center pbx-rounded-md pbx-border-none pbx-bg-white pbx-text-gray-600 pbx-shadow-sm pbx-transition-colors hover:pbx-bg-myPrimaryLinkColor hover:pbx-text-white focus-visible:pbx-outline-none",onClick:t[0]||(t[0]=i=>e.$emit("decrement"))},[...t[2]||(t[2]=[o.createElementVNode("span",{class:"material-symbols-outlined pbx-materialIcon18"},"remove",-1)])]),o.createElementVNode("div",{class:o.normalizeClass(["pbx-flex pbx-flex-col pbx-items-center pbx-justify-center",r.sideLabel?"pbx-min-w-[2.75rem]":"pbx-min-w-[2.25rem]"])},[r.sideLabel?(o.openBlock(),o.createElementBlock("span",Eee,o.toDisplayString(r.sideLabel),1)):o.createCommentVNode("",!0),o.createElementVNode("span",{class:o.normalizeClass(["pbx-font-semibold pbx-tabular-nums pbx-text-gray-800",r.sideLabel?"pbx-text-xs":"pbx-text-sm"])},o.toDisplayString(r.value),3)],2),o.createElementVNode("button",{type:"button",class:"pbx-flex pbx-h-7 pbx-w-7 pbx-shrink-0 pbx-cursor-pointer pbx-items-center pbx-justify-center pbx-rounded-md pbx-border-none pbx-bg-white pbx-text-gray-600 pbx-shadow-sm pbx-transition-colors hover:pbx-bg-myPrimaryLinkColor hover:pbx-text-white focus-visible:pbx-outline-none",onClick:t[1]||(t[1]=i=>e.$emit("increment"))},[...t[3]||(t[3]=[o.createElementVNode("span",{class:"material-symbols-outlined pbx-materialIcon18"},"add",-1)])])],2))}}),ce={verticalPadding:["none","pbx-py-0","pbx-py-0.5","pbx-py-1","pbx-py-1.5","pbx-py-2","pbx-py-2.5","pbx-py-3","pbx-py-3.5","pbx-py-4","pbx-py-5","pbx-py-6","pbx-py-7","pbx-py-8","pbx-py-9","pbx-py-10","pbx-py-11","pbx-py-12","pbx-py-14","pbx-py-16","pbx-py-20","pbx-py-24","pbx-py-28","pbx-py-32","pbx-py-36","pbx-py-40","pbx-py-44","pbx-py-48","pbx-py-52","pbx-py-56","pbx-py-60","pbx-py-64","pbx-py-72","pbx-py-80","pbx-py-96"],horizontalPadding:["none","pbx-px-0","pbx-px-0.5","pbx-px-1","pbx-px-1.5","pbx-px-2","pbx-px-2.5","pbx-px-3","pbx-px-3.5","pbx-px-4","pbx-px-5","pbx-px-6","pbx-px-7","pbx-px-8","pbx-px-9","pbx-px-10","pbx-px-11","pbx-px-12","pbx-px-14","pbx-px-16","pbx-px-20","pbx-px-24","pbx-px-28","pbx-px-32","pbx-px-36","pbx-px-40","pbx-px-44","pbx-px-48","pbx-px-52","pbx-px-56","pbx-px-60","pbx-px-64","pbx-px-72","pbx-px-80","pbx-px-96"],topPadding:["none","pbx-pt-0","pbx-pt-0.5","pbx-pt-1","pbx-pt-1.5","pbx-pt-2","pbx-pt-2.5","pbx-pt-3","pbx-pt-3.5","pbx-pt-4","pbx-pt-5","pbx-pt-6","pbx-pt-7","pbx-pt-8","pbx-pt-9","pbx-pt-10","pbx-pt-11","pbx-pt-12","pbx-pt-14","pbx-pt-16","pbx-pt-20","pbx-pt-24","pbx-pt-28","pbx-pt-32","pbx-pt-36","pbx-pt-40","pbx-pt-44","pbx-pt-48","pbx-pt-52","pbx-pt-56","pbx-pt-60","pbx-pt-64","pbx-pt-72","pbx-pt-80","pbx-pt-96"],rightPadding:["none","pbx-pr-0","pbx-pr-0.5","pbx-pr-1","pbx-pr-1.5","pbx-pr-2","pbx-pr-2.5","pbx-pr-3","pbx-pr-3.5","pbx-pr-4","pbx-pr-5","pbx-pr-6","pbx-pr-7","pbx-pr-8","pbx-pr-9","pbx-pr-10","pbx-pr-11","pbx-pr-12","pbx-pr-14","pbx-pr-16","pbx-pr-20","pbx-pr-24","pbx-pr-28","pbx-pr-32","pbx-pr-36","pbx-pr-40","pbx-pr-44","pbx-pr-48","pbx-pr-52","pbx-pr-56","pbx-pr-60","pbx-pr-64","pbx-pr-72","pbx-pr-80","pbx-pr-96"],bottomPadding:["none","pbx-pb-0","pbx-pb-0.5","pbx-pb-1","pbx-pb-1.5","pbx-pb-2","pbx-pb-2.5","pbx-pb-3","pbx-pb-3.5","pbx-pb-4","pbx-pb-5","pbx-pb-6","pbx-pb-7","pbx-pb-8","pbx-pb-9","pbx-pb-10","pbx-pb-11","pbx-pb-12","pbx-pb-14","pbx-pb-16","pbx-pb-20","pbx-pb-24","pbx-pb-28","pbx-pb-32","pbx-pb-36","pbx-pb-40","pbx-pb-44","pbx-pb-48","pbx-pb-52","pbx-pb-56","pbx-pb-60","pbx-pb-64","pbx-pb-72","pbx-pb-80","pbx-pb-96"],leftPadding:["none","pbx-pl-0","pbx-pl-0.5","pbx-pl-1","pbx-pl-1.5","pbx-pl-2","pbx-pl-2.5","pbx-pl-3","pbx-pl-3.5","pbx-pl-4","pbx-pl-5","pbx-pl-6","pbx-pl-7","pbx-pl-8","pbx-pl-9","pbx-pl-10","pbx-pl-11","pbx-pl-12","pbx-pl-14","pbx-pl-16","pbx-pl-20","pbx-pl-24","pbx-pl-28","pbx-pl-32","pbx-pl-36","pbx-pl-40","pbx-pl-44","pbx-pl-48","pbx-pl-52","pbx-pl-56","pbx-pl-60","pbx-pl-64","pbx-pl-72","pbx-pl-80","pbx-pl-96"],verticalMargin:["none","pbx-my-0","pbx-my-0.5","pbx-my-1","pbx-my-1.5","pbx-my-2","pbx-my-2.5","pbx-my-3","pbx-my-3.5","pbx-my-4","pbx-my-5","pbx-my-6","pbx-my-7","pbx-my-8","pbx-my-9","pbx-my-10","pbx-my-11","pbx-my-12","pbx-my-14","pbx-my-16","pbx-my-20","pbx-my-24","pbx-my-28","pbx-my-32","pbx-my-36","pbx-my-40","pbx-my-44","pbx-my-48","pbx-my-52","pbx-my-56","pbx-my-60","pbx-my-64","pbx-my-72","pbx-my-80","pbx-my-96"],horizontalMargin:["none","pbx-mx-0","pbx-mx-0.5","pbx-mx-1","pbx-mx-1.5","pbx-mx-2","pbx-mx-2.5","pbx-mx-3","pbx-mx-3.5","pbx-mx-4","pbx-mx-5","pbx-mx-6","pbx-mx-7","pbx-mx-8","pbx-mx-9","pbx-mx-10","pbx-mx-11","pbx-mx-12","pbx-mx-14","pbx-mx-16","pbx-mx-20","pbx-mx-24","pbx-mx-28","pbx-mx-32","pbx-mx-36","pbx-mx-40","pbx-mx-44","pbx-mx-48","pbx-mx-52","pbx-mx-56","pbx-mx-60","pbx-mx-64","pbx-mx-72","pbx-mx-80","pbx-mx-96"],topMargin:["none","pbx-mt-0","pbx-mt-0.5","pbx-mt-1","pbx-mt-1.5","pbx-mt-2","pbx-mt-2.5","pbx-mt-3","pbx-mt-3.5","pbx-mt-4","pbx-mt-5","pbx-mt-6","pbx-mt-7","pbx-mt-8","pbx-mt-9","pbx-mt-10","pbx-mt-11","pbx-mt-12","pbx-mt-14","pbx-mt-16","pbx-mt-20","pbx-mt-24","pbx-mt-28","pbx-mt-32","pbx-mt-36","pbx-mt-40","pbx-mt-44","pbx-mt-48","pbx-mt-52","pbx-mt-56","pbx-mt-60","pbx-mt-64","pbx-mt-72","pbx-mt-80","pbx-mt-96"],rightMargin:["none","pbx-mr-0","pbx-mr-0.5","pbx-mr-1","pbx-mr-1.5","pbx-mr-2","pbx-mr-2.5","pbx-mr-3","pbx-mr-3.5","pbx-mr-4","pbx-mr-5","pbx-mr-6","pbx-mr-7","pbx-mr-8","pbx-mr-9","pbx-mr-10","pbx-mr-11","pbx-mr-12","pbx-mr-14","pbx-mr-16","pbx-mr-20","pbx-mr-24","pbx-mr-28","pbx-mr-32","pbx-mr-36","pbx-mr-40","pbx-mr-44","pbx-mr-48","pbx-mr-52","pbx-mr-56","pbx-mr-60","pbx-mr-64","pbx-mr-72","pbx-mr-80","pbx-mr-96"],bottomMargin:["none","pbx-mb-0","pbx-mb-0.5","pbx-mb-1","pbx-mb-1.5","pbx-mb-2","pbx-mb-2.5","pbx-mb-3","pbx-mb-3.5","pbx-mb-4","pbx-mb-5","pbx-mb-6","pbx-mb-7","pbx-mb-8","pbx-mb-9","pbx-mb-10","pbx-mb-11","pbx-mb-12","pbx-mb-14","pbx-mb-16","pbx-mb-20","pbx-mb-24","pbx-mb-28","pbx-mb-32","pbx-mb-36","pbx-mb-40","pbx-mb-44","pbx-mb-48","pbx-mb-52","pbx-mb-56","pbx-mb-60","pbx-mb-64","pbx-mb-72","pbx-mb-80","pbx-mb-96"],leftMargin:["none","pbx-ml-0","pbx-ml-0.5","pbx-ml-1","pbx-ml-1.5","pbx-ml-2","pbx-ml-2.5","pbx-ml-3","pbx-ml-3.5","pbx-ml-4","pbx-ml-5","pbx-ml-6","pbx-ml-7","pbx-ml-8","pbx-ml-9","pbx-ml-10","pbx-ml-11","pbx-ml-12","pbx-ml-14","pbx-ml-16","pbx-ml-20","pbx-ml-24","pbx-ml-28","pbx-ml-32","pbx-ml-36","pbx-ml-40","pbx-ml-44","pbx-ml-48","pbx-ml-52","pbx-ml-56","pbx-ml-60","pbx-ml-64","pbx-ml-72","pbx-ml-80","pbx-ml-96"]},Mee={class:"pbx-editorSectionTitle"},Pee={class:"pbx-editorSectionDesc"},Bee={class:"pbx-mb-4 pbx-space-y-2 pbx-rounded-xl pbx-border pbx-border-solid pbx-border-gray-200 pbx-bg-white pbx-p-3"},Lee={class:"pbx-flex pbx-items-center pbx-justify-between pbx-gap-3"},Nee={class:"pbx-text-xs pbx-font-medium pbx-text-gray-500"},Aee={class:"pbx-flex pbx-items-center pbx-justify-between pbx-gap-3"},_ee={class:"pbx-text-xs pbx-font-medium pbx-text-gray-500"},Dee={class:"pbx-editorSectionTitle"},zee={class:"pbx-flex pbx-flex-col pbx-items-center pbx-justify-center"},Iee={class:"pbx-mb-3 pbx-flex pbx-justify-center"},Vee={class:"pbx-items-center pbx-gap-2",style:{display:"grid","grid-template-columns":"auto 1fr auto"}},Hee={class:"pbx-flex pbx-h-10 pbx-items-center pbx-justify-center pbx-rounded-lg pbx-border pbx-border-solid pbx-border-gray-200/80 pbx-bg-white pbx-shadow-sm"},Ree={class:"pbx-select-none pbx-text-[10px] pbx-font-medium pbx-text-gray-400"},Oee={class:"pbx-mt-3 pbx-flex pbx-justify-center"},wz=o.defineComponent({__name:"SpacingControl",props:{mode:{}},setup(r){const e=r,{translate:t}=ne(),i=ke(),n=fe,a=o.computed(()=>e.mode==="padding"),l=o.computed(()=>a.value?"pbx-bg-emerald-50/40":"pbx-bg-amber-50/40"),s=o.computed(()=>a.value?"pbx-border-emerald-200/60":"pbx-border-amber-200/60"),p=o.ref(null),d=o.ref(null),c=o.ref(null),b=o.ref(null),m=o.ref(null),g=o.ref(null),x=o.computed(()=>a.value?n.getFontVerticalPadding:n.getFontVerticalMargin),u=o.computed(()=>a.value?n.getFontHorizontalPadding:n.getFontHorizontalMargin),h=o.computed(()=>a.value?n.getFontTopPadding:n.getFontTopMargin),f=o.computed(()=>a.value?n.getFontRightPadding:n.getFontRightMargin),w=o.computed(()=>a.value?n.getFontBottomPadding:n.getFontBottomMargin),y=o.computed(()=>a.value?n.getFontLeftPadding:n.getFontLeftMargin);o.watch(x,async D=>{p.value=D,await i.initializeElementStyles()},{immediate:!0}),o.watch(u,async D=>{d.value=D,await i.initializeElementStyles()},{immediate:!0}),o.watch(h,async D=>{c.value=D,await i.initializeElementStyles()},{immediate:!0}),o.watch(f,async D=>{b.value=D,await i.initializeElementStyles()},{immediate:!0}),o.watch(w,async D=>{m.value=D,await i.initializeElementStyles()},{immediate:!0}),o.watch(y,async D=>{g.value=D,await i.initializeElementStyles()},{immediate:!0});function E(D){if(!D||D==="none")return"–";const q=D.match(/-(\d[\d.]*)$/);return q?q[1]:"–"}function S(){return E(c.value&&c.value!=="none"?c.value:p.value)}function P(){return E(m.value&&m.value!=="none"?m.value:p.value)}function v(){return E(g.value&&g.value!=="none"?g.value:d.value)}function M(){return E(b.value&&b.value!=="none"?b.value:d.value)}function C(D,q,Y){const Q=D.indexOf(q??"none");return D[Math.max(0,Math.min(D.length-1,Math.max(0,Q)+Y))]}function k(D){const q=a.value?ce.verticalPadding:ce.verticalMargin,Y=C(q,p.value,D);p.value=Y,a.value?i.handleVerticalPadding(Y):i.handleVerticalMargin(Y)}function T(D){const q=a.value?ce.horizontalPadding:ce.horizontalMargin,Y=C(q,d.value,D);d.value=Y,a.value?i.handleHorizontalPadding(Y):i.handleHorizontalMargin(Y)}function V(D){const q=a.value?ce.topPadding:ce.topMargin,Y=C(q,c.value,D);c.value=Y,a.value?i.handleTopPadding(Y):i.handleTopMargin(Y)}function N(D){const q=a.value?ce.rightPadding:ce.rightMargin,Y=C(q,b.value,D);b.value=Y,a.value?i.handleRightPadding(Y):i.handleRightMargin(Y)}function A(D){const q=a.value?ce.bottomPadding:ce.bottomMargin,Y=C(q,m.value,D);m.value=Y,a.value?i.handleBottomPadding(Y):i.handleBottomMargin(Y)}function I(D){const q=a.value?ce.leftPadding:ce.leftMargin,Y=C(q,g.value,D);g.value=Y,a.value?i.handleLeftPadding(Y):i.handleLeftMargin(Y)}return(D,q)=>(o.openBlock(),o.createBlock(Re,null,{title:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(o.unref(t)(a.value?"Padding":"Margin")),1)]),content:o.withCtx(()=>[o.createElementVNode("p",Mee,o.toDisplayString(o.unref(t)("All sides")),1),o.createElementVNode("p",Pee,o.toDisplayString(o.unref(t)("Applies across all screen sizes")),1),o.createElementVNode("div",Bee,[o.createElementVNode("div",Lee,[o.createElementVNode("span",Nee,o.toDisplayString(o.unref(t)("Vertical")),1),o.createVNode(Pi,{value:E(p.value),onDecrement:q[0]||(q[0]=Y=>k(-1)),onIncrement:q[1]||(q[1]=Y=>k(1))},null,8,["value"])]),q[12]||(q[12]=o.createElementVNode("div",{class:"pbx-h-px pbx-bg-gray-100"},null,-1)),o.createElementVNode("div",Aee,[o.createElementVNode("span",_ee,o.toDisplayString(o.unref(t)("Horizontal")),1),o.createVNode(Pi,{value:E(d.value),onDecrement:q[2]||(q[2]=Y=>T(-1)),onIncrement:q[3]||(q[3]=Y=>T(1))},null,8,["value"])])]),q[13]||(q[13]=o.createElementVNode("hr",null,null,-1)),o.createElementVNode("div",Dee,o.toDisplayString(o.unref(t)(a.value?"Padding":"Margin")),1),o.createElementVNode("div",{class:o.normalizeClass(["pbx-relative pbx-rounded-full pbx-border pbx-border-solid pbx-p-8 pbx-pt-8 pbx-flex pbx-items-center pbx-justify-center",[l.value,s.value]])},[o.createElementVNode("div",zee,[o.createElementVNode("div",Iee,[o.createVNode(Pi,{value:S(),"side-label":o.unref(t)("top"),onDecrement:q[4]||(q[4]=Y=>V(-1)),onIncrement:q[5]||(q[5]=Y=>V(1))},null,8,["value","side-label"])]),o.createElementVNode("div",Vee,[o.createVNode(Pi,{value:v(),"side-label":o.unref(t)("left"),compact:"",onDecrement:q[6]||(q[6]=Y=>I(-1)),onIncrement:q[7]||(q[7]=Y=>I(1))},null,8,["value","side-label"]),o.createElementVNode("div",Hee,[o.createElementVNode("span",Ree,o.toDisplayString(o.unref(t)("element")),1)]),o.createVNode(Pi,{value:M(),"side-label":o.unref(t)("right"),compact:"",onDecrement:q[8]||(q[8]=Y=>N(-1)),onIncrement:q[9]||(q[9]=Y=>N(1))},null,8,["value","side-label"])]),o.createElementVNode("div",Oee,[o.createVNode(Pi,{value:P(),"side-label":o.unref(t)("bottom"),onDecrement:q[10]||(q[10]=Y=>A(-1)),onIncrement:q[11]||(q[11]=Y=>A(1))},null,8,["value","side-label"])])])],2)]),_:1}))}}),vz=o.defineComponent({__name:"PaddingControl",setup(r){return(e,t)=>(o.openBlock(),o.createBlock(wz,{mode:"padding"}))}}),kz=o.defineComponent({__name:"MarginControl",setup(r){return(e,t)=>(o.openBlock(),o.createBlock(wz,{mode:"margin"}))}}),vt={roundedGlobal:["none","pbx-rounded-sm","pbx-rounded","pbx-rounded-md","pbx-rounded-lg","pbx-rounded-xl","pbx-rounded-2xl","pbx-rounded-3xl","pbx-rounded-full"],roundedTopLeft:["none","pbx-rounded-tl-sm","pbx-rounded-tl","pbx-rounded-tl-md","pbx-rounded-tl-lg","pbx-rounded-tl-xl","pbx-rounded-tl-2xl","pbx-rounded-tl-3xl","pbx-rounded-tl-full"],roundedTopRight:["none","pbx-rounded-tr-sm","pbx-rounded-tr","pbx-rounded-tr-md","pbx-rounded-tr-lg","pbx-rounded-tr-xl","pbx-rounded-tr-2xl","pbx-rounded-tr-3xl","pbx-rounded-tr-full"],roundedBottomLeft:["none","pbx-rounded-bl-sm","pbx-rounded-bl","pbx-rounded-bl-md","pbx-rounded-bl-lg","pbx-rounded-bl-xl","pbx-rounded-bl-2xl","pbx-rounded-bl-3xl","pbx-rounded-bl-full"],roundedBottomRight:["none","pbx-rounded-br-sm","pbx-rounded-br","pbx-rounded-br-md","pbx-rounded-br-lg","pbx-rounded-br-xl","pbx-rounded-br-2xl","pbx-rounded-br-3xl","pbx-rounded-br-full"]},Fee={class:"pbx-editorSectionTitle"},jee={class:"pbx-editorFieldGroup"},qee={for:"global-border-radius",class:"pbx-myPrimaryInputLabel"},Uee={disabled:"",value:""},Wee={class:"pbx-editorSectionTitle"},Gee={class:"pbx-editorFieldGroup"},Kee={for:"border-radius-top-left",class:"pbx-myPrimaryInputLabel"},Jee={disabled:"",value:""},Yee={class:"pbx-editorFieldGroup"},Qee={for:"border-radius-top-right",class:"pbx-myPrimaryInputLabel"},Xee={disabled:"",value:""},Zee={class:"pbx-editorFieldGroup"},$ee={for:"border-radius-bottom-left",class:"pbx-myPrimaryInputLabel"},ete={disabled:"",value:""},tte={class:"pbx-editorFieldGroup"},rte={for:"border-radius-bottom-right",class:"pbx-myPrimaryInputLabel"},ote={disabled:"",value:""},Sz=o.defineComponent({__name:"BorderRadiusControl",setup(r){const{translate:e}=ne(),t=ke(),i=fe,n=o.ref(null),a=o.ref(null),l=o.ref(null),s=o.ref(null),p=o.ref(null),d=o.computed(()=>i.getBorderRadiusGlobal),c=o.computed(()=>i.getBorderRadiusTopLeft),b=o.computed(()=>i.getBorderRadiusTopRight),m=o.computed(()=>i.getBorderRadiusBottomleft),g=o.computed(()=>i.getBorderRadiusBottomRight);return o.watch(d,async x=>{n.value=x,await t.initializeElementStyles()},{immediate:!0}),o.watch(c,async x=>{a.value=x,await t.initializeElementStyles()},{immediate:!0}),o.watch(b,async x=>{l.value=x,await t.initializeElementStyles()},{immediate:!0}),o.watch(m,async x=>{s.value=x,await t.initializeElementStyles()},{immediate:!0}),o.watch(g,async x=>{p.value=x,await t.initializeElementStyles()},{immediate:!0}),(x,u)=>(o.openBlock(),o.createBlock(Re,null,{title:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(o.unref(e)("Border Radius")),1)]),content:o.withCtx(()=>[o.createElementVNode("p",Fee,o.toDisplayString(o.unref(e)("Global")),1),o.createElementVNode("div",jee,[o.createElementVNode("label",qee,o.toDisplayString(o.unref(e)("Border Radius")),1),o.withDirectives(o.createElementVNode("select",{id:"global-border-radius","onUpdate:modelValue":u[0]||(u[0]=h=>n.value=h),class:"pbx-myPrimarySelect",onChange:u[1]||(u[1]=h=>o.unref(t).handleBorderRadiusGlobal(n.value??void 0))},[o.createElementVNode("option",Uee,o.toDisplayString(o.unref(e)("Select")),1),(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(o.unref(vt).roundedGlobal,h=>(o.openBlock(),o.createElementBlock("option",{key:h},o.toDisplayString(h),1))),128))],544),[[o.vModelSelect,n.value]])]),u[10]||(u[10]=o.createElementVNode("hr",null,null,-1)),o.createElementVNode("p",Wee,o.toDisplayString(o.unref(e)("Specific")),1),o.createElementVNode("div",Gee,[o.createElementVNode("label",Kee,o.toDisplayString(o.unref(e)("Border Radius top left")),1),o.withDirectives(o.createElementVNode("select",{id:"border-radius-top-left","onUpdate:modelValue":u[2]||(u[2]=h=>a.value=h),class:"pbx-myPrimarySelect",onChange:u[3]||(u[3]=h=>o.unref(t).handleBorderRadiusTopLeft(a.value??void 0))},[o.createElementVNode("option",Jee,o.toDisplayString(o.unref(e)("Select")),1),(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(o.unref(vt).roundedTopLeft,h=>(o.openBlock(),o.createElementBlock("option",{key:h},o.toDisplayString(h),1))),128))],544),[[o.vModelSelect,a.value]])]),u[11]||(u[11]=o.createElementVNode("hr",null,null,-1)),o.createElementVNode("div",Yee,[o.createElementVNode("label",Qee,o.toDisplayString(o.unref(e)("Border Radius top right")),1),o.withDirectives(o.createElementVNode("select",{id:"border-radius-top-right","onUpdate:modelValue":u[4]||(u[4]=h=>l.value=h),class:"pbx-myPrimarySelect",onChange:u[5]||(u[5]=h=>o.unref(t).handleBorderRadiusTopRight(l.value??void 0))},[o.createElementVNode("option",Xee,o.toDisplayString(o.unref(e)("Select")),1),(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(o.unref(vt).roundedTopRight,h=>(o.openBlock(),o.createElementBlock("option",{key:h},o.toDisplayString(h),1))),128))],544),[[o.vModelSelect,l.value]])]),u[12]||(u[12]=o.createElementVNode("hr",null,null,-1)),o.createElementVNode("div",Zee,[o.createElementVNode("label",$ee,o.toDisplayString(o.unref(e)("Border Radius bottom left")),1),o.withDirectives(o.createElementVNode("select",{id:"border-radius-bottom-left","onUpdate:modelValue":u[6]||(u[6]=h=>s.value=h),class:"pbx-myPrimarySelect",onChange:u[7]||(u[7]=h=>o.unref(t).handleBorderRadiusBottomleft(s.value??void 0))},[o.createElementVNode("option",ete,o.toDisplayString(o.unref(e)("Select")),1),(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(o.unref(vt).roundedBottomLeft,h=>(o.openBlock(),o.createElementBlock("option",{key:h},o.toDisplayString(h),1))),128))],544),[[o.vModelSelect,s.value]])]),u[13]||(u[13]=o.createElementVNode("hr",null,null,-1)),o.createElementVNode("div",tte,[o.createElementVNode("label",rte,o.toDisplayString(o.unref(e)("Border Radius bottom right")),1),o.withDirectives(o.createElementVNode("select",{id:"border-radius-bottom-right","onUpdate:modelValue":u[8]||(u[8]=h=>p.value=h),class:"pbx-myPrimarySelect",onChange:u[9]||(u[9]=h=>o.unref(t).handleBorderRadiusBottomRight(p.value??void 0))},[o.createElementVNode("option",ote,o.toDisplayString(o.unref(e)("Select")),1),(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(o.unref(vt).roundedBottomRight,h=>(o.openBlock(),o.createElementBlock("option",{key:h},o.toDisplayString(h),1))),128))],544),[[o.vModelSelect,p.value]])])]),_:1}))}}),Bi={borderStyle:["none","pbx-border-solid","pbx-border-dashed","pbx-border-dotted","pbx-border-double","pbx-border-hidden"],borderWidth:["none","pbx-border","pbx-border-2","pbx-border-4","pbx-border-8"],borderColor:["none","pbx-border-white","pbx-border-black","pbx-border-slate-50","pbx-border-slate-100","pbx-border-slate-200","pbx-border-slate-300","pbx-border-slate-400","pbx-border-slate-500","pbx-border-slate-600","pbx-border-slate-700","pbx-border-slate-800","pbx-border-slate-900","pbx-border-gray-50","pbx-border-gray-100","pbx-border-gray-200","pbx-border-gray-300","pbx-border-gray-400","pbx-border-gray-500","pbx-border-gray-600","pbx-border-gray-700","pbx-border-gray-800","pbx-border-gray-900","pbx-border-zinc-50","pbx-border-zinc-100","pbx-border-zinc-200","pbx-border-zinc-300","pbx-border-zinc-400","pbx-border-zinc-500","pbx-border-zinc-600","pbx-border-zinc-700","pbx-border-zinc-800","pbx-border-zinc-900","pbx-border-neutral-50","pbx-border-neutral-100","pbx-border-neutral-200","pbx-border-neutral-300","pbx-border-neutral-400","pbx-border-neutral-500","pbx-border-neutral-600","pbx-border-neutral-700","pbx-border-neutral-800","pbx-border-neutral-900","pbx-border-stone-50","pbx-border-stone-100","pbx-border-stone-200","pbx-border-stone-300","pbx-border-stone-400","pbx-border-stone-500","pbx-border-stone-600","pbx-border-stone-700","pbx-border-stone-800","pbx-border-stone-900","pbx-border-red-50","pbx-border-red-100","pbx-border-red-200","pbx-border-red-300","pbx-border-red-400","pbx-border-red-500","pbx-border-red-600","pbx-border-red-700","pbx-border-red-800","pbx-border-red-900","pbx-border-orange-50","pbx-border-orange-100","pbx-border-orange-200","pbx-border-orange-300","pbx-border-orange-400","pbx-border-orange-500","pbx-border-orange-600","pbx-border-orange-700","pbx-border-orange-800","pbx-border-orange-900","pbx-border-amber-50","pbx-border-amber-100","pbx-border-amber-200","pbx-border-amber-300","pbx-border-amber-400","pbx-border-amber-500","pbx-border-amber-600","pbx-border-amber-700","pbx-border-amber-800","pbx-border-amber-900","pbx-border-yellow-50","pbx-border-yellow-100","pbx-border-yellow-200","pbx-border-yellow-300","pbx-border-yellow-400","pbx-border-yellow-500","pbx-border-yellow-600","pbx-border-yellow-700","pbx-border-yellow-800","pbx-border-yellow-900","pbx-border-lime-50","pbx-border-lime-100","pbx-border-lime-200","pbx-border-lime-300","pbx-border-lime-400","pbx-border-lime-500","pbx-border-lime-600","pbx-border-lime-700","pbx-border-lime-800","pbx-border-lime-900","pbx-border-green-50","pbx-border-green-100","pbx-border-green-200","pbx-border-green-300","pbx-border-green-400","pbx-border-green-500","pbx-border-green-600","pbx-border-green-700","pbx-border-green-800","pbx-border-green-900","pbx-border-emerald-50","pbx-border-emerald-100","pbx-border-emerald-200","pbx-border-emerald-300","pbx-border-emerald-400","pbx-border-emerald-500","pbx-border-emerald-600","pbx-border-emerald-700","pbx-border-emerald-800","pbx-border-emerald-900","pbx-border-teal-50","pbx-border-teal-100","pbx-border-teal-200","pbx-border-teal-300","pbx-border-teal-400","pbx-border-teal-500","pbx-border-teal-600","pbx-border-teal-700","pbx-border-teal-800","pbx-border-teal-900","pbx-border-cyan-50","pbx-border-cyan-100","pbx-border-cyan-200","pbx-border-cyan-300","pbx-border-cyan-400","pbx-border-cyan-500","pbx-border-cyan-600","pbx-border-cyan-700","pbx-border-cyan-800","pbx-border-cyan-900","pbx-border-sky-50","pbx-border-sky-100","pbx-border-sky-200","pbx-border-sky-300","pbx-border-sky-400","pbx-border-sky-500","pbx-border-sky-600","pbx-border-sky-700","pbx-border-sky-800","pbx-border-sky-900","pbx-border-blue-50","pbx-border-blue-100","pbx-border-blue-200","pbx-border-blue-300","pbx-border-blue-400","pbx-border-blue-500","pbx-border-blue-600","pbx-border-blue-700","pbx-border-blue-800","pbx-border-blue-900","pbx-border-indigo-50","pbx-border-indigo-100","pbx-border-indigo-200","pbx-border-indigo-300","pbx-border-indigo-400","pbx-border-indigo-500","pbx-border-indigo-600","pbx-border-indigo-700","pbx-border-indigo-800","pbx-border-indigo-900","pbx-border-violet-50","pbx-border-violet-100","pbx-border-violet-200","pbx-border-violet-300","pbx-border-violet-400","pbx-border-violet-500","pbx-border-violet-600","pbx-border-violet-700","pbx-border-violet-800","pbx-border-violet-900","pbx-border-purple-50","pbx-border-purple-100","pbx-border-purple-200","pbx-border-purple-300","pbx-border-purple-400","pbx-border-purple-500","pbx-border-purple-600","pbx-border-purple-700","pbx-border-purple-800","pbx-border-purple-900","pbx-border-fuchsia-50","pbx-border-fuchsia-100","pbx-border-fuchsia-200","pbx-border-fuchsia-300","pbx-border-fuchsia-400","pbx-border-fuchsia-500","pbx-border-fuchsia-600","pbx-border-fuchsia-700","pbx-border-fuchsia-800","pbx-border-fuchsia-900","pbx-border-pink-50","pbx-border-pink-100","pbx-border-pink-200","pbx-border-pink-300","pbx-border-pink-400","pbx-border-pink-500","pbx-border-pink-600","pbx-border-pink-700","pbx-border-pink-800","pbx-border-pink-900","pbx-border-rose-50","pbx-border-rose-100","pbx-border-rose-200","pbx-border-rose-300","pbx-border-rose-400","pbx-border-rose-500","pbx-border-rose-600","pbx-border-rose-700","pbx-border-rose-800","pbx-border-rose-900"]},ite={class:"pbx-editorSectionTitle"},nte={class:"pbx-editorFieldGroup"},ate={for:"border-style",class:"pbx-myPrimaryInputLabel"},lte={disabled:"",value:""},ste={class:"pbx-editorFieldGroup"},pte={for:"border-width",class:"pbx-myPrimaryInputLabel"},dte={disabled:"",value:""},cte={class:"pbx-editorFieldGroup"},bte={for:"border-color",class:"pbx-myPrimaryInputLabel"},mte={class:"pbx-flex pbx-items-center pbx-gap-2"},gte={key:0},ute={class:"pbx-block pbx-truncate"},xte={class:"pbx-flex pbx-items-center"},hte={key:0},fte={key:2,class:"pbx-ml-3"},yte={key:3,class:"pbx-ml-3"},Cz=o.defineComponent({name:"BorderControls",__name:"BorderControls",setup(r){const{translate:e}=ne(),t=ke(),i=fe,n=o.ref(null),a=o.ref(null),l=o.ref(null),s=o.computed(()=>i.getBorderStyle),p=o.computed(()=>i.getBorderWidth),d=o.computed(()=>i.getBorderColor);return o.watch(s,async c=>{n.value=c,await t.initializeElementStyles()},{immediate:!0}),o.watch(p,async c=>{a.value=c,await t.initializeElementStyles()},{immediate:!0}),o.watch(d,async c=>{l.value=c,await t.initializeElementStyles()},{immediate:!0}),(c,b)=>(o.openBlock(),o.createBlock(Re,null,{title:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(o.unref(e)("Border Style, Width & Color")),1)]),content:o.withCtx(()=>[o.createElementVNode("p",ite,o.toDisplayString(o.unref(e)("Border")),1),o.createElementVNode("div",nte,[o.createElementVNode("label",ate,o.toDisplayString(o.unref(e)("Border Style")),1),o.withDirectives(o.createElementVNode("select",{id:"border-style","onUpdate:modelValue":b[0]||(b[0]=m=>n.value=m),class:"pbx-myPrimarySelect",onChange:b[1]||(b[1]=m=>o.unref(t).handleBorderStyle(n.value??void 0))},[o.createElementVNode("option",lte,o.toDisplayString(o.unref(e)("Select")),1),(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(o.unref(Bi).borderStyle,m=>(o.openBlock(),o.createElementBlock("option",{key:m},o.toDisplayString(m),1))),128))],544),[[o.vModelSelect,n.value]])]),b[8]||(b[8]=o.createElementVNode("hr",null,null,-1)),o.createElementVNode("div",ste,[o.createElementVNode("label",pte,o.toDisplayString(o.unref(e)("Border Width")),1),o.withDirectives(o.createElementVNode("select",{id:"border-width","onUpdate:modelValue":b[2]||(b[2]=m=>a.value=m),class:"pbx-myPrimarySelect",onChange:b[3]||(b[3]=m=>o.unref(t).handleBorderWidth(a.value??void 0))},[o.createElementVNode("option",dte,o.toDisplayString(o.unref(e)("Select")),1),(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(o.unref(Bi).borderWidth,m=>(o.openBlock(),o.createElementBlock("option",{key:m},o.toDisplayString(m),1))),128))],544),[[o.vModelSelect,a.value]])]),b[9]||(b[9]=o.createElementVNode("hr",null,null,-1)),o.createElementVNode("div",cte,[o.createElementVNode("label",bte,o.toDisplayString(o.unref(e)("Border Color")),1),o.createVNode(o.unref(_n),{as:"div",modelValue:l.value,"onUpdate:modelValue":b[5]||(b[5]=m=>l.value=m)},{default:o.withCtx(({open:m})=>[o.createElementVNode("div",{class:o.normalizeClass(["pbx-relative pbx-mt-2",m?"pbx-z-50":"pbx-z-0"])},[o.createVNode(o.unref(Dn),{class:"pbx-myPrimarySelect",id:"border-color"},{default:o.withCtx(()=>{var g;return[o.createElementVNode("span",mte,[d.value==="none"?(o.openBlock(),o.createElementBlock("div",gte,[...b[6]||(b[6]=[o.createElementVNode("div",{class:"pbx-myPrimaryColorPreview pbx-border-none"},[o.createElementVNode("span",{class:"material-symbols-outlined"}," ev_shadow ")],-1)])])):o.createCommentVNode("",!0),l.value!=="none"?(o.openBlock(),o.createElementBlock("div",{key:1,class:o.normalizeClass(["pbx-aspect-square pbx-w-6 pbx-h-6 pbx-border-solid pbx-border pbx-border-gray-100 pbx-rounded-sm",`pbx-bg-${(g=l.value)==null?void 0:g.replace("pbx-border-","")}`])},null,2)):o.createCommentVNode("",!0),o.createElementVNode("span",ute,o.toDisplayString(l.value),1)])]}),_:1}),o.createVNode(o.Transition,{"leave-active-class":"pbx-transition pbx-ease-in pbx-duration-100","leave-from-class":"pbx-opacity-100","leave-to-class":"pbx-opacity-0"},{default:o.withCtx(()=>[o.createVNode(o.unref(zn),{class:"pbx-headless-dropdown pbx-absolute pbx-z-50 pbx-mt-1 pbx-max-h-56 pbx-w-full pbx-overflow-auto pbx-rounded-md pbx-bg-white pbx-text-base pbx-shadow-lg pbx-ring-1 pbx-ring-black pbx-ring-opacity-5 focus:pbx-outline-none sm:pbx-text-sm pbx-list-none pbx-p-0 pbx-m-0"},{default:o.withCtx(()=>[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(o.unref(Bi).borderColor,g=>(o.openBlock(),o.createBlock(o.unref(Er),{as:"template",onClick:b[4]||(b[4]=x=>o.unref(t).handleBorderColor(l.value??void 0)),key:g,value:g},{default:o.withCtx(({active:x})=>[o.createElementVNode("li",{class:o.normalizeClass([x?"pbx-bg-myPrimaryLinkColor pbx-text-white":"pbx-text-myPrimaryDarkGrayColor","pbx-relative pbx-cursor-default pbx-select-none pbx-py-2 pbx-pl-3 pbx-pr-9"])},[o.createElementVNode("div",xte,[g==="none"?(o.openBlock(),o.createElementBlock("div",hte,[...b[7]||(b[7]=[o.createElementVNode("div",{class:"pbx-myPrimaryColorPreview pbx-border-none"},[o.createElementVNode("span",{class:"material-symbols-outlined"}," ev_shadow ")],-1)])])):o.createCommentVNode("",!0),g!=="none"?(o.openBlock(),o.createElementBlock("div",{key:1,class:o.normalizeClass(["pbx-aspect-square pbx-w-6 pbx-h-6 pbx-bg-gray-950",`pbx-bg-${g.replace("pbx-border-","")}`])},null,2)):o.createCommentVNode("",!0),g==="none"?(o.openBlock(),o.createElementBlock("span",fte,o.toDisplayString(o.unref(e)("Transparent")),1)):o.createCommentVNode("",!0),g!=="none"?(o.openBlock(),o.createElementBlock("span",yte,o.toDisplayString(g),1)):o.createCommentVNode("",!0)])],2)]),_:2},1032,["value"]))),128))]),_:1})]),_:1})],2)]),_:1},8,["modelValue"])])]),_:1}))}}),wte={class:"pbx-flex pbx-items-center pbx-justify-between pbx-gap-4 pbx-rounded-lg pbx-border pbx-border-solid pbx-border-gray-100 pbx-bg-gray-50 pbx-px-4 pbx-py-3"},vte={class:"pbx-text-sm pbx-font-semibold pbx-text-myPrimaryDarkGrayColor pbx-my-0"},kte={class:"pbx-text-xs pbx-text-gray-500 pbx-my-0"},Ste={class:"pbx-grid pbx-grid-cols-1 pbx-gap-3"},Cte=["for"],Tte={class:"pbx-flex pbx-justify-between pbx-items-center pbx-gap-4 pbx-border pbx-border-gray-200 pbx-py-4 pbx-px-3 pbx-rounded-lg"},Ete=["id","value","onInput","onBlur"],Mte={class:"pbx-relative pbx-flex-shrink-0"},Pte=["title","onClick"],Bte={class:"pbx-border-t pbx-border-gray-100 pbx-pt-4 pbx-mt-2 pbx-flex pbx-items-center pbx-justify-between pbx-gap-3"},Lte={class:"pbx-text-sm pbx-font-semibold pbx-text-myPrimaryDarkGrayColor pbx-my-0"},Nte={class:"pbx-text-xs pbx-text-gray-500 pbx-my-0"},Ate=o.defineComponent({__name:"ThemeColorPresetManager",props:{embedded:{type:Boolean}},setup(r){const{translate:e}=ne(),{showToast:t}=tt(),i=fe,n=o.computed(()=>i.getPageBuilderConfig),{themeColorPresetSettings:a,setThemeColorPresetsEnabled:l,updateThemeColorPreset:s,resetToConfigDefaults:p}=Kl(n),d=o.ref({});function c(v){return d.value[v.id]??v.color}o.watch(()=>a.value.colors,v=>{v.forEach(M=>{var k;((k=document.activeElement)==null?void 0:k.id)!==`color-input-${M.id}`&&(d.value[M.id]=M.color)})},{deep:!0});const b=/^#?[0-9a-fA-F]{6}$/;function m(v,M){const C=M.target,k=C.value.trim();d.value[v.id]=C.value,b.test(k)&&s(v.id,{color:k})}function g(v){d.value[v.id]=v.color}function x(v,M){s(v,{enabled:M})}function u(v,M){s(v.id,{color:M})}const h=o.ref(null);function f(v){h.value=h.value===v?null:v}function w(){h.value=null}const y=o.ref(!1);function E(){y.value=!0}function S(){y.value=!1}function P(){p(),d.value={},y.value=!1,t(e("Theme colors reset to defaults"),"success")}return(v,M)=>(o.openBlock(),o.createElementBlock(o.Fragment,null,[o.createElementVNode("div",{class:o.normalizeClass(["pbx-flex pbx-flex-col pbx-gap-4",r.embedded?"":"pbx-mb-20"])},[o.createElementVNode("div",wte,[o.createElementVNode("div",null,[o.createElementVNode("p",vte,o.toDisplayString(o.unref(e)("Enable theme color presets")),1),o.createElementVNode("p",kte,o.toDisplayString(o.unref(e)("Use saved hex colors in text and background color menus")),1)]),o.createVNode(Jt,{"model-value":o.unref(a).enabled,"onUpdate:modelValue":o.unref(l)},null,8,["model-value","onUpdate:modelValue"])]),o.createElementVNode("div",Ste,[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(o.unref(a).colors,C=>(o.openBlock(),o.createElementBlock("div",{key:C.id,class:"pbx-myInputGroup"},[o.createElementVNode("label",{for:`color-input-${C.id}`,class:"pbx-myPrimaryInputLabel"},o.toDisplayString(o.unref(e)(C.label)),9,Cte),o.createElementVNode("div",Tte,[o.createVNode(Jt,{"model-value":C.enabled,"onUpdate:modelValue":k=>x(C.id,k)},null,8,["model-value","onUpdate:modelValue"]),o.createElementVNode("input",{id:`color-input-${C.id}`,value:c(C),type:"text",maxlength:"7",placeholder:"#rrggbb",class:"pbx-myPrimaryInput pbx-w-full",onInput:k=>m(C,k),onBlur:k=>g(C)},null,40,Ete),o.createElementVNode("div",Mte,[o.createElementVNode("button",{type:"button",title:C.color,class:"pbx-cursor-pointer pbx-border-0 pbx-p-0 pbx-bg-transparent pbx-block pbx-flex-shrink-0",style:{width:"2rem",height:"2rem"},onClick:o.withModifiers(k=>f(C.id),["stop"])},[o.createElementVNode("span",{style:o.normalizeStyle([{backgroundColor:C.color},{display:"block",width:"60%",height:"60%","border-radius":"9999px",border:"1px solid rgba(0, 0, 0, 0.1)","box-shadow":`0 1px 4px rgba(0, 0, 0, 0.1),
364
+ `,!c&&!fz(p,!0)&&i++}),n.trimEnd()}function Oe(r=200){return new Promise(e=>{setTimeout(e,r)})}const ns=o.ref(!1),yz=o.ref(""),as=o.ref(""),sc=o.ref("element"),Mi=o.ref(!1),Vn=o.ref(null);function ls(){function r(i,n,a="element"){yz.value=i,as.value=G$(n),sc.value=a,Vn.value=null,Mi.value=!1,ns.value=!0}function e(){ns.value=!1,Vn.value=null,Mi.value=!1}async function t(){const i=ke(),{showToast:n}=tt(),{translate:a}=ne();Mi.value=!0,Vn.value=null,await Oe(300);const l=sc.value==="page"?await i.applyModifiedComponents(as.value):await i.applyModifiedHTML(as.value);if(l){Vn.value=l,n(l,"error"),Mi.value=!1;return}n(a("HTML updated successfully"),"success"),ns.value=!1,Mi.value=!1}return{show:ns,title:yz,html:as,mode:sc,isLoading:Mi,error:Vn,openHtmlEditor:r,closeHtmlEditor:e,saveHtmlEditor:t}}const Y$={class:"pbx-editorSectionDesc"},Q$={class:"pbx-inspectorActionStack"},X$=o.defineComponent({name:"ElementHtmlEditorSettingsEditor",__name:"ElementHtmlEditorSettingsEditor",setup(r){const{translate:e}=ne(),t=fe,{openHtmlViewer:i}=is(),{openHtmlEditor:n}=ls(),a=o.computed(()=>t.getElement),l=()=>{a.value&&n(e("Element HTML"),a.value.outerHTML,"element")},s=()=>{a.value&&i(e("Element HTML"),a.value.outerHTML)};return(p,d)=>(o.openBlock(),o.createBlock(Re,null,{title:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(o.unref(e)("Element HTML")),1)]),content:o.withCtx(()=>[o.createElementVNode("p",Y$,o.toDisplayString(o.unref(e)("Element HTML editor description")),1),o.createElementVNode("div",Q$,[o.createVNode(Mr,{icon:"visibility",label:o.unref(e)("View element HTML"),hint:o.unref(e)("Preview selected element markup"),onClick:s},null,8,["label","hint"]),o.createVNode(Mr,{icon:"deployed_code",label:o.unref(e)("Open element HTML editor"),hint:o.unref(e)("Edit selected element markup"),onClick:l},null,8,["label","hint"])])]),_:1}))}});function Z$(r){return new Promise((e,t)=>{const i=new window.Image;i.onload=e,i.onerror=t,i.src=r})}const $$={class:"pbx-editorFieldGroup"},eee={class:"pbx-editorFieldGroup"},tee=["src"],ree={class:"pbx-editorFieldGroup pbx-rounded-lg pbx-border pbx-border-solid pbx-border-gray-200 pbx-bg-gray-50 pbx-px-4 pbx-py-8 pbx-text-center"},oee={class:"pbx-editorSectionDesc pbx-mb-0"},iee=o.defineComponent({__name:"ImageEditor",setup(r){const{translate:e}=ne(),t=fe,i=o.inject("CustomMediaComponent",null),n=o.ref(null),a=o.ref(!1),l=o.ref(!1),s=o.ref(""),p=o.ref(""),d=o.ref(""),c=o.ref(null),b=o.ref(null),m=o.ref(null),g=o.computed(()=>(t.getBasePrimaryImage&&f(t.getBasePrimaryImage),t.getBasePrimaryImage));function x(w){return w?w.tagName==="IMG"?!0:!!t.getBasePrimaryImage:!1}function u(w){var y;x(w)&&((y=n.value)==null||y.open())}o.watch(()=>t.getElement,w=>{u(w)},{immediate:!0,flush:"post"}),o.watch(()=>t.getBasePrimaryImage,()=>{u(t.getElement)}),o.onMounted(()=>{o.nextTick(()=>{u(t.getElement)})});const h=function(){l.value=!0,s.value=e("Media Library"),p.value=null,d.value=e("Close"),c.value=e("Select image"),m.value=function(){l.value=!1}},f=async function(w){a.value=!0,w&&typeof w=="string"&&w.length>2&&(await Z$(w),await Oe(200),a.value=!1)};return(w,y)=>(o.openBlock(),o.createElementBlock(o.Fragment,null,[o.createVNode(Re,{ref_key:"imageAccordionRef",ref:n},{title:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(o.unref(e)("Image")),1)]),content:o.withCtx(()=>[o.withDirectives(o.createElementVNode("div",$$,[...y[1]||(y[1]=[o.createElementVNode("div",{class:"pbx-flex pbx-min-h-40 pbx-items-center pbx-justify-center"},[o.createElementVNode("div",{class:"pbx-inline-block pbx-h-8 pbx-w-8 pbx-animate-spin pbx-rounded-full pbx-border-4 pbx-border-solid pbx-border-current pbx-border-r-transparent pbx-align-[-0.125em] motion-reduce:pbx-animate-[spin_1.5s_linear_infinite]"},[o.createElementVNode("span",{class:"!pbx-absolute !pbx-m-px !pbx-h-px !pbx-w-px !pbx-overflow-hidden !pbx-whitespace-nowrap !pbx-border-0 !pbx-p-0 !pbx-[clip:rect(0,0,0,0)]"},"Loading...")])],-1)])],512),[[o.vShow,a.value]]),o.withDirectives(o.createElementVNode("div",eee,[o.createElementVNode("img",{class:"pbx-w-full pbx-cursor-pointer pbx-rounded-lg pbx-object-cover pbx-object-center",src:g.value??void 0,onClick:h,alt:"image"},null,8,tee)],512),[[o.vShow,g.value&&!a.value]]),o.withDirectives(o.createElementVNode("div",ree,[o.createElementVNode("p",oee,o.toDisplayString(o.unref(e)("No image has been selected.")),1)],512),[[o.vShow,!a.value&&!g.value]])]),_:1},512),o.createVNode(TD,{open:l.value,title:s.value,description:p.value,firstButtonText:d.value,secondButtonText:c.value??void 0,thirdButtonText:b.value??void 0,customMediaComponent:o.unref(i)??void 0,onFirstMediaButtonFunction:y[0]||(y[0]=()=>{var E;return(E=m.value)==null?void 0:E.call(m)})},null,8,["open","title","description","firstButtonText","secondButtonText","thirdButtonText","customMediaComponent"])],64))}}),ss={opacities:["none","pbx-opacity-0","pbx-opacity-5","pbx-opacity-10","pbx-opacity-20","pbx-opacity-25","pbx-opacity-30","pbx-opacity-40","pbx-opacity-50","pbx-opacity-60","pbx-opacity-70","pbx-opacity-75","pbx-opacity-80","pbx-opacity-90","pbx-opacity-95","pbx-opacity-100"],backgroundOpacities:["none","pbx-bg-opacity-0","pbx-bg-opacity-5","pbx-bg-opacity-10","pbx-bg-opacity-20","pbx-bg-opacity-25","pbx-bg-opacity-30","pbx-bg-opacity-40","pbx-bg-opacity-50","pbx-bg-opacity-60","pbx-bg-opacity-70","pbx-bg-opacity-75","pbx-bg-opacity-80","pbx-bg-opacity-90","pbx-bg-opacity-95","pbx-bg-opacity-100"]},nee={class:"pbx-editorFieldGroup"},aee={class:"pbx-relative"},lee={class:"pbx-flex pbx-items-center pbx-gap-2"},see={key:0},pee={class:"pbx-flex pbx-items-center"},dee={key:0},cee={key:2,class:"pbx-ml-3"},bee={key:3,class:"pbx-ml-3"},mee=o.defineComponent({__name:"BackgroundOpacityControl",setup(r){const e=ke(),{translate:t}=ne(),i=fe,n=o.ref(null),a=o.computed(()=>i.getBackgroundOpacity);return o.watch(a,async l=>{n.value=l,await e.initializeElementStyles()},{immediate:!0}),(l,s)=>(o.openBlock(),o.createElementBlock("div",nee,[o.createVNode(o.unref(_n),{as:"div",modelValue:n.value,"onUpdate:modelValue":s[0]||(s[0]=p=>n.value=p)},{default:o.withCtx(()=>[o.createElementVNode("div",aee,[o.createVNode(o.unref(Dn),{class:"pbx-myPrimarySelect",id:"bg-opacity"},{default:o.withCtx(()=>[o.createElementVNode("span",lee,[n.value==="none"?(o.openBlock(),o.createElementBlock("div",see,[...s[1]||(s[1]=[o.createElementVNode("div",{class:"pbx-myPrimaryColorPreview pbx-border-none"},[o.createElementVNode("span",{class:"material-symbols-outlined"}," ev_shadow ")],-1)])])):o.createCommentVNode("",!0),n.value!=="none"?(o.openBlock(),o.createElementBlock("div",{key:1,class:o.normalizeClass(["pbx-aspect-square pbx-w-6 pbx-h-6 pbx-bg-gray-950",`${n.value}`])},null,2)):o.createCommentVNode("",!0),o.createElementVNode("span",{class:o.normalizeClass(["pbx-block pbx-truncate",[(n.value!=="none","")]])},o.toDisplayString(n.value==="none"?o.unref(t)("Transparent"):n.value),3)])]),_:1}),o.createVNode(o.Transition,{"leave-active-class":"pbx-transition pbx-ease-in pbx-duration-100","leave-from-class":"pbx-opacity-100","leave-to-class":"pbx-opacity-0"},{default:o.withCtx(()=>[o.createVNode(o.unref(zn),{class:"pbx-absolute pbx-z-10 pbx-mt-1 pbx-max-h-56 pbx-w-full pbx-overflow-auto pbx-rounded-md pbx-bg-white pbx-text-base pbx-shadow-lg pbx-ring-1 pbx-ring-black pbx-ring-opacity-5 focus:pbx-outline-none sm:pbx-text-sm pbx-list-none pbx-p-0 pbx-m-0"},{default:o.withCtx(()=>[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(o.unref(ss).backgroundOpacities,p=>(o.openBlock(),o.createBlock(o.unref(Er),{as:"template",onClick:d=>o.unref(e).handleBackgroundOpacity(p),key:p,value:p},{default:o.withCtx(({active:d})=>[o.createElementVNode("li",{class:o.normalizeClass([d?"pbx-bg-myPrimaryLinkColor text-white":"pbx-text-myPrimaryDarkGrayColor","pbx-relative pbx-cursor-default pbx-select-none pbx-py-2 pbx-pl-3 pbx-pr-9"])},[o.createElementVNode("div",pee,[p==="none"?(o.openBlock(),o.createElementBlock("div",dee,[...s[2]||(s[2]=[o.createElementVNode("div",{class:"pbx-myPrimaryColorPreview pbx-border-none"},[o.createElementVNode("span",{class:"material-symbols-outlined"}," ev_shadow ")],-1)])])):o.createCommentVNode("",!0),p!=="none"?(o.openBlock(),o.createElementBlock("div",{key:1,class:o.normalizeClass(["pbx-aspect-square pbx-w-6 pbx-h-6 pbx-bg-gray-950",`${p}`])},null,2)):o.createCommentVNode("",!0),p==="none"?(o.openBlock(),o.createElementBlock("span",cee,o.toDisplayString(o.unref(t)("Transparent")),1)):o.createCommentVNode("",!0),p!=="none"?(o.openBlock(),o.createElementBlock("span",bee,o.toDisplayString(p),1)):o.createCommentVNode("",!0)])],2)]),_:2},1032,["onClick","value"]))),128))]),_:1})]),_:1})])]),_:1},8,["modelValue"])]))}}),gee={class:"pbx-editorFieldGroup"},uee={class:"pbx-relative"},xee={class:"pbx-flex pbx-items-center pbx-gap-2"},hee={key:0},fee={class:"pbx-flex pbx-items-center"},yee={key:0},wee={key:2,class:"pbx-ml-3"},vee={key:3,class:"pbx-ml-3"},kee=o.defineComponent({__name:"OpacityControl",setup(r){const e=ke(),{translate:t}=ne(),i=fe,n=o.ref(null),a=o.computed(()=>i.getOpacity);return o.watch(a,async l=>{n.value=l,await e.initializeElementStyles()},{immediate:!0}),(l,s)=>(o.openBlock(),o.createElementBlock("div",gee,[o.createVNode(o.unref(_n),{as:"div",modelValue:n.value,"onUpdate:modelValue":s[0]||(s[0]=p=>n.value=p)},{default:o.withCtx(()=>[o.createElementVNode("div",uee,[o.createVNode(o.unref(Dn),{class:"pbx-myPrimarySelect",id:"default-opacity"},{default:o.withCtx(()=>[o.createElementVNode("span",xee,[n.value==="none"?(o.openBlock(),o.createElementBlock("div",hee,[...s[1]||(s[1]=[o.createElementVNode("div",{class:"pbx-myPrimaryColorPreview pbx-border-none"},[o.createElementVNode("span",{class:"material-symbols-outlined"}," ev_shadow ")],-1)])])):o.createCommentVNode("",!0),n.value!=="none"?(o.openBlock(),o.createElementBlock("div",{key:1,class:o.normalizeClass(["pbx-aspect-square pbx-w-6 pbx-h-6 pbx-bg-gray-950",`${n.value}`])},null,2)):o.createCommentVNode("",!0),o.createElementVNode("span",{class:o.normalizeClass(["pbx-block pbx-truncate",[(n.value!=="none","")]])},o.toDisplayString(n.value==="none"?o.unref(t)("Transparent"):n.value),3)])]),_:1}),o.createVNode(o.Transition,{"leave-active-class":"pbx-transition pbx-ease-in pbx-duration-100","leave-from-class":"pbx-opacity-100","leave-to-class":"pbx-opacity-0"},{default:o.withCtx(()=>[o.createVNode(o.unref(zn),{class:"pbx-absolute pbx-z-10 pbx-mt-1 pbx-max-h-56 pbx-w-full pbx-overflow-auto pbx-rounded-md pbx-bg-white pbx-text-base pbx-shadow-lg pbx-ring-1 pbx-ring-black pbx-ring-opacity-5 focus:pbx-outline-none sm:pbx-text-sm pbx-list-none pbx-p-0 pbx-m-0"},{default:o.withCtx(()=>[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(o.unref(ss).opacities,p=>(o.openBlock(),o.createBlock(o.unref(Er),{as:"template",onClick:d=>o.unref(e).handleOpacity(p),key:p,value:p},{default:o.withCtx(({active:d})=>[o.createElementVNode("li",{class:o.normalizeClass([d?"pbx-bg-myPrimaryLinkColor text-white":"pbx-text-myPrimaryDarkGrayColor","pbx-relative pbx-cursor-default pbx-select-none pbx-py-2 pbx-pl-3 pbx-pr-9"])},[o.createElementVNode("div",fee,[p==="none"?(o.openBlock(),o.createElementBlock("div",yee,[...s[2]||(s[2]=[o.createElementVNode("div",{class:"pbx-myPrimaryColorPreview pbx-border-none"},[o.createElementVNode("span",{class:"material-symbols-outlined"}," ev_shadow ")],-1)])])):o.createCommentVNode("",!0),p!=="none"?(o.openBlock(),o.createElementBlock("div",{key:1,class:o.normalizeClass(["pbx-aspect-square pbx-w-6 pbx-h-6 pbx-bg-gray-950",`${p}`])},null,2)):o.createCommentVNode("",!0),p==="none"?(o.openBlock(),o.createElementBlock("span",wee,o.toDisplayString(o.unref(t)("Transparent")),1)):o.createCommentVNode("",!0),p!=="none"?(o.openBlock(),o.createElementBlock("span",vee,o.toDisplayString(p),1)):o.createCommentVNode("",!0)])],2)]),_:2},1032,["onClick","value"]))),128))]),_:1})]),_:1})])]),_:1},8,["modelValue"])]))}}),See={class:"pbx-editorSectionTitle"},Cee={class:"pbx-editorSectionTitle"},Tee=o.defineComponent({__name:"OpacityEditor",setup(r){const{translate:e}=ne();return(t,i)=>(o.openBlock(),o.createBlock(Re,null,{title:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(o.unref(e)("Opacity & Transparency")),1)]),content:o.withCtx(()=>[o.createElementVNode("p",See,o.toDisplayString(o.unref(e)("Opacity")),1),o.createVNode(kee),i[0]||(i[0]=o.createElementVNode("hr",null,null,-1)),o.createElementVNode("p",Cee,o.toDisplayString(o.unref(e)("Background Opacity")),1),o.createVNode(mee)]),_:1}))}}),Eee={key:0,class:"pbx-text-[9px] pbx-font-medium pbx-uppercase pbx-tracking-wide pbx-text-gray-400 pbx-leading-none"},Pi=o.defineComponent({__name:"SpacingStepper",props:{value:{},sideLabel:{},compact:{type:Boolean}},emits:["decrement","increment"],setup(r){return(e,t)=>(o.openBlock(),o.createElementBlock("div",{class:o.normalizeClass(["pbx-flex pbx-items-center pbx-gap-0.5 pbx-rounded-lg pbx-bg-gray-100/80 pbx-p-0.5",r.compact?"pbx-scale-90 pbx-origin-center":""])},[o.createElementVNode("button",{type:"button",class:"pbx-flex pbx-h-7 pbx-w-7 pbx-shrink-0 pbx-cursor-pointer pbx-items-center pbx-justify-center pbx-rounded-md pbx-border-none pbx-bg-white pbx-text-gray-600 pbx-shadow-sm pbx-transition-colors hover:pbx-bg-myPrimaryLinkColor hover:pbx-text-white focus-visible:pbx-outline-none",onClick:t[0]||(t[0]=i=>e.$emit("decrement"))},[...t[2]||(t[2]=[o.createElementVNode("span",{class:"material-symbols-outlined pbx-materialIcon18"},"remove",-1)])]),o.createElementVNode("div",{class:o.normalizeClass(["pbx-flex pbx-flex-col pbx-items-center pbx-justify-center",r.sideLabel?"pbx-min-w-[2.75rem]":"pbx-min-w-[2.25rem]"])},[r.sideLabel?(o.openBlock(),o.createElementBlock("span",Eee,o.toDisplayString(r.sideLabel),1)):o.createCommentVNode("",!0),o.createElementVNode("span",{class:o.normalizeClass(["pbx-font-semibold pbx-tabular-nums pbx-text-gray-800",r.sideLabel?"pbx-text-xs":"pbx-text-sm"])},o.toDisplayString(r.value),3)],2),o.createElementVNode("button",{type:"button",class:"pbx-flex pbx-h-7 pbx-w-7 pbx-shrink-0 pbx-cursor-pointer pbx-items-center pbx-justify-center pbx-rounded-md pbx-border-none pbx-bg-white pbx-text-gray-600 pbx-shadow-sm pbx-transition-colors hover:pbx-bg-myPrimaryLinkColor hover:pbx-text-white focus-visible:pbx-outline-none",onClick:t[1]||(t[1]=i=>e.$emit("increment"))},[...t[3]||(t[3]=[o.createElementVNode("span",{class:"material-symbols-outlined pbx-materialIcon18"},"add",-1)])])],2))}}),ce={verticalPadding:["none","pbx-py-0","pbx-py-0.5","pbx-py-1","pbx-py-1.5","pbx-py-2","pbx-py-2.5","pbx-py-3","pbx-py-3.5","pbx-py-4","pbx-py-5","pbx-py-6","pbx-py-7","pbx-py-8","pbx-py-9","pbx-py-10","pbx-py-11","pbx-py-12","pbx-py-14","pbx-py-16","pbx-py-20","pbx-py-24","pbx-py-28","pbx-py-32","pbx-py-36","pbx-py-40","pbx-py-44","pbx-py-48","pbx-py-52","pbx-py-56","pbx-py-60","pbx-py-64","pbx-py-72","pbx-py-80","pbx-py-96"],horizontalPadding:["none","pbx-px-0","pbx-px-0.5","pbx-px-1","pbx-px-1.5","pbx-px-2","pbx-px-2.5","pbx-px-3","pbx-px-3.5","pbx-px-4","pbx-px-5","pbx-px-6","pbx-px-7","pbx-px-8","pbx-px-9","pbx-px-10","pbx-px-11","pbx-px-12","pbx-px-14","pbx-px-16","pbx-px-20","pbx-px-24","pbx-px-28","pbx-px-32","pbx-px-36","pbx-px-40","pbx-px-44","pbx-px-48","pbx-px-52","pbx-px-56","pbx-px-60","pbx-px-64","pbx-px-72","pbx-px-80","pbx-px-96"],topPadding:["none","pbx-pt-0","pbx-pt-0.5","pbx-pt-1","pbx-pt-1.5","pbx-pt-2","pbx-pt-2.5","pbx-pt-3","pbx-pt-3.5","pbx-pt-4","pbx-pt-5","pbx-pt-6","pbx-pt-7","pbx-pt-8","pbx-pt-9","pbx-pt-10","pbx-pt-11","pbx-pt-12","pbx-pt-14","pbx-pt-16","pbx-pt-20","pbx-pt-24","pbx-pt-28","pbx-pt-32","pbx-pt-36","pbx-pt-40","pbx-pt-44","pbx-pt-48","pbx-pt-52","pbx-pt-56","pbx-pt-60","pbx-pt-64","pbx-pt-72","pbx-pt-80","pbx-pt-96"],rightPadding:["none","pbx-pr-0","pbx-pr-0.5","pbx-pr-1","pbx-pr-1.5","pbx-pr-2","pbx-pr-2.5","pbx-pr-3","pbx-pr-3.5","pbx-pr-4","pbx-pr-5","pbx-pr-6","pbx-pr-7","pbx-pr-8","pbx-pr-9","pbx-pr-10","pbx-pr-11","pbx-pr-12","pbx-pr-14","pbx-pr-16","pbx-pr-20","pbx-pr-24","pbx-pr-28","pbx-pr-32","pbx-pr-36","pbx-pr-40","pbx-pr-44","pbx-pr-48","pbx-pr-52","pbx-pr-56","pbx-pr-60","pbx-pr-64","pbx-pr-72","pbx-pr-80","pbx-pr-96"],bottomPadding:["none","pbx-pb-0","pbx-pb-0.5","pbx-pb-1","pbx-pb-1.5","pbx-pb-2","pbx-pb-2.5","pbx-pb-3","pbx-pb-3.5","pbx-pb-4","pbx-pb-5","pbx-pb-6","pbx-pb-7","pbx-pb-8","pbx-pb-9","pbx-pb-10","pbx-pb-11","pbx-pb-12","pbx-pb-14","pbx-pb-16","pbx-pb-20","pbx-pb-24","pbx-pb-28","pbx-pb-32","pbx-pb-36","pbx-pb-40","pbx-pb-44","pbx-pb-48","pbx-pb-52","pbx-pb-56","pbx-pb-60","pbx-pb-64","pbx-pb-72","pbx-pb-80","pbx-pb-96"],leftPadding:["none","pbx-pl-0","pbx-pl-0.5","pbx-pl-1","pbx-pl-1.5","pbx-pl-2","pbx-pl-2.5","pbx-pl-3","pbx-pl-3.5","pbx-pl-4","pbx-pl-5","pbx-pl-6","pbx-pl-7","pbx-pl-8","pbx-pl-9","pbx-pl-10","pbx-pl-11","pbx-pl-12","pbx-pl-14","pbx-pl-16","pbx-pl-20","pbx-pl-24","pbx-pl-28","pbx-pl-32","pbx-pl-36","pbx-pl-40","pbx-pl-44","pbx-pl-48","pbx-pl-52","pbx-pl-56","pbx-pl-60","pbx-pl-64","pbx-pl-72","pbx-pl-80","pbx-pl-96"],verticalMargin:["none","pbx-my-0","pbx-my-0.5","pbx-my-1","pbx-my-1.5","pbx-my-2","pbx-my-2.5","pbx-my-3","pbx-my-3.5","pbx-my-4","pbx-my-5","pbx-my-6","pbx-my-7","pbx-my-8","pbx-my-9","pbx-my-10","pbx-my-11","pbx-my-12","pbx-my-14","pbx-my-16","pbx-my-20","pbx-my-24","pbx-my-28","pbx-my-32","pbx-my-36","pbx-my-40","pbx-my-44","pbx-my-48","pbx-my-52","pbx-my-56","pbx-my-60","pbx-my-64","pbx-my-72","pbx-my-80","pbx-my-96"],horizontalMargin:["none","pbx-mx-0","pbx-mx-0.5","pbx-mx-1","pbx-mx-1.5","pbx-mx-2","pbx-mx-2.5","pbx-mx-3","pbx-mx-3.5","pbx-mx-4","pbx-mx-5","pbx-mx-6","pbx-mx-7","pbx-mx-8","pbx-mx-9","pbx-mx-10","pbx-mx-11","pbx-mx-12","pbx-mx-14","pbx-mx-16","pbx-mx-20","pbx-mx-24","pbx-mx-28","pbx-mx-32","pbx-mx-36","pbx-mx-40","pbx-mx-44","pbx-mx-48","pbx-mx-52","pbx-mx-56","pbx-mx-60","pbx-mx-64","pbx-mx-72","pbx-mx-80","pbx-mx-96"],topMargin:["none","pbx-mt-0","pbx-mt-0.5","pbx-mt-1","pbx-mt-1.5","pbx-mt-2","pbx-mt-2.5","pbx-mt-3","pbx-mt-3.5","pbx-mt-4","pbx-mt-5","pbx-mt-6","pbx-mt-7","pbx-mt-8","pbx-mt-9","pbx-mt-10","pbx-mt-11","pbx-mt-12","pbx-mt-14","pbx-mt-16","pbx-mt-20","pbx-mt-24","pbx-mt-28","pbx-mt-32","pbx-mt-36","pbx-mt-40","pbx-mt-44","pbx-mt-48","pbx-mt-52","pbx-mt-56","pbx-mt-60","pbx-mt-64","pbx-mt-72","pbx-mt-80","pbx-mt-96"],rightMargin:["none","pbx-mr-0","pbx-mr-0.5","pbx-mr-1","pbx-mr-1.5","pbx-mr-2","pbx-mr-2.5","pbx-mr-3","pbx-mr-3.5","pbx-mr-4","pbx-mr-5","pbx-mr-6","pbx-mr-7","pbx-mr-8","pbx-mr-9","pbx-mr-10","pbx-mr-11","pbx-mr-12","pbx-mr-14","pbx-mr-16","pbx-mr-20","pbx-mr-24","pbx-mr-28","pbx-mr-32","pbx-mr-36","pbx-mr-40","pbx-mr-44","pbx-mr-48","pbx-mr-52","pbx-mr-56","pbx-mr-60","pbx-mr-64","pbx-mr-72","pbx-mr-80","pbx-mr-96"],bottomMargin:["none","pbx-mb-0","pbx-mb-0.5","pbx-mb-1","pbx-mb-1.5","pbx-mb-2","pbx-mb-2.5","pbx-mb-3","pbx-mb-3.5","pbx-mb-4","pbx-mb-5","pbx-mb-6","pbx-mb-7","pbx-mb-8","pbx-mb-9","pbx-mb-10","pbx-mb-11","pbx-mb-12","pbx-mb-14","pbx-mb-16","pbx-mb-20","pbx-mb-24","pbx-mb-28","pbx-mb-32","pbx-mb-36","pbx-mb-40","pbx-mb-44","pbx-mb-48","pbx-mb-52","pbx-mb-56","pbx-mb-60","pbx-mb-64","pbx-mb-72","pbx-mb-80","pbx-mb-96"],leftMargin:["none","pbx-ml-0","pbx-ml-0.5","pbx-ml-1","pbx-ml-1.5","pbx-ml-2","pbx-ml-2.5","pbx-ml-3","pbx-ml-3.5","pbx-ml-4","pbx-ml-5","pbx-ml-6","pbx-ml-7","pbx-ml-8","pbx-ml-9","pbx-ml-10","pbx-ml-11","pbx-ml-12","pbx-ml-14","pbx-ml-16","pbx-ml-20","pbx-ml-24","pbx-ml-28","pbx-ml-32","pbx-ml-36","pbx-ml-40","pbx-ml-44","pbx-ml-48","pbx-ml-52","pbx-ml-56","pbx-ml-60","pbx-ml-64","pbx-ml-72","pbx-ml-80","pbx-ml-96"]},Mee={class:"pbx-editorSectionTitle"},Pee={class:"pbx-editorSectionDesc"},Bee={class:"pbx-mb-4 pbx-space-y-2 pbx-rounded-xl pbx-border pbx-border-solid pbx-border-gray-200 pbx-bg-white pbx-p-3"},Lee={class:"pbx-flex pbx-items-center pbx-justify-between pbx-gap-3"},Nee={class:"pbx-text-xs pbx-font-medium pbx-text-gray-500"},Aee={class:"pbx-flex pbx-items-center pbx-justify-between pbx-gap-3"},_ee={class:"pbx-text-xs pbx-font-medium pbx-text-gray-500"},Dee={class:"pbx-editorSectionTitle"},zee={class:"pbx-flex pbx-flex-col pbx-items-center pbx-justify-center"},Iee={class:"pbx-mb-3 pbx-flex pbx-justify-center"},Vee={class:"pbx-items-center pbx-gap-2",style:{display:"grid","grid-template-columns":"auto 1fr auto"}},Hee={class:"pbx-flex pbx-h-10 pbx-items-center pbx-justify-center pbx-rounded-lg pbx-border pbx-border-solid pbx-border-gray-200/80 pbx-bg-white pbx-shadow-sm"},Ree={class:"pbx-select-none pbx-text-[10px] pbx-font-medium pbx-text-gray-400"},Oee={class:"pbx-mt-3 pbx-flex pbx-justify-center"},wz=o.defineComponent({__name:"SpacingControl",props:{mode:{}},setup(r){const e=r,{translate:t}=ne(),i=ke(),n=fe,a=o.computed(()=>e.mode==="padding"),l=o.computed(()=>a.value?"pbx-bg-emerald-50/40":"pbx-bg-amber-50/40"),s=o.computed(()=>a.value?"pbx-border-emerald-200/60":"pbx-border-amber-200/60"),p=o.ref(null),d=o.ref(null),c=o.ref(null),b=o.ref(null),m=o.ref(null),g=o.ref(null),x=o.computed(()=>a.value?n.getFontVerticalPadding:n.getFontVerticalMargin),u=o.computed(()=>a.value?n.getFontHorizontalPadding:n.getFontHorizontalMargin),h=o.computed(()=>a.value?n.getFontTopPadding:n.getFontTopMargin),f=o.computed(()=>a.value?n.getFontRightPadding:n.getFontRightMargin),w=o.computed(()=>a.value?n.getFontBottomPadding:n.getFontBottomMargin),y=o.computed(()=>a.value?n.getFontLeftPadding:n.getFontLeftMargin);o.watch(x,async D=>{p.value=D,await i.initializeElementStyles()},{immediate:!0}),o.watch(u,async D=>{d.value=D,await i.initializeElementStyles()},{immediate:!0}),o.watch(h,async D=>{c.value=D,await i.initializeElementStyles()},{immediate:!0}),o.watch(f,async D=>{b.value=D,await i.initializeElementStyles()},{immediate:!0}),o.watch(w,async D=>{m.value=D,await i.initializeElementStyles()},{immediate:!0}),o.watch(y,async D=>{g.value=D,await i.initializeElementStyles()},{immediate:!0});function E(D){if(!D||D==="none")return"–";const q=D.match(/-(\d[\d.]*)$/);return q?q[1]:"–"}function S(){return E(c.value&&c.value!=="none"?c.value:p.value)}function P(){return E(m.value&&m.value!=="none"?m.value:p.value)}function v(){return E(g.value&&g.value!=="none"?g.value:d.value)}function M(){return E(b.value&&b.value!=="none"?b.value:d.value)}function C(D,q,Y){const Q=D.indexOf(q??"none");return D[Math.max(0,Math.min(D.length-1,Math.max(0,Q)+Y))]}function k(D){const q=a.value?ce.verticalPadding:ce.verticalMargin,Y=C(q,p.value,D);p.value=Y,a.value?i.handleVerticalPadding(Y):i.handleVerticalMargin(Y)}function T(D){const q=a.value?ce.horizontalPadding:ce.horizontalMargin,Y=C(q,d.value,D);d.value=Y,a.value?i.handleHorizontalPadding(Y):i.handleHorizontalMargin(Y)}function V(D){const q=a.value?ce.topPadding:ce.topMargin,Y=C(q,c.value,D);c.value=Y,a.value?i.handleTopPadding(Y):i.handleTopMargin(Y)}function N(D){const q=a.value?ce.rightPadding:ce.rightMargin,Y=C(q,b.value,D);b.value=Y,a.value?i.handleRightPadding(Y):i.handleRightMargin(Y)}function A(D){const q=a.value?ce.bottomPadding:ce.bottomMargin,Y=C(q,m.value,D);m.value=Y,a.value?i.handleBottomPadding(Y):i.handleBottomMargin(Y)}function I(D){const q=a.value?ce.leftPadding:ce.leftMargin,Y=C(q,g.value,D);g.value=Y,a.value?i.handleLeftPadding(Y):i.handleLeftMargin(Y)}return(D,q)=>(o.openBlock(),o.createBlock(Re,null,{title:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(o.unref(t)(a.value?"Padding":"Margin")),1)]),content:o.withCtx(()=>[o.createElementVNode("p",Mee,o.toDisplayString(o.unref(t)("All sides")),1),o.createElementVNode("p",Pee,o.toDisplayString(o.unref(t)("Applies across all screen sizes")),1),o.createElementVNode("div",Bee,[o.createElementVNode("div",Lee,[o.createElementVNode("span",Nee,o.toDisplayString(o.unref(t)("Vertical")),1),o.createVNode(Pi,{value:E(p.value),onDecrement:q[0]||(q[0]=Y=>k(-1)),onIncrement:q[1]||(q[1]=Y=>k(1))},null,8,["value"])]),q[12]||(q[12]=o.createElementVNode("div",{class:"pbx-h-px pbx-bg-gray-100"},null,-1)),o.createElementVNode("div",Aee,[o.createElementVNode("span",_ee,o.toDisplayString(o.unref(t)("Horizontal")),1),o.createVNode(Pi,{value:E(d.value),onDecrement:q[2]||(q[2]=Y=>T(-1)),onIncrement:q[3]||(q[3]=Y=>T(1))},null,8,["value"])])]),q[13]||(q[13]=o.createElementVNode("hr",null,null,-1)),o.createElementVNode("div",Dee,o.toDisplayString(o.unref(t)(a.value?"Padding":"Margin")),1),o.createElementVNode("div",{class:o.normalizeClass(["pbx-relative pbx-rounded-full pbx-border pbx-border-solid pbx-p-8 pbx-pt-8 pbx-flex pbx-items-center pbx-justify-center",[l.value,s.value]])},[o.createElementVNode("div",zee,[o.createElementVNode("div",Iee,[o.createVNode(Pi,{value:S(),"side-label":o.unref(t)("top"),onDecrement:q[4]||(q[4]=Y=>V(-1)),onIncrement:q[5]||(q[5]=Y=>V(1))},null,8,["value","side-label"])]),o.createElementVNode("div",Vee,[o.createVNode(Pi,{value:v(),"side-label":o.unref(t)("left"),compact:"",onDecrement:q[6]||(q[6]=Y=>I(-1)),onIncrement:q[7]||(q[7]=Y=>I(1))},null,8,["value","side-label"]),o.createElementVNode("div",Hee,[o.createElementVNode("span",Ree,o.toDisplayString(o.unref(t)("element")),1)]),o.createVNode(Pi,{value:M(),"side-label":o.unref(t)("right"),compact:"",onDecrement:q[8]||(q[8]=Y=>N(-1)),onIncrement:q[9]||(q[9]=Y=>N(1))},null,8,["value","side-label"])]),o.createElementVNode("div",Oee,[o.createVNode(Pi,{value:P(),"side-label":o.unref(t)("bottom"),onDecrement:q[10]||(q[10]=Y=>A(-1)),onIncrement:q[11]||(q[11]=Y=>A(1))},null,8,["value","side-label"])])])],2)]),_:1}))}}),vz=o.defineComponent({__name:"PaddingControl",setup(r){return(e,t)=>(o.openBlock(),o.createBlock(wz,{mode:"padding"}))}}),kz=o.defineComponent({__name:"MarginControl",setup(r){return(e,t)=>(o.openBlock(),o.createBlock(wz,{mode:"margin"}))}}),vt={roundedGlobal:["none","pbx-rounded-sm","pbx-rounded","pbx-rounded-md","pbx-rounded-lg","pbx-rounded-xl","pbx-rounded-2xl","pbx-rounded-3xl","pbx-rounded-full"],roundedTopLeft:["none","pbx-rounded-tl-sm","pbx-rounded-tl","pbx-rounded-tl-md","pbx-rounded-tl-lg","pbx-rounded-tl-xl","pbx-rounded-tl-2xl","pbx-rounded-tl-3xl","pbx-rounded-tl-full"],roundedTopRight:["none","pbx-rounded-tr-sm","pbx-rounded-tr","pbx-rounded-tr-md","pbx-rounded-tr-lg","pbx-rounded-tr-xl","pbx-rounded-tr-2xl","pbx-rounded-tr-3xl","pbx-rounded-tr-full"],roundedBottomLeft:["none","pbx-rounded-bl-sm","pbx-rounded-bl","pbx-rounded-bl-md","pbx-rounded-bl-lg","pbx-rounded-bl-xl","pbx-rounded-bl-2xl","pbx-rounded-bl-3xl","pbx-rounded-bl-full"],roundedBottomRight:["none","pbx-rounded-br-sm","pbx-rounded-br","pbx-rounded-br-md","pbx-rounded-br-lg","pbx-rounded-br-xl","pbx-rounded-br-2xl","pbx-rounded-br-3xl","pbx-rounded-br-full"]},Fee={class:"pbx-editorSectionTitle"},jee={class:"pbx-editorFieldGroup"},qee={for:"global-border-radius",class:"pbx-myPrimaryInputLabel"},Uee={disabled:"",value:""},Wee={class:"pbx-editorSectionTitle"},Gee={class:"pbx-editorFieldGroup"},Kee={for:"border-radius-top-left",class:"pbx-myPrimaryInputLabel"},Jee={disabled:"",value:""},Yee={class:"pbx-editorFieldGroup"},Qee={for:"border-radius-top-right",class:"pbx-myPrimaryInputLabel"},Xee={disabled:"",value:""},Zee={class:"pbx-editorFieldGroup"},$ee={for:"border-radius-bottom-left",class:"pbx-myPrimaryInputLabel"},ete={disabled:"",value:""},tte={class:"pbx-editorFieldGroup"},rte={for:"border-radius-bottom-right",class:"pbx-myPrimaryInputLabel"},ote={disabled:"",value:""},Sz=o.defineComponent({__name:"BorderRadiusControl",setup(r){const{translate:e}=ne(),t=ke(),i=fe,n=o.ref(null),a=o.ref(null),l=o.ref(null),s=o.ref(null),p=o.ref(null),d=o.computed(()=>i.getBorderRadiusGlobal),c=o.computed(()=>i.getBorderRadiusTopLeft),b=o.computed(()=>i.getBorderRadiusTopRight),m=o.computed(()=>i.getBorderRadiusBottomleft),g=o.computed(()=>i.getBorderRadiusBottomRight);return o.watch(d,async x=>{n.value=x,await t.initializeElementStyles()},{immediate:!0}),o.watch(c,async x=>{a.value=x,await t.initializeElementStyles()},{immediate:!0}),o.watch(b,async x=>{l.value=x,await t.initializeElementStyles()},{immediate:!0}),o.watch(m,async x=>{s.value=x,await t.initializeElementStyles()},{immediate:!0}),o.watch(g,async x=>{p.value=x,await t.initializeElementStyles()},{immediate:!0}),(x,u)=>(o.openBlock(),o.createBlock(Re,null,{title:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(o.unref(e)("Border Radius")),1)]),content:o.withCtx(()=>[o.createElementVNode("p",Fee,o.toDisplayString(o.unref(e)("Global")),1),o.createElementVNode("div",jee,[o.createElementVNode("label",qee,o.toDisplayString(o.unref(e)("Border Radius")),1),o.withDirectives(o.createElementVNode("select",{id:"global-border-radius","onUpdate:modelValue":u[0]||(u[0]=h=>n.value=h),class:"pbx-myPrimarySelect",onChange:u[1]||(u[1]=h=>o.unref(t).handleBorderRadiusGlobal(n.value??void 0))},[o.createElementVNode("option",Uee,o.toDisplayString(o.unref(e)("Select")),1),(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(o.unref(vt).roundedGlobal,h=>(o.openBlock(),o.createElementBlock("option",{key:h},o.toDisplayString(h),1))),128))],544),[[o.vModelSelect,n.value]])]),u[10]||(u[10]=o.createElementVNode("hr",null,null,-1)),o.createElementVNode("p",Wee,o.toDisplayString(o.unref(e)("Specific")),1),o.createElementVNode("div",Gee,[o.createElementVNode("label",Kee,o.toDisplayString(o.unref(e)("Border Radius top left")),1),o.withDirectives(o.createElementVNode("select",{id:"border-radius-top-left","onUpdate:modelValue":u[2]||(u[2]=h=>a.value=h),class:"pbx-myPrimarySelect",onChange:u[3]||(u[3]=h=>o.unref(t).handleBorderRadiusTopLeft(a.value??void 0))},[o.createElementVNode("option",Jee,o.toDisplayString(o.unref(e)("Select")),1),(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(o.unref(vt).roundedTopLeft,h=>(o.openBlock(),o.createElementBlock("option",{key:h},o.toDisplayString(h),1))),128))],544),[[o.vModelSelect,a.value]])]),u[11]||(u[11]=o.createElementVNode("hr",null,null,-1)),o.createElementVNode("div",Yee,[o.createElementVNode("label",Qee,o.toDisplayString(o.unref(e)("Border Radius top right")),1),o.withDirectives(o.createElementVNode("select",{id:"border-radius-top-right","onUpdate:modelValue":u[4]||(u[4]=h=>l.value=h),class:"pbx-myPrimarySelect",onChange:u[5]||(u[5]=h=>o.unref(t).handleBorderRadiusTopRight(l.value??void 0))},[o.createElementVNode("option",Xee,o.toDisplayString(o.unref(e)("Select")),1),(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(o.unref(vt).roundedTopRight,h=>(o.openBlock(),o.createElementBlock("option",{key:h},o.toDisplayString(h),1))),128))],544),[[o.vModelSelect,l.value]])]),u[12]||(u[12]=o.createElementVNode("hr",null,null,-1)),o.createElementVNode("div",Zee,[o.createElementVNode("label",$ee,o.toDisplayString(o.unref(e)("Border Radius bottom left")),1),o.withDirectives(o.createElementVNode("select",{id:"border-radius-bottom-left","onUpdate:modelValue":u[6]||(u[6]=h=>s.value=h),class:"pbx-myPrimarySelect",onChange:u[7]||(u[7]=h=>o.unref(t).handleBorderRadiusBottomleft(s.value??void 0))},[o.createElementVNode("option",ete,o.toDisplayString(o.unref(e)("Select")),1),(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(o.unref(vt).roundedBottomLeft,h=>(o.openBlock(),o.createElementBlock("option",{key:h},o.toDisplayString(h),1))),128))],544),[[o.vModelSelect,s.value]])]),u[13]||(u[13]=o.createElementVNode("hr",null,null,-1)),o.createElementVNode("div",tte,[o.createElementVNode("label",rte,o.toDisplayString(o.unref(e)("Border Radius bottom right")),1),o.withDirectives(o.createElementVNode("select",{id:"border-radius-bottom-right","onUpdate:modelValue":u[8]||(u[8]=h=>p.value=h),class:"pbx-myPrimarySelect",onChange:u[9]||(u[9]=h=>o.unref(t).handleBorderRadiusBottomRight(p.value??void 0))},[o.createElementVNode("option",ote,o.toDisplayString(o.unref(e)("Select")),1),(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(o.unref(vt).roundedBottomRight,h=>(o.openBlock(),o.createElementBlock("option",{key:h},o.toDisplayString(h),1))),128))],544),[[o.vModelSelect,p.value]])])]),_:1}))}}),Bi={borderStyle:["none","pbx-border-solid","pbx-border-dashed","pbx-border-dotted","pbx-border-double","pbx-border-hidden"],borderWidth:["none","pbx-border","pbx-border-2","pbx-border-4","pbx-border-8"],borderColor:["none","pbx-border-white","pbx-border-black","pbx-border-slate-50","pbx-border-slate-100","pbx-border-slate-200","pbx-border-slate-300","pbx-border-slate-400","pbx-border-slate-500","pbx-border-slate-600","pbx-border-slate-700","pbx-border-slate-800","pbx-border-slate-900","pbx-border-gray-50","pbx-border-gray-100","pbx-border-gray-200","pbx-border-gray-300","pbx-border-gray-400","pbx-border-gray-500","pbx-border-gray-600","pbx-border-gray-700","pbx-border-gray-800","pbx-border-gray-900","pbx-border-zinc-50","pbx-border-zinc-100","pbx-border-zinc-200","pbx-border-zinc-300","pbx-border-zinc-400","pbx-border-zinc-500","pbx-border-zinc-600","pbx-border-zinc-700","pbx-border-zinc-800","pbx-border-zinc-900","pbx-border-neutral-50","pbx-border-neutral-100","pbx-border-neutral-200","pbx-border-neutral-300","pbx-border-neutral-400","pbx-border-neutral-500","pbx-border-neutral-600","pbx-border-neutral-700","pbx-border-neutral-800","pbx-border-neutral-900","pbx-border-stone-50","pbx-border-stone-100","pbx-border-stone-200","pbx-border-stone-300","pbx-border-stone-400","pbx-border-stone-500","pbx-border-stone-600","pbx-border-stone-700","pbx-border-stone-800","pbx-border-stone-900","pbx-border-red-50","pbx-border-red-100","pbx-border-red-200","pbx-border-red-300","pbx-border-red-400","pbx-border-red-500","pbx-border-red-600","pbx-border-red-700","pbx-border-red-800","pbx-border-red-900","pbx-border-orange-50","pbx-border-orange-100","pbx-border-orange-200","pbx-border-orange-300","pbx-border-orange-400","pbx-border-orange-500","pbx-border-orange-600","pbx-border-orange-700","pbx-border-orange-800","pbx-border-orange-900","pbx-border-amber-50","pbx-border-amber-100","pbx-border-amber-200","pbx-border-amber-300","pbx-border-amber-400","pbx-border-amber-500","pbx-border-amber-600","pbx-border-amber-700","pbx-border-amber-800","pbx-border-amber-900","pbx-border-yellow-50","pbx-border-yellow-100","pbx-border-yellow-200","pbx-border-yellow-300","pbx-border-yellow-400","pbx-border-yellow-500","pbx-border-yellow-600","pbx-border-yellow-700","pbx-border-yellow-800","pbx-border-yellow-900","pbx-border-lime-50","pbx-border-lime-100","pbx-border-lime-200","pbx-border-lime-300","pbx-border-lime-400","pbx-border-lime-500","pbx-border-lime-600","pbx-border-lime-700","pbx-border-lime-800","pbx-border-lime-900","pbx-border-green-50","pbx-border-green-100","pbx-border-green-200","pbx-border-green-300","pbx-border-green-400","pbx-border-green-500","pbx-border-green-600","pbx-border-green-700","pbx-border-green-800","pbx-border-green-900","pbx-border-emerald-50","pbx-border-emerald-100","pbx-border-emerald-200","pbx-border-emerald-300","pbx-border-emerald-400","pbx-border-emerald-500","pbx-border-emerald-600","pbx-border-emerald-700","pbx-border-emerald-800","pbx-border-emerald-900","pbx-border-teal-50","pbx-border-teal-100","pbx-border-teal-200","pbx-border-teal-300","pbx-border-teal-400","pbx-border-teal-500","pbx-border-teal-600","pbx-border-teal-700","pbx-border-teal-800","pbx-border-teal-900","pbx-border-cyan-50","pbx-border-cyan-100","pbx-border-cyan-200","pbx-border-cyan-300","pbx-border-cyan-400","pbx-border-cyan-500","pbx-border-cyan-600","pbx-border-cyan-700","pbx-border-cyan-800","pbx-border-cyan-900","pbx-border-sky-50","pbx-border-sky-100","pbx-border-sky-200","pbx-border-sky-300","pbx-border-sky-400","pbx-border-sky-500","pbx-border-sky-600","pbx-border-sky-700","pbx-border-sky-800","pbx-border-sky-900","pbx-border-blue-50","pbx-border-blue-100","pbx-border-blue-200","pbx-border-blue-300","pbx-border-blue-400","pbx-border-blue-500","pbx-border-blue-600","pbx-border-blue-700","pbx-border-blue-800","pbx-border-blue-900","pbx-border-indigo-50","pbx-border-indigo-100","pbx-border-indigo-200","pbx-border-indigo-300","pbx-border-indigo-400","pbx-border-indigo-500","pbx-border-indigo-600","pbx-border-indigo-700","pbx-border-indigo-800","pbx-border-indigo-900","pbx-border-violet-50","pbx-border-violet-100","pbx-border-violet-200","pbx-border-violet-300","pbx-border-violet-400","pbx-border-violet-500","pbx-border-violet-600","pbx-border-violet-700","pbx-border-violet-800","pbx-border-violet-900","pbx-border-purple-50","pbx-border-purple-100","pbx-border-purple-200","pbx-border-purple-300","pbx-border-purple-400","pbx-border-purple-500","pbx-border-purple-600","pbx-border-purple-700","pbx-border-purple-800","pbx-border-purple-900","pbx-border-fuchsia-50","pbx-border-fuchsia-100","pbx-border-fuchsia-200","pbx-border-fuchsia-300","pbx-border-fuchsia-400","pbx-border-fuchsia-500","pbx-border-fuchsia-600","pbx-border-fuchsia-700","pbx-border-fuchsia-800","pbx-border-fuchsia-900","pbx-border-pink-50","pbx-border-pink-100","pbx-border-pink-200","pbx-border-pink-300","pbx-border-pink-400","pbx-border-pink-500","pbx-border-pink-600","pbx-border-pink-700","pbx-border-pink-800","pbx-border-pink-900","pbx-border-rose-50","pbx-border-rose-100","pbx-border-rose-200","pbx-border-rose-300","pbx-border-rose-400","pbx-border-rose-500","pbx-border-rose-600","pbx-border-rose-700","pbx-border-rose-800","pbx-border-rose-900"]},ite={class:"pbx-editorSectionTitle"},nte={class:"pbx-editorFieldGroup"},ate={for:"border-style",class:"pbx-myPrimaryInputLabel"},lte={disabled:"",value:""},ste={class:"pbx-editorFieldGroup"},pte={for:"border-width",class:"pbx-myPrimaryInputLabel"},dte={disabled:"",value:""},cte={class:"pbx-editorFieldGroup"},bte={for:"border-color",class:"pbx-myPrimaryInputLabel"},mte={class:"pbx-flex pbx-items-center pbx-gap-2"},gte={key:0},ute={class:"pbx-block pbx-truncate"},xte={class:"pbx-flex pbx-items-center"},hte={key:0},fte={key:2,class:"pbx-ml-3"},yte={key:3,class:"pbx-ml-3"},Cz=o.defineComponent({name:"BorderControls",__name:"BorderControls",setup(r){const{translate:e}=ne(),t=ke(),i=fe,n=o.ref(null),a=o.ref(null),l=o.ref(null),s=o.computed(()=>i.getBorderStyle),p=o.computed(()=>i.getBorderWidth),d=o.computed(()=>i.getBorderColor);return o.watch(s,async c=>{n.value=c,await t.initializeElementStyles()},{immediate:!0}),o.watch(p,async c=>{a.value=c,await t.initializeElementStyles()},{immediate:!0}),o.watch(d,async c=>{l.value=c,await t.initializeElementStyles()},{immediate:!0}),(c,b)=>(o.openBlock(),o.createBlock(Re,null,{title:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(o.unref(e)("Border Style, Width & Color")),1)]),content:o.withCtx(()=>[o.createElementVNode("p",ite,o.toDisplayString(o.unref(e)("Border")),1),o.createElementVNode("div",nte,[o.createElementVNode("label",ate,o.toDisplayString(o.unref(e)("Border Style")),1),o.withDirectives(o.createElementVNode("select",{id:"border-style","onUpdate:modelValue":b[0]||(b[0]=m=>n.value=m),class:"pbx-myPrimarySelect",onChange:b[1]||(b[1]=m=>o.unref(t).handleBorderStyle(n.value??void 0))},[o.createElementVNode("option",lte,o.toDisplayString(o.unref(e)("Select")),1),(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(o.unref(Bi).borderStyle,m=>(o.openBlock(),o.createElementBlock("option",{key:m},o.toDisplayString(m),1))),128))],544),[[o.vModelSelect,n.value]])]),b[8]||(b[8]=o.createElementVNode("hr",null,null,-1)),o.createElementVNode("div",ste,[o.createElementVNode("label",pte,o.toDisplayString(o.unref(e)("Border Width")),1),o.withDirectives(o.createElementVNode("select",{id:"border-width","onUpdate:modelValue":b[2]||(b[2]=m=>a.value=m),class:"pbx-myPrimarySelect",onChange:b[3]||(b[3]=m=>o.unref(t).handleBorderWidth(a.value??void 0))},[o.createElementVNode("option",dte,o.toDisplayString(o.unref(e)("Select")),1),(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(o.unref(Bi).borderWidth,m=>(o.openBlock(),o.createElementBlock("option",{key:m},o.toDisplayString(m),1))),128))],544),[[o.vModelSelect,a.value]])]),b[9]||(b[9]=o.createElementVNode("hr",null,null,-1)),o.createElementVNode("div",cte,[o.createElementVNode("label",bte,o.toDisplayString(o.unref(e)("Border Color")),1),o.createVNode(o.unref(_n),{as:"div",modelValue:l.value,"onUpdate:modelValue":b[5]||(b[5]=m=>l.value=m)},{default:o.withCtx(({open:m})=>[o.createElementVNode("div",{class:o.normalizeClass(["pbx-relative pbx-mt-2",m?"pbx-z-50":"pbx-z-0"])},[o.createVNode(o.unref(Dn),{class:"pbx-myPrimarySelect",id:"border-color"},{default:o.withCtx(()=>{var g;return[o.createElementVNode("span",mte,[d.value==="none"?(o.openBlock(),o.createElementBlock("div",gte,[...b[6]||(b[6]=[o.createElementVNode("div",{class:"pbx-myPrimaryColorPreview pbx-border-none"},[o.createElementVNode("span",{class:"material-symbols-outlined"}," ev_shadow ")],-1)])])):o.createCommentVNode("",!0),l.value!=="none"?(o.openBlock(),o.createElementBlock("div",{key:1,class:o.normalizeClass(["pbx-aspect-square pbx-w-6 pbx-h-6 pbx-border-solid pbx-border pbx-border-gray-100 pbx-rounded-sm",`pbx-bg-${(g=l.value)==null?void 0:g.replace("pbx-border-","")}`])},null,2)):o.createCommentVNode("",!0),o.createElementVNode("span",ute,o.toDisplayString(l.value),1)])]}),_:1}),o.createVNode(o.Transition,{"leave-active-class":"pbx-transition pbx-ease-in pbx-duration-100","leave-from-class":"pbx-opacity-100","leave-to-class":"pbx-opacity-0"},{default:o.withCtx(()=>[o.createVNode(o.unref(zn),{class:"pbx-headless-dropdown pbx-absolute pbx-z-50 pbx-mt-1 pbx-max-h-56 pbx-w-full pbx-overflow-auto pbx-rounded-md pbx-bg-white pbx-text-base pbx-shadow-lg pbx-ring-1 pbx-ring-black pbx-ring-opacity-5 focus:pbx-outline-none sm:pbx-text-sm pbx-list-none pbx-p-0 pbx-m-0"},{default:o.withCtx(()=>[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(o.unref(Bi).borderColor,g=>(o.openBlock(),o.createBlock(o.unref(Er),{as:"template",onClick:b[4]||(b[4]=x=>o.unref(t).handleBorderColor(l.value??void 0)),key:g,value:g},{default:o.withCtx(({active:x})=>[o.createElementVNode("li",{class:o.normalizeClass([x?"pbx-bg-myPrimaryLinkColor pbx-text-white":"pbx-text-myPrimaryDarkGrayColor","pbx-relative pbx-cursor-default pbx-select-none pbx-py-2 pbx-pl-3 pbx-pr-9"])},[o.createElementVNode("div",xte,[g==="none"?(o.openBlock(),o.createElementBlock("div",hte,[...b[7]||(b[7]=[o.createElementVNode("div",{class:"pbx-myPrimaryColorPreview pbx-border-none"},[o.createElementVNode("span",{class:"material-symbols-outlined"}," ev_shadow ")],-1)])])):o.createCommentVNode("",!0),g!=="none"?(o.openBlock(),o.createElementBlock("div",{key:1,class:o.normalizeClass(["pbx-aspect-square pbx-w-6 pbx-h-6 pbx-bg-gray-950",`pbx-bg-${g.replace("pbx-border-","")}`])},null,2)):o.createCommentVNode("",!0),g==="none"?(o.openBlock(),o.createElementBlock("span",fte,o.toDisplayString(o.unref(e)("Transparent")),1)):o.createCommentVNode("",!0),g!=="none"?(o.openBlock(),o.createElementBlock("span",yte,o.toDisplayString(g),1)):o.createCommentVNode("",!0)])],2)]),_:2},1032,["value"]))),128))]),_:1})]),_:1})],2)]),_:1},8,["modelValue"])])]),_:1}))}}),wte={class:"pbx-flex pbx-items-center pbx-justify-between pbx-gap-4 pbx-rounded-lg pbx-border pbx-border-solid pbx-border-gray-100 pbx-bg-gray-50 pbx-px-4 pbx-py-3"},vte={class:"pbx-text-sm pbx-font-semibold pbx-text-myPrimaryDarkGrayColor pbx-my-0"},kte={class:"pbx-text-xs pbx-text-gray-500 pbx-my-0"},Ste={class:"pbx-grid pbx-grid-cols-1 pbx-gap-3"},Cte=["for"],Tte={class:"pbx-flex pbx-justify-between pbx-items-center pbx-gap-4 pbx-border pbx-border-gray-200 pbx-py-4 pbx-px-3 pbx-rounded-lg"},Ete=["id","value","onInput","onBlur"],Mte={class:"pbx-relative pbx-flex-shrink-0"},Pte=["title","onClick"],Bte={class:"pbx-border-t pbx-border-gray-100 pbx-pt-4 pbx-mt-2 pbx-flex pbx-items-center pbx-justify-between pbx-gap-3"},Lte={class:"pbx-text-sm pbx-font-semibold pbx-text-myPrimaryDarkGrayColor pbx-my-0"},Nte={class:"pbx-text-xs pbx-text-gray-500 pbx-my-0"},Ate=o.defineComponent({__name:"ThemeColorPresetManager",props:{embedded:{type:Boolean}},setup(r){const{translate:e}=ne(),{showToast:t}=tt(),i=fe,n=o.computed(()=>i.getPageBuilderConfig),{themeColorPresetSettings:a,setThemeColorPresetsEnabled:l,updateThemeColorPreset:s,resetToConfigDefaults:p}=Kl(n),d=o.ref({});function c(v){return d.value[v.id]??v.color}o.watch(()=>a.value.colors,v=>{v.forEach(M=>{var k;((k=document.activeElement)==null?void 0:k.id)!==`color-input-${M.id}`&&(d.value[M.id]=M.color)})},{deep:!0});const b=/^#?[0-9a-fA-F]{6}$/;function m(v,M){const C=M.target,k=C.value.trim();d.value[v.id]=C.value,b.test(k)&&s(v.id,{color:k})}function g(v){d.value[v.id]=v.color}function x(v,M){s(v,{enabled:M})}function u(v,M){s(v.id,{color:M})}const h=o.ref(null);function f(v){h.value=h.value===v?null:v}function w(){h.value=null}const y=o.ref(!1);function E(){y.value=!0}function S(){y.value=!1}function P(){p(),d.value={},y.value=!1,t(e("Theme colors reset to defaults"),"success")}return(v,M)=>(o.openBlock(),o.createElementBlock(o.Fragment,null,[o.createElementVNode("div",{class:o.normalizeClass(["pbx-flex pbx-flex-col pbx-gap-4",r.embedded?"":"pbx-mb-20"])},[o.createElementVNode("div",wte,[o.createElementVNode("div",null,[o.createElementVNode("p",vte,o.toDisplayString(o.unref(e)("Enable theme color presets")),1),o.createElementVNode("p",kte,o.toDisplayString(o.unref(e)("Use saved hex colors in text and background color menus")),1)]),o.createVNode(Jt,{"model-value":o.unref(a).enabled,"onUpdate:modelValue":o.unref(l)},null,8,["model-value","onUpdate:modelValue"])]),o.createElementVNode("div",Ste,[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(o.unref(a).colors,C=>(o.openBlock(),o.createElementBlock("div",{key:C.id,class:"pbx-myInputGroup"},[o.createElementVNode("label",{for:`color-input-${C.id}`,class:"pbx-myPrimaryInputLabel"},o.toDisplayString(o.unref(e)(C.label)),9,Cte),o.createElementVNode("div",Tte,[o.createVNode(Jt,{"model-value":C.enabled,"onUpdate:modelValue":k=>x(C.id,k)},null,8,["model-value","onUpdate:modelValue"]),o.createElementVNode("input",{id:`color-input-${C.id}`,value:c(C),type:"text",maxlength:"7",placeholder:"#rrggbb",class:"pbx-myPrimaryInput pbx-w-full",onInput:k=>m(C,k),onBlur:k=>g(C)},null,40,Ete),o.createElementVNode("div",Mte,[o.createElementVNode("button",{type:"button",title:C.color,class:"pbx-cursor-pointer pbx-border-0 pbx-p-0 pbx-bg-transparent pbx-block pbx-flex-shrink-0",style:{width:"2rem",height:"2rem"},onClick:o.withModifiers(k=>f(C.id),["stop"])},[o.createElementVNode("span",{style:o.normalizeStyle([{backgroundColor:C.color},{display:"block",width:"60%",height:"60%","border-radius":"9999px",border:"1px solid rgba(0, 0, 0, 0.1)","box-shadow":`0 1px 4px rgba(0, 0, 0, 0.1),
365
365
  inset 0 0 0 1px rgba(96, 96, 96, 0.1)`,transition:`box-shadow 0.15s,
366
- border-color 0.15s`}])},null,4)],8,Pte),h.value===C.id?(o.openBlock(),o.createElementBlock("div",{key:0,class:"pbx-fixed pbx-inset-0 pbx-z-40",onClick:w})):o.createCommentVNode("",!0),h.value===C.id?(o.openBlock(),o.createElementBlock("div",{key:1,class:"pbx-absolute pbx-right-0 pbx-z-50 pbx-rounded-xl pbx-border pbx-border-solid pbx-border-gray-200 pbx-bg-white pbx-p-3 pbx-shadow-lg",style:{top:"calc(100% + 8px)",width:"266px"},onClick:M[0]||(M[0]=o.withModifiers(()=>{},["stop"]))},[o.createVNode(QD,{"model-value":C.color,"onUpdate:modelValue":k=>u(C,k)},null,8,["model-value","onUpdate:modelValue"])])):o.createCommentVNode("",!0)])])]))),128))]),o.createElementVNode("div",Bte,[o.createElementVNode("div",null,[o.createElementVNode("p",Lte,o.toDisplayString(o.unref(e)("Reset to provided defaults")),1),o.createElementVNode("p",Nte,o.toDisplayString(o.unref(e)("Restore the original colors provided to the page builder")),1)]),o.createElementVNode("button",{type:"button",class:"pbx-mySecondaryButton pbx-flex pbx-items-center pbx-gap-1 pbx-shrink-0",onClick:E},[M[1]||(M[1]=o.createElementVNode("span",{class:"material-symbols-outlined pbx-materialIconBase pbx-leading-none"},"restart_alt",-1)),o.createTextVNode(" "+o.toDisplayString(o.unref(e)("Reset")),1)])])],2),o.createVNode(Et,{showDynamicModalBuilder:y.value,type:"delete",gridColumnAmount:2,title:o.unref(e)("Reset to provided defaults"),description:o.unref(e)("This will restore the original colors provided to the page builder. Any changes you have made to colors or enabled states will be lost."),firstButtonText:o.unref(e)("Close"),thirdButtonText:o.unref(e)("Reset"),onFirstModalButtonFunctionDynamicModalBuilder:S,onThirdModalButtonFunctionDynamicModalBuilder:P},{default:o.withCtx(()=>[...M[2]||(M[2]=[o.createElementVNode("header",null,null,-1),o.createElementVNode("main",null,null,-1)])]),_:1},8,["showDynamicModalBuilder","title","description","firstButtonText","thirdButtonText"])],64))}}),_te=o.defineComponent({__name:"ThemeColorSettingsEditor",setup(r){const{translate:e}=ne();return(t,i)=>(o.openBlock(),o.createBlock(Re,null,{title:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(o.unref(e)("Theme & colors")),1)]),content:o.withCtx(()=>[o.createVNode(Ate,{embedded:""})]),_:1}))}}),Dte={class:"pbx-editorSectionDesc"},zte={class:"pbx-editorFieldGroup"},Ite={for:"page-meta-title",class:"pbx-myPrimaryInputLabel"},Vte=["placeholder"],Hte={class:"pbx-editorFieldGroup"},Rte={for:"page-meta-description",class:"pbx-myPrimaryInputLabel"},Ote=["placeholder"],Fte=["disabled"],jte={key:0,class:"material-symbols-outlined"},qte={key:1,class:"material-symbols-outlined pbx-animate-spin"},Ute=o.defineComponent({name:"PageMetaSettingsEditor",__name:"PageMetaSettingsEditor",setup(r){const{translate:e}=ne(),{showToast:t}=tt(),i=ke(),n=o.ref(""),a=o.ref(""),l=o.ref(!1);o.onMounted(()=>{const p=i.getPageMeta();n.value=p.title||"",a.value=p.description||""});const s=async()=>{if(!l.value){l.value=!0,await Fl(300);try{await i.setPageMeta({title:n.value.trim(),description:a.value.trim()}),t(e("Page meta saved"),"success")}catch{t(e("Could not save page meta"),"error")}finally{l.value=!1}}};return(p,d)=>(o.openBlock(),o.createBlock(Re,null,{title:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(o.unref(e)("Page Meta")),1)]),content:o.withCtx(()=>[o.createElementVNode("p",Dte,o.toDisplayString(o.unref(e)("Page meta description")),1),o.createElementVNode("div",zte,[o.createElementVNode("label",Ite,o.toDisplayString(o.unref(e)("Meta title")),1),o.withDirectives(o.createElementVNode("input",{id:"page-meta-title","onUpdate:modelValue":d[0]||(d[0]=c=>n.value=c),type:"text",class:"pbx-myPrimaryInput pbx-w-full",placeholder:o.unref(e)("Meta title placeholder")},null,8,Vte),[[o.vModelText,n.value]])]),o.createElementVNode("div",Hte,[o.createElementVNode("label",Rte,o.toDisplayString(o.unref(e)("Meta description")),1),o.withDirectives(o.createElementVNode("textarea",{id:"page-meta-description","onUpdate:modelValue":d[1]||(d[1]=c=>a.value=c),rows:"3",class:"pbx-myPrimaryInput pbx-w-full pbx-resize-y",placeholder:o.unref(e)("Meta description placeholder")},null,8,Ote),[[o.vModelText,a.value]])]),o.createElementVNode("button",{type:"button",class:"pbx-myPrimaryButton pbx-w-full",disabled:l.value,onClick:s},[o.createTextVNode(o.toDisplayString(o.unref(e)("Save"))+" ",1),l.value?o.createCommentVNode("",!0):(o.openBlock(),o.createElementBlock("span",jte,"check")),l.value?(o.openBlock(),o.createElementBlock("span",qte,"refresh")):o.createCommentVNode("",!0)],8,Fte)]),_:1}))}}),Wte={key:0,class:"pbx-fixed pbx-inset-0 pbx-z-[9999]"},Gte={class:"pbx-flex pbx-gap-2 pbx-justify-between pbx-items-center pbx-py-2 pbx-px-2 pbx-mb-2 pbx-border-b pbx-border-gray-200"},Kte={class:"pbx-myQuaternaryHeader pbx-my-0 pbx-py-0 pbx-text-black"},Jte={class:"pbx-pt-4 pbx-px-2"},Tz=o.defineComponent({__name:"FloatingSidePanel",props:{title:{type:String,required:!1,default:null},showSidebarPanel:{type:Boolean,default:!1},position:{type:String,required:!0,default:"right",validator(r){const t=["left","right"].includes(r);return t||console.warn(`Invalid prop: position must be 'left' or 'right', got '${r}'`),t}},closeOnOverlayClick:{type:Boolean,default:!0}},emits:["closeSidebarPanel"],setup(r,{emit:e}){const t=r,i=e,n=()=>{i("closeSidebarPanel")},a=()=>{t.closeOnOverlayClick&&n()};return(l,s)=>(o.openBlock(),o.createBlock(o.Teleport,{to:"body"},[o.createVNode(o.Transition,{name:"popup-fade"},{default:o.withCtx(()=>[r.showSidebarPanel?(o.openBlock(),o.createElementBlock("div",Wte,[o.createElementVNode("div",{class:o.normalizeClass(["pbx-fixed pbx-inset-0 pbx-bg-black pbx-opacity-20 pbx-z-40",{"pbx-pointer-events-none":!r.closeOnOverlayClick}]),onClick:a},null,2),o.createElementVNode("div",{class:o.normalizeClass(["pbx-font-sans pbx-fixed pbx-top-0 pbx-rounded-3xl pbx-pt-2 pbx-pb-20 pbx-px-2 pbx-border pbx-border-gray-200 pbx-max-h-[80vh] lg:pbx-min-h-[98%] pbx-min-h-[80vh] lg:pbx-min-w-96 lg:pbx-w-96 pbx-w-[96%] pbx-overflow-y-auto pbx-z-50 pbx-bg-white lg:pbx-mt-2 pbx-mt-2",[r.position==="left"?"pbx-left-0 pbx-ml-[1%]":"",r.position==="right"?"pbx-right-0 pbx-mr-[1%]":""]]),onClick:s[0]||(s[0]=o.withModifiers(()=>{},["stop"]))},[o.createElementVNode("div",Gte,[o.createElementVNode("span",Kte,o.toDisplayString(r.title),1),o.createElementVNode("span",{onClick:n},[...s[1]||(s[1]=[o.createElementVNode("div",{class:"pbx-h-10 pbx-w-10 pbx-cursor-pointer pbx-rounded-full pbx-flex pbx-items-center pbx-border-none pbx-justify-center pbx-bg-gray-50 pbx-aspect-square hover:pbx-bg-myPrimaryLinkColor hover:pbx-text-white focus-visible:pbx-ring-0 pbx-text-black"},[o.createElementVNode("span",{class:"material-symbols-outlined"}," close ")],-1)])])]),o.createElementVNode("div",Jte,[o.renderSlot(l.$slots,"default")])],2)])):o.createCommentVNode("",!0)]),_:3})]))}}),Yte={class:"pbx-overflow-y-auto"},Qte={key:0,class:"pbx-flex pbx-items-center pbx-justify-center pbx-gap-2"},Xte={class:"pbx-bg-gray-100 pbx-rounded-full pbx-w-32 pbx-h-32 pbx-flex pbx-items-center pbx-justify-center"},Zte={class:"pbx-text-center"},$te={class:"pbx-lg:pbx-text-7xl pbx-text-5xl"},ere={key:1,class:"pbx-w-full pbx-space-y-5"},tre={class:"pbx-text-base pbx-font-semibold pbx-text-center pbx-text-myPrimaryDarkGrayColor"},rre={class:"pbx-seoCheckGroupTitle"},ore={class:"pbx-space-y-2"},ire={class:"material-symbols-outlined","aria-hidden":"true"},nre={class:"pbx-pageDesignOpenButtonText"},are={class:"pbx-pageDesignOpenButtonLabel"},lre={class:"pbx-pageDesignOpenButtonHint"},sre={key:2,class:"pbx-text-gray-500 pbx-text-center pbx-py-8"},pre=o.defineComponent({__name:"SeoCheckPanel",props:{seoResult:{}},setup(r){const e=r,{translate:t}=ne(),i=o.computed(()=>{if(!e.seoResult)return[];const n=new Map;for(const a of e.seoResult.checks){const l=a.category??"Other";n.has(l)||n.set(l,[]),n.get(l).push(a)}return Array.from(n.entries()).map(([a,l])=>({title:a,checks:l}))});return(n,a)=>(o.openBlock(),o.createElementBlock("div",Yte,[r.seoResult?(o.openBlock(),o.createElementBlock("div",Qte,[o.createElementVNode("div",{class:"pbx-relative pbx-my-4 pbx-rounded-full pbx-flex pbx-items-center pbx-justify-center pbx-w-36 pbx-h-36",style:o.normalizeStyle({background:`conic-gradient(${r.seoResult.score<50?"#ef4444":"#50C878"} ${r.seoResult.score}%, #e5e7eb 0)`})},[o.createElementVNode("div",Xte,[o.createElementVNode("div",Zte,[o.createElementVNode("span",$te,o.toDisplayString(r.seoResult.score),1),a[0]||(a[0]=o.createElementVNode("span",{class:"pbx-text-xl"},"%",-1))])])],4)])):o.createCommentVNode("",!0),i.value.length?(o.openBlock(),o.createElementBlock("div",ere,[o.createElementVNode("h3",tre,o.toDisplayString(o.unref(t)("SEO Check Results")),1),(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(i.value,l=>(o.openBlock(),o.createElementBlock("div",{key:l.title,class:"pbx-space-y-2"},[o.createElementVNode("h4",rre,o.toDisplayString(o.unref(t)(l.title)),1),o.createElementVNode("ul",ore,[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(l.checks,(s,p)=>(o.openBlock(),o.createElementBlock("li",{key:p,class:o.normalizeClass(["pbx-seoCheckRow",s.passed?"pbx-seoCheckRow--pass":"pbx-seoCheckRow--fail"])},[o.createElementVNode("span",{class:o.normalizeClass(["pbx-seoCheckRowIcon",s.passed?"pbx-seoCheckRowIcon--pass":"pbx-seoCheckRowIcon--fail"])},[o.createElementVNode("span",ire,o.toDisplayString(s.passed?"check":"close"),1)],2),o.createElementVNode("span",nre,[o.createElementVNode("span",are,o.toDisplayString(o.unref(t)(s.check)),1),o.createElementVNode("span",lre,o.toDisplayString(s.details),1)])],2))),128))])]))),128))])):(o.openBlock(),o.createElementBlock("div",sre,o.toDisplayString(o.unref(t)("No SEO checks available.")),1))]))}}),dre={class:"pbx-editorSectionDesc"},cre=o.defineComponent({name:"SeoCheckSettingsEditor",__name:"SeoCheckSettingsEditor",setup(r){const{translate:e}=ne(),t=ke(),i=o.ref(null),n=o.ref(!1),a=o.ref(!1),l=async()=>{a.value=!0,n.value=!0,await Fl(300);try{i.value=await t.analyzeSEO()}finally{a.value=!1}},s=()=>{n.value=!1};return(p,d)=>(o.openBlock(),o.createElementBlock(o.Fragment,null,[o.createVNode(Re,null,{title:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(o.unref(e)("SEO Check")),1)]),content:o.withCtx(()=>[o.createElementVNode("p",dre,o.toDisplayString(o.unref(e)("SEO check description")),1),o.createVNode(Mr,{icon:"circle_circle",label:o.unref(e)("Run SEO check"),hint:o.unref(e)("Analyze headings, images, links and word count"),"is-loading":a.value,onClick:l},null,8,["label","hint","is-loading"])]),_:1}),o.createVNode(Tz,{title:o.unref(e)("SEO Check"),showSidebarPanel:n.value,position:"left",onCloseSidebarPanel:s},{default:o.withCtx(()=>[o.createVNode(pre,{"seo-result":i.value},null,8,["seo-result"])]),_:1},8,["title","showSidebarPanel"])],64))}}),bre={class:"pbx-editorSectionDesc"},mre={class:"pbx-pageDesignOpenButtonText"},gre={class:"pbx-pageDesignOpenButtonLabel"},ure={class:"pbx-pageDesignOpenButtonHint"},xre=o.defineComponent({name:"RemoveAllComponentsSettingsEditor",__name:"RemoveAllComponentsSettingsEditor",setup(r){const{translate:e}=ne(),{showToast:t}=tt(),i=ke(),n=o.ref(!1),a=o.ref(!1),l=o.ref(""),s=o.ref(1),p=o.ref(""),d=o.ref(""),c=o.ref(""),b=o.ref(null),m=o.ref(null),g=o.ref(null),x=o.ref(null),u=o.ref(null),h=function(){a.value=!0,l.value="delete",s.value=2,p.value=e("Remove all Components"),d.value=e("Are you sure you want to remove all Components?"),c.value=e("Close"),b.value=null,m.value=e("Delete"),g.value=function(){a.value=!1},x.value=function(){},u.value=async function(){n.value=!0,await i.clearHtmlSelection(),await i.handleFormSubmission(),await je(500),a.value=!1,n.value=!1,t(e("All components removed"),"success")}};return(f,w)=>(o.openBlock(),o.createElementBlock(o.Fragment,null,[o.createVNode(Re,null,{title:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(o.unref(e)("Page layout")),1)]),content:o.withCtx(()=>[o.createElementVNode("p",bre,o.toDisplayString(o.unref(e)("Remove all components description")),1),o.createElementVNode("button",{type:"button",class:"pbx-pageDesignOpenButton pbx-pageDesignOpenButton--danger",onClick:h},[w[3]||(w[3]=o.createElementVNode("span",{class:"material-symbols-outlined"},"delete_forever",-1)),o.createElementVNode("span",mre,[o.createElementVNode("span",gre,o.toDisplayString(o.unref(e)("Remove all Components")),1),o.createElementVNode("span",ure,o.toDisplayString(o.unref(e)("Clear every section from the page")),1)]),w[4]||(w[4]=o.createElementVNode("span",{class:"pbx-pageDesignOpenButtonArrow material-symbols-outlined","aria-hidden":"true"}," arrow_forward ",-1))])]),_:1}),o.createVNode(Et,{showDynamicModalBuilder:a.value,type:l.value,gridColumnAmount:s.value,title:p.value,description:d.value,isLoading:n.value,firstButtonText:c.value,secondButtonText:b.value??void 0,thirdButtonText:m.value??void 0,onFirstModalButtonFunctionDynamicModalBuilder:w[0]||(w[0]=()=>{var y;return(y=g.value)==null?void 0:y.call(g)}),onSecondModalButtonFunctionDynamicModalBuilder:w[1]||(w[1]=()=>{var y;return(y=x.value)==null?void 0:y.call(x)}),onThirdModalButtonFunctionDynamicModalBuilder:w[2]||(w[2]=()=>{var y;return(y=u.value)==null?void 0:y.call(u)})},{default:o.withCtx(()=>[...w[5]||(w[5]=[o.createElementVNode("header",null,null,-1),o.createElementVNode("main",null,null,-1)])]),_:1},8,["showDynamicModalBuilder","type","gridColumnAmount","title","description","isLoading","firstButtonText","secondButtonText","thirdButtonText"])],64))}}),hre={class:"pbx-editorSectionDesc"},fre={class:"pbx-pageDesignOpenButtonText"},yre={class:"pbx-pageDesignOpenButtonLabel"},wre={class:"pbx-pageDesignOpenButtonHint"},vre=o.defineComponent({name:"PageDesignSettingsEditor",__name:"PageDesignSettingsEditor",emits:["open"],setup(r){const{translate:e}=ne();return(t,i)=>(o.openBlock(),o.createBlock(Re,null,{title:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(o.unref(e)("Page Design")),1)]),content:o.withCtx(()=>[o.createElementVNode("p",hre,o.toDisplayString(o.unref(e)("Page design description")),1),o.createElementVNode("button",{type:"button",class:"pbx-pageDesignOpenButton",onClick:i[0]||(i[0]=n=>t.$emit("open"))},[o.createVNode(Jl),o.createElementVNode("span",fre,[o.createElementVNode("span",yre,o.toDisplayString(o.unref(e)("Open page design")),1),o.createElementVNode("span",wre,o.toDisplayString(o.unref(e)("Typography, colors, spacing & more")),1)]),i[1]||(i[1]=o.createElementVNode("span",{class:"pbx-pageDesignOpenButtonArrow material-symbols-outlined","aria-hidden":"true"}," arrow_forward ",-1))])]),_:1}))}}),kre={class:"pbx-editorSectionDesc"},Sre={class:"pbx-inspectorActionStack"},Cre=o.defineComponent({name:"PageHtmlEditorSettingsEditor",__name:"PageHtmlEditorSettingsEditor",setup(r){const{translate:e}=ne(),t=ke(),{openHtmlViewer:i}=is(),{openHtmlEditor:n}=ls(),a=async()=>{const s=await t.generateFullPageHtml();n(e("HTML Editor"),s,"page")},l=async()=>{const s=await t.generateFullPageHtml();i(e("Page HTML"),s)};return(s,p)=>(o.openBlock(),o.createBlock(Re,null,{title:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(o.unref(e)("HTML Editor")),1)]),content:o.withCtx(()=>[o.createElementVNode("p",kre,o.toDisplayString(o.unref(e)("Page HTML editor description")),1),o.createElementVNode("div",Sre,[o.createVNode(Mr,{icon:"visibility",label:o.unref(e)("View page HTML"),hint:o.unref(e)("Preview full page markup"),onClick:l},null,8,["label","hint"]),o.createVNode(Mr,{icon:"deployed_code",label:o.unref(e)("Open HTML editor"),hint:o.unref(e)("Edit full page markup"),onClick:a},null,8,["label","hint"])])]),_:1}))}}),no=function(r){return!r||typeof r=="object"&&r.constructor===Object&&Object.keys(r).length===0},Tre="3.5.51",Ere=r=>/^[a-z][a-z0-9+.-]*:/i.test(r)||r.startsWith("//");function Ez(r,e){if(!r)return console.warn("No valid pagebuilder element passed"),"";const t=r.cloneNode(!0);if(t.removeAttribute("id"),t.querySelectorAll("[data-pbx-insert-btn]").forEach(a=>{a.remove()}),t.querySelectorAll("[data-componentid], [data-component-title], #page-builder-editor-editable-area").forEach(a=>{a.removeAttribute("data-componentid"),a.removeAttribute("data-component-title"),a.id==="page-builder-editor-editable-area"&&a.removeAttribute("id")}),t.querySelectorAll("[data-pagebuilder-content]").forEach(a=>{a.removeAttribute("data-pagebuilder-content")}),t.querySelectorAll("[data-isl-active]").forEach(a=>{a.removeAttribute("data-isl-active")}),t.removeAttribute("data-builder-canvas"),e&&e&&typeof e.imageUrlPrefix=="string"){const a=e.imageUrlPrefix;t.querySelectorAll("img").forEach(s=>{const p=s.getAttribute("src")||"";p&&!p.startsWith("http")&&!Ere(p)&&a&&!p.startsWith(a)&&s.setAttribute("src",a+p.replace(/^\/+/,""))})}const n=a=>{for(let l=a.childNodes.length-1;l>=0;l--){const s=a.childNodes[l];s.nodeType===Node.COMMENT_NODE?a.removeChild(s):s.nodeType===Node.ELEMENT_NODE&&n(s)}};return n(t),t.outerHTML}function Mz(r){if(!(r!=null&&r.trim()))return[];const e=r.match(/class\s*=\s*(["'])(.*?)\1/i);return e!=null&&e[2]?e[2].split(/\s+/).filter(Boolean):[]}async function pc(r){const{showToast:e}=tt(),{translate:t}=ne();try{return await navigator.clipboard.writeText(r),e(t("Copied to clipboard"),"success"),!0}catch{return e(t("Clipboard unavailable"),"error"),!1}}const Mre=["title","aria-label"],Pre={class:"pbx-inspectorIdChipText"},Bre={class:"pbx-inspectorIdChipIcon material-symbols-outlined","aria-hidden":"true"},Lre={key:1,class:"pbx-inspectorValue"},Pz=o.defineComponent({__name:"InspectorIdValue",props:{value:{}},setup(r){const e=r,{translate:t}=ne(),i=o.ref(!1),n=o.computed(()=>{const s=e.value;return s==null||s===""?null:String(s)}),a=o.computed(()=>{const s=n.value;return s?s.length<=18?s:`${s.slice(0,8)}…${s.slice(-4)}`:"—"});async function l(){if(!n.value)return;await pc(n.value)&&(i.value=!0,globalThis.setTimeout(()=>{i.value=!1},2e3))}return(s,p)=>n.value?(o.openBlock(),o.createElementBlock("button",{key:0,type:"button",class:"pbx-inspectorIdChip",title:n.value,"aria-label":`${o.unref(t)("Copy ID")}: ${n.value}`,onClick:l},[o.createElementVNode("span",Pre,o.toDisplayString(a.value),1),o.createElementVNode("span",Bre,o.toDisplayString(i.value?"check":"content_copy"),1)],8,Mre)):(o.openBlock(),o.createElementBlock("span",Lre,"—"))}}),Nre={class:"pbx-selectedHtmlInspector"},Are={class:"pbx-editorSectionDesc"},_re={class:"pbx-editorFieldGroup"},Dre={class:"pbx-editorSectionTitle"},zre={class:"pbx-inspectorCard"},Ire={class:"pbx-inspectorLabel"},Vre={class:"pbx-editorFieldGroup"},Hre={class:"pbx-editorSectionTitle"},Rre=["aria-label"],Ore=["aria-selected"],Fre=["aria-selected"],jre=["aria-selected"],qre={class:"pbx-inspectorPanel"},Ure={key:0,role:"tabpanel"},Wre={key:0,class:"pbx-inspectorEmpty"},Gre={class:"pbx-inspectorMeta pbx-mb-3"},Kre={key:0,class:"pbx-inspectorMetaRow"},Jre={class:"pbx-inspectorFieldLabel"},Yre={class:"pbx-inspectorValue pbx-inspectorValueBreak"},Qre={class:"pbx-inspectorMetaRow pbx-inspectorMetaRowStacked"},Xre={class:"pbx-inspectorFieldLabel"},Zre={class:"pbx-inspectorActionStack"},$re={key:1,role:"tabpanel"},eoe={key:0,class:"pbx-inspectorEmpty"},toe={class:"pbx-inspectorMeta pbx-mb-3"},roe={class:"pbx-inspectorMetaRow"},ooe={class:"pbx-inspectorFieldLabel"},ioe={class:"pbx-inspectorMetaRow"},noe={class:"pbx-inspectorFieldLabel"},aoe={class:"pbx-inspectorValue"},loe={class:"pbx-inspectorMetaRow pbx-inspectorMetaRowStacked"},soe={class:"pbx-inspectorFieldLabel"},poe={key:2,role:"tabpanel"},doe=["aria-expanded","aria-label"],coe={class:"pbx-inspectorComponentsSummaryContent"},boe={class:"pbx-inspectorComponentsSummaryChevron material-symbols-outlined","aria-hidden":"true"},moe={key:1,class:"pbx-inspectorComponentsSummary pbx-inspectorComponentsSummaryEmpty"},goe={class:"pbx-inspectorList"},uoe=["aria-expanded","aria-label","onClick"],xoe={class:"pbx-inspectorComponentCardTitleContent"},hoe={class:"pbx-inspectorListIndex"},foe={class:"pbx-inspectorListTitle"},yoe={class:"pbx-inspectorComponentsSummaryChevron material-symbols-outlined","aria-hidden":"true"},woe={class:"pbx-inspectorComponentCardBody"},voe={class:"pbx-inspectorMeta pbx-inspectorComponentCardMeta"},koe={class:"pbx-inspectorMetaRow"},Soe={class:"pbx-inspectorFieldLabel"},Coe={class:"pbx-inspectorMetaRow pbx-inspectorMetaRowStacked"},Toe={class:"pbx-inspectorFieldLabel"},Eoe={class:"pbx-inspectorComponentCardFooter"},Moe=o.defineComponent({__name:"SelectedHtmlInspector",setup(r){const{translate:e}=ne(),{openHtmlViewer:t}=is(),{openHtmlEditor:i}=ls(),n=fe,a=o.computed(()=>n.getElement),l=o.computed(()=>n.getComponent),s=o.computed(()=>n.getComponents),p=o.ref("element"),d=o.computed(()=>{var N;return((N=s.value)==null?void 0:N.length)??0}),c=o.ref(!1),b=o.ref(new Set);function m(){d.value&&(c.value=!c.value)}function g(N,A){return String(N.id??N.title??A)}function x(N,A){return b.value.has(g(N,A))}function u(N,A){const I=g(N,A),D=new Set(b.value);D.has(I)?D.delete(I):D.add(I),b.value=D}o.watch(c,N=>{N||(b.value=new Set)}),o.watch(p,N=>{N!=="components"&&(c.value=!1,b.value=new Set)});function h(N){return N?N.tagName.toLowerCase():"—"}function f(N){return N?"object":"—"}function w(N){return N.length?`${e("array")} · ${N.length}`:e("array")}const y=o.computed(()=>[{label:e("Element type:"),value:h(a.value),tone:a.value?"active":"muted"},{label:e("Component type:"),value:f(l.value),tone:l.value?"active":"muted"},{label:e("Components:"),value:w(s.value),tone:d.value>0?"active":"muted"}]),E=o.computed(()=>{var A;const N=a.value;return(A=N==null?void 0:N.classList)!=null&&A.length?Array.from(N.classList):[]}),S=o.computed(()=>{var N;return(N=l.value)!=null&&N.html_code?Mz(l.value.html_code):[]}),P=o.computed(()=>{const N=a.value;return!N||N.tagName!=="IMG"?null:N.src||"—"});function v(N){p.value=N}function M(){a.value&&i(e("Element HTML"),a.value.outerHTML,"element")}function C(){a.value&&t(e("Element HTML"),a.value.outerHTML)}function k(N,A){const I=N.title||(A!==void 0?`${e("Component")} #${A+1}`:e("Component"));t(`${I} · ${e("HTML")}`,N.html_code||"")}function T(){l.value&&k(l.value)}function V(N){return Mz(N.html_code||"")}return(N,A)=>(o.openBlock(),o.createElementBlock("div",Nre,[o.createElementVNode("p",Are,o.toDisplayString(o.unref(e)("Overview of Selected Element, Component, and Components. This section provides real-time updates based on your HTML selection.")),1),o.createElementVNode("div",_re,[o.createElementVNode("h4",Dre,o.toDisplayString(o.unref(e)("Types")),1),o.createElementVNode("div",zre,[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(y.value,I=>(o.openBlock(),o.createElementBlock("div",{key:I.label,class:"pbx-inspectorRow"},[o.createElementVNode("span",Ire,o.toDisplayString(I.label),1),o.createElementVNode("span",{class:o.normalizeClass(["pbx-inspectorBadge",I.tone==="active"?"pbx-inspectorBadgeActive":"pbx-inspectorBadgeMuted"])},o.toDisplayString(I.value),3)]))),128))])]),o.createElementVNode("div",Vre,[o.createElementVNode("h4",Hre,o.toDisplayString(o.unref(e)("Content")),1),o.createElementVNode("div",{class:"pbx-inspectorTabs",role:"tablist","aria-label":o.unref(e)("Content")},[o.createElementVNode("button",{type:"button",role:"tab","aria-selected":p.value==="element",class:o.normalizeClass(["pbx-inspectorTab pbx-font-sans",{"pbx-inspectorTabActive":p.value==="element"}]),onClick:A[0]||(A[0]=I=>v("element"))},o.toDisplayString(o.unref(e)("Element")),11,Ore),o.createElementVNode("button",{type:"button",role:"tab","aria-selected":p.value==="component",class:o.normalizeClass(["pbx-inspectorTab pbx-font-sans",{"pbx-inspectorTabActive":p.value==="component"}]),onClick:A[1]||(A[1]=I=>v("component"))},o.toDisplayString(o.unref(e)("Component")),11,Fre),o.createElementVNode("button",{type:"button",role:"tab","aria-selected":p.value==="components",class:o.normalizeClass(["pbx-inspectorTab pbx-font-sans",{"pbx-inspectorTabActive":p.value==="components"}]),onClick:A[2]||(A[2]=I=>v("components"))},o.toDisplayString(o.unref(e)("Components")),11,jre)],8,Rre),o.createElementVNode("div",qre,[p.value==="element"?(o.openBlock(),o.createElementBlock("div",Ure,[a.value?(o.openBlock(),o.createElementBlock(o.Fragment,{key:1},[o.createElementVNode("div",Gre,[P.value!==null?(o.openBlock(),o.createElementBlock("div",Kre,[o.createElementVNode("span",Jre,o.toDisplayString(o.unref(e)("Element src:")),1),o.createElementVNode("span",Yre,o.toDisplayString(P.value),1)])):o.createCommentVNode("",!0),o.createElementVNode("div",Qre,[o.createElementVNode("span",Xre,o.toDisplayString(o.unref(e)("Element classes:")),1),o.createVNode(rs,{classes:E.value,"empty-placeholder":""},null,8,["classes"])])]),o.createElementVNode("div",Zre,[o.createVNode(Mr,{icon:"visibility",label:o.unref(e)("View element HTML"),hint:o.unref(e)("Preview selected element markup"),onClick:C},null,8,["label","hint"]),o.createVNode(Mr,{icon:"deployed_code",label:o.unref(e)("Open element HTML editor"),hint:o.unref(e)("Edit selected element markup"),onClick:M},null,8,["label","hint"])])],64)):(o.openBlock(),o.createElementBlock("p",Wre,o.toDisplayString(o.unref(e)("No Element selected")),1))])):o.createCommentVNode("",!0),p.value==="component"?(o.openBlock(),o.createElementBlock("div",$re,[l.value?(o.openBlock(),o.createElementBlock(o.Fragment,{key:1},[o.createElementVNode("div",toe,[o.createElementVNode("div",roe,[o.createElementVNode("span",ooe,o.toDisplayString(o.unref(e)("ID:")),1),o.createVNode(Pz,{value:l.value.id},null,8,["value"])]),o.createElementVNode("div",ioe,[o.createElementVNode("span",noe,o.toDisplayString(o.unref(e)("Title:")),1),o.createElementVNode("span",aoe,o.toDisplayString(l.value.title||"—"),1)]),o.createElementVNode("div",loe,[o.createElementVNode("span",soe,o.toDisplayString(o.unref(e)("Component classes:")),1),o.createVNode(rs,{classes:S.value,"empty-placeholder":""},null,8,["classes"])])]),o.createVNode(Mr,{icon:"visibility",label:o.unref(e)("View component HTML"),hint:o.unref(e)("Preview component markup"),onClick:T},null,8,["label","hint"])],64)):(o.openBlock(),o.createElementBlock("p",eoe,o.toDisplayString(o.unref(e)("No Component selected")),1))])):o.createCommentVNode("",!0),p.value==="components"?(o.openBlock(),o.createElementBlock("div",poe,[d.value?(o.openBlock(),o.createElementBlock("button",{key:0,type:"button",class:o.normalizeClass(["pbx-font-sans pbx-inspectorComponentsSummary pbx-inspectorComponentsSummaryToggle",{"pbx-inspectorComponentsSummaryOpen":c.value}]),"aria-expanded":c.value,"aria-label":o.unref(e)("Components"),onClick:m},[o.createElementVNode("span",coe,[o.createElementVNode("span",null,o.toDisplayString(o.unref(e)("Components")),1)]),o.createElementVNode("span",boe,o.toDisplayString(c.value?"expand_less":"expand_more"),1)],10,doe)):(o.openBlock(),o.createElementBlock("div",moe,o.toDisplayString(o.unref(e)("No Components added yet")),1)),o.withDirectives(o.createElementVNode("div",goe,[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(s.value,(I,D)=>(o.openBlock(),o.createElementBlock("article",{key:String(I.id??I.title??D),class:"pbx-inspectorComponentCard"},[o.createElementVNode("button",{type:"button",class:"pbx-font-sans pbx-inspectorComponentCardToggle","aria-expanded":x(I,D),"aria-label":I.title||o.unref(e)("Component"),onClick:q=>u(I,D)},[o.createElementVNode("span",xoe,[o.createElementVNode("span",hoe,"#"+o.toDisplayString(D+1),1),o.createElementVNode("span",foe,o.toDisplayString(I.title||o.unref(e)("Component")),1)]),o.createElementVNode("span",yoe,o.toDisplayString(x(I,D)?"expand_less":"expand_more"),1)],8,uoe),o.withDirectives(o.createElementVNode("div",woe,[o.createElementVNode("div",voe,[o.createElementVNode("div",koe,[o.createElementVNode("span",Soe,o.toDisplayString(o.unref(e)("ID:")),1),o.createVNode(Pz,{value:I.id},null,8,["value"])]),o.createElementVNode("div",Coe,[o.createElementVNode("span",Toe,o.toDisplayString(o.unref(e)("Component classes:")),1),o.createVNode(rs,{classes:V(I),"empty-placeholder":""},null,8,["classes"])])]),o.createElementVNode("div",Eoe,[o.createVNode(Mr,{icon:"visibility",label:o.unref(e)("View component HTML"),hint:o.unref(e)("Preview component markup"),onClick:q=>k(I,D)},null,8,["label","hint","onClick"])])],512),[[o.vShow,x(I,D)]])]))),128))],512),[[o.vShow,d.value&&c.value]])])):o.createCommentVNode("",!0)])])]))}}),Poe={key:0,class:"pbx-flex pbx-items-center pbx-gap-1 pbx-border-0 pbx-border-solid pbx-border-b pbx-border-gray-100 pbx-pb-3 pbx-pt-1 pbx-overflow-x-auto"},Boe={key:1},Loe={key:0},Noe={class:"pbx-flex pbx-items-left pbx-flex-col pbx-gap-1"},Aoe={class:"pbx-myQuaternaryHeader"},_oe={key:1,class:"pbx-editorSectionDesc"},Doe={key:2,class:"pbx-editorSectionDesc"},zoe={key:3,class:"pbx-editorSectionDesc"},Ioe={class:"pbx-settingsSection"},Voe={class:"pbx-settingsSectionTitle"},Hoe={class:"pbx-overflow-hidden pbx-shadow-xs md:pbx-rounded-lg pbx-border pbx-border-gray-200"},Roe={class:"pbx-overflow-x-auto"},Ooe={class:"pbx-min-w-full"},Foe={class:"pbx-bg-gray-50"},joe={scope:"col",class:"pbx-px-6 pbx-py-3 pbx-text-left pbx-text-xs pbx-font-medium pbx-text-gray-500 pbx-uppercase pbx-tracking-wider"},qoe={scope:"col",class:"pbx-px-6 pbx-py-3 pbx-text-left pbx-text-xs pbx-font-medium pbx-text-gray-500 pbx-uppercase pbx-tracking-wider"},Uoe={class:"pbx-bg-white pbx-divide-y pbx-divide-gray-200"},Woe={class:"pbx-px-6 pbx-py-4 pbx-whitespace-nowrap pbx-text-sm pbx-font-medium pbx-text-gray-900"},Goe={class:"pbx-min-w-[30rem] pbx-w-max"},Koe={class:"pbx-px-6 pbx-py-4 pbx-whitespace-nowrap pbx-text-sm pbx-text-gray-500"},Joe={class:"pbx-min-w-[30rem] pbx-w-max"},Yoe={class:"pbx-inline-flex pbx-items-center pbx-px-2.5 pbx-py-0.5 pbx-rounded-full pbx-text-xs pbx-font-medium pbx-bg-blue-100 pbx-text-blue-800"},Qoe={key:0,class:"pbx-settingsSection"},Xoe={class:"pbx-settingsSectionTitle"},Zoe={class:"pbx-overflow-hidden pbx-shadow-xs md:pbx-rounded-lg pbx-border pbx-border-gray-200"},$oe={class:"pbx-overflow-x-auto"},eie={class:"pbx-min-w-full"},tie={class:"pbx-bg-gray-50"},rie={scope:"col",class:"pbx-px-6 pbx-py-3 pbx-text-left pbx-text-xs pbx-font-medium pbx-text-gray-500 pbx-uppercase pbx-tracking-wider"},oie={scope:"col",class:"pbx-px-6 pbx-py-3 pbx-text-left pbx-text-xs pbx-font-medium pbx-text-gray-500 pbx-uppercase pbx-tracking-wider"},iie={class:"pbx-bg-white pbx-divide-y pbx-divide-gray-200"},nie={key:0},aie={class:"pbx-px-6 pbx-py-4 pbx-whitespace-nowrap pbx-text-sm pbx-font-medium pbx-text-gray-900"},lie={class:"pbx-min-w-[30rem] pbx-w-max"},sie={class:"pbx-px-6 pbx-py-4 pbx-whitespace-nowrap pbx-text-sm pbx-text-gray-500"},pie={class:"pbx-min-w-[30rem] pbx-w-max"},die={key:1},cie={class:"pbx-px-6 pbx-py-4 pbx-whitespace-nowrap pbx-text-sm pbx-font-medium pbx-text-gray-900"},bie={class:"pbx-min-w-[30rem] pbx-w-max"},mie={class:"pbx-px-6 pbx-py-4 pbx-whitespace-nowrap pbx-text-sm pbx-text-gray-500"},gie={class:"pbx-min-w-[30rem] pbx-w-max"},uie={key:1,class:"pbx-settingsSection"},xie={class:"pbx-settingsSectionTitle"},hie={class:"pbx-overflow-hidden pbx-shadow-xs md:pbx-rounded-lg pbx-border pbx-border-gray-200"},fie={class:"pbx-overflow-x-auto"},yie={class:"pbx-min-w-full"},wie={class:"pbx-bg-gray-50"},vie={scope:"col",class:"pbx-px-6 pbx-py-3 pbx-text-left pbx-text-xs pbx-font-medium pbx-text-gray-500 pbx-uppercase pbx-tracking-wider"},kie={scope:"col",class:"pbx-px-6 pbx-py-3 pbx-text-left pbx-text-xs pbx-font-medium pbx-text-gray-500 pbx-uppercase pbx-tracking-wider"},Sie={class:"pbx-bg-white pbx-divide-y pbx-divide-gray-200"},Cie={class:"pbx-px-6 pbx-py-4 pbx-whitespace-nowrap pbx-text-sm pbx-font-medium pbx-text-gray-900"},Tie={class:"pbx-min-w-[30rem] pbx-w-max"},Eie={class:"pbx-px-6 pbx-py-4 pbx-whitespace-nowrap pbx-text-sm pbx-text-gray-500"},Mie={class:"pbx-min-w-[30rem] pbx-w-max"},Pie={class:"pbx-flex pbx-items-center pbx-space-x-3"},Bie=["src"],Lie={class:"pbx-px-6 pbx-py-4 pbx-whitespace-nowrap pbx-text-sm pbx-font-medium pbx-text-gray-900"},Nie={class:"pbx-min-w-[30rem] pbx-w-max"},Aie={class:"pbx-px-6 pbx-py-4 pbx-whitespace-nowrap pbx-text-sm pbx-text-gray-500"},_ie={class:"pbx-min-w-[30rem] pbx-w-max"},Die={class:"pbx-whitespace-nowrap"},zie={key:2,class:"pbx-settingsSection"},Iie={class:"pbx-settingsSectionTitle"},Vie={class:"pbx-overflow-hidden pbx-shadow-xs md:pbx-rounded-lg pbx-border pbx-border-gray-200"},Hie={class:"pbx-overflow-x-auto"},Rie={class:"pbx-w-max pbx-min-w-full"},Oie={class:"pbx-bg-gray-50"},Fie={scope:"col",class:"pbx-px-6 pbx-py-3 pbx-text-left pbx-text-xs pbx-font-medium pbx-text-gray-500 pbx-uppercase pbx-tracking-wider"},jie={scope:"col",class:"pbx-px-6 pbx-py-3 pbx-text-left pbx-text-xs pbx-font-medium pbx-text-gray-500 pbx-uppercase pbx-tracking-wider"},qie={class:"pbx-bg-white pbx-divide-y pbx-divide-gray-200"},Uie={class:"pbx-px-6 pbx-py-4 pbx-whitespace-nowrap pbx-text-sm pbx-font-medium pbx-text-gray-900"},Wie={class:"pbx-min-w-[30rem] pbx-w-max"},Gie={class:"pbx-px-6 pbx-py-4 pbx-whitespace-nowrap pbx-text-sm pbx-text-gray-500"},Kie={class:"pbx-min-w-[30rem] pbx-w-max"},Jie={key:0},Yie={class:"pbx-px-6 pbx-py-4 pbx-whitespace-nowrap pbx-text-sm pbx-font-medium pbx-text-gray-900"},Qie={class:"pbx-min-w-[30rem] pbx-w-max"},Xie={class:"pbx-px-6 pbx-py-4 pbx-whitespace-nowrap pbx-text-sm pbx-text-gray-500"},Zie={class:"pbx-min-w-[30rem] pbx-w-max"},$ie={class:"pbx-inline-flex pbx-items-center pbx-px-2.5 pbx-py-0.5 pbx-rounded-full pbx-text-xs pbx-font-medium"},ene={key:5,class:"pbx-px-2 pbx-settingsSectionGroup"},tne={key:0,class:"pbx-settingsSection"},rne={class:"pbx-settingsSectionTitle"},one={class:"pbx-overflow-hidden pbx-shadow-xs md:pbx-rounded-lg pbx-border pbx-border-gray-200"},ine={class:"pbx-overflow-x-auto"},nne={class:"pbx-min-w-full"},ane={class:"pbx-bg-gray-50"},lne={scope:"col",class:"pbx-px-6 pbx-py-3 pbx-text-left pbx-text-xs pbx-font-medium pbx-text-gray-500 pbx-uppercase pbx-tracking-wider"},sne={scope:"col",class:"pbx-px-6 pbx-py-3 pbx-text-left pbx-text-xs pbx-font-medium pbx-text-gray-500 pbx-uppercase pbx-tracking-wider"},pne={class:"pbx-bg-white pbx-divide-y pbx-divide-gray-200"},dne={class:"pbx-px-6 pbx-py-4 pbx-whitespace-nowrap pbx-text-sm pbx-font-medium pbx-text-gray-900"},cne={class:"pbx-min-w-[30rem] pbx-w-max"},bne={class:"pbx-px-6 pbx-py-4 pbx-whitespace-nowrap pbx-text-sm pbx-text-gray-500"},mne={class:"pbx-min-w-[30rem] pbx-w-max"},gne={class:"pbx-px-6 pbx-py-4 pbx-whitespace-nowrap pbx-text-sm pbx-text-gray-500"},une={class:"pbx-min-w-[30rem] pbx-w-max"},xne={class:"pbx-px-6 pbx-py-4 pbx-whitespace-nowrap pbx-text-sm pbx-font-medium pbx-text-gray-900"},hne={class:"pbx-min-w-[30rem] pbx-w-max"},fne={key:0,class:"pbx-px-6 pbx-py-4 pbx-whitespace-nowrap pbx-text-sm pbx-text-gray-500"},yne={class:"pbx-min-w-[30rem] pbx-w-max"},wne={class:"pbx-flex pbx-items-center pbx-space-x-3"},vne=["src"],kne={class:"pbx-px-6 pbx-py-4 pbx-whitespace-nowrap pbx-text-sm pbx-font-medium pbx-text-gray-900"},Sne={class:"pbx-min-w-[30rem] pbx-w-max"},Cne={key:0,class:"pbx-px-6 pbx-py-4 pbx-whitespace-nowrap pbx-text-sm pbx-text-gray-500"},Tne={class:"pbx-min-w-[30rem] pbx-w-max"},Ene={key:1,class:"pbx-settingsSection"},Mne={class:"pbx-settingsSectionTitle"},Pne={class:"pbx-overflow-hidden pbx-shadow-xs md:pbx-rounded-lg pbx-border pbx-border-gray-200"},Bne={class:"pbx-overflow-x-auto"},Lne={class:"pbx-min-w-full"},Nne={class:"pbx-bg-gray-50"},Ane={scope:"col",class:"pbx-px-6 pbx-py-3 pbx-text-left pbx-text-xs pbx-font-medium pbx-text-gray-500 pbx-uppercase pbx-tracking-wider"},_ne={scope:"col",class:"pbx-px-6 pbx-py-3 pbx-text-left pbx-text-xs pbx-font-medium pbx-text-gray-500 pbx-uppercase pbx-tracking-wider"},Dne={class:"pbx-bg-white pbx-divide-y pbx-divide-gray-200"},zne={key:0},Ine={class:"pbx-px-6 pbx-py-4 pbx-whitespace-nowrap pbx-text-sm pbx-font-medium pbx-text-gray-900"},Vne={class:"pbx-min-w-[30rem] pbx-w-max"},Hne={class:"pbx-px-6 pbx-py-4 pbx-whitespace-nowrap pbx-text-sm pbx-text-gray-500"},Rne={class:"pbx-min-w-[30rem] pbx-w-max"},One={key:1},Fne={class:"pbx-px-6 pbx-py-4 pbx-whitespace-nowrap pbx-text-sm pbx-font-medium pbx-text-gray-900"},jne={class:"pbx-min-w-[30rem] pbx-w-max"},qne={class:"pbx-px-6 pbx-py-4 pbx-whitespace-nowrap pbx-text-sm pbx-text-gray-500"},Une={class:"pbx-min-w-[30rem] pbx-w-max"},Wne={key:2},Gne={class:"pbx-px-6 pbx-py-4 pbx-whitespace-nowrap pbx-text-sm pbx-font-medium pbx-text-gray-900"},Kne={class:"pbx-min-w-[30rem] pbx-w-max"},Jne={class:"pbx-px-6 pbx-py-4 pbx-whitespace-nowrap pbx-text-sm pbx-text-gray-500"},Yne={class:"pbx-min-w-[30rem] pbx-w-max"},Qne={key:0,class:"pbx-flex pbx-items-left pbx-flex-col pbx-gap-1"},Xne={class:"pbx-myQuaternaryHeader"},Zne={class:"pbx-myPrimaryParagraph pbx-text-xs"},$ne={class:"pbx-settingsSection pbx-whitespace-pre-wrap pbx-text-white pbx-overflow-hidden pbx-bg-gray-900"},eae={class:"pbx-flex bg-gray-800/40 pbx-ring-1 ring-white/5"},tae={class:"pbx-mb-px pbx-flex pbx-text-xs pbx-font-medium pbx-text-myPrimaryMediumGrayColor"},rae={class:"pbx-px-4 pbx-py-4 pbx-text-white"},oae={class:"pbx-px-4 pbx-pb-8 pbx-pt-4 pbx-text-white pbx-text-xs pbx-break-all"},iae={class:"pbx-myPrimaryParagraph pbx-text-xs pbx-text-white"},nae={key:0},aae={class:"pbx-editorFieldGroup"},lae={key:1},sae={class:"pbx-myPrimaryParagraph pbx-mt-6 pbx-text-gray-500"},Hn=o.defineComponent({__name:"PageBuilderSettings",props:{embeddedSection:{}},setup(r){const e=r,{translate:t}=ne(),{showToast:i}=tt(),n=o.computed(()=>!!e.embeddedSection),a=o.computed(()=>["overviewApp","overviewUser","overviewConfig"].includes(e.embeddedSection??"")),l=fe,s=o.computed(()=>l.getPageBuilderConfig),p=o.computed(()=>l.getComponents),d=o.ref("overview");function c(E){d.value=E}const b=o.computed(()=>a.value||!e.embeddedSection&&d.value==="overview"),m=o.computed(()=>b.value&&!a.value),g=o.computed(()=>e.embeddedSection==="overviewApp"||!e.embeddedSection&&d.value==="overview"),x=o.computed(()=>e.embeddedSection==="overviewUser"||!e.embeddedSection&&d.value==="overview"),u=o.computed(()=>e.embeddedSection==="overviewConfig"||!e.embeddedSection&&d.value==="overview"),h=o.computed(()=>e.embeddedSection==="download"||!e.embeddedSection&&d.value==="download"),f=o.computed(()=>e.embeddedSection==="selectedHtml"||!e.embeddedSection&&d.value==="viewHTMLConfig");function w(E,S){const C=`
366
+ border-color 0.15s`}])},null,4)],8,Pte),h.value===C.id?(o.openBlock(),o.createElementBlock("div",{key:0,class:"pbx-fixed pbx-inset-0 pbx-z-40",onClick:w})):o.createCommentVNode("",!0),h.value===C.id?(o.openBlock(),o.createElementBlock("div",{key:1,class:"pbx-absolute pbx-right-0 pbx-z-50 pbx-rounded-xl pbx-border pbx-border-solid pbx-border-gray-200 pbx-bg-white pbx-p-3 pbx-shadow-lg",style:{top:"calc(100% + 8px)",width:"266px"},onClick:M[0]||(M[0]=o.withModifiers(()=>{},["stop"]))},[o.createVNode(QD,{"model-value":C.color,"onUpdate:modelValue":k=>u(C,k)},null,8,["model-value","onUpdate:modelValue"])])):o.createCommentVNode("",!0)])])]))),128))]),o.createElementVNode("div",Bte,[o.createElementVNode("div",null,[o.createElementVNode("p",Lte,o.toDisplayString(o.unref(e)("Reset to provided defaults")),1),o.createElementVNode("p",Nte,o.toDisplayString(o.unref(e)("Restore the original colors provided to the page builder")),1)]),o.createElementVNode("button",{type:"button",class:"pbx-mySecondaryButton pbx-flex pbx-items-center pbx-gap-1 pbx-shrink-0",onClick:E},[M[1]||(M[1]=o.createElementVNode("span",{class:"material-symbols-outlined pbx-materialIconBase pbx-leading-none"},"restart_alt",-1)),o.createTextVNode(" "+o.toDisplayString(o.unref(e)("Reset")),1)])])],2),o.createVNode(Et,{showDynamicModalBuilder:y.value,type:"delete",gridColumnAmount:2,title:o.unref(e)("Reset to provided defaults"),description:o.unref(e)("This will restore the original colors provided to the page builder. Any changes you have made to colors or enabled states will be lost."),firstButtonText:o.unref(e)("Close"),thirdButtonText:o.unref(e)("Reset"),onFirstModalButtonFunctionDynamicModalBuilder:S,onThirdModalButtonFunctionDynamicModalBuilder:P},{default:o.withCtx(()=>[...M[2]||(M[2]=[o.createElementVNode("header",null,null,-1),o.createElementVNode("main",null,null,-1)])]),_:1},8,["showDynamicModalBuilder","title","description","firstButtonText","thirdButtonText"])],64))}}),_te=o.defineComponent({__name:"ThemeColorSettingsEditor",setup(r){const{translate:e}=ne();return(t,i)=>(o.openBlock(),o.createBlock(Re,null,{title:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(o.unref(e)("Theme & colors")),1)]),content:o.withCtx(()=>[o.createVNode(Ate,{embedded:""})]),_:1}))}}),Dte={class:"pbx-editorSectionDesc"},zte={class:"pbx-editorFieldGroup"},Ite={for:"page-meta-title",class:"pbx-myPrimaryInputLabel"},Vte=["placeholder"],Hte={class:"pbx-editorFieldGroup"},Rte={for:"page-meta-description",class:"pbx-myPrimaryInputLabel"},Ote=["placeholder"],Fte=["disabled"],jte={key:0,class:"material-symbols-outlined"},qte={key:1,class:"material-symbols-outlined pbx-animate-spin"},Ute=o.defineComponent({name:"PageMetaSettingsEditor",__name:"PageMetaSettingsEditor",setup(r){const{translate:e}=ne(),{showToast:t}=tt(),i=ke(),n=o.ref(""),a=o.ref(""),l=o.ref(!1);o.onMounted(()=>{const p=i.getPageMeta();n.value=p.title||"",a.value=p.description||""});const s=async()=>{if(!l.value){l.value=!0,await Fl(300);try{await i.setPageMeta({title:n.value.trim(),description:a.value.trim()}),t(e("Page meta saved"),"success")}catch{t(e("Could not save page meta"),"error")}finally{l.value=!1}}};return(p,d)=>(o.openBlock(),o.createBlock(Re,null,{title:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(o.unref(e)("Page Meta")),1)]),content:o.withCtx(()=>[o.createElementVNode("p",Dte,o.toDisplayString(o.unref(e)("Page meta description")),1),o.createElementVNode("div",zte,[o.createElementVNode("label",Ite,o.toDisplayString(o.unref(e)("Meta title")),1),o.withDirectives(o.createElementVNode("input",{id:"page-meta-title","onUpdate:modelValue":d[0]||(d[0]=c=>n.value=c),type:"text",class:"pbx-myPrimaryInput pbx-w-full",placeholder:o.unref(e)("Meta title placeholder")},null,8,Vte),[[o.vModelText,n.value]])]),o.createElementVNode("div",Hte,[o.createElementVNode("label",Rte,o.toDisplayString(o.unref(e)("Meta description")),1),o.withDirectives(o.createElementVNode("textarea",{id:"page-meta-description","onUpdate:modelValue":d[1]||(d[1]=c=>a.value=c),rows:"3",class:"pbx-myPrimaryInput pbx-w-full pbx-resize-y",placeholder:o.unref(e)("Meta description placeholder")},null,8,Ote),[[o.vModelText,a.value]])]),o.createElementVNode("button",{type:"button",class:"pbx-myPrimaryButton pbx-w-full",disabled:l.value,onClick:s},[o.createTextVNode(o.toDisplayString(o.unref(e)("Save"))+" ",1),l.value?o.createCommentVNode("",!0):(o.openBlock(),o.createElementBlock("span",jte,"check")),l.value?(o.openBlock(),o.createElementBlock("span",qte,"refresh")):o.createCommentVNode("",!0)],8,Fte)]),_:1}))}}),Wte={key:0,class:"pbx-fixed pbx-inset-0 pbx-z-[9999]"},Gte={class:"pbx-flex pbx-gap-2 pbx-justify-between pbx-items-center pbx-py-2 pbx-px-2 pbx-mb-2 pbx-border-b pbx-border-gray-200"},Kte={class:"pbx-myQuaternaryHeader pbx-my-0 pbx-py-0 pbx-text-black"},Jte={class:"pbx-pt-4 pbx-px-2"},Tz=o.defineComponent({__name:"FloatingSidePanel",props:{title:{type:String,required:!1,default:null},showSidebarPanel:{type:Boolean,default:!1},position:{type:String,required:!0,default:"right",validator(r){const t=["left","right"].includes(r);return t||console.warn(`Invalid prop: position must be 'left' or 'right', got '${r}'`),t}},closeOnOverlayClick:{type:Boolean,default:!0}},emits:["closeSidebarPanel"],setup(r,{emit:e}){const t=r,i=e,n=()=>{i("closeSidebarPanel")},a=()=>{t.closeOnOverlayClick&&n()};return(l,s)=>(o.openBlock(),o.createBlock(o.Teleport,{to:"body"},[o.createVNode(o.Transition,{name:"popup-fade"},{default:o.withCtx(()=>[r.showSidebarPanel?(o.openBlock(),o.createElementBlock("div",Wte,[o.createElementVNode("div",{class:o.normalizeClass(["pbx-fixed pbx-inset-0 pbx-bg-black pbx-opacity-20 pbx-z-40",{"pbx-pointer-events-none":!r.closeOnOverlayClick}]),onClick:a},null,2),o.createElementVNode("div",{class:o.normalizeClass(["pbx-font-sans pbx-fixed pbx-top-0 pbx-rounded-3xl pbx-pt-2 pbx-pb-20 pbx-px-2 pbx-border pbx-border-gray-200 pbx-max-h-[80vh] lg:pbx-min-h-[98%] pbx-min-h-[80vh] lg:pbx-min-w-96 lg:pbx-w-96 pbx-w-[96%] pbx-overflow-y-auto pbx-z-50 pbx-bg-white lg:pbx-mt-2 pbx-mt-2",[r.position==="left"?"pbx-left-0 pbx-ml-[1%]":"",r.position==="right"?"pbx-right-0 pbx-mr-[1%]":""]]),onClick:s[0]||(s[0]=o.withModifiers(()=>{},["stop"]))},[o.createElementVNode("div",Gte,[o.createElementVNode("span",Kte,o.toDisplayString(r.title),1),o.createElementVNode("span",{onClick:n},[...s[1]||(s[1]=[o.createElementVNode("div",{class:"pbx-h-10 pbx-w-10 pbx-cursor-pointer pbx-rounded-full pbx-flex pbx-items-center pbx-border-none pbx-justify-center pbx-bg-gray-50 pbx-aspect-square hover:pbx-bg-myPrimaryLinkColor hover:pbx-text-white focus-visible:pbx-ring-0 pbx-text-black"},[o.createElementVNode("span",{class:"material-symbols-outlined"}," close ")],-1)])])]),o.createElementVNode("div",Jte,[o.renderSlot(l.$slots,"default")])],2)])):o.createCommentVNode("",!0)]),_:3})]))}}),Yte={class:"pbx-overflow-y-auto"},Qte={key:0,class:"pbx-flex pbx-items-center pbx-justify-center pbx-gap-2"},Xte={class:"pbx-bg-gray-100 pbx-rounded-full pbx-w-32 pbx-h-32 pbx-flex pbx-items-center pbx-justify-center"},Zte={class:"pbx-text-center"},$te={class:"pbx-lg:pbx-text-7xl pbx-text-5xl"},ere={key:1,class:"pbx-w-full pbx-space-y-5"},tre={class:"pbx-text-base pbx-font-semibold pbx-text-center pbx-text-myPrimaryDarkGrayColor"},rre={class:"pbx-seoCheckGroupTitle"},ore={class:"pbx-space-y-2"},ire={class:"material-symbols-outlined","aria-hidden":"true"},nre={class:"pbx-pageDesignOpenButtonText"},are={class:"pbx-pageDesignOpenButtonLabel"},lre={class:"pbx-pageDesignOpenButtonHint"},sre={key:2,class:"pbx-text-gray-500 pbx-text-center pbx-py-8"},pre=o.defineComponent({__name:"SeoCheckPanel",props:{seoResult:{}},setup(r){const e=r,{translate:t}=ne(),i=o.computed(()=>{if(!e.seoResult)return[];const n=new Map;for(const a of e.seoResult.checks){const l=a.category??"Other";n.has(l)||n.set(l,[]),n.get(l).push(a)}return Array.from(n.entries()).map(([a,l])=>({title:a,checks:l}))});return(n,a)=>(o.openBlock(),o.createElementBlock("div",Yte,[r.seoResult?(o.openBlock(),o.createElementBlock("div",Qte,[o.createElementVNode("div",{class:"pbx-relative pbx-my-4 pbx-rounded-full pbx-flex pbx-items-center pbx-justify-center pbx-w-36 pbx-h-36",style:o.normalizeStyle({background:`conic-gradient(${r.seoResult.score<50?"#ef4444":"#50C878"} ${r.seoResult.score}%, #e5e7eb 0)`})},[o.createElementVNode("div",Xte,[o.createElementVNode("div",Zte,[o.createElementVNode("span",$te,o.toDisplayString(r.seoResult.score),1),a[0]||(a[0]=o.createElementVNode("span",{class:"pbx-text-xl"},"%",-1))])])],4)])):o.createCommentVNode("",!0),i.value.length?(o.openBlock(),o.createElementBlock("div",ere,[o.createElementVNode("h3",tre,o.toDisplayString(o.unref(t)("SEO Check Results")),1),(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(i.value,l=>(o.openBlock(),o.createElementBlock("div",{key:l.title,class:"pbx-space-y-2"},[o.createElementVNode("h4",rre,o.toDisplayString(o.unref(t)(l.title)),1),o.createElementVNode("ul",ore,[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(l.checks,(s,p)=>(o.openBlock(),o.createElementBlock("li",{key:p,class:o.normalizeClass(["pbx-seoCheckRow",s.passed?"pbx-seoCheckRow--pass":"pbx-seoCheckRow--fail"])},[o.createElementVNode("span",{class:o.normalizeClass(["pbx-seoCheckRowIcon",s.passed?"pbx-seoCheckRowIcon--pass":"pbx-seoCheckRowIcon--fail"])},[o.createElementVNode("span",ire,o.toDisplayString(s.passed?"check":"close"),1)],2),o.createElementVNode("span",nre,[o.createElementVNode("span",are,o.toDisplayString(o.unref(t)(s.check)),1),o.createElementVNode("span",lre,o.toDisplayString(s.details),1)])],2))),128))])]))),128))])):(o.openBlock(),o.createElementBlock("div",sre,o.toDisplayString(o.unref(t)("No SEO checks available.")),1))]))}}),dre={class:"pbx-editorSectionDesc"},cre=o.defineComponent({name:"SeoCheckSettingsEditor",__name:"SeoCheckSettingsEditor",setup(r){const{translate:e}=ne(),t=ke(),i=o.ref(null),n=o.ref(!1),a=o.ref(!1),l=async()=>{a.value=!0,n.value=!0,await Fl(300);try{i.value=await t.analyzeSEO()}finally{a.value=!1}},s=()=>{n.value=!1};return(p,d)=>(o.openBlock(),o.createElementBlock(o.Fragment,null,[o.createVNode(Re,null,{title:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(o.unref(e)("SEO Check")),1)]),content:o.withCtx(()=>[o.createElementVNode("p",dre,o.toDisplayString(o.unref(e)("SEO check description")),1),o.createVNode(Mr,{icon:"circle_circle",label:o.unref(e)("Run SEO check"),hint:o.unref(e)("Analyze headings, images, links and word count"),"is-loading":a.value,onClick:l},null,8,["label","hint","is-loading"])]),_:1}),o.createVNode(Tz,{title:o.unref(e)("SEO Check"),showSidebarPanel:n.value,position:"left",onCloseSidebarPanel:s},{default:o.withCtx(()=>[o.createVNode(pre,{"seo-result":i.value},null,8,["seo-result"])]),_:1},8,["title","showSidebarPanel"])],64))}}),bre={class:"pbx-editorSectionDesc"},mre={class:"pbx-pageDesignOpenButtonText"},gre={class:"pbx-pageDesignOpenButtonLabel"},ure={class:"pbx-pageDesignOpenButtonHint"},xre=o.defineComponent({name:"RemoveAllComponentsSettingsEditor",__name:"RemoveAllComponentsSettingsEditor",setup(r){const{translate:e}=ne(),{showToast:t}=tt(),i=ke(),n=o.ref(!1),a=o.ref(!1),l=o.ref(""),s=o.ref(1),p=o.ref(""),d=o.ref(""),c=o.ref(""),b=o.ref(null),m=o.ref(null),g=o.ref(null),x=o.ref(null),u=o.ref(null),h=function(){a.value=!0,l.value="delete",s.value=2,p.value=e("Remove all Components"),d.value=e("Are you sure you want to remove all Components?"),c.value=e("Close"),b.value=null,m.value=e("Delete"),g.value=function(){a.value=!1},x.value=function(){},u.value=async function(){n.value=!0,await i.clearHtmlSelection(),await i.handleFormSubmission(),await Oe(500),a.value=!1,n.value=!1,t(e("All components removed"),"success")}};return(f,w)=>(o.openBlock(),o.createElementBlock(o.Fragment,null,[o.createVNode(Re,null,{title:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(o.unref(e)("Page layout")),1)]),content:o.withCtx(()=>[o.createElementVNode("p",bre,o.toDisplayString(o.unref(e)("Remove all components description")),1),o.createElementVNode("button",{type:"button",class:"pbx-pageDesignOpenButton pbx-pageDesignOpenButton--danger",onClick:h},[w[3]||(w[3]=o.createElementVNode("span",{class:"material-symbols-outlined"},"delete_forever",-1)),o.createElementVNode("span",mre,[o.createElementVNode("span",gre,o.toDisplayString(o.unref(e)("Remove all Components")),1),o.createElementVNode("span",ure,o.toDisplayString(o.unref(e)("Clear every section from the page")),1)]),w[4]||(w[4]=o.createElementVNode("span",{class:"pbx-pageDesignOpenButtonArrow material-symbols-outlined","aria-hidden":"true"}," arrow_forward ",-1))])]),_:1}),o.createVNode(Et,{showDynamicModalBuilder:a.value,type:l.value,gridColumnAmount:s.value,title:p.value,description:d.value,isLoading:n.value,firstButtonText:c.value,secondButtonText:b.value??void 0,thirdButtonText:m.value??void 0,onFirstModalButtonFunctionDynamicModalBuilder:w[0]||(w[0]=()=>{var y;return(y=g.value)==null?void 0:y.call(g)}),onSecondModalButtonFunctionDynamicModalBuilder:w[1]||(w[1]=()=>{var y;return(y=x.value)==null?void 0:y.call(x)}),onThirdModalButtonFunctionDynamicModalBuilder:w[2]||(w[2]=()=>{var y;return(y=u.value)==null?void 0:y.call(u)})},{default:o.withCtx(()=>[...w[5]||(w[5]=[o.createElementVNode("header",null,null,-1),o.createElementVNode("main",null,null,-1)])]),_:1},8,["showDynamicModalBuilder","type","gridColumnAmount","title","description","isLoading","firstButtonText","secondButtonText","thirdButtonText"])],64))}}),hre={class:"pbx-editorSectionDesc"},fre={class:"pbx-pageDesignOpenButtonText"},yre={class:"pbx-pageDesignOpenButtonLabel"},wre={class:"pbx-pageDesignOpenButtonHint"},vre=o.defineComponent({name:"PageDesignSettingsEditor",__name:"PageDesignSettingsEditor",emits:["open"],setup(r){const{translate:e}=ne();return(t,i)=>(o.openBlock(),o.createBlock(Re,null,{title:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(o.unref(e)("Page Design")),1)]),content:o.withCtx(()=>[o.createElementVNode("p",hre,o.toDisplayString(o.unref(e)("Page design description")),1),o.createElementVNode("button",{type:"button",class:"pbx-pageDesignOpenButton",onClick:i[0]||(i[0]=n=>t.$emit("open"))},[o.createVNode(Jl),o.createElementVNode("span",fre,[o.createElementVNode("span",yre,o.toDisplayString(o.unref(e)("Open page design")),1),o.createElementVNode("span",wre,o.toDisplayString(o.unref(e)("Typography, colors, spacing & more")),1)]),i[1]||(i[1]=o.createElementVNode("span",{class:"pbx-pageDesignOpenButtonArrow material-symbols-outlined","aria-hidden":"true"}," arrow_forward ",-1))])]),_:1}))}}),kre={class:"pbx-editorSectionDesc"},Sre={class:"pbx-inspectorActionStack"},Cre=o.defineComponent({name:"PageHtmlEditorSettingsEditor",__name:"PageHtmlEditorSettingsEditor",setup(r){const{translate:e}=ne(),t=ke(),{openHtmlViewer:i}=is(),{openHtmlEditor:n}=ls(),a=async()=>{const s=await t.generateFullPageHtml();n(e("HTML Editor"),s,"page")},l=async()=>{const s=await t.generateFullPageHtml();i(e("Page HTML"),s)};return(s,p)=>(o.openBlock(),o.createBlock(Re,null,{title:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(o.unref(e)("HTML Editor")),1)]),content:o.withCtx(()=>[o.createElementVNode("p",kre,o.toDisplayString(o.unref(e)("Page HTML editor description")),1),o.createElementVNode("div",Sre,[o.createVNode(Mr,{icon:"visibility",label:o.unref(e)("View page HTML"),hint:o.unref(e)("Preview full page markup"),onClick:l},null,8,["label","hint"]),o.createVNode(Mr,{icon:"deployed_code",label:o.unref(e)("Open HTML editor"),hint:o.unref(e)("Edit full page markup"),onClick:a},null,8,["label","hint"])])]),_:1}))}}),no=function(r){return!r||typeof r=="object"&&r.constructor===Object&&Object.keys(r).length===0},Tre="3.5.52",Ere=r=>/^[a-z][a-z0-9+.-]*:/i.test(r)||r.startsWith("//");function Ez(r,e){if(!r)return console.warn("No valid pagebuilder element passed"),"";const t=r.cloneNode(!0);if(t.removeAttribute("id"),t.querySelectorAll("[data-pbx-insert-btn]").forEach(a=>{a.remove()}),t.querySelectorAll("[data-componentid], [data-component-title], #page-builder-editor-editable-area").forEach(a=>{a.removeAttribute("data-componentid"),a.removeAttribute("data-component-title"),a.id==="page-builder-editor-editable-area"&&a.removeAttribute("id")}),t.querySelectorAll("[data-pagebuilder-content]").forEach(a=>{a.removeAttribute("data-pagebuilder-content")}),t.querySelectorAll("[data-isl-active]").forEach(a=>{a.removeAttribute("data-isl-active")}),t.removeAttribute("data-builder-canvas"),e&&e&&typeof e.imageUrlPrefix=="string"){const a=e.imageUrlPrefix;t.querySelectorAll("img").forEach(s=>{const p=s.getAttribute("src")||"";p&&!p.startsWith("http")&&!Ere(p)&&a&&!p.startsWith(a)&&s.setAttribute("src",a+p.replace(/^\/+/,""))})}const n=a=>{for(let l=a.childNodes.length-1;l>=0;l--){const s=a.childNodes[l];s.nodeType===Node.COMMENT_NODE?a.removeChild(s):s.nodeType===Node.ELEMENT_NODE&&n(s)}};return n(t),t.outerHTML}function Mz(r){if(!(r!=null&&r.trim()))return[];const e=r.match(/class\s*=\s*(["'])(.*?)\1/i);return e!=null&&e[2]?e[2].split(/\s+/).filter(Boolean):[]}async function pc(r){const{showToast:e}=tt(),{translate:t}=ne();try{return await navigator.clipboard.writeText(r),e(t("Copied to clipboard"),"success"),!0}catch{return e(t("Clipboard unavailable"),"error"),!1}}const Mre=["title","aria-label"],Pre={class:"pbx-inspectorIdChipText"},Bre={class:"pbx-inspectorIdChipIcon material-symbols-outlined","aria-hidden":"true"},Lre={key:1,class:"pbx-inspectorValue"},Pz=o.defineComponent({__name:"InspectorIdValue",props:{value:{}},setup(r){const e=r,{translate:t}=ne(),i=o.ref(!1),n=o.computed(()=>{const s=e.value;return s==null||s===""?null:String(s)}),a=o.computed(()=>{const s=n.value;return s?s.length<=18?s:`${s.slice(0,8)}…${s.slice(-4)}`:"—"});async function l(){if(!n.value)return;await pc(n.value)&&(i.value=!0,globalThis.setTimeout(()=>{i.value=!1},2e3))}return(s,p)=>n.value?(o.openBlock(),o.createElementBlock("button",{key:0,type:"button",class:"pbx-inspectorIdChip",title:n.value,"aria-label":`${o.unref(t)("Copy ID")}: ${n.value}`,onClick:l},[o.createElementVNode("span",Pre,o.toDisplayString(a.value),1),o.createElementVNode("span",Bre,o.toDisplayString(i.value?"check":"content_copy"),1)],8,Mre)):(o.openBlock(),o.createElementBlock("span",Lre,"—"))}}),Nre={class:"pbx-selectedHtmlInspector"},Are={class:"pbx-editorSectionDesc"},_re={class:"pbx-editorFieldGroup"},Dre={class:"pbx-editorSectionTitle"},zre={class:"pbx-inspectorCard"},Ire={class:"pbx-inspectorLabel"},Vre={class:"pbx-editorFieldGroup"},Hre={class:"pbx-editorSectionTitle"},Rre=["aria-label"],Ore=["aria-selected"],Fre=["aria-selected"],jre=["aria-selected"],qre={class:"pbx-inspectorPanel"},Ure={key:0,role:"tabpanel"},Wre={key:0,class:"pbx-inspectorEmpty"},Gre={class:"pbx-inspectorMeta pbx-mb-3"},Kre={key:0,class:"pbx-inspectorMetaRow"},Jre={class:"pbx-inspectorFieldLabel"},Yre={class:"pbx-inspectorValue pbx-inspectorValueBreak"},Qre={class:"pbx-inspectorMetaRow pbx-inspectorMetaRowStacked"},Xre={class:"pbx-inspectorFieldLabel"},Zre={class:"pbx-inspectorActionStack"},$re={key:1,role:"tabpanel"},eoe={key:0,class:"pbx-inspectorEmpty"},toe={class:"pbx-inspectorMeta pbx-mb-3"},roe={class:"pbx-inspectorMetaRow"},ooe={class:"pbx-inspectorFieldLabel"},ioe={class:"pbx-inspectorMetaRow"},noe={class:"pbx-inspectorFieldLabel"},aoe={class:"pbx-inspectorValue"},loe={class:"pbx-inspectorMetaRow pbx-inspectorMetaRowStacked"},soe={class:"pbx-inspectorFieldLabel"},poe={key:2,role:"tabpanel"},doe=["aria-expanded","aria-label"],coe={class:"pbx-inspectorComponentsSummaryContent"},boe={class:"pbx-inspectorComponentsSummaryChevron material-symbols-outlined","aria-hidden":"true"},moe={key:1,class:"pbx-inspectorComponentsSummary pbx-inspectorComponentsSummaryEmpty"},goe={class:"pbx-inspectorList"},uoe=["aria-expanded","aria-label","onClick"],xoe={class:"pbx-inspectorComponentCardTitleContent"},hoe={class:"pbx-inspectorListIndex"},foe={class:"pbx-inspectorListTitle"},yoe={class:"pbx-inspectorComponentsSummaryChevron material-symbols-outlined","aria-hidden":"true"},woe={class:"pbx-inspectorComponentCardBody"},voe={class:"pbx-inspectorMeta pbx-inspectorComponentCardMeta"},koe={class:"pbx-inspectorMetaRow"},Soe={class:"pbx-inspectorFieldLabel"},Coe={class:"pbx-inspectorMetaRow pbx-inspectorMetaRowStacked"},Toe={class:"pbx-inspectorFieldLabel"},Eoe={class:"pbx-inspectorComponentCardFooter"},Moe=o.defineComponent({__name:"SelectedHtmlInspector",setup(r){const{translate:e}=ne(),{openHtmlViewer:t}=is(),{openHtmlEditor:i}=ls(),n=fe,a=o.computed(()=>n.getElement),l=o.computed(()=>n.getComponent),s=o.computed(()=>n.getComponents),p=o.ref("element"),d=o.computed(()=>{var N;return((N=s.value)==null?void 0:N.length)??0}),c=o.ref(!1),b=o.ref(new Set);function m(){d.value&&(c.value=!c.value)}function g(N,A){return String(N.id??N.title??A)}function x(N,A){return b.value.has(g(N,A))}function u(N,A){const I=g(N,A),D=new Set(b.value);D.has(I)?D.delete(I):D.add(I),b.value=D}o.watch(c,N=>{N||(b.value=new Set)}),o.watch(p,N=>{N!=="components"&&(c.value=!1,b.value=new Set)});function h(N){return N?N.tagName.toLowerCase():"—"}function f(N){return N?"object":"—"}function w(N){return N.length?`${e("array")} · ${N.length}`:e("array")}const y=o.computed(()=>[{label:e("Element type:"),value:h(a.value),tone:a.value?"active":"muted"},{label:e("Component type:"),value:f(l.value),tone:l.value?"active":"muted"},{label:e("Components:"),value:w(s.value),tone:d.value>0?"active":"muted"}]),E=o.computed(()=>{var A;const N=a.value;return(A=N==null?void 0:N.classList)!=null&&A.length?Array.from(N.classList):[]}),S=o.computed(()=>{var N;return(N=l.value)!=null&&N.html_code?Mz(l.value.html_code):[]}),P=o.computed(()=>{const N=a.value;return!N||N.tagName!=="IMG"?null:N.src||"—"});function v(N){p.value=N}function M(){a.value&&i(e("Element HTML"),a.value.outerHTML,"element")}function C(){a.value&&t(e("Element HTML"),a.value.outerHTML)}function k(N,A){const I=N.title||(A!==void 0?`${e("Component")} #${A+1}`:e("Component"));t(`${I} · ${e("HTML")}`,N.html_code||"")}function T(){l.value&&k(l.value)}function V(N){return Mz(N.html_code||"")}return(N,A)=>(o.openBlock(),o.createElementBlock("div",Nre,[o.createElementVNode("p",Are,o.toDisplayString(o.unref(e)("Overview of Selected Element, Component, and Components. This section provides real-time updates based on your HTML selection.")),1),o.createElementVNode("div",_re,[o.createElementVNode("h4",Dre,o.toDisplayString(o.unref(e)("Types")),1),o.createElementVNode("div",zre,[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(y.value,I=>(o.openBlock(),o.createElementBlock("div",{key:I.label,class:"pbx-inspectorRow"},[o.createElementVNode("span",Ire,o.toDisplayString(I.label),1),o.createElementVNode("span",{class:o.normalizeClass(["pbx-inspectorBadge",I.tone==="active"?"pbx-inspectorBadgeActive":"pbx-inspectorBadgeMuted"])},o.toDisplayString(I.value),3)]))),128))])]),o.createElementVNode("div",Vre,[o.createElementVNode("h4",Hre,o.toDisplayString(o.unref(e)("Content")),1),o.createElementVNode("div",{class:"pbx-inspectorTabs",role:"tablist","aria-label":o.unref(e)("Content")},[o.createElementVNode("button",{type:"button",role:"tab","aria-selected":p.value==="element",class:o.normalizeClass(["pbx-inspectorTab pbx-font-sans",{"pbx-inspectorTabActive":p.value==="element"}]),onClick:A[0]||(A[0]=I=>v("element"))},o.toDisplayString(o.unref(e)("Element")),11,Ore),o.createElementVNode("button",{type:"button",role:"tab","aria-selected":p.value==="component",class:o.normalizeClass(["pbx-inspectorTab pbx-font-sans",{"pbx-inspectorTabActive":p.value==="component"}]),onClick:A[1]||(A[1]=I=>v("component"))},o.toDisplayString(o.unref(e)("Component")),11,Fre),o.createElementVNode("button",{type:"button",role:"tab","aria-selected":p.value==="components",class:o.normalizeClass(["pbx-inspectorTab pbx-font-sans",{"pbx-inspectorTabActive":p.value==="components"}]),onClick:A[2]||(A[2]=I=>v("components"))},o.toDisplayString(o.unref(e)("Components")),11,jre)],8,Rre),o.createElementVNode("div",qre,[p.value==="element"?(o.openBlock(),o.createElementBlock("div",Ure,[a.value?(o.openBlock(),o.createElementBlock(o.Fragment,{key:1},[o.createElementVNode("div",Gre,[P.value!==null?(o.openBlock(),o.createElementBlock("div",Kre,[o.createElementVNode("span",Jre,o.toDisplayString(o.unref(e)("Element src:")),1),o.createElementVNode("span",Yre,o.toDisplayString(P.value),1)])):o.createCommentVNode("",!0),o.createElementVNode("div",Qre,[o.createElementVNode("span",Xre,o.toDisplayString(o.unref(e)("Element classes:")),1),o.createVNode(rs,{classes:E.value,"empty-placeholder":""},null,8,["classes"])])]),o.createElementVNode("div",Zre,[o.createVNode(Mr,{icon:"visibility",label:o.unref(e)("View element HTML"),hint:o.unref(e)("Preview selected element markup"),onClick:C},null,8,["label","hint"]),o.createVNode(Mr,{icon:"deployed_code",label:o.unref(e)("Open element HTML editor"),hint:o.unref(e)("Edit selected element markup"),onClick:M},null,8,["label","hint"])])],64)):(o.openBlock(),o.createElementBlock("p",Wre,o.toDisplayString(o.unref(e)("No Element selected")),1))])):o.createCommentVNode("",!0),p.value==="component"?(o.openBlock(),o.createElementBlock("div",$re,[l.value?(o.openBlock(),o.createElementBlock(o.Fragment,{key:1},[o.createElementVNode("div",toe,[o.createElementVNode("div",roe,[o.createElementVNode("span",ooe,o.toDisplayString(o.unref(e)("ID:")),1),o.createVNode(Pz,{value:l.value.id},null,8,["value"])]),o.createElementVNode("div",ioe,[o.createElementVNode("span",noe,o.toDisplayString(o.unref(e)("Title:")),1),o.createElementVNode("span",aoe,o.toDisplayString(l.value.title||"—"),1)]),o.createElementVNode("div",loe,[o.createElementVNode("span",soe,o.toDisplayString(o.unref(e)("Component classes:")),1),o.createVNode(rs,{classes:S.value,"empty-placeholder":""},null,8,["classes"])])]),o.createVNode(Mr,{icon:"visibility",label:o.unref(e)("View component HTML"),hint:o.unref(e)("Preview component markup"),onClick:T},null,8,["label","hint"])],64)):(o.openBlock(),o.createElementBlock("p",eoe,o.toDisplayString(o.unref(e)("No Component selected")),1))])):o.createCommentVNode("",!0),p.value==="components"?(o.openBlock(),o.createElementBlock("div",poe,[d.value?(o.openBlock(),o.createElementBlock("button",{key:0,type:"button",class:o.normalizeClass(["pbx-font-sans pbx-inspectorComponentsSummary pbx-inspectorComponentsSummaryToggle",{"pbx-inspectorComponentsSummaryOpen":c.value}]),"aria-expanded":c.value,"aria-label":o.unref(e)("Components"),onClick:m},[o.createElementVNode("span",coe,[o.createElementVNode("span",null,o.toDisplayString(o.unref(e)("Components")),1)]),o.createElementVNode("span",boe,o.toDisplayString(c.value?"expand_less":"expand_more"),1)],10,doe)):(o.openBlock(),o.createElementBlock("div",moe,o.toDisplayString(o.unref(e)("No Components added yet")),1)),o.withDirectives(o.createElementVNode("div",goe,[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(s.value,(I,D)=>(o.openBlock(),o.createElementBlock("article",{key:String(I.id??I.title??D),class:"pbx-inspectorComponentCard"},[o.createElementVNode("button",{type:"button",class:"pbx-font-sans pbx-inspectorComponentCardToggle","aria-expanded":x(I,D),"aria-label":I.title||o.unref(e)("Component"),onClick:q=>u(I,D)},[o.createElementVNode("span",xoe,[o.createElementVNode("span",hoe,"#"+o.toDisplayString(D+1),1),o.createElementVNode("span",foe,o.toDisplayString(I.title||o.unref(e)("Component")),1)]),o.createElementVNode("span",yoe,o.toDisplayString(x(I,D)?"expand_less":"expand_more"),1)],8,uoe),o.withDirectives(o.createElementVNode("div",woe,[o.createElementVNode("div",voe,[o.createElementVNode("div",koe,[o.createElementVNode("span",Soe,o.toDisplayString(o.unref(e)("ID:")),1),o.createVNode(Pz,{value:I.id},null,8,["value"])]),o.createElementVNode("div",Coe,[o.createElementVNode("span",Toe,o.toDisplayString(o.unref(e)("Component classes:")),1),o.createVNode(rs,{classes:V(I),"empty-placeholder":""},null,8,["classes"])])]),o.createElementVNode("div",Eoe,[o.createVNode(Mr,{icon:"visibility",label:o.unref(e)("View component HTML"),hint:o.unref(e)("Preview component markup"),onClick:q=>k(I,D)},null,8,["label","hint","onClick"])])],512),[[o.vShow,x(I,D)]])]))),128))],512),[[o.vShow,d.value&&c.value]])])):o.createCommentVNode("",!0)])])]))}}),Poe={key:0,class:"pbx-flex pbx-items-center pbx-gap-1 pbx-border-0 pbx-border-solid pbx-border-b pbx-border-gray-100 pbx-pb-3 pbx-pt-1 pbx-overflow-x-auto"},Boe={key:1},Loe={key:0},Noe={class:"pbx-flex pbx-items-left pbx-flex-col pbx-gap-1"},Aoe={class:"pbx-myQuaternaryHeader"},_oe={key:1,class:"pbx-editorSectionDesc"},Doe={key:2,class:"pbx-editorSectionDesc"},zoe={key:3,class:"pbx-editorSectionDesc"},Ioe={class:"pbx-settingsSection"},Voe={class:"pbx-settingsSectionTitle"},Hoe={class:"pbx-overflow-hidden pbx-shadow-xs md:pbx-rounded-lg pbx-border pbx-border-gray-200"},Roe={class:"pbx-overflow-x-auto"},Ooe={class:"pbx-min-w-full"},Foe={class:"pbx-bg-gray-50"},joe={scope:"col",class:"pbx-px-6 pbx-py-3 pbx-text-left pbx-text-xs pbx-font-medium pbx-text-gray-500 pbx-uppercase pbx-tracking-wider"},qoe={scope:"col",class:"pbx-px-6 pbx-py-3 pbx-text-left pbx-text-xs pbx-font-medium pbx-text-gray-500 pbx-uppercase pbx-tracking-wider"},Uoe={class:"pbx-bg-white pbx-divide-y pbx-divide-gray-200"},Woe={class:"pbx-px-6 pbx-py-4 pbx-whitespace-nowrap pbx-text-sm pbx-font-medium pbx-text-gray-900"},Goe={class:"pbx-min-w-[30rem] pbx-w-max"},Koe={class:"pbx-px-6 pbx-py-4 pbx-whitespace-nowrap pbx-text-sm pbx-text-gray-500"},Joe={class:"pbx-min-w-[30rem] pbx-w-max"},Yoe={class:"pbx-inline-flex pbx-items-center pbx-px-2.5 pbx-py-0.5 pbx-rounded-full pbx-text-xs pbx-font-medium pbx-bg-blue-100 pbx-text-blue-800"},Qoe={key:0,class:"pbx-settingsSection"},Xoe={class:"pbx-settingsSectionTitle"},Zoe={class:"pbx-overflow-hidden pbx-shadow-xs md:pbx-rounded-lg pbx-border pbx-border-gray-200"},$oe={class:"pbx-overflow-x-auto"},eie={class:"pbx-min-w-full"},tie={class:"pbx-bg-gray-50"},rie={scope:"col",class:"pbx-px-6 pbx-py-3 pbx-text-left pbx-text-xs pbx-font-medium pbx-text-gray-500 pbx-uppercase pbx-tracking-wider"},oie={scope:"col",class:"pbx-px-6 pbx-py-3 pbx-text-left pbx-text-xs pbx-font-medium pbx-text-gray-500 pbx-uppercase pbx-tracking-wider"},iie={class:"pbx-bg-white pbx-divide-y pbx-divide-gray-200"},nie={key:0},aie={class:"pbx-px-6 pbx-py-4 pbx-whitespace-nowrap pbx-text-sm pbx-font-medium pbx-text-gray-900"},lie={class:"pbx-min-w-[30rem] pbx-w-max"},sie={class:"pbx-px-6 pbx-py-4 pbx-whitespace-nowrap pbx-text-sm pbx-text-gray-500"},pie={class:"pbx-min-w-[30rem] pbx-w-max"},die={key:1},cie={class:"pbx-px-6 pbx-py-4 pbx-whitespace-nowrap pbx-text-sm pbx-font-medium pbx-text-gray-900"},bie={class:"pbx-min-w-[30rem] pbx-w-max"},mie={class:"pbx-px-6 pbx-py-4 pbx-whitespace-nowrap pbx-text-sm pbx-text-gray-500"},gie={class:"pbx-min-w-[30rem] pbx-w-max"},uie={key:1,class:"pbx-settingsSection"},xie={class:"pbx-settingsSectionTitle"},hie={class:"pbx-overflow-hidden pbx-shadow-xs md:pbx-rounded-lg pbx-border pbx-border-gray-200"},fie={class:"pbx-overflow-x-auto"},yie={class:"pbx-min-w-full"},wie={class:"pbx-bg-gray-50"},vie={scope:"col",class:"pbx-px-6 pbx-py-3 pbx-text-left pbx-text-xs pbx-font-medium pbx-text-gray-500 pbx-uppercase pbx-tracking-wider"},kie={scope:"col",class:"pbx-px-6 pbx-py-3 pbx-text-left pbx-text-xs pbx-font-medium pbx-text-gray-500 pbx-uppercase pbx-tracking-wider"},Sie={class:"pbx-bg-white pbx-divide-y pbx-divide-gray-200"},Cie={class:"pbx-px-6 pbx-py-4 pbx-whitespace-nowrap pbx-text-sm pbx-font-medium pbx-text-gray-900"},Tie={class:"pbx-min-w-[30rem] pbx-w-max"},Eie={class:"pbx-px-6 pbx-py-4 pbx-whitespace-nowrap pbx-text-sm pbx-text-gray-500"},Mie={class:"pbx-min-w-[30rem] pbx-w-max"},Pie={class:"pbx-flex pbx-items-center pbx-space-x-3"},Bie=["src"],Lie={class:"pbx-px-6 pbx-py-4 pbx-whitespace-nowrap pbx-text-sm pbx-font-medium pbx-text-gray-900"},Nie={class:"pbx-min-w-[30rem] pbx-w-max"},Aie={class:"pbx-px-6 pbx-py-4 pbx-whitespace-nowrap pbx-text-sm pbx-text-gray-500"},_ie={class:"pbx-min-w-[30rem] pbx-w-max"},Die={class:"pbx-whitespace-nowrap"},zie={key:2,class:"pbx-settingsSection"},Iie={class:"pbx-settingsSectionTitle"},Vie={class:"pbx-overflow-hidden pbx-shadow-xs md:pbx-rounded-lg pbx-border pbx-border-gray-200"},Hie={class:"pbx-overflow-x-auto"},Rie={class:"pbx-w-max pbx-min-w-full"},Oie={class:"pbx-bg-gray-50"},Fie={scope:"col",class:"pbx-px-6 pbx-py-3 pbx-text-left pbx-text-xs pbx-font-medium pbx-text-gray-500 pbx-uppercase pbx-tracking-wider"},jie={scope:"col",class:"pbx-px-6 pbx-py-3 pbx-text-left pbx-text-xs pbx-font-medium pbx-text-gray-500 pbx-uppercase pbx-tracking-wider"},qie={class:"pbx-bg-white pbx-divide-y pbx-divide-gray-200"},Uie={class:"pbx-px-6 pbx-py-4 pbx-whitespace-nowrap pbx-text-sm pbx-font-medium pbx-text-gray-900"},Wie={class:"pbx-min-w-[30rem] pbx-w-max"},Gie={class:"pbx-px-6 pbx-py-4 pbx-whitespace-nowrap pbx-text-sm pbx-text-gray-500"},Kie={class:"pbx-min-w-[30rem] pbx-w-max"},Jie={key:0},Yie={class:"pbx-px-6 pbx-py-4 pbx-whitespace-nowrap pbx-text-sm pbx-font-medium pbx-text-gray-900"},Qie={class:"pbx-min-w-[30rem] pbx-w-max"},Xie={class:"pbx-px-6 pbx-py-4 pbx-whitespace-nowrap pbx-text-sm pbx-text-gray-500"},Zie={class:"pbx-min-w-[30rem] pbx-w-max"},$ie={class:"pbx-inline-flex pbx-items-center pbx-px-2.5 pbx-py-0.5 pbx-rounded-full pbx-text-xs pbx-font-medium"},ene={key:5,class:"pbx-px-2 pbx-settingsSectionGroup"},tne={key:0,class:"pbx-settingsSection"},rne={class:"pbx-settingsSectionTitle"},one={class:"pbx-overflow-hidden pbx-shadow-xs md:pbx-rounded-lg pbx-border pbx-border-gray-200"},ine={class:"pbx-overflow-x-auto"},nne={class:"pbx-min-w-full"},ane={class:"pbx-bg-gray-50"},lne={scope:"col",class:"pbx-px-6 pbx-py-3 pbx-text-left pbx-text-xs pbx-font-medium pbx-text-gray-500 pbx-uppercase pbx-tracking-wider"},sne={scope:"col",class:"pbx-px-6 pbx-py-3 pbx-text-left pbx-text-xs pbx-font-medium pbx-text-gray-500 pbx-uppercase pbx-tracking-wider"},pne={class:"pbx-bg-white pbx-divide-y pbx-divide-gray-200"},dne={class:"pbx-px-6 pbx-py-4 pbx-whitespace-nowrap pbx-text-sm pbx-font-medium pbx-text-gray-900"},cne={class:"pbx-min-w-[30rem] pbx-w-max"},bne={class:"pbx-px-6 pbx-py-4 pbx-whitespace-nowrap pbx-text-sm pbx-text-gray-500"},mne={class:"pbx-min-w-[30rem] pbx-w-max"},gne={class:"pbx-px-6 pbx-py-4 pbx-whitespace-nowrap pbx-text-sm pbx-text-gray-500"},une={class:"pbx-min-w-[30rem] pbx-w-max"},xne={class:"pbx-px-6 pbx-py-4 pbx-whitespace-nowrap pbx-text-sm pbx-font-medium pbx-text-gray-900"},hne={class:"pbx-min-w-[30rem] pbx-w-max"},fne={key:0,class:"pbx-px-6 pbx-py-4 pbx-whitespace-nowrap pbx-text-sm pbx-text-gray-500"},yne={class:"pbx-min-w-[30rem] pbx-w-max"},wne={class:"pbx-flex pbx-items-center pbx-space-x-3"},vne=["src"],kne={class:"pbx-px-6 pbx-py-4 pbx-whitespace-nowrap pbx-text-sm pbx-font-medium pbx-text-gray-900"},Sne={class:"pbx-min-w-[30rem] pbx-w-max"},Cne={key:0,class:"pbx-px-6 pbx-py-4 pbx-whitespace-nowrap pbx-text-sm pbx-text-gray-500"},Tne={class:"pbx-min-w-[30rem] pbx-w-max"},Ene={key:1,class:"pbx-settingsSection"},Mne={class:"pbx-settingsSectionTitle"},Pne={class:"pbx-overflow-hidden pbx-shadow-xs md:pbx-rounded-lg pbx-border pbx-border-gray-200"},Bne={class:"pbx-overflow-x-auto"},Lne={class:"pbx-min-w-full"},Nne={class:"pbx-bg-gray-50"},Ane={scope:"col",class:"pbx-px-6 pbx-py-3 pbx-text-left pbx-text-xs pbx-font-medium pbx-text-gray-500 pbx-uppercase pbx-tracking-wider"},_ne={scope:"col",class:"pbx-px-6 pbx-py-3 pbx-text-left pbx-text-xs pbx-font-medium pbx-text-gray-500 pbx-uppercase pbx-tracking-wider"},Dne={class:"pbx-bg-white pbx-divide-y pbx-divide-gray-200"},zne={key:0},Ine={class:"pbx-px-6 pbx-py-4 pbx-whitespace-nowrap pbx-text-sm pbx-font-medium pbx-text-gray-900"},Vne={class:"pbx-min-w-[30rem] pbx-w-max"},Hne={class:"pbx-px-6 pbx-py-4 pbx-whitespace-nowrap pbx-text-sm pbx-text-gray-500"},Rne={class:"pbx-min-w-[30rem] pbx-w-max"},One={key:1},Fne={class:"pbx-px-6 pbx-py-4 pbx-whitespace-nowrap pbx-text-sm pbx-font-medium pbx-text-gray-900"},jne={class:"pbx-min-w-[30rem] pbx-w-max"},qne={class:"pbx-px-6 pbx-py-4 pbx-whitespace-nowrap pbx-text-sm pbx-text-gray-500"},Une={class:"pbx-min-w-[30rem] pbx-w-max"},Wne={key:2},Gne={class:"pbx-px-6 pbx-py-4 pbx-whitespace-nowrap pbx-text-sm pbx-font-medium pbx-text-gray-900"},Kne={class:"pbx-min-w-[30rem] pbx-w-max"},Jne={class:"pbx-px-6 pbx-py-4 pbx-whitespace-nowrap pbx-text-sm pbx-text-gray-500"},Yne={class:"pbx-min-w-[30rem] pbx-w-max"},Qne={key:0,class:"pbx-flex pbx-items-left pbx-flex-col pbx-gap-1"},Xne={class:"pbx-myQuaternaryHeader"},Zne={class:"pbx-myPrimaryParagraph pbx-text-xs"},$ne={class:"pbx-settingsSection pbx-whitespace-pre-wrap pbx-text-white pbx-overflow-hidden pbx-bg-gray-900"},eae={class:"pbx-flex bg-gray-800/40 pbx-ring-1 ring-white/5"},tae={class:"pbx-mb-px pbx-flex pbx-text-xs pbx-font-medium pbx-text-myPrimaryMediumGrayColor"},rae={class:"pbx-px-4 pbx-py-4 pbx-text-white"},oae={class:"pbx-px-4 pbx-pb-8 pbx-pt-4 pbx-text-white pbx-text-xs pbx-break-all"},iae={class:"pbx-myPrimaryParagraph pbx-text-xs pbx-text-white"},nae={key:0},aae={class:"pbx-editorFieldGroup"},lae={key:1},sae={class:"pbx-myPrimaryParagraph pbx-mt-6 pbx-text-gray-500"},Hn=o.defineComponent({__name:"PageBuilderSettings",props:{embeddedSection:{}},setup(r){const e=r,{translate:t}=ne(),{showToast:i}=tt(),n=o.computed(()=>!!e.embeddedSection),a=o.computed(()=>["overviewApp","overviewUser","overviewConfig"].includes(e.embeddedSection??"")),l=fe,s=o.computed(()=>l.getPageBuilderConfig),p=o.computed(()=>l.getComponents),d=o.ref("overview");function c(E){d.value=E}const b=o.computed(()=>a.value||!e.embeddedSection&&d.value==="overview"),m=o.computed(()=>b.value&&!a.value),g=o.computed(()=>e.embeddedSection==="overviewApp"||!e.embeddedSection&&d.value==="overview"),x=o.computed(()=>e.embeddedSection==="overviewUser"||!e.embeddedSection&&d.value==="overview"),u=o.computed(()=>e.embeddedSection==="overviewConfig"||!e.embeddedSection&&d.value==="overview"),h=o.computed(()=>e.embeddedSection==="download"||!e.embeddedSection&&d.value==="download"),f=o.computed(()=>e.embeddedSection==="selectedHtml"||!e.embeddedSection&&d.value==="viewHTMLConfig");function w(E,S){const C=`
367
367
  <!DOCTYPE html>
368
368
  <html lang="en">
369
369
  <head>
@@ -402,17 +402,17 @@ This will fail in production.`);s=Pn,s._s.has(i)||(a?Dd(i,e,n,s):tD(i,n,s),proce
402
402
  </div>
403
403
  </body>
404
404
  </html>
405
- `,k=document.createElement("a");k.setAttribute("href","data:text/html;charset=utf-8,"+encodeURIComponent(C)),k.setAttribute("download",E),k.style.display="none",document.body.appendChild(k),k.click(),document.body.removeChild(k)}function y(){const E=document.getElementById("pagebuilder");if(!E)return;let S=Ez(E);const P=document.createElement("div");P.innerHTML=S,P.querySelectorAll("[hovered], [selected]").forEach(v=>{v.removeAttribute("hovered"),v.removeAttribute("selected")}),S=P.innerHTML,w("downloaded_html.html",S),i(t("HTML file downloaded"),"success")}return(E,S)=>{var P,v,M,C,k,T,V,N,A,I,D,q,Y,Q;return o.openBlock(),o.createElementBlock("div",{class:o.normalizeClass(["pbx-w-full",n.value?"pbx-editorEmbeddedSettings":"pbx-inset-x-0 pbx-h-[90vh] pbx-bg-white pbx-overflow-x-scroll lg:pbx-pt-2 pbx-pt-2"])},[n.value?o.createCommentVNode("",!0):(o.openBlock(),o.createElementBlock("div",Poe,[o.createElementVNode("button",{onClick:S[0]||(S[0]=F=>c("overview")),type:"button",class:o.normalizeClass(["pbx-inline-flex pbx-items-center pbx-gap-1 pbx-px-2.5 pbx-py-2 pbx-rounded pbx-text-xs pbx-font-medium pbx-cursor-pointer pbx-border pbx-transition-colors pbx-whitespace-nowrap",d.value==="overview"?"pbx-bg-gray-900 pbx-text-white pbx-border-gray-900":"pbx-bg-white pbx-text-gray-500 pbx-border-gray-200 hover:pbx-bg-gray-50 hover:pbx-text-gray-700"])},[S[3]||(S[3]=o.createElementVNode("span",{class:"material-symbols-outlined",style:{"font-size":"13px"}},"visibility",-1)),o.createElementVNode("span",null,o.toDisplayString(o.unref(t)("Overview")),1)],2),o.createElementVNode("button",{onClick:S[1]||(S[1]=F=>c("download")),type:"button",class:o.normalizeClass(["pbx-inline-flex pbx-items-center pbx-gap-1 pbx-px-2.5 pbx-py-2 pbx-rounded pbx-text-xs pbx-font-medium pbx-cursor-pointer pbx-border pbx-transition-colors pbx-whitespace-nowrap",d.value==="download"?"pbx-bg-gray-900 pbx-text-white pbx-border-gray-900":"pbx-bg-white pbx-text-gray-500 pbx-border-gray-200 hover:pbx-bg-gray-50 hover:pbx-text-gray-700"])},[S[4]||(S[4]=o.createElementVNode("span",{class:"material-symbols-outlined",style:{"font-size":"13px"}},"nest_eco_leaf",-1)),o.createElementVNode("span",null,o.toDisplayString(o.unref(t)("Download HTML")),1)],2),o.createElementVNode("button",{onClick:S[2]||(S[2]=F=>c("viewHTMLConfig")),type:"button",class:o.normalizeClass(["pbx-inline-flex pbx-items-center pbx-gap-1 pbx-px-2.5 pbx-py-2 pbx-rounded pbx-text-xs pbx-font-medium pbx-cursor-pointer pbx-border pbx-transition-colors pbx-whitespace-nowrap",d.value==="viewHTMLConfig"?"pbx-bg-gray-900 pbx-text-white pbx-border-gray-900":"pbx-bg-white pbx-text-gray-500 pbx-border-gray-200 hover:pbx-bg-gray-50 hover:pbx-text-gray-700"])},[S[5]||(S[5]=o.createElementVNode("span",{class:"material-symbols-outlined",style:{"font-size":"13px"}},"deployed_code",-1)),o.createElementVNode("span",null,o.toDisplayString(o.unref(t)("Selected HTML")),1)],2)])),b.value?(o.openBlock(),o.createElementBlock("div",Boe,[m.value?(o.openBlock(),o.createElementBlock("div",Loe,[o.createElementVNode("div",Noe,[o.createElementVNode("h3",Aoe,o.toDisplayString(o.unref(t)("Configuration Overview")),1),o.createElementVNode("p",{class:o.normalizeClass(n.value?"pbx-editorSectionDesc":"pbx-myPrimaryParagraph pbx-text-xs")},o.toDisplayString(o.unref(t)("A summary of current user preferences, application settings, and system metadata including UI theme, language, saved components, and logo configuration.")),3)])])):o.createCommentVNode("",!0),r.embeddedSection==="overviewApp"?(o.openBlock(),o.createElementBlock("p",_oe,o.toDisplayString(o.unref(t)("Application version, resource metadata, logo, and form configuration.")),1)):o.createCommentVNode("",!0),r.embeddedSection==="overviewUser"?(o.openBlock(),o.createElementBlock("p",Doe,o.toDisplayString(o.unref(t)("Current user profile and saved application preferences.")),1)):o.createCommentVNode("",!0),r.embeddedSection==="overviewConfig"?(o.openBlock(),o.createElementBlock("p",zoe,o.toDisplayString(o.unref(t)("Complete configuration object currently used by the Page Builder. Includes user information, branding settings, and other context-specific data needed for rendering and managing the builder environment.")),1)):o.createCommentVNode("",!0),g.value?(o.openBlock(),o.createElementBlock("div",{key:4,class:o.normalizeClass(["pbx-px-2 pbx-settingsSectionGroup",m.value&&!n.value?"pbx-mt-8":""])},[o.createElementVNode("div",Ioe,[o.createElementVNode("h4",Voe,o.toDisplayString(o.unref(t)("Version Information")),1),o.createElementVNode("div",Hoe,[o.createElementVNode("div",Roe,[o.createElementVNode("table",Ooe,[o.createElementVNode("thead",Foe,[o.createElementVNode("tr",null,[o.createElementVNode("th",joe,o.toDisplayString(o.unref(t)("App")),1),o.createElementVNode("th",qoe,o.toDisplayString(o.unref(t)("Version")),1)])]),o.createElementVNode("tbody",Uoe,[o.createElementVNode("tr",null,[o.createElementVNode("td",Woe,[o.createElementVNode("div",Goe,o.toDisplayString(o.unref(t)("Page Builder")),1)]),o.createElementVNode("td",Koe,[o.createElementVNode("div",Joe,[o.createElementVNode("span",Yoe,o.toDisplayString(o.unref(Tre)),1)])])])])])])])]),(P=s.value)!=null&&P.resourceData&&!o.unref(no)(s.value.resourceData)?(o.openBlock(),o.createElementBlock("div",Qoe,[o.createElementVNode("h4",Xoe,o.toDisplayString(o.unref(t)("Resource Data")),1),o.createElementVNode("div",Zoe,[o.createElementVNode("div",$oe,[o.createElementVNode("table",eie,[o.createElementVNode("thead",tie,[o.createElementVNode("tr",null,[o.createElementVNode("th",rie,o.toDisplayString(o.unref(t)("Property")),1),o.createElementVNode("th",oie,o.toDisplayString(o.unref(t)("Value")),1)])]),o.createElementVNode("tbody",iie,[(M=(v=s.value)==null?void 0:v.resourceData)!=null&&M.title?(o.openBlock(),o.createElementBlock("tr",nie,[o.createElementVNode("td",aie,[o.createElementVNode("div",lie,o.toDisplayString(o.unref(t)("Title")),1)]),o.createElementVNode("td",sie,[o.createElementVNode("div",pie,o.toDisplayString(s.value.resourceData.title),1)])])):o.createCommentVNode("",!0),(k=(C=s.value)==null?void 0:C.resourceData)!=null&&k.id?(o.openBlock(),o.createElementBlock("tr",die,[o.createElementVNode("td",cie,[o.createElementVNode("div",bie,o.toDisplayString(o.unref(t)("ID")),1)]),o.createElementVNode("td",mie,[o.createElementVNode("div",gie,o.toDisplayString(s.value.resourceData.id),1)])])):o.createCommentVNode("",!0)])])])])])):o.createCommentVNode("",!0),s.value&&s.value.pageBuilderLogo&&!o.unref(no)(s.value.pageBuilderLogo)?(o.openBlock(),o.createElementBlock("div",uie,[o.createElementVNode("h4",xie,o.toDisplayString(o.unref(t)("Logo Configuration")),1),o.createElementVNode("div",hie,[o.createElementVNode("div",fie,[o.createElementVNode("table",yie,[o.createElementVNode("thead",wie,[o.createElementVNode("tr",null,[o.createElementVNode("th",vie,o.toDisplayString(o.unref(t)("Property")),1),o.createElementVNode("th",kie,o.toDisplayString(o.unref(t)("Value")),1)])]),o.createElementVNode("tbody",Sie,[o.createElementVNode("tr",null,[o.createElementVNode("td",Cie,[o.createElementVNode("div",Tie,o.toDisplayString(o.unref(t)("Logo")),1)]),o.createElementVNode("td",Eie,[o.createElementVNode("div",Mie,[o.createElementVNode("div",Pie,[o.createElementVNode("img",{class:"pbx-h-4",src:s.value.pageBuilderLogo.src,alt:"Logo"},null,8,Bie)])])])]),o.createElementVNode("tr",null,[o.createElementVNode("td",Lie,[o.createElementVNode("div",Nie,o.toDisplayString(o.unref(t)("Logo URL")),1)]),o.createElementVNode("td",Aie,[o.createElementVNode("div",_ie,[o.createElementVNode("span",Die,o.toDisplayString(s.value.pageBuilderLogo.src),1)])])])])])])])])):o.createCommentVNode("",!0),(T=s.value)!=null&&T.updateOrCreate&&!o.unref(no)(s.value.updateOrCreate)?(o.openBlock(),o.createElementBlock("div",zie,[o.createElementVNode("h4",Iie,o.toDisplayString(o.unref(t)("Form Type")),1),o.createElementVNode("div",Vie,[o.createElementVNode("div",Hie,[o.createElementVNode("table",Rie,[o.createElementVNode("thead",Oie,[o.createElementVNode("tr",null,[o.createElementVNode("th",Fie,o.toDisplayString(o.unref(t)("Mode")),1),o.createElementVNode("th",jie,o.toDisplayString(o.unref(t)("Description")),1)])]),o.createElementVNode("tbody",qie,[o.createElementVNode("tr",null,[o.createElementVNode("td",Uie,[o.createElementVNode("div",Wie,o.toDisplayString(o.unref(t)("Form Type")),1)]),o.createElementVNode("td",Gie,[o.createElementVNode("div",Kie,[o.createElementVNode("span",{class:o.normalizeClass(["pbx-inline-flex pbx-items-center pbx-px-2.5 pbx-py-0.5 pbx-rounded-full pbx-text-xs pbx-font-medium",s.value.updateOrCreate.formType==="create"?"pbx-bg-green-100 pbx-text-green-800":"pbx-bg-blue-100 pbx-text-blue-800"])},o.toDisplayString(s.value.updateOrCreate.formType),3)])])]),s.value.updateOrCreate.formName&&s.value.updateOrCreate.formName.length>0?(o.openBlock(),o.createElementBlock("tr",Jie,[o.createElementVNode("td",Yie,[o.createElementVNode("div",Qie,o.toDisplayString(o.unref(t)("Form Name")),1)]),o.createElementVNode("td",Xie,[o.createElementVNode("div",Zie,[o.createElementVNode("span",$ie,o.toDisplayString(s.value.updateOrCreate.formName),1)])])])):o.createCommentVNode("",!0)])])])])])):o.createCommentVNode("",!0)],2)):o.createCommentVNode("",!0),x.value?(o.openBlock(),o.createElementBlock("div",ene,[(V=s.value)!=null&&V.userForPageBuilder&&!o.unref(no)(s.value.userForPageBuilder)?(o.openBlock(),o.createElementBlock("div",tne,[o.createElementVNode("h4",rne,o.toDisplayString(o.unref(t)("User Information")),1),o.createElementVNode("div",one,[o.createElementVNode("div",ine,[o.createElementVNode("table",nne,[o.createElementVNode("thead",ane,[o.createElementVNode("tr",null,[o.createElementVNode("th",lne,o.toDisplayString(o.unref(t)("Property")),1),o.createElementVNode("th",sne,o.toDisplayString(o.unref(t)("Value")),1)])]),o.createElementVNode("tbody",pne,[o.createElementVNode("tr",null,[o.createElementVNode("td",dne,[o.createElementVNode("div",cne,o.toDisplayString(o.unref(t)("User Name")),1)]),o.createElementVNode("td",bne,[o.createElementVNode("div",mne,o.toDisplayString(s.value.userForPageBuilder.name),1)])]),o.createElementVNode("tr",null,[S[6]||(S[6]=o.createElementVNode("td",{class:"pbx-px-6 pbx-py-4 pbx-whitespace-nowrap pbx-text-sm pbx-font-medium pbx-text-gray-900"},[o.createElementVNode("div",{class:"pbx-min-w-[30rem] pbx-w-max"},"ID")],-1)),o.createElementVNode("td",gne,[o.createElementVNode("div",une,o.toDisplayString(s.value.userForPageBuilder.id),1)])]),o.createElementVNode("tr",null,[o.createElementVNode("td",xne,[o.createElementVNode("div",hne,o.toDisplayString(o.unref(t)("Image")),1)]),s.value.userForPageBuilder.image&&typeof s.value.userForPageBuilder.image=="string"&&s.value.userForPageBuilder.image.length>2?(o.openBlock(),o.createElementBlock("td",fne,[o.createElementVNode("div",yne,[o.createElementVNode("div",wne,[o.createElementVNode("img",{class:"pbx-block pbx-inset-0 pbx-object-top pbx-h-10 pbx-min-h-10 pbx-max-h-10 pbx-w-10 pbx-min-w-10 pbx-max-w-10 pbx-object-cover pbx-rounded-full",src:s.value.userForPageBuilder.image,alt:"image"},null,8,vne)])])])):o.createCommentVNode("",!0)]),o.createElementVNode("tr",null,[o.createElementVNode("td",kne,[o.createElementVNode("div",Sne,o.toDisplayString(o.unref(t)("Image URL")),1)]),s.value.userForPageBuilder.image&&typeof s.value.userForPageBuilder.image=="string"&&s.value.userForPageBuilder.image.length>2?(o.openBlock(),o.createElementBlock("td",Cne,[o.createElementVNode("div",Tne,o.toDisplayString(s.value.userForPageBuilder.image),1)])):o.createCommentVNode("",!0)])])])])])])):o.createCommentVNode("",!0),(N=s.value)!=null&&N.userSettings&&!o.unref(no)(s.value.userSettings)?(o.openBlock(),o.createElementBlock("div",Ene,[o.createElementVNode("h4",Mne,o.toDisplayString(o.unref(t)("User Settings")),1),o.createElementVNode("div",Pne,[o.createElementVNode("div",Bne,[o.createElementVNode("table",Lne,[o.createElementVNode("thead",Nne,[o.createElementVNode("tr",null,[o.createElementVNode("th",Ane,o.toDisplayString(o.unref(t)("Setting")),1),o.createElementVNode("th",_ne,o.toDisplayString(o.unref(t)("Value")),1)])]),o.createElementVNode("tbody",Dne,[(I=(A=s.value)==null?void 0:A.userSettings)!=null&&I.language?(o.openBlock(),o.createElementBlock("tr",zne,[o.createElementVNode("td",Ine,[o.createElementVNode("div",Vne,o.toDisplayString(o.unref(t)("Language")),1)]),o.createElementVNode("td",Hne,[o.createElementVNode("div",Rne,o.toDisplayString(s.value.userSettings.language),1)])])):o.createCommentVNode("",!0),((q=(D=s.value)==null?void 0:D.userSettings)==null?void 0:q.autoSave)!==void 0?(o.openBlock(),o.createElementBlock("tr",One,[o.createElementVNode("td",Fne,[o.createElementVNode("div",jne,o.toDisplayString(o.unref(t)("Auto Save")),1)]),o.createElementVNode("td",qne,[o.createElementVNode("div",Une,[o.createElementVNode("span",{class:o.normalizeClass(["pbx-inline-flex pbx-items-center pbx-px-2.5 pbx-py-0.5 pbx-rounded-full pbx-text-xs pbx-font-medium",s.value.userSettings.autoSave?"pbx-bg-green-100 pbx-text-green-800":"pbx-bg-red-100 pbx-text-red-800"])},o.toDisplayString(s.value.userSettings.autoSave?o.unref(t)("Enabled"):o.unref(t)("Disabled")),3)])])])):o.createCommentVNode("",!0),((Q=(Y=s.value)==null?void 0:Y.userSettings)==null?void 0:Q.notifications)!==void 0?(o.openBlock(),o.createElementBlock("tr",Wne,[o.createElementVNode("td",Gne,[o.createElementVNode("div",Kne,o.toDisplayString(o.unref(t)("Notifications")),1)]),o.createElementVNode("td",Jne,[o.createElementVNode("div",Yne,[o.createElementVNode("span",{class:o.normalizeClass(["pbx-inline-flex pbx-items-center pbx-px-2.5 pbx-py-0.5 pbx-rounded-full pbx-text-xs pbx-font-medium",s.value.userSettings.notifications?"pbx-bg-green-100 pbx-text-green-800":"pbx-bg-red-100 pbx-text-red-800"])},o.toDisplayString(s.value.userSettings.notifications?o.unref(t)("Enabled"):o.unref(t)("Disabled")),3)])])])):o.createCommentVNode("",!0)])])])])])):o.createCommentVNode("",!0)])):o.createCommentVNode("",!0),u.value?(o.openBlock(),o.createElementBlock("div",{key:6,class:o.normalizeClass(["pbx-settingsSectionGroup",m.value?"pbx-mt-12":""])},[m.value?(o.openBlock(),o.createElementBlock("div",Qne,[o.createElementVNode("h3",Xne,o.toDisplayString(o.unref(t)("Complete Configuration Overview")),1),o.createElementVNode("p",Zne,o.toDisplayString(o.unref(t)("Complete configuration object currently used by the Page Builder. Includes user information, branding settings, and other context-specific data needed for rendering and managing the builder environment.")),1)])):o.createCommentVNode("",!0),o.createElementVNode("div",$ne,[o.createElementVNode("div",eae,[o.createElementVNode("div",tae,[o.createElementVNode("div",rae,o.toDisplayString(o.unref(t)("Configuration")),1)])]),o.createElementVNode("div",oae,[o.createElementVNode("p",iae," config: "+o.toDisplayString(JSON.stringify(s.value,null,4)),1)])])],2)):o.createCommentVNode("",!0)])):o.createCommentVNode("",!0),h.value?(o.openBlock(),o.createElementBlock("div",{key:2,class:o.normalizeClass(n.value?"":"pbx-min-h-screen pbx-mt-4")},[Array.isArray(p.value)&&p.value.length>=1?(o.openBlock(),o.createElementBlock("div",nae,[o.createElementVNode("p",{class:o.normalizeClass(["pbx-editorSectionDesc",n.value?"":"pbx-mb-10"])},o.toDisplayString(o.unref(t)("Export the entire page as a standalone HTML file. This includes all sections, content, and applied styles, making it ready for use or integration elsewhere.")),3),o.createElementVNode("div",aae,[o.createElementVNode("button",{onClick:y,type:"button",class:"pbx-myPrimaryButton"},[o.createElementVNode("span",null,o.toDisplayString(o.unref(t)("Download HTML file")),1)])])])):(o.openBlock(),o.createElementBlock("div",lae,[o.createElementVNode("p",sae,o.toDisplayString(o.unref(t)("No components added yet. Add components to the page to enable HTML download.")),1)]))],2)):o.createCommentVNode("",!0),f.value?(o.openBlock(),o.createElementBlock("div",{key:3,class:o.normalizeClass(n.value?"":"pbx-min-h-screen pbx-mt-4")},[o.createVNode(Moe)],2)):o.createCommentVNode("",!0)],2)}}}),pae={class:"pbx-flex pbx-flex-col pbx-gap-2"},dae=o.defineComponent({__name:"OverviewSettingsSection",setup(r){const{translate:e}=ne();return(t,i)=>(o.openBlock(),o.createElementBlock("div",pae,[o.createVNode(Re,null,{title:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(o.unref(e)("App & Resource")),1)]),content:o.withCtx(()=>[o.createVNode(Hn,{"embedded-section":"overviewApp"})]),_:1}),o.createVNode(Re,null,{title:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(o.unref(e)("User & Settings")),1)]),content:o.withCtx(()=>[o.createVNode(Hn,{"embedded-section":"overviewUser"})]),_:1}),o.createVNode(Re,null,{title:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(o.unref(e)("Full Configuration")),1)]),content:o.withCtx(()=>[o.createVNode(Hn,{"embedded-section":"overviewConfig"})]),_:1})]))}}),cae=o.defineComponent({__name:"DownloadHtmlSettingsSection",setup(r){const{translate:e}=ne();return(t,i)=>(o.openBlock(),o.createBlock(Re,null,{title:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(o.unref(e)("Download HTML")),1)]),content:o.withCtx(()=>[o.createVNode(Hn,{"embedded-section":"download"})]),_:1}))}}),bae=o.defineComponent({__name:"SelectedHtmlSettingsSection",setup(r){const{translate:e}=ne();return(t,i)=>(o.openBlock(),o.createBlock(Re,null,{title:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(o.unref(e)("Selected HTML")),1)]),content:o.withCtx(()=>[o.createVNode(Hn,{"embedded-section":"selectedHtml"})]),_:1}))}}),mae={class:"pbx-myPrimaryParagraph pbx-font-medium pbx-pt-6"},gae={class:"pbx-my-2 pbx-py-2"},uae={for:"font-desktop",class:"pbx-myPrimaryInputLabel"},xae={disabled:"",value:""},hae={class:"pbx-my-2 pbx-py-2"},fae={for:"font-weight",class:"pbx-myPrimaryInputLabel"},yae={disabled:"",value:""},wae={class:"pbx-my-2 pbx-py-2"},vae={for:"font-family",class:"pbx-myPrimaryInputLabel"},kae={value:null},Sae=["value"],Cae={key:0,class:"pbx-mt-2 pbx-mb-0 pbx-text-xs pbx-text-gray-500"},Tae={class:"pbx-my-2 pbx-py-2"},Eae={for:"font-style",class:"pbx-myPrimaryInputLabel"},Mae={disabled:"",value:""},Pae=o.defineComponent({__name:"TypographyControl",setup(r){const{translate:e}=ne(),t=ke(),i=fe,n=o.ref(null),a=o.ref(null),l=o.ref(null),s=o.ref(null),p=o.ref(null),d=o.ref(null),c=o.ref(""),b=o.ref(null),m=o.computed(()=>i.getElement),g=o.computed(()=>i.getFontBase),x=o.computed(()=>i.getFontDesktop),u=o.computed(()=>i.getFontTablet),h=o.computed(()=>i.getFontMobile),f=o.computed(()=>i.getFontWeight),w=o.computed(()=>i.getFontFamily),y=o.computed(()=>i.getFontStyle),E=o.computed(()=>i.getPageBuilderConfig),S=o.computed(()=>{var C;return mD((C=E.value)==null?void 0:C.userSettings)}),P=o.computed(()=>!!(d.value&&d.value!=="none")),v=function(){t.handleFontFamily(d.value==null?"none":d.value)},M=async()=>{if(await o.nextTick(),!(m.value instanceof HTMLElement)){c.value="";return}c.value=fD(m.value,E.value,{globalPageDesignMode:i.getToggleGlobalHtmlMode,selectedFontClass:i.getFontFamily})};return o.watch(g,async C=>{n.value=C,await t.initializeElementStyles()},{immediate:!0}),o.watch(x,async C=>{a.value=C,await t.initializeElementStyles()},{immediate:!0}),o.watch(u,async C=>{l.value=C,await t.initializeElementStyles()},{immediate:!0}),o.watch(h,async C=>{s.value=C,await t.initializeElementStyles()},{immediate:!0}),o.watch(f,async C=>{p.value=C,await t.initializeElementStyles()},{immediate:!0}),o.watch(w,async C=>{d.value=!C||C==="none"?null:C,await M(),await t.initializeElementStyles()},{immediate:!0}),o.watch(m,M,{immediate:!0,flush:"post"}),o.watch(y,async C=>{b.value=C,await t.initializeElementStyles()},{immediate:!0}),(C,k)=>(o.openBlock(),o.createBlock(Re,null,{title:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(o.unref(e)("Typographies")),1)]),content:o.withCtx(()=>[o.createElementVNode("p",mae,o.toDisplayString(o.unref(e)("Font Appearance")),1),o.createCommentVNode("",!0),o.createElementVNode("div",gae,[o.createElementVNode("label",uae,o.toDisplayString(o.unref(e)("Font size")),1),o.withDirectives(o.createElementVNode("select",{id:"font-desktop","onUpdate:modelValue":k[2]||(k[2]=T=>a.value=T),class:"pbx-myPrimarySelect",onChange:k[3]||(k[3]=T=>o.unref(t).handleFontSizeDesktop(a.value??void 0))},[o.createElementVNode("option",xae,o.toDisplayString(o.unref(e)("Select")),1),(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(o.unref(vi).fontDesktop,T=>(o.openBlock(),o.createElementBlock("option",{key:T},o.toDisplayString(T),1))),128))],544),[[o.vModelSelect,a.value]])]),o.createCommentVNode("",!0),k[13]||(k[13]=o.createElementVNode("hr",null,null,-1)),o.createElementVNode("div",hae,[o.createElementVNode("label",fae,o.toDisplayString(o.unref(e)("Font weight")),1),o.withDirectives(o.createElementVNode("select",{id:"font-weight","onUpdate:modelValue":k[8]||(k[8]=T=>p.value=T),class:"pbx-myPrimarySelect",onChange:k[9]||(k[9]=T=>o.unref(t).handleFontWeight(p.value??void 0))},[o.createElementVNode("option",yae,o.toDisplayString(o.unref(e)("Select")),1),(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(o.unref(lr).fontWeight,T=>(o.openBlock(),o.createElementBlock("option",{key:T},o.toDisplayString(T),1))),128))],544),[[o.vModelSelect,p.value]])]),k[14]||(k[14]=o.createElementVNode("hr",null,null,-1)),o.createElementVNode("div",wae,[o.createElementVNode("label",vae,o.toDisplayString(o.unref(e)("Font family")),1),o.withDirectives(o.createElementVNode("select",{id:"font-family","onUpdate:modelValue":k[10]||(k[10]=T=>d.value=T),class:"pbx-myPrimarySelect",onChange:v},[o.createElementVNode("option",kae,o.toDisplayString(o.unref(e)("No font family")),1),(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(S.value.filter(T=>T.value!=="none"),T=>(o.openBlock(),o.createElementBlock("option",{key:T.value,value:T.value},o.toDisplayString(T.label),9,Sae))),128))],544),[[o.vModelSelect,d.value]]),!P.value&&c.value?(o.openBlock(),o.createElementBlock("p",Cae,o.toDisplayString(o.unref(e)("Inherited"))+": "+o.toDisplayString(c.value),1)):o.createCommentVNode("",!0)]),k[15]||(k[15]=o.createElementVNode("hr",null,null,-1)),o.createElementVNode("div",Tae,[o.createElementVNode("label",Eae,o.toDisplayString(o.unref(e)("Font Style")),1),o.withDirectives(o.createElementVNode("select",{id:"font-style","onUpdate:modelValue":k[11]||(k[11]=T=>b.value=T),class:"pbx-myPrimarySelect",onChange:k[12]||(k[12]=T=>o.unref(t).handleFontStyle(b.value??void 0))},[o.createElementVNode("option",Mae,o.toDisplayString(o.unref(e)("Select")),1),(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(o.unref(lr).fontStyle,T=>(o.openBlock(),o.createElementBlock("option",{key:T},o.toDisplayString(T),1))),128))],544),[[o.vModelSelect,b.value]])])]),_:1}))}}),Bae={class:"pbx-pageDesignEditor pbx-min-h-[60rem]"},Lae={key:0,class:"pbx-pageDesignLoading pbx-flex pbx-items-start pbx-justify-center pbx-pt-12 pbx-min-h-[20rem]"},Nae={key:1},Aae={class:"pbx-editorSectionDesc pbx-pageDesignIntro"},_ae={class:"pbx-pageDesignSection"},Dae={class:"pbx-pageDesignSectionTitle"},zae={class:"pbx-pageDesignCard"},Iae={class:"pbx-pageDesignToggleRow"},Vae={class:"pbx-pageDesignToggleCopy"},Hae={class:"pbx-pageDesignToggleLabel"},Rae={class:"pbx-pageDesignToggleHint"},Oae={class:"pbx-pageDesignSection"},Fae={class:"pbx-pageDesignCard pbx-pageDesignCardWide"},jae={class:"pbx-pageDesignSection"},qae={class:"pbx-pageDesignSectionTitle"},Uae={class:"pbx-pageDesignGrid"},Wae={class:"pbx-pageDesignCard"},Gae={class:"pbx-pageDesignCardLabel pbx-px-2"},Kae={class:"pbx-pageDesignCard"},Jae={class:"pbx-pageDesignCardLabel pbx-px-2"},Yae={class:"pbx-pageDesignSection"},Qae={class:"pbx-pageDesignSectionTitle"},Xae={class:"pbx-pageDesignGrid"},Zae={class:"pbx-pageDesignCard"},$ae={class:"pbx-pageDesignCard"},ele={class:"pbx-pageDesignSection"},tle={class:"pbx-pageDesignSectionTitle"},rle={class:"pbx-pageDesignGrid"},ole={class:"pbx-pageDesignCard"},ile={class:"pbx-pageDesignCard"},nle={class:"pbx-pageDesignSection"},ale={class:"pbx-pageDesignSectionTitle"},lle={class:"pbx-pageDesignGrid"},sle={class:"pbx-pageDesignCard"},ple={class:"pbx-pageDesignCard"},dle=o.defineComponent({name:"PageDesignEditor",__name:"PageDesignEditor",props:{isLoading:{type:Boolean,required:!0,default:!0}},setup(r){const{translate:e}=ne(),t=ke(),i=o.ref(0),n=o.computed(()=>(i.value,t.isGlobalFullWidth())),a=async l=>{const s=t.setGlobalFullWidth(l);i.value++,await s};return(l,s)=>(o.openBlock(),o.createElementBlock("div",Bae,[r.isLoading?(o.openBlock(),o.createElementBlock("div",Lae,[...s[0]||(s[0]=[o.createElementVNode("div",{class:"pbx-inline-block pbx-h-8 pbx-w-8 pbx-animate-spin pbx-rounded-full pbx-border-4 pbx-border-solid pbx-border-current pbx-border-r-transparent",role:"status"},null,-1)])])):o.createCommentVNode("",!0),r.isLoading?o.createCommentVNode("",!0):(o.openBlock(),o.createElementBlock("div",Nae,[o.createElementVNode("p",Aae,o.toDisplayString(o.unref(e)("Apply styles that affect the entire page. These settings include global font family, text color, background color, and other universal styles that apply to all sections.")),1),o.createElementVNode("section",_ae,[o.createElementVNode("h4",Dae,o.toDisplayString(o.unref(e)("Layout")),1),o.createElementVNode("div",zae,[o.createElementVNode("div",Iae,[o.createElementVNode("div",Vae,[o.createElementVNode("p",Hae,o.toDisplayString(o.unref(e)("Full-width page")),1),o.createElementVNode("p",Rae,o.toDisplayString(o.unref(e)("Stretch all sections across browser width")),1)]),o.createVNode(Jt,{"model-value":n.value,"onUpdate:modelValue":a},null,8,["model-value"])])])]),o.createElementVNode("section",Oae,[o.createElementVNode("div",Fae,[o.createVNode(Pae)])]),o.createElementVNode("section",jae,[o.createElementVNode("h4",qae,o.toDisplayString(o.unref(e)("Colors")),1),o.createElementVNode("div",Uae,[o.createElementVNode("div",Wae,[o.createElementVNode("p",Gae,o.toDisplayString(o.unref(e)("Text Color")),1),o.createVNode(ZD,{globalPageLayout:!0})]),o.createElementVNode("div",Kae,[o.createElementVNode("p",Jae,o.toDisplayString(o.unref(e)("Background Color")),1),o.createVNode($D,{globalPageLayout:!0})])])]),o.createElementVNode("section",Yae,[o.createElementVNode("h4",Qae,o.toDisplayString(o.unref(e)("Spacing")),1),o.createElementVNode("div",Xae,[o.createElementVNode("div",Zae,[o.createVNode(vz)]),o.createElementVNode("div",$ae,[o.createVNode(kz)])])]),o.createElementVNode("section",ele,[o.createElementVNode("h4",tle,o.toDisplayString(o.unref(e)("Borders")),1),o.createElementVNode("div",rle,[o.createElementVNode("div",ole,[o.createVNode(Sz)]),o.createElementVNode("div",ile,[o.createVNode(Cz)])])]),o.createElementVNode("section",nle,[o.createElementVNode("h4",ale,o.toDisplayString(o.unref(e)("Advanced")),1),o.createElementVNode("div",lle,[o.createElementVNode("div",sle,[o.createVNode(bz)]),o.createElementVNode("div",ple,[o.createVNode(mz)])])])]))]))}}),cle={class:"pbx-flex pbx-h-full pbx-flex-col"},ble={class:"pbx-flex pbx-flex-row pbx-justify-between pbx-pt-7 pbx-pr-4 pbx-pl-4 pbx-items-center pbx-mb-3"},mle=["aria-label"],gle={class:"pbx-font-medium pbx-text-sm"},ule={class:"pbx-lowercase"},xle={class:"pbx-px-4 pbx-mb-3"},hle=["aria-label"],fle=["aria-selected"],yle=["aria-selected"],wle=["aria-selected"],vle={class:"pbx-flex pbx-flex-col pbx-gap-2"},kle={key:0,class:"pbx-flex pbx-flex-col pbx-gap-2"},Sle={key:1,class:"pbx-rounded-xl pbx-border pbx-border-solid pbx-border-gray-200 pbx-bg-white pbx-px-4 pbx-py-8 pbx-text-center"},Cle={class:"pbx-myPrimaryParagraph pbx-text-sm pbx-text-gray-500 pbx-my-0"},Tle={class:"pbx-flex pbx-flex-col pbx-gap-2"},Ele={class:"pbx-flex pbx-flex-col pbx-gap-2"},Mle=o.defineComponent({__name:"RightSidebarEditor",emits:["closeEditor"],setup(r){const{translate:e}=ne(),{showToast:t}=tt(),i=ke(),n=fe,a=o.ref("styles"),l=o.computed(()=>n.getElement),s=o.computed(()=>{var w;return(w=l.value)==null?void 0:w.tagName}),p=o.computed(()=>{const w=l.value;return!!(w&&i.isEditableElement(w))}),d=o.computed(()=>{const w=l.value;return w?w.tagName==="IMG"||!!n.getBasePrimaryImage:!1}),c=o.ref(null);let b=0;o.watch(()=>n.getElement,w=>{(w==null?void 0:w.tagName)==="IMG"&&(a.value="styles"),o.nextTick(()=>{c.value&&(c.value.scrollTop=b)})});function m(){c.value&&(b=c.value.scrollTop)}function g(w){a.value=w,o.nextTick(()=>{c.value&&(c.value.scrollTop=0,b=0)})}const x=o.ref(!1),u=o.ref(!1),h=async function(){x.value=!0,u.value=!0,await je(200),n.setToggleGlobalHtmlMode(!0),await i.globalPageStyles(),u.value=!1},f=async function(){u.value=!0,await je(200);try{await i.handleManualSave(),t(e("Page saved successfully"),"success")}catch{t(e("Could not save page"),"error")}i.stopGlobalStylesSync();const w=document.querySelector("[data-pagebuilder-content]");w&&w.removeAttribute("data-global-selected"),x.value=!1,u.value=!1};return(w,y)=>(o.openBlock(),o.createElementBlock(o.Fragment,null,[o.createElementVNode("div",cle,[o.createElementVNode("div",ble,[o.createElementVNode("button",{type:"button",onClick:y[0]||(y[0]=E=>w.$emit("closeEditor")),"aria-label":o.unref(e)("Close properties panel"),class:"pbx-h-10 pbx-w-10 pbx-cursor-pointer pbx-rounded-full pbx-flex pbx-items-center pbx-border-none pbx-justify-center pbx-bg-gray-50 pbx-aspect-square hover:pbx-bg-myPrimaryLinkColor hover:pbx-text-white focus-visible:pbx-ring-0 pbx-text-black hover:pbx-text-white"},[...y[4]||(y[4]=[o.createElementVNode("span",{class:"material-symbols-outlined","aria-hidden":"true"}," close ",-1)])],8,mle),o.createElementVNode("p",gle,[p.value?(o.openBlock(),o.createElementBlock(o.Fragment,{key:0},[o.createTextVNode(o.toDisplayString(o.unref(e)("Editing"))+" ",1),o.createElementVNode("span",ule,"<"+o.toDisplayString(s.value)+">",1)],64)):(o.openBlock(),o.createElementBlock(o.Fragment,{key:1},[o.createTextVNode(o.toDisplayString(o.unref(e)("Properties")),1)],64))])]),o.createElementVNode("div",xle,[o.createElementVNode("div",{class:"pbx-grid pbx-grid-cols-3 pbx-gap-1 pbx-rounded-xl pbx-border pbx-border-solid pbx-border-gray-200 pbx-bg-white pbx-p-1",role:"tablist","aria-label":o.unref(e)("Properties panel")},[o.createElementVNode("button",{type:"button",role:"tab","aria-selected":a.value==="styles",class:o.normalizeClass(["pbx-rounded-lg pbx-py-2 pbx-text-sm pbx-font-medium pbx-transition-colors pbx-border-0 pbx-cursor-pointer pbx-font-sans",a.value==="styles"?"pbx-bg-myPrimaryLinkColor pbx-text-white pbx-shadow-sm":"pbx-bg-transparent pbx-text-myPrimaryDarkGrayColor hover:pbx-bg-gray-50"]),onClick:y[1]||(y[1]=E=>g("styles"))},o.toDisplayString(o.unref(e)("Styles")),11,fle),o.createElementVNode("button",{type:"button",role:"tab","aria-selected":a.value==="settings",class:o.normalizeClass(["pbx-rounded-lg pbx-py-2 pbx-text-sm pbx-font-medium pbx-transition-colors pbx-border-0 pbx-cursor-pointer pbx-font-sans",a.value==="settings"?"pbx-bg-myPrimaryLinkColor pbx-text-white pbx-shadow-sm":"pbx-bg-transparent pbx-text-myPrimaryDarkGrayColor hover:pbx-bg-gray-50"]),onClick:y[2]||(y[2]=E=>g("settings"))},o.toDisplayString(o.unref(e)("Settings")),11,yle),o.createElementVNode("button",{type:"button",role:"tab","aria-selected":a.value==="tools",class:o.normalizeClass(["pbx-rounded-lg pbx-py-2 pbx-text-sm pbx-font-medium pbx-transition-colors pbx-border-0 pbx-cursor-pointer pbx-font-sans",a.value==="tools"?"pbx-bg-myPrimaryLinkColor pbx-text-white pbx-shadow-sm":"pbx-bg-transparent pbx-text-myPrimaryDarkGrayColor hover:pbx-bg-gray-50"]),onClick:y[3]||(y[3]=E=>g("tools"))},o.toDisplayString(o.unref(e)("Tools")),11,wle)],8,hle)]),o.createElementVNode("div",{ref_key:"scrollContainer",ref:c,onScroll:m,class:"pbx-pl-3 pbx-pr-3 pbx-mb-4 pbx-flex-1 pbx-overflow-y-scroll"},[o.withDirectives(o.createElementVNode("div",vle,[p.value?(o.openBlock(),o.createElementBlock("div",kle,[d.value?(o.openBlock(),o.createBlock(iee,{key:0})):o.createCommentVNode("",!0),o.createVNode(Tee),o.createVNode(vz),o.createVNode(kz),o.createVNode(Sz),o.createVNode(Cz),o.createVNode(bz),o.createVNode(mz),o.createVNode(X$)])):(o.openBlock(),o.createElementBlock("div",Sle,[o.createElementVNode("p",Cle,o.toDisplayString(o.unref(e)("No Element selected")),1)]))],512),[[o.vShow,a.value==="styles"]]),o.withDirectives(o.createElementVNode("div",Tle,[o.createVNode(vre,{onOpen:h}),o.createVNode(_te),o.createVNode(Ute),o.createVNode(cre),o.createVNode(Cre),o.createVNode(xre)],512),[[o.vShow,a.value==="settings"]]),o.withDirectives(o.createElementVNode("div",Ele,[o.createVNode(dae),o.createVNode(cae),o.createVNode(bae)],512),[[o.vShow,a.value==="tools"]])],544)]),o.createVNode(At,{maxWidth:"5xl",showModalBuilder:x.value,title:o.unref(e)("Page Design"),onCloseMainModalBuilder:f,minHeight:"",maxHeight:""},{default:o.withCtx(()=>[o.createVNode(dle,{isLoading:u.value},null,8,["isLoading"])]),_:1},8,["showModalBuilder","title"])],64))}}),Ple={class:"pbx-flex pbx-items-center pbx-justify-center pbx-ml-2"},Ble={class:"pbx-mr-2"},Lle={key:0,class:"pbx-flex pbx-items-center pbx-myPrimaryTag pbx-whitespace-nowrap pbx-py-0 pbx-gap-2"},Nle={class:"pbx-text-white pbx-rounded-full pbx-bg-myPrimaryBrandColor pbx-flex pbx-justify-center pbx-items-center pbx-text-xs pbx-d pbx-min-d pbx-max-d lg:pbx-w-8 lg:pbx-h-8 lg:pbx-min-w-8 lg:pbx-max-w-8 pbx-w-8 pbx-h-8 pbx-min-w-8 pbx-max-w-8 pbx-font-normal"},Ale={key:1,class:"pbx-flex pbx-items-center lg:pbx-myPrimaryTag pbx-whitespace-nowrap pbx-py-0 pbx-gap-4 pbx-w-max pbx-h-12 pbx-ml-2"},_le={class:"pbx-text-white pbx-flex-shrink-0 pbx-d pbx-w-10 pbx-h-10 pbx-rounded-full pbx-flex pbx-justify-center pbx-items-center pbx-text-xs pbx-rounded-l-full"},Dle=["src"],zle=o.defineComponent({__name:"ToolbarOption",setup(r){const e=fe,t=o.computed(()=>e.getPageBuilderConfig);return(i,n)=>{var a;return o.openBlock(),o.createElementBlock("div",null,[o.createElementVNode("div",Ple,[o.createElementVNode("div",Ble,[t.value&&t.value.userForPageBuilder&&t.value.userForPageBuilder.name&&(!t.value.userForPageBuilder.image||typeof t.value.userForPageBuilder.image=="string"&&((a=t.value.userForPageBuilder.image)==null?void 0:a.length)<2)?(o.openBlock(),o.createElementBlock("div",Lle,[o.createElementVNode("div",Nle,o.toDisplayString(typeof t.value.userForPageBuilder.name=="string"&&t.value.userForPageBuilder.name[0]),1)])):o.createCommentVNode("",!0),t.value&&t.value.userForPageBuilder&&t.value.userForPageBuilder.name&&t.value.userForPageBuilder.image&&typeof t.value.userForPageBuilder.image=="string"&&t.value.userForPageBuilder.image.length>2?(o.openBlock(),o.createElementBlock("div",Ale,[o.createElementVNode("div",_le,[o.createElementVNode("img",{alt:"Avatar",src:`${t.value.userForPageBuilder.image}`,class:"pbx-block pbx-inset-0 pbx-object-top pbx-d pbx-min-d pbx-max-d lg:pbx-w-8 lg:pbx-h-8 lg:pbx-min-w-8 lg:pbx-max-w-8 pbx-w-8 pbx-h-8 pbx-min-w-8 pbx-max-w-8 pbx-object-cover pbx-rounded-full"},null,8,Dle)])])):o.createCommentVNode("",!0)])])])}}});let dc=null;function Ile(){return(r,e=300)=>{dc&&clearTimeout(dc),dc=setTimeout(r,e)}}const Vle={};function Hle(r,e){return o.openBlock(),o.createBlock(o.Teleport,{to:"body"},[e[0]||(e[0]=o.createElementVNode("div",{class:"pbx-bg-white pbx-flex pbx-justify-center pbx-items-center min-pbx-h-screen pbx-h-screen pbx-w-screen pbx-fixed pbx-inset-0 pbx-z-[10000]"},[o.createElementVNode("div",{class:"pbx-absolute pbx-top-1/3"},[o.createElementVNode("div",{class:"pbx-flex pbx-items-center pbx-justify-center pbx-mt-4"},[o.createElementVNode("div",{class:"pbx-inline-block pbx-h-8 pbx-w-8 pbx-animate-spin pbx-rounded-full pbx-border-4 pbx-border-solid pbx-border-current pbx-border-r-transparent pbx-align-[-0.125em] motion-reduce:pbx-animate-[spin_1.5s_linear_infinite]"},[o.createElementVNode("span",{class:"!pbx-absolute !pbx-m-px !pbx-h-px !pbx-w-px !pbx-overflow-hidden !pbx-whitespace-nowrap !pbx-border-0 !pbx-p-0 !pbx-[clip:rect(0,0,0,0)]"},"Loading...")])])])],-1))])}const Bz=qo(Vle,[["render",Hle]]),Rle={class:"pbx-text-sm pbx-font-semibold pbx-text-myPrimaryDarkGrayColor pbx-mb-2"},Ole={class:"pbx-flex pbx-gap-2"},Fle={class:"pbx-text-xs pbx-text-gray-500 pbx-mt-2 pbx-mb-0"},jle={class:"pbx-text-sm pbx-font-semibold pbx-text-myPrimaryDarkGrayColor pbx-mb-2"},qle={class:"pbx-flex pbx-items-center pbx-justify-center"},Ule={class:"pbx-inline-grid pbx-gap-1 pbx-py-8 pbx-px-2 pbx-rounded-xl pbx-border pbx-border-solid pbx-border-gray-200 pbx-bg-gray-50 pbx-w-full pbx-justify-center",style:{"grid-template-columns":"repeat(3, 2.5rem)"}},Wle=["title","onClick"],Gle={class:"pbx-text-sm pbx-font-semibold pbx-text-myPrimaryDarkGrayColor pbx-mb-2"},Kle={class:"pbx-grid pbx-grid-cols-2 pbx-gap-2"},Jle=["onClick"],Yle={for:"image-alt-text",class:"pbx-text-sm pbx-font-semibold pbx-text-myPrimaryDarkGrayColor pbx-mb-2 pbx-block"},Qle={class:"pbx-flex pbx-justify-between pbx-items-center pbx-gap-4 pbx-border pbx-border-gray-200 pbx-py-4 pbx-px-3 pbx-rounded-lg"},Xle=["placeholder","onKeydown"],Zle=["disabled","title"],$le={key:0,class:"material-symbols-outlined pbx-materialIconXl"},ese={key:1,class:"material-symbols-outlined pbx-animate-spin"},tse={class:"pbx-text-xs pbx-text-gray-500 pbx-mt-2 pbx-mb-0"},rse=o.defineComponent({__name:"ImageSettingsModal",props:{show:{type:Boolean}},setup(r){const e=r,{translate:t}=ne(),{showToast:i}=tt(),n=ke(),a=fe,l=o.ref(0),s=o.ref(""),p=o.ref(""),d=o.ref(!1),c=[["pbx-object-top-left","pbx-object-top","pbx-object-top-right"],["pbx-object-left","pbx-object-center","pbx-object-right"],["pbx-object-bottom-left","pbx-object-bottom","pbx-object-bottom-right"]],b=o.computed(()=>{l.value;const P=a.getImageObjectFit;return!P||P==="none"?null:P}),m=o.computed(()=>{l.value;const P=a.getImageObjectPosition;return!P||P==="none"?"pbx-object-center":P}),g=o.computed(()=>{l.value;const P=a.getImageAspectRatio;return!P||P==="none"?"none":P}),x=o.computed(()=>s.value.trim()!==p.value.trim());function u(){const P=n.getSelectedImageAltText();s.value=P,p.value=P}o.watch(()=>e.show,async P=>{P&&(u(),await n.initializeElementStyles(),u(),l.value++)},{immediate:!0});async function h(){l.value++,await n.handleAutoSave()}async function f(P){n.handleImageObjectFit(P),await h()}async function w(P){n.handleImageObjectPosition(P),await h()}async function y(P){n.handleImageAspectRatio(P),await h()}async function E(){if(!(!x.value||d.value)){d.value=!0,await je(400);try{await n.handleImageAltText(s.value),p.value=s.value.trim(),l.value++,i(t("Image settings saved"),"success")}finally{d.value=!1}}}const S=[{id:"none",labelKey:"Auto"},{id:"pbx-aspect-square",labelKey:"Square"},{id:"pbx-aspect-video",labelKey:"Landscape 16:9"},{id:"pbx-aspect-[9/16]",labelKey:"Portrait 9:16"}];return(P,v)=>(o.openBlock(),o.createElementBlock("div",{class:"pbx-flex pbx-flex-col pbx-gap-4 pbx-pt-1 pbx-pb-2",onMousedown:v[3]||(v[3]=o.withModifiers(()=>{},["stop"])),onClick:v[4]||(v[4]=o.withModifiers(()=>{},["stop"]))},[o.createElementVNode("div",null,[o.createElementVNode("p",Rle,o.toDisplayString(o.unref(t)("Image fit")),1),o.createElementVNode("div",Ole,[o.createElementVNode("button",{type:"button",class:o.normalizeClass(["pbx-font-sans pbx-flex-1 pbx-rounded-xl pbx-border pbx-border-solid pbx-px-4 pbx-py-3 pbx-text-sm pbx-font-medium pbx-cursor-pointer pbx-transition-colors",b.value==="pbx-object-cover"?"pbx-border-myPrimaryLinkColor pbx-bg-myPrimaryLinkColor pbx-text-white":"pbx-border-gray-200 pbx-bg-white pbx-text-gray-700 hover:pbx-border-gray-300"]),onClick:v[0]||(v[0]=M=>f("pbx-object-cover"))},o.toDisplayString(o.unref(t)("Cover")),3),o.createElementVNode("button",{type:"button",class:o.normalizeClass(["pbx-font-sans pbx-flex-1 pbx-rounded-xl pbx-border pbx-border-solid pbx-px-4 pbx-py-3 pbx-text-sm pbx-font-medium pbx-cursor-pointer pbx-transition-colors",b.value==="pbx-object-contain"?"pbx-border-myPrimaryLinkColor pbx-bg-myPrimaryLinkColor pbx-text-white":"pbx-border-gray-200 pbx-bg-white pbx-text-gray-700 hover:pbx-border-gray-300"]),onClick:v[1]||(v[1]=M=>f("pbx-object-contain"))},o.toDisplayString(o.unref(t)("Contain")),3)]),o.createElementVNode("p",Fle,o.toDisplayString(o.unref(t)("Cover fills the frame and may crop. Contain shows the full image.")),1)]),o.createElementVNode("div",null,[o.createElementVNode("p",jle,o.toDisplayString(o.unref(t)("Crop focus")),1),o.createElementVNode("div",qle,[o.createElementVNode("div",Ule,[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(c.flat(),M=>(o.openBlock(),o.createElementBlock("button",{key:M,type:"button",class:o.normalizeClass(["pbx-w-10 pbx-h-10 pbx-rounded-lg pbx-border pbx-border-solid pbx-flex pbx-items-center pbx-justify-center pbx-cursor-pointer pbx-text-xs pbx-transition-colors",m.value===M?"pbx-border-myPrimaryLinkColor pbx-bg-myPrimaryLinkColor pbx-text-white":"pbx-border-gray-200 pbx-bg-white pbx-text-gray-500 hover:pbx-border-gray-300"]),title:M.replace("pbx-object-",""),onClick:C=>w(M)},[...v[5]||(v[5]=[o.createElementVNode("span",{class:"material-symbols-outlined pbx-materialIconBase"},"crop_free",-1)])],10,Wle))),128))])])]),o.createElementVNode("div",null,[o.createElementVNode("p",Gle,o.toDisplayString(o.unref(t)("Shape")),1),o.createElementVNode("div",Kle,[(o.openBlock(),o.createElementBlock(o.Fragment,null,o.renderList(S,M=>o.createElementVNode("button",{key:M.id,type:"button",class:o.normalizeClass(["pbx-font-sans pbx-rounded-xl pbx-border pbx-border-solid pbx-px-3 pbx-py-2.5 pbx-text-sm pbx-font-medium pbx-cursor-pointer pbx-transition-colors",g.value===M.id?"pbx-border-myPrimaryLinkColor pbx-bg-myPrimaryLinkColor pbx-text-white":"pbx-border-gray-200 pbx-bg-white pbx-text-gray-700 hover:pbx-border-gray-300"]),onClick:C=>y(M.id)},o.toDisplayString(o.unref(t)(M.labelKey)),11,Jle)),64))])]),o.createElementVNode("div",null,[o.createElementVNode("label",Yle,o.toDisplayString(o.unref(t)("Alt text")),1),o.createElementVNode("div",Qle,[o.withDirectives(o.createElementVNode("input",{id:"image-alt-text","onUpdate:modelValue":v[2]||(v[2]=M=>s.value=M),type:"text",class:"pbx-myPrimaryInput pbx-flex-1 pbx-min-w-0",placeholder:o.unref(t)("Describe this image for accessibility"),onKeydown:o.withKeys(o.withModifiers(E,["prevent"]),["enter"])},null,40,Xle),[[o.vModelText,s.value]]),o.createElementVNode("button",{type:"button",class:o.normalizeClass(["pbx-h-10 pbx-w-10 pbx-shrink-0 pbx-rounded-xl pbx-border pbx-border-solid pbx-flex pbx-items-center pbx-justify-center pbx-cursor-pointer pbx-transition-colors",x.value?"pbx-border-myPrimaryLinkColor pbx-bg-myPrimaryLinkColor pbx-text-white hover:pbx-opacity-90":"pbx-border-gray-200 pbx-bg-gray-100 pbx-text-gray-400 pbx-cursor-not-allowed"]),disabled:!x.value||d.value,title:o.unref(t)("Save"),onClick:E},[d.value?o.createCommentVNode("",!0):(o.openBlock(),o.createElementBlock("span",$le,"check")),d.value?(o.openBlock(),o.createElementBlock("span",ese,"refresh")):o.createCommentVNode("",!0)],10,Zle)]),o.createElementVNode("p",tse,o.toDisplayString(o.unref(t)("Helps screen readers and SEO understand the image content.")),1)])],32))}}),ose={class:"pbx-flex-1 pbx-flex pbx-justify-center pbx-items-center pbx-py-2 pbx-w-full pbx-gap-1"},ise=["disabled","aria-label","title"],nse=["aria-label"],ase=["disabled","aria-label","title"],lse=o.defineComponent({__name:"UndoRedo",emits:["toolbar-hide-request"],setup(r,{expose:e,emit:t}){const i=ke(),{translate:n}=ne(),a=t,l=fe,s=o.computed(()=>l.getIsLoadingGlobal),p=o.computed(()=>l.getHistoryIndex),d=o.computed(()=>l.getHistoryLength),c=o.computed(()=>p.value>0),b=o.computed(()=>p.value<d.value-1),m=async function(){c.value&&(a("toolbar-hide-request"),await i.undo(),await i.clearHtmlSelection())},g=async function(){b.value&&(a("toolbar-hide-request"),await i.redo(),await i.clearHtmlSelection())};return e({handleUndo:m,handleRedo:g,canUndo:c,canRedo:b}),(x,u)=>(o.openBlock(),o.createElementBlock(o.Fragment,null,[s.value?(o.openBlock(),o.createBlock(Bz,{key:0})):o.createCommentVNode("",!0),o.createElementVNode("div",ose,[o.createElementVNode("button",{type:"button",disabled:!c.value,"aria-label":o.unref(n)("Undo"),title:o.unref(n)("Undo"),onClick:m,class:o.normalizeClass(["pbx-h-10 pbx-w-10 pbx-rounded-full pbx-flex pbx-items-center pbx-border-none pbx-justify-center pbx-bg-gray-50 pbx-aspect-square pbx-text-black hover:pbx-text-white",[c.value?"pbx-cursor-pointer hover:pbx-bg-myPrimaryLinkColor focus-visible:pbx-ring-0":"pbx-cursor-not-allowed pbx-bg-opacity-20 hover:pbx-bg-gray-200"]])},[...u[0]||(u[0]=[o.createElementVNode("span",{class:"material-symbols-outlined","aria-hidden":"true"}," undo ",-1)])],10,ise),o.createElementVNode("div",{class:"pbx-text-xs pbx-text-gray-600 pbx-mx-2 pbx-py-3 pbx-px-2 pbx-border-solid pbx-border pbx-border-gray-200 pbx-rounded-full","aria-live":"polite","aria-label":`${p.value+1} ${o.unref(n)("of")} ${d.value}`},o.toDisplayString(p.value+1)+"/"+o.toDisplayString(d.value),9,nse),o.createElementVNode("button",{type:"button",disabled:!b.value,"aria-label":o.unref(n)("Redo"),title:o.unref(n)("Redo"),onClick:g,class:o.normalizeClass(["pbx-h-10 pbx-w-10 pbx-rounded-full pbx-flex pbx-items-center pbx-border-none pbx-justify-center pbx-bg-gray-50 pbx-aspect-square pbx-text-black hover:pbx-text-white",[b.value?"pbx-cursor-pointer hover:pbx-bg-myPrimaryLinkColor focus-visible:pbx-ring-0":"pbx-cursor-not-allowed pbx-bg-opacity-20 hover:pbx-bg-gray-200"]])},[...u[1]||(u[1]=[o.createElementVNode("span",{class:"material-symbols-outlined","aria-hidden":"true"}," redo ",-1)])],10,ase)])],64))}}),sse=["width","height"],pse=o.defineComponent({__name:"LayersIcon",props:{size:{default:24}},setup(r){return(e,t)=>(o.openBlock(),o.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",width:r.size,height:r.size,viewBox:"0 0 24 24","aria-hidden":"true"},[...t[0]||(t[0]=[o.createStaticVNode('<title>layers</title><g fill="none"><path d="M9.12015 8.16C10.1529 7.38542 10.6693 6.99813 11.2364 6.84884C11.737 6.71706 12.2632 6.71705 12.7638 6.84883C13.331 6.99812 13.8474 7.38541 14.8801 8.15999L20.5868 12.44C21.7448 13.3085 22.3238 13.7427 22.5308 14.275C22.7122 14.7413 22.7122 15.2586 22.5308 15.7249C22.3238 16.2573 21.7448 16.6915 20.5868 17.56L14.8801 21.84C13.8474 22.6146 13.331 23.0019 12.7638 23.1512C12.2632 23.2829 11.737 23.2829 11.2364 23.1512C10.6693 23.0019 10.1529 22.6146 9.12014 21.84L3.41349 17.56C2.25552 16.6915 1.67654 16.2573 1.4695 15.7249C1.28816 15.2586 1.28816 14.7413 1.46951 14.275C1.67655 13.7427 2.25553 13.3085 3.41349 12.44L9.12015 8.16Z" fill="url(#layers-icon-gradient-0)" data-glass="origin" mask="url(#layers-icon-mask)"></path><path d="M9.12015 8.16C10.1529 7.38542 10.6693 6.99813 11.2364 6.84884C11.737 6.71706 12.2632 6.71705 12.7638 6.84883C13.331 6.99812 13.8474 7.38541 14.8801 8.15999L20.5868 12.44C21.7448 13.3085 22.3238 13.7427 22.5308 14.275C22.7122 14.7413 22.7122 15.2586 22.5308 15.7249C22.3238 16.2573 21.7448 16.6915 20.5868 17.56L14.8801 21.84C13.8474 22.6146 13.331 23.0019 12.7638 23.1512C12.2632 23.2829 11.737 23.2829 11.2364 23.1512C10.6693 23.0019 10.1529 22.6146 9.12014 21.84L3.41349 17.56C2.25552 16.6915 1.67654 16.2573 1.4695 15.7249C1.28816 15.2586 1.28816 14.7413 1.46951 14.275C1.67655 13.7427 2.25553 13.3085 3.41349 12.44L9.12015 8.16Z" fill="url(#layers-icon-gradient-0)" data-glass="clone" filter="url(#layers-icon-filter)" clip-path="url(#layers-icon-clip)"></path><path d="M9.12015 2.15999C10.1529 1.38542 10.6693 0.998128 11.2364 0.848835C11.737 0.717055 12.2632 0.717055 12.7638 0.848834C13.331 0.998124 13.8474 1.38541 14.8801 2.15999L20.5868 6.43998C21.7448 7.30845 22.3238 7.74269 22.5308 8.27503C22.7122 8.74132 22.7122 9.25864 22.5308 9.72492C22.3238 10.2573 21.7448 10.6915 20.5868 11.56L14.8801 15.84C13.8474 16.6146 13.331 17.0019 12.7638 17.1512C12.2632 17.2829 11.737 17.2829 11.2364 17.1512C10.6693 17.0019 10.1529 16.6146 9.12014 15.84L3.41349 11.56C2.25552 10.6915 1.67654 10.2573 1.4695 9.72492C1.28816 9.25864 1.28816 8.74132 1.46951 8.27504C1.67655 7.74269 2.25553 7.30846 3.41349 6.43998L9.12015 2.15999Z" fill="url(#layers-icon-gradient-1)" data-glass="blur"></path><path d="M11.237 0.848781C11.7375 0.717108 12.2639 0.717038 12.7644 0.848781C13.3314 0.998119 13.8479 1.38584 14.8806 2.1603L20.5866 6.44056C21.7446 7.30903 22.3239 7.74317 22.5309 8.27552C22.7121 8.74164 22.7121 9.25861 22.5309 9.72473C22.3239 10.2571 21.7446 10.6912 20.5866 11.5597L14.8806 15.8399L14.194 16.3507C13.5865 16.7934 13.1897 17.0395 12.7644 17.1515L12.5749 17.1944C12.1953 17.2685 11.805 17.2685 11.4255 17.1944L11.237 17.1515C10.8117 17.0395 10.4147 16.7933 9.80733 16.3507L9.12081 15.8399L3.4138 11.5597C2.25593 10.6913 1.67649 10.2571 1.46947 9.72473C1.31093 9.31688 1.29097 8.86987 1.4099 8.45227L1.46947 8.27552C1.62471 7.87635 1.98934 7.53197 2.65013 7.01868L3.4138 6.44056L9.12081 2.1603C10.0243 1.48266 10.5323 1.10089 11.0251 0.916164L11.237 0.848781ZM12.5729 1.57436C12.1975 1.47557 11.8029 1.47554 11.4274 1.57436C11.0366 1.67728 10.6561 1.94538 9.57003 2.75991L3.86399 7.04017C3.27389 7.48274 2.87129 7.78513 2.58665 8.04114C2.30554 8.29399 2.20972 8.44147 2.16868 8.547C2.05534 8.83843 2.05534 9.16182 2.16868 9.45325C2.20973 9.55878 2.30557 9.70629 2.58665 9.95911C2.87129 10.2151 3.27391 10.5175 3.86399 10.9601L9.57003 15.2403C10.6561 16.0549 11.0366 16.323 11.4274 16.4259C11.8029 16.5247 12.1975 16.5247 12.5729 16.4259C12.9638 16.323 13.3443 16.0549 14.4304 15.2403L20.1374 10.9601C20.7272 10.5177 21.1292 10.215 21.4137 9.95911C21.6947 9.70637 21.7906 9.55877 21.8317 9.45325C21.945 9.16182 21.945 8.83843 21.8317 8.547C21.7906 8.44148 21.6948 8.2939 21.4137 8.04114C21.1292 7.7852 20.7272 7.48254 20.1374 7.04017L14.4304 2.75991C13.3443 1.94534 12.9638 1.67725 12.5729 1.57436Z" fill="url(#layers-icon-gradient-2)"></path><defs><linearGradient id="layers-icon-gradient-0" x1="12" y1="6.75" x2="12" y2="23.25" gradientUnits="userSpaceOnUse"><stop stop-color="#575757"></stop><stop offset="1" stop-color="#151515"></stop></linearGradient><linearGradient id="layers-icon-gradient-1" x1="12" y1=".75" x2="12" y2="17.25" gradientUnits="userSpaceOnUse"><stop stop-color="#E3E3E5" stop-opacity=".6"></stop><stop offset="1" stop-color="#BBBBC0" stop-opacity=".6"></stop></linearGradient><linearGradient id="layers-icon-gradient-2" x1="12" y1=".75" x2="12" y2="10.305" gradientUnits="userSpaceOnUse"><stop stop-color="#fff"></stop><stop offset="1" stop-color="#fff" stop-opacity="0"></stop></linearGradient><filter id="layers-icon-filter" x="-100%" y="-100%" width="400%" height="400%" filterUnits="objectBoundingBox" primitiveUnits="userSpaceOnUse"><feGaussianBlur stdDeviation="2" x="0%" y="0%" width="100%" height="100%" in="SourceGraphic" edgeMode="none" result="blur"></feGaussianBlur></filter><clipPath id="layers-icon-clip"><path d="M9.12015 2.15999C10.1529 1.38542 10.6693 0.998128 11.2364 0.848835C11.737 0.717055 12.2632 0.717055 12.7638 0.848834C13.331 0.998124 13.8474 1.38541 14.8801 2.15999L20.5868 6.43998C21.7448 7.30845 22.3238 7.74269 22.5308 8.27503C22.7122 8.74132 22.7122 9.25864 22.5308 9.72492C22.3238 10.2573 21.7448 10.6915 20.5868 11.56L14.8801 15.84C13.8474 16.6146 13.331 17.0019 12.7638 17.1512C12.2632 17.2829 11.737 17.2829 11.2364 17.1512C10.6693 17.0019 10.1529 16.6146 9.12014 15.84L3.41349 11.56C2.25552 10.6915 1.67654 10.2573 1.4695 9.72492C1.28816 9.25864 1.28816 8.74132 1.46951 8.27504C1.67655 7.74269 2.25553 7.30846 3.41349 6.43998L9.12015 2.15999Z" fill="url(#layers-icon-gradient-1)"></path></clipPath><mask id="layers-icon-mask"><rect width="100%" height="100%" fill="#FFF"></rect><path d="M9.12015 2.15999C10.1529 1.38542 10.6693 0.998128 11.2364 0.848835C11.737 0.717055 12.2632 0.717055 12.7638 0.848834C13.331 0.998124 13.8474 1.38541 14.8801 2.15999L20.5868 6.43998C21.7448 7.30845 22.3238 7.74269 22.5308 8.27503C22.7122 8.74132 22.7122 9.25864 22.5308 9.72492C22.3238 10.2573 21.7448 10.6915 20.5868 11.56L14.8801 15.84C13.8474 16.6146 13.331 17.0019 12.7638 17.1512C12.2632 17.2829 11.737 17.2829 11.2364 17.1512C10.6693 17.0019 10.1529 16.6146 9.12014 15.84L3.41349 11.56C2.25552 10.6915 1.67654 10.2573 1.4695 9.72492C1.28816 9.25864 1.28816 8.74132 1.46951 8.27504C1.67655 7.74269 2.25553 7.30846 3.41349 6.43998L9.12015 2.15999Z" fill="#000"></path></mask></defs></g>',2)])],8,sse))}}),dse={key:0,class:"pbx-inspectorEmpty"},cse={key:1,class:"pbx-htmlCodeViewer"},bse={class:"pbx-htmlCodeViewerToolbar"},mse={class:"pbx-htmlCodeViewerToolbarLeft"},gse={class:"pbx-htmlCodeViewerMeta"},use={class:"pbx-htmlCodeViewerMeta pbx-htmlCodeViewerMetaMuted"},xse={class:"material-symbols-outlined","aria-hidden":"true"},hse={class:"pbx-htmlCodeViewerSurface"},fse={class:"pbx-htmlCodeViewerPre"},yse=["innerHTML"],wse=o.defineComponent({__name:"HtmlCodeViewerModal",props:{show:{type:Boolean},title:{},html:{}},emits:["close"],setup(r){const e=r,{translate:t}=ne(),i=o.ref(!1),n=o.computed(()=>J$(e.html)),a=o.computed(()=>e.html?n.value.split(`
405
+ `,k=document.createElement("a");k.setAttribute("href","data:text/html;charset=utf-8,"+encodeURIComponent(C)),k.setAttribute("download",E),k.style.display="none",document.body.appendChild(k),k.click(),document.body.removeChild(k)}function y(){const E=document.getElementById("pagebuilder");if(!E)return;let S=Ez(E);const P=document.createElement("div");P.innerHTML=S,P.querySelectorAll("[hovered], [selected]").forEach(v=>{v.removeAttribute("hovered"),v.removeAttribute("selected")}),S=P.innerHTML,w("downloaded_html.html",S),i(t("HTML file downloaded"),"success")}return(E,S)=>{var P,v,M,C,k,T,V,N,A,I,D,q,Y,Q;return o.openBlock(),o.createElementBlock("div",{class:o.normalizeClass(["pbx-w-full",n.value?"pbx-editorEmbeddedSettings":"pbx-inset-x-0 pbx-h-[90vh] pbx-bg-white pbx-overflow-x-scroll lg:pbx-pt-2 pbx-pt-2"])},[n.value?o.createCommentVNode("",!0):(o.openBlock(),o.createElementBlock("div",Poe,[o.createElementVNode("button",{onClick:S[0]||(S[0]=F=>c("overview")),type:"button",class:o.normalizeClass(["pbx-inline-flex pbx-items-center pbx-gap-1 pbx-px-2.5 pbx-py-2 pbx-rounded pbx-text-xs pbx-font-medium pbx-cursor-pointer pbx-border pbx-transition-colors pbx-whitespace-nowrap",d.value==="overview"?"pbx-bg-gray-900 pbx-text-white pbx-border-gray-900":"pbx-bg-white pbx-text-gray-500 pbx-border-gray-200 hover:pbx-bg-gray-50 hover:pbx-text-gray-700"])},[S[3]||(S[3]=o.createElementVNode("span",{class:"material-symbols-outlined",style:{"font-size":"13px"}},"visibility",-1)),o.createElementVNode("span",null,o.toDisplayString(o.unref(t)("Overview")),1)],2),o.createElementVNode("button",{onClick:S[1]||(S[1]=F=>c("download")),type:"button",class:o.normalizeClass(["pbx-inline-flex pbx-items-center pbx-gap-1 pbx-px-2.5 pbx-py-2 pbx-rounded pbx-text-xs pbx-font-medium pbx-cursor-pointer pbx-border pbx-transition-colors pbx-whitespace-nowrap",d.value==="download"?"pbx-bg-gray-900 pbx-text-white pbx-border-gray-900":"pbx-bg-white pbx-text-gray-500 pbx-border-gray-200 hover:pbx-bg-gray-50 hover:pbx-text-gray-700"])},[S[4]||(S[4]=o.createElementVNode("span",{class:"material-symbols-outlined",style:{"font-size":"13px"}},"nest_eco_leaf",-1)),o.createElementVNode("span",null,o.toDisplayString(o.unref(t)("Download HTML")),1)],2),o.createElementVNode("button",{onClick:S[2]||(S[2]=F=>c("viewHTMLConfig")),type:"button",class:o.normalizeClass(["pbx-inline-flex pbx-items-center pbx-gap-1 pbx-px-2.5 pbx-py-2 pbx-rounded pbx-text-xs pbx-font-medium pbx-cursor-pointer pbx-border pbx-transition-colors pbx-whitespace-nowrap",d.value==="viewHTMLConfig"?"pbx-bg-gray-900 pbx-text-white pbx-border-gray-900":"pbx-bg-white pbx-text-gray-500 pbx-border-gray-200 hover:pbx-bg-gray-50 hover:pbx-text-gray-700"])},[S[5]||(S[5]=o.createElementVNode("span",{class:"material-symbols-outlined",style:{"font-size":"13px"}},"deployed_code",-1)),o.createElementVNode("span",null,o.toDisplayString(o.unref(t)("Selected HTML")),1)],2)])),b.value?(o.openBlock(),o.createElementBlock("div",Boe,[m.value?(o.openBlock(),o.createElementBlock("div",Loe,[o.createElementVNode("div",Noe,[o.createElementVNode("h3",Aoe,o.toDisplayString(o.unref(t)("Configuration Overview")),1),o.createElementVNode("p",{class:o.normalizeClass(n.value?"pbx-editorSectionDesc":"pbx-myPrimaryParagraph pbx-text-xs")},o.toDisplayString(o.unref(t)("A summary of current user preferences, application settings, and system metadata including UI theme, language, saved components, and logo configuration.")),3)])])):o.createCommentVNode("",!0),r.embeddedSection==="overviewApp"?(o.openBlock(),o.createElementBlock("p",_oe,o.toDisplayString(o.unref(t)("Application version, resource metadata, logo, and form configuration.")),1)):o.createCommentVNode("",!0),r.embeddedSection==="overviewUser"?(o.openBlock(),o.createElementBlock("p",Doe,o.toDisplayString(o.unref(t)("Current user profile and saved application preferences.")),1)):o.createCommentVNode("",!0),r.embeddedSection==="overviewConfig"?(o.openBlock(),o.createElementBlock("p",zoe,o.toDisplayString(o.unref(t)("Complete configuration object currently used by the Page Builder. Includes user information, branding settings, and other context-specific data needed for rendering and managing the builder environment.")),1)):o.createCommentVNode("",!0),g.value?(o.openBlock(),o.createElementBlock("div",{key:4,class:o.normalizeClass(["pbx-px-2 pbx-settingsSectionGroup",m.value&&!n.value?"pbx-mt-8":""])},[o.createElementVNode("div",Ioe,[o.createElementVNode("h4",Voe,o.toDisplayString(o.unref(t)("Version Information")),1),o.createElementVNode("div",Hoe,[o.createElementVNode("div",Roe,[o.createElementVNode("table",Ooe,[o.createElementVNode("thead",Foe,[o.createElementVNode("tr",null,[o.createElementVNode("th",joe,o.toDisplayString(o.unref(t)("App")),1),o.createElementVNode("th",qoe,o.toDisplayString(o.unref(t)("Version")),1)])]),o.createElementVNode("tbody",Uoe,[o.createElementVNode("tr",null,[o.createElementVNode("td",Woe,[o.createElementVNode("div",Goe,o.toDisplayString(o.unref(t)("Page Builder")),1)]),o.createElementVNode("td",Koe,[o.createElementVNode("div",Joe,[o.createElementVNode("span",Yoe,o.toDisplayString(o.unref(Tre)),1)])])])])])])])]),(P=s.value)!=null&&P.resourceData&&!o.unref(no)(s.value.resourceData)?(o.openBlock(),o.createElementBlock("div",Qoe,[o.createElementVNode("h4",Xoe,o.toDisplayString(o.unref(t)("Resource Data")),1),o.createElementVNode("div",Zoe,[o.createElementVNode("div",$oe,[o.createElementVNode("table",eie,[o.createElementVNode("thead",tie,[o.createElementVNode("tr",null,[o.createElementVNode("th",rie,o.toDisplayString(o.unref(t)("Property")),1),o.createElementVNode("th",oie,o.toDisplayString(o.unref(t)("Value")),1)])]),o.createElementVNode("tbody",iie,[(M=(v=s.value)==null?void 0:v.resourceData)!=null&&M.title?(o.openBlock(),o.createElementBlock("tr",nie,[o.createElementVNode("td",aie,[o.createElementVNode("div",lie,o.toDisplayString(o.unref(t)("Title")),1)]),o.createElementVNode("td",sie,[o.createElementVNode("div",pie,o.toDisplayString(s.value.resourceData.title),1)])])):o.createCommentVNode("",!0),(k=(C=s.value)==null?void 0:C.resourceData)!=null&&k.id?(o.openBlock(),o.createElementBlock("tr",die,[o.createElementVNode("td",cie,[o.createElementVNode("div",bie,o.toDisplayString(o.unref(t)("ID")),1)]),o.createElementVNode("td",mie,[o.createElementVNode("div",gie,o.toDisplayString(s.value.resourceData.id),1)])])):o.createCommentVNode("",!0)])])])])])):o.createCommentVNode("",!0),s.value&&s.value.pageBuilderLogo&&!o.unref(no)(s.value.pageBuilderLogo)?(o.openBlock(),o.createElementBlock("div",uie,[o.createElementVNode("h4",xie,o.toDisplayString(o.unref(t)("Logo Configuration")),1),o.createElementVNode("div",hie,[o.createElementVNode("div",fie,[o.createElementVNode("table",yie,[o.createElementVNode("thead",wie,[o.createElementVNode("tr",null,[o.createElementVNode("th",vie,o.toDisplayString(o.unref(t)("Property")),1),o.createElementVNode("th",kie,o.toDisplayString(o.unref(t)("Value")),1)])]),o.createElementVNode("tbody",Sie,[o.createElementVNode("tr",null,[o.createElementVNode("td",Cie,[o.createElementVNode("div",Tie,o.toDisplayString(o.unref(t)("Logo")),1)]),o.createElementVNode("td",Eie,[o.createElementVNode("div",Mie,[o.createElementVNode("div",Pie,[o.createElementVNode("img",{class:"pbx-h-4",src:s.value.pageBuilderLogo.src,alt:"Logo"},null,8,Bie)])])])]),o.createElementVNode("tr",null,[o.createElementVNode("td",Lie,[o.createElementVNode("div",Nie,o.toDisplayString(o.unref(t)("Logo URL")),1)]),o.createElementVNode("td",Aie,[o.createElementVNode("div",_ie,[o.createElementVNode("span",Die,o.toDisplayString(s.value.pageBuilderLogo.src),1)])])])])])])])])):o.createCommentVNode("",!0),(T=s.value)!=null&&T.updateOrCreate&&!o.unref(no)(s.value.updateOrCreate)?(o.openBlock(),o.createElementBlock("div",zie,[o.createElementVNode("h4",Iie,o.toDisplayString(o.unref(t)("Form Type")),1),o.createElementVNode("div",Vie,[o.createElementVNode("div",Hie,[o.createElementVNode("table",Rie,[o.createElementVNode("thead",Oie,[o.createElementVNode("tr",null,[o.createElementVNode("th",Fie,o.toDisplayString(o.unref(t)("Mode")),1),o.createElementVNode("th",jie,o.toDisplayString(o.unref(t)("Description")),1)])]),o.createElementVNode("tbody",qie,[o.createElementVNode("tr",null,[o.createElementVNode("td",Uie,[o.createElementVNode("div",Wie,o.toDisplayString(o.unref(t)("Form Type")),1)]),o.createElementVNode("td",Gie,[o.createElementVNode("div",Kie,[o.createElementVNode("span",{class:o.normalizeClass(["pbx-inline-flex pbx-items-center pbx-px-2.5 pbx-py-0.5 pbx-rounded-full pbx-text-xs pbx-font-medium",s.value.updateOrCreate.formType==="create"?"pbx-bg-green-100 pbx-text-green-800":"pbx-bg-blue-100 pbx-text-blue-800"])},o.toDisplayString(s.value.updateOrCreate.formType),3)])])]),s.value.updateOrCreate.formName&&s.value.updateOrCreate.formName.length>0?(o.openBlock(),o.createElementBlock("tr",Jie,[o.createElementVNode("td",Yie,[o.createElementVNode("div",Qie,o.toDisplayString(o.unref(t)("Form Name")),1)]),o.createElementVNode("td",Xie,[o.createElementVNode("div",Zie,[o.createElementVNode("span",$ie,o.toDisplayString(s.value.updateOrCreate.formName),1)])])])):o.createCommentVNode("",!0)])])])])])):o.createCommentVNode("",!0)],2)):o.createCommentVNode("",!0),x.value?(o.openBlock(),o.createElementBlock("div",ene,[(V=s.value)!=null&&V.userForPageBuilder&&!o.unref(no)(s.value.userForPageBuilder)?(o.openBlock(),o.createElementBlock("div",tne,[o.createElementVNode("h4",rne,o.toDisplayString(o.unref(t)("User Information")),1),o.createElementVNode("div",one,[o.createElementVNode("div",ine,[o.createElementVNode("table",nne,[o.createElementVNode("thead",ane,[o.createElementVNode("tr",null,[o.createElementVNode("th",lne,o.toDisplayString(o.unref(t)("Property")),1),o.createElementVNode("th",sne,o.toDisplayString(o.unref(t)("Value")),1)])]),o.createElementVNode("tbody",pne,[o.createElementVNode("tr",null,[o.createElementVNode("td",dne,[o.createElementVNode("div",cne,o.toDisplayString(o.unref(t)("User Name")),1)]),o.createElementVNode("td",bne,[o.createElementVNode("div",mne,o.toDisplayString(s.value.userForPageBuilder.name),1)])]),o.createElementVNode("tr",null,[S[6]||(S[6]=o.createElementVNode("td",{class:"pbx-px-6 pbx-py-4 pbx-whitespace-nowrap pbx-text-sm pbx-font-medium pbx-text-gray-900"},[o.createElementVNode("div",{class:"pbx-min-w-[30rem] pbx-w-max"},"ID")],-1)),o.createElementVNode("td",gne,[o.createElementVNode("div",une,o.toDisplayString(s.value.userForPageBuilder.id),1)])]),o.createElementVNode("tr",null,[o.createElementVNode("td",xne,[o.createElementVNode("div",hne,o.toDisplayString(o.unref(t)("Image")),1)]),s.value.userForPageBuilder.image&&typeof s.value.userForPageBuilder.image=="string"&&s.value.userForPageBuilder.image.length>2?(o.openBlock(),o.createElementBlock("td",fne,[o.createElementVNode("div",yne,[o.createElementVNode("div",wne,[o.createElementVNode("img",{class:"pbx-block pbx-inset-0 pbx-object-top pbx-h-10 pbx-min-h-10 pbx-max-h-10 pbx-w-10 pbx-min-w-10 pbx-max-w-10 pbx-object-cover pbx-rounded-full",src:s.value.userForPageBuilder.image,alt:"image"},null,8,vne)])])])):o.createCommentVNode("",!0)]),o.createElementVNode("tr",null,[o.createElementVNode("td",kne,[o.createElementVNode("div",Sne,o.toDisplayString(o.unref(t)("Image URL")),1)]),s.value.userForPageBuilder.image&&typeof s.value.userForPageBuilder.image=="string"&&s.value.userForPageBuilder.image.length>2?(o.openBlock(),o.createElementBlock("td",Cne,[o.createElementVNode("div",Tne,o.toDisplayString(s.value.userForPageBuilder.image),1)])):o.createCommentVNode("",!0)])])])])])])):o.createCommentVNode("",!0),(N=s.value)!=null&&N.userSettings&&!o.unref(no)(s.value.userSettings)?(o.openBlock(),o.createElementBlock("div",Ene,[o.createElementVNode("h4",Mne,o.toDisplayString(o.unref(t)("User Settings")),1),o.createElementVNode("div",Pne,[o.createElementVNode("div",Bne,[o.createElementVNode("table",Lne,[o.createElementVNode("thead",Nne,[o.createElementVNode("tr",null,[o.createElementVNode("th",Ane,o.toDisplayString(o.unref(t)("Setting")),1),o.createElementVNode("th",_ne,o.toDisplayString(o.unref(t)("Value")),1)])]),o.createElementVNode("tbody",Dne,[(I=(A=s.value)==null?void 0:A.userSettings)!=null&&I.language?(o.openBlock(),o.createElementBlock("tr",zne,[o.createElementVNode("td",Ine,[o.createElementVNode("div",Vne,o.toDisplayString(o.unref(t)("Language")),1)]),o.createElementVNode("td",Hne,[o.createElementVNode("div",Rne,o.toDisplayString(s.value.userSettings.language),1)])])):o.createCommentVNode("",!0),((q=(D=s.value)==null?void 0:D.userSettings)==null?void 0:q.autoSave)!==void 0?(o.openBlock(),o.createElementBlock("tr",One,[o.createElementVNode("td",Fne,[o.createElementVNode("div",jne,o.toDisplayString(o.unref(t)("Auto Save")),1)]),o.createElementVNode("td",qne,[o.createElementVNode("div",Une,[o.createElementVNode("span",{class:o.normalizeClass(["pbx-inline-flex pbx-items-center pbx-px-2.5 pbx-py-0.5 pbx-rounded-full pbx-text-xs pbx-font-medium",s.value.userSettings.autoSave?"pbx-bg-green-100 pbx-text-green-800":"pbx-bg-red-100 pbx-text-red-800"])},o.toDisplayString(s.value.userSettings.autoSave?o.unref(t)("Enabled"):o.unref(t)("Disabled")),3)])])])):o.createCommentVNode("",!0),((Q=(Y=s.value)==null?void 0:Y.userSettings)==null?void 0:Q.notifications)!==void 0?(o.openBlock(),o.createElementBlock("tr",Wne,[o.createElementVNode("td",Gne,[o.createElementVNode("div",Kne,o.toDisplayString(o.unref(t)("Notifications")),1)]),o.createElementVNode("td",Jne,[o.createElementVNode("div",Yne,[o.createElementVNode("span",{class:o.normalizeClass(["pbx-inline-flex pbx-items-center pbx-px-2.5 pbx-py-0.5 pbx-rounded-full pbx-text-xs pbx-font-medium",s.value.userSettings.notifications?"pbx-bg-green-100 pbx-text-green-800":"pbx-bg-red-100 pbx-text-red-800"])},o.toDisplayString(s.value.userSettings.notifications?o.unref(t)("Enabled"):o.unref(t)("Disabled")),3)])])])):o.createCommentVNode("",!0)])])])])])):o.createCommentVNode("",!0)])):o.createCommentVNode("",!0),u.value?(o.openBlock(),o.createElementBlock("div",{key:6,class:o.normalizeClass(["pbx-settingsSectionGroup",m.value?"pbx-mt-12":""])},[m.value?(o.openBlock(),o.createElementBlock("div",Qne,[o.createElementVNode("h3",Xne,o.toDisplayString(o.unref(t)("Complete Configuration Overview")),1),o.createElementVNode("p",Zne,o.toDisplayString(o.unref(t)("Complete configuration object currently used by the Page Builder. Includes user information, branding settings, and other context-specific data needed for rendering and managing the builder environment.")),1)])):o.createCommentVNode("",!0),o.createElementVNode("div",$ne,[o.createElementVNode("div",eae,[o.createElementVNode("div",tae,[o.createElementVNode("div",rae,o.toDisplayString(o.unref(t)("Configuration")),1)])]),o.createElementVNode("div",oae,[o.createElementVNode("p",iae," config: "+o.toDisplayString(JSON.stringify(s.value,null,4)),1)])])],2)):o.createCommentVNode("",!0)])):o.createCommentVNode("",!0),h.value?(o.openBlock(),o.createElementBlock("div",{key:2,class:o.normalizeClass(n.value?"":"pbx-min-h-screen pbx-mt-4")},[Array.isArray(p.value)&&p.value.length>=1?(o.openBlock(),o.createElementBlock("div",nae,[o.createElementVNode("p",{class:o.normalizeClass(["pbx-editorSectionDesc",n.value?"":"pbx-mb-10"])},o.toDisplayString(o.unref(t)("Export the entire page as a standalone HTML file. This includes all sections, content, and applied styles, making it ready for use or integration elsewhere.")),3),o.createElementVNode("div",aae,[o.createElementVNode("button",{onClick:y,type:"button",class:"pbx-myPrimaryButton"},[o.createElementVNode("span",null,o.toDisplayString(o.unref(t)("Download HTML file")),1)])])])):(o.openBlock(),o.createElementBlock("div",lae,[o.createElementVNode("p",sae,o.toDisplayString(o.unref(t)("No components added yet. Add components to the page to enable HTML download.")),1)]))],2)):o.createCommentVNode("",!0),f.value?(o.openBlock(),o.createElementBlock("div",{key:3,class:o.normalizeClass(n.value?"":"pbx-min-h-screen pbx-mt-4")},[o.createVNode(Moe)],2)):o.createCommentVNode("",!0)],2)}}}),pae={class:"pbx-flex pbx-flex-col pbx-gap-2"},dae=o.defineComponent({__name:"OverviewSettingsSection",setup(r){const{translate:e}=ne();return(t,i)=>(o.openBlock(),o.createElementBlock("div",pae,[o.createVNode(Re,null,{title:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(o.unref(e)("App & Resource")),1)]),content:o.withCtx(()=>[o.createVNode(Hn,{"embedded-section":"overviewApp"})]),_:1}),o.createVNode(Re,null,{title:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(o.unref(e)("User & Settings")),1)]),content:o.withCtx(()=>[o.createVNode(Hn,{"embedded-section":"overviewUser"})]),_:1}),o.createVNode(Re,null,{title:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(o.unref(e)("Full Configuration")),1)]),content:o.withCtx(()=>[o.createVNode(Hn,{"embedded-section":"overviewConfig"})]),_:1})]))}}),cae=o.defineComponent({__name:"DownloadHtmlSettingsSection",setup(r){const{translate:e}=ne();return(t,i)=>(o.openBlock(),o.createBlock(Re,null,{title:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(o.unref(e)("Download HTML")),1)]),content:o.withCtx(()=>[o.createVNode(Hn,{"embedded-section":"download"})]),_:1}))}}),bae=o.defineComponent({__name:"SelectedHtmlSettingsSection",setup(r){const{translate:e}=ne();return(t,i)=>(o.openBlock(),o.createBlock(Re,null,{title:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(o.unref(e)("Selected HTML")),1)]),content:o.withCtx(()=>[o.createVNode(Hn,{"embedded-section":"selectedHtml"})]),_:1}))}}),mae={class:"pbx-myPrimaryParagraph pbx-font-medium pbx-pt-6"},gae={class:"pbx-my-2 pbx-py-2"},uae={for:"font-desktop",class:"pbx-myPrimaryInputLabel"},xae={disabled:"",value:""},hae={class:"pbx-my-2 pbx-py-2"},fae={for:"font-weight",class:"pbx-myPrimaryInputLabel"},yae={disabled:"",value:""},wae={class:"pbx-my-2 pbx-py-2"},vae={for:"font-family",class:"pbx-myPrimaryInputLabel"},kae={value:null},Sae=["value"],Cae={key:0,class:"pbx-mt-2 pbx-mb-0 pbx-text-xs pbx-text-gray-500"},Tae={class:"pbx-my-2 pbx-py-2"},Eae={for:"font-style",class:"pbx-myPrimaryInputLabel"},Mae={disabled:"",value:""},Pae=o.defineComponent({__name:"TypographyControl",setup(r){const{translate:e}=ne(),t=ke(),i=fe,n=o.ref(null),a=o.ref(null),l=o.ref(null),s=o.ref(null),p=o.ref(null),d=o.ref(null),c=o.ref(""),b=o.ref(null),m=o.computed(()=>i.getElement),g=o.computed(()=>i.getFontBase),x=o.computed(()=>i.getFontDesktop),u=o.computed(()=>i.getFontTablet),h=o.computed(()=>i.getFontMobile),f=o.computed(()=>i.getFontWeight),w=o.computed(()=>i.getFontFamily),y=o.computed(()=>i.getFontStyle),E=o.computed(()=>i.getPageBuilderConfig),S=o.computed(()=>{var C;return mD((C=E.value)==null?void 0:C.userSettings)}),P=o.computed(()=>!!(d.value&&d.value!=="none")),v=function(){t.handleFontFamily(d.value==null?"none":d.value)},M=async()=>{if(await o.nextTick(),!(m.value instanceof HTMLElement)){c.value="";return}c.value=fD(m.value,E.value,{globalPageDesignMode:i.getToggleGlobalHtmlMode,selectedFontClass:i.getFontFamily})};return o.watch(g,async C=>{n.value=C,await t.initializeElementStyles()},{immediate:!0}),o.watch(x,async C=>{a.value=C,await t.initializeElementStyles()},{immediate:!0}),o.watch(u,async C=>{l.value=C,await t.initializeElementStyles()},{immediate:!0}),o.watch(h,async C=>{s.value=C,await t.initializeElementStyles()},{immediate:!0}),o.watch(f,async C=>{p.value=C,await t.initializeElementStyles()},{immediate:!0}),o.watch(w,async C=>{d.value=!C||C==="none"?null:C,await M(),await t.initializeElementStyles()},{immediate:!0}),o.watch(m,M,{immediate:!0,flush:"post"}),o.watch(y,async C=>{b.value=C,await t.initializeElementStyles()},{immediate:!0}),(C,k)=>(o.openBlock(),o.createBlock(Re,null,{title:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(o.unref(e)("Typographies")),1)]),content:o.withCtx(()=>[o.createElementVNode("p",mae,o.toDisplayString(o.unref(e)("Font Appearance")),1),o.createCommentVNode("",!0),o.createElementVNode("div",gae,[o.createElementVNode("label",uae,o.toDisplayString(o.unref(e)("Font size")),1),o.withDirectives(o.createElementVNode("select",{id:"font-desktop","onUpdate:modelValue":k[2]||(k[2]=T=>a.value=T),class:"pbx-myPrimarySelect",onChange:k[3]||(k[3]=T=>o.unref(t).handleFontSizeDesktop(a.value??void 0))},[o.createElementVNode("option",xae,o.toDisplayString(o.unref(e)("Select")),1),(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(o.unref(vi).fontDesktop,T=>(o.openBlock(),o.createElementBlock("option",{key:T},o.toDisplayString(T),1))),128))],544),[[o.vModelSelect,a.value]])]),o.createCommentVNode("",!0),k[13]||(k[13]=o.createElementVNode("hr",null,null,-1)),o.createElementVNode("div",hae,[o.createElementVNode("label",fae,o.toDisplayString(o.unref(e)("Font weight")),1),o.withDirectives(o.createElementVNode("select",{id:"font-weight","onUpdate:modelValue":k[8]||(k[8]=T=>p.value=T),class:"pbx-myPrimarySelect",onChange:k[9]||(k[9]=T=>o.unref(t).handleFontWeight(p.value??void 0))},[o.createElementVNode("option",yae,o.toDisplayString(o.unref(e)("Select")),1),(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(o.unref(lr).fontWeight,T=>(o.openBlock(),o.createElementBlock("option",{key:T},o.toDisplayString(T),1))),128))],544),[[o.vModelSelect,p.value]])]),k[14]||(k[14]=o.createElementVNode("hr",null,null,-1)),o.createElementVNode("div",wae,[o.createElementVNode("label",vae,o.toDisplayString(o.unref(e)("Font family")),1),o.withDirectives(o.createElementVNode("select",{id:"font-family","onUpdate:modelValue":k[10]||(k[10]=T=>d.value=T),class:"pbx-myPrimarySelect",onChange:v},[o.createElementVNode("option",kae,o.toDisplayString(o.unref(e)("No font family")),1),(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(S.value.filter(T=>T.value!=="none"),T=>(o.openBlock(),o.createElementBlock("option",{key:T.value,value:T.value},o.toDisplayString(T.label),9,Sae))),128))],544),[[o.vModelSelect,d.value]]),!P.value&&c.value?(o.openBlock(),o.createElementBlock("p",Cae,o.toDisplayString(o.unref(e)("Inherited"))+": "+o.toDisplayString(c.value),1)):o.createCommentVNode("",!0)]),k[15]||(k[15]=o.createElementVNode("hr",null,null,-1)),o.createElementVNode("div",Tae,[o.createElementVNode("label",Eae,o.toDisplayString(o.unref(e)("Font Style")),1),o.withDirectives(o.createElementVNode("select",{id:"font-style","onUpdate:modelValue":k[11]||(k[11]=T=>b.value=T),class:"pbx-myPrimarySelect",onChange:k[12]||(k[12]=T=>o.unref(t).handleFontStyle(b.value??void 0))},[o.createElementVNode("option",Mae,o.toDisplayString(o.unref(e)("Select")),1),(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(o.unref(lr).fontStyle,T=>(o.openBlock(),o.createElementBlock("option",{key:T},o.toDisplayString(T),1))),128))],544),[[o.vModelSelect,b.value]])])]),_:1}))}}),Bae={class:"pbx-pageDesignEditor pbx-min-h-[60rem]"},Lae={key:0,class:"pbx-pageDesignLoading pbx-flex pbx-items-start pbx-justify-center pbx-pt-12 pbx-min-h-[20rem]"},Nae={key:1},Aae={class:"pbx-editorSectionDesc pbx-pageDesignIntro"},_ae={class:"pbx-pageDesignSection"},Dae={class:"pbx-pageDesignSectionTitle"},zae={class:"pbx-pageDesignCard"},Iae={class:"pbx-pageDesignToggleRow"},Vae={class:"pbx-pageDesignToggleCopy"},Hae={class:"pbx-pageDesignToggleLabel"},Rae={class:"pbx-pageDesignToggleHint"},Oae={class:"pbx-pageDesignSection"},Fae={class:"pbx-pageDesignCard pbx-pageDesignCardWide"},jae={class:"pbx-pageDesignSection"},qae={class:"pbx-pageDesignSectionTitle"},Uae={class:"pbx-pageDesignGrid"},Wae={class:"pbx-pageDesignCard"},Gae={class:"pbx-pageDesignCardLabel pbx-px-2"},Kae={class:"pbx-pageDesignCard"},Jae={class:"pbx-pageDesignCardLabel pbx-px-2"},Yae={class:"pbx-pageDesignSection"},Qae={class:"pbx-pageDesignSectionTitle"},Xae={class:"pbx-pageDesignGrid"},Zae={class:"pbx-pageDesignCard"},$ae={class:"pbx-pageDesignCard"},ele={class:"pbx-pageDesignSection"},tle={class:"pbx-pageDesignSectionTitle"},rle={class:"pbx-pageDesignGrid"},ole={class:"pbx-pageDesignCard"},ile={class:"pbx-pageDesignCard"},nle={class:"pbx-pageDesignSection"},ale={class:"pbx-pageDesignSectionTitle"},lle={class:"pbx-pageDesignGrid"},sle={class:"pbx-pageDesignCard"},ple={class:"pbx-pageDesignCard"},dle=o.defineComponent({name:"PageDesignEditor",__name:"PageDesignEditor",props:{isLoading:{type:Boolean,required:!0,default:!0}},setup(r){const{translate:e}=ne(),t=ke(),i=o.ref(0),n=o.computed(()=>(i.value,t.isGlobalFullWidth())),a=async l=>{const s=t.setGlobalFullWidth(l);i.value++,await s};return(l,s)=>(o.openBlock(),o.createElementBlock("div",Bae,[r.isLoading?(o.openBlock(),o.createElementBlock("div",Lae,[...s[0]||(s[0]=[o.createElementVNode("div",{class:"pbx-inline-block pbx-h-8 pbx-w-8 pbx-animate-spin pbx-rounded-full pbx-border-4 pbx-border-solid pbx-border-current pbx-border-r-transparent",role:"status"},null,-1)])])):o.createCommentVNode("",!0),r.isLoading?o.createCommentVNode("",!0):(o.openBlock(),o.createElementBlock("div",Nae,[o.createElementVNode("p",Aae,o.toDisplayString(o.unref(e)("Apply styles that affect the entire page. These settings include global font family, text color, background color, and other universal styles that apply to all sections.")),1),o.createElementVNode("section",_ae,[o.createElementVNode("h4",Dae,o.toDisplayString(o.unref(e)("Layout")),1),o.createElementVNode("div",zae,[o.createElementVNode("div",Iae,[o.createElementVNode("div",Vae,[o.createElementVNode("p",Hae,o.toDisplayString(o.unref(e)("Full-width page")),1),o.createElementVNode("p",Rae,o.toDisplayString(o.unref(e)("Stretch all sections across browser width")),1)]),o.createVNode(Jt,{"model-value":n.value,"onUpdate:modelValue":a},null,8,["model-value"])])])]),o.createElementVNode("section",Oae,[o.createElementVNode("div",Fae,[o.createVNode(Pae)])]),o.createElementVNode("section",jae,[o.createElementVNode("h4",qae,o.toDisplayString(o.unref(e)("Colors")),1),o.createElementVNode("div",Uae,[o.createElementVNode("div",Wae,[o.createElementVNode("p",Gae,o.toDisplayString(o.unref(e)("Text Color")),1),o.createVNode(ZD,{globalPageLayout:!0})]),o.createElementVNode("div",Kae,[o.createElementVNode("p",Jae,o.toDisplayString(o.unref(e)("Background Color")),1),o.createVNode($D,{globalPageLayout:!0})])])]),o.createElementVNode("section",Yae,[o.createElementVNode("h4",Qae,o.toDisplayString(o.unref(e)("Spacing")),1),o.createElementVNode("div",Xae,[o.createElementVNode("div",Zae,[o.createVNode(vz)]),o.createElementVNode("div",$ae,[o.createVNode(kz)])])]),o.createElementVNode("section",ele,[o.createElementVNode("h4",tle,o.toDisplayString(o.unref(e)("Borders")),1),o.createElementVNode("div",rle,[o.createElementVNode("div",ole,[o.createVNode(Sz)]),o.createElementVNode("div",ile,[o.createVNode(Cz)])])]),o.createElementVNode("section",nle,[o.createElementVNode("h4",ale,o.toDisplayString(o.unref(e)("Advanced")),1),o.createElementVNode("div",lle,[o.createElementVNode("div",sle,[o.createVNode(bz)]),o.createElementVNode("div",ple,[o.createVNode(mz)])])])]))]))}}),cle={class:"pbx-flex pbx-h-full pbx-flex-col"},ble={class:"pbx-flex pbx-flex-row pbx-justify-between pbx-pt-7 pbx-pr-4 pbx-pl-4 pbx-items-center pbx-mb-3"},mle=["aria-label"],gle={class:"pbx-font-medium pbx-text-sm"},ule={class:"pbx-lowercase"},xle={class:"pbx-px-4 pbx-mb-3"},hle=["aria-label"],fle=["aria-selected"],yle=["aria-selected"],wle=["aria-selected"],vle={class:"pbx-flex pbx-flex-col pbx-gap-2"},kle={key:0,class:"pbx-flex pbx-flex-col pbx-gap-2"},Sle={key:1,class:"pbx-rounded-xl pbx-border pbx-border-solid pbx-border-gray-200 pbx-bg-white pbx-px-4 pbx-py-8 pbx-text-center"},Cle={class:"pbx-myPrimaryParagraph pbx-text-sm pbx-text-gray-500 pbx-my-0"},Tle={class:"pbx-flex pbx-flex-col pbx-gap-2"},Ele={class:"pbx-flex pbx-flex-col pbx-gap-2"},Mle=o.defineComponent({__name:"RightSidebarEditor",emits:["closeEditor"],setup(r){const{translate:e}=ne(),{showToast:t}=tt(),i=ke(),n=fe,a=o.ref("styles"),l=o.computed(()=>n.getElement),s=o.computed(()=>{var w;return(w=l.value)==null?void 0:w.tagName}),p=o.computed(()=>{const w=l.value;return!!(w&&i.isEditableElement(w))}),d=o.computed(()=>{const w=l.value;return w?w.tagName==="IMG"||!!n.getBasePrimaryImage:!1}),c=o.ref(null);let b=0;o.watch(()=>n.getElement,w=>{(w==null?void 0:w.tagName)==="IMG"&&(a.value="styles"),o.nextTick(()=>{c.value&&(c.value.scrollTop=b)})});function m(){c.value&&(b=c.value.scrollTop)}function g(w){a.value=w,o.nextTick(()=>{c.value&&(c.value.scrollTop=0,b=0)})}const x=o.ref(!1),u=o.ref(!1),h=async function(){x.value=!0,u.value=!0,await Oe(200),n.setToggleGlobalHtmlMode(!0),await i.globalPageStyles(),u.value=!1},f=async function(){u.value=!0,await Oe(200);try{await i.handleManualSave(),t(e("Page saved successfully"),"success")}catch{t(e("Could not save page"),"error")}i.stopGlobalStylesSync();const w=document.querySelector("[data-pagebuilder-content]");w&&w.removeAttribute("data-global-selected"),x.value=!1,u.value=!1};return(w,y)=>(o.openBlock(),o.createElementBlock(o.Fragment,null,[o.createElementVNode("div",cle,[o.createElementVNode("div",ble,[o.createElementVNode("button",{type:"button",onClick:y[0]||(y[0]=E=>w.$emit("closeEditor")),"aria-label":o.unref(e)("Close properties panel"),class:"pbx-h-10 pbx-w-10 pbx-cursor-pointer pbx-rounded-full pbx-flex pbx-items-center pbx-border-none pbx-justify-center pbx-bg-gray-50 pbx-aspect-square hover:pbx-bg-myPrimaryLinkColor hover:pbx-text-white focus-visible:pbx-ring-0 pbx-text-black hover:pbx-text-white"},[...y[4]||(y[4]=[o.createElementVNode("span",{class:"material-symbols-outlined","aria-hidden":"true"}," close ",-1)])],8,mle),o.createElementVNode("p",gle,[p.value?(o.openBlock(),o.createElementBlock(o.Fragment,{key:0},[o.createTextVNode(o.toDisplayString(o.unref(e)("Editing"))+" ",1),o.createElementVNode("span",ule,"<"+o.toDisplayString(s.value)+">",1)],64)):(o.openBlock(),o.createElementBlock(o.Fragment,{key:1},[o.createTextVNode(o.toDisplayString(o.unref(e)("Properties")),1)],64))])]),o.createElementVNode("div",xle,[o.createElementVNode("div",{class:"pbx-grid pbx-grid-cols-3 pbx-gap-1 pbx-rounded-xl pbx-border pbx-border-solid pbx-border-gray-200 pbx-bg-white pbx-p-1",role:"tablist","aria-label":o.unref(e)("Properties panel")},[o.createElementVNode("button",{type:"button",role:"tab","aria-selected":a.value==="styles",class:o.normalizeClass(["pbx-rounded-lg pbx-py-2 pbx-text-sm pbx-font-medium pbx-transition-colors pbx-border-0 pbx-cursor-pointer pbx-font-sans",a.value==="styles"?"pbx-bg-myPrimaryLinkColor pbx-text-white pbx-shadow-sm":"pbx-bg-transparent pbx-text-myPrimaryDarkGrayColor hover:pbx-bg-gray-50"]),onClick:y[1]||(y[1]=E=>g("styles"))},o.toDisplayString(o.unref(e)("Styles")),11,fle),o.createElementVNode("button",{type:"button",role:"tab","aria-selected":a.value==="settings",class:o.normalizeClass(["pbx-rounded-lg pbx-py-2 pbx-text-sm pbx-font-medium pbx-transition-colors pbx-border-0 pbx-cursor-pointer pbx-font-sans",a.value==="settings"?"pbx-bg-myPrimaryLinkColor pbx-text-white pbx-shadow-sm":"pbx-bg-transparent pbx-text-myPrimaryDarkGrayColor hover:pbx-bg-gray-50"]),onClick:y[2]||(y[2]=E=>g("settings"))},o.toDisplayString(o.unref(e)("Settings")),11,yle),o.createElementVNode("button",{type:"button",role:"tab","aria-selected":a.value==="tools",class:o.normalizeClass(["pbx-rounded-lg pbx-py-2 pbx-text-sm pbx-font-medium pbx-transition-colors pbx-border-0 pbx-cursor-pointer pbx-font-sans",a.value==="tools"?"pbx-bg-myPrimaryLinkColor pbx-text-white pbx-shadow-sm":"pbx-bg-transparent pbx-text-myPrimaryDarkGrayColor hover:pbx-bg-gray-50"]),onClick:y[3]||(y[3]=E=>g("tools"))},o.toDisplayString(o.unref(e)("Tools")),11,wle)],8,hle)]),o.createElementVNode("div",{ref_key:"scrollContainer",ref:c,onScroll:m,class:"pbx-pl-3 pbx-pr-3 pbx-mb-4 pbx-flex-1 pbx-overflow-y-scroll"},[o.withDirectives(o.createElementVNode("div",vle,[p.value?(o.openBlock(),o.createElementBlock("div",kle,[d.value?(o.openBlock(),o.createBlock(iee,{key:0})):o.createCommentVNode("",!0),o.createVNode(Tee),o.createVNode(vz),o.createVNode(kz),o.createVNode(Sz),o.createVNode(Cz),o.createVNode(bz),o.createVNode(mz),o.createVNode(X$)])):(o.openBlock(),o.createElementBlock("div",Sle,[o.createElementVNode("p",Cle,o.toDisplayString(o.unref(e)("No Element selected")),1)]))],512),[[o.vShow,a.value==="styles"]]),o.withDirectives(o.createElementVNode("div",Tle,[o.createVNode(vre,{onOpen:h}),o.createVNode(_te),o.createVNode(Ute),o.createVNode(cre),o.createVNode(Cre),o.createVNode(xre)],512),[[o.vShow,a.value==="settings"]]),o.withDirectives(o.createElementVNode("div",Ele,[o.createVNode(dae),o.createVNode(cae),o.createVNode(bae)],512),[[o.vShow,a.value==="tools"]])],544)]),o.createVNode(At,{maxWidth:"5xl",showModalBuilder:x.value,title:o.unref(e)("Page Design"),onCloseMainModalBuilder:f,minHeight:"",maxHeight:""},{default:o.withCtx(()=>[o.createVNode(dle,{isLoading:u.value},null,8,["isLoading"])]),_:1},8,["showModalBuilder","title"])],64))}}),Ple={class:"pbx-flex pbx-items-center pbx-justify-center pbx-ml-2"},Ble={class:"pbx-mr-2"},Lle={key:0,class:"pbx-flex pbx-items-center pbx-myPrimaryTag pbx-whitespace-nowrap pbx-py-0 pbx-gap-2"},Nle={class:"pbx-text-white pbx-rounded-full pbx-bg-myPrimaryBrandColor pbx-flex pbx-justify-center pbx-items-center pbx-text-xs pbx-d pbx-min-d pbx-max-d lg:pbx-w-8 lg:pbx-h-8 lg:pbx-min-w-8 lg:pbx-max-w-8 pbx-w-8 pbx-h-8 pbx-min-w-8 pbx-max-w-8 pbx-font-normal"},Ale={key:1,class:"pbx-flex pbx-items-center lg:pbx-myPrimaryTag pbx-whitespace-nowrap pbx-py-0 pbx-gap-4 pbx-w-max pbx-h-12 pbx-ml-2"},_le={class:"pbx-text-white pbx-flex-shrink-0 pbx-d pbx-w-10 pbx-h-10 pbx-rounded-full pbx-flex pbx-justify-center pbx-items-center pbx-text-xs pbx-rounded-l-full"},Dle=["src"],zle=o.defineComponent({__name:"ToolbarOption",setup(r){const e=fe,t=o.computed(()=>e.getPageBuilderConfig);return(i,n)=>{var a;return o.openBlock(),o.createElementBlock("div",null,[o.createElementVNode("div",Ple,[o.createElementVNode("div",Ble,[t.value&&t.value.userForPageBuilder&&t.value.userForPageBuilder.name&&(!t.value.userForPageBuilder.image||typeof t.value.userForPageBuilder.image=="string"&&((a=t.value.userForPageBuilder.image)==null?void 0:a.length)<2)?(o.openBlock(),o.createElementBlock("div",Lle,[o.createElementVNode("div",Nle,o.toDisplayString(typeof t.value.userForPageBuilder.name=="string"&&t.value.userForPageBuilder.name[0]),1)])):o.createCommentVNode("",!0),t.value&&t.value.userForPageBuilder&&t.value.userForPageBuilder.name&&t.value.userForPageBuilder.image&&typeof t.value.userForPageBuilder.image=="string"&&t.value.userForPageBuilder.image.length>2?(o.openBlock(),o.createElementBlock("div",Ale,[o.createElementVNode("div",_le,[o.createElementVNode("img",{alt:"Avatar",src:`${t.value.userForPageBuilder.image}`,class:"pbx-block pbx-inset-0 pbx-object-top pbx-d pbx-min-d pbx-max-d lg:pbx-w-8 lg:pbx-h-8 lg:pbx-min-w-8 lg:pbx-max-w-8 pbx-w-8 pbx-h-8 pbx-min-w-8 pbx-max-w-8 pbx-object-cover pbx-rounded-full"},null,8,Dle)])])):o.createCommentVNode("",!0)])])])}}});let dc=null;function Ile(){return(r,e=300)=>{dc&&clearTimeout(dc),dc=setTimeout(r,e)}}const Vle={};function Hle(r,e){return o.openBlock(),o.createBlock(o.Teleport,{to:"body"},[e[0]||(e[0]=o.createElementVNode("div",{class:"pbx-bg-white pbx-flex pbx-justify-center pbx-items-center min-pbx-h-screen pbx-h-screen pbx-w-screen pbx-fixed pbx-inset-0 pbx-z-[10000]"},[o.createElementVNode("div",{class:"pbx-absolute pbx-top-1/3"},[o.createElementVNode("div",{class:"pbx-flex pbx-items-center pbx-justify-center pbx-mt-4"},[o.createElementVNode("div",{class:"pbx-inline-block pbx-h-8 pbx-w-8 pbx-animate-spin pbx-rounded-full pbx-border-4 pbx-border-solid pbx-border-current pbx-border-r-transparent pbx-align-[-0.125em] motion-reduce:pbx-animate-[spin_1.5s_linear_infinite]"},[o.createElementVNode("span",{class:"!pbx-absolute !pbx-m-px !pbx-h-px !pbx-w-px !pbx-overflow-hidden !pbx-whitespace-nowrap !pbx-border-0 !pbx-p-0 !pbx-[clip:rect(0,0,0,0)]"},"Loading...")])])])],-1))])}const Bz=qo(Vle,[["render",Hle]]),Rle={class:"pbx-text-sm pbx-font-semibold pbx-text-myPrimaryDarkGrayColor pbx-mb-2"},Ole={class:"pbx-flex pbx-gap-2"},Fle={class:"pbx-text-xs pbx-text-gray-500 pbx-mt-2 pbx-mb-0"},jle={class:"pbx-text-sm pbx-font-semibold pbx-text-myPrimaryDarkGrayColor pbx-mb-2"},qle={class:"pbx-flex pbx-items-center pbx-justify-center"},Ule={class:"pbx-inline-grid pbx-gap-1 pbx-py-8 pbx-px-2 pbx-rounded-xl pbx-border pbx-border-solid pbx-border-gray-200 pbx-bg-gray-50 pbx-w-full pbx-justify-center",style:{"grid-template-columns":"repeat(3, 2.5rem)"}},Wle=["title","onClick"],Gle={class:"pbx-text-sm pbx-font-semibold pbx-text-myPrimaryDarkGrayColor pbx-mb-2"},Kle={class:"pbx-grid pbx-grid-cols-2 pbx-gap-2"},Jle=["onClick"],Yle={for:"image-alt-text",class:"pbx-text-sm pbx-font-semibold pbx-text-myPrimaryDarkGrayColor pbx-mb-2 pbx-block"},Qle={class:"pbx-flex pbx-justify-between pbx-items-center pbx-gap-4 pbx-border pbx-border-gray-200 pbx-py-4 pbx-px-3 pbx-rounded-lg"},Xle=["placeholder","onKeydown"],Zle=["disabled","title"],$le={key:0,class:"material-symbols-outlined pbx-materialIconXl"},ese={key:1,class:"material-symbols-outlined pbx-animate-spin"},tse={class:"pbx-text-xs pbx-text-gray-500 pbx-mt-2 pbx-mb-0"},rse=o.defineComponent({__name:"ImageSettingsModal",props:{show:{type:Boolean}},setup(r){const e=r,{translate:t}=ne(),{showToast:i}=tt(),n=ke(),a=fe,l=o.ref(0),s=o.ref(""),p=o.ref(""),d=o.ref(!1),c=[["pbx-object-top-left","pbx-object-top","pbx-object-top-right"],["pbx-object-left","pbx-object-center","pbx-object-right"],["pbx-object-bottom-left","pbx-object-bottom","pbx-object-bottom-right"]],b=o.computed(()=>{l.value;const P=a.getImageObjectFit;return!P||P==="none"?null:P}),m=o.computed(()=>{l.value;const P=a.getImageObjectPosition;return!P||P==="none"?"pbx-object-center":P}),g=o.computed(()=>{l.value;const P=a.getImageAspectRatio;return!P||P==="none"?"none":P}),x=o.computed(()=>s.value.trim()!==p.value.trim());function u(){const P=n.getSelectedImageAltText();s.value=P,p.value=P}o.watch(()=>e.show,async P=>{P&&(u(),await n.initializeElementStyles(),u(),l.value++)},{immediate:!0});async function h(){l.value++,await n.handleAutoSave()}async function f(P){n.handleImageObjectFit(P),await h()}async function w(P){n.handleImageObjectPosition(P),await h()}async function y(P){n.handleImageAspectRatio(P),await h()}async function E(){if(!(!x.value||d.value)){d.value=!0,await Oe(400);try{await n.handleImageAltText(s.value),p.value=s.value.trim(),l.value++,i(t("Image settings saved"),"success")}finally{d.value=!1}}}const S=[{id:"none",labelKey:"Auto"},{id:"pbx-aspect-square",labelKey:"Square"},{id:"pbx-aspect-video",labelKey:"Landscape 16:9"},{id:"pbx-aspect-[9/16]",labelKey:"Portrait 9:16"}];return(P,v)=>(o.openBlock(),o.createElementBlock("div",{class:"pbx-flex pbx-flex-col pbx-gap-4 pbx-pt-1 pbx-pb-2",onMousedown:v[3]||(v[3]=o.withModifiers(()=>{},["stop"])),onClick:v[4]||(v[4]=o.withModifiers(()=>{},["stop"]))},[o.createElementVNode("div",null,[o.createElementVNode("p",Rle,o.toDisplayString(o.unref(t)("Image fit")),1),o.createElementVNode("div",Ole,[o.createElementVNode("button",{type:"button",class:o.normalizeClass(["pbx-font-sans pbx-flex-1 pbx-rounded-xl pbx-border pbx-border-solid pbx-px-4 pbx-py-3 pbx-text-sm pbx-font-medium pbx-cursor-pointer pbx-transition-colors",b.value==="pbx-object-cover"?"pbx-border-myPrimaryLinkColor pbx-bg-myPrimaryLinkColor pbx-text-white":"pbx-border-gray-200 pbx-bg-white pbx-text-gray-700 hover:pbx-border-gray-300"]),onClick:v[0]||(v[0]=M=>f("pbx-object-cover"))},o.toDisplayString(o.unref(t)("Cover")),3),o.createElementVNode("button",{type:"button",class:o.normalizeClass(["pbx-font-sans pbx-flex-1 pbx-rounded-xl pbx-border pbx-border-solid pbx-px-4 pbx-py-3 pbx-text-sm pbx-font-medium pbx-cursor-pointer pbx-transition-colors",b.value==="pbx-object-contain"?"pbx-border-myPrimaryLinkColor pbx-bg-myPrimaryLinkColor pbx-text-white":"pbx-border-gray-200 pbx-bg-white pbx-text-gray-700 hover:pbx-border-gray-300"]),onClick:v[1]||(v[1]=M=>f("pbx-object-contain"))},o.toDisplayString(o.unref(t)("Contain")),3)]),o.createElementVNode("p",Fle,o.toDisplayString(o.unref(t)("Cover fills the frame and may crop. Contain shows the full image.")),1)]),o.createElementVNode("div",null,[o.createElementVNode("p",jle,o.toDisplayString(o.unref(t)("Crop focus")),1),o.createElementVNode("div",qle,[o.createElementVNode("div",Ule,[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(c.flat(),M=>(o.openBlock(),o.createElementBlock("button",{key:M,type:"button",class:o.normalizeClass(["pbx-w-10 pbx-h-10 pbx-rounded-lg pbx-border pbx-border-solid pbx-flex pbx-items-center pbx-justify-center pbx-cursor-pointer pbx-text-xs pbx-transition-colors",m.value===M?"pbx-border-myPrimaryLinkColor pbx-bg-myPrimaryLinkColor pbx-text-white":"pbx-border-gray-200 pbx-bg-white pbx-text-gray-500 hover:pbx-border-gray-300"]),title:M.replace("pbx-object-",""),onClick:C=>w(M)},[...v[5]||(v[5]=[o.createElementVNode("span",{class:"material-symbols-outlined pbx-materialIconBase"},"crop_free",-1)])],10,Wle))),128))])])]),o.createElementVNode("div",null,[o.createElementVNode("p",Gle,o.toDisplayString(o.unref(t)("Shape")),1),o.createElementVNode("div",Kle,[(o.openBlock(),o.createElementBlock(o.Fragment,null,o.renderList(S,M=>o.createElementVNode("button",{key:M.id,type:"button",class:o.normalizeClass(["pbx-font-sans pbx-rounded-xl pbx-border pbx-border-solid pbx-px-3 pbx-py-2.5 pbx-text-sm pbx-font-medium pbx-cursor-pointer pbx-transition-colors",g.value===M.id?"pbx-border-myPrimaryLinkColor pbx-bg-myPrimaryLinkColor pbx-text-white":"pbx-border-gray-200 pbx-bg-white pbx-text-gray-700 hover:pbx-border-gray-300"]),onClick:C=>y(M.id)},o.toDisplayString(o.unref(t)(M.labelKey)),11,Jle)),64))])]),o.createElementVNode("div",null,[o.createElementVNode("label",Yle,o.toDisplayString(o.unref(t)("Alt text")),1),o.createElementVNode("div",Qle,[o.withDirectives(o.createElementVNode("input",{id:"image-alt-text","onUpdate:modelValue":v[2]||(v[2]=M=>s.value=M),type:"text",class:"pbx-myPrimaryInput pbx-flex-1 pbx-min-w-0",placeholder:o.unref(t)("Describe this image for accessibility"),onKeydown:o.withKeys(o.withModifiers(E,["prevent"]),["enter"])},null,40,Xle),[[o.vModelText,s.value]]),o.createElementVNode("button",{type:"button",class:o.normalizeClass(["pbx-h-10 pbx-w-10 pbx-shrink-0 pbx-rounded-xl pbx-border pbx-border-solid pbx-flex pbx-items-center pbx-justify-center pbx-cursor-pointer pbx-transition-colors",x.value?"pbx-border-myPrimaryLinkColor pbx-bg-myPrimaryLinkColor pbx-text-white hover:pbx-opacity-90":"pbx-border-gray-200 pbx-bg-gray-100 pbx-text-gray-400 pbx-cursor-not-allowed"]),disabled:!x.value||d.value,title:o.unref(t)("Save"),onClick:E},[d.value?o.createCommentVNode("",!0):(o.openBlock(),o.createElementBlock("span",$le,"check")),d.value?(o.openBlock(),o.createElementBlock("span",ese,"refresh")):o.createCommentVNode("",!0)],10,Zle)]),o.createElementVNode("p",tse,o.toDisplayString(o.unref(t)("Helps screen readers and SEO understand the image content.")),1)])],32))}}),ose={class:"pbx-flex-1 pbx-flex pbx-justify-center pbx-items-center pbx-py-2 pbx-w-full pbx-gap-1"},ise=["disabled","aria-label","title"],nse=["aria-label"],ase=["disabled","aria-label","title"],lse=o.defineComponent({__name:"UndoRedo",emits:["toolbar-hide-request"],setup(r,{expose:e,emit:t}){const i=ke(),{translate:n}=ne(),a=t,l=fe,s=o.computed(()=>l.getIsLoadingGlobal),p=o.computed(()=>l.getHistoryIndex),d=o.computed(()=>l.getHistoryLength),c=o.computed(()=>p.value>0),b=o.computed(()=>p.value<d.value-1),m=async function(){c.value&&(a("toolbar-hide-request"),await i.undo(),await i.clearHtmlSelection())},g=async function(){b.value&&(a("toolbar-hide-request"),await i.redo(),await i.clearHtmlSelection())};return e({handleUndo:m,handleRedo:g,canUndo:c,canRedo:b}),(x,u)=>(o.openBlock(),o.createElementBlock(o.Fragment,null,[s.value?(o.openBlock(),o.createBlock(Bz,{key:0})):o.createCommentVNode("",!0),o.createElementVNode("div",ose,[o.createElementVNode("button",{type:"button",disabled:!c.value,"aria-label":o.unref(n)("Undo"),title:o.unref(n)("Undo"),onClick:m,class:o.normalizeClass(["pbx-h-10 pbx-w-10 pbx-rounded-full pbx-flex pbx-items-center pbx-border-none pbx-justify-center pbx-bg-gray-50 pbx-aspect-square pbx-text-black hover:pbx-text-white",[c.value?"pbx-cursor-pointer hover:pbx-bg-myPrimaryLinkColor focus-visible:pbx-ring-0":"pbx-cursor-not-allowed pbx-bg-opacity-20 hover:pbx-bg-gray-200"]])},[...u[0]||(u[0]=[o.createElementVNode("span",{class:"material-symbols-outlined","aria-hidden":"true"}," undo ",-1)])],10,ise),o.createElementVNode("div",{class:"pbx-text-xs pbx-text-gray-600 pbx-mx-2 pbx-py-3 pbx-px-2 pbx-border-solid pbx-border pbx-border-gray-200 pbx-rounded-full","aria-live":"polite","aria-label":`${p.value+1} ${o.unref(n)("of")} ${d.value}`},o.toDisplayString(p.value+1)+"/"+o.toDisplayString(d.value),9,nse),o.createElementVNode("button",{type:"button",disabled:!b.value,"aria-label":o.unref(n)("Redo"),title:o.unref(n)("Redo"),onClick:g,class:o.normalizeClass(["pbx-h-10 pbx-w-10 pbx-rounded-full pbx-flex pbx-items-center pbx-border-none pbx-justify-center pbx-bg-gray-50 pbx-aspect-square pbx-text-black hover:pbx-text-white",[b.value?"pbx-cursor-pointer hover:pbx-bg-myPrimaryLinkColor focus-visible:pbx-ring-0":"pbx-cursor-not-allowed pbx-bg-opacity-20 hover:pbx-bg-gray-200"]])},[...u[1]||(u[1]=[o.createElementVNode("span",{class:"material-symbols-outlined","aria-hidden":"true"}," redo ",-1)])],10,ase)])],64))}}),sse=["width","height"],pse=o.defineComponent({__name:"LayersIcon",props:{size:{default:24}},setup(r){return(e,t)=>(o.openBlock(),o.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",width:r.size,height:r.size,viewBox:"0 0 24 24","aria-hidden":"true"},[...t[0]||(t[0]=[o.createStaticVNode('<title>layers</title><g fill="none"><path d="M9.12015 8.16C10.1529 7.38542 10.6693 6.99813 11.2364 6.84884C11.737 6.71706 12.2632 6.71705 12.7638 6.84883C13.331 6.99812 13.8474 7.38541 14.8801 8.15999L20.5868 12.44C21.7448 13.3085 22.3238 13.7427 22.5308 14.275C22.7122 14.7413 22.7122 15.2586 22.5308 15.7249C22.3238 16.2573 21.7448 16.6915 20.5868 17.56L14.8801 21.84C13.8474 22.6146 13.331 23.0019 12.7638 23.1512C12.2632 23.2829 11.737 23.2829 11.2364 23.1512C10.6693 23.0019 10.1529 22.6146 9.12014 21.84L3.41349 17.56C2.25552 16.6915 1.67654 16.2573 1.4695 15.7249C1.28816 15.2586 1.28816 14.7413 1.46951 14.275C1.67655 13.7427 2.25553 13.3085 3.41349 12.44L9.12015 8.16Z" fill="url(#layers-icon-gradient-0)" data-glass="origin" mask="url(#layers-icon-mask)"></path><path d="M9.12015 8.16C10.1529 7.38542 10.6693 6.99813 11.2364 6.84884C11.737 6.71706 12.2632 6.71705 12.7638 6.84883C13.331 6.99812 13.8474 7.38541 14.8801 8.15999L20.5868 12.44C21.7448 13.3085 22.3238 13.7427 22.5308 14.275C22.7122 14.7413 22.7122 15.2586 22.5308 15.7249C22.3238 16.2573 21.7448 16.6915 20.5868 17.56L14.8801 21.84C13.8474 22.6146 13.331 23.0019 12.7638 23.1512C12.2632 23.2829 11.737 23.2829 11.2364 23.1512C10.6693 23.0019 10.1529 22.6146 9.12014 21.84L3.41349 17.56C2.25552 16.6915 1.67654 16.2573 1.4695 15.7249C1.28816 15.2586 1.28816 14.7413 1.46951 14.275C1.67655 13.7427 2.25553 13.3085 3.41349 12.44L9.12015 8.16Z" fill="url(#layers-icon-gradient-0)" data-glass="clone" filter="url(#layers-icon-filter)" clip-path="url(#layers-icon-clip)"></path><path d="M9.12015 2.15999C10.1529 1.38542 10.6693 0.998128 11.2364 0.848835C11.737 0.717055 12.2632 0.717055 12.7638 0.848834C13.331 0.998124 13.8474 1.38541 14.8801 2.15999L20.5868 6.43998C21.7448 7.30845 22.3238 7.74269 22.5308 8.27503C22.7122 8.74132 22.7122 9.25864 22.5308 9.72492C22.3238 10.2573 21.7448 10.6915 20.5868 11.56L14.8801 15.84C13.8474 16.6146 13.331 17.0019 12.7638 17.1512C12.2632 17.2829 11.737 17.2829 11.2364 17.1512C10.6693 17.0019 10.1529 16.6146 9.12014 15.84L3.41349 11.56C2.25552 10.6915 1.67654 10.2573 1.4695 9.72492C1.28816 9.25864 1.28816 8.74132 1.46951 8.27504C1.67655 7.74269 2.25553 7.30846 3.41349 6.43998L9.12015 2.15999Z" fill="url(#layers-icon-gradient-1)" data-glass="blur"></path><path d="M11.237 0.848781C11.7375 0.717108 12.2639 0.717038 12.7644 0.848781C13.3314 0.998119 13.8479 1.38584 14.8806 2.1603L20.5866 6.44056C21.7446 7.30903 22.3239 7.74317 22.5309 8.27552C22.7121 8.74164 22.7121 9.25861 22.5309 9.72473C22.3239 10.2571 21.7446 10.6912 20.5866 11.5597L14.8806 15.8399L14.194 16.3507C13.5865 16.7934 13.1897 17.0395 12.7644 17.1515L12.5749 17.1944C12.1953 17.2685 11.805 17.2685 11.4255 17.1944L11.237 17.1515C10.8117 17.0395 10.4147 16.7933 9.80733 16.3507L9.12081 15.8399L3.4138 11.5597C2.25593 10.6913 1.67649 10.2571 1.46947 9.72473C1.31093 9.31688 1.29097 8.86987 1.4099 8.45227L1.46947 8.27552C1.62471 7.87635 1.98934 7.53197 2.65013 7.01868L3.4138 6.44056L9.12081 2.1603C10.0243 1.48266 10.5323 1.10089 11.0251 0.916164L11.237 0.848781ZM12.5729 1.57436C12.1975 1.47557 11.8029 1.47554 11.4274 1.57436C11.0366 1.67728 10.6561 1.94538 9.57003 2.75991L3.86399 7.04017C3.27389 7.48274 2.87129 7.78513 2.58665 8.04114C2.30554 8.29399 2.20972 8.44147 2.16868 8.547C2.05534 8.83843 2.05534 9.16182 2.16868 9.45325C2.20973 9.55878 2.30557 9.70629 2.58665 9.95911C2.87129 10.2151 3.27391 10.5175 3.86399 10.9601L9.57003 15.2403C10.6561 16.0549 11.0366 16.323 11.4274 16.4259C11.8029 16.5247 12.1975 16.5247 12.5729 16.4259C12.9638 16.323 13.3443 16.0549 14.4304 15.2403L20.1374 10.9601C20.7272 10.5177 21.1292 10.215 21.4137 9.95911C21.6947 9.70637 21.7906 9.55877 21.8317 9.45325C21.945 9.16182 21.945 8.83843 21.8317 8.547C21.7906 8.44148 21.6948 8.2939 21.4137 8.04114C21.1292 7.7852 20.7272 7.48254 20.1374 7.04017L14.4304 2.75991C13.3443 1.94534 12.9638 1.67725 12.5729 1.57436Z" fill="url(#layers-icon-gradient-2)"></path><defs><linearGradient id="layers-icon-gradient-0" x1="12" y1="6.75" x2="12" y2="23.25" gradientUnits="userSpaceOnUse"><stop stop-color="#575757"></stop><stop offset="1" stop-color="#151515"></stop></linearGradient><linearGradient id="layers-icon-gradient-1" x1="12" y1=".75" x2="12" y2="17.25" gradientUnits="userSpaceOnUse"><stop stop-color="#E3E3E5" stop-opacity=".6"></stop><stop offset="1" stop-color="#BBBBC0" stop-opacity=".6"></stop></linearGradient><linearGradient id="layers-icon-gradient-2" x1="12" y1=".75" x2="12" y2="10.305" gradientUnits="userSpaceOnUse"><stop stop-color="#fff"></stop><stop offset="1" stop-color="#fff" stop-opacity="0"></stop></linearGradient><filter id="layers-icon-filter" x="-100%" y="-100%" width="400%" height="400%" filterUnits="objectBoundingBox" primitiveUnits="userSpaceOnUse"><feGaussianBlur stdDeviation="2" x="0%" y="0%" width="100%" height="100%" in="SourceGraphic" edgeMode="none" result="blur"></feGaussianBlur></filter><clipPath id="layers-icon-clip"><path d="M9.12015 2.15999C10.1529 1.38542 10.6693 0.998128 11.2364 0.848835C11.737 0.717055 12.2632 0.717055 12.7638 0.848834C13.331 0.998124 13.8474 1.38541 14.8801 2.15999L20.5868 6.43998C21.7448 7.30845 22.3238 7.74269 22.5308 8.27503C22.7122 8.74132 22.7122 9.25864 22.5308 9.72492C22.3238 10.2573 21.7448 10.6915 20.5868 11.56L14.8801 15.84C13.8474 16.6146 13.331 17.0019 12.7638 17.1512C12.2632 17.2829 11.737 17.2829 11.2364 17.1512C10.6693 17.0019 10.1529 16.6146 9.12014 15.84L3.41349 11.56C2.25552 10.6915 1.67654 10.2573 1.4695 9.72492C1.28816 9.25864 1.28816 8.74132 1.46951 8.27504C1.67655 7.74269 2.25553 7.30846 3.41349 6.43998L9.12015 2.15999Z" fill="url(#layers-icon-gradient-1)"></path></clipPath><mask id="layers-icon-mask"><rect width="100%" height="100%" fill="#FFF"></rect><path d="M9.12015 2.15999C10.1529 1.38542 10.6693 0.998128 11.2364 0.848835C11.737 0.717055 12.2632 0.717055 12.7638 0.848834C13.331 0.998124 13.8474 1.38541 14.8801 2.15999L20.5868 6.43998C21.7448 7.30845 22.3238 7.74269 22.5308 8.27503C22.7122 8.74132 22.7122 9.25864 22.5308 9.72492C22.3238 10.2573 21.7448 10.6915 20.5868 11.56L14.8801 15.84C13.8474 16.6146 13.331 17.0019 12.7638 17.1512C12.2632 17.2829 11.737 17.2829 11.2364 17.1512C10.6693 17.0019 10.1529 16.6146 9.12014 15.84L3.41349 11.56C2.25552 10.6915 1.67654 10.2573 1.4695 9.72492C1.28816 9.25864 1.28816 8.74132 1.46951 8.27504C1.67655 7.74269 2.25553 7.30846 3.41349 6.43998L9.12015 2.15999Z" fill="#000"></path></mask></defs></g>',2)])],8,sse))}}),dse={key:0,class:"pbx-inspectorEmpty"},cse={key:1,class:"pbx-htmlCodeViewer"},bse={class:"pbx-htmlCodeViewerToolbar"},mse={class:"pbx-htmlCodeViewerToolbarLeft"},gse={class:"pbx-htmlCodeViewerMeta"},use={class:"pbx-htmlCodeViewerMeta pbx-htmlCodeViewerMetaMuted"},xse={class:"material-symbols-outlined","aria-hidden":"true"},hse={class:"pbx-htmlCodeViewerSurface"},fse={class:"pbx-htmlCodeViewerPre"},yse=["innerHTML"],wse=o.defineComponent({__name:"HtmlCodeViewerModal",props:{show:{type:Boolean},title:{},html:{}},emits:["close"],setup(r){const e=r,{translate:t}=ne(),i=o.ref(!1),n=o.computed(()=>J$(e.html)),a=o.computed(()=>e.html?n.value.split(`
406
406
  `).filter(s=>s.trim().length>0).length:0);async function l(){if(!e.html)return;await pc(e.html)&&(i.value=!0,globalThis.setTimeout(()=>{i.value=!1},2e3))}return(s,p)=>(o.openBlock(),o.createBlock(At,{showModalBuilder:r.show,title:r.title,maxWidth:"7xl","z-index":10001,onCloseMainModalBuilder:p[0]||(p[0]=d=>s.$emit("close"))},{default:o.withCtx(()=>[o.createElementVNode("div",null,[r.html?(o.openBlock(),o.createElementBlock("div",cse,[o.createElementVNode("div",bse,[o.createElementVNode("div",mse,[p[1]||(p[1]=o.createElementVNode("span",{class:"pbx-htmlCodeViewerBadge"},"HTML",-1)),o.createElementVNode("span",gse,o.toDisplayString(a.value)+" "+o.toDisplayString(o.unref(t)("lines")),1),o.createElementVNode("span",use,o.toDisplayString(o.unref(t)("Read-only")),1)]),o.createElementVNode("button",{type:"button",class:"pbx-htmlCodeViewerCopy",onClick:l},[o.createElementVNode("span",xse,o.toDisplayString(i.value?"check":"content_copy"),1)])]),o.createElementVNode("div",hse,[o.createElementVNode("pre",fse,[o.createElementVNode("code",{innerHTML:n.value},null,8,yse)])])])):(o.openBlock(),o.createElementBlock("p",dse,o.toDisplayString(o.unref(t)("No HTML available")),1))])]),_:1},8,["showModalBuilder","title"]))}}),vse={key:0,class:"pbx-inspectorEmpty"},kse={key:1,class:"pbx-htmlCodeViewer"},Sse={class:"pbx-htmlCodeViewerToolbar"},Cse={class:"pbx-htmlCodeViewerToolbarLeft"},Tse={class:"pbx-htmlCodeViewerBadge"},Ese={class:"pbx-htmlCodeViewerMeta"},Mse={class:"pbx-htmlCodeViewerMeta pbx-htmlCodeViewerMetaMuted"},Pse={class:"material-symbols-outlined","aria-hidden":"true"},Bse={class:"pbx-htmlCodeViewerSurface"},Lse=["value","aria-label","readonly"],Nse=["disabled"],Ase=["disabled"],_se={key:0,class:"material-symbols-outlined"},Dse={key:1,class:"material-symbols-outlined pbx-animate-spin"},zse=o.defineComponent({__name:"HtmlEditorModal",props:{show:{type:Boolean},title:{},html:{},isLoading:{type:Boolean},error:{},badge:{default:"HTML"},readOnly:{type:Boolean,default:!1}},emits:["close","save","update:html"],setup(r,{emit:e}){const t=r,i=e,{translate:n}=ne(),a=o.ref(!1),l=o.computed(()=>t.html?t.html.split(`
407
- `).filter(d=>d.trim().length>0).length:0);function s(d){i("update:html",d.target.value)}async function p(){if(!t.html)return;await pc(t.html)&&(a.value=!0,globalThis.setTimeout(()=>{a.value=!1},2e3))}return(d,c)=>(o.openBlock(),o.createBlock(At,{showModalBuilder:r.show,title:r.title,maxWidth:"7xl","z-index":10001,onCloseMainModalBuilder:c[2]||(c[2]=b=>d.$emit("close"))},{actions:o.withCtx(()=>[o.createElementVNode("button",{type:"button",class:"pbx-mySecondaryButton",disabled:r.isLoading,onClick:c[0]||(c[0]=b=>d.$emit("close"))},o.toDisplayString(o.unref(n)("Close")),9,Nse),r.readOnly?o.createCommentVNode("",!0):(o.openBlock(),o.createElementBlock("button",{key:0,type:"button",class:"pbx-myPrimaryButton",disabled:r.isLoading,onClick:c[1]||(c[1]=b=>d.$emit("save"))},[o.createTextVNode(o.toDisplayString(o.unref(n)("Save"))+" ",1),r.isLoading?o.createCommentVNode("",!0):(o.openBlock(),o.createElementBlock("span",_se,"check")),r.isLoading?(o.openBlock(),o.createElementBlock("span",Dse,"refresh")):o.createCommentVNode("",!0)],8,Ase))]),default:o.withCtx(()=>[o.createElementVNode("div",null,[r.html?(o.openBlock(),o.createElementBlock("div",kse,[o.createElementVNode("div",Sse,[o.createElementVNode("div",Cse,[o.createElementVNode("span",Tse,o.toDisplayString(r.badge),1),o.createElementVNode("span",Ese,o.toDisplayString(l.value)+" "+o.toDisplayString(o.unref(n)("lines")),1),o.createElementVNode("span",Mse,o.toDisplayString(r.readOnly?o.unref(n)("Read-only"):o.unref(n)("Editable")),1)]),o.createElementVNode("button",{type:"button",class:"pbx-htmlCodeViewerCopy",onClick:p},[o.createElementVNode("span",Pse,o.toDisplayString(a.value?"check":"content_copy"),1)])]),o.createElementVNode("div",Bse,[o.createElementVNode("textarea",{id:"html-editor",class:"pbx-htmlCodeEditorTextarea",value:r.html,"aria-label":r.title,readonly:r.readOnly,spellcheck:"false",onInput:s},null,40,Lse)])])):(o.openBlock(),o.createElementBlock("p",vse,o.toDisplayString(o.unref(n)("No HTML available")),1))])]),_:1},8,["showModalBuilder","title"]))}}),Ise={class:"pbx-pointer-events-none pbx-fixed pbx-right-6 pbx-top-6 pbx-z-[10010] pbx-flex pbx-flex-col pbx-items-end pbx-gap-3","aria-live":"polite","aria-relevant":"additions removals"},Vse={class:"pbx-font-sans pbx-toastMessage"},Hse=["onClick"],Rse=qo(o.defineComponent({__name:"ToastContainer",setup(r){const{toasts:e,hideToast:t}=tt(),i={success:"pbx-toastSuccess",error:"pbx-toastError",warning:"pbx-toastWarning"};return(n,a)=>(o.openBlock(),o.createElementBlock("div",Ise,[o.createVNode(o.TransitionGroup,{name:"pbx-toast",tag:"div",class:"pbx-flex pbx-flex-col pbx-gap-2"},{default:o.withCtx(()=>[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(o.unref(e),l=>(o.openBlock(),o.createElementBlock("div",{key:l.id,class:o.normalizeClass(["pbx-toast",i[l.type]]),role:"status"},[o.createElementVNode("span",Vse,o.toDisplayString(l.message),1),o.createElementVNode("button",{type:"button",class:"pbx-toastClose","aria-label":"Close",onClick:s=>o.unref(t)(l.id)},[...a[0]||(a[0]=[o.createElementVNode("span",{class:"material-symbols-outlined pbx-materialIcon18","aria-hidden":"true"}," close_small ",-1)])],8,Hse)],2))),128))]),_:1})]))}}),[["__scopeId","data-v-7948f981"]]);function Ose(r){return r instanceof HTMLElement?!!r.closest('input, textarea, select, [contenteditable="true"], .pbx-inline-tiptap-editor, .ProseMirror'):!1}function Fse(r){const e=t=>{if(r.isBlocked()||Ose(t.target))return;const i=t.metaKey||t.ctrlKey;if(i&&t.key.toLowerCase()==="z"&&!t.shiftKey){t.preventDefault(),r.canUndo()&&r.onUndo();return}if(i&&t.shiftKey&&t.key.toLowerCase()==="z"||i&&t.key.toLowerCase()==="y"){t.preventDefault(),r.canRedo()&&r.onRedo();return}if(i&&t.key.toLowerCase()==="s"){t.preventDefault(),r.onSave();return}if(t.key==="Escape"){r.onDeselect();return}(t.key==="Delete"||t.key==="Backspace")&&r.hasSelection()&&(t.preventDefault(),r.onDelete())};o.onMounted(()=>{document.addEventListener("keydown",e)}),o.onBeforeUnmount(()=>{document.removeEventListener("keydown",e)})}const Lz="--pbx-brand-color",Nz="--pbx-brand-color-rgb";function Az(r){return r!=null&&r.trim()?Kt(r)??r.trim():null}function jse(r){const e=Az(r);if(!e)return null;const t=JD(e);return t?`${t.r} ${t.g} ${t.b}`:null}function qse(r){if(typeof document>"u")return;const e=Az(r),t=jse(r);if(e&&t){document.documentElement.style.setProperty(Lz,e),document.documentElement.style.setProperty(Nz,t);return}_z()}function _z(){typeof document>"u"||(document.documentElement.style.removeProperty(Lz),document.documentElement.style.removeProperty(Nz))}const Use={class:"lg:pbx-min-w-full lg:pbx-max-w-full lg:pbx-w-full pbx-mx-auto pbx-flex pbx-flex-col pbx-font-sans pbx-text-black pbx-border-solid pbx-border pbx-border-gray-400 pbx-inset-x-0 pbx-z-10 pbx-bg-white pbx-overflow-x-auto pbx-h-full"},Wse={id:"pagebuilder-navbar",class:"lg:pbx-min-w-full lg:pbx-max-w-full lg:pbx-w-full pbx-min-w-[64rem] pbx-max-w-[64rem] pbx-w-[64rem] pbx-flex-1 pbx-bg-myPrimaryLightGrayColor pbx-flex pbx-items-center pbx-justify-between pbx-border-0 pbx-border-solid pbx-border-b pbx-border-gray-200 pbx-mb-2 pbx-font-sans pbx-min-h-20"},Gse=["src"],Kse={class:"pbx-flex pbx-items-center pbx-justify-center"},Jse=["disabled","aria-label","title"],Yse={key:0,class:"pbx-h-10 pbx-w-4 pbx-cursor-pointer pbx-rounded-full pbx-flex pbx-items-center pbx-justify-center"},Qse={key:1,class:"pbx-h-10 pbx-w-4 pbx-cursor-pointer pbx-rounded-full pbx-flex pbx-items-center pbx-justify-center"},Xse=["disabled","aria-label"],Zse={key:0,class:"pbx-h-10 pbx-w-4 pbx-cursor-pointer pbx-rounded-full pbx-flex pbx-items-center pbx-justify-center"},$se={key:1,class:"pbx-h-10 pbx-w-4 pbx-cursor-pointer pbx-rounded-full pbx-flex pbx-items-center pbx-justify-center"},epe={class:"lg:pbx-block pbx-hidden"},tpe={class:"lg:pbx-hidden pbx-block"},rpe=["aria-label","title"],ope={class:"pbx-h-10 pbx-w-10 pbx-rounded-full pbx-flex pbx-items-center pbx-border-none pbx-justify-center pbx-bg-gray-50 pbx-aspect-square hover:pbx-bg-myPrimaryLinkColor focus-visible:pbx-ring-0 pbx-text-black hover:pbx-text-white"},ipe={class:"lg:pbx-block lg:pbx-pr-4 pbx-hidden"},npe=["aria-label","title"],ape={class:"lg:pbx-block lg:pbx-pr-4 pbx-hidden"},lpe=["aria-label","title"],spe={class:"pbx-h-10 pbx-w-10 pbx-rounded-full pbx-flex pbx-items-center pbx-border-none pbx-justify-center pbx-bg-gray-50 pbx-aspect-square hover:pbx-bg-myPrimaryLinkColor focus-visible:pbx-ring-0 pbx-text-black hover:pbx-text-white"},ppe={fill:"currentColor",height:"22",viewBox:"0 0 22 22",width:"22",xmlns:"http://www.w3.org/2000/svg",style:{display:"block"},"aria-hidden":"true"},dpe=["aria-label","title"],cpe={class:"pbx-h-10 pbx-w-10 pbx-rounded-full pbx-flex pbx-items-center pbx-border-none pbx-justify-center pbx-bg-gray-50 pbx-aspect-square hover:pbx-bg-myPrimaryLinkColor focus-visible:pbx-ring-0 pbx-text-black hover:pbx-text-white"},bpe={fill:"currentColor",height:"22",viewBox:"0 0 22 22",width:"22",xmlns:"http://www.w3.org/2000/svg",style:{display:"block"},"aria-hidden":"true"},mpe={class:"pbx-flex-1 pbx-flex gap-2 pbx-items-center pbx-justify-end"},gpe={key:0,class:"pbx-flex-1 pbx-ml-2"},upe={key:0,class:"pbx-flex-1 pbx-flex pbx-justify-end pbx-items-center pbx-ml-2 lg:pbx-mr-4 pbx-mr-2"},xpe=["value"],hpe=["value"],fpe={key:2,class:"pbx-flex-1 pbx-ml-2 pbx-mr-2"},ype=["aria-label"],wpe={id:"pagebuilder-main",class:"lg:pbx-min-w-full lg:pbx-max-w-full lg:pbx-w-full pbx-min-w-[64rem] pbx-max-w-[64rem] pbx-w-[64rem] pbx-flex-1 pbx-relative pbx-h-full pbx-flex pbx-pb-2 pbx-gap-2"},vpe={id:"pbxEditToolbar",class:"pbx-z-30 pbx-flex pbx-flex-wrap pbx-gap-x-2 pbx-gap-y-1 pbx-justify-start pbx-items-center pbx-content-start pbx-rounded-sm pbx-px-2 pbx-py-0 pbx-h-0 pbx-relative pbx-box-border"},kpe={key:0,"data-pbx-insert-btn":"","data-pb-no-select":""},Spe={class:"pbx-flex pbx-justify-center pbx-w-full pbx-absolute pbx-items-center pbx-gap-3"},Cpe={class:"pbx-flex pbx-items-center pbx-gap-2"},Tpe={class:"pbx-font-medium pbx-break-words lg:pbx-text-lg md:pbx-text-lg pbx-text-base pbx-font-sans"},Epe={class:"pbx-flex pbx-items-center pbx-gap-2"},Mpe={class:"pbx-font-medium pbx-break-words lg:pbx-text-lg md:pbx-text-lg pbx-text-base pbx-font-sans"},Ppe={key:1,"data-pbx-insert-btn":"","data-pb-no-select":""},Bpe={class:"pbx-flex pbx-justify-end pbx-w-full pbx-h-0 pbx-items-center pbx-rounded-r-full pbx-z-10"},Lpe={class:"pbx-flex pbx-items-center"},Npe={class:"pbx-flex pbx-items-center"},Ape={class:"lg:pbx-block pbx-hidden"},_pe={class:"pbx-flex pbx-items-center"},Dpe=["innerHTML","onMouseup"],zpe={key:1,"data-pbx-insert-btn":"","data-pb-no-select":""},Ipe={class:"pbx-flex pbx-justify-end pbx-w-full pbx-h-0 pbx-items-center pbx-rounded-r-full pbx-z-10"},Vpe={class:"pbx-flex pbx-items-center"},Hpe=["onClick"],Rpe={class:"pbx-flex pbx-items-center"},Ope={class:"lg:pbx-block pbx-hidden"},Fpe=["onClick"],jpe={class:"pbx-flex pbx-items-center"},qpe={fill:"currentColor",height:"22",viewBox:"0 0 22 22",width:"22",xmlns:"http://www.w3.org/2000/svg",style:{display:"block"}},Upe=o.defineComponent({__name:"PageBuilder",props:{CustomMediaLibraryComponent:{type:Object,default:null},DisplayProducts:{type:Object,default:null},enableDefaultProducts:{type:Boolean,default:!0},CustomBuilderComponents:{type:Object,default:null},showCloseButton:{type:Boolean,default:!1},showPublishButton:{type:Boolean,default:!1}},emits:["handleClosePageBuilder","handlePublishPageBuilder"],setup(r,{emit:e}){const t=ke(),{show:i,title:n,html:a,closeHtmlViewer:l}=is(),{show:s,title:p,html:d,isLoading:c,error:b,closeHtmlEditor:m,saveHtmlEditor:g}=ls(),x=r,{translate:u,loadTranslations:h}=ne(),{showToast:f}=tt(),w=zd,y=fe;o.provide("pageBuilderStateStore",y),o.provide("internalPinia",w),o.provide("CustomMediaComponent",x.CustomMediaLibraryComponent),o.provide("DisplayProductsComponent",x.DisplayProducts),o.provide("CustomBuilderComponents",x.CustomBuilderComponents);const E=o.computed(()=>!!x.DisplayProducts||x.enableDefaultProducts),S=e,P=o.ref(1),v=o.ref(""),M=o.ref(!1),C=o.ref(""),k=o.ref(""),T=o.ref(""),V=o.ref(null),N=o.ref(null),A=o.ref(null),I=o.ref(null),D=o.ref(null),q=async function(){v.value="warning",M.value=!0,C.value=u("Continue Your Work?"),k.value=u("Are you sure you want to close the Page Builder? All unsaved changes will be lost."),T.value=null,V.value=u("Close Page Builder"),N.value=null,A.value=async function(){M.value=!1},I.value=function(){Y()},D.value=async function(){}},Y=function(){M.value=!1,S("handleClosePageBuilder")},Q=async function(){y.setIsLoadingGlobal(!0);try{await t.handleManualSave(),f(u("Page saved successfully"),"success")}catch{f(u("Could not save page"),"error")}y.setIsLoadingGlobal(!1),S("handlePublishPageBuilder")};async function F(){try{await t.handleManualSave(),f(u("Page saved successfully"),"success")}catch{f(u("Could not save page"),"error")}}const le=()=>{Qt.value=!1};o.provide("closeAddComponentModal",le);const Se=o.ref("en");let kt=!0;const Ye=o.ref(!1);o.watch(Se,async _=>{if(_&&!kt){Ye.value=!0,await je(200),await h(_),t.changeLanguage(_);const L=JSON.parse(localStorage.getItem("userSettingsPageBuilder")??"{}")||{};L.lang=_,localStorage.setItem("userSettingsPageBuilder",JSON.stringify(L)),Ye.value=!1}});const ct=o.computed(()=>y.getBuilderStarted),ue=o.computed(()=>y.getPageBuilderConfig),oe=o.computed(()=>{var _;return dD((_=ue.value)==null?void 0:_.userSettings)}),Z=o.computed(()=>{var Xe;const _=(Xe=ue.value)==null?void 0:Xe.userSettings,L=y.getToggleGlobalHtmlMode,re=y.getFontFamily;if(L&&re&&re!=="none")return re;const j=document.getElementById("pagebuilder"),we=j?cD(j,_):void 0;return we&&Od(j,_,{globalPageDesignMode:L,selectedFontClass:re})?we:oe.value}),K=o.computed(()=>{var re;const _=(re=ue.value)==null?void 0:re.userSettings,L=document.getElementById("pagebuilder");return Od(L,_,{globalPageDesignMode:y.getToggleGlobalHtmlMode,selectedFontClass:y.getFontFamily})}),X=o.computed(()=>{var _;return HU((_=ue.value)==null?void 0:_.userSettings)}),J=o.computed(()=>{var j,we;if(K.value)return{};const _=(we=(j=ue.value)==null?void 0:j.userSettings)==null?void 0:we.elementFonts;if(!_)return{};const L={},re=["h1","h2","h3","h4","h5","h6","p"];for(const Xe of re){const Di=_[Xe];if(Di){const Hr=jd(Di);Hr&&(L[`--pbx-el-${Xe}-font`]=Hr)}}return L}),R=o.computed(()=>{var _;return(_=ue.value)==null?void 0:_.pageSettings}),Qe=o.computed(()=>{var L;const _=(L=R.value)==null?void 0:L.classes;return!_||typeof _!="string"?"":_}),W=o.computed(()=>{var L;const _=(L=R.value)==null?void 0:L.style;return _?typeof _=="string"?_:Object.entries(_).map(([re,j])=>`${re.replace(/([A-Z])/g,"-$1").toLowerCase()}: ${j};`).join(" "):""});o.watch(()=>{var _,L;return(L=(_=ue.value)==null?void 0:_.settings)==null?void 0:L.brandColor},_=>{qse(_)},{immediate:!0});const H=o.computed(()=>y.getCurrentLanguage);o.watch(H,_=>{_&&_!==Se.value&&(Se.value=_)});const ge=o.computed(()=>y.getMenuRight),xe=o.ref(!1),bt=o.ref(""),St=o.ref(""),Pr=function(){localStorage.setItem("preview-font-class",Z.value),localStorage.setItem("preview-element-fonts",JSON.stringify(K.value?{}:J.value))},Br=function(){t.previewCurrentDesign(),Pr()},On=function(){bt.value=u("Preview"),Br(),xe.value=!0},Lr=o.ref(!1),cs=function(){t.previewCurrentDesign(),Pr()},xc=function(){St.value=u("Mobile"),cs(),Lr.value=!0},Go=o.ref(!1),hc=function(){Go.value=!1},bs=function(){xe.value=!1},Ft=function(){Lr.value=!1},Qt=o.ref(!1),Ko=o.ref(""),Jo=o.ref(""),Nr=o.ref(null),Yo=async function(){await t.clearHtmlSelection(),Ko.value=u("Add Components to Page"),Jo.value=u("Close"),Qt.value=!0,Nr.value=function(){Qt.value=!1}},Xt=o.ref(!1),ao=o.ref(""),pr=async function(){await t.clearHtmlSelection(),y.setAddComponentAddIndex(null),y.setComponentArrayAddMethod("unshift"),ao.value=u("Add Products to Page"),Xt.value=!0},Ar=()=>{Xt.value=!1},Zt=function(_){y.setAddComponentAddIndex(_),y.setComponentArrayAddMethod("insert"),Yo()},Fn=async function(_){await t.clearHtmlSelection(),y.setAddComponentAddIndex(_),y.setComponentArrayAddMethod("insert"),ao.value=u("Add Products to Page"),Xt.value=!0},$t=o.computed(()=>y.getElement),er=o.computed(()=>y.getComponents),jn=o.computed(()=>y.getHasLocalDraftForUpdate);o.watch(jn,_=>{_&&Zo()});const ms=o.computed(()=>!$t.value||!($t.value instanceof HTMLElement)?null:{src:$t.value.getAttribute("src"),href:$t.value.getAttribute("href"),style:$t.value.getAttribute("style"),class:$t.value.getAttribute("class"),dataImage:$t.value.getAttribute("data-image")}),gs=Ile();o.watch(ms,async(_,L)=>{((_==null?void 0:_.src)!==(L==null?void 0:L.src)||(_==null?void 0:_.href)!==(L==null?void 0:L.href)||(_==null?void 0:_.style)!==(L==null?void 0:L.style)||(_==null?void 0:_.class)!==(L==null?void 0:L.class)||(_==null?void 0:_.dataImage)!==(L==null?void 0:L.dataImage))&&gs(async()=>{await t.initializeElementStyles()},200)});const us=function(_){y.getInlineTipTapEditor||y.setComponent(_)},xs=async function(_){await t.openInlineTipTapFromEvent(_)},hs=function(_){if(!y.getInlineTipTapEditor||!(_.target instanceof Node))return;const L=document.querySelector("#pagebuilder [data-pbx-inline-tiptap]"),re=L==null?void 0:L.querySelector(".ProseMirror"),j=_.target instanceof Element?_.target.closest("[data-pbx-inline-editor-ui]"):null,we=_.target instanceof Element?_.target.closest("#pbx-modal"):null;if(re!=null&&re.contains(_.target)||j||we||CD(_.target))return;const Xe=t.findEditableElementFromEventTarget(_.target);_.preventDefault(),_.stopPropagation(),_.stopImmediatePropagation(),t.finishActiveInlineTipTapEditorFromDom(Xe)},lo=o.computed(()=>y.getIsLoadingGlobal),qn=o.computed(()=>y.getIsSaving),_r=o.ref(null),dr=o.ref(null),so=o.computed(()=>y.getIsLoadingResumeEditing),po=o.computed(()=>y.getIsRestoring),fs=o.ref(!1),mt=o.ref(!1),Un=o.ref(1),Wn=o.ref(""),co=o.ref(!1),Qo=o.ref(""),Dr=o.ref(""),Gn=o.ref(""),ys=o.ref(null),ws=o.ref(null),Ni=o.ref(null),Xo=o.ref(null),bo=o.ref(null),Zo=async function(){Wn.value="warning",co.value=!0,Qo.value=u("Continue Your Work?"),Dr.value=u("We noticed you have some changes that weren’t saved last time. Would you like to pick up where you left off, or use the version that’s currently loaded from the database?"),Gn.value=u("Use Saved Version"),ys.value=null,ws.value=u("Continue Where I Left Off"),Ni.value=async function(){y.setHasLocalDraftForUpdate(!1),co.value=!1},Xo.value=function(){},bo.value=async function(){await t.resumeEditingFromDraft(),y.setHasLocalDraftForUpdate(!1),co.value=!1}},mo=o.ref(1),jt=o.ref(""),go=o.ref(!1),vs=o.ref(""),ks=o.ref(""),Ai=o.ref(""),cr=o.ref(null),_i=o.ref(null),uo=o.ref(null),zr=o.ref(null),Ir=o.ref(null),Kn=async function(){await t.clearHtmlSelection(),jt.value="success",go.value=!0,vs.value=u("Do you want to reset this page?"),ks.value=u("Are you sure you want to reset this page? This will overwrite your current changes."),Ai.value=u("Close"),cr.value=null,_i.value=u("Reset changes"),uo.value=function(){go.value=!1},zr.value=async function(){},Ir.value=async function(){try{await t.restoreOriginalContent(),f(u("Page restored to original version"),"success")}catch{f(u("Could not restore page"),"error")}go.value=!1}},br=o.ref(!1),Jn=()=>{if(br.value){xo();return}t.setImageSettingsModalOpen(!0),br.value=!0},xo=()=>{br.value=!1,t.setImageSettingsModalOpen(!1)};Fse({canUndo:()=>y.getHistoryIndex>0,canRedo:()=>y.getHistoryIndex<y.getHistoryLength-1,isBlocked:()=>lo.value||Ye.value||y.getInlineTipTapEditor||Qt.value||Xt.value||M.value||co.value||go.value||s.value||i.value||xe.value||Lr.value||br.value,onUndo:async()=>{var _;await((_=_r.value)==null?void 0:_.handleUndo())},onRedo:async()=>{var _;await((_=_r.value)==null?void 0:_.handleRedo())},onSave:F,onDeselect:async()=>{await t.clearHtmlSelection()},onDelete:()=>{var _;(_=dr.value)==null||_.openDeleteConfirm()},hasSelection:()=>!!y.getElement});const $o=function(){ct.value||(Go.value=!0)},tr=o.ref(null),Ss=o.ref(null),ho=o.ref(!1);let Vr=0,fo=null,O=0,B=0;function z(){const _=tr.value;if(_){const L=_.scrollTop,re=L-O;kW()?B=0:vW()?re>0?(B+=re,B>=wW&&(SW(),B=0)):re<0&&(B=0):B=0,O=L}Lt()}const se=function(){var L;const _=document.querySelector("#pbxEditToolbar");_&&((L=_.querySelector(".pbx-select-none > .pbx-flex"))==null||L.style.removeProperty("width"),_.classList.remove("is-visible"),_.removeAttribute("style"))};function ye(_,L){const re=_.querySelector(".pbx-select-none > .pbx-flex");if(!re)return;re.style.flexWrap="nowrap",re.style.removeProperty("max-width"),re.style.width="max-content",re.getBoundingClientRect();const j=Math.ceil(re.getBoundingClientRect().width);re.style.flexWrap="wrap",j>0&&(re.style.width=`${Math.min(j,L)}px`),re.style.justifyContent="center",re.style.removeProperty("max-width")}const Ce=function(){ho.value=!ho.value,_e()};function it(_){const L=document.querySelector("#pbxEditToolbar");let re=!1;for(const j of _){if(j.type==="attributes"&&j.attributeName==="selected"){re=!0;break}if(!L)continue;const we=j.target;if(we instanceof Node&&(L===we||L.contains(we))){re=!0;break}}re?gt():Lt()}function qe(_={}){const L=_.remeasureWidth??!0,re=tr.value,j=re&&re.querySelector("#pbxEditToolbar");if(!re||!j)return;const we=re.querySelector("[selected]");if(we&&typeof we.getBoundingClientRect=="function"){const Hr=(we.closest("[data-pb-no-select]")||we).getBoundingClientRect(),zi=re.getBoundingClientRect(),Ii=20,Vz=re.offsetWidth-Ii*2;j.style.maxWidth=`${Vz}px`,j.style.position=ho.value?"fixed":"absolute",j.classList.add("is-visible"),L&&(j.style.removeProperty("width"),ye(j,Vz),j.getBoundingClientRect());let Cs=Hr.top-zi.top+re.scrollTop-j.offsetHeight-20,Vi=Hr.left-zi.left+Hr.width/2-j.offsetWidth/2;ho.value?(Cs=zi.top+Ii,Vi=zi.left+re.offsetWidth/2-j.offsetWidth/2,Vi=Math.max(zi.left+Ii,Math.min(Vi,zi.left+re.offsetWidth-j.offsetWidth-Ii))):(Cs=Math.max(0,Cs),Vi=Math.max(Ii,Math.min(Vi,re.offsetWidth-j.offsetWidth-Ii))),j.style.top=`${Cs}px`,j.style.left=`${Vi}px`,window.dispatchEvent(new CustomEvent("pagebuilder:toolbar-positioned"))}else j.classList.remove("is-visible"),j.removeAttribute("style")}const _e=function(){qe({remeasureWidth:!0}),requestAnimationFrame(()=>qe({remeasureWidth:!0}))};function Lt(){cancelAnimationFrame(Vr),Vr=requestAnimationFrame(()=>{Vr=0,qe({remeasureWidth:!1})})}function gt(){cancelAnimationFrame(Vr),Vr=requestAnimationFrame(()=>{Vr=0,qe({remeasureWidth:!0})})}o.watch(()=>y.getInlineTipTapEditor,()=>{o.nextTick(_e)}),o.watch($t,()=>{o.nextTick(_e)}),o.watch(er,()=>{o.nextTick(_e)}),o.watch([lo,so,po,Ye,Go],()=>{ie()});const ze=function(){_e()},Le=JSON.parse(localStorage.getItem("userSettingsPageBuilder")??"null"),ie=function(){fs.value=mt.value||lo.value&&!Go.value||Ye.value||so.value||po.value};return o.onMounted(async()=>{const _=t.shouldCompleteBuilderMountOnMount(Ss.value??void 0);_&&(mt.value=!0,y.setIsLoadingGlobal(!0),ie());try{_?await t.completeBuilderInitialization(void 0):await t.refreshListeners()}finally{mt.value=!1,y.setIsLoadingGlobal(!1),ie()}Le&&Le.lang&&(Se.value=Le.lang),await h(Se.value),kt=!1,ie(),gt();const L=tr.value;L&&(O=L.scrollTop,fo=new MutationObserver(it),fo.observe(L,{attributes:!0,attributeFilter:["selected"],childList:!0,subtree:!0}),L.addEventListener("scroll",z,{passive:!0}),window.addEventListener("scroll",Lt,{passive:!0}),window.addEventListener("resize",gt),window.addEventListener("pagebuilder:layout-change",ze),document.addEventListener("pointerdown",hs,!0),await je(1e4),$o(),await je(1e4),$o(),await je(1e4),$o())}),o.onBeforeUnmount(()=>{var _;t.flushPendingEditsToLocalStorage(),t.markCanvasUnmountedForNextMount(),cancelAnimationFrame(Vr),fo==null||fo.disconnect(),fo=null,(_=tr.value)==null||_.removeEventListener("scroll",z),window.removeEventListener("scroll",Lt),window.removeEventListener("resize",gt),window.removeEventListener("pagebuilder:layout-change",ze),document.removeEventListener("pointerdown",hs,!0),_z()}),(_,L)=>{var re;return o.openBlock(),o.createElementBlock(o.Fragment,null,[X.value?(o.openBlock(),o.createBlock(o.resolveDynamicComponent("style"),{key:0},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(X.value),1)]),_:1})):o.createCommentVNode("",!0),o.createElementVNode("div",Use,[fs.value?(o.openBlock(),o.createBlock(Bz,{key:0})):o.createCommentVNode("",!0),o.createVNode(At,{title:"The builder hasn’t started yet",showModalBuilder:Go.value,onCloseMainModalBuilder:hc,type:"delete",maxWidth:"2xl",noBackgroundOpacity:!0},{default:o.withCtx(()=>[...L[32]||(L[32]=[o.createTextVNode(" The builder hasn’t started yet. If this screen doesn’t go away soon, it may just need a little setup in the background. You can safely contact support and ask them to initialize the builder by running the startBuilder method for this resource. ",-1)])]),_:1},8,["showModalBuilder"]),Qt.value?(o.openBlock(),o.createBlock(FX,{key:1,show:Qt.value,firstButtonText:Jo.value,title:Ko.value,CustomBuilderComponents:x.CustomBuilderComponents,onFirstModalButtonSearchComponentsFunction:L[0]||(L[0]=()=>{var j;return(j=Nr.value)==null?void 0:j.call(Nr)})},null,8,["show","firstButtonText","title","CustomBuilderComponents"])):o.createCommentVNode("",!0),E.value&&Xt.value?(o.openBlock(),o.createBlock(p$,{key:2,open:Xt.value,title:ao.value,displayProductsComponent:x.DisplayProducts,onCloseProductLibrary:Ar},null,8,["open","title","displayProductsComponent"])):o.createCommentVNode("",!0),o.createVNode(Et,{showDynamicModalBuilder:M.value,isLoading:!1,type:v.value,gridColumnAmount:P.value,title:C.value,description:k.value,firstButtonText:T.value??void 0,secondButtonText:V.value??void 0,thirdButtonText:N.value??void 0,onFirstModalButtonFunctionDynamicModalBuilder:L[1]||(L[1]=()=>{var j;return(j=A.value)==null?void 0:j.call(A)}),onSecondModalButtonFunctionDynamicModalBuilder:L[2]||(L[2]=()=>{var j;return(j=I.value)==null?void 0:j.call(I)}),onThirdModalButtonFunctionDynamicModalBuilder:L[3]||(L[3]=()=>{var j;return(j=D.value)==null?void 0:j.call(D)})},{default:o.withCtx(()=>[...L[33]||(L[33]=[o.createElementVNode("header",null,null,-1),o.createElementVNode("main",null,null,-1)])]),_:1},8,["showDynamicModalBuilder","type","gridColumnAmount","title","description","firstButtonText","secondButtonText","thirdButtonText"]),o.createVNode(At,{title:bt.value,showModalBuilder:xe.value,onCloseMainModalBuilder:bs,maxWidth:"screen"},{default:o.withCtx(()=>[o.createVNode(Ns)]),_:1},8,["title","showModalBuilder"]),o.createVNode(At,{title:St.value,showModalBuilder:Lr.value,onCloseMainModalBuilder:Ft,maxWidth:"lg"},{default:o.withCtx(()=>[o.createVNode(Ns,{mobile:!0})]),_:1},8,["title","showModalBuilder"]),o.createVNode(Et,{showDynamicModalBuilder:co.value,isLoading:so.value,type:Wn.value,gridColumnAmount:Un.value,title:Qo.value,description:Dr.value,firstButtonText:Gn.value,secondButtonText:ys.value??void 0,thirdButtonText:ws.value??void 0,onFirstModalButtonFunctionDynamicModalBuilder:L[4]||(L[4]=()=>{var j;return(j=Ni.value)==null?void 0:j.call(Ni)}),onSecondModalButtonFunctionDynamicModalBuilder:L[5]||(L[5]=()=>{var j;return(j=Xo.value)==null?void 0:j.call(Xo)}),onThirdModalButtonFunctionDynamicModalBuilder:L[6]||(L[6]=()=>{var j;return(j=bo.value)==null?void 0:j.call(bo)})},{default:o.withCtx(()=>[...L[34]||(L[34]=[o.createElementVNode("header",null,null,-1),o.createElementVNode("main",null,null,-1)])]),_:1},8,["showDynamicModalBuilder","isLoading","type","gridColumnAmount","title","description","firstButtonText","secondButtonText","thirdButtonText"]),o.createVNode(Et,{showDynamicModalBuilder:go.value,isLoading:po.value,type:jt.value,gridColumnAmount:mo.value,title:vs.value,description:ks.value,firstButtonText:Ai.value,secondButtonText:cr.value??void 0,thirdButtonText:_i.value??void 0,onFirstModalButtonFunctionDynamicModalBuilder:L[7]||(L[7]=()=>{var j;return(j=uo.value)==null?void 0:j.call(uo)}),onSecondModalButtonFunctionDynamicModalBuilder:L[8]||(L[8]=()=>{var j;return(j=zr.value)==null?void 0:j.call(zr)}),onThirdModalButtonFunctionDynamicModalBuilder:L[9]||(L[9]=()=>{var j;return(j=Ir.value)==null?void 0:j.call(Ir)})},{default:o.withCtx(()=>[...L[35]||(L[35]=[o.createElementVNode("header",null,null,-1),o.createElementVNode("main",null,null,-1)])]),_:1},8,["showDynamicModalBuilder","isLoading","type","gridColumnAmount","title","description","firstButtonText","secondButtonText","thirdButtonText"]),o.createElementVNode("div",Wse,[ue.value&&ue.value.pageBuilderLogo&&ue.value.pageBuilderLogo.src?(o.openBlock(),o.createElementBlock("div",{key:0,onClick:L[10]||(L[10]=o.withModifiers(async()=>{await o.unref(t).clearHtmlSelection()},["self"])),class:"pbx-flex pbx-justify-start pbx-py-2 lg:pbx-ml-4 pbx-ml-2"},[o.createElementVNode("img",{class:"pbx-h-6",src:ue.value.pageBuilderLogo.src,alt:"Logo"},null,8,Gse)])):o.createCommentVNode("",!0),o.createVNode(lse,{ref_key:"undoRedoRef",ref:_r,onToolbarHideRequest:se},null,512),o.createElementVNode("div",{onClick:L[13]||(L[13]=o.withModifiers(async()=>{await o.unref(t).clearHtmlSelection()},["self"])),class:"pbx-flex-1 pbx-flex pbx-justify-center pbx-items-center pbx-py-2 pbx-w-full"},[o.createElementVNode("div",Kse,[o.createElementVNode("button",{class:"pbx-mySecondaryButton pbx-h-6 pbx-flex pbx-gap-2 pbx-mr-2",onClick:L[11]||(L[11]=o.withModifiers(async()=>{await o.unref(t).clearHtmlSelection(),await F()},["stop"])),type:"button",disabled:qn.value,"aria-label":o.unref(u)("Save"),title:`${o.unref(u)("Save")} (Ctrl+S)`},[qn.value?o.createCommentVNode("",!0):(o.openBlock(),o.createElementBlock("div",Yse,[...L[36]||(L[36]=[o.createElementVNode("span",{class:"material-symbols-outlined","aria-hidden":"true"},"save",-1)])])),qn.value?(o.openBlock(),o.createElementBlock("div",Qse,[...L[37]||(L[37]=[o.createElementVNode("span",{class:"pbx-relative pbx-flex pbx-size-3"},[o.createElementVNode("span",{class:"pbx-absolute pbx-inline-flex pbx-h-full pbx-w-full pbx-animate-ping pbx-rounded-full pbx-bg-gray-400 pbx-opacity-75"}),o.createElementVNode("span",{class:"pbx-relative pbx-inline-flex pbx-size-3 pbx-rounded-full pbx-bg-green-200"})],-1)])])):o.createCommentVNode("",!0),o.createElementVNode("div",null,o.toDisplayString(o.unref(u)("Save")),1)],8,Jse),ue.value&&ue.value.updateOrCreate&&ue.value.updateOrCreate.formType==="update"?(o.openBlock(),o.createElementBlock("button",{key:0,class:"pbx-mySecondaryButton pbx-h-6 pbx-flex pbx-gap-2 lg:pbx-mr-2 pbx-mr-2",onClick:L[12]||(L[12]=o.withModifiers(async()=>{await o.unref(t).clearHtmlSelection(),await Kn()},["stop"])),type:"button",disabled:po.value,"aria-label":o.unref(u)("Reset Page")},[po.value?o.createCommentVNode("",!0):(o.openBlock(),o.createElementBlock("div",Zse,[...L[38]||(L[38]=[o.createElementVNode("span",{class:"material-symbols-outlined"}," settings_backup_restore ",-1)])])),po.value?(o.openBlock(),o.createElementBlock("div",$se,[...L[39]||(L[39]=[o.createElementVNode("span",{class:"pbx-relative pbx-flex pbx-size-3"},[o.createElementVNode("span",{class:"pbx-absolute pbx-inline-flex pbx-h-full pbx-w-full pbx-animate-ping pbx-rounded-full pbx-bg-gray-400 pbx-opacity-75"}),o.createElementVNode("span",{class:"pbx-relative pbx-inline-flex pbx-size-3 pbx-rounded-full pbx-bg-green-200"})],-1)])])):o.createCommentVNode("",!0),o.createElementVNode("div",epe,[o.createElementVNode("span",null,o.toDisplayString(o.unref(u)("Reset Page")),1)]),o.createElementVNode("div",tpe,[o.createElementVNode("span",null,o.toDisplayString(o.unref(u)("Reset")),1)])],8,Xse)):o.createCommentVNode("",!0)])]),o.createElementVNode("div",{onClick:L[18]||(L[18]=o.withModifiers(async()=>{await o.unref(t).clearHtmlSelection()},["self"])),class:"pbx-flex-1 pbx-flex pbx-justify-center pbx-items-center pbx-py-2 pbx-w-full"},[o.createElementVNode("div",{onClick:L[17]||(L[17]=o.withModifiers(async()=>{await o.unref(t).clearHtmlSelection()},["self"])),class:"pbx-flex pbx-items-center pbx-justify-center"},[o.createElementVNode("button",{type:"button",class:"pbx-mr-2 pbx-flex pbx-items-center pbx-justify-center pbx-gap-2 pbx-border-0 pbx-bg-transparent pbx-cursor-pointer pbx-font-sans","aria-label":o.unref(u)("Add components"),title:o.unref(u)("Add components"),onClick:L[14]||(L[14]=()=>{o.unref(y).setComponentArrayAddMethod("unshift"),Yo()})},[o.createElementVNode("span",ope,[o.createVNode(pse)]),o.createElementVNode("span",ipe,o.toDisplayString(o.unref(u)("Add")),1)],8,rpe),E.value?(o.openBlock(),o.createElementBlock("button",{key:0,type:"button",class:"pbx-mr-2 pbx-flex pbx-items-center pbx-justify-center pbx-gap-2 pbx-border-0 pbx-bg-transparent pbx-cursor-pointer pbx-font-sans","aria-label":o.unref(u)("Add products"),title:o.unref(u)("Add products"),onClick:pr},[L[40]||(L[40]=o.createElementVNode("span",{class:"pbx-h-10 pbx-w-10 pbx-rounded-full pbx-flex pbx-items-center pbx-border-none pbx-justify-center pbx-bg-gray-50 pbx-aspect-square hover:pbx-bg-myPrimaryLinkColor focus-visible:pbx-ring-0 pbx-text-black hover:pbx-text-white"},[o.createElementVNode("span",{class:"material-symbols-outlined"}," shopping_bag ")],-1)),o.createElementVNode("span",ape,o.toDisplayString(o.unref(u)("Products")),1)],8,npe)):o.createCommentVNode("",!0),o.createElementVNode("button",{type:"button",class:"pbx-mr-2 pbx-flex pbx-items-center pbx-justify-center pbx-gap-2 pbx-border-0 pbx-bg-transparent pbx-cursor-pointer","aria-label":o.unref(u)("Desktop preview"),title:o.unref(u)("Desktop preview"),onClick:L[15]||(L[15]=async()=>{o.unref(y).setMenuRight(!1),o.unref(y).setElement(null),await o.unref(t).clearHtmlSelection(),On()})},[o.createElementVNode("span",spe,[o.createElementVNode("span",null,[(o.openBlock(),o.createElementBlock("svg",ppe,[...L[41]||(L[41]=[o.createElementVNode("path",{"clip-rule":"evenodd",d:"M2 3h18v13h-8v2h3v2H7v-2h3v-2H2V3zm2 2v9h14V5H4z","fill-rule":"evenodd"},null,-1)])]))])])],8,lpe),o.createElementVNode("button",{type:"button",class:"lg:pbx-flex pbx-hidden pbx-items-center pbx-justify-center pbx-mr-2 pbx-border-0 pbx-bg-transparent pbx-cursor-pointer","aria-label":o.unref(u)("Mobile preview"),title:o.unref(u)("Mobile preview"),onClick:L[16]||(L[16]=async()=>{o.unref(y).setMenuRight(!1),o.unref(y).setElement(null),await o.unref(t).clearHtmlSelection(),xc()})},[o.createElementVNode("span",cpe,[(o.openBlock(),o.createElementBlock("svg",bpe,[...L[42]||(L[42]=[o.createElementVNode("path",{d:"M14 16H8v2h6v-2z"},null,-1),o.createElementVNode("path",{d:"M14 1H8a3 3 0 00-3 3v14a3 3 0 003 3h6a3 3 0 003-3V4a3 3 0 00-3-3zM7 4a1 1 0 011-1h6a1 1 0 011 1v14a1 1 0 01-1 1H8a1 1 0 01-1-1V4z"},null,-1)])]))])],8,dpe)])]),o.createElementVNode("div",mpe,[o.createElementVNode("div",{onClick:L[19]||(L[19]=o.withModifiers(async()=>{await o.unref(t).clearHtmlSelection()},["self"])),class:o.normalizeClass(["pbx-flex pbx-items-center pbx-py-2 pbx-w-full",[r.showCloseButton?"pbx-justify-between":"pbx-justify-end"]])},[o.createVNode(zle)],2),r.showPublishButton?(o.openBlock(),o.createElementBlock("div",gpe,[o.createElementVNode("button",{class:"pbx-myPrimaryButton",onClick:L[20]||(L[20]=async()=>{Q()})},o.toDisplayString(o.unref(u)("Publish")),1)])):o.createCommentVNode("",!0),o.unref(t)&&ue.value&&ue.value.userSettings&&ue.value.userSettings.language&&!((re=ue.value.userSettings.language)!=null&&re.disableLanguageDropDown)?(o.openBlock(),o.createElementBlock(o.Fragment,{key:1},[ue.value&&ue.value.userSettings&&ue.value.userSettings.language?(o.openBlock(),o.createElementBlock("div",upe,[o.withDirectives(o.createElementVNode("select",{id:"pbx-lang",class:"pbx-myPrimarySelect pbx-min-w-20","onUpdate:modelValue":L[21]||(L[21]=j=>Se.value=j)},[Array.isArray(ue.value.userSettings.language.enable)&&ue.value.userSettings.language.enable.length>=1?(o.openBlock(!0),o.createElementBlock(o.Fragment,{key:0},o.renderList(o.unref(t).availableLanguage().filter(j=>{var we,Xe,Di,Hr;return((Hr=(Di=(Xe=(we=ue.value)==null?void 0:we.userSettings)==null?void 0:Xe.language)==null?void 0:Di.enable)==null?void 0:Hr.includes(j))??!1}),j=>(o.openBlock(),o.createElementBlock("option",{key:j,value:j},o.toDisplayString(j),9,xpe))),128)):o.createCommentVNode("",!0),!ue.value.userSettings.language.enable||Array.isArray(ue.value.userSettings.language.enable)&&ue.value.userSettings.language.enable.length===0?(o.openBlock(!0),o.createElementBlock(o.Fragment,{key:1},o.renderList(o.unref(t).availableLanguage(),j=>(o.openBlock(),o.createElementBlock("option",{key:j,value:j},o.toDisplayString(j),9,hpe))),128)):o.createCommentVNode("",!0)],512),[[o.vModelSelect,Se.value]])])):o.createCommentVNode("",!0)],64)):o.createCommentVNode("",!0),r.showCloseButton?(o.openBlock(),o.createElementBlock("div",fpe,[o.createElementVNode("button",{type:"button",class:"pbx-h-10 pbx-w-10 pbx-flex-end pbx-cursor-pointer pbx-rounded-full pbx-flex pbx-items-center pbx-border-none pbx-justify-center pbx-bg-gray-50 pbx-aspect-square hover:pbx-bg-myPrimaryLinkColor hover:pbx-text-white hover:pbx-fill-white focus-visible:pbx-ring-0","aria-label":o.unref(u)("Close Page Builder"),onClick:L[22]||(L[22]=async()=>{q(),await o.unref(t).clearHtmlSelection()})},[...L[43]||(L[43]=[o.createElementVNode("span",{class:"material-symbols-outlined","aria-hidden":"true"}," close ",-1)])],8,ype)])):o.createCommentVNode("",!0)])]),o.createElementVNode("div",wpe,[o.createElementVNode("main",{ref_key:"pbxBuilderWrapper",ref:tr,id:"page-builder-wrapper",class:o.normalizeClass(["pbx-transition-all pbx-duration-300 pbx-p-1 pbx-flex pbx-flex-col pbx-grow pbx-rounded-tr-2xl pbx-rounded-tl-2xl pbx-border-solid pbx-border pbx-border-gray-200 pbx-items-stretch pbx-text-black pbx-h-[100vh] pbx-overflow-y-scroll pbx-relative pbx-pt-16",[(ge.value,"pbx-w-full")]]),style:o.normalizeStyle(J.value)},[o.createElementVNode("div",vpe,[$t.value?(o.openBlock(),o.createBlock(EQ,{key:0,ref_key:"selectedElementToolbarRef",ref:dr,"toolbar-pinned":ho.value,onOpenImageSettings:Jn,onToggleToolbarPin:Ce},null,8,["toolbar-pinned"])):o.createCommentVNode("",!0)]),o.createElementVNode("div",{id:"pagebuilder",ref_key:"pageBuilderCanvas",ref:Ss,"data-builder-canvas":"",class:o.normalizeClass([Z.value,"pbx-text-black",Qe.value]),style:o.normalizeStyle(W.value?W.value:void 0),onDblclickCapture:xs},[Array.isArray(er.value)&&er.value.length===0?(o.openBlock(),o.createElementBlock("div",kpe,[o.createElementVNode("div",Spe,[o.createElementVNode("div",{onClick:L[23]||(L[23]=j=>Zt(0)),class:"pbx-py-4 pbx-px-4 pbx-my-4 pbx-rounded-full pbx-bg-gray-100 pbx-text-gray-600 pbx-flex pbx-items-center pbx-justify-center hover:pbx-text-white hover:pbx-bg-gray-900 pbx-cursor-pointer"},[o.createElementVNode("div",Cpe,[o.createElementVNode("span",Tpe,o.toDisplayString(o.unref(u)("Add new Components")),1)])]),E.value?(o.openBlock(),o.createElementBlock("div",{key:0,onClick:L[24]||(L[24]=j=>Fn(0)),class:"pbx-py-4 pbx-px-4 pbx-my-4 pbx-rounded-full pbx-bg-gray-100 pbx-text-gray-600 pbx-flex pbx-items-center pbx-justify-center hover:pbx-text-white hover:pbx-bg-gray-900 pbx-cursor-pointer"},[o.createElementVNode("div",Epe,[L[44]||(L[44]=o.createElementVNode("span",{class:"material-symbols-outlined"},"shopping_bag",-1)),o.createElementVNode("span",Mpe,o.toDisplayString(o.unref(u)("Products")),1)])])):o.createCommentVNode("",!0)])])):o.createCommentVNode("",!0),Array.isArray(er.value)&&er.value.length!=0?(o.openBlock(),o.createElementBlock("div",Ppe,[o.createElementVNode("div",Bpe,[o.createElementVNode("div",Lpe,[o.createElementVNode("div",{onClick:L[25]||(L[25]=j=>Zt(0)),class:"pbx-select-none pbx-addsection-btn pbx-font-sans pbx-rounded-l-full pbx-rounded-r-none pbx-bg-gray-100 pbx-text-gray-600 pbx-z-50 pbx-flex pbx-items-center pbx-justify-center hover:pbx-text-white hover:pbx-bg-gray-900 pbx-cursor-pointer"},[o.createElementVNode("div",Npe,[L[45]||(L[45]=o.createElementVNode("span",{class:"material-symbols-outlined"}," add ",-1)),o.createElementVNode("span",Ape,o.toDisplayString(o.unref(u)("Add")),1)])]),E.value?(o.openBlock(),o.createElementBlock("div",{key:0,onClick:L[26]||(L[26]=j=>Fn(0)),class:"pbx-select-none pbx-addsection-btn pbx-font-sans pbx-rounded-l-none pbx-bg-gray-100 pbx-text-gray-600 pbx-z-50 pbx-flex pbx-items-center pbx-justify-center hover:pbx-text-white hover:pbx-bg-gray-900 pbx-cursor-pointer pbx-border-l pbx-border-gray-200"},[o.createElementVNode("div",_pe,[L[46]||(L[46]=o.createElementVNode("span",{class:"material-symbols-outlined"}," shopping_bag ",-1)),o.createCommentVNode("",!0)])])):o.createCommentVNode("",!0)])])])):o.createCommentVNode("",!0),(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(er.value,(j,we)=>(o.openBlock(),o.createElementBlock(o.Fragment,{key:j.id},[j.html_code?(o.openBlock(),o.createElementBlock("div",{key:0,"data-pagebuilder-content":"",innerHTML:j.html_code,onMouseup:Xe=>us(j)},null,40,Dpe)):o.createCommentVNode("",!0),Array.isArray(er.value)&&er.value.length!=0?(o.openBlock(),o.createElementBlock("div",zpe,[o.createElementVNode("div",Ipe,[o.createElementVNode("div",Vpe,[o.createElementVNode("div",{onClick:Xe=>Zt(we+1),class:"pbx-select-none pbx-addsection-btn pbx-font-sans pbx-rounded-l-full pbx-rounded-r-none pbx-bg-gray-100 pbx-text-gray-600 pbx-z-50 pbx-flex pbx-items-center pbx-justify-center hover:pbx-text-white hover:pbx-bg-gray-900 pbx-cursor-pointer"},[o.createElementVNode("div",Rpe,[L[47]||(L[47]=o.createElementVNode("span",{class:"material-symbols-outlined"}," add ",-1)),o.createElementVNode("span",Ope,o.toDisplayString(o.unref(u)("Add")),1)])],8,Hpe),E.value?(o.openBlock(),o.createElementBlock("div",{key:0,onClick:Xe=>Fn(we+1),class:"pbx-select-none pbx-addsection-btn pbx-font-sans pbx-rounded-l-none pbx-bg-gray-100 pbx-text-gray-600 pbx-z-50 pbx-flex pbx-items-center pbx-justify-center hover:pbx-text-white hover:pbx-bg-gray-900 pbx-cursor-pointer pbx-border-l pbx-border-gray-200"},[o.createElementVNode("div",jpe,[L[48]||(L[48]=o.createElementVNode("span",{class:"material-symbols-outlined"}," shopping_bag ",-1)),o.createCommentVNode("",!0)])],8,Fpe)):o.createCommentVNode("",!0)])])])):o.createCommentVNode("",!0)],64))),128))],38)],6),o.createVNode(o.Transition,{name:"slide-right",appear:"",mode:"out-in"},{default:o.withCtx(()=>[ge.value?(o.openBlock(),o.createElementBlock("aside",{key:0,"aria-label":"menu",id:"pagebuilder-right-menu",class:o.normalizeClass(["pbx-z-20 pbx-flex-shrink-0 pbx-overflow-hidden pbx-border-0 pbx-border-solid pbx-border-l-0 pbx-border-l-gray-600 pbx-rounded-l-2xl pbx-h-[100vh]",[ge.value?"pbx-w-96 pbx-bg-myPrimaryLightGrayColor pbx-items-stretch":"pbx-w-0 pbx-mr-0"]])},[o.createVNode(Mle,{onCloseEditor:L[27]||(L[27]=j=>o.unref(y).setMenuRight(!1))})],2)):(o.openBlock(),o.createElementBlock("div",{key:1,onClick:L[30]||(L[30]=o.withModifiers(async()=>{await o.unref(t).clearHtmlSelection()},["self"])),class:"pbx-w-18 pbx-bg-myPrimaryLightGrayColor pbx-pt-5 pbx-z-20 pbx-flex-shrink-0 pbx-overflow-hidden pbx-border-0 pbx-border-solid pbx-border-l-0 pbx-border-l-gray-600 pbx-rounded-l-2xl pbx-h-[100vh] pbx-pl-2 pbx-pr-2"},[o.createElementVNode("div",{onClick:L[29]||(L[29]=o.withModifiers(async()=>{await o.unref(t).clearHtmlSelection()},["self"])),class:"pbx-flex pbx-flex-col pbx-items-center pbx-justify-center pbx-gap-2"},[ge.value?o.createCommentVNode("",!0):(o.openBlock(),o.createElementBlock("button",{key:0,onClick:L[28]||(L[28]=j=>o.unref(y).setMenuRight(!0)),type:"button",class:"pbx-h-10 pbx-w-10 pbx-cursor-pointer pbx-rounded-full pbx-flex pbx-items-center pbx-border-none pbx-justify-center pbx-bg-gray-50 pbx-aspect-square hover:pbx-bg-myPrimaryLinkColor focus-visible:pbx-ring-0 pbx-text-black hover:pbx-text-white"},[o.createElementVNode("span",null,[(o.openBlock(),o.createElementBlock("svg",qpe,[...L[49]||(L[49]=[o.createElementVNode("g",{"clip-path":"url(#prefix__clip0_1645_485)"},[o.createElementVNode("path",{"clip-rule":"evenodd",d:"M19.871 1.81a2.768 2.768 0 00-3.914 0l-3.543 3.544-2.5-2.5L0 12.768l8.914 8.914 9.914-9.914-2.5-2.5 3.543-3.543a2.768 2.768 0 000-3.914zm-2.5 1.415a.768.768 0 011.086 1.086L13.5 9.268l2.5 2.5-1.086 1.086-6.086-6.086 1.086-1.086 2.5 2.5 4.957-4.957zM7.414 8.182l-4.586 4.586 1.086 1.086 3.293-3.293 1.414 1.414-3.293 3.293 1.086 1.086 3.293-3.293 1.414 1.414-3.293 3.293 1.086 1.086 4.586-4.586-6.086-6.086z","fill-rule":"evenodd"})],-1),o.createElementVNode("defs",null,[o.createElementVNode("clipPath",{id:"prefix__clip0_1645_485"},[o.createElementVNode("path",{d:"M0 0h22v22H0z",fill:"#fff"})])],-1)])]))])]))])]))]),_:1})])]),o.createVNode(Tz,{title:o.unref(u)("Image Settings"),showSidebarPanel:br.value,position:"left",onCloseSidebarPanel:xo},{default:o.withCtx(()=>[o.createVNode(rse,{show:br.value},null,8,["show"])]),_:1},8,["title","showSidebarPanel"]),o.createVNode(zse,{show:o.unref(s),title:o.unref(p),html:o.unref(d),"is-loading":o.unref(c),error:o.unref(b),"onUpdate:html":L[31]||(L[31]=j=>d.value=j),onClose:o.unref(m),onSave:o.unref(g)},null,8,["show","title","html","is-loading","error","onClose","onSave"]),o.createVNode(wse,{show:o.unref(i),title:o.unref(n),html:o.unref(a),onClose:o.unref(l)},null,8,["show","title","html","onClose"]),o.createVNode(Rse)],64)}}});class Li{static getHistory(e){const t=e+this.HISTORY_KEY_SUFFIX,i=localStorage.getItem(t);return i?JSON.parse(i):[]}static addToHistory(e,t){const i=e+this.HISTORY_KEY_SUFFIX;let n=this.getHistory(e);n.push(t),n.length>this.MAX_HISTORY_SIZE&&(n=n.slice(n.length-this.MAX_HISTORY_SIZE)),localStorage.setItem(i,JSON.stringify(n))}static clearHistory(e){const t=e+this.HISTORY_KEY_SUFFIX;localStorage.removeItem(t)}}be(Li,"HISTORY_KEY_SUFFIX","-history"),be(Li,"MAX_HISTORY_SIZE",10);const cc={objectFit:["none","pbx-object-cover","pbx-object-contain"],objectPosition:["none","pbx-object-top-left","pbx-object-top","pbx-object-top-right","pbx-object-left","pbx-object-center","pbx-object-right","pbx-object-bottom-left","pbx-object-bottom","pbx-object-bottom-right"],aspectRatio:["none","pbx-aspect-square","pbx-aspect-video","pbx-aspect-[9/16]"]},rt=[];for(let r=0;r<256;++r)rt.push((r+256).toString(16).slice(1));function Wpe(r,e=0){return(rt[r[e+0]]+rt[r[e+1]]+rt[r[e+2]]+rt[r[e+3]]+"-"+rt[r[e+4]]+rt[r[e+5]]+"-"+rt[r[e+6]]+rt[r[e+7]]+"-"+rt[r[e+8]]+rt[r[e+9]]+"-"+rt[r[e+10]]+rt[r[e+11]]+rt[r[e+12]]+rt[r[e+13]]+rt[r[e+14]]+rt[r[e+15]]).toLowerCase()}const Gpe=new Uint8Array(16);function Kpe(){return crypto.getRandomValues(Gpe)}function Dz(r,e,t){return crypto.randomUUID?crypto.randomUUID():Jpe(r)}function Jpe(r,e,t){var n;r=r||{};const i=r.random??((n=r.rng)==null?void 0:n.call(r))??Kpe();if(i.length<16)throw new Error("Random bytes length must be >= 16");return i[6]=i[6]&15|64,i[8]=i[8]&63|128,Wpe(i)}function ot(r){return r.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}const bc="hidden",Ype=new Set(["id","title","description","image","imageAlt","price","compareAtPrice","badge","url","buttonText","sku"]);function Qpe(r){return r?' target="_blank" rel="noopener noreferrer"':""}function Xpe(r,e={},t=!1){const i=e.cardStyle??"minimal",n=e.roundedImages??!1,a=e.openInNewTab??!1,l=e.buttonStyle??"text",s=e.roundedButtons??!1,p=e.hidePrice??!1,d=e.hideImage??!1,c=e.hideButton??!1,b=Qpe(a),m=$l[i]??$l.minimal,g=[oz(n),d?bc:""].filter(Boolean).join(" "),x=r.id!=null?String(r.id):"",u=r.title?ot(r.title):"",h=r.description?ot(r.description):"",f=r.price!=null?ot(String(r.price)):"",w=r.compareAtPrice!=null?ot(String(r.compareAtPrice)):"",y=r.badge?ot(r.badge):"",E=r.image?ot(r.image):"",S=r.imageAlt?ot(r.imageAlt):u||"Product",P=r.url?ot(r.url):"",v=r.buttonText?ot(r.buttonText):"";let M="";if(E){const D=`<img class="object-cover w-full object-top aspect-square " src="${E}" alt="${S}">`;M=P?`<div class="${g}" data-pb-no-inline-text><a href="${P}"${b}>${D}</a></div>`:`<div class="${g}" data-pb-no-inline-text>${D}</div>`}const C=y?`<div class="product-card-badge text-xs font-medium uppercase tracking-wide text-gray-500 pt-2"><p>${y}</p></div>`:t?'<div class="product-card-badge text-xs font-medium uppercase tracking-wide text-gray-500 pt-2 min-h-6"></div>':"",k=u?`<div class="product-card-title text-lg font-semibold text-gray-900 pt-2 min-h-16">${P?`<p><a href="${P}"${b}>${u}</a></p>`:`<p>${u}</p>`}</div>`:"",T=h?`<div class="product-card-description text-sm text-gray-600 pt-1"><p>${h}</p></div>`:"",V=Object.entries(r).filter(([D,q])=>!Ype.has(D)&&q!=null&&String(q).trim()!==""),N=V.length?`<div class="product-card-custom-fields text-sm text-gray-600 pt-1">${V.map(([D,q])=>`<div class="product-card-custom-field product-card-custom-field-${D.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")}"><p><strong>${ot(D)}</strong>: ${ot(String(q))}</p></div>`).join("")}</div>`:"";let A="";if(!!(f||w||P&&v)){let D="";if(f||w){const Q=[w?`<div class="product-card-compare text-sm line-through text-gray-400"><p>${w}</p></div>`:"",f?`<div class="product-card-price text-2xl font-semibold text-gray-900"><p>${f}</p></div>`:""].filter(Boolean);D=`<div class="${["product-card-price-row flex flex-wrap items-baseline gap-2 pt-2",p?bc:""].filter(Boolean).join(" ")}">${Q.join("")}</div>`}const q=iz(l,s),Y=P&&v?`<div class="product-card-cta text-sm font-semibold text-myPrimaryLinkColor pt-3${c?` ${bc}`:""}"><p><a class="${q}" href="${P}"${b}>${v}</a></p></div>`:"";A=`<div class="product-card-footer mt-auto flex flex-col">${D}${Y}</div>`}return[`<div class="${m}" data-pbx-product-id="${ot(x)}">`,M,'<div class="break-words py-2 product-card-body text-gray-900 flex flex-col flex-1">','<div class="product-card-meta flex flex-col flex-1">',C,k,T,N,"</div>",A,"</div></div>"].filter(Boolean).join(`
407
+ `).filter(d=>d.trim().length>0).length:0);function s(d){i("update:html",d.target.value)}async function p(){if(!t.html)return;await pc(t.html)&&(a.value=!0,globalThis.setTimeout(()=>{a.value=!1},2e3))}return(d,c)=>(o.openBlock(),o.createBlock(At,{showModalBuilder:r.show,title:r.title,maxWidth:"7xl","z-index":10001,onCloseMainModalBuilder:c[2]||(c[2]=b=>d.$emit("close"))},{actions:o.withCtx(()=>[o.createElementVNode("button",{type:"button",class:"pbx-mySecondaryButton",disabled:r.isLoading,onClick:c[0]||(c[0]=b=>d.$emit("close"))},o.toDisplayString(o.unref(n)("Close")),9,Nse),r.readOnly?o.createCommentVNode("",!0):(o.openBlock(),o.createElementBlock("button",{key:0,type:"button",class:"pbx-myPrimaryButton",disabled:r.isLoading,onClick:c[1]||(c[1]=b=>d.$emit("save"))},[o.createTextVNode(o.toDisplayString(o.unref(n)("Save"))+" ",1),r.isLoading?o.createCommentVNode("",!0):(o.openBlock(),o.createElementBlock("span",_se,"check")),r.isLoading?(o.openBlock(),o.createElementBlock("span",Dse,"refresh")):o.createCommentVNode("",!0)],8,Ase))]),default:o.withCtx(()=>[o.createElementVNode("div",null,[r.html?(o.openBlock(),o.createElementBlock("div",kse,[o.createElementVNode("div",Sse,[o.createElementVNode("div",Cse,[o.createElementVNode("span",Tse,o.toDisplayString(r.badge),1),o.createElementVNode("span",Ese,o.toDisplayString(l.value)+" "+o.toDisplayString(o.unref(n)("lines")),1),o.createElementVNode("span",Mse,o.toDisplayString(r.readOnly?o.unref(n)("Read-only"):o.unref(n)("Editable")),1)]),o.createElementVNode("button",{type:"button",class:"pbx-htmlCodeViewerCopy",onClick:p},[o.createElementVNode("span",Pse,o.toDisplayString(a.value?"check":"content_copy"),1)])]),o.createElementVNode("div",Bse,[o.createElementVNode("textarea",{id:"html-editor",class:"pbx-htmlCodeEditorTextarea",value:r.html,"aria-label":r.title,readonly:r.readOnly,spellcheck:"false",onInput:s},null,40,Lse)])])):(o.openBlock(),o.createElementBlock("p",vse,o.toDisplayString(o.unref(n)("No HTML available")),1))])]),_:1},8,["showModalBuilder","title"]))}}),Ise={class:"pbx-pointer-events-none pbx-fixed pbx-right-6 pbx-top-6 pbx-z-[10010] pbx-flex pbx-flex-col pbx-items-end pbx-gap-3","aria-live":"polite","aria-relevant":"additions removals"},Vse={class:"pbx-font-sans pbx-toastMessage"},Hse=["onClick"],Rse=qo(o.defineComponent({__name:"ToastContainer",setup(r){const{toasts:e,hideToast:t}=tt(),i={success:"pbx-toastSuccess",error:"pbx-toastError",warning:"pbx-toastWarning"};return(n,a)=>(o.openBlock(),o.createElementBlock("div",Ise,[o.createVNode(o.TransitionGroup,{name:"pbx-toast",tag:"div",class:"pbx-flex pbx-flex-col pbx-gap-2"},{default:o.withCtx(()=>[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(o.unref(e),l=>(o.openBlock(),o.createElementBlock("div",{key:l.id,class:o.normalizeClass(["pbx-toast",i[l.type]]),role:"status"},[o.createElementVNode("span",Vse,o.toDisplayString(l.message),1),o.createElementVNode("button",{type:"button",class:"pbx-toastClose","aria-label":"Close",onClick:s=>o.unref(t)(l.id)},[...a[0]||(a[0]=[o.createElementVNode("span",{class:"material-symbols-outlined pbx-materialIcon18","aria-hidden":"true"}," close_small ",-1)])],8,Hse)],2))),128))]),_:1})]))}}),[["__scopeId","data-v-7948f981"]]);function Ose(r){return r instanceof HTMLElement?!!r.closest('input, textarea, select, [contenteditable="true"], .pbx-inline-tiptap-editor, .ProseMirror'):!1}function Fse(r){const e=t=>{if(r.isBlocked()||Ose(t.target))return;const i=t.metaKey||t.ctrlKey;if(i&&t.key.toLowerCase()==="z"&&!t.shiftKey){t.preventDefault(),r.canUndo()&&r.onUndo();return}if(i&&t.shiftKey&&t.key.toLowerCase()==="z"||i&&t.key.toLowerCase()==="y"){t.preventDefault(),r.canRedo()&&r.onRedo();return}if(i&&t.key.toLowerCase()==="s"){t.preventDefault(),r.onSave();return}if(t.key==="Escape"){r.onDeselect();return}(t.key==="Delete"||t.key==="Backspace")&&r.hasSelection()&&(t.preventDefault(),r.onDelete())};o.onMounted(()=>{document.addEventListener("keydown",e)}),o.onBeforeUnmount(()=>{document.removeEventListener("keydown",e)})}const Lz="--pbx-brand-color",Nz="--pbx-brand-color-rgb";function Az(r){return r!=null&&r.trim()?Kt(r)??r.trim():null}function jse(r){const e=Az(r);if(!e)return null;const t=JD(e);return t?`${t.r} ${t.g} ${t.b}`:null}function qse(r){if(typeof document>"u")return;const e=Az(r),t=jse(r);if(e&&t){document.documentElement.style.setProperty(Lz,e),document.documentElement.style.setProperty(Nz,t);return}_z()}function _z(){typeof document>"u"||(document.documentElement.style.removeProperty(Lz),document.documentElement.style.removeProperty(Nz))}const Use={class:"lg:pbx-min-w-full lg:pbx-max-w-full lg:pbx-w-full pbx-mx-auto pbx-flex pbx-flex-col pbx-font-sans pbx-text-black pbx-border-solid pbx-border pbx-border-gray-400 pbx-inset-x-0 pbx-z-10 pbx-bg-white pbx-overflow-x-auto pbx-h-full"},Wse={id:"pagebuilder-navbar",class:"lg:pbx-min-w-full lg:pbx-max-w-full lg:pbx-w-full pbx-min-w-[64rem] pbx-max-w-[64rem] pbx-w-[64rem] pbx-flex-1 pbx-bg-myPrimaryLightGrayColor pbx-flex pbx-items-center pbx-justify-between pbx-border-0 pbx-border-solid pbx-border-b pbx-border-gray-200 pbx-mb-2 pbx-font-sans pbx-min-h-20"},Gse=["src"],Kse={class:"pbx-flex pbx-items-center pbx-justify-center"},Jse=["disabled","aria-label","title"],Yse={key:0,class:"pbx-h-10 pbx-w-4 pbx-cursor-pointer pbx-rounded-full pbx-flex pbx-items-center pbx-justify-center"},Qse={key:1,class:"pbx-h-10 pbx-w-4 pbx-cursor-pointer pbx-rounded-full pbx-flex pbx-items-center pbx-justify-center"},Xse=["disabled","aria-label"],Zse={key:0,class:"pbx-h-10 pbx-w-4 pbx-cursor-pointer pbx-rounded-full pbx-flex pbx-items-center pbx-justify-center"},$se={key:1,class:"pbx-h-10 pbx-w-4 pbx-cursor-pointer pbx-rounded-full pbx-flex pbx-items-center pbx-justify-center"},epe={class:"lg:pbx-block pbx-hidden"},tpe={class:"lg:pbx-hidden pbx-block"},rpe=["aria-label","title"],ope={class:"pbx-h-10 pbx-w-10 pbx-rounded-full pbx-flex pbx-items-center pbx-border-none pbx-justify-center pbx-bg-gray-50 pbx-aspect-square hover:pbx-bg-myPrimaryLinkColor focus-visible:pbx-ring-0 pbx-text-black hover:pbx-text-white"},ipe={class:"lg:pbx-block lg:pbx-pr-4 pbx-hidden"},npe=["aria-label","title"],ape={class:"lg:pbx-block lg:pbx-pr-4 pbx-hidden"},lpe=["aria-label","title"],spe={class:"pbx-h-10 pbx-w-10 pbx-rounded-full pbx-flex pbx-items-center pbx-border-none pbx-justify-center pbx-bg-gray-50 pbx-aspect-square hover:pbx-bg-myPrimaryLinkColor focus-visible:pbx-ring-0 pbx-text-black hover:pbx-text-white"},ppe={fill:"currentColor",height:"22",viewBox:"0 0 22 22",width:"22",xmlns:"http://www.w3.org/2000/svg",style:{display:"block"},"aria-hidden":"true"},dpe=["aria-label","title"],cpe={class:"pbx-h-10 pbx-w-10 pbx-rounded-full pbx-flex pbx-items-center pbx-border-none pbx-justify-center pbx-bg-gray-50 pbx-aspect-square hover:pbx-bg-myPrimaryLinkColor focus-visible:pbx-ring-0 pbx-text-black hover:pbx-text-white"},bpe={fill:"currentColor",height:"22",viewBox:"0 0 22 22",width:"22",xmlns:"http://www.w3.org/2000/svg",style:{display:"block"},"aria-hidden":"true"},mpe={class:"pbx-flex-1 pbx-flex gap-2 pbx-items-center pbx-justify-end"},gpe={key:0,class:"pbx-flex-1 pbx-ml-2"},upe={key:0,class:"pbx-flex-1 pbx-flex pbx-justify-end pbx-items-center pbx-ml-2 lg:pbx-mr-4 pbx-mr-2"},xpe=["value"],hpe=["value"],fpe={key:2,class:"pbx-flex-1 pbx-ml-2 pbx-mr-2"},ype=["aria-label"],wpe={id:"pagebuilder-main",class:"lg:pbx-min-w-full lg:pbx-max-w-full lg:pbx-w-full pbx-min-w-[64rem] pbx-max-w-[64rem] pbx-w-[64rem] pbx-flex-1 pbx-relative pbx-h-full pbx-flex pbx-pb-2 pbx-gap-2"},vpe={id:"pbxEditToolbar",class:"pbx-z-30 pbx-flex pbx-flex-wrap pbx-gap-x-2 pbx-gap-y-1 pbx-justify-start pbx-items-center pbx-content-start pbx-rounded-sm pbx-px-2 pbx-py-0 pbx-h-0 pbx-relative pbx-box-border"},kpe={key:0,"data-pbx-insert-btn":"","data-pb-no-select":""},Spe={class:"pbx-flex pbx-justify-center pbx-w-full pbx-absolute pbx-items-center pbx-gap-3"},Cpe={class:"pbx-flex pbx-items-center pbx-gap-2"},Tpe={class:"pbx-font-medium pbx-break-words lg:pbx-text-lg md:pbx-text-lg pbx-text-base pbx-font-sans"},Epe={class:"pbx-flex pbx-items-center pbx-gap-2"},Mpe={class:"pbx-font-medium pbx-break-words lg:pbx-text-lg md:pbx-text-lg pbx-text-base pbx-font-sans"},Ppe={key:1,"data-pbx-insert-btn":"","data-pb-no-select":""},Bpe={class:"pbx-flex pbx-justify-end pbx-w-full pbx-h-0 pbx-items-center pbx-rounded-r-full pbx-z-10"},Lpe={class:"pbx-flex pbx-items-center"},Npe={class:"pbx-flex pbx-items-center"},Ape={class:"lg:pbx-block pbx-hidden"},_pe={class:"pbx-flex pbx-items-center"},Dpe=["innerHTML","onMouseup"],zpe={key:1,"data-pbx-insert-btn":"","data-pb-no-select":""},Ipe={class:"pbx-flex pbx-justify-end pbx-w-full pbx-h-0 pbx-items-center pbx-rounded-r-full pbx-z-10"},Vpe={class:"pbx-flex pbx-items-center"},Hpe=["onClick"],Rpe={class:"pbx-flex pbx-items-center"},Ope={class:"lg:pbx-block pbx-hidden"},Fpe=["onClick"],jpe={class:"pbx-flex pbx-items-center"},qpe={fill:"currentColor",height:"22",viewBox:"0 0 22 22",width:"22",xmlns:"http://www.w3.org/2000/svg",style:{display:"block"}},Upe=o.defineComponent({__name:"PageBuilder",props:{CustomMediaLibraryComponent:{type:Object,default:null},DisplayProducts:{type:Object,default:null},enableDefaultProducts:{type:Boolean,default:!0},CustomBuilderComponents:{type:Object,default:null},showCloseButton:{type:Boolean,default:!1},showPublishButton:{type:Boolean,default:!1}},emits:["handleClosePageBuilder","handlePublishPageBuilder"],setup(r,{emit:e}){const t=ke(),{show:i,title:n,html:a,closeHtmlViewer:l}=is(),{show:s,title:p,html:d,isLoading:c,error:b,closeHtmlEditor:m,saveHtmlEditor:g}=ls(),x=r,{translate:u,loadTranslations:h}=ne(),{showToast:f}=tt(),w=zd,y=fe;o.provide("pageBuilderStateStore",y),o.provide("internalPinia",w),o.provide("CustomMediaComponent",x.CustomMediaLibraryComponent),o.provide("DisplayProductsComponent",x.DisplayProducts),o.provide("CustomBuilderComponents",x.CustomBuilderComponents);const E=o.computed(()=>!!x.DisplayProducts||x.enableDefaultProducts),S=e,P=o.ref(1),v=o.ref(""),M=o.ref(!1),C=o.ref(""),k=o.ref(""),T=o.ref(""),V=o.ref(null),N=o.ref(null),A=o.ref(null),I=o.ref(null),D=o.ref(null),q=async function(){v.value="warning",M.value=!0,C.value=u("Continue Your Work?"),k.value=u("Are you sure you want to close the Page Builder? All unsaved changes will be lost."),T.value=null,V.value=u("Close Page Builder"),N.value=null,A.value=async function(){M.value=!1},I.value=function(){Y()},D.value=async function(){}},Y=function(){M.value=!1,S("handleClosePageBuilder")},Q=async function(){y.setIsLoadingGlobal(!0);try{await t.handleManualSave(),f(u("Page saved successfully"),"success")}catch{f(u("Could not save page"),"error")}y.setIsLoadingGlobal(!1),S("handlePublishPageBuilder")};async function F(){try{await t.handleManualSave(),f(u("Page saved successfully"),"success")}catch{f(u("Could not save page"),"error")}}const le=()=>{Qt.value=!1};o.provide("closeAddComponentModal",le);const Se=o.ref("en");let kt=!0;const Ye=o.ref(!1);o.watch(Se,async _=>{if(_&&!kt){Ye.value=!0,await Oe(200),await h(_),t.changeLanguage(_);const L=JSON.parse(localStorage.getItem("userSettingsPageBuilder")??"{}")||{};L.lang=_,localStorage.setItem("userSettingsPageBuilder",JSON.stringify(L)),Ye.value=!1}});const ct=o.computed(()=>y.getBuilderStarted),ue=o.computed(()=>y.getPageBuilderConfig),oe=o.computed(()=>{var _;return dD((_=ue.value)==null?void 0:_.userSettings)}),Z=o.computed(()=>{var Xe;const _=(Xe=ue.value)==null?void 0:Xe.userSettings,L=y.getToggleGlobalHtmlMode,re=y.getFontFamily;if(L&&re&&re!=="none")return re;const j=document.getElementById("pagebuilder"),we=j?cD(j,_):void 0;return we&&Od(j,_,{globalPageDesignMode:L,selectedFontClass:re})?we:oe.value}),K=o.computed(()=>{var re;const _=(re=ue.value)==null?void 0:re.userSettings,L=document.getElementById("pagebuilder");return Od(L,_,{globalPageDesignMode:y.getToggleGlobalHtmlMode,selectedFontClass:y.getFontFamily})}),X=o.computed(()=>{var _;return HU((_=ue.value)==null?void 0:_.userSettings)}),J=o.computed(()=>{var j,we;if(K.value)return{};const _=(we=(j=ue.value)==null?void 0:j.userSettings)==null?void 0:we.elementFonts;if(!_)return{};const L={},re=["h1","h2","h3","h4","h5","h6","p"];for(const Xe of re){const Di=_[Xe];if(Di){const Hr=jd(Di);Hr&&(L[`--pbx-el-${Xe}-font`]=Hr)}}return L}),R=o.computed(()=>{var _;return(_=ue.value)==null?void 0:_.pageSettings}),Qe=o.computed(()=>{var L;const _=(L=R.value)==null?void 0:L.classes;return!_||typeof _!="string"?"":_}),W=o.computed(()=>{var L;const _=(L=R.value)==null?void 0:L.style;return _?typeof _=="string"?_:Object.entries(_).map(([re,j])=>`${re.replace(/([A-Z])/g,"-$1").toLowerCase()}: ${j};`).join(" "):""});o.watch(()=>{var _,L;return(L=(_=ue.value)==null?void 0:_.settings)==null?void 0:L.brandColor},_=>{qse(_)},{immediate:!0});const H=o.computed(()=>y.getCurrentLanguage);o.watch(H,_=>{_&&_!==Se.value&&(Se.value=_)});const ge=o.computed(()=>y.getMenuRight),xe=o.ref(!1),bt=o.ref(""),St=o.ref(""),Pr=function(){localStorage.setItem("preview-font-class",Z.value),localStorage.setItem("preview-element-fonts",JSON.stringify(K.value?{}:J.value))},Br=function(){t.previewCurrentDesign(),Pr()},On=function(){bt.value=u("Preview"),Br(),xe.value=!0},Lr=o.ref(!1),cs=function(){t.previewCurrentDesign(),Pr()},xc=function(){St.value=u("Mobile"),cs(),Lr.value=!0},Go=o.ref(!1),hc=function(){Go.value=!1},bs=function(){xe.value=!1},Ft=function(){Lr.value=!1},Qt=o.ref(!1),Ko=o.ref(""),Jo=o.ref(""),Nr=o.ref(null),Yo=async function(){await t.clearHtmlSelection(),Ko.value=u("Add Components to Page"),Jo.value=u("Close"),Qt.value=!0,Nr.value=function(){Qt.value=!1}},Xt=o.ref(!1),ao=o.ref(""),pr=async function(){await t.clearHtmlSelection(),y.setAddComponentAddIndex(null),y.setComponentArrayAddMethod("unshift"),ao.value=u("Add Products to Page"),Xt.value=!0},Ar=()=>{Xt.value=!1},Zt=function(_){y.setAddComponentAddIndex(_),y.setComponentArrayAddMethod("insert"),Yo()},Fn=async function(_){await t.clearHtmlSelection(),y.setAddComponentAddIndex(_),y.setComponentArrayAddMethod("insert"),ao.value=u("Add Products to Page"),Xt.value=!0},$t=o.computed(()=>y.getElement),er=o.computed(()=>y.getComponents),jn=o.computed(()=>y.getHasLocalDraftForUpdate);o.watch(jn,_=>{_&&Zo()});const ms=o.computed(()=>!$t.value||!($t.value instanceof HTMLElement)?null:{src:$t.value.getAttribute("src"),href:$t.value.getAttribute("href"),style:$t.value.getAttribute("style"),class:$t.value.getAttribute("class"),dataImage:$t.value.getAttribute("data-image")}),gs=Ile();o.watch(ms,async(_,L)=>{((_==null?void 0:_.src)!==(L==null?void 0:L.src)||(_==null?void 0:_.href)!==(L==null?void 0:L.href)||(_==null?void 0:_.style)!==(L==null?void 0:L.style)||(_==null?void 0:_.class)!==(L==null?void 0:L.class)||(_==null?void 0:_.dataImage)!==(L==null?void 0:L.dataImage))&&gs(async()=>{await t.initializeElementStyles()},200)});const us=function(_){y.getInlineTipTapEditor||y.setComponent(_)},xs=async function(_){await t.openInlineTipTapFromEvent(_)},hs=function(_){if(!y.getInlineTipTapEditor||!(_.target instanceof Node))return;const L=document.querySelector("#pagebuilder [data-pbx-inline-tiptap]"),re=L==null?void 0:L.querySelector(".ProseMirror"),j=_.target instanceof Element?_.target.closest("[data-pbx-inline-editor-ui]"):null,we=_.target instanceof Element?_.target.closest("#pbx-modal"):null;if(re!=null&&re.contains(_.target)||j||we||CD(_.target))return;const Xe=t.findEditableElementFromEventTarget(_.target);_.preventDefault(),_.stopPropagation(),_.stopImmediatePropagation(),t.finishActiveInlineTipTapEditorFromDom(Xe)},lo=o.computed(()=>y.getIsLoadingGlobal),qn=o.computed(()=>y.getIsSaving),_r=o.ref(null),dr=o.ref(null),so=o.computed(()=>y.getIsLoadingResumeEditing),po=o.computed(()=>y.getIsRestoring),fs=o.ref(!1),mt=o.ref(!1),Un=o.ref(1),Wn=o.ref(""),co=o.ref(!1),Qo=o.ref(""),Dr=o.ref(""),Gn=o.ref(""),ys=o.ref(null),ws=o.ref(null),Ni=o.ref(null),Xo=o.ref(null),bo=o.ref(null),Zo=async function(){Wn.value="warning",co.value=!0,Qo.value=u("Continue Your Work?"),Dr.value=u("We noticed you have some changes that weren’t saved last time. Would you like to pick up where you left off, or use the version that’s currently loaded from the database?"),Gn.value=u("Use Saved Version"),ys.value=null,ws.value=u("Continue Where I Left Off"),Ni.value=async function(){y.setHasLocalDraftForUpdate(!1),co.value=!1},Xo.value=function(){},bo.value=async function(){await t.resumeEditingFromDraft(),y.setHasLocalDraftForUpdate(!1),co.value=!1}},mo=o.ref(1),jt=o.ref(""),go=o.ref(!1),vs=o.ref(""),ks=o.ref(""),Ai=o.ref(""),cr=o.ref(null),_i=o.ref(null),uo=o.ref(null),zr=o.ref(null),Ir=o.ref(null),Kn=async function(){await t.clearHtmlSelection(),jt.value="success",go.value=!0,vs.value=u("Do you want to reset this page?"),ks.value=u("Are you sure you want to reset this page? This will overwrite your current changes."),Ai.value=u("Close"),cr.value=null,_i.value=u("Reset changes"),uo.value=function(){go.value=!1},zr.value=async function(){},Ir.value=async function(){try{await t.restoreOriginalContent(),f(u("Page restored to original version"),"success")}catch{f(u("Could not restore page"),"error")}go.value=!1}},br=o.ref(!1),Jn=()=>{if(br.value){xo();return}t.setImageSettingsModalOpen(!0),br.value=!0},xo=()=>{br.value=!1,t.setImageSettingsModalOpen(!1)};Fse({canUndo:()=>y.getHistoryIndex>0,canRedo:()=>y.getHistoryIndex<y.getHistoryLength-1,isBlocked:()=>lo.value||Ye.value||y.getInlineTipTapEditor||Qt.value||Xt.value||M.value||co.value||go.value||s.value||i.value||xe.value||Lr.value||br.value,onUndo:async()=>{var _;await((_=_r.value)==null?void 0:_.handleUndo())},onRedo:async()=>{var _;await((_=_r.value)==null?void 0:_.handleRedo())},onSave:F,onDeselect:async()=>{await t.clearHtmlSelection()},onDelete:()=>{var _;(_=dr.value)==null||_.openDeleteConfirm()},hasSelection:()=>!!y.getElement});const $o=function(){ct.value||(Go.value=!0)},tr=o.ref(null),Ss=o.ref(null),ho=o.ref(!1);let Vr=0,fo=null,O=0,B=0;function z(){const _=tr.value;if(_){const L=_.scrollTop,re=L-O;kW()?B=0:vW()?re>0?(B+=re,B>=wW&&(SW(),B=0)):re<0&&(B=0):B=0,O=L}Lt()}const se=function(){var L;const _=document.querySelector("#pbxEditToolbar");_&&((L=_.querySelector(".pbx-select-none > .pbx-flex"))==null||L.style.removeProperty("width"),_.classList.remove("is-visible"),_.removeAttribute("style"))};function ye(_,L){const re=_.querySelector(".pbx-select-none > .pbx-flex");if(!re)return;re.style.flexWrap="nowrap",re.style.removeProperty("max-width"),re.style.width="max-content",re.getBoundingClientRect();const j=Math.ceil(re.getBoundingClientRect().width);re.style.flexWrap="wrap",j>0&&(re.style.width=`${Math.min(j,L)}px`),re.style.justifyContent="center",re.style.removeProperty("max-width")}const Ce=function(){ho.value=!ho.value,_e()};function it(_){const L=document.querySelector("#pbxEditToolbar");let re=!1;for(const j of _){if(j.type==="attributes"&&j.attributeName==="selected"){re=!0;break}if(!L)continue;const we=j.target;if(we instanceof Node&&(L===we||L.contains(we))){re=!0;break}}re?gt():Lt()}function qe(_={}){const L=_.remeasureWidth??!0,re=tr.value,j=re&&re.querySelector("#pbxEditToolbar");if(!re||!j)return;const we=re.querySelector("[selected]");if(we&&typeof we.getBoundingClientRect=="function"){const Hr=(we.closest("[data-pb-no-select]")||we).getBoundingClientRect(),zi=re.getBoundingClientRect(),Ii=20,Vz=re.offsetWidth-Ii*2;j.style.maxWidth=`${Vz}px`,j.style.position=ho.value?"fixed":"absolute",j.classList.add("is-visible"),L&&(j.style.removeProperty("width"),ye(j,Vz),j.getBoundingClientRect());let Cs=Hr.top-zi.top+re.scrollTop-j.offsetHeight-20,Vi=Hr.left-zi.left+Hr.width/2-j.offsetWidth/2;ho.value?(Cs=zi.top+Ii,Vi=zi.left+re.offsetWidth/2-j.offsetWidth/2,Vi=Math.max(zi.left+Ii,Math.min(Vi,zi.left+re.offsetWidth-j.offsetWidth-Ii))):(Cs=Math.max(0,Cs),Vi=Math.max(Ii,Math.min(Vi,re.offsetWidth-j.offsetWidth-Ii))),j.style.top=`${Cs}px`,j.style.left=`${Vi}px`,window.dispatchEvent(new CustomEvent("pagebuilder:toolbar-positioned"))}else j.classList.remove("is-visible"),j.removeAttribute("style")}const _e=function(){qe({remeasureWidth:!0}),requestAnimationFrame(()=>qe({remeasureWidth:!0}))};function Lt(){cancelAnimationFrame(Vr),Vr=requestAnimationFrame(()=>{Vr=0,qe({remeasureWidth:!1})})}function gt(){cancelAnimationFrame(Vr),Vr=requestAnimationFrame(()=>{Vr=0,qe({remeasureWidth:!0})})}o.watch(()=>y.getInlineTipTapEditor,()=>{o.nextTick(_e)}),o.watch($t,()=>{o.nextTick(_e)}),o.watch(er,()=>{o.nextTick(_e)}),o.watch([lo,so,po,Ye,Go],()=>{ie()});const ze=function(){_e()},Le=JSON.parse(localStorage.getItem("userSettingsPageBuilder")??"null"),ie=function(){fs.value=mt.value||lo.value&&!Go.value||Ye.value||so.value||po.value};return o.onMounted(async()=>{const _=t.shouldCompleteBuilderMountOnMount(Ss.value??void 0);_&&(mt.value=!0,y.setIsLoadingGlobal(!0),ie());try{_?await t.completeBuilderInitialization(void 0):await t.refreshListeners()}finally{mt.value=!1,y.setIsLoadingGlobal(!1),ie()}Le&&Le.lang&&(Se.value=Le.lang),await h(Se.value),kt=!1,ie(),gt();const L=tr.value;L&&(O=L.scrollTop,fo=new MutationObserver(it),fo.observe(L,{attributes:!0,attributeFilter:["selected"],childList:!0,subtree:!0}),L.addEventListener("scroll",z,{passive:!0}),window.addEventListener("scroll",Lt,{passive:!0}),window.addEventListener("resize",gt),window.addEventListener("pagebuilder:layout-change",ze),document.addEventListener("pointerdown",hs,!0),await Oe(1e4),$o(),await Oe(1e4),$o(),await Oe(1e4),$o())}),o.onBeforeUnmount(()=>{var _;t.flushPendingEditsToLocalStorage(),t.markCanvasUnmountedForNextMount(),cancelAnimationFrame(Vr),fo==null||fo.disconnect(),fo=null,(_=tr.value)==null||_.removeEventListener("scroll",z),window.removeEventListener("scroll",Lt),window.removeEventListener("resize",gt),window.removeEventListener("pagebuilder:layout-change",ze),document.removeEventListener("pointerdown",hs,!0),_z()}),(_,L)=>{var re;return o.openBlock(),o.createElementBlock(o.Fragment,null,[X.value?(o.openBlock(),o.createBlock(o.resolveDynamicComponent("style"),{key:0},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(X.value),1)]),_:1})):o.createCommentVNode("",!0),o.createElementVNode("div",Use,[fs.value?(o.openBlock(),o.createBlock(Bz,{key:0})):o.createCommentVNode("",!0),o.createVNode(At,{title:"The builder hasn’t started yet",showModalBuilder:Go.value,onCloseMainModalBuilder:hc,type:"delete",maxWidth:"2xl",noBackgroundOpacity:!0},{default:o.withCtx(()=>[...L[32]||(L[32]=[o.createTextVNode(" The builder hasn’t started yet. If this screen doesn’t go away soon, it may just need a little setup in the background. You can safely contact support and ask them to initialize the builder by running the startBuilder method for this resource. ",-1)])]),_:1},8,["showModalBuilder"]),Qt.value?(o.openBlock(),o.createBlock(FX,{key:1,show:Qt.value,firstButtonText:Jo.value,title:Ko.value,CustomBuilderComponents:x.CustomBuilderComponents,onFirstModalButtonSearchComponentsFunction:L[0]||(L[0]=()=>{var j;return(j=Nr.value)==null?void 0:j.call(Nr)})},null,8,["show","firstButtonText","title","CustomBuilderComponents"])):o.createCommentVNode("",!0),E.value&&Xt.value?(o.openBlock(),o.createBlock(p$,{key:2,open:Xt.value,title:ao.value,displayProductsComponent:x.DisplayProducts,onCloseProductLibrary:Ar},null,8,["open","title","displayProductsComponent"])):o.createCommentVNode("",!0),o.createVNode(Et,{showDynamicModalBuilder:M.value,isLoading:!1,type:v.value,gridColumnAmount:P.value,title:C.value,description:k.value,firstButtonText:T.value??void 0,secondButtonText:V.value??void 0,thirdButtonText:N.value??void 0,onFirstModalButtonFunctionDynamicModalBuilder:L[1]||(L[1]=()=>{var j;return(j=A.value)==null?void 0:j.call(A)}),onSecondModalButtonFunctionDynamicModalBuilder:L[2]||(L[2]=()=>{var j;return(j=I.value)==null?void 0:j.call(I)}),onThirdModalButtonFunctionDynamicModalBuilder:L[3]||(L[3]=()=>{var j;return(j=D.value)==null?void 0:j.call(D)})},{default:o.withCtx(()=>[...L[33]||(L[33]=[o.createElementVNode("header",null,null,-1),o.createElementVNode("main",null,null,-1)])]),_:1},8,["showDynamicModalBuilder","type","gridColumnAmount","title","description","firstButtonText","secondButtonText","thirdButtonText"]),o.createVNode(At,{title:bt.value,showModalBuilder:xe.value,onCloseMainModalBuilder:bs,maxWidth:"screen"},{default:o.withCtx(()=>[o.createVNode(Ns)]),_:1},8,["title","showModalBuilder"]),o.createVNode(At,{title:St.value,showModalBuilder:Lr.value,onCloseMainModalBuilder:Ft,maxWidth:"lg"},{default:o.withCtx(()=>[o.createVNode(Ns,{mobile:!0})]),_:1},8,["title","showModalBuilder"]),o.createVNode(Et,{showDynamicModalBuilder:co.value,isLoading:so.value,type:Wn.value,gridColumnAmount:Un.value,title:Qo.value,description:Dr.value,firstButtonText:Gn.value,secondButtonText:ys.value??void 0,thirdButtonText:ws.value??void 0,onFirstModalButtonFunctionDynamicModalBuilder:L[4]||(L[4]=()=>{var j;return(j=Ni.value)==null?void 0:j.call(Ni)}),onSecondModalButtonFunctionDynamicModalBuilder:L[5]||(L[5]=()=>{var j;return(j=Xo.value)==null?void 0:j.call(Xo)}),onThirdModalButtonFunctionDynamicModalBuilder:L[6]||(L[6]=()=>{var j;return(j=bo.value)==null?void 0:j.call(bo)})},{default:o.withCtx(()=>[...L[34]||(L[34]=[o.createElementVNode("header",null,null,-1),o.createElementVNode("main",null,null,-1)])]),_:1},8,["showDynamicModalBuilder","isLoading","type","gridColumnAmount","title","description","firstButtonText","secondButtonText","thirdButtonText"]),o.createVNode(Et,{showDynamicModalBuilder:go.value,isLoading:po.value,type:jt.value,gridColumnAmount:mo.value,title:vs.value,description:ks.value,firstButtonText:Ai.value,secondButtonText:cr.value??void 0,thirdButtonText:_i.value??void 0,onFirstModalButtonFunctionDynamicModalBuilder:L[7]||(L[7]=()=>{var j;return(j=uo.value)==null?void 0:j.call(uo)}),onSecondModalButtonFunctionDynamicModalBuilder:L[8]||(L[8]=()=>{var j;return(j=zr.value)==null?void 0:j.call(zr)}),onThirdModalButtonFunctionDynamicModalBuilder:L[9]||(L[9]=()=>{var j;return(j=Ir.value)==null?void 0:j.call(Ir)})},{default:o.withCtx(()=>[...L[35]||(L[35]=[o.createElementVNode("header",null,null,-1),o.createElementVNode("main",null,null,-1)])]),_:1},8,["showDynamicModalBuilder","isLoading","type","gridColumnAmount","title","description","firstButtonText","secondButtonText","thirdButtonText"]),o.createElementVNode("div",Wse,[ue.value&&ue.value.pageBuilderLogo&&ue.value.pageBuilderLogo.src?(o.openBlock(),o.createElementBlock("div",{key:0,onClick:L[10]||(L[10]=o.withModifiers(async()=>{await o.unref(t).clearHtmlSelection()},["self"])),class:"pbx-flex pbx-justify-start pbx-py-2 lg:pbx-ml-4 pbx-ml-2"},[o.createElementVNode("img",{class:"pbx-h-6",src:ue.value.pageBuilderLogo.src,alt:"Logo"},null,8,Gse)])):o.createCommentVNode("",!0),o.createVNode(lse,{ref_key:"undoRedoRef",ref:_r,onToolbarHideRequest:se},null,512),o.createElementVNode("div",{onClick:L[13]||(L[13]=o.withModifiers(async()=>{await o.unref(t).clearHtmlSelection()},["self"])),class:"pbx-flex-1 pbx-flex pbx-justify-center pbx-items-center pbx-py-2 pbx-w-full"},[o.createElementVNode("div",Kse,[o.createElementVNode("button",{class:"pbx-mySecondaryButton pbx-h-6 pbx-flex pbx-gap-2 pbx-mr-2",onClick:L[11]||(L[11]=o.withModifiers(async()=>{await o.unref(t).clearHtmlSelection(),await F()},["stop"])),type:"button",disabled:qn.value,"aria-label":o.unref(u)("Save"),title:`${o.unref(u)("Save")} (Ctrl+S)`},[qn.value?o.createCommentVNode("",!0):(o.openBlock(),o.createElementBlock("div",Yse,[...L[36]||(L[36]=[o.createElementVNode("span",{class:"material-symbols-outlined","aria-hidden":"true"},"save",-1)])])),qn.value?(o.openBlock(),o.createElementBlock("div",Qse,[...L[37]||(L[37]=[o.createElementVNode("span",{class:"pbx-relative pbx-flex pbx-size-3"},[o.createElementVNode("span",{class:"pbx-absolute pbx-inline-flex pbx-h-full pbx-w-full pbx-animate-ping pbx-rounded-full pbx-bg-gray-400 pbx-opacity-75"}),o.createElementVNode("span",{class:"pbx-relative pbx-inline-flex pbx-size-3 pbx-rounded-full pbx-bg-green-200"})],-1)])])):o.createCommentVNode("",!0),o.createElementVNode("div",null,o.toDisplayString(o.unref(u)("Save")),1)],8,Jse),ue.value&&ue.value.updateOrCreate&&ue.value.updateOrCreate.formType==="update"?(o.openBlock(),o.createElementBlock("button",{key:0,class:"pbx-mySecondaryButton pbx-h-6 pbx-flex pbx-gap-2 lg:pbx-mr-2 pbx-mr-2",onClick:L[12]||(L[12]=o.withModifiers(async()=>{await o.unref(t).clearHtmlSelection(),await Kn()},["stop"])),type:"button",disabled:po.value,"aria-label":o.unref(u)("Reset Page")},[po.value?o.createCommentVNode("",!0):(o.openBlock(),o.createElementBlock("div",Zse,[...L[38]||(L[38]=[o.createElementVNode("span",{class:"material-symbols-outlined"}," settings_backup_restore ",-1)])])),po.value?(o.openBlock(),o.createElementBlock("div",$se,[...L[39]||(L[39]=[o.createElementVNode("span",{class:"pbx-relative pbx-flex pbx-size-3"},[o.createElementVNode("span",{class:"pbx-absolute pbx-inline-flex pbx-h-full pbx-w-full pbx-animate-ping pbx-rounded-full pbx-bg-gray-400 pbx-opacity-75"}),o.createElementVNode("span",{class:"pbx-relative pbx-inline-flex pbx-size-3 pbx-rounded-full pbx-bg-green-200"})],-1)])])):o.createCommentVNode("",!0),o.createElementVNode("div",epe,[o.createElementVNode("span",null,o.toDisplayString(o.unref(u)("Reset Page")),1)]),o.createElementVNode("div",tpe,[o.createElementVNode("span",null,o.toDisplayString(o.unref(u)("Reset")),1)])],8,Xse)):o.createCommentVNode("",!0)])]),o.createElementVNode("div",{onClick:L[18]||(L[18]=o.withModifiers(async()=>{await o.unref(t).clearHtmlSelection()},["self"])),class:"pbx-flex-1 pbx-flex pbx-justify-center pbx-items-center pbx-py-2 pbx-w-full"},[o.createElementVNode("div",{onClick:L[17]||(L[17]=o.withModifiers(async()=>{await o.unref(t).clearHtmlSelection()},["self"])),class:"pbx-flex pbx-items-center pbx-justify-center"},[o.createElementVNode("button",{type:"button",class:"pbx-mr-2 pbx-flex pbx-items-center pbx-justify-center pbx-gap-2 pbx-border-0 pbx-bg-transparent pbx-cursor-pointer pbx-font-sans","aria-label":o.unref(u)("Add components"),title:o.unref(u)("Add components"),onClick:L[14]||(L[14]=()=>{o.unref(y).setComponentArrayAddMethod("unshift"),Yo()})},[o.createElementVNode("span",ope,[o.createVNode(pse)]),o.createElementVNode("span",ipe,o.toDisplayString(o.unref(u)("Add")),1)],8,rpe),E.value?(o.openBlock(),o.createElementBlock("button",{key:0,type:"button",class:"pbx-mr-2 pbx-flex pbx-items-center pbx-justify-center pbx-gap-2 pbx-border-0 pbx-bg-transparent pbx-cursor-pointer pbx-font-sans","aria-label":o.unref(u)("Add products"),title:o.unref(u)("Add products"),onClick:pr},[L[40]||(L[40]=o.createElementVNode("span",{class:"pbx-h-10 pbx-w-10 pbx-rounded-full pbx-flex pbx-items-center pbx-border-none pbx-justify-center pbx-bg-gray-50 pbx-aspect-square hover:pbx-bg-myPrimaryLinkColor focus-visible:pbx-ring-0 pbx-text-black hover:pbx-text-white"},[o.createElementVNode("span",{class:"material-symbols-outlined"}," shopping_bag ")],-1)),o.createElementVNode("span",ape,o.toDisplayString(o.unref(u)("Products")),1)],8,npe)):o.createCommentVNode("",!0),o.createElementVNode("button",{type:"button",class:"pbx-mr-2 pbx-flex pbx-items-center pbx-justify-center pbx-gap-2 pbx-border-0 pbx-bg-transparent pbx-cursor-pointer","aria-label":o.unref(u)("Desktop preview"),title:o.unref(u)("Desktop preview"),onClick:L[15]||(L[15]=async()=>{o.unref(y).setMenuRight(!1),o.unref(y).setElement(null),await o.unref(t).clearHtmlSelection(),On()})},[o.createElementVNode("span",spe,[o.createElementVNode("span",null,[(o.openBlock(),o.createElementBlock("svg",ppe,[...L[41]||(L[41]=[o.createElementVNode("path",{"clip-rule":"evenodd",d:"M2 3h18v13h-8v2h3v2H7v-2h3v-2H2V3zm2 2v9h14V5H4z","fill-rule":"evenodd"},null,-1)])]))])])],8,lpe),o.createElementVNode("button",{type:"button",class:"lg:pbx-flex pbx-hidden pbx-items-center pbx-justify-center pbx-mr-2 pbx-border-0 pbx-bg-transparent pbx-cursor-pointer","aria-label":o.unref(u)("Mobile preview"),title:o.unref(u)("Mobile preview"),onClick:L[16]||(L[16]=async()=>{o.unref(y).setMenuRight(!1),o.unref(y).setElement(null),await o.unref(t).clearHtmlSelection(),xc()})},[o.createElementVNode("span",cpe,[(o.openBlock(),o.createElementBlock("svg",bpe,[...L[42]||(L[42]=[o.createElementVNode("path",{d:"M14 16H8v2h6v-2z"},null,-1),o.createElementVNode("path",{d:"M14 1H8a3 3 0 00-3 3v14a3 3 0 003 3h6a3 3 0 003-3V4a3 3 0 00-3-3zM7 4a1 1 0 011-1h6a1 1 0 011 1v14a1 1 0 01-1 1H8a1 1 0 01-1-1V4z"},null,-1)])]))])],8,dpe)])]),o.createElementVNode("div",mpe,[o.createElementVNode("div",{onClick:L[19]||(L[19]=o.withModifiers(async()=>{await o.unref(t).clearHtmlSelection()},["self"])),class:o.normalizeClass(["pbx-flex pbx-items-center pbx-py-2 pbx-w-full",[r.showCloseButton?"pbx-justify-between":"pbx-justify-end"]])},[o.createVNode(zle)],2),r.showPublishButton?(o.openBlock(),o.createElementBlock("div",gpe,[o.createElementVNode("button",{class:"pbx-myPrimaryButton",onClick:L[20]||(L[20]=async()=>{Q()})},o.toDisplayString(o.unref(u)("Publish")),1)])):o.createCommentVNode("",!0),o.unref(t)&&ue.value&&ue.value.userSettings&&ue.value.userSettings.language&&!((re=ue.value.userSettings.language)!=null&&re.disableLanguageDropDown)?(o.openBlock(),o.createElementBlock(o.Fragment,{key:1},[ue.value&&ue.value.userSettings&&ue.value.userSettings.language?(o.openBlock(),o.createElementBlock("div",upe,[o.withDirectives(o.createElementVNode("select",{id:"pbx-lang",class:"pbx-myPrimarySelect pbx-min-w-20","onUpdate:modelValue":L[21]||(L[21]=j=>Se.value=j)},[Array.isArray(ue.value.userSettings.language.enable)&&ue.value.userSettings.language.enable.length>=1?(o.openBlock(!0),o.createElementBlock(o.Fragment,{key:0},o.renderList(o.unref(t).availableLanguage().filter(j=>{var we,Xe,Di,Hr;return((Hr=(Di=(Xe=(we=ue.value)==null?void 0:we.userSettings)==null?void 0:Xe.language)==null?void 0:Di.enable)==null?void 0:Hr.includes(j))??!1}),j=>(o.openBlock(),o.createElementBlock("option",{key:j,value:j},o.toDisplayString(j),9,xpe))),128)):o.createCommentVNode("",!0),!ue.value.userSettings.language.enable||Array.isArray(ue.value.userSettings.language.enable)&&ue.value.userSettings.language.enable.length===0?(o.openBlock(!0),o.createElementBlock(o.Fragment,{key:1},o.renderList(o.unref(t).availableLanguage(),j=>(o.openBlock(),o.createElementBlock("option",{key:j,value:j},o.toDisplayString(j),9,hpe))),128)):o.createCommentVNode("",!0)],512),[[o.vModelSelect,Se.value]])])):o.createCommentVNode("",!0)],64)):o.createCommentVNode("",!0),r.showCloseButton?(o.openBlock(),o.createElementBlock("div",fpe,[o.createElementVNode("button",{type:"button",class:"pbx-h-10 pbx-w-10 pbx-flex-end pbx-cursor-pointer pbx-rounded-full pbx-flex pbx-items-center pbx-border-none pbx-justify-center pbx-bg-gray-50 pbx-aspect-square hover:pbx-bg-myPrimaryLinkColor hover:pbx-text-white hover:pbx-fill-white focus-visible:pbx-ring-0","aria-label":o.unref(u)("Close Page Builder"),onClick:L[22]||(L[22]=async()=>{q(),await o.unref(t).clearHtmlSelection()})},[...L[43]||(L[43]=[o.createElementVNode("span",{class:"material-symbols-outlined","aria-hidden":"true"}," close ",-1)])],8,ype)])):o.createCommentVNode("",!0)])]),o.createElementVNode("div",wpe,[o.createElementVNode("main",{ref_key:"pbxBuilderWrapper",ref:tr,id:"page-builder-wrapper",class:o.normalizeClass(["pbx-transition-all pbx-duration-300 pbx-p-1 pbx-flex pbx-flex-col pbx-grow pbx-rounded-tr-2xl pbx-rounded-tl-2xl pbx-border-solid pbx-border pbx-border-gray-200 pbx-items-stretch pbx-text-black pbx-h-[100vh] pbx-overflow-y-scroll pbx-relative pbx-pt-16",[(ge.value,"pbx-w-full")]]),style:o.normalizeStyle(J.value)},[o.createElementVNode("div",vpe,[$t.value?(o.openBlock(),o.createBlock(EQ,{key:0,ref_key:"selectedElementToolbarRef",ref:dr,"toolbar-pinned":ho.value,onOpenImageSettings:Jn,onToggleToolbarPin:Ce},null,8,["toolbar-pinned"])):o.createCommentVNode("",!0)]),o.createElementVNode("div",{id:"pagebuilder",ref_key:"pageBuilderCanvas",ref:Ss,"data-builder-canvas":"",class:o.normalizeClass([Z.value,"pbx-text-black",Qe.value]),style:o.normalizeStyle(W.value?W.value:void 0),onDblclickCapture:xs},[Array.isArray(er.value)&&er.value.length===0?(o.openBlock(),o.createElementBlock("div",kpe,[o.createElementVNode("div",Spe,[o.createElementVNode("div",{onClick:L[23]||(L[23]=j=>Zt(0)),class:"pbx-py-4 pbx-px-4 pbx-my-4 pbx-rounded-full pbx-bg-gray-100 pbx-text-gray-600 pbx-flex pbx-items-center pbx-justify-center hover:pbx-text-white hover:pbx-bg-gray-900 pbx-cursor-pointer"},[o.createElementVNode("div",Cpe,[o.createElementVNode("span",Tpe,o.toDisplayString(o.unref(u)("Add new Components")),1)])]),E.value?(o.openBlock(),o.createElementBlock("div",{key:0,onClick:L[24]||(L[24]=j=>Fn(0)),class:"pbx-py-4 pbx-px-4 pbx-my-4 pbx-rounded-full pbx-bg-gray-100 pbx-text-gray-600 pbx-flex pbx-items-center pbx-justify-center hover:pbx-text-white hover:pbx-bg-gray-900 pbx-cursor-pointer"},[o.createElementVNode("div",Epe,[L[44]||(L[44]=o.createElementVNode("span",{class:"material-symbols-outlined"},"shopping_bag",-1)),o.createElementVNode("span",Mpe,o.toDisplayString(o.unref(u)("Products")),1)])])):o.createCommentVNode("",!0)])])):o.createCommentVNode("",!0),Array.isArray(er.value)&&er.value.length!=0?(o.openBlock(),o.createElementBlock("div",Ppe,[o.createElementVNode("div",Bpe,[o.createElementVNode("div",Lpe,[o.createElementVNode("div",{onClick:L[25]||(L[25]=j=>Zt(0)),class:"pbx-select-none pbx-addsection-btn pbx-font-sans pbx-rounded-l-full pbx-rounded-r-none pbx-bg-gray-100 pbx-text-gray-600 pbx-z-50 pbx-flex pbx-items-center pbx-justify-center hover:pbx-text-white hover:pbx-bg-gray-900 pbx-cursor-pointer"},[o.createElementVNode("div",Npe,[L[45]||(L[45]=o.createElementVNode("span",{class:"material-symbols-outlined"}," add ",-1)),o.createElementVNode("span",Ape,o.toDisplayString(o.unref(u)("Add")),1)])]),E.value?(o.openBlock(),o.createElementBlock("div",{key:0,onClick:L[26]||(L[26]=j=>Fn(0)),class:"pbx-select-none pbx-addsection-btn pbx-font-sans pbx-rounded-l-none pbx-bg-gray-100 pbx-text-gray-600 pbx-z-50 pbx-flex pbx-items-center pbx-justify-center hover:pbx-text-white hover:pbx-bg-gray-900 pbx-cursor-pointer pbx-border-l pbx-border-gray-200"},[o.createElementVNode("div",_pe,[L[46]||(L[46]=o.createElementVNode("span",{class:"material-symbols-outlined"}," shopping_bag ",-1)),o.createCommentVNode("",!0)])])):o.createCommentVNode("",!0)])])])):o.createCommentVNode("",!0),(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(er.value,(j,we)=>(o.openBlock(),o.createElementBlock(o.Fragment,{key:j.id},[j.html_code?(o.openBlock(),o.createElementBlock("div",{key:0,"data-pagebuilder-content":"",innerHTML:j.html_code,onMouseup:Xe=>us(j)},null,40,Dpe)):o.createCommentVNode("",!0),Array.isArray(er.value)&&er.value.length!=0?(o.openBlock(),o.createElementBlock("div",zpe,[o.createElementVNode("div",Ipe,[o.createElementVNode("div",Vpe,[o.createElementVNode("div",{onClick:Xe=>Zt(we+1),class:"pbx-select-none pbx-addsection-btn pbx-font-sans pbx-rounded-l-full pbx-rounded-r-none pbx-bg-gray-100 pbx-text-gray-600 pbx-z-50 pbx-flex pbx-items-center pbx-justify-center hover:pbx-text-white hover:pbx-bg-gray-900 pbx-cursor-pointer"},[o.createElementVNode("div",Rpe,[L[47]||(L[47]=o.createElementVNode("span",{class:"material-symbols-outlined"}," add ",-1)),o.createElementVNode("span",Ope,o.toDisplayString(o.unref(u)("Add")),1)])],8,Hpe),E.value?(o.openBlock(),o.createElementBlock("div",{key:0,onClick:Xe=>Fn(we+1),class:"pbx-select-none pbx-addsection-btn pbx-font-sans pbx-rounded-l-none pbx-bg-gray-100 pbx-text-gray-600 pbx-z-50 pbx-flex pbx-items-center pbx-justify-center hover:pbx-text-white hover:pbx-bg-gray-900 pbx-cursor-pointer pbx-border-l pbx-border-gray-200"},[o.createElementVNode("div",jpe,[L[48]||(L[48]=o.createElementVNode("span",{class:"material-symbols-outlined"}," shopping_bag ",-1)),o.createCommentVNode("",!0)])],8,Fpe)):o.createCommentVNode("",!0)])])])):o.createCommentVNode("",!0)],64))),128))],38)],6),o.createVNode(o.Transition,{name:"slide-right",appear:"",mode:"out-in"},{default:o.withCtx(()=>[ge.value?(o.openBlock(),o.createElementBlock("aside",{key:0,"aria-label":"menu",id:"pagebuilder-right-menu",class:o.normalizeClass(["pbx-z-20 pbx-flex-shrink-0 pbx-overflow-hidden pbx-border-0 pbx-border-solid pbx-border-l-0 pbx-border-l-gray-600 pbx-rounded-l-2xl pbx-h-[100vh]",[ge.value?"pbx-w-96 pbx-bg-myPrimaryLightGrayColor pbx-items-stretch":"pbx-w-0 pbx-mr-0"]])},[o.createVNode(Mle,{onCloseEditor:L[27]||(L[27]=j=>o.unref(y).setMenuRight(!1))})],2)):(o.openBlock(),o.createElementBlock("div",{key:1,onClick:L[30]||(L[30]=o.withModifiers(async()=>{await o.unref(t).clearHtmlSelection()},["self"])),class:"pbx-w-18 pbx-bg-myPrimaryLightGrayColor pbx-pt-5 pbx-z-20 pbx-flex-shrink-0 pbx-overflow-hidden pbx-border-0 pbx-border-solid pbx-border-l-0 pbx-border-l-gray-600 pbx-rounded-l-2xl pbx-h-[100vh] pbx-pl-2 pbx-pr-2"},[o.createElementVNode("div",{onClick:L[29]||(L[29]=o.withModifiers(async()=>{await o.unref(t).clearHtmlSelection()},["self"])),class:"pbx-flex pbx-flex-col pbx-items-center pbx-justify-center pbx-gap-2"},[ge.value?o.createCommentVNode("",!0):(o.openBlock(),o.createElementBlock("button",{key:0,onClick:L[28]||(L[28]=j=>o.unref(y).setMenuRight(!0)),type:"button",class:"pbx-h-10 pbx-w-10 pbx-cursor-pointer pbx-rounded-full pbx-flex pbx-items-center pbx-border-none pbx-justify-center pbx-bg-gray-50 pbx-aspect-square hover:pbx-bg-myPrimaryLinkColor focus-visible:pbx-ring-0 pbx-text-black hover:pbx-text-white"},[o.createElementVNode("span",null,[(o.openBlock(),o.createElementBlock("svg",qpe,[...L[49]||(L[49]=[o.createElementVNode("g",{"clip-path":"url(#prefix__clip0_1645_485)"},[o.createElementVNode("path",{"clip-rule":"evenodd",d:"M19.871 1.81a2.768 2.768 0 00-3.914 0l-3.543 3.544-2.5-2.5L0 12.768l8.914 8.914 9.914-9.914-2.5-2.5 3.543-3.543a2.768 2.768 0 000-3.914zm-2.5 1.415a.768.768 0 011.086 1.086L13.5 9.268l2.5 2.5-1.086 1.086-6.086-6.086 1.086-1.086 2.5 2.5 4.957-4.957zM7.414 8.182l-4.586 4.586 1.086 1.086 3.293-3.293 1.414 1.414-3.293 3.293 1.086 1.086 3.293-3.293 1.414 1.414-3.293 3.293 1.086 1.086 4.586-4.586-6.086-6.086z","fill-rule":"evenodd"})],-1),o.createElementVNode("defs",null,[o.createElementVNode("clipPath",{id:"prefix__clip0_1645_485"},[o.createElementVNode("path",{d:"M0 0h22v22H0z",fill:"#fff"})])],-1)])]))])]))])]))]),_:1})])]),o.createVNode(Tz,{title:o.unref(u)("Image Settings"),showSidebarPanel:br.value,position:"left",onCloseSidebarPanel:xo},{default:o.withCtx(()=>[o.createVNode(rse,{show:br.value},null,8,["show"])]),_:1},8,["title","showSidebarPanel"]),o.createVNode(zse,{show:o.unref(s),title:o.unref(p),html:o.unref(d),"is-loading":o.unref(c),error:o.unref(b),"onUpdate:html":L[31]||(L[31]=j=>d.value=j),onClose:o.unref(m),onSave:o.unref(g)},null,8,["show","title","html","is-loading","error","onClose","onSave"]),o.createVNode(wse,{show:o.unref(i),title:o.unref(n),html:o.unref(a),onClose:o.unref(l)},null,8,["show","title","html","onClose"]),o.createVNode(Rse)],64)}}});class Li{static getHistory(e){const t=e+this.HISTORY_KEY_SUFFIX,i=localStorage.getItem(t);return i?JSON.parse(i):[]}static addToHistory(e,t){const i=e+this.HISTORY_KEY_SUFFIX;let n=this.getHistory(e);n.push(t),n.length>this.MAX_HISTORY_SIZE&&(n=n.slice(n.length-this.MAX_HISTORY_SIZE)),localStorage.setItem(i,JSON.stringify(n))}static clearHistory(e){const t=e+this.HISTORY_KEY_SUFFIX;localStorage.removeItem(t)}}be(Li,"HISTORY_KEY_SUFFIX","-history"),be(Li,"MAX_HISTORY_SIZE",10);const cc={objectFit:["none","pbx-object-cover","pbx-object-contain"],objectPosition:["none","pbx-object-top-left","pbx-object-top","pbx-object-top-right","pbx-object-left","pbx-object-center","pbx-object-right","pbx-object-bottom-left","pbx-object-bottom","pbx-object-bottom-right"],aspectRatio:["none","pbx-aspect-square","pbx-aspect-video","pbx-aspect-[9/16]"]},rt=[];for(let r=0;r<256;++r)rt.push((r+256).toString(16).slice(1));function Wpe(r,e=0){return(rt[r[e+0]]+rt[r[e+1]]+rt[r[e+2]]+rt[r[e+3]]+"-"+rt[r[e+4]]+rt[r[e+5]]+"-"+rt[r[e+6]]+rt[r[e+7]]+"-"+rt[r[e+8]]+rt[r[e+9]]+"-"+rt[r[e+10]]+rt[r[e+11]]+rt[r[e+12]]+rt[r[e+13]]+rt[r[e+14]]+rt[r[e+15]]).toLowerCase()}const Gpe=new Uint8Array(16);function Kpe(){return crypto.getRandomValues(Gpe)}function Dz(r,e,t){return crypto.randomUUID?crypto.randomUUID():Jpe(r)}function Jpe(r,e,t){var n;r=r||{};const i=r.random??((n=r.rng)==null?void 0:n.call(r))??Kpe();if(i.length<16)throw new Error("Random bytes length must be >= 16");return i[6]=i[6]&15|64,i[8]=i[8]&63|128,Wpe(i)}function ot(r){return r.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}const bc="hidden",Ype=new Set(["id","title","description","image","imageAlt","price","compareAtPrice","badge","url","buttonText","sku"]);function Qpe(r){return r?' target="_blank" rel="noopener noreferrer"':""}function Xpe(r,e={},t=!1){const i=e.cardStyle??"minimal",n=e.roundedImages??!1,a=e.openInNewTab??!1,l=e.buttonStyle??"text",s=e.roundedButtons??!1,p=e.hidePrice??!1,d=e.hideImage??!1,c=e.hideButton??!1,b=Qpe(a),m=$l[i]??$l.minimal,g=[oz(n),d?bc:""].filter(Boolean).join(" "),x=r.id!=null?String(r.id):"",u=r.title?ot(r.title):"",h=r.description?ot(r.description):"",f=r.price!=null?ot(String(r.price)):"",w=r.compareAtPrice!=null?ot(String(r.compareAtPrice)):"",y=r.badge?ot(r.badge):"",E=r.image?ot(r.image):"",S=r.imageAlt?ot(r.imageAlt):u||"Product",P=r.url?ot(r.url):"",v=r.buttonText?ot(r.buttonText):"";let M="";if(E){const D=`<img class="object-cover w-full object-top aspect-square " src="${E}" alt="${S}">`;M=P?`<div class="${g}" data-pb-no-inline-text><a href="${P}"${b}>${D}</a></div>`:`<div class="${g}" data-pb-no-inline-text>${D}</div>`}const C=y?`<div class="product-card-badge text-xs font-medium uppercase tracking-wide text-gray-500 pt-2"><p>${y}</p></div>`:t?'<div class="product-card-badge text-xs font-medium uppercase tracking-wide text-gray-500 pt-2 min-h-6"></div>':"",k=u?`<div class="product-card-title text-lg font-semibold text-gray-900 pt-2 min-h-16">${P?`<p><a href="${P}"${b}>${u}</a></p>`:`<p>${u}</p>`}</div>`:"",T=h?`<div class="product-card-description text-sm text-gray-600 pt-1"><p>${h}</p></div>`:"",V=Object.entries(r).filter(([D,q])=>!Ype.has(D)&&q!=null&&String(q).trim()!==""),N=V.length?`<div class="product-card-custom-fields text-sm text-gray-600 pt-1">${V.map(([D,q])=>`<div class="product-card-custom-field product-card-custom-field-${D.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")}"><p><strong>${ot(D)}</strong>: ${ot(String(q))}</p></div>`).join("")}</div>`:"";let A="";if(!!(f||w||P&&v)){let D="";if(f||w){const Q=[w?`<div class="product-card-compare text-sm line-through text-gray-400"><p>${w}</p></div>`:"",f?`<div class="product-card-price text-2xl font-semibold text-gray-900"><p>${f}</p></div>`:""].filter(Boolean);D=`<div class="${["product-card-price-row flex flex-wrap items-baseline gap-2 pt-2",p?bc:""].filter(Boolean).join(" ")}">${Q.join("")}</div>`}const q=iz(l,s),Y=P&&v?`<div class="product-card-cta text-sm font-semibold text-myPrimaryLinkColor pt-3${c?` ${bc}`:""}"><p><a class="${q}" href="${P}"${b}>${v}</a></p></div>`:"";A=`<div class="product-card-footer mt-auto flex flex-col">${D}${Y}</div>`}return[`<div class="${m}" data-pbx-product-id="${ot(x)}">`,M,'<div class="break-words py-2 product-card-body text-gray-900 flex flex-col flex-1">','<div class="product-card-meta flex flex-col flex-1">',C,k,T,N,"</div>",A,"</div></div>"].filter(Boolean).join(`
408
408
  `)}function zz(r,e="grid-3",t="Products",i={}){if(!r.length)return"";const n=r.map(f=>f.id!=null?String(f.id):"").filter(Boolean).join(","),a=i.mobileColumns===2?2:1,l=i.cardStyle??"minimal",s=i.roundedImages??!1,p=i.openInNewTab??!1,d=i.buttonStyle??"text",c=i.roundedButtons??!1,b=i.hidePrice??!1,m=i.hideImage??!1,g=i.hideButton??!1,x=r.some(f=>!!f.badge),u=r.map(f=>Xpe(f,i,x)).join(`
409
409
  `),h=rz(e,a);return`<section data-component-title="${ot(t)}" data-pbx-product-section="true" data-pbx-product-ids="${ot(n)}" data-pbx-product-layout="${ot(String(e))}" data-pbx-product-mobile-cols="${a}" data-pbx-product-card-style="${ot(l)}" data-pbx-product-rounded-images="${s?"true":"false"}" data-pbx-product-open-in-new-tab="${p?"true":"false"}" data-pbx-product-button-style="${ot(d)}" data-pbx-product-rounded-buttons="${c?"true":"false"}" data-pbx-product-hide-price="${b?"true":"false"}" data-pbx-product-hide-image="${m?"true":"false"}" data-pbx-product-hide-button="${g?"true":"false"}">
410
410
  <div class="pbx-py-8 pbx-px-4"><div class="pbx-mx-auto pbx-max-w-7xl"><div class="${h}" data-pbx-product-grid="true">
411
411
  ${u}
412
412
  </div></div></div>
413
- </section>`}const mc="data-meta-title",gc="data-meta-description";function ps(r){return{title:r.getAttribute(mc)||"",description:r.getAttribute(gc)||""}}function uc(r,e){var n,a;const t=((n=e.title)==null?void 0:n.trim())||"",i=((a=e.description)==null?void 0:a.trim())||"";t?r.setAttribute(mc,t):r.removeAttribute(mc),i?r.setAttribute(gc,i):r.removeAttribute(gc)}function Rn(r){const e=r==null?void 0:r.meta;return!e||typeof e!="object"?{title:"",description:""}:{title:typeof e.title=="string"?e.title:"",description:typeof e.description=="string"?e.description:""}}function Zpe(r,e){return{...r,meta:{...Rn(r),...e}}}function $pe(r,e,t=180){const i=e.getBoundingClientRect(),n=r.getBoundingClientRect(),l=i.top-n.top+r.scrollTop-r.clientHeight/2+e.clientHeight/2,s=r.scrollTop,p=l-s;if(Math.abs(p)<1){window.dispatchEvent(new CustomEvent("pagebuilder:layout-change"));return}const d=performance.now(),c=b=>{const m=Math.min(1,(b-d)/t),g=1-(1-m)**3;if(r.scrollTop=s+p*g,window.dispatchEvent(new CustomEvent("pagebuilder:layout-change")),m<1){requestAnimationFrame(c);return}window.dispatchEvent(new CustomEvent("pagebuilder:layout-change"))};requestAnimationFrame(c)}const ede=["en","zh-Hans","fr","ja","ru","es","pt","de","ar","hi","da","it"],ds="pbx-full-width-component";class Iz{constructor(e){be(this,"fontSizeRegex",/^(sm:|md:|lg:|xl:|2xl:)?pbx-text-(xs|sm|base|lg|xl|2xl|3xl|4xl|5xl|6xl|7xl|8xl|9xl)$/);be(this,"pageBuilderStateStore");be(this,"getLocalStorageItemName");be(this,"getApplyImageToSelection");be(this,"getHyberlinkEnable");be(this,"getComponents");be(this,"getComponent");be(this,"getElement");be(this,"getComponentArrayAddMethod");be(this,"NoneListernesTags");be(this,"hasStartedEditing",!1);be(this,"originalComponents");be(this,"savedMountComponents",null);be(this,"pendingMountComponents",null);be(this,"globalStylesObserver",null);be(this,"_pendingPageSettings",null);be(this,"_lastKnownPageSettings",null);be(this,"isPageBuilderMissingOnStart",!1);be(this,"hasCompletedBuilderMount",!1);be(this,"builderWasMountedBeforeClose",!1);be(this,"builderMountPromise",null);be(this,"activeBuilderSessionToken",0);be(this,"canvasClickCaptureListener",null);be(this,"canvasDblClickCaptureListener",null);be(this,"elementsWithListeners",new WeakMap);be(this,"translate");be(this,"handleMouseOver",(e,t)=>{if(this.pageBuilderStateStore.getInlineTipTapEditor)return;e.preventDefault(),e.stopPropagation();const i=document.querySelector("#pagebuilder");if(!i)return;const n=i.querySelector("[hovered]");n&&n.removeAttribute("hovered"),t.hasAttribute("selected")||t.setAttribute("hovered","")});be(this,"handleMouseLeave",e=>{if(this.pageBuilderStateStore.getInlineTipTapEditor)return;e.preventDefault(),e.stopPropagation();const t=document.querySelector("#pagebuilder");if(!t)return;const i=t.querySelector("[hovered]");i&&i.removeAttribute("hovered")});be(this,"addListenersToEditableElements",async()=>{const e=document.querySelector("#pagebuilder");if(!e)return;await o.nextTick(),this.attachCanvasInlineEditListeners(e);let t=0,i=0;e.querySelectorAll("section *").forEach(n=>{if(this.isEditableElement(n)){t++;const a=n;if(this.elementsWithListeners.has(a)){const c=this.elementsWithListeners.get(a);c&&(a.removeEventListener("click",c.click),a.removeEventListener("dblclick",c.dblclick),a.removeEventListener("mouseover",c.mouseover),a.removeEventListener("mouseleave",c.mouseleave))}const l=c=>this.handleElementClick(c,a),s=c=>this.handleElementDoubleClick(c,a),p=c=>this.handleMouseOver(c,a),d=c=>this.handleMouseLeave(c);a.addEventListener("click",l),a.addEventListener("dblclick",s),a.addEventListener("mouseover",p),a.addEventListener("mouseleave",d),i++,this.elementsWithListeners.set(a,{click:l,dblclick:s,mouseover:p,mouseleave:d})}}),this.debugLog("log","addListenersToEditableElements(): attached listeners",{eligible:t,attached:i,hasSections:!!e.querySelector("section")})});be(this,"handleCanvasClickCapture",async e=>{if(!this.pageBuilderStateStore.getImageSettingsPanelOpen&&this.pageBuilderStateStore.getInlineTipTapEditor)if(!this.hasInlineTipTapElement())this.pageBuilderStateStore.setInlineTipTapEditor(!1);else{const t=document.querySelector("#pagebuilder [data-pbx-inline-tiptap]");if(t&&e.target instanceof Node&&!t.contains(e.target)){const i=e.target instanceof Element&&!!e.target.closest("[data-pbx-insert-btn]");i||(e.preventDefault(),e.stopPropagation());const n=i?null:this.findEditableElementFromEventTarget(e.target);this.finishActiveInlineTipTapEditorFromDom(n)}}});be(this,"handleCanvasDoubleClickCapture",async e=>{await this.openInlineTipTapFromEvent(e)});be(this,"handleElementClick",async(e,t)=>{if(!this.pageBuilderStateStore.getImageSettingsPanelOpen){if(this.pageBuilderStateStore.getInlineTipTapEditor){e.preventDefault(),e.stopPropagation();return}e.preventDefault(),e.stopPropagation(),await this.selectEditableElement(t)}});be(this,"handleElementDoubleClick",async(e,t)=>{if(!this.pageBuilderStateStore.getImageSettingsPanelOpen&&!this.pageBuilderStateStore.getInlineTipTapEditor){if(!this.isValidTextElement(t)){e.stopPropagation();return}e.preventDefault(),e.stopPropagation(),this.pageBuilderStateStore.setElement(t),this.pageBuilderStateStore.setInlineTipTapEditor(!0),await this.openInlineTipTapForElement(t),this.hasInlineTipTapElement()||this.pageBuilderStateStore.setInlineTipTapEditor(!1)}});be(this,"handleAutoSave",async()=>{if(this.startEditing(),this.pageBuilderStateStore.getInlineTipTapEditor)return;const e=this.pageBuilderStateStore.getPageBuilderConfig;if(e&&e.userSettings&&typeof e.userSettings.autoSave=="boolean"&&e.userSettings.autoSave!==!1){if(this.pageBuilderStateStore.getIsSaving)return;try{this.commitActiveInlineTipTapEditorSync(),this.pageBuilderStateStore.setIsSaving(!0),this.saveDomComponentsToLocalStorage(),await je(400)}catch(t){console.error("Error trying auto save.",t),this.debugLog("error","handleAutoSave(): error",t);const{showToast:i}=tt(),{translate:n}=ne();i(n("Auto-save failed — please save manually"),"error")}finally{this.pageBuilderStateStore.setIsSaving(!1)}}if(e&&!e.userSettings)try{this.commitActiveInlineTipTapEditorSync(),this.pageBuilderStateStore.setIsSaving(!0),this.saveDomComponentsToLocalStorage(),await je(400)}catch(t){console.error("Error trying saving.",t),this.debugLog("error","handleAutoSave(): error (no userSettings)",t);const{showToast:i}=tt(),{translate:n}=ne();i(n("Auto-save failed — please save manually"),"error")}finally{this.pageBuilderStateStore.setIsSaving(!1)}});be(this,"handleManualSave",async e=>{this.commitActiveInlineTipTapEditorSync(),await this.syncDomToStoreOnly(),this.pageBuilderStateStore.setIsSaving(!0),e||this.clearHtmlSelection(),this.startEditing(),this.saveDomComponentsToLocalStorage(),await this.refreshListeners(),await je(300),this.pageBuilderStateStore.setIsSaving(!1)});be(this,"ensureTextAreaHasContent",()=>{if(!this.getElement.value||typeof this.getElement.value.innerHTML!="string")return;const e=this.getElement.value,t=e.tagName;["DIV"].includes(t)&&e.tagName.toLowerCase()!=="img"&&e.textContent&&Number(e.textContent.length)===0?(e.classList.add("h-6"),e.classList.add("bg-red-50")):(e.classList.remove("h-6"),e.classList.remove("bg-red-50"))});be(this,"handleTextInput",async e=>{var t;typeof((t=this.getElement.value)==null?void 0:t.innerHTML)=="string"&&(typeof this.getElement.value.innerHTML=="string"&&(await o.nextTick(),this.getElement.value.textContent=e,this.pageBuilderStateStore.setTextAreaVueModel(this.getElement.value.innerHTML),this.getElement.value.innerHTML=e),this.ensureTextAreaHasContent())});this.hasStartedEditing=!1,this.pageBuilderStateStore=e;const{translate:t}=ne();this.translate=t,this.getApplyImageToSelection=o.computed(()=>this.pageBuilderStateStore.getApplyImageToSelection),this.getLocalStorageItemName=o.computed(()=>this.pageBuilderStateStore.getLocalStorageItemName),this.getHyberlinkEnable=o.computed(()=>this.pageBuilderStateStore.getHyberlinkEnable),this.getComponents=o.computed(()=>this.pageBuilderStateStore.getComponents),this.getComponent=o.computed(()=>this.pageBuilderStateStore.getComponent),this.getElement=o.computed(()=>this.pageBuilderStateStore.getElement),this.getComponentArrayAddMethod=o.computed(()=>this.pageBuilderStateStore.getComponentArrayAddMethod),this.NoneListernesTags=["P","H1","H2","H3","H4","H5","H6","IFRAME","UL","OL","LI","EM","STRONG","B","A","SPAN","BLOCKQUOTE","BR","PRE","CODE","MARK","DEL","INS","U","FIGURE","FIGCAPTION"]}isDebugEnabled(){try{return typeof localStorage<"u"&&localStorage.getItem("pbx-debug")==="1"}catch{return!1}}debugLog(e,t,i){if(!this.isDebugEnabled())return;const n="[PBX]";if(i!==void 0){console[e](`${n} ${t}`,i);return}console[e](`${n} ${t}`)}availableLanguage(){return ede}changeLanguage(e){this.pageBuilderStateStore.setCurrentLanguage(e)}async clearHtmlSelection(){this.pageBuilderStateStore.getImageSettingsPanelOpen||(this.pageBuilderStateStore.setComponent(null),this.pageBuilderStateStore.setElement(null),await this.removeHoveredAndSelected())}ensureUpdateOrCreateConfig(e){if(!e.updateOrCreate||e.updateOrCreate&&no(e.updateOrCreate)){const t={...e,updateOrCreate:{formType:"create",formName:"post"}};this.pageBuilderStateStore.setPageBuilderConfig(t);return}if(e.updateOrCreate&&typeof e.updateOrCreate.formType=="string"&&(e.updateOrCreate.formType==="create"||e.updateOrCreate.formType==="update")&&typeof e.updateOrCreate.formName!="string"||typeof e.updateOrCreate.formName=="string"&&e.updateOrCreate.formName.length===0){const t={...e,updateOrCreate:{formType:e.updateOrCreate.formType,formName:"post"}};this.pageBuilderStateStore.setPageBuilderConfig(t)}if(e.updateOrCreate&&typeof e.updateOrCreate.formType!="string"||typeof e.updateOrCreate.formType=="string"&&e.updateOrCreate.formType!=="create"&&e.updateOrCreate.formType!=="update"&&typeof e.updateOrCreate.formName=="string"&&e.updateOrCreate.formName.length!==0){const t={...e,updateOrCreate:{formType:"create",formName:e.updateOrCreate.formName}};this.pageBuilderStateStore.setPageBuilderConfig(t);return}if(e.updateOrCreate&&typeof e.updateOrCreate.formType=="string"&&e.updateOrCreate.formType!=="create"&&e.updateOrCreate.formType!=="update"&&typeof e.formName!="string"){const t={...e,updateOrCreate:{formType:"create",formName:"post"}};this.pageBuilderStateStore.setPageBuilderConfig(t)}}validateUserProvidedComponents(e){const t=this.pageBuilderStateStore.getPageBuilderConfig&&this.pageBuilderStateStore.getPageBuilderConfig.updateOrCreate&&this.pageBuilderStateStore.getPageBuilderConfig.updateOrCreate.formType;if(Array.isArray(e)&&e.length>=1&&t==="create"&&e)return{error:!0,warning:"You cannot set formType to create in your configuration while also passing a components data array to the Page Builder. Please set formType to update.",status:"validation_failed"};if(!Array.isArray(e))return{error:!0,reason:"Components data must be an array."};const i=e[0];if(i&&"html_code"in i&&typeof i.html_code!="string")return{error:!0,reason:"The 'html_code' property in the first object must be a string."};if(Array.isArray(e)&&e.length>=1&&(!i||!("html_code"in i)))return{error:!0,reason:"The first object in the array must include an 'html_code' key."}}ensureLanguage(e){const i=["en","zh-Hans","fr","ja","ru","es","pt","de","ar","hi","da"];let n=!1;const a=e.userSettings,l=a&&a.language;if((!a||no(a)||!l||no(l))&&(n=!0),n){const s=a?{...a}:{};s.language={default:"en",enable:i};const p={...e,userSettings:s};this.pageBuilderStateStore.setPageBuilderConfig(p);return}if(l&&Array.isArray(l.enable)&&l.default&&!l.enable.includes(l.default)){const s=[...l.enable,l.default],p={...e,userSettings:{...a,language:{...l,enable:s}}};this.pageBuilderStateStore.setPageBuilderConfig(p)}}validateConfig(e){var n;const t={updateOrCreate:{formType:"create",formName:"post"}};if(!e||e&&Object.keys(e).length===0&&e.constructor===Object){this.pageBuilderStateStore.setPageBuilderConfig(t);return}e&&Object.keys(e).length!==0&&e.constructor===Object&&(this.ensureUpdateOrCreateConfig(e),(!e.resourceData||typeof e.resourceData.title!="string"||!e.resourceData.title.trim())&&(!e.resourceData||typeof e.resourceData!="object"?e.resourceData={title:"Default Post"}:e.resourceData.title="Default Post"));let i=e;if(!i.userSettings||typeof i.userSettings!="object"||!("autoSave"in i.userSettings)){const a=i.userSettings?{...i.userSettings}:{};a.autoSave=((n=i.userSettings)==null?void 0:n.autoSave)!==!1;const l={...i,userSettings:a};this.pageBuilderStateStore.setPageBuilderConfig(l),i=l}this.ensureLanguage(i)}saveUserSettingsStorage(e){localStorage.setItem("userSettingsPageBuilder",JSON.stringify({userSettings:{lang:e}}))}async startBuilder(e,t){var d,c,b;const i=++this.activeBuilderSessionToken;this.debugLog("warn","startBuilder(): begin",{sessionToken:i,hasPassedComponentsArray:Array.isArray(t),passedComponentsLength:Array.isArray(t)?t.length:null});const n=document.querySelector("#pagebuilder"),a=!!(n!=null&&n.querySelector("section[data-componentid]"));this.debugLog("warn","startBuilder(): dom snapshot",{hasLiveMountedContent:a,hasPagebuilderEl:!!n,hasCompletedBuilderMount:this.hasCompletedBuilderMount}),a||(this.hasCompletedBuilderMount=!1,this.builderMountPromise=null,this.pendingMountComponents=null,this.isPageBuilderMissingOnStart=!1),typeof this.pageBuilderStateStore.setInlineTipTapEditor=="function"&&this.pageBuilderStateStore.setInlineTipTapEditor(!1),typeof this.pageBuilderStateStore.setShowModalTipTap=="function"&&this.pageBuilderStateStore.setShowModalTipTap(!1),typeof this.pageBuilderStateStore.setImageSettingsPanelOpen=="function"&&this.pageBuilderStateStore.setImageSettingsPanelOpen(!1),typeof this.pageBuilderStateStore.setElement=="function"&&this.pageBuilderStateStore.setElement(null),typeof this.pageBuilderStateStore.setComponent=="function"&&this.pageBuilderStateStore.setComponent(null),typeof this.pageBuilderStateStore.setIsLoadingGlobal=="function"&&this.pageBuilderStateStore.setIsLoadingGlobal(!1),this.pageBuilderStateStore.setBuilderStarted(!0);const l=document.querySelector("#pagebuilder");this.debugLog("warn","startBuilder(): #pagebuilder present?",!!l);const s=this.readCurrentPageSettings();this.hasMeaningfulPageSettings(s)&&(this._lastKnownPageSettings=s);let p;try{this.originalComponents=t,this.pageBuilderStateStore.setPageBuilderConfig(e);const m=JSON.parse(localStorage.getItem("userSettingsPageBuilder")??"null");!(m!=null&&m.lang)&&((c=(d=e.userSettings)==null?void 0:d.language)!=null&&c.default)&&this.changeLanguage(e.userSettings.language.default),this.validateConfig(e),p=this.validateUserProvidedComponents(t);const g=Array.isArray(t)&&t.length>0?t:null,x=g!==null;if(this.updateLocalStorageItemName(),this.initializeHistory(),this.debugLog("warn","startBuilder(): storage key",{key:this.getLocalStorageItemName.value}),x&&(this.savedMountComponents=g),l||(this.isPageBuilderMissingOnStart=!0),x&&!l){const h=this.getSavedPageHtml();this.debugLog("warn","startBuilder(): deferred mount decision",{existingDraft:!!h,builderWasMountedBeforeClose:this.builderWasMountedBeforeClose,willQueuePendingMount:!h}),h||(this.pendingMountComponents=g)}if(l&&(!t||Array.isArray(t))&&(this.debugLog("warn","startBuilder(): calling completeBuilderInitialization",{hasUsablePassedComponents:x,isPageBuilderMissingOnStart:this.isPageBuilderMissingOnStart}),await this.completeBuilderInitializationWithSession(x?g:void 0,i)),l&&(await this.addListenersToEditableElements(),this.debugLog("warn","startBuilder(): listeners attached (safety net)")),a&&l){const h=((b=this.pageBuilderStateStore.getPageBuilderConfig)==null?void 0:b.pageSettings)??null;if(this.hasMeaningfulPageSettings(h)){const f=this.convertStyleObjectToString(h.style),w=l.getAttribute("style")||"";f.trim()&&!w.trim()&&(await o.nextTick(),this.applyPageSettingsToPage(h))}}const u={message:"Page builder started successfully."};return p&&(u.validation=p),Array.isArray(t)&&t.length>=0&&(u.passedComponentsArray=t),u}catch(m){return console.error("Not able to start the Page Builder",m),this.debugLog("error","startBuilder(): error",m),{error:!0,reason:"Failed to start the Page Builder due to an unexpected error."}}}shouldCompleteBuilderMountOnMount(e){if(this.hasCompletedBuilderMount){if(this.isPageBuilderMissingOnStart)return this.hasCompletedBuilderMount=!1,this.builderMountPromise=null,!0;const t=e??document.querySelector("#pagebuilder"),i=!!(t!=null&&t.querySelector("section[data-componentid]"));return t&&!i?(this.hasCompletedBuilderMount=!1,this.builderMountPromise=null,!0):!1}return this.isPageBuilderMissingOnStart||!!this.pendingMountComponents}markCanvasUnmountedForNextMount(){this.hasCompletedBuilderMount=!1,this.builderMountPromise=null,this.isPageBuilderMissingOnStart=!0}async completeBuilderInitialization(e){return this.completeBuilderInitializationWithSession(e,this.activeBuilderSessionToken)}async completeBuilderInitializationWithSession(e,t=this.activeBuilderSessionToken){if(t===this.activeBuilderSessionToken){if(this.hasCompletedBuilderMount){this.pageBuilderStateStore.setIsLoadingGlobal(!1);return}this.builderMountPromise||(this.builderMountPromise=this.runCompleteBuilderInitialization(e,t));try{await this.builderMountPromise}finally{this.pageBuilderStateStore.setIsLoadingGlobal(!1)}}}async runCompleteBuilderInitialization(e,t=this.activeBuilderSessionToken){if(t!==this.activeBuilderSessionToken)return;let i=!1;try{if(this.pageBuilderStateStore.setIsLoadingGlobal(!0),i=!0,await je(400),t!==this.activeBuilderSessionToken)return;this.debugLog("warn","completeBuilderInitialization(): loading ON",{sessionToken:t,key:this.getLocalStorageItemName.value}),this.deleteAllComponentsFromDOM();const n=this.pageBuilderStateStore.getPageBuilderConfig,a=n&&n.updateOrCreate&&n.updateOrCreate.formType,l=this.getSavedPageHtml();if(this.debugLog("warn","completeBuilderInitialization(): draft presence",{key:this.getLocalStorageItemName.value,hasLocalDraft:!!l,draftBytes:typeof l=="string"?l.length:0,isPageBuilderMissingOnStart:this.isPageBuilderMissingOnStart,hasPendingMountComponents:!!this.pendingMountComponents,hasPassedComponents:!!e}),await this.clearHtmlSelection(),t!==this.activeBuilderSessionToken)return;if(a==="update"||a==="create"){if(!this.pendingMountComponents){if(!e&&this.isPageBuilderMissingOnStart&&l){this.debugLog("warn","completeBuilderInitialization(): mounting from local draft (missing-on-start)"),await this.completeMountProcess(l,void 0,t);return}if(e&&!l){this.debugLog("warn","completeBuilderInitialization(): mounting from passed components (no draft)");const s=this.renderComponentsToHtml(e);await this.completeMountProcess(s,!0,t),this.saveDomComponentsToLocalStorage();return}if(e&&l){if(this.isPageBuilderMissingOnStart){this.debugLog("warn","completeBuilderInitialization(): missing-on-start + passed + draft → mount draft directly",{key:this.getLocalStorageItemName.value}),await this.completeMountProcess(l,void 0,t);return}this.debugLog("warn","completeBuilderInitialization(): both passed + draft exist → showing resume modal",{key:this.getLocalStorageItemName.value});const s=this.renderComponentsToHtml(e);await this.completeMountProcess(s,!0,t),await je(500),this.pageBuilderStateStore.setHasLocalDraftForUpdate(!0);return}if(!e&&l&&!this.pendingMountComponents){this.debugLog("warn","completeBuilderInitialization(): mounting from local draft (default path)"),await this.completeMountProcess(l,void 0,t);return}if(!e&&!l&&this.isPageBuilderMissingOnStart){const s=this.renderComponentsToHtml([]);await this.completeMountProcess(s,void 0,t);return}if(!this.isPageBuilderMissingOnStart&&!l&&!e){const s=this.renderComponentsToHtml([]);await this.completeMountProcess(s,void 0,t);return}}if(this.pendingMountComponents){if(l&&this.isPageBuilderMissingOnStart){this.debugLog("warn","completeBuilderInitialization(): pending mount + draft → mounting draft (draft wins)"),this.pendingMountComponents=null,await this.completeMountProcess(l,void 0,t),this.pendingMountComponents=null;return}if(!l&&e&&this.isPageBuilderMissingOnStart){this.debugLog("warn","completeBuilderInitialization(): pending mount (no draft) → mount and save");const s=this.renderComponentsToHtml(this.pendingMountComponents);await this.completeMountProcess(s,!0,t),this.saveDomComponentsToLocalStorage();return}if(!e&&!l&&this.isPageBuilderMissingOnStart){const s=this.renderComponentsToHtml(this.pendingMountComponents);await this.completeMountProcess(s,!0,t),this.saveDomComponentsToLocalStorage();return}}}}finally{i&&this.pageBuilderStateStore.setIsLoadingGlobal(!1)}}renderComponentsToHtml(e){return!e||Array.isArray(e)&&e.length===0?'<div id="pagebuilder" class="pbx-text-black pbx-font-sans"></div>':e.map(i=>i.html_code).join(`
414
- `)}async completeMountProcess(e,t,i=this.activeBuilderSessionToken){if(i!==this.activeBuilderSessionToken){this.pageBuilderStateStore.setIsLoadingGlobal(!1);return}if(await this.mountComponentsToDOM(e,t),i!==this.activeBuilderSessionToken){this.pageBuilderStateStore.setIsLoadingGlobal(!1);return}this.deleteOldPageBuilderLocalStorage(),this.pageBuilderStateStore.setIsRestoring(!1),this.hasCompletedBuilderMount=!0,this.builderWasMountedBeforeClose=!0,this.pendingMountComponents=null,this.isPageBuilderMissingOnStart=!1,this.pageBuilderStateStore.setIsLoadingGlobal(!1),this.debugLog("warn","completeMountProcess(): loading OFF + mount complete",{sessionToken:i,hasCompletedBuilderMount:this.hasCompletedBuilderMount})}applyElementClassChanges(e,t,i){const n=this.getElement.value;if(!n)return;const a=t===vt.roundedGlobal||t===vt.roundedTopLeft||t===vt.roundedTopRight||t===vt.roundedBottomLeft||t===vt.roundedBottomRight,l=(()=>{if(!a||n.tagName==="A")return null;const b=Array.from(n.querySelectorAll("a")).filter(g=>g instanceof HTMLAnchorElement),m=b.find(g=>t.some(x=>x!=="none"&&g.classList.contains(x)));return m||(n.id==="linktree"||n.classList.contains("pbx-product-card-cta")?b[0]??null:null)})(),s=a&&n.tagName==="IMG"?n.closest(".pbx-product-card-image"):null,p=l instanceof HTMLElement?l:s instanceof HTMLElement?s:n,d=t.find(b=>p.classList.contains(b))||(l instanceof HTMLElement?t.find(b=>n.classList.contains(b)):void 0);let c=d||"none";if(e===void 0){if(typeof i=="string"&&i.length>2&&i in this.pageBuilderStateStore&&typeof this.pageBuilderStateStore[i]=="function"){const b=this.pageBuilderStateStore[i];b(c)}return d}if(typeof e=="string"&&e!=="none"?(c&&(p.classList.contains(c)&&p.classList.remove(c),l instanceof HTMLElement&&n.classList.contains(c)&&n.classList.remove(c)),t.forEach(b=>{b!=="none"&&["lg","md","sm","xl","2xl"].forEach(m=>{const g=`${m}:${b}`;p.classList.contains(g)&&p.classList.remove(g),l instanceof HTMLElement&&n.classList.contains(g)&&n.classList.remove(g)})}),p.classList.add(e),c=e):typeof e=="string"&&e==="none"&&c&&(p.classList.remove(c),l instanceof HTMLElement&&n.classList.remove(c),t.forEach(b=>{b!=="none"&&["lg","md","sm","xl","2xl"].forEach(m=>{const g=`${m}:${b}`;p.classList.contains(g)&&p.classList.remove(g),l instanceof HTMLElement&&n.classList.contains(g)&&n.classList.remove(g)})}),c=e),typeof i=="string"&&i.length>2&&i in this.pageBuilderStateStore&&typeof this.pageBuilderStateStore[i]=="function"){const b=this.pageBuilderStateStore[i];b(c),this.pageBuilderStateStore.getInlineTipTapEditor||this.pageBuilderStateStore.setElement(n)}return d}removeElementClassesFromArray(e,t){t.forEach(i=>{i!=="none"&&e.classList.contains(i)&&e.classList.remove(i)})}async clearClassesFromPage(){const e=document.querySelector("#pagebuilder");e==null||e.removeAttribute("class"),this.initializeElementStyles(),await o.nextTick()}async clearInlineStylesFromPage(){const e=document.querySelector("#pagebuilder");e==null||e.removeAttribute("style"),this.initializeElementStyles(),await o.nextTick()}async globalPageStyles(){const e=document.querySelector("#pagebuilder");e&&(await this.clearHtmlSelection(),this.pageBuilderStateStore.setElement(e),e.setAttribute("data-global-selected","true"),this.globalStylesObserver&&this.globalStylesObserver.disconnect(),this.globalStylesObserver=new MutationObserver(()=>{const t=this.readCurrentPageSettings();t&&(this._lastKnownPageSettings=t)}),this.globalStylesObserver.observe(e,{attributes:!0,attributeFilter:["class","style","data-meta-title","data-meta-description"]}),await o.nextTick())}stopGlobalStylesSync(){this.globalStylesObserver&&(this.globalStylesObserver.disconnect(),this.globalStylesObserver=null)}handleFontWeight(e){this.applyElementClassChanges(e,lr.fontWeight,"setFontWeight")}handleFontSizeBase(e){this.applyElementClassChanges(e,vi.fontBase,"setFontBase")}handleFontSizeDesktop(e){const t=this.getElement.value;if(!t)return;const i={"pbx-text-9xl":"pbx-text-6xl","pbx-text-8xl":"pbx-text-5xl","pbx-text-7xl":"pbx-text-4xl","pbx-text-6xl":"pbx-text-3xl","pbx-text-5xl":"pbx-text-3xl","pbx-text-4xl":"pbx-text-2xl","pbx-text-3xl":"pbx-text-xl","pbx-text-2xl":"pbx-text-lg","pbx-text-xl":"pbx-text-base","pbx-text-lg":"pbx-text-sm","pbx-text-base":"pbx-text-xs","pbx-text-sm":"pbx-text-xs","pbx-text-xs":"pbx-text-xs"};if(e){Array.from(t.classList).forEach(p=>{this.fontSizeRegex.test(p)&&t.classList.remove(p)});const a=e.replace(/^lg:/,""),l=i[a]||a,s=`lg:${a}`;l!==a?t.classList.add(l,s):t.classList.add(l)}const n=vi.fontDesktop.find(a=>t.classList.contains(a));e||this.pageBuilderStateStore.setFontDesktop("none"),n&&!e&&this.pageBuilderStateStore.setFontDesktop(n)}ensureImagesHaveAltText(e){e.tagName==="IMG"&&!e.hasAttribute("alt")&&e.setAttribute("alt","image"),e.querySelectorAll("img:not([alt])").forEach(t=>{t.setAttribute("alt","image")})}applyHelperCSSToElements(e){if(this.wrapElementInDivIfExcluded(e),this.ensureImagesHaveAltText(e),e.tagName==="DIV"&&e.children.length===1&&["H1","H2","H3","H4","H5","H6"].includes(e.children[0].tagName)){const t=e.children[0];Array.from(e.classList).some(n=>this.fontSizeRegex.test(n))||(t.tagName==="H2"&&e.classList.add("pbx-text-3xl","lg:pbx-text-4xl","pbx-font-medium"),t.tagName==="H3"&&e.classList.add("pbx-text-2xl","lg:pbx-text-3xl","pbx-font-medium"),t.tagName==="H4"&&e.classList.add("pbx-text-xl","lg:pbx-text-2xl","pbx-font-medium"),t.tagName==="H5"&&e.classList.add("pbx-text-lg","lg:pbx-text-xl","pbx-font-medium"),t.tagName==="H6"&&e.classList.add("pbx-text-base","lg:pbx-text-base","pbx-font-medium"))}}async toggleTipTapModal(e){this.pageBuilderStateStore.setShowModalTipTap(e),await o.nextTick(),await this.addListenersToEditableElements(),e||await this.handleAutoSave()}async toggleInlineTipTapEditor(e){e&&!this.isValidTextElement(this.getElement.value)||(this.pageBuilderStateStore.setInlineTipTapEditor(e),await o.nextTick(),await this.addListenersToEditableElements(),e||(this.commitActiveInlineTipTapEditorSync(),this.saveDomComponentsToLocalStorage()))}async finishInlineTipTapEditor(e,t=!0){if(this.pageBuilderStateStore.setInlineTipTapEditor(!1),await o.nextTick(),e){const i=document.querySelector("#pagebuilder");i==null||i.querySelectorAll("[hovered]").forEach(n=>n.removeAttribute("hovered")),i==null||i.querySelectorAll("[selected]").forEach(n=>{n!==e&&n.removeAttribute("selected")}),e.removeAttribute("data-pbx-inline-tiptap"),e.setAttribute("selected",""),this.pageBuilderStateStore.setElement(e)}await o.nextTick(),await this.addListenersToEditableElements(),await this.initializeElementStyles(),await this.addListenersToEditableElements(),t&&(this.commitActiveInlineTipTapEditorSync(),this.saveDomComponentsToLocalStorage())}wrapElementInDivIfExcluded(e){var t;if(e&&this.NoneListernesTags.includes(e.tagName)&&(e.previousElementSibling&&e.previousElementSibling.tagName==="IMG"||e.nextElementSibling&&e.nextElementSibling.tagName==="IMG")){const i=document.createElement("div");(t=e.parentNode)==null||t.insertBefore(i,e),i.appendChild(e)}}isEditableElement(e){return!e||e.tagName!=="IMG"&&e.closest("[data-pb-no-select]")?!1:!this.NoneListernesTags.includes(e.tagName)}getSelectedComponentSection(){const e=this.getElement.value;return!e||!(e instanceof HTMLElement)?null:e.closest("section")}isSelectedComponentTopElement(){const e=this.getElement.value,t=this.getSelectedComponentSection();return!e||!t?!1:e.parentElement===t}selectedComponentIsFullWidth(){var e;return((e=this.getSelectedComponentSection())==null?void 0:e.classList.contains(ds))??!1}async setSelectedComponentFullWidth(e){const t=this.getSelectedComponentSection();t&&(t.classList.toggle(ds,e),await this.handleAutoSave())}isSelectedProductSection(){const e=this.getSelectedComponentSection();return(e==null?void 0:e.getAttribute("data-pbx-product-section"))==="true"}getSelectedProductSectionOptions(){const e=this.getSelectedComponentSection();return!e||!this.isSelectedProductSection()?{...Yt}:kJ(e)}getSelectedProductSectionContentAvailability(){const e=this.getSelectedComponentSection();return!e||!this.isSelectedProductSection()?{hasPrices:!1,hasImages:!1,hasButtons:!1,hasLinks:!1}:{hasPrices:hJ(e),hasImages:xJ(e),hasButtons:fJ(e),hasLinks:yJ(e)}}async updateSelectedProductSection(e){const t=this.getSelectedComponentSection();!t||!this.isSelectedProductSection()||(TJ(t,e),await this.handleAutoSave())}isGlobalFullWidth(){const e=document.querySelector("#pagebuilder");return(e==null?void 0:e.classList.contains(ds))??!1}async setGlobalFullWidth(e){const t=document.querySelector("#pagebuilder");t==null||t.classList.toggle(ds,e),this.saveDomComponentsToLocalStorage(),await this.handleAutoSave()}isSelectedElementImage(){var e;return((e=this.getElement.value)==null?void 0:e.tagName)==="IMG"}setImageSettingsModalOpen(e){this.pageBuilderStateStore.setImageSettingsPanelOpen(e)}isImageSettingsModalOpen(){return this.pageBuilderStateStore.getImageSettingsPanelOpen}findImageAspectClass(e){const t=cc.aspectRatio.find(n=>n!=="none"&&e.classList.contains(n));return t||(Array.from(e.classList).find(n=>n.startsWith("pbx-aspect-"))??null)}removeImageAspectClasses(e){Array.from(e.classList).forEach(t=>{t.startsWith("pbx-aspect-")&&e.classList.remove(t)})}handleImageObjectFit(e){this.applyElementClassChanges(e,cc.objectFit,"setImageObjectFit")}handleImageObjectPosition(e){this.applyElementClassChanges(e,cc.objectPosition,"setImageObjectPosition")}handleImageAspectRatio(e){const t=this.getElement.value;if(!(!t||t.tagName!=="IMG")){if(e===void 0){const i=this.findImageAspectClass(t);this.pageBuilderStateStore.setImageAspectRatio(i||"none");return}this.removeImageAspectClasses(t),e!=="none"&&t.classList.add(e),this.pageBuilderStateStore.setImageAspectRatio(e),this.pageBuilderStateStore.setElement(t)}}async handleImageAltText(e){const t=this.getElement.value;if(!t||t.tagName!=="IMG"||e===void 0)return;const i=e.trim();i?t.setAttribute("alt",i):t.removeAttribute("alt"),this.pageBuilderStateStore.setElement(t),await this.handleAutoSave()}getSelectedImageAltText(){const e=this.getElement.value;return!e||e.tagName!=="IMG"?"":e.getAttribute("alt")||""}attachCanvasInlineEditListeners(e){this.canvasClickCaptureListener&&e.removeEventListener("click",this.canvasClickCaptureListener,!0),this.canvasDblClickCaptureListener&&e.removeEventListener("dblclick",this.canvasDblClickCaptureListener,!0),this.canvasClickCaptureListener=t=>{this.handleCanvasClickCapture(t)},this.canvasDblClickCaptureListener=t=>{this.handleCanvasDoubleClickCapture(t)},e.addEventListener("click",this.canvasClickCaptureListener,!0),e.addEventListener("dblclick",this.canvasDblClickCaptureListener,!0)}findEditableElementFromEventTarget(e){if(!(e instanceof Element))return null;const t=document.querySelector("#pagebuilder");let i=e;for(;i&&i!==t;){if(i instanceof HTMLElement&&this.isEditableElement(i))return i;i=i.parentElement}return null}async openInlineTipTapFromEvent(e){if(this.pageBuilderStateStore.getImageSettingsPanelOpen||(this.pageBuilderStateStore.getInlineTipTapEditor&&!this.hasInlineTipTapElement()&&this.pageBuilderStateStore.setInlineTipTapEditor(!1),this.pageBuilderStateStore.getInlineTipTapEditor))return;const t=this.findEditableElementFromEventTarget(e.target);if(!t||!this.isValidTextElement(t)){e.target instanceof Element&&(e.target.tagName==="IMG"||e.target.closest("img"))&&e.stopPropagation();return}e.preventDefault(),e.stopPropagation(),this.pageBuilderStateStore.setElement(t),this.pageBuilderStateStore.setInlineTipTapEditor(!0),await this.openInlineTipTapForElement(t)}hasInlineTipTapElement(){return!!document.querySelector("#pagebuilder [data-pbx-inline-tiptap]")}commitActiveInlineTipTapEditorSync(){const e=document.querySelector("#pagebuilder [data-pbx-inline-tiptap]");if(!e)return null;const t=e.querySelector(".ProseMirror"),i=e.getAttribute("data-pbx-inline-original-html")??"",n=this.pageBuilderStateStore.getTextAreaVueModel,a=typeof n=="string"&&n.trim().length>0?n:(t==null?void 0:t.innerHTML)??e.innerHTML,l=Ud(a,i);return e.innerHTML=l,e.removeAttribute("data-pbx-inline-tiptap"),e.removeAttribute("data-pbx-inline-original-html"),this.pageBuilderStateStore.setTextAreaVueModel(l),this.pageBuilderStateStore.setInlineTipTapEditor(!1),e}flushPendingEditsToLocalStorage(){this.commitActiveInlineTipTapEditorSync(),this.saveDomComponentsToLocalStorage()}async finishActiveInlineTipTapEditorFromDom(e=null){const t=this.commitActiveInlineTipTapEditorSync();if(!t){await this.toggleInlineTipTapEditor(!1);return}this.pageBuilderStateStore.setElement(t),await this.finishInlineTipTapEditor(t,!1),e&&e!==t&&await this.selectEditableElement(e,!1),this.saveDomComponentsToLocalStorage(),this.handleAutoSave()}async openInlineTipTapForElement(e){this.isValidTextElement(e)&&(await this.selectEditableElement(e,!1),await o.nextTick(),await this.addListenersToEditableElements())}async selectEditableElement(e,t=!0){const i=document.querySelector("#pagebuilder");if(!i){this.debugLog("warn","selectEditableElement(): #pagebuilder missing; cannot select/save",{elementTag:e==null?void 0:e.tagName,elementId:(e==null?void 0:e.id)??null,key:this.getLocalStorageItemName.value});return}this.pageBuilderStateStore.setMenuRight(!0);const n=i.querySelector("[selected]");if(n&&n.removeAttribute("selected"),e.removeAttribute("hovered"),e.setAttribute("selected",""),this.pageBuilderStateStore.setElement(e),await o.nextTick(),await this.initializeElementStyles(),t){const a=this.pageBuilderStateStore.getPageBuilderConfig,l=a&&a.userSettings?a.userSettings.autoSave:void 0;this.saveDomComponentsToLocalStorage(),l!==!1&&this.handleAutoSave()}}getHistoryBaseKey(){return this.getLocalStorageItemName.value}initializeHistory(){const e=this.getHistoryBaseKey();if(e){const t=Li.getHistory(e);this.pageBuilderStateStore.setHistoryIndex(t.length-1),this.pageBuilderStateStore.setHistoryLength(t.length)}}cloneCompObjForDOMInsertion(e){const t={...e},i=document.querySelector("#page-builder-wrapper");i&&this.getComponentArrayAddMethod.value==="unshift"&&i.scrollTo({top:0,behavior:"smooth"});const a=new DOMParser().parseFromString(t.html_code||"","text/html");a.querySelectorAll("*").forEach(p=>{this.applyHelperCSSToElements(p)});const s=a.querySelector("section");return s&&(s.querySelectorAll("[class]").forEach(p=>{p.setAttribute("class",this.addTailwindPrefixToClasses(p.getAttribute("class")||"","pbx-"))}),s.dataset.componentid=Dz(),t.title&&s.setAttribute("data-component-title",t.title),t.id=s.dataset.componentid,t.html_code=s.outerHTML),t}async removeHoveredAndSelected(){const e=document.querySelector("#pagebuilder");if(!e)return;const t=e.querySelector("[hovered]");t&&t.removeAttribute("hovered");const i=e.querySelector("[selected]");i&&i.removeAttribute("selected")}async syncCurrentClasses(){var t;const e=Array.from(((t=this.getElement.value)==null?void 0:t.classList)||[]);this.pageBuilderStateStore.setCurrentClasses(e)}async syncCurrentStyles(){var t;const e=(t=this.getElement.value)==null?void 0:t.getAttribute("style");if(e){const i=this.parseStyleString(e);this.pageBuilderStateStore.setCurrentStyles(i)}else this.pageBuilderStateStore.setCurrentStyles({})}handleAddClasses(e){var t,i;if(typeof e=="string"&&e.trim()!==""&&!e.includes(" ")&&!((t=this.getElement.value)!=null&&t.classList.contains("pbx-"+e.trim()))){const n=e.trim(),a=n.startsWith("pbx-")?n:"pbx-"+n;(i=this.getElement.value)==null||i.classList.add(a),this.pageBuilderStateStore.setElement(this.getElement.value),this.pageBuilderStateStore.setClass(a)}}handleAddStyle(e,t){const i=this.getElement.value;!i||!e||!t||(i.style.setProperty(e,t),this.pageBuilderStateStore.setElement(i))}handleRemoveStyle(e){const t=this.getElement.value;!t||!e||(t.style.removeProperty(e),this.pageBuilderStateStore.setElement(t))}handleFontFamily(e){var i;const t=bD((i=this.pageBuilderStateStore.getPageBuilderConfig)==null?void 0:i.userSettings);this.applyElementClassChanges(e,t,"setFontFamily")}handleFontStyle(e){this.applyElementClassChanges(e,lr.fontStyle,"setFontStyle")}purgeConflictingClasses(e){const t=this.getElement.value;t&&e.forEach(i=>{i.forEach(n=>{n!=="none"&&t.classList.contains(n)&&t.classList.remove(n)})})}handleVerticalPadding(e){e!==void 0&&this.purgeConflictingClasses([ce.topPadding,ce.bottomPadding]),this.applyElementClassChanges(e,ce.verticalPadding,"setFontVerticalPadding")}handleHorizontalPadding(e){e!==void 0&&this.purgeConflictingClasses([ce.leftPadding,ce.rightPadding]),this.applyElementClassChanges(e,ce.horizontalPadding,"setFontHorizontalPadding")}handleTopPadding(e){e!==void 0&&this.purgeConflictingClasses([ce.verticalPadding]),this.applyElementClassChanges(e,ce.topPadding,"setFontTopPadding")}handleRightPadding(e){e!==void 0&&this.purgeConflictingClasses([ce.horizontalPadding]),this.applyElementClassChanges(e,ce.rightPadding,"setFontRightPadding")}handleBottomPadding(e){e!==void 0&&this.purgeConflictingClasses([ce.verticalPadding]),this.applyElementClassChanges(e,ce.bottomPadding,"setFontBottomPadding")}handleLeftPadding(e){e!==void 0&&this.purgeConflictingClasses([ce.horizontalPadding]),this.applyElementClassChanges(e,ce.leftPadding,"setFontLeftPadding")}handleVerticalMargin(e){e!==void 0&&this.purgeConflictingClasses([ce.topMargin,ce.bottomMargin]),this.applyElementClassChanges(e,ce.verticalMargin,"setFontVerticalMargin")}handleHorizontalMargin(e){e!==void 0&&this.purgeConflictingClasses([ce.leftMargin,ce.rightMargin]),this.applyElementClassChanges(e,ce.horizontalMargin,"setFontHorizontalMargin")}handleTopMargin(e){e!==void 0&&this.purgeConflictingClasses([ce.verticalMargin]),this.applyElementClassChanges(e,ce.topMargin,"setFontTopMargin")}handleRightMargin(e){e!==void 0&&this.purgeConflictingClasses([ce.horizontalMargin]),this.applyElementClassChanges(e,ce.rightMargin,"setFontRightMargin")}handleBottomMargin(e){e!==void 0&&this.purgeConflictingClasses([ce.verticalMargin]),this.applyElementClassChanges(e,ce.bottomMargin,"setFontBottomMargin")}handleLeftMargin(e){e!==void 0&&this.purgeConflictingClasses([ce.horizontalMargin]),this.applyElementClassChanges(e,ce.leftMargin,"setFontLeftMargin")}handleBorderStyle(e){this.applyElementClassChanges(e,Bi.borderStyle,"setBorderStyle")}handleBorderWidth(e){this.applyElementClassChanges(e,Bi.borderWidth,"setBorderWidth")}handleBorderColor(e){this.applyElementClassChanges(e,Bi.borderColor,"setBorderColor")}handleBackgroundColor(e){var t,i;if(e===void 0){const n=(t=this.getElement.value)==null?void 0:t.style.getPropertyValue("background-color");if(n){this.pageBuilderStateStore.setBackgroundColor(`custom:${Kt(n)??n}`);return}}else(i=this.getElement.value)==null||i.style.removeProperty("background-color");this.applyElementClassChanges(e,Ti.backgroundColorVariables,"setBackgroundColor")}handleCustomBackgroundColor(e){const t=this.getElement.value;!t||!e||(this.removeElementClassesFromArray(t,Ti.backgroundColorVariables),t.style.setProperty("background-color",e),this.pageBuilderStateStore.setBackgroundColor(`custom:${e}`),this.pageBuilderStateStore.setElement(t))}handleTextColor(e){var t,i;if(e===void 0){const n=(t=this.getElement.value)==null?void 0:t.style.getPropertyValue("color");if(n){this.pageBuilderStateStore.setTextColor(`custom:${Kt(n)??n}`);return}}else(i=this.getElement.value)==null||i.style.removeProperty("color");this.applyElementClassChanges(e,Ti.textColorVariables,"setTextColor")}handleCustomTextColor(e){const t=this.getElement.value;!t||!e||(this.removeElementClassesFromArray(t,Ti.textColorVariables),t.style.setProperty("color",e),this.pageBuilderStateStore.setTextColor(`custom:${e}`),this.pageBuilderStateStore.setElement(t))}handleBorderRadiusGlobal(e){this.applyElementClassChanges(e,vt.roundedGlobal,"setBorderRadiusGlobal")}handleBorderRadiusTopLeft(e){this.applyElementClassChanges(e,vt.roundedTopLeft,"setBorderRadiusTopLeft")}handleBorderRadiusTopRight(e){this.applyElementClassChanges(e,vt.roundedTopRight,"setBorderRadiusTopRight")}handleBorderRadiusBottomleft(e){this.applyElementClassChanges(e,vt.roundedBottomLeft,"setBorderRadiusBottomleft")}handleBorderRadiusBottomRight(e){this.applyElementClassChanges(e,vt.roundedBottomRight,"setBorderRadiusBottomRight")}handleFontSizeTablet(e){this.applyElementClassChanges(e,vi.fontTablet,"setFontTablet")}handleFontSizeMobile(e){this.applyElementClassChanges(e,vi.fontMobile,"setFontMobile")}handleBackgroundOpacity(e){this.applyElementClassChanges(e,ss.backgroundOpacities,"setBackgroundOpacity")}handleOpacity(e){this.applyElementClassChanges(e,ss.opacities,"setOpacity")}deleteAllComponentsFromDOM(){this.pageBuilderStateStore.setComponents([]);const e=document.querySelector("#pagebuilder");e&&e.querySelectorAll("section[data-componentid]").forEach(t=>t.remove())}async undo(){this.pageBuilderStateStore.setIsLoadingGlobal(!0),await je(300);const e=this.getHistoryBaseKey();if(!e)return;const t=Li.getHistory(e);if(t.length>1&&this.pageBuilderStateStore.getHistoryIndex>0){this.pageBuilderStateStore.setHistoryIndex(this.pageBuilderStateStore.getHistoryIndex-1);const i=t[this.pageBuilderStateStore.getHistoryIndex],n=this.renderComponentsToHtml(i.components);await this.mountComponentsToDOM(n,!1,i.pageSettings)}this.pageBuilderStateStore.setIsLoadingGlobal(!1)}async redo(){this.pageBuilderStateStore.setIsLoadingGlobal(!0),await je(300);const e=this.getHistoryBaseKey();if(!e)return;const t=Li.getHistory(e);if(t.length>0&&this.pageBuilderStateStore.getHistoryIndex<t.length-1){this.pageBuilderStateStore.setHistoryIndex(this.pageBuilderStateStore.getHistoryIndex+1);const i=t[this.pageBuilderStateStore.getHistoryIndex],n=this.renderComponentsToHtml(i.components);await this.mountComponentsToDOM(n,!1,i.pageSettings)}this.pageBuilderStateStore.setIsLoadingGlobal(!1)}hasVisibleContent(e){if(!e)return!1;if(e.querySelector("img, video, iframe, input, button, a, h1, h2, h3, h4, h5, h6, p, li, blockquote, pre, code, table"))return!0;const i=document.createTreeWalker(e,NodeFilter.SHOW_TEXT,null);for(;i.nextNode();)if(i.currentNode.nodeValue&&i.currentNode.nodeValue.trim()!=="")return!0;return!1}isSectionEmpty(e){return!this.hasVisibleContent(e)}findReverseableContainer(){const e=this.getSelectedComponentSection();if(!e)return null;const t=['[class*="flex-row"]','[class*="pbx-flex-row"]','[class*="grid-cols-2"]','[class*="pbx-grid-cols-2"]'];for(const i of t){const n=Array.from(e.querySelectorAll(i));for(const a of n)if(Array.from(a.children).filter(s=>s instanceof HTMLElement).length===2)return a}return null}async reverseComponentLayout(){const e=this.findReverseableContainer();if(!e)return;const t=Array.from(e.children);t.length===2&&(e.insertBefore(t[1],t[0]),await this.syncDomToStoreOnly(),await o.nextTick(),this.saveDomComponentsToLocalStorage(),await this.handleAutoSave(),this.pageBuilderStateStore.setComponent(null),this.pageBuilderStateStore.setElement(null),await this.clearHtmlSelection(),await o.nextTick(),await this.addListenersToEditableElements())}async duplicateComponent(){await this.syncDomToStoreOnly(),await o.nextTick();const e=this.pageBuilderStateStore.getComponents,t=this.getComponent.value;if(!e||!t)return;const i=e.findIndex(l=>l.id===t.id);if(i===-1)return;const n=this.cloneCompObjForDOMInsertion(e[i]),a=[...e.slice(0,i+1),n,...e.slice(i+1)];await this.setComponentsPreservingPageSettings(a),await o.nextTick(),await this.addListenersToEditableElements(),this.pageBuilderStateStore.setComponent(n),this.pageBuilderStateStore.setElement(null),await this.handleAutoSave()}async deleteComponentFromDOM(){await this.syncDomToStoreOnly(),await o.nextTick();const e=this.pageBuilderStateStore.getComponents;if(!e)return;const t=e.findIndex(n=>this.getComponent.value?n.id===this.getComponent.value.id:!1);if(t===-1)return;const i=[...e.slice(0,t),...e.slice(t+1)];await this.setComponentsPreservingPageSettings(i),await o.nextTick(),await this.addListenersToEditableElements(),this.pageBuilderStateStore.setComponent(null),this.pageBuilderStateStore.setElement(null),await this.handleAutoSave()}async duplicateElementInDOM(){const e=this.getElement.value;if(!e||!e.parentNode)return;e.removeAttribute("selected");const t=e.cloneNode(!0);e.parentNode.insertBefore(t,e.nextSibling),await this.syncDomToStoreOnly(),await this.addListenersToEditableElements(),this.pageBuilderStateStore.setComponent(null),this.pageBuilderStateStore.setElement(null),this.saveDomComponentsToLocalStorage(),await this.handleAutoSave()}async deleteElementFromDOM(){const e=this.getElement.value;if(!e)return;if(e.removeAttribute("selected"),!e.parentNode){this.pageBuilderStateStore.setComponent(null),this.pageBuilderStateStore.setElement(null);return}const t=e.closest("section");e.tagName==="SECTION"?await this.deleteComponentFromDOM():(e.remove(),t&&this.isSectionEmpty(t)&&t.remove(),await this.syncDomToStoreOnly(),this.saveDomComponentsToLocalStorage()),this.pageBuilderStateStore.setComponent(null),this.pageBuilderStateStore.setElement(null),await this.clearHtmlSelection(),await o.nextTick(),await this.addListenersToEditableElements()}handleRemoveClasses(e){var t,i;(t=this.getElement.value)!=null&&t.classList.contains(e)&&((i=this.getElement.value)==null||i.classList.remove(e),this.pageBuilderStateStore.setElement(this.getElement.value),this.pageBuilderStateStore.removeClass(e))}async reorderComponent(e){if(!this.getComponents.value||!this.getComponent.value||this.getComponents.value.length<=1)return;const t=this.getComponent.value,i=this.getComponents.value.findIndex(s=>s.id===t.id);if(i===-1)return;const n=i+e;if(n<0||n>=this.getComponents.value.length)return;this.getComponents.value.splice(i,1),this.getComponents.value.splice(n,0,t),await o.nextTick();const a=document.querySelector("#page-builder-wrapper"),l=a==null?void 0:a.querySelector(`section[data-componentid="${t.id}"]`);if(l){l.classList.add("pbx-reorder-highlight");const s=l.previousElementSibling,p=l.nextElementSibling;s&&s.tagName==="SECTION"&&s.classList.add("pbx-sibling-highlight"),p&&p.tagName==="SECTION"&&p.classList.add("pbx-sibling-highlight"),a&&($pe(a,l),window.setTimeout(()=>{l.classList.remove("pbx-reorder-highlight"),s&&s.tagName==="SECTION"&&s.classList.remove("pbx-sibling-highlight"),p&&p.tagName==="SECTION"&&p.classList.remove("pbx-sibling-highlight")},280))}}canMoveUp(){return!this.getComponents.value||!this.getComponent.value?!1:this.getComponents.value.findIndex(t=>{var i;return t.id===((i=this.getComponent.value)==null?void 0:i.id)})>0}canMoveDown(){return!this.getComponents.value||!this.getComponent.value?!1:this.getComponents.value.findIndex(t=>{var i;return t.id===((i=this.getComponent.value)==null?void 0:i.id)})<this.getComponents.value.length-1}ElOrFirstChildIsIframe(){var e,t,i;return((e=this.getElement.value)==null?void 0:e.tagName)==="IFRAME"||((i=(t=this.getElement.value)==null?void 0:t.firstElementChild)==null?void 0:i.tagName)==="IFRAME"}isValidTextElement(e){var n;if(!e||e.hasAttribute("data-pb-no-inline-text")||e.tagName==="IMG"||((n=e.firstElementChild)==null?void 0:n.tagName)==="IFRAME"||e.querySelector("img")||e.classList.contains("pbx-product-card-image")||e.classList.contains("product-card-image"))return!1;const t=e.children;if(!t.length)return!1;let i=!1;return Array.from(t).forEach(a=>{a.tagName==="IMG"||a.tagName==="DIV"?i=!1:i=!0}),i}isSelectedElementValidText(){return this.isValidTextElement(this.getElement.value)}previewCurrentDesign(){this.pageBuilderStateStore.setElement(null);const e=document.querySelector("#pagebuilder");if(e&&e){const t=Ez(e,this.pageBuilderStateStore.getPageBuilderConfig?this.pageBuilderStateStore.getPageBuilderConfig:void 0),i=JSON.stringify([t]);this.pageBuilderStateStore.setCurrentLayoutPreview(i)}}sanitizeForLocalStorage(e){return e.trim().toLowerCase().replace(/\s+/g,"-").replace(/[^a-z0-9-]/g,"").replace(/-+/g,"-").replace(/^-+|-+$/g,"")}cloneAndRemoveSelectionAttributes(e){const t=e.cloneNode(!0);return t.querySelectorAll("[hovered]").forEach(i=>i.removeAttribute("hovered")),t.querySelectorAll("[selected]").forEach(i=>i.removeAttribute("selected")),t.removeAttribute("hovered"),t.removeAttribute("selected"),t}async syncDomToStoreOnly(){const e=document.querySelector("#pagebuilder");if(!e)return;const t=[];e.querySelectorAll("section[data-componentid]").forEach(i=>{const n=this.cloneAndRemoveSelectionAttributes(i);t.push({html_code:n.outerHTML,id:n.getAttribute("data-componentid"),title:n.getAttribute("data-component-title")||"Untitled Component"})}),await this.setComponentsPreservingPageSettings(t)}async generateHtmlFromComponents(){await this.syncDomToStoreOnly(),await o.nextTick();const e=this.pageBuilderStateStore.getComponents;return Array.isArray(e)?(await o.nextTick(),await this.addListenersToEditableElements(),e.map(t=>t.html_code.replace(/data-componentid="[^"]*"/g,"").replace(/\s{2,}/g," ")).join(`
415
- `)):""}async generateFullPageHtml(){await this.syncDomToStoreOnly(),await o.nextTick();const e=this.pageBuilderStateStore.getComponents;if(!Array.isArray(e))return"";await o.nextTick(),await this.addListenersToEditableElements();const t=this.readCurrentPageSettings()??this._lastKnownPageSettings,i=document.createElement("div");if(i.setAttribute("id","pagebuilder"),t!=null&&t.classes&&i.setAttribute("class",t.classes),t!=null&&t.style){const n=typeof t.style=="string"?t.style:this.convertStyleObjectToString(t.style)||"";n&&i.setAttribute("style",n)}return uc(i,Rn(t)),e.forEach(n=>{const s=new DOMParser().parseFromString(n.html_code,"text/html").querySelector("section");if(s){s.removeAttribute("data-componentid"),i.appendChild(document.importNode(s,!0));return}i.insertAdjacentHTML("beforeend",n.html_code)}),i.outerHTML}saveDomComponentsToLocalStorage(){this.commitActiveInlineTipTapEditorSync(),this.getLocalStorageItemName.value||this.updateLocalStorageItemName();const e=this.getLocalStorageItemName.value;e||this.debugLog("warn","saveDomComponentsToLocalStorage(): no storage key resolved",{config:this.pageBuilderStateStore.getPageBuilderConfig??null});const t=document.querySelector("#pagebuilder");if(!t){this.debugLog("warn","saveDomComponentsToLocalStorage(): no #pagebuilder in DOM",{key:e});return}const i=t.querySelector("[hovered]");i&&i.removeAttribute("hovered");const n=[];t.querySelectorAll("section[data-componentid]").forEach(d=>{const c=this.cloneAndRemoveSelectionAttributes(d);c.removeAttribute("data-componentid"),n.push({html_code:c.outerHTML,title:c.getAttribute("data-component-title")||"Untitled Component"})}),this.debugLog("warn","saveDomComponentsToLocalStorage(): collected sections",{key:e,sections:n.length,hasSelected:!!t.querySelector("[selected]"),hasInlineTipTap:!!t.querySelector("[data-pbx-inline-tiptap]")});const a=this.readCurrentPageSettings()??this._lastKnownPageSettings??{classes:"",style:""},l=this.pageBuilderStateStore.getPageBuilderConfig;l&&typeof l=="object"&&this.pageBuilderStateStore.setPageBuilderConfig({...l,pageSettings:a}),this.debugLog("warn","saveDomComponentsToLocalStorage(): pageSettings snapshot",{classes:(a==null?void 0:a.classes)??"",style:typeof(a==null?void 0:a.style)=="string"?a.style:a!=null&&a.style?this.convertStyleObjectToString(a.style):""});const s={components:n,pageBuilderContentSavedAt:new Date().toISOString(),pageSettings:a},p=this.getHistoryBaseKey();if(p){const d=localStorage.getItem(p);this.debugLog("warn","saveDomComponentsToLocalStorage(): existing key?",{baseKey:p,hasExisting:!!d});try{localStorage.setItem(p,JSON.stringify(s))}catch(c){this.debugLog("error","saveDomComponentsToLocalStorage(): localStorage.setItem failed",{baseKey:p,err:c});return}if(d){const c=JSON.parse(d),b=c.components||[],m=s.components||[],g=m.length!==b.length||m.some((u,h)=>{const f=b[h];return!f||f.html_code!==u.html_code}),x=c.pageSettings&&c.pageSettings.classes!==s.pageSettings.classes||c.pageSettings&&c.pageSettings.style!==s.pageSettings.style;if(g||x){this.debugLog("error","saveDomComponentsToLocalStorage(): wrote draft",{baseKey:p,sections:s.components.length});let u=Li.getHistory(p);const h=u[u.length-1];if(h){const f=JSON.stringify(h.components),w=JSON.stringify(s.components),y=JSON.stringify(h.pageSettings),E=JSON.stringify(s.pageSettings);if(f===w&&y===E)return}this.pageBuilderStateStore.getHistoryIndex<u.length-1&&(u=u.slice(0,this.pageBuilderStateStore.getHistoryIndex+1)),u.push(s),u.length>10&&(u=u.slice(u.length-10)),localStorage.setItem(p+"-history",JSON.stringify(u)),this.pageBuilderStateStore.setHistoryIndex(u.length-1),this.pageBuilderStateStore.setHistoryLength(u.length);return}}}}async removeCurrentComponentsFromLocalStorage(){this.updateLocalStorageItemName(),await o.nextTick();const e=this.getLocalStorageItemName.value;e&&localStorage.removeItem(e)}async handleFormSubmission(){const e=this.readCurrentPageSettings();if(e&&(this._lastKnownPageSettings=e),await this.removeCurrentComponentsFromLocalStorage(),this.deleteAllComponentsFromDOM(),this.pageBuilderStateStore.setComponents([]),e){this.updateLocalStorageItemName();const t=this.getLocalStorageItemName.value;if(t){const i={components:[],pageBuilderContentSavedAt:new Date().toISOString(),pageSettings:e};localStorage.setItem(t,JSON.stringify(i))}}}readCurrentPageSettings(){const e=document.querySelector("#pagebuilder");if(e)return{classes:e.className||"",style:e.getAttribute("style")||e.style.cssText||"",meta:ps(e)};const t=document.querySelector("[data-pagebuilder-content]");if(t)return{classes:t.className||"",style:t.getAttribute("style")||t.style.cssText||""};this.updateLocalStorageItemName();const i=this.getLocalStorageItemName.value;if(i)try{const n=localStorage.getItem(i);if(n){const a=JSON.parse(n);if(a!=null&&a.pageSettings)return a.pageSettings}}catch{}return null}applyPageSettingsToPage(e){const t=document.querySelector("#pagebuilder");if(t){e.classes?t.setAttribute("class",e.classes):t.removeAttribute("class");const i=typeof e.style=="string"?e.style:this.convertStyleObjectToString(e.style)||"";i?t.setAttribute("style",i):t.removeAttribute("style"),uc(t,Rn(e))}document.querySelectorAll("[data-pagebuilder-content]").forEach(i=>{i.removeAttribute("class"),i.removeAttribute("style")}),(e.classes||e.style||e.meta)&&(this._lastKnownPageSettings=e)}reconnectGlobalStylesObserver(){if(!this.globalStylesObserver)return;const e=document.querySelector("#pagebuilder");e&&(this.globalStylesObserver.disconnect(),this.globalStylesObserver=new MutationObserver(()=>{const t=this.readCurrentPageSettings();t&&(this._lastKnownPageSettings=t)}),this.globalStylesObserver.observe(e,{attributes:!0,attributeFilter:["class","style","data-meta-title","data-meta-description"]}))}async setComponentsPreservingPageSettings(e){var n;const t=this.readCurrentPageSettings()??this._lastKnownPageSettings??null,i=this.globalStylesObserver!==null;(n=this.globalStylesObserver)==null||n.disconnect(),this.pageBuilderStateStore.setComponents(e),await o.nextTick(),await o.nextTick(),t&&(t.classes||t.style)&&this.applyPageSettingsToPage(t),i&&this.reconnectGlobalStylesObserver()}parseStyleString(e){return e.split(";").map(t=>t.trim()).filter(Boolean).reduce((t,i)=>{const[n,a]=i.split(":").map(l=>l.trim());return n&&a&&(t[n]=a),t},{})}deleteOldPageBuilderLocalStorage(){const e=this.pageBuilderStateStore.getPageBuilderConfig;if((e&&e.updateOrCreate&&e.updateOrCreate.formType)==="update"){let i=0;const n=[],a=new Date(Date.now()-336*60*60*1e3);for(let l=0;l<localStorage.length;l++){const s=localStorage.key(l);if(s&&s.startsWith("page-builder-update-resource-"))try{const p=localStorage.getItem(s);if(!p)continue;const c=JSON.parse(p).pageBuilderContentSavedAt;c&&new Date(c)<a&&(i++,n.push({Number:i,Key:s,SavedAt:c}),localStorage.removeItem(s))}catch{}}n.length>0&&(console.info(`Deleted ${n.length} localStorage item(s) older than ${a} days:`),console.table(n))}}startEditing(){this.hasStartedEditing=!0}async refreshListeners(){await o.nextTick(),await this.addListenersToEditableElements(),this.reapplyConfigPageSettingsIfMissing()}reapplyConfigPageSettingsIfMissing(){var a;const e=document.querySelector("#pagebuilder");if(!e)return;const t=((a=this.pageBuilderStateStore.getPageBuilderConfig)==null?void 0:a.pageSettings)??null;if(!this.hasMeaningfulPageSettings(t))return;const i=this.convertStyleObjectToString(t.style),n=e.getAttribute("style")||"";i.trim()&&!n.trim()&&this.applyPageSettingsToPage(t)}async resumeEditingFromDraft(){this.updateLocalStorageItemName();const e=this.getSavedPageHtml();e&&(this.pageBuilderStateStore.setIsLoadingResumeEditing(!0),await je(400),await this.mountComponentsToDOM(e),this.pageBuilderStateStore.setIsLoadingResumeEditing(!1)),await o.nextTick(),await this.addListenersToEditableElements(),this.pageBuilderStateStore.setIsLoadingResumeEditing(!1)}async restoreOriginalContent(){if(this.updateLocalStorageItemName(),this.pageBuilderStateStore.setIsRestoring(!0),await je(400),Array.isArray(this.originalComponents)){await this.clearClassesFromPage(),await this.clearInlineStylesFromPage();const e=this.renderComponentsToHtml(this.originalComponents);await this.mountComponentsToDOM(e),this.removeCurrentComponentsFromLocalStorage()}await o.nextTick(),await this.addListenersToEditableElements(),this.pageBuilderStateStore.setIsRestoring(!1)}async returnLatestComponents(){return await this.syncDomToStoreOnly(),await o.nextTick(),await this.addListenersToEditableElements(),this.pageBuilderStateStore.getComponents}getStorageItemNameForResource(){return this.getLocalStorageItemName.value}getSavedPageHtml(){if(!this.getLocalStorageItemName.value)return!1;const e=this.getLocalStorageItemName.value;if(!e)return!1;const t=localStorage.getItem(e);if(!t)return!1;const i=JSON.parse(t);if(i&&Array.isArray(i.components)){const n=i.pageSettings&&i.pageSettings.classes||"",a=i.pageSettings&&i.pageSettings.style||"",l=typeof a=="string"?a:this.convertStyleObjectToString(a),s=i.components.map(p=>{const b=new DOMParser().parseFromString(p.html_code,"text/html").querySelector("section");return b?(b.removeAttribute("data-componentid"),b.outerHTML):p.html_code}).join(`
413
+ </section>`}const mc="data-meta-title",gc="data-meta-description";function ps(r){return{title:r.getAttribute(mc)||"",description:r.getAttribute(gc)||""}}function uc(r,e){var n,a;const t=((n=e.title)==null?void 0:n.trim())||"",i=((a=e.description)==null?void 0:a.trim())||"";t?r.setAttribute(mc,t):r.removeAttribute(mc),i?r.setAttribute(gc,i):r.removeAttribute(gc)}function Rn(r){const e=r==null?void 0:r.meta;return!e||typeof e!="object"?{title:"",description:""}:{title:typeof e.title=="string"?e.title:"",description:typeof e.description=="string"?e.description:""}}function Zpe(r,e){return{...r,meta:{...Rn(r),...e}}}function $pe(r,e,t=180){const i=e.getBoundingClientRect(),n=r.getBoundingClientRect(),l=i.top-n.top+r.scrollTop-r.clientHeight/2+e.clientHeight/2,s=r.scrollTop,p=l-s;if(Math.abs(p)<1){window.dispatchEvent(new CustomEvent("pagebuilder:layout-change"));return}const d=performance.now(),c=b=>{const m=Math.min(1,(b-d)/t),g=1-(1-m)**3;if(r.scrollTop=s+p*g,window.dispatchEvent(new CustomEvent("pagebuilder:layout-change")),m<1){requestAnimationFrame(c);return}window.dispatchEvent(new CustomEvent("pagebuilder:layout-change"))};requestAnimationFrame(c)}const ede=["en","zh-Hans","fr","ja","ru","es","pt","de","ar","hi","da","it"],ds="pbx-full-width-component";class Iz{constructor(e){be(this,"fontSizeRegex",/^(sm:|md:|lg:|xl:|2xl:)?pbx-text-(xs|sm|base|lg|xl|2xl|3xl|4xl|5xl|6xl|7xl|8xl|9xl)$/);be(this,"pageBuilderStateStore");be(this,"getLocalStorageItemName");be(this,"getApplyImageToSelection");be(this,"getHyberlinkEnable");be(this,"getComponents");be(this,"getComponent");be(this,"getElement");be(this,"getComponentArrayAddMethod");be(this,"NoneListernesTags");be(this,"hasStartedEditing",!1);be(this,"originalComponents");be(this,"savedMountComponents",null);be(this,"pendingMountComponents",null);be(this,"globalStylesObserver",null);be(this,"_pendingPageSettings",null);be(this,"_lastKnownPageSettings",null);be(this,"isPageBuilderMissingOnStart",!1);be(this,"hasCompletedBuilderMount",!1);be(this,"builderWasMountedBeforeClose",!1);be(this,"builderMountPromise",null);be(this,"activeBuilderSessionToken",0);be(this,"canvasClickCaptureListener",null);be(this,"canvasDblClickCaptureListener",null);be(this,"elementsWithListeners",new WeakMap);be(this,"translate");be(this,"handleMouseOver",(e,t)=>{if(this.pageBuilderStateStore.getInlineTipTapEditor)return;e.preventDefault(),e.stopPropagation();const i=document.querySelector("#pagebuilder");if(!i)return;const n=i.querySelector("[hovered]");n&&n.removeAttribute("hovered"),t.hasAttribute("selected")||t.setAttribute("hovered","")});be(this,"handleMouseLeave",e=>{if(this.pageBuilderStateStore.getInlineTipTapEditor)return;e.preventDefault(),e.stopPropagation();const t=document.querySelector("#pagebuilder");if(!t)return;const i=t.querySelector("[hovered]");i&&i.removeAttribute("hovered")});be(this,"addListenersToEditableElements",async()=>{const e=document.querySelector("#pagebuilder");if(!e)return;await o.nextTick(),this.attachCanvasInlineEditListeners(e);let t=0,i=0;e.querySelectorAll("section *").forEach(n=>{if(this.isEditableElement(n)){t++;const a=n;if(this.elementsWithListeners.has(a)){const c=this.elementsWithListeners.get(a);c&&(a.removeEventListener("click",c.click),a.removeEventListener("dblclick",c.dblclick),a.removeEventListener("mouseover",c.mouseover),a.removeEventListener("mouseleave",c.mouseleave))}const l=c=>this.handleElementClick(c,a),s=c=>this.handleElementDoubleClick(c,a),p=c=>this.handleMouseOver(c,a),d=c=>this.handleMouseLeave(c);a.addEventListener("click",l),a.addEventListener("dblclick",s),a.addEventListener("mouseover",p),a.addEventListener("mouseleave",d),i++,this.elementsWithListeners.set(a,{click:l,dblclick:s,mouseover:p,mouseleave:d})}}),this.debugLog("log","addListenersToEditableElements(): attached listeners",{eligible:t,attached:i,hasSections:!!e.querySelector("section")})});be(this,"handleCanvasClickCapture",async e=>{if(!this.pageBuilderStateStore.getImageSettingsPanelOpen&&this.pageBuilderStateStore.getInlineTipTapEditor)if(!this.hasInlineTipTapElement())this.pageBuilderStateStore.setInlineTipTapEditor(!1);else{const t=document.querySelector("#pagebuilder [data-pbx-inline-tiptap]");if(t&&e.target instanceof Node&&!t.contains(e.target)){const i=e.target instanceof Element&&!!e.target.closest("[data-pbx-insert-btn]");i||(e.preventDefault(),e.stopPropagation());const n=i?null:this.findEditableElementFromEventTarget(e.target);this.finishActiveInlineTipTapEditorFromDom(n)}}});be(this,"handleCanvasDoubleClickCapture",async e=>{await this.openInlineTipTapFromEvent(e)});be(this,"handleElementClick",async(e,t)=>{if(!this.pageBuilderStateStore.getImageSettingsPanelOpen){if(this.pageBuilderStateStore.getInlineTipTapEditor){e.preventDefault(),e.stopPropagation();return}e.preventDefault(),e.stopPropagation(),await this.selectEditableElement(t)}});be(this,"handleElementDoubleClick",async(e,t)=>{if(!this.pageBuilderStateStore.getImageSettingsPanelOpen&&!this.pageBuilderStateStore.getInlineTipTapEditor){if(!this.isValidTextElement(t)){e.stopPropagation();return}e.preventDefault(),e.stopPropagation(),this.pageBuilderStateStore.setElement(t),this.pageBuilderStateStore.setInlineTipTapEditor(!0),await this.openInlineTipTapForElement(t),this.hasInlineTipTapElement()||this.pageBuilderStateStore.setInlineTipTapEditor(!1)}});be(this,"handleAutoSave",async()=>{if(this.startEditing(),this.pageBuilderStateStore.getInlineTipTapEditor)return;const e=this.pageBuilderStateStore.getPageBuilderConfig;if(e&&e.userSettings&&typeof e.userSettings.autoSave=="boolean"&&e.userSettings.autoSave!==!1){if(this.pageBuilderStateStore.getIsSaving)return;try{this.commitActiveInlineTipTapEditorSync(),this.pageBuilderStateStore.setIsSaving(!0),this.saveDomComponentsToLocalStorage(),await Oe(400)}catch(t){console.error("Error trying auto save.",t),this.debugLog("error","handleAutoSave(): error",t);const{showToast:i}=tt(),{translate:n}=ne();i(n("Auto-save failed — please save manually"),"error")}finally{this.pageBuilderStateStore.setIsSaving(!1)}}if(e&&!e.userSettings)try{this.commitActiveInlineTipTapEditorSync(),this.pageBuilderStateStore.setIsSaving(!0),this.saveDomComponentsToLocalStorage(),await Oe(400)}catch(t){console.error("Error trying saving.",t),this.debugLog("error","handleAutoSave(): error (no userSettings)",t);const{showToast:i}=tt(),{translate:n}=ne();i(n("Auto-save failed — please save manually"),"error")}finally{this.pageBuilderStateStore.setIsSaving(!1)}});be(this,"handleManualSave",async e=>{this.commitActiveInlineTipTapEditorSync(),await this.syncDomToStoreOnly(),this.pageBuilderStateStore.setIsSaving(!0),e||this.clearHtmlSelection(),this.startEditing(),this.saveDomComponentsToLocalStorage(),await this.refreshListeners(),await Oe(300),this.pageBuilderStateStore.setIsSaving(!1)});be(this,"ensureTextAreaHasContent",()=>{if(!this.getElement.value||typeof this.getElement.value.innerHTML!="string")return;const e=this.getElement.value,t=e.tagName;["DIV"].includes(t)&&e.tagName.toLowerCase()!=="img"&&e.textContent&&Number(e.textContent.length)===0?(e.classList.add("h-6"),e.classList.add("bg-red-50")):(e.classList.remove("h-6"),e.classList.remove("bg-red-50"))});be(this,"handleTextInput",async e=>{var t;typeof((t=this.getElement.value)==null?void 0:t.innerHTML)=="string"&&(typeof this.getElement.value.innerHTML=="string"&&(await o.nextTick(),this.getElement.value.textContent=e,this.pageBuilderStateStore.setTextAreaVueModel(this.getElement.value.innerHTML),this.getElement.value.innerHTML=e),this.ensureTextAreaHasContent())});this.hasStartedEditing=!1,this.pageBuilderStateStore=e;const{translate:t}=ne();this.translate=t,this.getApplyImageToSelection=o.computed(()=>this.pageBuilderStateStore.getApplyImageToSelection),this.getLocalStorageItemName=o.computed(()=>this.pageBuilderStateStore.getLocalStorageItemName),this.getHyberlinkEnable=o.computed(()=>this.pageBuilderStateStore.getHyberlinkEnable),this.getComponents=o.computed(()=>this.pageBuilderStateStore.getComponents),this.getComponent=o.computed(()=>this.pageBuilderStateStore.getComponent),this.getElement=o.computed(()=>this.pageBuilderStateStore.getElement),this.getComponentArrayAddMethod=o.computed(()=>this.pageBuilderStateStore.getComponentArrayAddMethod),this.NoneListernesTags=["P","H1","H2","H3","H4","H5","H6","IFRAME","UL","OL","LI","EM","STRONG","B","A","SPAN","BLOCKQUOTE","BR","PRE","CODE","MARK","DEL","INS","U","FIGURE","FIGCAPTION"]}isDebugEnabled(){try{return typeof localStorage<"u"&&localStorage.getItem("pbx-debug")==="1"}catch{return!1}}debugLog(e,t,i){if(!this.isDebugEnabled())return;const n="[PBX]";if(i!==void 0){console[e](`${n} ${t}`,i);return}console[e](`${n} ${t}`)}availableLanguage(){return ede}changeLanguage(e){this.pageBuilderStateStore.setCurrentLanguage(e)}async clearHtmlSelection(){this.pageBuilderStateStore.getImageSettingsPanelOpen||(this.pageBuilderStateStore.setComponent(null),this.pageBuilderStateStore.setElement(null),await this.removeHoveredAndSelected())}ensureUpdateOrCreateConfig(e){if(!e.updateOrCreate||e.updateOrCreate&&no(e.updateOrCreate)){const t={...e,updateOrCreate:{formType:"create",formName:"post"}};this.pageBuilderStateStore.setPageBuilderConfig(t);return}if(e.updateOrCreate&&typeof e.updateOrCreate.formType=="string"&&(e.updateOrCreate.formType==="create"||e.updateOrCreate.formType==="update")&&typeof e.updateOrCreate.formName!="string"||typeof e.updateOrCreate.formName=="string"&&e.updateOrCreate.formName.length===0){const t={...e,updateOrCreate:{formType:e.updateOrCreate.formType,formName:"post"}};this.pageBuilderStateStore.setPageBuilderConfig(t)}if(e.updateOrCreate&&typeof e.updateOrCreate.formType!="string"||typeof e.updateOrCreate.formType=="string"&&e.updateOrCreate.formType!=="create"&&e.updateOrCreate.formType!=="update"&&typeof e.updateOrCreate.formName=="string"&&e.updateOrCreate.formName.length!==0){const t={...e,updateOrCreate:{formType:"create",formName:e.updateOrCreate.formName}};this.pageBuilderStateStore.setPageBuilderConfig(t);return}if(e.updateOrCreate&&typeof e.updateOrCreate.formType=="string"&&e.updateOrCreate.formType!=="create"&&e.updateOrCreate.formType!=="update"&&typeof e.formName!="string"){const t={...e,updateOrCreate:{formType:"create",formName:"post"}};this.pageBuilderStateStore.setPageBuilderConfig(t)}}validateUserProvidedComponents(e){const t=this.pageBuilderStateStore.getPageBuilderConfig&&this.pageBuilderStateStore.getPageBuilderConfig.updateOrCreate&&this.pageBuilderStateStore.getPageBuilderConfig.updateOrCreate.formType;if(Array.isArray(e)&&e.length>=1&&t==="create"&&e)return{error:!0,warning:"You cannot set formType to create in your configuration while also passing a components data array to the Page Builder. Please set formType to update.",status:"validation_failed"};if(!Array.isArray(e))return{error:!0,reason:"Components data must be an array."};const i=e[0];if(i&&"html_code"in i&&typeof i.html_code!="string")return{error:!0,reason:"The 'html_code' property in the first object must be a string."};if(Array.isArray(e)&&e.length>=1&&(!i||!("html_code"in i)))return{error:!0,reason:"The first object in the array must include an 'html_code' key."}}ensureLanguage(e){const i=["en","zh-Hans","fr","ja","ru","es","pt","de","ar","hi","da"];let n=!1;const a=e.userSettings,l=a&&a.language;if((!a||no(a)||!l||no(l))&&(n=!0),n){const s=a?{...a}:{};s.language={default:"en",enable:i};const p={...e,userSettings:s};this.pageBuilderStateStore.setPageBuilderConfig(p);return}if(l&&Array.isArray(l.enable)&&l.default&&!l.enable.includes(l.default)){const s=[...l.enable,l.default],p={...e,userSettings:{...a,language:{...l,enable:s}}};this.pageBuilderStateStore.setPageBuilderConfig(p)}}validateConfig(e){var n;const t={updateOrCreate:{formType:"create",formName:"post"}};if(!e||e&&Object.keys(e).length===0&&e.constructor===Object){this.pageBuilderStateStore.setPageBuilderConfig(t);return}e&&Object.keys(e).length!==0&&e.constructor===Object&&(this.ensureUpdateOrCreateConfig(e),(!e.resourceData||typeof e.resourceData.title!="string"||!e.resourceData.title.trim())&&(!e.resourceData||typeof e.resourceData!="object"?e.resourceData={title:"Default Post"}:e.resourceData.title="Default Post"));let i=e;if(!i.userSettings||typeof i.userSettings!="object"||!("autoSave"in i.userSettings)){const a=i.userSettings?{...i.userSettings}:{};a.autoSave=((n=i.userSettings)==null?void 0:n.autoSave)!==!1;const l={...i,userSettings:a};this.pageBuilderStateStore.setPageBuilderConfig(l),i=l}this.ensureLanguage(i)}saveUserSettingsStorage(e){localStorage.setItem("userSettingsPageBuilder",JSON.stringify({userSettings:{lang:e}}))}async startBuilder(e,t){var d,c,b;const i=++this.activeBuilderSessionToken;this.debugLog("warn","startBuilder(): begin",{sessionToken:i,hasPassedComponentsArray:Array.isArray(t),passedComponentsLength:Array.isArray(t)?t.length:null});const n=document.querySelector("#pagebuilder"),a=!!(n!=null&&n.querySelector("section[data-componentid]"));this.debugLog("warn","startBuilder(): dom snapshot",{hasLiveMountedContent:a,hasPagebuilderEl:!!n,hasCompletedBuilderMount:this.hasCompletedBuilderMount}),a||(this.hasCompletedBuilderMount=!1,this.builderMountPromise=null,this.pendingMountComponents=null,this.isPageBuilderMissingOnStart=!1),typeof this.pageBuilderStateStore.setInlineTipTapEditor=="function"&&this.pageBuilderStateStore.setInlineTipTapEditor(!1),typeof this.pageBuilderStateStore.setShowModalTipTap=="function"&&this.pageBuilderStateStore.setShowModalTipTap(!1),typeof this.pageBuilderStateStore.setImageSettingsPanelOpen=="function"&&this.pageBuilderStateStore.setImageSettingsPanelOpen(!1),typeof this.pageBuilderStateStore.setElement=="function"&&this.pageBuilderStateStore.setElement(null),typeof this.pageBuilderStateStore.setComponent=="function"&&this.pageBuilderStateStore.setComponent(null),typeof this.pageBuilderStateStore.setIsLoadingGlobal=="function"&&this.pageBuilderStateStore.setIsLoadingGlobal(!1),this.pageBuilderStateStore.setBuilderStarted(!0);const l=document.querySelector("#pagebuilder");this.debugLog("warn","startBuilder(): #pagebuilder present?",!!l);const s=this.readCurrentPageSettings();this.hasMeaningfulPageSettings(s)&&(this._lastKnownPageSettings=s);let p;try{this.originalComponents=t,this.pageBuilderStateStore.setPageBuilderConfig(e);const m=JSON.parse(localStorage.getItem("userSettingsPageBuilder")??"null");!(m!=null&&m.lang)&&((c=(d=e.userSettings)==null?void 0:d.language)!=null&&c.default)&&this.changeLanguage(e.userSettings.language.default),this.validateConfig(e),p=this.validateUserProvidedComponents(t);const g=Array.isArray(t)&&t.length>0?t:null,x=g!==null;if(this.updateLocalStorageItemName(),this.initializeHistory(),this.debugLog("warn","startBuilder(): storage key",{key:this.getLocalStorageItemName.value}),x&&(this.savedMountComponents=g),l||(this.isPageBuilderMissingOnStart=!0),x&&!l){const h=this.getSavedPageHtml();this.debugLog("warn","startBuilder(): deferred mount decision",{existingDraft:!!h,builderWasMountedBeforeClose:this.builderWasMountedBeforeClose,willQueuePendingMount:!0}),this.pendingMountComponents=g}if(l&&(!t||Array.isArray(t))&&(this.debugLog("warn","startBuilder(): calling completeBuilderInitialization",{hasUsablePassedComponents:x,isPageBuilderMissingOnStart:this.isPageBuilderMissingOnStart}),await this.completeBuilderInitializationWithSession(x?g:void 0,i)),l&&(await this.addListenersToEditableElements(),this.debugLog("warn","startBuilder(): listeners attached (safety net)")),a&&l){const h=((b=this.pageBuilderStateStore.getPageBuilderConfig)==null?void 0:b.pageSettings)??null;if(this.hasMeaningfulPageSettings(h)){const f=this.convertStyleObjectToString(h.style),w=l.getAttribute("style")||"";f.trim()&&!w.trim()&&(await o.nextTick(),this.applyPageSettingsToPage(h))}}const u={message:"Page builder started successfully."};return p&&(u.validation=p),Array.isArray(t)&&t.length>=0&&(u.passedComponentsArray=t),u}catch(m){return console.error("Not able to start the Page Builder",m),this.debugLog("error","startBuilder(): error",m),{error:!0,reason:"Failed to start the Page Builder due to an unexpected error."}}}shouldCompleteBuilderMountOnMount(e){if(this.hasCompletedBuilderMount){if(this.isPageBuilderMissingOnStart)return this.hasCompletedBuilderMount=!1,this.builderMountPromise=null,!0;const t=e??document.querySelector("#pagebuilder"),i=!!(t!=null&&t.querySelector("section[data-componentid]"));return t&&!i?(this.hasCompletedBuilderMount=!1,this.builderMountPromise=null,!0):!1}return this.isPageBuilderMissingOnStart||!!this.pendingMountComponents}markCanvasUnmountedForNextMount(){this.hasCompletedBuilderMount=!1,this.builderMountPromise=null,this.isPageBuilderMissingOnStart=!0}async completeBuilderInitialization(e){return this.completeBuilderInitializationWithSession(e,this.activeBuilderSessionToken)}async completeBuilderInitializationWithSession(e,t=this.activeBuilderSessionToken){if(t===this.activeBuilderSessionToken){if(this.hasCompletedBuilderMount){this.pageBuilderStateStore.setIsLoadingGlobal(!1);return}this.builderMountPromise||(this.builderMountPromise=this.runCompleteBuilderInitialization(e,t));try{await this.builderMountPromise}finally{this.pageBuilderStateStore.setIsLoadingGlobal(!1)}}}async runCompleteBuilderInitialization(e,t=this.activeBuilderSessionToken){if(t!==this.activeBuilderSessionToken)return;let i=!1;try{if(this.pageBuilderStateStore.setIsLoadingGlobal(!0),i=!0,await Oe(400),t!==this.activeBuilderSessionToken)return;this.debugLog("warn","completeBuilderInitialization(): loading ON",{sessionToken:t,key:this.getLocalStorageItemName.value}),this.deleteAllComponentsFromDOM();const n=this.pageBuilderStateStore.getPageBuilderConfig,a=n&&n.updateOrCreate&&n.updateOrCreate.formType,l=this.getSavedPageHtml();if(this.debugLog("warn","completeBuilderInitialization(): draft presence",{key:this.getLocalStorageItemName.value,hasLocalDraft:!!l,draftBytes:typeof l=="string"?l.length:0,isPageBuilderMissingOnStart:this.isPageBuilderMissingOnStart,hasPendingMountComponents:!!this.pendingMountComponents,hasPassedComponents:!!e}),await this.clearHtmlSelection(),t!==this.activeBuilderSessionToken)return;if(a==="update"||a==="create"){if(!this.pendingMountComponents){if(!e&&this.isPageBuilderMissingOnStart&&l){this.debugLog("warn","completeBuilderInitialization(): mounting from local draft (missing-on-start)"),await this.completeMountProcess(l,void 0,t);return}if(e&&!l){this.debugLog("warn","completeBuilderInitialization(): mounting from passed components (no draft)");const s=this.renderComponentsToHtml(e);await this.completeMountProcess(s,!0,t),this.saveDomComponentsToLocalStorage();return}if(e&&l){this.debugLog("warn","completeBuilderInitialization(): both passed + draft exist → mounting passed content + showing resume modal",{key:this.getLocalStorageItemName.value});const s=this.renderComponentsToHtml(e);await this.completeMountProcess(s,!0,t),await Oe(500),this.pageBuilderStateStore.setHasLocalDraftForUpdate(!0);return}if(!e&&l&&!this.pendingMountComponents){this.debugLog("warn","completeBuilderInitialization(): mounting from local draft (default path)"),await this.completeMountProcess(l,void 0,t);return}if(!e&&!l&&this.isPageBuilderMissingOnStart){const s=this.renderComponentsToHtml([]);await this.completeMountProcess(s,void 0,t);return}if(!this.isPageBuilderMissingOnStart&&!l&&!e){const s=this.renderComponentsToHtml([]);await this.completeMountProcess(s,void 0,t);return}}if(this.pendingMountComponents){if(l&&this.isPageBuilderMissingOnStart){this.debugLog("warn","completeBuilderInitialization(): pending mount + draft → mounting passed content + showing resume modal");const s=this.renderComponentsToHtml(this.pendingMountComponents);await this.completeMountProcess(s,!0,t),await Oe(500),this.pageBuilderStateStore.setHasLocalDraftForUpdate(!0),this.pendingMountComponents=null;return}if(!l&&e&&this.isPageBuilderMissingOnStart){this.debugLog("warn","completeBuilderInitialization(): pending mount (no draft) → mount and save");const s=this.renderComponentsToHtml(this.pendingMountComponents);await this.completeMountProcess(s,!0,t),this.saveDomComponentsToLocalStorage();return}if(!e&&!l&&this.isPageBuilderMissingOnStart){const s=this.renderComponentsToHtml(this.pendingMountComponents);await this.completeMountProcess(s,!0,t),this.saveDomComponentsToLocalStorage();return}}}}finally{i&&this.pageBuilderStateStore.setIsLoadingGlobal(!1)}}renderComponentsToHtml(e){return!e||Array.isArray(e)&&e.length===0?'<div id="pagebuilder" class="pbx-text-black pbx-font-sans"></div>':e.map(i=>i.html_code).join(`
414
+ `)}async completeMountProcess(e,t,i=this.activeBuilderSessionToken){if(i!==this.activeBuilderSessionToken){this.pageBuilderStateStore.setIsLoadingGlobal(!1);return}if(await this.mountComponentsToDOM(e,t),i!==this.activeBuilderSessionToken){this.pageBuilderStateStore.setIsLoadingGlobal(!1);return}this.deleteOldPageBuilderLocalStorage(),this.pageBuilderStateStore.setIsRestoring(!1),this.hasCompletedBuilderMount=!0,this.builderWasMountedBeforeClose=!0,this.pendingMountComponents=null,this.isPageBuilderMissingOnStart=!1,this.pageBuilderStateStore.setIsLoadingGlobal(!1),this.debugLog("warn","completeMountProcess(): loading OFF + mount complete",{sessionToken:i,hasCompletedBuilderMount:this.hasCompletedBuilderMount})}applyElementClassChanges(e,t,i){const n=this.getElement.value;if(!n)return;const a=t===vt.roundedGlobal||t===vt.roundedTopLeft||t===vt.roundedTopRight||t===vt.roundedBottomLeft||t===vt.roundedBottomRight,l=(()=>{if(!a||n.tagName==="A")return null;const b=Array.from(n.querySelectorAll("a")).filter(g=>g instanceof HTMLAnchorElement),m=b.find(g=>t.some(x=>x!=="none"&&g.classList.contains(x)));return m||(n.id==="linktree"||n.classList.contains("pbx-product-card-cta")?b[0]??null:null)})(),s=a&&n.tagName==="IMG"?n.closest(".pbx-product-card-image"):null,p=l instanceof HTMLElement?l:s instanceof HTMLElement?s:n,d=t.find(b=>p.classList.contains(b))||(l instanceof HTMLElement?t.find(b=>n.classList.contains(b)):void 0);let c=d||"none";if(e===void 0){if(typeof i=="string"&&i.length>2&&i in this.pageBuilderStateStore&&typeof this.pageBuilderStateStore[i]=="function"){const b=this.pageBuilderStateStore[i];b(c)}return d}if(typeof e=="string"&&e!=="none"?(c&&(p.classList.contains(c)&&p.classList.remove(c),l instanceof HTMLElement&&n.classList.contains(c)&&n.classList.remove(c)),t.forEach(b=>{b!=="none"&&["lg","md","sm","xl","2xl"].forEach(m=>{const g=`${m}:${b}`;p.classList.contains(g)&&p.classList.remove(g),l instanceof HTMLElement&&n.classList.contains(g)&&n.classList.remove(g)})}),p.classList.add(e),c=e):typeof e=="string"&&e==="none"&&c&&(p.classList.remove(c),l instanceof HTMLElement&&n.classList.remove(c),t.forEach(b=>{b!=="none"&&["lg","md","sm","xl","2xl"].forEach(m=>{const g=`${m}:${b}`;p.classList.contains(g)&&p.classList.remove(g),l instanceof HTMLElement&&n.classList.contains(g)&&n.classList.remove(g)})}),c=e),typeof i=="string"&&i.length>2&&i in this.pageBuilderStateStore&&typeof this.pageBuilderStateStore[i]=="function"){const b=this.pageBuilderStateStore[i];b(c),this.pageBuilderStateStore.getInlineTipTapEditor||this.pageBuilderStateStore.setElement(n)}return d}removeElementClassesFromArray(e,t){t.forEach(i=>{i!=="none"&&e.classList.contains(i)&&e.classList.remove(i)})}async clearClassesFromPage(){const e=document.querySelector("#pagebuilder");e==null||e.removeAttribute("class"),this.initializeElementStyles(),await o.nextTick()}async clearInlineStylesFromPage(){const e=document.querySelector("#pagebuilder");e==null||e.removeAttribute("style"),this.initializeElementStyles(),await o.nextTick()}async globalPageStyles(){const e=document.querySelector("#pagebuilder");e&&(await this.clearHtmlSelection(),this.pageBuilderStateStore.setElement(e),e.setAttribute("data-global-selected","true"),this.globalStylesObserver&&this.globalStylesObserver.disconnect(),this.globalStylesObserver=new MutationObserver(()=>{const t=this.readCurrentPageSettings();t&&(this._lastKnownPageSettings=t)}),this.globalStylesObserver.observe(e,{attributes:!0,attributeFilter:["class","style","data-meta-title","data-meta-description"]}),await o.nextTick())}stopGlobalStylesSync(){this.globalStylesObserver&&(this.globalStylesObserver.disconnect(),this.globalStylesObserver=null)}handleFontWeight(e){this.applyElementClassChanges(e,lr.fontWeight,"setFontWeight")}handleFontSizeBase(e){this.applyElementClassChanges(e,vi.fontBase,"setFontBase")}handleFontSizeDesktop(e){const t=this.getElement.value;if(!t)return;const i={"pbx-text-9xl":"pbx-text-6xl","pbx-text-8xl":"pbx-text-5xl","pbx-text-7xl":"pbx-text-4xl","pbx-text-6xl":"pbx-text-3xl","pbx-text-5xl":"pbx-text-3xl","pbx-text-4xl":"pbx-text-2xl","pbx-text-3xl":"pbx-text-xl","pbx-text-2xl":"pbx-text-lg","pbx-text-xl":"pbx-text-base","pbx-text-lg":"pbx-text-sm","pbx-text-base":"pbx-text-xs","pbx-text-sm":"pbx-text-xs","pbx-text-xs":"pbx-text-xs"};if(e){Array.from(t.classList).forEach(p=>{this.fontSizeRegex.test(p)&&t.classList.remove(p)});const a=e.replace(/^lg:/,""),l=i[a]||a,s=`lg:${a}`;l!==a?t.classList.add(l,s):t.classList.add(l)}const n=vi.fontDesktop.find(a=>t.classList.contains(a));e||this.pageBuilderStateStore.setFontDesktop("none"),n&&!e&&this.pageBuilderStateStore.setFontDesktop(n)}ensureImagesHaveAltText(e){e.tagName==="IMG"&&!e.hasAttribute("alt")&&e.setAttribute("alt","image"),e.querySelectorAll("img:not([alt])").forEach(t=>{t.setAttribute("alt","image")})}applyHelperCSSToElements(e){if(this.wrapElementInDivIfExcluded(e),this.ensureImagesHaveAltText(e),e.tagName==="DIV"&&e.children.length===1&&["H1","H2","H3","H4","H5","H6"].includes(e.children[0].tagName)){const t=e.children[0];Array.from(e.classList).some(n=>this.fontSizeRegex.test(n))||(t.tagName==="H2"&&e.classList.add("pbx-text-3xl","lg:pbx-text-4xl","pbx-font-medium"),t.tagName==="H3"&&e.classList.add("pbx-text-2xl","lg:pbx-text-3xl","pbx-font-medium"),t.tagName==="H4"&&e.classList.add("pbx-text-xl","lg:pbx-text-2xl","pbx-font-medium"),t.tagName==="H5"&&e.classList.add("pbx-text-lg","lg:pbx-text-xl","pbx-font-medium"),t.tagName==="H6"&&e.classList.add("pbx-text-base","lg:pbx-text-base","pbx-font-medium"))}}async toggleTipTapModal(e){this.pageBuilderStateStore.setShowModalTipTap(e),await o.nextTick(),await this.addListenersToEditableElements(),e||await this.handleAutoSave()}async toggleInlineTipTapEditor(e){e&&!this.isValidTextElement(this.getElement.value)||(this.pageBuilderStateStore.setInlineTipTapEditor(e),await o.nextTick(),await this.addListenersToEditableElements(),e||(this.commitActiveInlineTipTapEditorSync(),this.saveDomComponentsToLocalStorage()))}async finishInlineTipTapEditor(e,t=!0){if(this.pageBuilderStateStore.setInlineTipTapEditor(!1),await o.nextTick(),e){const i=document.querySelector("#pagebuilder");i==null||i.querySelectorAll("[hovered]").forEach(n=>n.removeAttribute("hovered")),i==null||i.querySelectorAll("[selected]").forEach(n=>{n!==e&&n.removeAttribute("selected")}),e.removeAttribute("data-pbx-inline-tiptap"),e.setAttribute("selected",""),this.pageBuilderStateStore.setElement(e)}await o.nextTick(),await this.addListenersToEditableElements(),await this.initializeElementStyles(),await this.addListenersToEditableElements(),t&&(this.commitActiveInlineTipTapEditorSync(),this.saveDomComponentsToLocalStorage())}wrapElementInDivIfExcluded(e){var t;if(e&&this.NoneListernesTags.includes(e.tagName)&&(e.previousElementSibling&&e.previousElementSibling.tagName==="IMG"||e.nextElementSibling&&e.nextElementSibling.tagName==="IMG")){const i=document.createElement("div");(t=e.parentNode)==null||t.insertBefore(i,e),i.appendChild(e)}}isEditableElement(e){return!e||e.tagName!=="IMG"&&e.closest("[data-pb-no-select]")?!1:!this.NoneListernesTags.includes(e.tagName)}getSelectedComponentSection(){const e=this.getElement.value;return!e||!(e instanceof HTMLElement)?null:e.closest("section")}isSelectedComponentTopElement(){const e=this.getElement.value,t=this.getSelectedComponentSection();return!e||!t?!1:e.parentElement===t}selectedComponentIsFullWidth(){var e;return((e=this.getSelectedComponentSection())==null?void 0:e.classList.contains(ds))??!1}async setSelectedComponentFullWidth(e){const t=this.getSelectedComponentSection();t&&(t.classList.toggle(ds,e),await this.handleAutoSave())}isSelectedProductSection(){const e=this.getSelectedComponentSection();return(e==null?void 0:e.getAttribute("data-pbx-product-section"))==="true"}getSelectedProductSectionOptions(){const e=this.getSelectedComponentSection();return!e||!this.isSelectedProductSection()?{...Yt}:kJ(e)}getSelectedProductSectionContentAvailability(){const e=this.getSelectedComponentSection();return!e||!this.isSelectedProductSection()?{hasPrices:!1,hasImages:!1,hasButtons:!1,hasLinks:!1}:{hasPrices:hJ(e),hasImages:xJ(e),hasButtons:fJ(e),hasLinks:yJ(e)}}async updateSelectedProductSection(e){const t=this.getSelectedComponentSection();!t||!this.isSelectedProductSection()||(TJ(t,e),await this.handleAutoSave())}isGlobalFullWidth(){const e=document.querySelector("#pagebuilder");return(e==null?void 0:e.classList.contains(ds))??!1}async setGlobalFullWidth(e){const t=document.querySelector("#pagebuilder");t==null||t.classList.toggle(ds,e),this.saveDomComponentsToLocalStorage(),await this.handleAutoSave()}isSelectedElementImage(){var e;return((e=this.getElement.value)==null?void 0:e.tagName)==="IMG"}setImageSettingsModalOpen(e){this.pageBuilderStateStore.setImageSettingsPanelOpen(e)}isImageSettingsModalOpen(){return this.pageBuilderStateStore.getImageSettingsPanelOpen}findImageAspectClass(e){const t=cc.aspectRatio.find(n=>n!=="none"&&e.classList.contains(n));return t||(Array.from(e.classList).find(n=>n.startsWith("pbx-aspect-"))??null)}removeImageAspectClasses(e){Array.from(e.classList).forEach(t=>{t.startsWith("pbx-aspect-")&&e.classList.remove(t)})}handleImageObjectFit(e){this.applyElementClassChanges(e,cc.objectFit,"setImageObjectFit")}handleImageObjectPosition(e){this.applyElementClassChanges(e,cc.objectPosition,"setImageObjectPosition")}handleImageAspectRatio(e){const t=this.getElement.value;if(!(!t||t.tagName!=="IMG")){if(e===void 0){const i=this.findImageAspectClass(t);this.pageBuilderStateStore.setImageAspectRatio(i||"none");return}this.removeImageAspectClasses(t),e!=="none"&&t.classList.add(e),this.pageBuilderStateStore.setImageAspectRatio(e),this.pageBuilderStateStore.setElement(t)}}async handleImageAltText(e){const t=this.getElement.value;if(!t||t.tagName!=="IMG"||e===void 0)return;const i=e.trim();i?t.setAttribute("alt",i):t.removeAttribute("alt"),this.pageBuilderStateStore.setElement(t),await this.handleAutoSave()}getSelectedImageAltText(){const e=this.getElement.value;return!e||e.tagName!=="IMG"?"":e.getAttribute("alt")||""}attachCanvasInlineEditListeners(e){this.canvasClickCaptureListener&&e.removeEventListener("click",this.canvasClickCaptureListener,!0),this.canvasDblClickCaptureListener&&e.removeEventListener("dblclick",this.canvasDblClickCaptureListener,!0),this.canvasClickCaptureListener=t=>{this.handleCanvasClickCapture(t)},this.canvasDblClickCaptureListener=t=>{this.handleCanvasDoubleClickCapture(t)},e.addEventListener("click",this.canvasClickCaptureListener,!0),e.addEventListener("dblclick",this.canvasDblClickCaptureListener,!0)}findEditableElementFromEventTarget(e){if(!(e instanceof Element))return null;const t=document.querySelector("#pagebuilder");let i=e;for(;i&&i!==t;){if(i instanceof HTMLElement&&this.isEditableElement(i))return i;i=i.parentElement}return null}async openInlineTipTapFromEvent(e){if(this.pageBuilderStateStore.getImageSettingsPanelOpen||(this.pageBuilderStateStore.getInlineTipTapEditor&&!this.hasInlineTipTapElement()&&this.pageBuilderStateStore.setInlineTipTapEditor(!1),this.pageBuilderStateStore.getInlineTipTapEditor))return;const t=this.findEditableElementFromEventTarget(e.target);if(!t||!this.isValidTextElement(t)){e.target instanceof Element&&(e.target.tagName==="IMG"||e.target.closest("img"))&&e.stopPropagation();return}e.preventDefault(),e.stopPropagation(),this.pageBuilderStateStore.setElement(t),this.pageBuilderStateStore.setInlineTipTapEditor(!0),await this.openInlineTipTapForElement(t)}hasInlineTipTapElement(){return!!document.querySelector("#pagebuilder [data-pbx-inline-tiptap]")}commitActiveInlineTipTapEditorSync(){const e=document.querySelector("#pagebuilder [data-pbx-inline-tiptap]");if(!e)return null;const t=e.querySelector(".ProseMirror"),i=e.getAttribute("data-pbx-inline-original-html")??"",n=this.pageBuilderStateStore.getTextAreaVueModel,a=typeof n=="string"&&n.trim().length>0?n:(t==null?void 0:t.innerHTML)??e.innerHTML,l=Ud(a,i);return e.innerHTML=l,e.removeAttribute("data-pbx-inline-tiptap"),e.removeAttribute("data-pbx-inline-original-html"),this.pageBuilderStateStore.setTextAreaVueModel(l),this.pageBuilderStateStore.setInlineTipTapEditor(!1),e}flushPendingEditsToLocalStorage(){this.commitActiveInlineTipTapEditorSync(),this.saveDomComponentsToLocalStorage()}async finishActiveInlineTipTapEditorFromDom(e=null){const t=this.commitActiveInlineTipTapEditorSync();if(!t){await this.toggleInlineTipTapEditor(!1);return}this.pageBuilderStateStore.setElement(t),await this.finishInlineTipTapEditor(t,!1),e&&e!==t&&await this.selectEditableElement(e,!1),this.saveDomComponentsToLocalStorage(),this.handleAutoSave()}async openInlineTipTapForElement(e){this.isValidTextElement(e)&&(await this.selectEditableElement(e,!1),await o.nextTick(),await this.addListenersToEditableElements())}async selectEditableElement(e,t=!0){const i=document.querySelector("#pagebuilder");if(!i){this.debugLog("warn","selectEditableElement(): #pagebuilder missing; cannot select/save",{elementTag:e==null?void 0:e.tagName,elementId:(e==null?void 0:e.id)??null,key:this.getLocalStorageItemName.value});return}this.pageBuilderStateStore.setMenuRight(!0);const n=i.querySelector("[selected]");if(n&&n.removeAttribute("selected"),e.removeAttribute("hovered"),e.setAttribute("selected",""),this.pageBuilderStateStore.setElement(e),await o.nextTick(),await this.initializeElementStyles(),t){const a=this.pageBuilderStateStore.getPageBuilderConfig,l=a&&a.userSettings?a.userSettings.autoSave:void 0;this.saveDomComponentsToLocalStorage(),l!==!1&&this.handleAutoSave()}}getHistoryBaseKey(){return this.getLocalStorageItemName.value}initializeHistory(){const e=this.getHistoryBaseKey();if(e){const t=Li.getHistory(e);this.pageBuilderStateStore.setHistoryIndex(t.length-1),this.pageBuilderStateStore.setHistoryLength(t.length)}}cloneCompObjForDOMInsertion(e){const t={...e},i=document.querySelector("#page-builder-wrapper");i&&this.getComponentArrayAddMethod.value==="unshift"&&i.scrollTo({top:0,behavior:"smooth"});const a=new DOMParser().parseFromString(t.html_code||"","text/html");a.querySelectorAll("*").forEach(p=>{this.applyHelperCSSToElements(p)});const s=a.querySelector("section");return s&&(s.querySelectorAll("[class]").forEach(p=>{p.setAttribute("class",this.addTailwindPrefixToClasses(p.getAttribute("class")||"","pbx-"))}),s.dataset.componentid=Dz(),t.title&&s.setAttribute("data-component-title",t.title),t.id=s.dataset.componentid,t.html_code=s.outerHTML),t}async removeHoveredAndSelected(){const e=document.querySelector("#pagebuilder");if(!e)return;const t=e.querySelector("[hovered]");t&&t.removeAttribute("hovered");const i=e.querySelector("[selected]");i&&i.removeAttribute("selected")}async syncCurrentClasses(){var t;const e=Array.from(((t=this.getElement.value)==null?void 0:t.classList)||[]);this.pageBuilderStateStore.setCurrentClasses(e)}async syncCurrentStyles(){var t;const e=(t=this.getElement.value)==null?void 0:t.getAttribute("style");if(e){const i=this.parseStyleString(e);this.pageBuilderStateStore.setCurrentStyles(i)}else this.pageBuilderStateStore.setCurrentStyles({})}handleAddClasses(e){var t,i;if(typeof e=="string"&&e.trim()!==""&&!e.includes(" ")&&!((t=this.getElement.value)!=null&&t.classList.contains("pbx-"+e.trim()))){const n=e.trim(),a=n.startsWith("pbx-")?n:"pbx-"+n;(i=this.getElement.value)==null||i.classList.add(a),this.pageBuilderStateStore.setElement(this.getElement.value),this.pageBuilderStateStore.setClass(a)}}handleAddStyle(e,t){const i=this.getElement.value;!i||!e||!t||(i.style.setProperty(e,t),this.pageBuilderStateStore.setElement(i))}handleRemoveStyle(e){const t=this.getElement.value;!t||!e||(t.style.removeProperty(e),this.pageBuilderStateStore.setElement(t))}handleFontFamily(e){var i;const t=bD((i=this.pageBuilderStateStore.getPageBuilderConfig)==null?void 0:i.userSettings);this.applyElementClassChanges(e,t,"setFontFamily")}handleFontStyle(e){this.applyElementClassChanges(e,lr.fontStyle,"setFontStyle")}purgeConflictingClasses(e){const t=this.getElement.value;t&&e.forEach(i=>{i.forEach(n=>{n!=="none"&&t.classList.contains(n)&&t.classList.remove(n)})})}handleVerticalPadding(e){e!==void 0&&this.purgeConflictingClasses([ce.topPadding,ce.bottomPadding]),this.applyElementClassChanges(e,ce.verticalPadding,"setFontVerticalPadding")}handleHorizontalPadding(e){e!==void 0&&this.purgeConflictingClasses([ce.leftPadding,ce.rightPadding]),this.applyElementClassChanges(e,ce.horizontalPadding,"setFontHorizontalPadding")}handleTopPadding(e){e!==void 0&&this.purgeConflictingClasses([ce.verticalPadding]),this.applyElementClassChanges(e,ce.topPadding,"setFontTopPadding")}handleRightPadding(e){e!==void 0&&this.purgeConflictingClasses([ce.horizontalPadding]),this.applyElementClassChanges(e,ce.rightPadding,"setFontRightPadding")}handleBottomPadding(e){e!==void 0&&this.purgeConflictingClasses([ce.verticalPadding]),this.applyElementClassChanges(e,ce.bottomPadding,"setFontBottomPadding")}handleLeftPadding(e){e!==void 0&&this.purgeConflictingClasses([ce.horizontalPadding]),this.applyElementClassChanges(e,ce.leftPadding,"setFontLeftPadding")}handleVerticalMargin(e){e!==void 0&&this.purgeConflictingClasses([ce.topMargin,ce.bottomMargin]),this.applyElementClassChanges(e,ce.verticalMargin,"setFontVerticalMargin")}handleHorizontalMargin(e){e!==void 0&&this.purgeConflictingClasses([ce.leftMargin,ce.rightMargin]),this.applyElementClassChanges(e,ce.horizontalMargin,"setFontHorizontalMargin")}handleTopMargin(e){e!==void 0&&this.purgeConflictingClasses([ce.verticalMargin]),this.applyElementClassChanges(e,ce.topMargin,"setFontTopMargin")}handleRightMargin(e){e!==void 0&&this.purgeConflictingClasses([ce.horizontalMargin]),this.applyElementClassChanges(e,ce.rightMargin,"setFontRightMargin")}handleBottomMargin(e){e!==void 0&&this.purgeConflictingClasses([ce.verticalMargin]),this.applyElementClassChanges(e,ce.bottomMargin,"setFontBottomMargin")}handleLeftMargin(e){e!==void 0&&this.purgeConflictingClasses([ce.horizontalMargin]),this.applyElementClassChanges(e,ce.leftMargin,"setFontLeftMargin")}handleBorderStyle(e){this.applyElementClassChanges(e,Bi.borderStyle,"setBorderStyle")}handleBorderWidth(e){this.applyElementClassChanges(e,Bi.borderWidth,"setBorderWidth")}handleBorderColor(e){this.applyElementClassChanges(e,Bi.borderColor,"setBorderColor")}handleBackgroundColor(e){var t,i;if(e===void 0){const n=(t=this.getElement.value)==null?void 0:t.style.getPropertyValue("background-color");if(n){this.pageBuilderStateStore.setBackgroundColor(`custom:${Kt(n)??n}`);return}}else(i=this.getElement.value)==null||i.style.removeProperty("background-color");this.applyElementClassChanges(e,Ti.backgroundColorVariables,"setBackgroundColor")}handleCustomBackgroundColor(e){const t=this.getElement.value;!t||!e||(this.removeElementClassesFromArray(t,Ti.backgroundColorVariables),t.style.setProperty("background-color",e),this.pageBuilderStateStore.setBackgroundColor(`custom:${e}`),this.pageBuilderStateStore.setElement(t))}handleTextColor(e){var t,i;if(e===void 0){const n=(t=this.getElement.value)==null?void 0:t.style.getPropertyValue("color");if(n){this.pageBuilderStateStore.setTextColor(`custom:${Kt(n)??n}`);return}}else(i=this.getElement.value)==null||i.style.removeProperty("color");this.applyElementClassChanges(e,Ti.textColorVariables,"setTextColor")}handleCustomTextColor(e){const t=this.getElement.value;!t||!e||(this.removeElementClassesFromArray(t,Ti.textColorVariables),t.style.setProperty("color",e),this.pageBuilderStateStore.setTextColor(`custom:${e}`),this.pageBuilderStateStore.setElement(t))}handleBorderRadiusGlobal(e){this.applyElementClassChanges(e,vt.roundedGlobal,"setBorderRadiusGlobal")}handleBorderRadiusTopLeft(e){this.applyElementClassChanges(e,vt.roundedTopLeft,"setBorderRadiusTopLeft")}handleBorderRadiusTopRight(e){this.applyElementClassChanges(e,vt.roundedTopRight,"setBorderRadiusTopRight")}handleBorderRadiusBottomleft(e){this.applyElementClassChanges(e,vt.roundedBottomLeft,"setBorderRadiusBottomleft")}handleBorderRadiusBottomRight(e){this.applyElementClassChanges(e,vt.roundedBottomRight,"setBorderRadiusBottomRight")}handleFontSizeTablet(e){this.applyElementClassChanges(e,vi.fontTablet,"setFontTablet")}handleFontSizeMobile(e){this.applyElementClassChanges(e,vi.fontMobile,"setFontMobile")}handleBackgroundOpacity(e){this.applyElementClassChanges(e,ss.backgroundOpacities,"setBackgroundOpacity")}handleOpacity(e){this.applyElementClassChanges(e,ss.opacities,"setOpacity")}deleteAllComponentsFromDOM(){this.pageBuilderStateStore.setComponents([]);const e=document.querySelector("#pagebuilder");e&&e.querySelectorAll("section[data-componentid]").forEach(t=>t.remove())}async undo(){this.pageBuilderStateStore.setIsLoadingGlobal(!0),await Oe(300);const e=this.getHistoryBaseKey();if(!e)return;const t=Li.getHistory(e);if(t.length>1&&this.pageBuilderStateStore.getHistoryIndex>0){this.pageBuilderStateStore.setHistoryIndex(this.pageBuilderStateStore.getHistoryIndex-1);const i=t[this.pageBuilderStateStore.getHistoryIndex],n=this.renderComponentsToHtml(i.components);await this.mountComponentsToDOM(n,!1,i.pageSettings)}this.pageBuilderStateStore.setIsLoadingGlobal(!1)}async redo(){this.pageBuilderStateStore.setIsLoadingGlobal(!0),await Oe(300);const e=this.getHistoryBaseKey();if(!e)return;const t=Li.getHistory(e);if(t.length>0&&this.pageBuilderStateStore.getHistoryIndex<t.length-1){this.pageBuilderStateStore.setHistoryIndex(this.pageBuilderStateStore.getHistoryIndex+1);const i=t[this.pageBuilderStateStore.getHistoryIndex],n=this.renderComponentsToHtml(i.components);await this.mountComponentsToDOM(n,!1,i.pageSettings)}this.pageBuilderStateStore.setIsLoadingGlobal(!1)}hasVisibleContent(e){if(!e)return!1;if(e.querySelector("img, video, iframe, input, button, a, h1, h2, h3, h4, h5, h6, p, li, blockquote, pre, code, table"))return!0;const i=document.createTreeWalker(e,NodeFilter.SHOW_TEXT,null);for(;i.nextNode();)if(i.currentNode.nodeValue&&i.currentNode.nodeValue.trim()!=="")return!0;return!1}isSectionEmpty(e){return!this.hasVisibleContent(e)}findReverseableContainer(){const e=this.getSelectedComponentSection();if(!e)return null;const t=['[class*="flex-row"]','[class*="pbx-flex-row"]','[class*="grid-cols-2"]','[class*="pbx-grid-cols-2"]'];for(const i of t){const n=Array.from(e.querySelectorAll(i));for(const a of n)if(Array.from(a.children).filter(s=>s instanceof HTMLElement).length===2)return a}return null}async reverseComponentLayout(){const e=this.findReverseableContainer();if(!e)return;const t=Array.from(e.children);t.length===2&&(e.insertBefore(t[1],t[0]),await this.syncDomToStoreOnly(),await o.nextTick(),this.saveDomComponentsToLocalStorage(),await this.handleAutoSave(),this.pageBuilderStateStore.setComponent(null),this.pageBuilderStateStore.setElement(null),await this.clearHtmlSelection(),await o.nextTick(),await this.addListenersToEditableElements())}async duplicateComponent(){await this.syncDomToStoreOnly(),await o.nextTick();const e=this.pageBuilderStateStore.getComponents,t=this.getComponent.value;if(!e||!t)return;const i=e.findIndex(l=>l.id===t.id);if(i===-1)return;const n=this.cloneCompObjForDOMInsertion(e[i]),a=[...e.slice(0,i+1),n,...e.slice(i+1)];await this.setComponentsPreservingPageSettings(a),await o.nextTick(),await this.addListenersToEditableElements(),this.pageBuilderStateStore.setComponent(n),this.pageBuilderStateStore.setElement(null),await this.handleAutoSave()}async deleteComponentFromDOM(){await this.syncDomToStoreOnly(),await o.nextTick();const e=this.pageBuilderStateStore.getComponents;if(!e)return;const t=e.findIndex(n=>this.getComponent.value?n.id===this.getComponent.value.id:!1);if(t===-1)return;const i=[...e.slice(0,t),...e.slice(t+1)];await this.setComponentsPreservingPageSettings(i),await o.nextTick(),await this.addListenersToEditableElements(),this.pageBuilderStateStore.setComponent(null),this.pageBuilderStateStore.setElement(null),await this.handleAutoSave()}async duplicateElementInDOM(){const e=this.getElement.value;if(!e||!e.parentNode)return;e.removeAttribute("selected");const t=e.cloneNode(!0);e.parentNode.insertBefore(t,e.nextSibling),await this.syncDomToStoreOnly(),await this.addListenersToEditableElements(),this.pageBuilderStateStore.setComponent(null),this.pageBuilderStateStore.setElement(null),this.saveDomComponentsToLocalStorage(),await this.handleAutoSave()}async deleteElementFromDOM(){const e=this.getElement.value;if(!e)return;if(e.removeAttribute("selected"),!e.parentNode){this.pageBuilderStateStore.setComponent(null),this.pageBuilderStateStore.setElement(null);return}const t=e.closest("section");e.tagName==="SECTION"?await this.deleteComponentFromDOM():(e.remove(),t&&this.isSectionEmpty(t)&&t.remove(),await this.syncDomToStoreOnly(),this.saveDomComponentsToLocalStorage()),this.pageBuilderStateStore.setComponent(null),this.pageBuilderStateStore.setElement(null),await this.clearHtmlSelection(),await o.nextTick(),await this.addListenersToEditableElements()}handleRemoveClasses(e){var t,i;(t=this.getElement.value)!=null&&t.classList.contains(e)&&((i=this.getElement.value)==null||i.classList.remove(e),this.pageBuilderStateStore.setElement(this.getElement.value),this.pageBuilderStateStore.removeClass(e))}async reorderComponent(e){if(!this.getComponents.value||!this.getComponent.value||this.getComponents.value.length<=1)return;const t=this.getComponent.value,i=this.getComponents.value.findIndex(s=>s.id===t.id);if(i===-1)return;const n=i+e;if(n<0||n>=this.getComponents.value.length)return;this.getComponents.value.splice(i,1),this.getComponents.value.splice(n,0,t),await o.nextTick();const a=document.querySelector("#page-builder-wrapper"),l=a==null?void 0:a.querySelector(`section[data-componentid="${t.id}"]`);if(l){l.classList.add("pbx-reorder-highlight");const s=l.previousElementSibling,p=l.nextElementSibling;s&&s.tagName==="SECTION"&&s.classList.add("pbx-sibling-highlight"),p&&p.tagName==="SECTION"&&p.classList.add("pbx-sibling-highlight"),a&&($pe(a,l),window.setTimeout(()=>{l.classList.remove("pbx-reorder-highlight"),s&&s.tagName==="SECTION"&&s.classList.remove("pbx-sibling-highlight"),p&&p.tagName==="SECTION"&&p.classList.remove("pbx-sibling-highlight")},280))}}canMoveUp(){return!this.getComponents.value||!this.getComponent.value?!1:this.getComponents.value.findIndex(t=>{var i;return t.id===((i=this.getComponent.value)==null?void 0:i.id)})>0}canMoveDown(){return!this.getComponents.value||!this.getComponent.value?!1:this.getComponents.value.findIndex(t=>{var i;return t.id===((i=this.getComponent.value)==null?void 0:i.id)})<this.getComponents.value.length-1}ElOrFirstChildIsIframe(){var e,t,i;return((e=this.getElement.value)==null?void 0:e.tagName)==="IFRAME"||((i=(t=this.getElement.value)==null?void 0:t.firstElementChild)==null?void 0:i.tagName)==="IFRAME"}isValidTextElement(e){var n;if(!e||e.hasAttribute("data-pb-no-inline-text")||e.tagName==="IMG"||((n=e.firstElementChild)==null?void 0:n.tagName)==="IFRAME"||e.querySelector("img")||e.classList.contains("pbx-product-card-image")||e.classList.contains("product-card-image"))return!1;const t=e.children;if(!t.length)return!1;let i=!1;return Array.from(t).forEach(a=>{a.tagName==="IMG"||a.tagName==="DIV"?i=!1:i=!0}),i}isSelectedElementValidText(){return this.isValidTextElement(this.getElement.value)}previewCurrentDesign(){this.pageBuilderStateStore.setElement(null);const e=document.querySelector("#pagebuilder");if(e&&e){const t=Ez(e,this.pageBuilderStateStore.getPageBuilderConfig?this.pageBuilderStateStore.getPageBuilderConfig:void 0),i=JSON.stringify([t]);this.pageBuilderStateStore.setCurrentLayoutPreview(i)}}sanitizeForLocalStorage(e){return e.trim().toLowerCase().replace(/\s+/g,"-").replace(/[^a-z0-9-]/g,"").replace(/-+/g,"-").replace(/^-+|-+$/g,"")}cloneAndRemoveSelectionAttributes(e){const t=e.cloneNode(!0);return t.querySelectorAll("[hovered]").forEach(i=>i.removeAttribute("hovered")),t.querySelectorAll("[selected]").forEach(i=>i.removeAttribute("selected")),t.removeAttribute("hovered"),t.removeAttribute("selected"),t}async syncDomToStoreOnly(){const e=document.querySelector("#pagebuilder");if(!e)return;const t=[];e.querySelectorAll("section[data-componentid]").forEach(i=>{const n=this.cloneAndRemoveSelectionAttributes(i);t.push({html_code:n.outerHTML,id:n.getAttribute("data-componentid"),title:n.getAttribute("data-component-title")||"Untitled Component"})}),await this.setComponentsPreservingPageSettings(t)}async generateHtmlFromComponents(){await this.syncDomToStoreOnly(),await o.nextTick();const e=this.pageBuilderStateStore.getComponents;return Array.isArray(e)?(await o.nextTick(),await this.addListenersToEditableElements(),e.map(t=>t.html_code.replace(/data-componentid="[^"]*"/g,"").replace(/\s{2,}/g," ")).join(`
415
+ `)):""}async generateFullPageHtml(){await this.syncDomToStoreOnly(),await o.nextTick();const e=this.pageBuilderStateStore.getComponents;if(!Array.isArray(e))return"";await o.nextTick(),await this.addListenersToEditableElements();const t=this.readCurrentPageSettings()??this._lastKnownPageSettings,i=document.createElement("div");if(i.setAttribute("id","pagebuilder"),t!=null&&t.classes&&i.setAttribute("class",t.classes),t!=null&&t.style){const n=typeof t.style=="string"?t.style:this.convertStyleObjectToString(t.style)||"";n&&i.setAttribute("style",n)}return uc(i,Rn(t)),e.forEach(n=>{const s=new DOMParser().parseFromString(n.html_code,"text/html").querySelector("section");if(s){s.removeAttribute("data-componentid"),i.appendChild(document.importNode(s,!0));return}i.insertAdjacentHTML("beforeend",n.html_code)}),i.outerHTML}saveDomComponentsToLocalStorage(){this.commitActiveInlineTipTapEditorSync(),this.getLocalStorageItemName.value||this.updateLocalStorageItemName();const e=this.getLocalStorageItemName.value;e||this.debugLog("warn","saveDomComponentsToLocalStorage(): no storage key resolved",{config:this.pageBuilderStateStore.getPageBuilderConfig??null});const t=document.querySelector("#pagebuilder");if(!t){this.debugLog("warn","saveDomComponentsToLocalStorage(): no #pagebuilder in DOM",{key:e});return}const i=t.querySelector("[hovered]");i&&i.removeAttribute("hovered");const n=[];t.querySelectorAll("section[data-componentid]").forEach(d=>{const c=this.cloneAndRemoveSelectionAttributes(d);c.removeAttribute("data-componentid"),n.push({html_code:c.outerHTML,title:c.getAttribute("data-component-title")||"Untitled Component"})}),this.debugLog("warn","saveDomComponentsToLocalStorage(): collected sections",{key:e,sections:n.length,hasSelected:!!t.querySelector("[selected]"),hasInlineTipTap:!!t.querySelector("[data-pbx-inline-tiptap]")});const a=this.readCurrentPageSettings()??this._lastKnownPageSettings??{classes:"",style:""},l=this.pageBuilderStateStore.getPageBuilderConfig;l&&typeof l=="object"&&this.pageBuilderStateStore.setPageBuilderConfig({...l,pageSettings:a}),this.debugLog("warn","saveDomComponentsToLocalStorage(): pageSettings snapshot",{classes:(a==null?void 0:a.classes)??"",style:typeof(a==null?void 0:a.style)=="string"?a.style:a!=null&&a.style?this.convertStyleObjectToString(a.style):""});const s={components:n,pageBuilderContentSavedAt:new Date().toISOString(),pageSettings:a},p=this.getHistoryBaseKey();if(p){const d=localStorage.getItem(p);this.debugLog("warn","saveDomComponentsToLocalStorage(): existing key?",{baseKey:p,hasExisting:!!d});try{localStorage.setItem(p,JSON.stringify(s))}catch(c){this.debugLog("error","saveDomComponentsToLocalStorage(): localStorage.setItem failed",{baseKey:p,err:c});return}if(d){const c=JSON.parse(d),b=c.components||[],m=s.components||[],g=m.length!==b.length||m.some((u,h)=>{const f=b[h];return!f||f.html_code!==u.html_code}),x=c.pageSettings&&c.pageSettings.classes!==s.pageSettings.classes||c.pageSettings&&c.pageSettings.style!==s.pageSettings.style;if(g||x){this.debugLog("error","saveDomComponentsToLocalStorage(): wrote draft",{baseKey:p,sections:s.components.length});let u=Li.getHistory(p);const h=u[u.length-1];if(h){const f=JSON.stringify(h.components),w=JSON.stringify(s.components),y=JSON.stringify(h.pageSettings),E=JSON.stringify(s.pageSettings);if(f===w&&y===E)return}this.pageBuilderStateStore.getHistoryIndex<u.length-1&&(u=u.slice(0,this.pageBuilderStateStore.getHistoryIndex+1)),u.push(s),u.length>10&&(u=u.slice(u.length-10)),localStorage.setItem(p+"-history",JSON.stringify(u)),this.pageBuilderStateStore.setHistoryIndex(u.length-1),this.pageBuilderStateStore.setHistoryLength(u.length);return}}}}async removeCurrentComponentsFromLocalStorage(){this.updateLocalStorageItemName(),await o.nextTick();const e=this.getLocalStorageItemName.value;e&&localStorage.removeItem(e)}async handleFormSubmission(){const e=this.readCurrentPageSettings();if(e&&(this._lastKnownPageSettings=e),await this.removeCurrentComponentsFromLocalStorage(),this.deleteAllComponentsFromDOM(),this.pageBuilderStateStore.setComponents([]),e){this.updateLocalStorageItemName();const t=this.getLocalStorageItemName.value;if(t){const i={components:[],pageBuilderContentSavedAt:new Date().toISOString(),pageSettings:e};localStorage.setItem(t,JSON.stringify(i))}}}readCurrentPageSettings(){const e=document.querySelector("#pagebuilder");if(e)return{classes:e.className||"",style:e.getAttribute("style")||e.style.cssText||"",meta:ps(e)};const t=document.querySelector("[data-pagebuilder-content]");if(t)return{classes:t.className||"",style:t.getAttribute("style")||t.style.cssText||""};this.updateLocalStorageItemName();const i=this.getLocalStorageItemName.value;if(i)try{const n=localStorage.getItem(i);if(n){const a=JSON.parse(n);if(a!=null&&a.pageSettings)return a.pageSettings}}catch{}return null}applyPageSettingsToPage(e){const t=document.querySelector("#pagebuilder");if(t){e.classes?t.setAttribute("class",e.classes):t.removeAttribute("class");const i=typeof e.style=="string"?e.style:this.convertStyleObjectToString(e.style)||"";i?t.setAttribute("style",i):t.removeAttribute("style"),uc(t,Rn(e))}document.querySelectorAll("[data-pagebuilder-content]").forEach(i=>{i.removeAttribute("class"),i.removeAttribute("style")}),(e.classes||e.style||e.meta)&&(this._lastKnownPageSettings=e)}reconnectGlobalStylesObserver(){if(!this.globalStylesObserver)return;const e=document.querySelector("#pagebuilder");e&&(this.globalStylesObserver.disconnect(),this.globalStylesObserver=new MutationObserver(()=>{const t=this.readCurrentPageSettings();t&&(this._lastKnownPageSettings=t)}),this.globalStylesObserver.observe(e,{attributes:!0,attributeFilter:["class","style","data-meta-title","data-meta-description"]}))}async setComponentsPreservingPageSettings(e){var n;const t=this.readCurrentPageSettings()??this._lastKnownPageSettings??null,i=this.globalStylesObserver!==null;(n=this.globalStylesObserver)==null||n.disconnect(),this.pageBuilderStateStore.setComponents(e),await o.nextTick(),await o.nextTick(),t&&(t.classes||t.style)&&this.applyPageSettingsToPage(t),i&&this.reconnectGlobalStylesObserver()}parseStyleString(e){return e.split(";").map(t=>t.trim()).filter(Boolean).reduce((t,i)=>{const[n,a]=i.split(":").map(l=>l.trim());return n&&a&&(t[n]=a),t},{})}deleteOldPageBuilderLocalStorage(){const e=this.pageBuilderStateStore.getPageBuilderConfig;if((e&&e.updateOrCreate&&e.updateOrCreate.formType)==="update"){let i=0;const n=[],a=new Date(Date.now()-336*60*60*1e3);for(let l=0;l<localStorage.length;l++){const s=localStorage.key(l);if(s&&s.startsWith("page-builder-update-resource-"))try{const p=localStorage.getItem(s);if(!p)continue;const c=JSON.parse(p).pageBuilderContentSavedAt;c&&new Date(c)<a&&(i++,n.push({Number:i,Key:s,SavedAt:c}),localStorage.removeItem(s))}catch{}}n.length>0&&(console.info(`Deleted ${n.length} localStorage item(s) older than ${a} days:`),console.table(n))}}startEditing(){this.hasStartedEditing=!0}async refreshListeners(){await o.nextTick(),await this.addListenersToEditableElements(),this.reapplyConfigPageSettingsIfMissing()}reapplyConfigPageSettingsIfMissing(){var a;const e=document.querySelector("#pagebuilder");if(!e)return;const t=((a=this.pageBuilderStateStore.getPageBuilderConfig)==null?void 0:a.pageSettings)??null;if(!this.hasMeaningfulPageSettings(t))return;const i=this.convertStyleObjectToString(t.style),n=e.getAttribute("style")||"";i.trim()&&!n.trim()&&this.applyPageSettingsToPage(t)}async resumeEditingFromDraft(){this.updateLocalStorageItemName();const e=this.getSavedPageHtml();e&&(this.pageBuilderStateStore.setIsLoadingResumeEditing(!0),await Oe(400),await this.mountComponentsToDOM(e),this.pageBuilderStateStore.setIsLoadingResumeEditing(!1)),await o.nextTick(),await this.addListenersToEditableElements(),this.pageBuilderStateStore.setIsLoadingResumeEditing(!1)}async restoreOriginalContent(){if(this.updateLocalStorageItemName(),this.pageBuilderStateStore.setIsRestoring(!0),await Oe(400),Array.isArray(this.originalComponents)){await this.clearClassesFromPage(),await this.clearInlineStylesFromPage();const e=this.renderComponentsToHtml(this.originalComponents);await this.mountComponentsToDOM(e),this.removeCurrentComponentsFromLocalStorage()}await o.nextTick(),await this.addListenersToEditableElements(),this.pageBuilderStateStore.setIsRestoring(!1)}async returnLatestComponents(){return await this.syncDomToStoreOnly(),await o.nextTick(),await this.addListenersToEditableElements(),this.pageBuilderStateStore.getComponents}getStorageItemNameForResource(){return this.getLocalStorageItemName.value}getSavedPageHtml(){if(!this.getLocalStorageItemName.value)return!1;const e=this.getLocalStorageItemName.value;if(!e)return!1;const t=localStorage.getItem(e);if(!t)return!1;const i=JSON.parse(t);if(i&&Array.isArray(i.components)){const n=i.pageSettings&&i.pageSettings.classes||"",a=i.pageSettings&&i.pageSettings.style||"",l=typeof a=="string"?a:this.convertStyleObjectToString(a),s=i.components.map(p=>{const b=new DOMParser().parseFromString(p.html_code,"text/html").querySelector("section");return b?(b.removeAttribute("data-componentid"),b.outerHTML):p.html_code}).join(`
416
416
  `);return`<div id="pagebuilder" class="${n}" style="${l}">
417
417
  ${s}
418
418
  </div>`}return!1}async applySelectedImage(e){this.pageBuilderStateStore.setApplyImageToSelection(e),this.getElement.value&&this.getApplyImageToSelection.value&&this.getApplyImageToSelection.value.src&&(await o.nextTick(),this.pageBuilderStateStore.setBasePrimaryImage(`${this.getApplyImageToSelection.value.src}`),await this.handleAutoSave())}setBasePrimaryImageFromSelectedElement(){if(!this.getElement.value)return;const e=document.createElement("div");e.innerHTML=this.getElement.value.outerHTML;const t=e.getElementsByTagName("img"),i=e.getElementsByTagName("div");if(t.length===1&&i.length===0){this.pageBuilderStateStore.setBasePrimaryImage(t[0].src);return}this.pageBuilderStateStore.setBasePrimaryImage(null)}addHyperlinkToElement(e,t,i){if(!this.getElement.value||!(this.getElement.value instanceof HTMLElement)||typeof this.getElement.value.closest!="function")return;const n=this.getElement.value.closest("a"),a=this.getElement.value.querySelector("a");this.pageBuilderStateStore.setHyperlinkError(null);const l=o.ref(!0);if(e===!0&&t!==null&&(l.value=qd(t)),l.value===!1){this.pageBuilderStateStore.setHyperlinkMessage(null),this.pageBuilderStateStore.setHyperlinkError("URL is not valid");return}if(e===!0&&typeof t=="string"){const s=t.trim();if(a!==null&&s.length!==0){a.href=s,i===!0&&(a.target="_blank"),i===!1&&a.removeAttribute("target"),a.textContent=this.getElement.value.textContent,this.pageBuilderStateStore.setHyperlinkMessage("Succesfully updated element hyperlink"),this.pageBuilderStateStore.setElementContainsHyperlink(!0);return}if(a===null&&s.length!==0&&n===null){const p=document.createElement("a");p.href=s,i===!0&&(p.target="_blank"),p.textContent=this.getElement.value.textContent,this.getElement.value.textContent="",this.getElement.value.appendChild(p),this.pageBuilderStateStore.setHyperlinkMessage("Successfully added hyperlink to element"),this.pageBuilderStateStore.setElementContainsHyperlink(!0);return}}if(e===!1&&t==="removeHyperlink"){const s=this.getElement.value.textContent||"",p=document.createTextNode(s);this.getElement.value.textContent="",this.getElement.value.appendChild(p),this.pageBuilderStateStore.setHyberlinkEnable(!1),this.pageBuilderStateStore.setElementContainsHyperlink(!1)}}checkForHyperlink(){if(!this.getElement.value)return;const e=this.getElement.value.querySelector("a");if(e!==null){this.pageBuilderStateStore.setHyberlinkEnable(!0),this.pageBuilderStateStore.setElementContainsHyperlink(!0),this.pageBuilderStateStore.setHyperlinkInput(e.href),this.pageBuilderStateStore.setHyperlinkMessage(null),this.pageBuilderStateStore.setHyperlinkError(null),e.target==="_blank"&&this.pageBuilderStateStore.setOpenHyperlinkInNewTab(!0),e.target!=="_blank"&&this.pageBuilderStateStore.setOpenHyperlinkInNewTab(!1);return}this.pageBuilderStateStore.setElementContainsHyperlink(!1),this.pageBuilderStateStore.setHyperlinkInput(""),this.pageBuilderStateStore.setHyperlinkError(null),this.pageBuilderStateStore.setHyperlinkMessage(null),this.pageBuilderStateStore.setHyberlinkEnable(!1)}handleHyperlink(e,t,i){var l;if(this.pageBuilderStateStore.setHyperlinkAbility(!0),!this.getElement.value||!(this.getElement.value instanceof HTMLElement)||typeof this.getElement.value.closest!="function")return;this.getElement.value.closest("a")!==null&&this.pageBuilderStateStore.setHyperlinkAbility(!1);const a=(l=this.getElement.value)==null?void 0:l.tagName.toUpperCase();if(a!=="P"&&a!=="H1"&&a!=="H2"&&a!=="H3"&&a!=="H4"&&a!=="H5"&&a!=="H6"&&this.pageBuilderStateStore.setHyperlinkAbility(!1),e===void 0){this.checkForHyperlink();return}this.addHyperlinkToElement(e,t||null,i||!1)}async addTheme(e){e&&(this.validateMountingHTML(e),await this.mountComponentsToDOM(e)),await this.handleAutoSave()}async replaceTheme(e){const t=e==null?void 0:e.trim();!t||this.validateMountingHTML(t,{logError:!0})||(this.deleteAllComponentsFromDOM(),await this.mountComponentsToDOM(t),await this.handleAutoSave())}getPageMeta(){const e=this.readCurrentPageSettings()??this._lastKnownPageSettings;return Rn(e)}async setPageMeta(e){const i={...this.getPageMeta(),...e},n=document.querySelector("#pagebuilder");n&&uc(n,i);const a=this.readCurrentPageSettings()??this._lastKnownPageSettings??{classes:"",style:""};this._lastKnownPageSettings=Zpe(a,i),await this.handleAutoSave()}async analyzeSEO(){const e=await this.returnLatestComponents();if(!e||!Array.isArray(e)||e.length===0)return{score:0,checks:[]};const t=e.map(S=>S.html_code).filter(S=>S&&S.trim()!=="").join(`